query_id
stringlengths
32
32
query
stringlengths
7
29.6k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
d7a6fd742a3825d72315f50215af983f
28. O functie care primeste ca parametru un array de numere. Aceasta sorteaza ascendent numerele pare si descendent numerele impare, in cadrul aceluiasi array primit ca parameru. ("sortAscDesc")
[ { "docid": "f445b81cda74babe75fa6ca47c370af6", "score": "0.6372135", "text": "function sortAscDesc(arr) {\n let evens = [];\n let odds = [];\n for (let i = arr.length - 1; i >= 0; i--) {\n if (arr[i] % 2 === 0) {\n evens.unshift(arr[i]);\n } else {\n odds.push(arr[i]);\n }\n }\n return evens.sort(sortUpArr).concat(odds.sort(sortDownArr));\n}", "title": "" } ]
[ { "docid": "be30f8e0c68fccbcd93820d34e568051", "score": "0.73861325", "text": "function sortNums(numbers,desc=false) {\n console.log(numbers.sort((a, b) => a - b))\n console.log(numbers.sort((a, b) => b - a))\n }", "title": "" }, { "docid": "6bac7015fdc001a146f64f29206f7e39", "score": "0.71717227", "text": "function sortNumAsc() {\n let array = [9, 2, 0, 5, 3, 6, 1, 7, 8, 4];\n\n for (let i = array.length; i >= 0; i--) {\n for (let j = array.length - 1; j >= 0; j--) {\n if (array[i] > array[j]) {\n let tempNum = array[i];\n array[i] = array[j];\n array[j] = tempNum;\n }\n }\n }\n\n return array;\n}", "title": "" }, { "docid": "40ba43709ff95c3bde8d85d9751ff597", "score": "0.7140569", "text": "function sortDesc(arrayNr) {\n\tfor(let i=0; i<arrayNr.length-1; ++i) {\n\t\tfor(let j=i+1; j<arrayNr.length; ++j) {\n\t\t\tif(arrayNr[i]<arrayNr[j]) {\n\t\t\t\tlet sw=arrayNr[i];\n\t\t\t\tarrayNr[i]=arrayNr[j];\n\t\t\t\tarrayNr[j]=sw;\n\t\t\t}\n\t\t}\n\t}\n\treturn arrayNr;\n}", "title": "" }, { "docid": "5cf0e3fb4e7ad27d74be22db3e718748", "score": "0.71140367", "text": "function sortNums(numbers,desc=false) {\n numbers.sort(function(a, b){return a-b});\n numbers.sort(function(a, b){return b-a});\n }", "title": "" }, { "docid": "2e2e706cb74071974d85f524b5287668", "score": "0.7105342", "text": "function sortNumbers(arr) {\n arr.sort((a, b) => {\n return a - b;\n });\n return arr;\n}", "title": "" }, { "docid": "c7dd822694b7fa0fdcf49d3f5c8aed76", "score": "0.7075592", "text": "function sortArrayDesc(arr) {\n var num = 0;\n for (var i = 0;i<arr.length;i++){\n for (var j = 0;j<arr.length-i;j++){\n if (arr[j]<arr[j+1]){\n num=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=num;\n }\n }\n }\n return arr;\n}", "title": "" }, { "docid": "1fe642c0175da28f294a45a314e67598", "score": "0.70565677", "text": "function sortNums(numbers,desc=false) {\n if (desc) {\n numbers.sort((a, b) => {return b- a});\n } else {\n numbers.sort((a, b) => {return a - b});\n }\n console.log(numbers);\n}", "title": "" }, { "docid": "4bef063029e64345abcba45e6246175b", "score": "0.6995318", "text": "function sortNumDesc() {\n let array = [9, 2, 0, 5, 3, 6, 1, 7, 8, 4];\n\n for (let i = array.length; i >= 0; i--) {\n for (let j = array.length - 1; j >= 0; j--) {\n if (array[i] < array[j]) {\n let tempNum = array[i];\n array[i] = array[j];\n array[j] = tempNum;\n }\n }\n }\n\n return array;\n}", "title": "" }, { "docid": "a492577a17eb368af4450581d4ade613", "score": "0.6960849", "text": "function numsort(a, b) {return (a - b);}", "title": "" }, { "docid": "766d55d97736facbb7508a54903bfd63", "score": "0.69579244", "text": "function Numsort(a,b) { return a - b; }", "title": "" }, { "docid": "4daf4fccc05d44a4264a05e5291ad995", "score": "0.6935841", "text": "function numSort(a,b) { \n\t\t\t\treturn a - b; \n\t\t\t}", "title": "" }, { "docid": "ae4304d91ecbca6009feec07b51aee9d", "score": "0.69263804", "text": "function sortNumbers(arr, order){\n var a = arr.sort(function(a, b){ return a - b; });\n return order == \"desc\" ? a.reverse() : a;\n }", "title": "" }, { "docid": "fed2077ff0ed73d1407a70db1d54e797", "score": "0.6887076", "text": "function nSort(numArray) {\n return numArray.sort((function (a, b) { return a - b; }));\n}", "title": "" }, { "docid": "72c76efeade16f02a7c2c1f2fcead748", "score": "0.68762743", "text": "function Sort(arr)\n{\n\n}", "title": "" }, { "docid": "736282cd461ffaef164ed03acb2126d1", "score": "0.6855229", "text": "function numsort(a, b) {\n return b - a;\n }", "title": "" }, { "docid": "8f4d51158d81ccfbf69a2be0a56e6507", "score": "0.68488836", "text": "function sort(theArray){\n\n}", "title": "" }, { "docid": "38ea9c9fade9d741c3041779d256d974", "score": "0.68266964", "text": "function numsort(a, b) {\n return b - a;\n }", "title": "" }, { "docid": "c038d1dee361738432b84cc96876dfdb", "score": "0.68249506", "text": "function numericalArraySortAscending(a, b)\n{\n return (a-b);\n}", "title": "" }, { "docid": "7ec6bfd714d703c283f48aa976914afd", "score": "0.67632633", "text": "function sortArrayNumerically(a, b) {\n return a > b ? 1 : b > a ? -1 : 0;\n}", "title": "" }, { "docid": "feee2b66cddcc1ab7fc530d9af890739", "score": "0.67327726", "text": "function sortNumberArray(theArray,theOperation) {\n var sortedArray = theArray;\n\n if (theOperation==\"ASC\") {\n sortedArray.sort(function(a,b){return a-b});\n } else {\n sortedArray.sort(function(a,b){return b-a});\n }\n\n console.log(sortedArray);\n return sortedArray;\n}", "title": "" }, { "docid": "2c71e2423951d4c8c27e2e01c980be96", "score": "0.6725518", "text": "function sortAsc(arr) {\n let t = arr.length;\n var temp;\n\n for (var i = 0; i <= t; i++) {\n for (var j = 0; j < t; j++) {\n // compara se o elemento atual é maior que o seguinte\n if (arr[j] > arr[j+1]) {\n // armazena o elemento atual\n temp = arr[j];\n // substitui o elemento atual pelo seguinte\n arr[j] = arr[j+1];\n // recupera o valor atual e substitui no seguinte\n arr[j+1] = temp;\n }\n }\n }\n return arr;\n}", "title": "" }, { "docid": "a8117d9a8973dc16a3523a63122209c8", "score": "0.6707233", "text": "function numberSortFunction(a, b) {\n return a - b;\n}", "title": "" }, { "docid": "c8cea0284091fc4106fc7cb16831d364", "score": "0.6702622", "text": "function sortNumber(a,b){\n\t//this is done so as to sort the negative numbers in the array.\n return a - b;\n}", "title": "" }, { "docid": "0ba84ed2a09f9166ca41f183566612ca", "score": "0.66884464", "text": "function numSort(a, b) {\n return a - b;\n }", "title": "" }, { "docid": "0ba84ed2a09f9166ca41f183566612ca", "score": "0.66884464", "text": "function numSort(a, b) {\n return a - b;\n }", "title": "" }, { "docid": "f861edfdb1d113fa51920c4e1771d26f", "score": "0.66836417", "text": "function sortArray() {\n\n //PRZYPISANIE WARTOSCI DO TABLICY\n var points = [41, 3, 6, 1, 114, 54, 64];\n\n //SORTOWANIE OD NAJMNIEJSZEJ DO NAJWIEKSZEJ\n points.sort(function (a, b) {\n //POROWNANIE DWOCH ELEM. TABLICY - MNIEJSZY STAWIA PO LEWEJ, WIEKSZY PO PRAWEJ\n return a - b;\n });\n\n //ZWROCENIE POSORTOWANEJ TABLICY\n return points;\n}", "title": "" }, { "docid": "335af8beea1d0151ca3fa0f463bade88", "score": "0.6671211", "text": "function sortArr(a, b){\n return a - b ;\n }", "title": "" }, { "docid": "599ab5fcf3e054fc4602f6456c41ff47", "score": "0.66356206", "text": "function numSort(a, b) {\n if (a > b) {\n return -1\n } else if (a < b) {\n return 1\n } else {\n return 0\n }\n}", "title": "" }, { "docid": "83eb322562126d34744729e5968d2ece", "score": "0.6594489", "text": "function mergeSort(numArray){\n\n}", "title": "" }, { "docid": "130eaed51575e138d1e4591b43387938", "score": "0.65926564", "text": "function sort() {\n renderContent(numArray.sort());\n}", "title": "" }, { "docid": "0d6c81a9bb9f1e6084143652a7a603ee", "score": "0.6541077", "text": "function sort_int(arr = [1, 2, 3]){\n\n return arr.sort(comparator_int_ascending);\n}", "title": "" }, { "docid": "9f623eae24ce7d5df9025152cecb0e7e", "score": "0.653617", "text": "function urutAscending(array) {\r\n array.sort((a, b) => {\r\n return a - b\r\n })\r\nreturn array;\r\n}", "title": "" }, { "docid": "1f4d45539231a04987c412866a8d4656", "score": "0.65321225", "text": "function newOrder(numeros) {\n\n numeros.sort(function(a,b) {\n return a -b ;\n });\n return console.log(numeros);\n}", "title": "" }, { "docid": "74fe0a89c8e1a743cd00cb1f0f9715aa", "score": "0.653207", "text": "function sortArr2(arr) {\n console.table(arr.sort((a, b) => a - b)\n );\n}", "title": "" }, { "docid": "c5cd5c4fb49a753bccf3763648f84d49", "score": "0.6528411", "text": "function Sort() {}", "title": "" }, { "docid": "7fbabdf75fe6bc52a29e7e1e4ea5f0cb", "score": "0.6500846", "text": "function sortNumbers(a,b) {\nreturn (a-b);\n}", "title": "" }, { "docid": "ae8a6632eafd4f4ed2491cbb647fac24", "score": "0.6494152", "text": "function sortNumbersAscending(a, b) {\n\t return a - b;\n\t}", "title": "" }, { "docid": "78fefe51db97a8ca342aa59e1aadc5b1", "score": "0.648499", "text": "function asc(arr) {\n\t arr.sort(function (a, b) {\n\t return a - b;\n\t });\n\t return arr;\n\t }", "title": "" }, { "docid": "faef83db5d6adabf1de02e2219627ef6", "score": "0.6481405", "text": "sort() {\n let a = this.array;\n const step = 1;\n let compares = 0;\n for (let i = 0; i < a.length; i++) {\n let tmp = a[i];\n for (var j = i; j >= step; j -= step) {\n this.store(step, i, j, tmp, compares);\n compares++;\n if (a[j - step] > tmp) {\n a[j] = a[j - step];\n this.store(step, i, j, tmp, compares);\n } else {\n break;\n }\n }\n a[j] = tmp;\n this.store(step, i, j, tmp, compares);\n }\n this.array = a;\n }", "title": "" }, { "docid": "fcfe7bea4fdc44c5ecf84938f54904f5", "score": "0.6474811", "text": "function sorting(arrNumber) {\n // code di sini\n var current = false\n while (current === false) {\n current = true\n for (var i = 1; i < arrNumber.length; i++) {\n if (arrNumber[i-1] > arrNumber[i]) {\n current = false\n var move = arrNumber[i-1]\n arrNumber[i-1] = arrNumber[i]\n arrNumber[i] = move\n }\n }\n }\n return arrNumber\n }", "title": "" }, { "docid": "fd91a1e29014d782188113b3e8f47b76", "score": "0.64602315", "text": "function numberSort (a, b) {\n if (a > b) {\n return -1;\n } else if (a < b) {\n return 1;\n }\n\n return 0;\n}", "title": "" }, { "docid": "8eb547db804ab7714c14c54dc4899573", "score": "0.644932", "text": "function sortNum(a, b) {\n return a - b;\n}", "title": "" }, { "docid": "4a2ec1585470fd6b9251d255ad4a8da2", "score": "0.6446817", "text": "function sort(unsortedArray) {\n // Your code here\n}", "title": "" }, { "docid": "b60a8edece1cd2638207b14efe5d7e44", "score": "0.64385587", "text": "function ascSort(a,b){\n return a - b;\n }", "title": "" }, { "docid": "820a2208f8b9422f4cbe1aa224416e3d", "score": "0.64338434", "text": "function ascendente(col){ // uso de slice() para que no cambie el array original\n Equipos_sort= CpyEquipos_array.slice().sort(function(a,b){\n if (a.puntos[col] > b.puntos[col]) { // > ordena de mayor a menor\n return 1;\n }\n if (a.puntos[col] < b.puntos[col]) {\n return -1;\n }\n // a must be equal to b\n return 0;\n });\n}", "title": "" }, { "docid": "565a1957c68eb97939437c67303cb2b6", "score": "0.643214", "text": "function start()\n{\n var a = [ 10, 1, 9, 2, 8, 3, 7, 4, 6, 5 ];\n\n outputArray( \"Data items in original order: \", a,\n document.getElementById( \"originalArray\" ) ); \n a.sort( compareIntegers ); // sort the array\n outputArray( \"Data items in ascending order: \", a,\n document.getElementById( \"sortedArray\" ) ); \n} // end function start", "title": "" }, { "docid": "59de7b5eed1bdc2eb622fada50c4847d", "score": "0.6412472", "text": "sortNumber(a, b) {\n return a - b;\n }", "title": "" }, { "docid": "014b79461caf38f16d4e29e617923d4b", "score": "0.64067894", "text": "static sort(arr) {\n const n = arr.length;\n \n for (let i = 1; i < n; i++) {\n for (let j = i; j > 0 && less(arr[j], arr[j - 1]); j--) {\n swap(arr, j, j - 1);\n }\n }\n }", "title": "" }, { "docid": "a0413984cb93b07e2dec61bd6c9aa23d", "score": "0.6395428", "text": "function sortNumber(a,b) {\n \treturn a - b;\n\t}", "title": "" }, { "docid": "7815841961b7cba9f82f00f3cf7aed1f", "score": "0.63933223", "text": "function sort(){\n myArray.sort(compareNumbers);\n\n showAray();\n}", "title": "" }, { "docid": "01a53122c67b54198dc6beba5f7a36a8", "score": "0.63901883", "text": "function asc(arr) {\n arr.sort(function (a, b) {\n return a - b;\n });\n return arr;\n}", "title": "" }, { "docid": "ddbaa605cc0c3af6b00b5c9bd3a29c1b", "score": "0.63846684", "text": "function sortNumber (a, b) {\n return a - b;\n }", "title": "" }, { "docid": "13cb18408e3979d430fbd876d08966c0", "score": "0.6382111", "text": "function sortAsc(a, b) {\n return a[1] - b[1];\n }", "title": "" }, { "docid": "da9b5148c7e087389eda41a4f330f6fb", "score": "0.63784665", "text": "function sort() {\n myArray.sort(compareNumbers);\n showArray();\n}", "title": "" }, { "docid": "f467464b0110458e63ddd01e91393d87", "score": "0.637453", "text": "function sortNumber(a,b){\n\treturn a - b;\n}", "title": "" }, { "docid": "f21e7bff3c52d53c8cf9e3b4864dee4a", "score": "0.63713455", "text": "function sortNums(num1, num2) {\n return num1 - num2;\n}", "title": "" }, { "docid": "ef0541da5f39ceb6e2bbaf809aa7d0ff", "score": "0.6368339", "text": "function subSort(arr) {\n // didnt get this one. try again\n}", "title": "" }, { "docid": "281ca016cf092b90863e037adf8f5c1c", "score": "0.63621926", "text": "function sortNumber(a, b){\n return a-b;\n }", "title": "" }, { "docid": "b17691d52bc2d626e8e9bc601a7f01ee", "score": "0.6360574", "text": "function sortNumber(a,b) {\n return a - b;\n}", "title": "" }, { "docid": "b17691d52bc2d626e8e9bc601a7f01ee", "score": "0.6360574", "text": "function sortNumber(a,b) {\n return a - b;\n}", "title": "" }, { "docid": "ac81f0bc1e5b30d38f673ed3bdb520e8", "score": "0.6349602", "text": "function sortNumber(a,b) {\r\n\t\t\treturn b - a;\r\n\t\t}", "title": "" }, { "docid": "175c249caceffa06e2255a684974379c", "score": "0.63392377", "text": "function sortArray1(arr) {\n return arr.sort((a, b) => a-b)\n}", "title": "" }, { "docid": "6291237cfaf11139b85a98cf759301b4", "score": "0.6329826", "text": "function sortFunction ( a, b ) { \n\t\t if (a[0] - b[0] != 0) {\n\t\t return (a[0] - b[0]);\n\t\t } else if (a[1] - b[1] != 0) { \n\t\t return (a[1] - b[1]);\n\t\t } else { \n\t\t return (a[2] - b[2]);\n\t\t }\n\t\t }", "title": "" }, { "docid": "56c7a39a0ebf5fba84b6ccfab8b522e6", "score": "0.6326185", "text": "function sortNumber(a, b) {\n return a - b;\n }", "title": "" }, { "docid": "da85a5bb4948d54576ec5b6f60800b69", "score": "0.6324923", "text": "function SortNumbers(a, b) {\n return (a - b);\n}", "title": "" }, { "docid": "20fbe569b6a085505e36f91ccf135f34", "score": "0.6312313", "text": "function alfa (arr){\n\tfor (var i = 0; i< arr.length;i++){\n\t\tarr[i].sort();\n\t}\n\treturn arr;\n}", "title": "" }, { "docid": "f370ce12847cab3ebe35f8f5702da20f", "score": "0.6311946", "text": "function sortNumber(a, b) {\n return a - b;\n}", "title": "" }, { "docid": "c15014068230b6e4fafa3c7dd3827137", "score": "0.6305295", "text": "sort(arr) {\n function IsNumber(arr) {\n for (let i = 0; i < arr.length; i++) {\n\n if (typeof arr[i] === 'number') {\n return arr.sort(function (a, b) { return a - b });\n } else if (typeof arr[i] === 'string') {\n return arr.sort();\n } else {\n return [];\n }\n }\n }\n return IsNumber(arr);\n }", "title": "" }, { "docid": "a1129ef5b7236e8550943cc90641bebf", "score": "0.6297782", "text": "function ordena(v){\n //algoritmo do buble sort\n for(let i=0; i<v.length; i++){\n for(let j=0;j<v.length-1; j++){\n if(v[j]> v[j+1]){\n //troca\n let aux = v[j]\n v[j] = v[j+1]\n v[j+1] = aux\n }\n }\n }\n //return v\n}", "title": "" }, { "docid": "b19d428cb3dca0eff6ad60cdb927a545", "score": "0.62962663", "text": "function sortNumber(a, b) {\n return b - a;\n }", "title": "" }, { "docid": "91fba3e08cba68b7ede61eb185d1ecef", "score": "0.62852114", "text": "function sortNumber(a, b) {\n return a - b;\n}", "title": "" }, { "docid": "e44ae5a9844e651a189d7acca5df45b1", "score": "0.62822396", "text": "function myarrayresult(){\r\narray2.sort(function (a,b) {\r\n return a-b; //For assending order \r\n return b-a; //For descendening Order // Correct \r\n});\r\n}", "title": "" }, { "docid": "70ca595b57bc118f966c496dd562e7d6", "score": "0.6278021", "text": "function urutDescending(array) {\r\n array.sort((a, b) => {\r\n return b - a\r\n })\r\nreturn array;\r\n}", "title": "" }, { "docid": "85c969226ffedb2539a5831c35c776fd", "score": "0.6271949", "text": "function sortNumeric(a, b) {\n return a - b;\n}", "title": "" }, { "docid": "951e5f7bad577dce4434350b3155e51c", "score": "0.6264474", "text": "function mysort(arr, fn) {\n\t//return bubbleSort(arr, isFn(fn) ? fn : (a, b) => a > b);\n\treturn selectionSort(arr, isFn(fn) ? fn : (a, b) => a > b);\n}", "title": "" }, { "docid": "cee9cbabda7d10729b12dcbb274d4b44", "score": "0.6260729", "text": "function sorting(arrNumber) {\n\tvar sortedNumber = arrNumber.sort(function(a, b) {return b - a});\n\treturn sortedNumber;\n}", "title": "" }, { "docid": "fccecfb05551c889cb7594ea533e3f8e", "score": "0.6260649", "text": "function sortNumber(a, b) {\n\treturn a - b;\n}", "title": "" }, { "docid": "0471d885fdc3c97af772c642e1938bbe", "score": "0.62591743", "text": "function musasSortFunction(array){\n const sortedArray =[];\n//take all array \n array.forEach(element => {\n// for every element check new array\n for (let i = 0; i < array.length; i++) {\n// if array empty, push your element and stop loop\n if(sortedArray.length === 0){ \n sortedArray.push(element);\n break;\n }\n//if element smaller or equal than sortedArray element, put before than it and stop loop\n if(element <=sortedArray[i]){\n// console.log(`${element} smaller than ${sortedArray[i]} ----pushed array`);\n sortedArray.splice(i,0,element);\n break;\n// if you can not find until end of the array, its biggest element. push end of the sortedArray\n }else if(i === sortedArray.length-1){//arayin sonuna gelindi sona ekle\n sortedArray.push(element);\n break;\n }\n }\n });\n // console.log(`SORTED SOLUTION: ${sortedArray} k<<<<<<<<<<<<<`);\n return sortedArray;\n}", "title": "" }, { "docid": "f03a2370d6a2baaecc23e41926a46ad1", "score": "0.625854", "text": "function ordena(num) {\n // teste++;\n // if (teste > 5) {\n // return console.log(\"a\");\n // }\n\n var verif = false;\n for (var i = 0; i < num.length - 1; i++) {\n\n if (parseInt(num[i]) < parseInt(num[i + 1])) {\n verif = true;\n var extra = num[i];\n num[i] = num[i + 1];\n num[i + 1] = extra;\n\n\n }\n\n }\n if (verif == true) {\n return ordena(num)\n } else {\n return num;\n }\n\n}", "title": "" }, { "docid": "7b8bb87e1bb78358970e08a852b15c6a", "score": "0.62551737", "text": "function sortArray() {\n //Twoj komentarz ...\n //deklaracje tablicy z elemtami\n var points = [41, 3, 6, 1, 114, 54, 64];\n\n //Twoj komentarz ...\n points.sort(function(a, b) {\n //Twoj komentarz ...\n\n return a - b;\n });\n\n //Twoj komentarz ...\n //zwrócenie tablicy points\n return points;\n}", "title": "" }, { "docid": "89afef9cb42697642ffdb525f609301a", "score": "0.6245659", "text": "function Reordernar(numeros) {\n\t\tfor(var i = 0; i < numeros.length; i++){\n\t\t\tfor(j=i+1; j < numeros.length; j++){\n\t\t\t\tif(numeros[i] > numeros[j]){\n\t\t\t\t\tauxiliar = numeros[i];\n\t\t\t\t\tnumeros[i] = numeros[j];\n\t\t\t\t\tnumeros[j] = auxiliar;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn numeros;\n\t}", "title": "" }, { "docid": "797049c333fb0582b3996f23d747fe16", "score": "0.6237076", "text": "function shellSort(arr,comp){\r\n var h = 1;\r\n for(; h < arr.length; h = 3*h+1);\r\n for(; h > 0; h = Math.floor(h / 3)){\r\n for(var i = 0; i < h; i ++){\r\n insertCustom(arr,comp,i,h,arr.length);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "b801bfe33ad261d2953b17e0765f7d2d", "score": "0.6236034", "text": "function sortNumbersDescending(a,b) {\n\t\treturn b-a;\n\t}", "title": "" }, { "docid": "b375b4690a1c6da7311be4836d8270d3", "score": "0.62187904", "text": "function sortNumeric(val1, val2)\n{\n return val1 - val2;\n}", "title": "" }, { "docid": "12e298bacfd1799dc70ad5b0fe5a7e79", "score": "0.6214286", "text": "sort(){\n\n }", "title": "" }, { "docid": "3d395c655303da31b244540fedcd218a", "score": "0.6209437", "text": "function primeSort(arr) {\r\n // -------------------- Your Code Here --------------------\r\n var pArray = primeArray(arr);\r\n var sortArr = bubleSort(pArray);\r\n\r\n\r\n return sortArr;\r\n\r\n\r\n // --------------------- End Code Area --------------------\r\n}", "title": "" }, { "docid": "1c5faeda8c33b3159455781bc5e41ca9", "score": "0.6204616", "text": "function sortingAscendingOrder(arr){\n return arr.sort((val1, val2) => val1 - val2);\n}", "title": "" }, { "docid": "15f25bb5a5adb089bffbbf57473b8795", "score": "0.62006986", "text": "function sort(array) {\n var buf;\n\n for (var j = 0; j < array.length-1; j++)\n for (var i = 0; i < array.length-j; i++) {\n if (array[i] > array[i+1]) {\n buf = array[i];\n array[i] = array[i+1];\n array[i+1] = buf;\n }\n }\n\n return array;\n }", "title": "" }, { "docid": "998dcfcbab5fb916b220ace9344b00ae", "score": "0.6197333", "text": "sort() {\n\t}", "title": "" }, { "docid": "998dcfcbab5fb916b220ace9344b00ae", "score": "0.6197333", "text": "sort() {\n\t}", "title": "" }, { "docid": "765bb0b8ff1ba1e8f67da4415c4c1b67", "score": "0.619212", "text": "function rankitup(array) {\narray.sort(function(a, b){return a-b});\n}", "title": "" }, { "docid": "4c0f7f6b544ab648a35d23059149b3d4", "score": "0.618981", "text": "function start() {\n\tvar a = [10, 1, 9, 2, 8, 3, 7, 4, 6, 5];\n\n\toutputArray(\"Data items in original order: \", a, document.getElementById('originalArray'));\n\ta.sort(compareIntegers); //sort the array\n\toutputArray(\"Data items in ascending order: \", a, document.getElementById('sortedArray'));\n} //end function start", "title": "" }, { "docid": "ffde65118e37050b5125e9c473bfde1b", "score": "0.61871225", "text": "function descendingOrder(n){\n //split number into array of individual nums, itterate through and compare each number to previous and sort in decending order,\n //join back the sorted array into string, and turn string into number\n return Number(n.toString().split('').sort((a,b) => {return b - a}).join(''))\n}", "title": "" }, { "docid": "c93f1158325c6f73321094d2be66a20c", "score": "0.61826617", "text": "function sortJsonArray(myarray,prop, asc) {\r\n myarray = myarray.sort(function(a, b) {\r\n if (asc) {\r\n return (a[prop] > b[prop]) ? 1 : ((a[prop] < b[prop]) ? -1 : 0);\r\n } else {\r\n return (b[prop] > a[prop]) ? 1 : ((b[prop] < a[prop]) ? -1 : 0);\r\n }\r\n });\r\n }", "title": "" }, { "docid": "6e327dffee52285e08138dc8120de751", "score": "0.6181028", "text": "function ascendingOrder(arr) {\n return arr.sort(function(a, b) {\n return a - b;\n });\n}", "title": "" }, { "docid": "50febb992020e984b6106ac2ba3c955e", "score": "0.61690784", "text": "function numericalSort(a, b) {\n return a > b ? 1 : b > a ? -1 : 0;\n }", "title": "" }, { "docid": "f58f4d94dcf8c49c4539dbca3620c1c3", "score": "0.61678576", "text": "function g_msort(array, on_field, order)\r\n{\r\n if(array.length < 2)\r\n return array;\r\n var middle = Math.ceil(array.length/2);\r\n return g_merge(g_msort(array.slice(0, middle), on_field, order),\r\n g_msort(array.slice(middle), on_field, order),\r\n on_field, order);\r\n}", "title": "" }, { "docid": "59bc7056b1faa48ac5e56b1e84c3a945", "score": "0.61674505", "text": "function sortDesc(array) {\n for (let j = array.length - 1; j > 0; j--) {\n for (let i = 0; i < j; i++) {\n if (array[i] < array[i + 1]) {\n let temp = array[i];\n array[i] = array[i + 1];\n array[i + 1] = temp;\n }\n }\n } return array;\n}", "title": "" }, { "docid": "5c38c9800122153149d378ab1c7f4eaf", "score": "0.61554503", "text": "function descendingOrder(n){\n n = String(n).split(''); // make from number aaray \n \n function compare(a, b) {\n if (a>b) return 1;\n if (a<b) return -1;\n }\n n = n.sort(compare); // sort the array\n n = n.reverse(); // \n n = n.join(''); // make string from array\n n = parseInt(n, 10); // \n return n;\n}", "title": "" }, { "docid": "0b9aba575a8f304982f1fce6d29ef653", "score": "0.61515254", "text": "function sortSeme(arr) {\n const sortedArr = [];\n\n for (let i = 1; i <= arr.length; i++) {\n sortedArr.push(i);\n }\n\n return sortedArr;\n}", "title": "" } ]
095b9fac6451e1f8ebd33d7fe7746fab
Instructions: Upon the completion of the games data download, a listing of games should be displayed on screen. The order of the listing should be determined by the `Order` field in the games data.
[ { "docid": "f5d949ab9409f23e7473db16e5adfc0b", "score": "0.56554306", "text": "function GamesTable(props) {\n /* props contains an object with the following basic structure:\n const gamesData = {\n 4: {\n ID: 1,\n name: 'World of Warcraft',\n supportsAddons: true,\n supportsVoice: false,\n slug: 'wow',\n gameFiles: [\n {\n ID: 1,\n FileName: 'file1',\n },\n ],\n categorySections: [\n {\n ID: 1,\n Name: 'cat1',\n },\n ],\n },\n };\n */\n\n /* props also contains:\n searchQuery (string)\n requireAddOns (boolean)\n requireVoice (boolean)\n */\n\n // pull out data from props\n const {\n gamesData,\n searchQuery,\n requireAddOns,\n requireVoice,\n } = props;\n\n // this will be used to make case-insensitive searches\n const lowercaseSearchQuery = searchQuery.toLowerCase();\n\n // sort the data by \"Order\" property\n // note: need to convert \"Order\" to number to be able to sort correctly\n const gameOrderStrings = Object.keys(gamesData);\n const gameOrderNums = gameOrderStrings.map((numStr) => parseInt(numStr, 10));\n const sortedGameOrderNums = gameOrderNums.sort((a, b) => a - b);\n\n // filter games by search parameters\n // create an instance of GameListing for each non-filtered game\n const gameListings = [];\n\n sortedGameOrderNums.forEach((gameOrderNum) => {\n const {\n ID,\n name,\n supportsAddons,\n supportsVoice,\n slug,\n gameFiles,\n categorySections,\n } = gamesData[gameOrderNum];\n\n // this will be used to make case-insensitive searches\n const lowercaseName = name.toLowerCase();\n\n // if game does not meet conditions, then filter it out\n if (lowercaseName.indexOf(lowercaseSearchQuery) === -1) {\n return;\n }\n if (requireAddOns && !supportsAddons) {\n return;\n }\n if (requireVoice && !supportsVoice) {\n return;\n }\n\n gameListings.push(\n <GameListing\n key={ID.toString()}\n ID={ID}\n name={name}\n supportsAddons={supportsAddons}\n supportsVoice={supportsVoice}\n slug={slug}\n gameFiles={gameFiles}\n categorySections={categorySections}\n />,\n );\n });\n\n return (\n <div>\n {gameListings}\n </div>\n );\n}", "title": "" } ]
[ { "docid": "4dcc33453988784deb2c1831a624db70", "score": "0.7135843", "text": "function fetchGameList(){\n\tfetch(\"https://rawg-video-games-database.p.rapidapi.com/games?page=1\", {\n\t\"method\": \"GET\",\n\t\"headers\": {\n\t\t\"x-rapidapi-host\": \"rawg-video-games-database.p.rapidapi.com\",\n\t\t\"x-rapidapi-key\": \"ba56e18dfbmsha0533de8919d27bp10d3dcjsn5229ce979bb3\"\n\t}\n\t})\n\t.then((resp) => resp.json())\n\t.then(function (response) {\n\t\t\tvar jsonGameList = response;\n\t\t\t//Envia el ID de cada uno de los juegos en la primera página\n\t\t\tfor(var i = 0; i < 19; i++){\n\t\t\t\tfetchGameInfo(jsonGameList.results[i].id);\n\t\t\t}\n\t})\n\t.catch(function (err) {\n\t\t\tconsole.log(\"No se puedo obtener el recurso\", err);\n\t});\n}", "title": "" }, { "docid": "1bdd524af421dcc6bc5fdcee86cbb598", "score": "0.641038", "text": "function getAllGames()\n {\n ajaxHelper(gamesUri, 'GET').done(function (data)\n {\n self.games(data);\n });\n }", "title": "" }, { "docid": "9a5aaa8c075c1a5ab08955654a053133", "score": "0.6399377", "text": "static fetchAllGames(url) {\n fetch(url)\n .then(res => res.json())\n .then(gamesObjects => {\n\n // Show the \"Create New Game\" form on the page\n Game.showCreateGameForm();\n\n gamesObjects.forEach(gameObject => {\n \n \n\n // Create a new Game object on the front-end\n const game = new Game(gameObject.id, gameObject.name, gameObject.status, gameObject.phase)\n gameObject.players.forEach(playerObject => {\n const player = new Player(playerObject.id, playerObject.name);\n game.players.push(player);\n }) \n \n // Renders a specific game on the page\n game.renderGameListCard();\n\n })\n\n // Open websocket connection with new games\n Game.createGamesWebsocketConnection();\n\n })\n }", "title": "" }, { "docid": "2b130870f33f068b54fd18918daad368", "score": "0.63228214", "text": "function printGames(game) {\n let queryUrl = `https://rawg.io/api/games?search=${game}&platforms=23`;\n $.ajax({\n url: queryUrl,\n method: 'GET'\n }).then(function (response) {\n console.log(response);\n let p = $('#results');\n p.empty();\n $('#info').empty();\n let array = response.results;\n for (let i = 0; i < array.length; i++) {\n let span = $('<span>');\n let name = $('<div>').text(array[i].name).attr('class','name');\n let image = $('<img>').attr({\n 'class': 'image thumbnail',\n 'src': array[i].background_image,\n 'alt': array[i].name\n });\n span.append(name, image);\n p.append(span);\n }\n listOfResults = response.results;\n })\n $('.boxdescription').css('height', '350px');\n\n }", "title": "" }, { "docid": "98ddccbd38a1bd58d76959b0aabc79c7", "score": "0.62982106", "text": "function updateGames() {\n var listView = Playtech.GamesManagement.ListView;\n listView.initPaging(Playtech.GamesManagement.data);\n\n $j('.gmPageCounter:first').trigger('click');\n }", "title": "" }, { "docid": "bfcc58c3039bf373064ebe249707848b", "score": "0.6163408", "text": "async function loadGames() {\n const allGameInfoResponse = await fetch(url + '/readAllGames', {\n method: \"GET\",\n headers: {\n \"Content-type\": \"application/json; charset=UTF-8\"\n }\n });\n if (allGameInfoResponse.ok) {\n const games = await allGameInfoResponse.json();\n window.games = games;\n console.log(games);\n }\n else {\n console.log(allGameInfoResponse);\n }\n}", "title": "" }, { "docid": "41d762be1471ec420765517ebdd2fd9d", "score": "0.6097837", "text": "async listGames(init) {\r\n return this.request('/games', init);\r\n }", "title": "" }, { "docid": "20b1acd602d869936792e0046bdd0f87", "score": "0.60650945", "text": "async myGames (data = {}) {\n return await this.request('get', '/my-games', data, {games: ensureArray})\n }", "title": "" }, { "docid": "c52b1b7e052c80341cc8b0338a9364d5", "score": "0.6032777", "text": "list(req, res) {\n Game.findAll()\n .then((games) => {\n res.status(200).json(games);\n })\n .catch((error) => {\n res.status(500).json(error);\n });\n }", "title": "" }, { "docid": "18a31b4415c7e43c19da6e05cc3d7e04", "score": "0.5980704", "text": "retrieveAllGames() {\n return freendiesApi.retrieveAllGames()\n }", "title": "" }, { "docid": "0f226f04871e47a9a1664986fccb2763", "score": "0.59660524", "text": "function renderGames() {\n var rows = document.getElementsByClassName(\"Tst-table Table\")[0].rows;\n var playerInfo;\n\n //go through rows of table\n for (var i = 1; i < rows.length; i++) {\n //grab all text from the <td> that includes the team/player name\n playerInfo = rows[i].cells[1].innerText.split(\" \");\n teamsString += getTeamFromInfo(playerInfo) + \",\";\n }\n //console.log(teamsString)\n var dateString = getFormattedDate();\n var leagueIDString = \"leagueID=\" + getLeagueID();\n //console.log(\"dateString = \" + dateString);\n var url =\n \"https://www.sportswzrd.com/gamesremaining/?pageName=transactionTrends&\" +\n teamsString +\n \"&format=json&date=\" +\n dateString +\n \"&\" +\n leagueIDString;\n //console.log(\"before request\");\n chrome.runtime.sendMessage(\n {\n endpoint: \"gamesremaining\",\n date: dateString,\n leagueID: getLeagueID(),\n teams: teamsString,\n pageName: \"yTransactionTrends\"\n },\n function(response) {\n addGames(response.data);\n }\n );\n}", "title": "" }, { "docid": "d329dfc4d5d4d8f5b1ac5098ce3941fe", "score": "0.5922113", "text": "function loadData() {\n $.get(\"/api/games\")\n .done(function (data) {\n updateView(data)\n console.log(data);\n })\n .fail(function (jqXHR, textStatus) {\n showOutput(\"Failed: \" + textStatus);\n });\n }", "title": "" }, { "docid": "d329dfc4d5d4d8f5b1ac5098ce3941fe", "score": "0.5922113", "text": "function loadData() {\n $.get(\"/api/games\")\n .done(function (data) {\n updateView(data)\n console.log(data);\n })\n .fail(function (jqXHR, textStatus) {\n showOutput(\"Failed: \" + textStatus);\n });\n }", "title": "" }, { "docid": "28c825dcc638df2dfb7ea5bd41e2cde2", "score": "0.59199435", "text": "async function displayAllGames(){\n //getting games from server\n const gamesFromServer = await fetchApi.getGamesList();\n \n //turning the array of games from server in an array of game objects\n const gamesList = gamesFromServer.map(gameServer => new Game(gameServer._id,\n gameServer.title,\n gameServer.imageUrl,\n gameServer.description\n )\n )\n \n //creating an array of DOM objects\n const domGamesArr = gamesList.map(game => game.displayGame());\n //creating the container and appending each game (DOM object) to it\n const container = document.querySelector('.container');\n domGamesArr.forEach((domGame => container.appendChild(domGame)));\n}", "title": "" }, { "docid": "2f86044db945a4550ea1bc1650265702", "score": "0.59172404", "text": "function fetchSuggestedGames(game) {\r\n return fetch(\"/api/games\", {\r\n method: \"post\",\r\n body:\r\n \"fields name, summary, cover; where id=(\" +\r\n game.similar_games.join(\", \") +\r\n \");\",\r\n headers: {\r\n \"Content-Type\": \"text/plain\"\r\n }\r\n })\r\n .then(\r\n response => response.json(),\r\n\r\n error => console.log(\"An error occurred.\", error)\r\n )\r\n .then(json => {\r\n return json;\r\n });\r\n}", "title": "" }, { "docid": "b1d7ef542b99f2af79dbce01771b37fd", "score": "0.58967394", "text": "function getTopRatedGames() {\n let xmlContent = \"\";\n fetch(\"https://gamezone.ninja/Resources/games.xml\").then((response) => {\n response.text().then((xml) => {\n xmlContent = xml;\n let parser = new DOMParser();\n let xmlDOM = parser.parseFromString(xmlContent, \"application/xml\");\n let games = xmlDOM.querySelectorAll(\"game\");\n var xmlContent2 = \"\";\n\n xmlContent2 = assembleContent(\"top\", xmlContent2, games);\n document.getElementById(\"games-game-list\").innerHTML = xmlContent2;\n });\n });\n}", "title": "" }, { "docid": "07a7b007ff777bc1a15fd09c98e2299d", "score": "0.5884021", "text": "function getLiveGames(){\n\n fetch('https://api.opendota.com/api/live')\n .then(convertToJSON) \n .then(getMatchInfo)\n .then(filterTeams)\n .then(writeMatchInfo)\n\n}", "title": "" }, { "docid": "2ab99b65c43fb3b8766fe0fd0b51479f", "score": "0.5876774", "text": "function loadData() {\n $.get(\"/api/games\")\n .done(function (data) {\n updateList(data);\n })\n .fail(function (jqXHR, textStatus) {\n alert(\"Failed: \" + textStatus);\n });\n }", "title": "" }, { "docid": "e62f5abf9f30bd76b4e9b09047ae5e93", "score": "0.5865489", "text": "getGames(){\n let games = fetch(API_URL +'/api/games',\n {method: 'GET'}).then((response) => response.json())\n return games;\n }", "title": "" }, { "docid": "1d0f05f7f7a344ff00d08bb4d8e41c94", "score": "0.5840291", "text": "function displayGame(gameName, game) {\n var gameUrl = 'http://boardgamegeek.com/boardgame/';\n var userUrl = 'http://boardgamegeek.com/user/';\n var gameClass = 'game-' + game.id;\n var liGame;\n \n // If game doesn't exist in list, create it\n if($('.' + gameClass).length)\n {\n liGame = $('.' + gameClass);\n }\n else\n {\n // Creates hyperlink for game\n var gameAnchorString = $('<a>', {href:gameUrl + game.id})\n .append(gameName)\n .prop('outerHTML');\n \n // Creates list item for game\n liGame = $('<li>', {class:gameClass}).append(gameAnchorString);\n }\n \n // Creates <span> of comma-separated hyperlinks for each user\n var userAnchorsString = \n $.map(\n getUnique(game.owners)\n .filter(function(item) {\n return $('.' + gameClass + ' .user-list a').length == 0 || \n $('.' + gameClass + ' .user-list a:not(:contains(\"' + item + '\"))').length > 0;\n }),\n function(item, index) {\n return $('<a>', {href:userUrl + item})\n .append(item)\n .prop('outerHTML')\n }\n )\n .sort()\n .join(', ');\n var spanUserList = $('<span>', {'class':'user-list'}).append(userAnchorsString);\n liGame.append(spanUserList);\n \n $('#olGamesAvailable').append(liGame);\n}", "title": "" }, { "docid": "3b98aff4ad24fbee1536075d7925a6d3", "score": "0.58219385", "text": "function popularModal() {\n fetch(`https://api.rawg.io/api/games?page_size=4&key=${rawgApi}`)\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n for (let i = 0; i <= 3; i++) {\n document.getElementById(`vg${i + 1}Name`).textContent =\n data.results[i].name;\n document\n .getElementById(`vg${i + 1}Img`)\n .setAttribute(\"src\", `${data.results[i].background_image}`);\n document.getElementById(`vg${i + 1}Img`).style.width = `75%`;\n document.getElementById(`vg${i + 1}Img`).style.height = `75%`;\n document\n .getElementById(`vg${i + 1}Link`)\n .setAttribute(\"href\", `https://rawg.io/games/${data.results[i].id}`);\n document.getElementById(\n `vg${i + 1}Link`\n ).textContent = `https://rawg.io/games/${data.results[i].id}`;\n }\n });\n fetch(\n `https://api.boardgameatlas.com/api/search?order_by=popularity&client_id=${bgAtlasApi}`\n )\n .then(function (response) {\n return response.json();\n })\n .then(function (response) {\n for (let i = 0; i <= 3; i++) {\n document.getElementById(`bg${i + 1}Name`).textContent =\n response.games[i].name;\n document\n .getElementById(`bg${i + 1}Img`)\n .setAttribute(\"src\", `${response.games[i].image_url}`);\n document.getElementById(`bg${i + 1}Img`).style.width = `75%`;\n document.getElementById(`bg${i + 1}Img`).style.height = `75%`;\n document\n .getElementById(`bg${i + 1}Link`)\n .setAttribute(\"href\", `${response.games[i].url}`);\n document.getElementById(\n `bg${i + 1}Link`\n ).textContent = `${response.games[i].url}`;\n }\n });\n}", "title": "" }, { "docid": "0e6cf68431c24b1ee832f26985632670", "score": "0.58102435", "text": "async function getGameData() {\n var res = await fetch(\"/games/search?limit=-1\")\n var resp = await res.json();\n return resp\n}", "title": "" }, { "docid": "21ef7dc53c3b20993ffabcae7f6e12a3", "score": "0.5802844", "text": "function get_game_overview(game_id) {\n view_game_id = game_id;\n var dataObj = {\n \"content\" : [ {\n \"session_id\" : get_cookie()\n }, {\n \"game_id\" : game_id\n } ]\n };\n call_server('game_overview', dataObj);\n}", "title": "" }, { "docid": "0a751b42979d1293e9bbc0301f86e4ec", "score": "0.5795173", "text": "function getGames(player) {\n playerId = player || \"\";\n if (playerId) {\n playerId = \"/?player_id=\" + playerId;\n }\n $.get(\"/api/games\" + playerId, function(data) {\n console.log(\"Games\", data);\n games = data;\n if (!games || !games.length) {\n displayEmpty(player);\n }\n else {\n initializeRows();\n }\n });\n }", "title": "" }, { "docid": "b36ccbe6f2f2ab7a7cfc724b20fabaf3", "score": "0.57867616", "text": "function loadGames(){\n\tvar request = loadViaAjax(\"AllGames.json\");\n\trequest.done(function(data) {\n\t\tGames = data;\n\t\tcreateGameCategories();\n\t\tcreateGameCategoryAll();\n\t});\n\treturn request;\n}", "title": "" }, { "docid": "938fa2b3bb3a6f9691284a209c00d7ee", "score": "0.5765572", "text": "function getGamesInfo(i){\n\n var games_deserialized = JSON.parse(localStorage.getItem('gamesStored'));\n\n var games = games_deserialized.games;\n \n var output = '';\n output += \"<h2>\" + games[i].name + \"</h2>\"; \n output += '<img src=\"' + games[i].images.medium + '\" alt=\"' + games[i].name + ' Thumb\">';\n output += '<div id=\"game-information\">';\n output += '<div id=\"game-data\">';\n output += \"<p><strong>Year Published:</strong> \" + games[i].year_published + \"</p>\";\n output += \"<p><strong>Number of Players:</strong> \" + games[i].min_players + \" to \" + games[i].max_players + \"</p>\";\n output += \"<p><strong>Play Time:</strong> \" + games[i].min_playtime + \" to \" + games[i].max_playtime + \" minutes</p>\";\n output += \"<p><strong>Recommended Age:</strong> \" + games[i].min_age + \"</p>\";\n output += \"<p><strong>Price:</strong> \" + games[i].price + \"</p>\";\n output += '</div>';\n output += '<div id=\"game-description\">';\n output += \"<p><strong>Description:</strong> \" + games[i].description + \"</p>\";\n output += '</div>';\n output += '</div>';\n\n document.getElementById(\"game-info\").innerHTML=output;\n\n}", "title": "" }, { "docid": "510b7266ec8957ce9ed6029a4e41c5f2", "score": "0.57566106", "text": "function getAndDisplayBoardGames() {\n $.getJSON(GAMES_URL, function(result) {\n \tlet element = result.boardGames;\n let boardGameElements = $(element).map(function(i) {\n return makeBoardGame(\n element[i].id, \n element[i].name, \n element[i].type, \n element[i].players, \n element[i].plays, \n element[i].averageScore,\n element[i].winsAndLosses\n );\n }).get();\n\t\t$('.game-box').html(boardGameElements); \n\t\t$('.js-bgame').velocity(\"transition.swoopIn\", { duration: 600, stagger: 100 })\n }); \n}", "title": "" }, { "docid": "23d019ddd61a113004a54b61c87bfd67", "score": "0.57558125", "text": "function getData(launches) {\n selectionHeading.innerText = `${launches[0].toUpperCase() + launches.slice(1)} launches`;\n fetch(`https://spacelaunchnow.me/api/3.3.0/launch/${launches}/?limit=200`)\n .then(res => res.json())\n .then(data => addDataToDOM(data, launches)); \n}", "title": "" }, { "docid": "3c6775debc9373329353b9deef6cd4e3", "score": "0.5716573", "text": "function getAwaitedGames() {\n let xmlContent = \"\";\n fetch(\"https://gamezone.ninja/Resources/games.xml\").then((response) => {\n response.text().then((xml) => {\n xmlContent = xml;\n let parser = new DOMParser();\n let xmlDOM = parser.parseFromString(xmlContent, \"application/xml\");\n let games = xmlDOM.querySelectorAll(\"game\");\n var xmlContent2 = \"\";\n\n xmlContent2 = assembleContent(\"awaited\", xmlContent2, games);\n document.getElementById(\"games-game-list\").innerHTML = xmlContent2;\n });\n });\n}", "title": "" }, { "docid": "b67072545775ae2d3ec9d33449f96e54", "score": "0.5710445", "text": "function dsFetch(){\n\tvar createInfo = document.getElementById(\"3dsData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Nintendo 3DS\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" }, { "docid": "920da451e9d0a412b2c25ab3c6ae4ac3", "score": "0.5706775", "text": "getAll () {\n View.out('----------- Teams -----------' + View.NEWLINE())\n View.out(this.getTeams())\n View.out(View.NEWLINE() + '----------- Games -----------' + View.NEWLINE())\n View.out(this.getGames())\n View.out(View.NEWLINE() + '----------- Canterbury Geams -----------' + View.NEWLINE())\n View.out(this.getCanterburyGames('Canterbury') + View.NEWLINE())\n View.out('----------- Crossover Games -----------' + View.NEWLINE())\n View.out(this.getCrossOverGames())\n }", "title": "" }, { "docid": "2510c7e8dd4a54c81324e1f05550e6c3", "score": "0.5690241", "text": "function getGame(name) {\n let xmlContent = \"\";\n fetch(\"https://gamezone.ninja/Resources/games.xml\").then((response) => {\n response.text().then((xml) => {\n xmlContent = xml;\n let parser = new DOMParser();\n let xmlDOM = parser.parseFromString(xmlContent, \"application/xml\");\n let games = xmlDOM.querySelectorAll(\"game\");\n var xmlContent2 = \"\";\n\n games.forEach((gameXmlNode) => {\n if (gameXmlNode.children[0].innerHTML.includes(name)) {\n xmlContent2 +=\n \"<div class='category'>\" +\n \" Category: \" +\n gameXmlNode.children[8].innerHTML +\n \"</div>\" +\n \"<img class='gamePic' src=\" +\n gameXmlNode.children[2].innerHTML +\n \" alt=''>\" +\n \"<div class='publisher'>\" +\n \"Publisher: \" +\n gameXmlNode.children[6].innerHTML +\n \"</div>\" +\n \"<div class='release'>\" +\n \"Release Date: \" +\n gameXmlNode.children[4].innerHTML +\n \"</div>\" +\n \"<div class='rating'>\" +\n \"Rating: \" +\n gameXmlNode.children[7].innerHTML +\n \"</div>\" +\n \"<div class='description'>\" +\n \"<h3>Description</h3> <br/>\" +\n gameXmlNode.children[1].innerHTML +\n \"</div>\" +\n \"<iframe width='1200' height='700' src='\" +\n gameXmlNode.children[3].innerHTML +\n \"' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>\" +\n \"<div class='review'>\" +\n \"<h3>Review</h3> <br/>\" +\n gameXmlNode.children[5].innerHTML +\n \"</div>\";\n }\n });\n document.getElementById(\"games-game-list\").innerHTML = xmlContent2;\n });\n });\n}", "title": "" }, { "docid": "bb1505441ecf472870290e730b0e4838", "score": "0.568937", "text": "getGameData () {\n let siteIdIndex = window.location.search('games/');\n let gameId = window.location.slice(siteIdIndex + 6);\n fetch(API_URL.games + `/${gameId}`, {\n headers: {\n 'Authorization': `Bearer ${this.props.authToken}`\n }\n })\n .then(res=> res.json())\n .then(data=> {\n this.props.dispatch(loadGameState(data));\n })\n .catch(err=> {\n console.log(JSON.stringify(err));\n //display in status component, don't redirect\n //this.props.dispatch(updateGameStatusError(err))\n })\n }", "title": "" }, { "docid": "0bb63f5bb1496ea3399498cd2ead8217", "score": "0.5686204", "text": "function gamesGET (req, res, next) {\n\n\tvar page = 'games';\n\tvar title = 'Games';\n\n\tif (req.session.user)\n\t\tUser\n\t\t.findOne({\n\t\t\temail : req.session.user.email\n\t\t})\n\t\t.exec(function (err, user) {\n\t\t\tif (err)\n\t\t\t\tres.send(err);\n\t\t\telse\n\t\t\t\tGame\n\t\t\t\t.find({ \n\t\t\t\t\tid : {\n\t\t\t\t\t\t$nin : [\"congkak\"]\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.exec(function (err, games) {\n\t\t\t\t\tif (err)\n\t\t\t\t\t\tres.send(err);\n\t\t\t\t\telse\n\t\t\t\t\t\tres.render(page, {\n\t\t\t\t\t\t\tuser : user,\n\t\t\t\t\t\t\ttitle : title,\n\t\t\t\t\t\t\tisGamesPage : true,\n\t\t\t\t\t\t\tgames : games,\n\t\t\t\t\t\t\tpartials : {\n\t\t\t\t\t\t\t\theader : 'header',\n\t\t\t\t\t\t\t\tfooter : 'footer'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t});\n\telse\n\t\tGame\n\t\t.find({})\n\t\t.exec(function (err, games) {\n\t\t\tif (err)\n\t\t\t\tres.send(err);\n\t\t\telse\n\t\t\t\tres.render(page, {\n\t\t\t\t\ttitle : title,\n\t\t\t\t\tisGamesPage : true,\n\t\t\t\t\tgames : games,\n\t\t\t\t\tpartials : {\n\t\t\t\t\t\theader : 'header',\n\t\t\t\t\t\tfooter : 'footer'\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t});\n}", "title": "" }, { "docid": "24ec9166f524655ae47908b09235a5e0", "score": "0.56644887", "text": "function ps3Fetch(){\n\tvar createInfo = document.getElementById(\"ps3Data\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Playstation 3\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" }, { "docid": "15d30545c3fb63c18a8792ef9efd4ccc", "score": "0.56548345", "text": "function fetchGame(gameUrl) {\n switch(gameUrl) {\n case 'stryk':\n return fetch(URL_STRYKTIPSET)\n .then(result => result.json())\n .then(data => parseGameData_(data)) \n\n break;\n case 'europa':\n return fetch(URL_EUROPATIPSET)\n .then(result => result.json())\n .then(data => parseGameData_(data)) \n break;\n case 'topp':\n return fetch(URL_TOPPTIPSET)\n .then(result => result.json())\n .then(data => parseGameData_(data)) \n break;\n default: console.warn('Wrong API call');\n }\n }", "title": "" }, { "docid": "ba890a9bb41d76298365234d2f47ceb3", "score": "0.5642817", "text": "function load_game_overview_data(page_data) {\n var status = page_data.game_status;\n var map_data;\n delete page_data.game_status;\n\n if(status == \"ongoing\"){\n var orders = page_data.orders;\n var punits = page_data.player_units;\n var year = page_data.year;\n var season = page_data.season;\n var phase = page_data.phase;\n var order_result = page_data.order_result;\n delete page_data.orders;\n delete page_data.player_units;\n delete page_data.year;\n delete page_data.season;\n delete page_data.phase;\n delete page_data.order_result;\n var stat_acc = \"<b>\"+year+\"_\"+season+\"_\"+phase+\"</b>\";\n\n $('#game_header').html(\"<h1>Game Overview</h1>\");\n $('#game_order_info').html(orders?interpret_orders(orders):\"No Orders\");\n $('#order_feedback').html(order_result?interpret_result_orders(order_result):\"No resulting orders\");\n $('#game_stat_info').html(stat_acc);\n $('#game_stat').show();\n $('#press_game_id').val(page_data.game_id);\n\n rownum = 0;\n $('#order_gen').html(\"\");\n\n map_data = {\n punits: punits,\n country: page_data.country,\n phase: phase,\n resOrd: order_result\n };\n }else if(page_data.status == \"finished\"){\n $('#game_header').html(\"<h1>Finished Game Overview</h1>\");\n $('#game_stat').hide();\n }\n\n var units = page_data.unit_list;\n var owners = page_data.owner_list;\n\n delete page_data.unit_list;\n delete page_data.owner_list;\n var acc = \"\";\n for(var i in page_data){\n acc += i+\": <b>\"+page_data[i]+\"</b><br>\";\n }\n acc += \"<br>\";\n $('#gov_info').html(acc);\n $('#game_id').val(page_data.game_id);\n $('#mid_area').html('<div id=\"canvas_div\"><canvas id=\"canvas\" width=\"1154\" height=\"996\"></canvas></div>');\n $('#canvas_div').css('left', ((window.innerWidth-1154)*0.5-7)+'px');\n\n //Keep the map always in the middle\n window.onresize = function(){\n $('#canvas_div').css('left', ((window.innerWidth-1154)*0.5-7)+'px');\n if(page!==\"game\")\n window.onresize = null;\n }\n\n //after page contents are loaded, draw the map and units\n $('#world').ready(function(){\n prepareCanvas(units, owners, map_data);\n });\n}", "title": "" }, { "docid": "54a471c743c94c8b3fef00642df4b84e", "score": "0.5634181", "text": "function load_games_current(data) {\n var view_link = function(id) {\n if(obj.status == 'waiting')\n return '<a href=\"javascript:void(0);\" class=\"btn disabled\">View</a>';\n else\n return '<a href=\"javascript:void(0);\" class=\"btn primary\" ' + 'onclick=\"get_game_overview(' + id + ')\">View</a>';\n }\n var reconfig_link = function(id) {\n return '<a href=\"javascript:void(0);\" class=\"btn primary\" ' + 'onclick=\"reconfig_game(' + id + ')\">Reconfig</a>';\n }\n\n // Add view link to all the games\n for ( var i = 0; i < data.length; i++) {\n var obj = data[i];\n\n data[i]['View'] = view_link(obj.id);\n\n if(userObj.id == obj.creator_id)\n data[i]['Reconfig'] = reconfig_link(obj.id);\n else\n data[i]['Reconfig'] = \"-\";\n\n // Filter out some fields\n delete data[i]['creator_id'];\n delete data[i]['order_phase'];\n delete data[i]['retreat_phase'];\n delete data[i]['build_phase'];\n delete data[i]['num_players'];\n delete data[i]['waiting_time'];\n }\n\n // Create html table from JSON and display it\n var keys = get_keys(data[0]);\n $('#games_current_data').html(JsonToTable(data, keys, 'gct', 'gcc'));\n}", "title": "" }, { "docid": "97898c0caa621b34afa6a6f6b401a562", "score": "0.56305355", "text": "async function getGames(season) {\n try {\n const response = await fetch(`https://hasses-sega-gubbar.herokuapp.com/games/${season}`, {});\n const data = await response.json();\n setSeasonGames(data)\n } catch {\n console.log(\"Error\");\n }\n }", "title": "" }, { "docid": "d9c119f62c74c41a78a5060e6365ff8f", "score": "0.56169444", "text": "function getNewGames() {\n let xmlContent = \"\";\n fetch(\"https://gamezone.ninja/Resources/games.xml\").then((response) => {\n response.text().then((xml) => {\n xmlContent = xml;\n let parser = new DOMParser();\n let xmlDOM = parser.parseFromString(xmlContent, \"application/xml\");\n let games = xmlDOM.querySelectorAll(\"game\");\n var xmlContent2 = \"\";\n\n xmlContent2 = assembleContent(\"new\", xmlContent2, games);\n document.getElementById(\"games-game-list\").innerHTML = xmlContent2;\n });\n });\n}", "title": "" }, { "docid": "d03a3817bfbf77c05683598f34896451", "score": "0.5612647", "text": "function fetchGames(callback){\n var url = 'http://wap.mlb.com/gdcross/components/game/mlb/year_'+year+'/month_'+month+'/day_'+day+'/miniscoreboard.json';\n console.log('fetching url: ' + url);\n http.get(url, function(res){\n var body = '';\n res.on('data', function(chunk) {\n body += chunk;\n });\n res.on('end', function() {\n var mlbResponse = JSON.parse(body)\n callback(mlbResponse.data.games.game);\n });\n });\n}", "title": "" }, { "docid": "adf5425eb401fcd1c1cbff7be83383dd", "score": "0.56104696", "text": "function load_get_games_ongoing(event_data) {\n var view_link = function(id) {\n return '<a href=\"javascript:void(0);\" class=\"btn primary\" ' + 'onclick=\"operator_game_overview(' + id + ')\">View</a>';\n }\n\n var stop_link = function(id) {\n return '<a href=\"javascript:void(0);\" class=\"btn danger\" ' + 'onclick=\"stop_game(' + id + ')\">Stop</a>';\n }\n\n var data = new Array();\n // Add view link to all the games\n for ( var i = 0; i < event_data.length; i++) {\n var obj = new Object();\n obj['Game Id'] = event_data[i];\n obj['View'] = view_link(event_data[i]);\n obj['Stop'] = stop_link(event_data[i]);\n data.push(obj);\n }\n // Create html table from JSON and display it\n var keys = get_keys(data[0]);\n\n $('#games_ongoing_data').html(JsonToTable(data, keys, 'gnt', 'gnc'));\n}", "title": "" }, { "docid": "f649f7b5c14f3160d8b689a92743963e", "score": "0.56100345", "text": "function load_game_search(data) {\n // Create html table from JSON and display it\n var keys = get_keys(data[0]);\n $('#game_search_data').html('<h2>Game search results</h2>');\n $('#game_search_data').append(JsonToTable(data, keys, 'gst', 'gsc'));\n}", "title": "" }, { "docid": "84c61fd96e48eee0e45dfcb82cb91919", "score": "0.55890656", "text": "function getData() {\nvar url1 = 'http://localhost:8080/api/game_view/' + myParam\n fetch(url1)\n .then(response => response.json())\n .then(response => {\n let slvGames = response\n console.log(response)\n main(slvGames)\n })\n .catch(err => console.log(err));\n}", "title": "" }, { "docid": "140c319a5c6736fdd31a65f616f2602a", "score": "0.55810726", "text": "function getTeamList() {\n if (\"caches\" in window) {\n caches.match(ENDPOINT_EPL + \"teams\").then(function (response) {\n if (response) {\n response.json().then(function (data) {\n showTeamList(data);\n })\n }\n })\n }\n\n fetchAPI(ENDPOINT_EPL + \"teams\")\n .then(data => {\n showTeamList(data);\n })\n .catch(error);\n}", "title": "" }, { "docid": "cc4d94de63389199bcf8645b09560a83", "score": "0.5543306", "text": "function vitaFetch(){\n\tvar createInfo = document.getElementById(\"vitaData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Playstation Vita\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" }, { "docid": "df3931c41e35644eda36865cf5db227f", "score": "0.55306065", "text": "function getDataTeams() {\n if (\"caches\" in window) {\n caches\n .match(base_url + \"v2/competitions/2001/standings\")\n .then(function(response) {\n if (response) {\n response.json().then(function(res) {\n const dataTable = res.standings\n .filter(({ type }) => type === \"TOTAL\")\n .map(value => {\n return `\n <h5>${value.group.replace(\"_\", \" \")}</h5>\n <table class=\"responsive-table striped grey darken-4\" style=\"color:white;\">\n <thead>\n <tr>\n <th>Team</th>\n <th>MP</th>\n <th>W</th>\n <th>D</th>\n <th>L</th>\n <th>GF</th>\n <th>GA</th>\n <th>GD</th>\n <th>Pts</th>\n </tr>\n </thead>\n <tbody>\n ${value.table\n .map(data => {\n return `\n <tr>\n <td style=\"display:flex;\" >\n <p style=\"padding-right:10px\">${data.position}</p>\n <img class=\"img-responsive\" src=\"${data.team.crestUrl.replace(\n /^http:\\/\\//i,\n \"https://\"\n )}\" width=\"25px\" alt=\"${data.team.name}\" />\n <a href=\"./detail_team.html?id=${\n data.team.id\n }\" style=\"color:white;\"><p style=\"padding-left: 10px\">${\n data.team.name\n }</p></a>\n </td>\n <td>${data.playedGames}</td>\n <td>${data.won}</td>\n <td>${data.draw}</td>\n <td>${data.lost}</td>\n <td>${data.goalsFor}</td>\n <td>${data.goalsAgainst}</td>\n <td>${data.goalDifference}</td>\n <td>${data.points}</td>\n </tr>\n `;\n })\n .join(\" \")} \n </tbody>\n </table>\n `;\n });\n document.getElementById(\n \"data-standings\"\n ).innerHTML = dataTable.join(\" \");\n document.getElementById(\"competition\").innerHTML =\n res.competition.name;\n document.getElementById(\n \"date\"\n ).innerHTML = `${res.season.startDate} / ${res.season.endDate}`;\n });\n }\n });\n }\n\n fetch(base_url + \"v2/competitions/2001/standings\", {\n method: \"GET\",\n headers: { \"X-Auth-Token\": \"7fa12231075a40f9a260585a31558f8c\" }\n })\n .then(status)\n .then(json)\n .then(function(res) {\n const dataTable = res.standings\n .filter(({ type }) => type === \"TOTAL\")\n .map(value => {\n return `\n <h5>${value.group.replace(\"_\", \" \")}</h5>\n <table class=\"responsive-table striped grey darken-4\" style=\"color:white;\">\n <thead>\n <tr>\n <th>Team</th>\n <th>MP</th>\n <th>W</th>\n <th>D</th>\n <th>L</th>\n <th>GF</th>\n <th>GA</th>\n <th>GD</th>\n <th>Pts</th>\n </tr>\n </thead>\n <tbody>\n ${value.table\n .map(data => {\n return `\n <tr>\n <td style=\"display:flex;\" >\n <p style=\"padding-right:10px\">${data.position}</p>\n <img class=\"img-responsive\" src=\"${data.team.crestUrl.replace(\n /^http:\\/\\//i,\n \"https://\"\n )}\" width=\"25px\" alt=\"${data.team.name}\" />\n <a href=\"./detail_team.html?id=${\n data.team.id\n }\" style=\"color:white;\"><p style=\"padding-left: 10px\">${\n data.team.name\n }</p></a>\n </td>\n <td>${data.playedGames}</td>\n <td>${data.won}</td>\n <td>${data.draw}</td>\n <td>${data.lost}</td>\n <td>${data.goalsFor}</td>\n <td>${data.goalsAgainst}</td>\n <td>${data.goalDifference}</td>\n <td>${data.points}</td>\n </tr>\n `;\n })\n .join(\" \")} \n </tbody>\n </table>\n `;\n });\n document.getElementById(\"data-standings\").innerHTML = dataTable.join(\" \");\n document.getElementById(\"competition\").innerHTML = res.competition.name;\n document.getElementById(\n \"date\"\n ).innerHTML = `${res.season.startDate} / ${res.season.endDate}`;\n })\n .catch(error);\n}", "title": "" }, { "docid": "60eebaf20bc2f9e7c5c9507121715560", "score": "0.55229115", "text": "function getData(){\n pos.board = [];\n fetch(\"/api/games\").then(function(response){if(response.ok){return response.json()}\n}).then(function (json){\n jsongames = json;\n app.player = json.player\n createPos();\n createGames();\n bottons();\n \n });\n }", "title": "" }, { "docid": "2333eeeed2cfb95886d8b7495cc8d548", "score": "0.5520968", "text": "function getPreviousGames() {\n\t$.getJSON(\"/games\").done(function(response){\n\t\tconsole.log(response.games);\n\t\tshowGames(response.games);\n\t});\n}", "title": "" }, { "docid": "0b7209784457776fa929abdbb23704c4", "score": "0.54770654", "text": "updateGames(data) {\n let gameList = []\n const baseimgURL = 'http://media.steampowered.com/steamcommunity/public/images/apps/'\n const games = data.games\n for (let i = 0; i < games.length; i++) {\n let gameEntry = {}\n const game = games[i]\n gameEntry['gameName'] = game.name\n gameEntry['progress'] = 'Calculating...'\n gameEntry['gameImage'] = `${baseimgURL}${game.appid}/${game.img_icon_url}.jpg`\n gameEntry['gameId'] = game.appid\n gameList.push(gameEntry)\n this.setState({ game: gameList })\n }\n this.setState({ game: gameList })\n this.updatePercentages()\n }", "title": "" }, { "docid": "918f924af202c30ecfa9fd62f0235b5c", "score": "0.5463438", "text": "function adbpFFDownload(){\n\ttry {\n\t\ttrackMetrics({\n\t\t\ttype: \"cnt-game-unity-download\",\n\t\t\tdata: {\n\t\t\t\tgame : {\n\t\t\t\t\tdetail:\t\"fusionfall\",\n\t\t\t\t\ttitle:\t\"fusionfall\",\n\t\t\t\t\ttype:\t\"\"\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} catch(e){}\n}", "title": "" }, { "docid": "06468954e06bbf5ff80ef532a8871a46", "score": "0.54632", "text": "function wiiFetch(){\n\tvar createInfo = document.getElementById(\"wiiData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Wii U\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" }, { "docid": "2de7383f913568bc933c5dc7a44a7e04", "score": "0.5460715", "text": "function processDownload() {\n loadPlayList();\n}", "title": "" }, { "docid": "cef5b57e2563666e978ee0369dcc50b4", "score": "0.54587156", "text": "function getAllGamesListed(){\n console.log(\"getting all the games in the database for the select list....\");\n var url = \"/getGames\";\n callAjax(url, handleGamesListed);\n}", "title": "" }, { "docid": "9e4e0a33a7ba181be839a1feedd5b17d", "score": "0.5452687", "text": "getFeaturedPlayers(){\n return client({\n method: 'GET',\n path: PLAYER_SEARCH_ROOT+\"getAllByOrderByEloDesc\",\n params: {\n page: 0,\n size: 3\n }\n })\n }", "title": "" }, { "docid": "9cd5214566a0a26da13dc83393a31b8e", "score": "0.5451207", "text": "function displayGame(req, res, game){\n\n var release = getReleaseDate(game.release_date);\n var banner = getBanner(game.screenshots);\n var rating = getRating(game.rating);\n\n return res.render('game', {\n title: game.display_name,\n layout: 'primary',\n file: 'game',\n user : req.user,\n game: game,\n release: release,\n banner: banner,\n rating: rating,\n oneUpped: helper.hasOneUpped(game.one_ups, req.user)\n });\n}", "title": "" }, { "docid": "cc84805abbcae405362808e4a0242945", "score": "0.5432751", "text": "function loadGame() {\n\ttry {\n\t\tvar gameArray = [];\n\t\t\n\n\t\tfor (var i = 0; i < gameList.length; i++) {\n\t\t\tif (gameList[i].Notification == 1) {\n\n\t\t\t\t//Ti.API.info('gameIcons', \"/images/gameIcons/\" + \"C\" + gameList[i].CTestID + \".png\");\n\n\t\t\t\tgameArray.push({\n\t\t\t\t\ttemplate : \"gameListTemplate\",\n\n\t\t\t\t\tgameNameLabel : {\n\t\t\t\t\t\ttext : gameList[i].CTestName\n\t\t\t\t\t},\n\t\t\t\t\ticonImage : {\n\t\t\t\t\t\timage : \"/images/gameIcons/\" + \"C\" + gameList[i].CTestID + \".png\"\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t$.lstSection.setItems(gameArray);\n\n\t} catch(ex) {\n\t\tcommonFunctions.handleException(\"welcomeContentScreen\", \"loadGame\", ex);\n\t}\n}", "title": "" }, { "docid": "feb22e93e79331bf7bd810a4c7cde6f6", "score": "0.5426773", "text": "function getAvailableGames() {\n ticTacToeData\n .getAvailableGames(auth.access_token())\n .then(function (data) {\n $scope.availableGames = data;\n $scope.allMyGames = $scope.allMyGames.concat(data);\n });\n }", "title": "" }, { "docid": "adb4e24304f6d7bdbe062729b92d61fb", "score": "0.5418031", "text": "function listTeams(data){\n const listOfTeams = data.sort(groupSort).map(item => renderTeamList(item));\n $('.list-of-teams-container').append(listOfTeams);\n}", "title": "" }, { "docid": "4210e5dd2126c35fd6ce7bb823ed9abf", "score": "0.54179794", "text": "function _handleRequestGames(data) {\r\n\tconsole.log('REQUESTED GAMES:', data.toString().trim());\r\n\tstate = SELECT_GAME;\r\n\r\n\tauthServer.write('N\\t' + game + '\\n');\r\n}", "title": "" }, { "docid": "ca6d9bb35f4a179c73a6b5e58a775a31", "score": "0.5410253", "text": "function loadTeamList(displayLeague, displayElement) {\r\n var apiRequest = api + displayLeague;\r\n //fetch selected API\r\n fetch(apiRequest)\r\n .then(response => {\r\n return response.json()\r\n })\r\n .then(data => {\r\n //create the list with the teams from selected league\r\n //each team is represented by a div element that consist of name, picture and short description\r\n var i = 0;\r\n while (i<data.teams.length) {\r\n var team = data.teams[i];\r\n //the picture will be either the badge or the kits\r\n var pic = (displayElement === \"b\") ? team.strTeamBadge : team.strTeamJersey;\r\n //create display box\r\n var teamDiv = createDisplayBox(team.strTeam, pic, team.strDescriptionEN.substring(0, 149) + \"...\");\r\n //append the teamDiv\r\n document.getElementById(\"teams\").appendChild(teamDiv);\r\n i++;\r\n }\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n });\r\n}", "title": "" }, { "docid": "8a0db629e6567f1e9bff76f1b6c32e17", "score": "0.54013747", "text": "function getStandings() {\n if (\"caches\" in window) {\n caches.match(base_url + \"standings\").then(function(response) {\n if (response) {\n response.json().then(function(data) {\n const {\n standings: [{\n table: imgData\n }]\n } = data;\n const standingsHTML = imgData.reduce(\n (html, {\n team: {\n id,\n name,\n crestUrl\n }\n }) => html += `\n <div class=\"card\">\n <div class=\"card-image waves-effect waves-block waves-light\">\n <img src=\"${crestUrl}\" />\n </div>\n </a>\n <div class=\"card-content\">\n <span class=\"card-title truncate\">${name}</span>\n </div>\n </div>\n \n `, '');\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"klasemen\").innerHTML = standingsHTML;\n });\n }\n });\n }\n\n fetch(\"https://api.football-data.org/v2/competitions/2014/standings\", {\n method: \"GET\",\n headers: {\n \"X-Auth-Token\": \"eef638e30ce248bcaef620dfedb5a12e\"\n }\n })\n .then(status)\n .then(json)\n .then(function(data) {\n // Objek/array JavaScript dari response.json() masuk lewat data.\n\n // Menyusun komponen card artikel secara dinamis\n const {\n standings: [{\n table: imgData\n }]\n } = data;\n const standingsHTML = imgData.reduce(\n (html, {\n team: {\n id,\n name,\n crestUrl\n }\n }) => html += `\n\n <div class=\"card\">\n <div class=\"card-image waves-effect waves-block waves-light\">\n <img src=\"${crestUrl}\" />\n </div>\n </a>\n <div class=\"card-content\">\n <span class=\"card-title truncate\">${name}</span>\n </div>\n </div>\n \n `, '');\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"klasemen\").innerHTML = standingsHTML;\n })\n .catch(error);\n}", "title": "" }, { "docid": "b1177173b3fa558bc156c57174718a21", "score": "0.5398897", "text": "function getPlayerList(order)\n{\n\t$.ajax({\n\t\turl: 'index.php?url=player/get/'+order+'/',\n\t\tasync: false,\n\t\tdataType : \"json\"\n\t}).done(function(data) {\n\t\tplayers = data;\n\t\tfillTable();\n\t});\n}", "title": "" }, { "docid": "4bd9000af1b1cd5834f0311bdd19efde", "score": "0.5395881", "text": "render() {\n return (\n <div>\n {this.props.games.length > 0 &&\n <p className=\"App-intro\">Top {Math.min(this.props.gameCount, 10)}/{this.props.gameCount} Games Owned by Playtime</p>\n }\n\n {this.props.games.length > 0 &&\n <ListGroup>\n {this.props.games.map((item, index) =>\n <ListGroupItem key={index} href={'https://store.steampowered.com/app/' + item.appid}>{item.appid} Playtime: {item.playtime_forever} minutes\n {item.playtime_2weeks ? `, Last 2 Weeks: ${item.playtime_2weeks}` : ''}\n </ListGroupItem>\n )}\n </ListGroup>\n }\n </div>\n );\n }", "title": "" }, { "docid": "05cb23289769066d9030ef8039607e1d", "score": "0.5388492", "text": "function getShowAllTeams() {\n if ('caches' in window) {\n caches.match(ENDPOINT_SHOW_ALL_TEAMS).then(function (response) {\n if (response) {\n response.json().then((data) => getViewTeamPremierLeague(data));\n }\n });\n }\n\n fetchAPI(ENDPOINT_SHOW_ALL_TEAMS)\n .then(status)\n .then(json)\n .then(data => getViewTeamPremierLeague(data))\n .catch(error);\n}", "title": "" }, { "docid": "21dc36526e05f32bc9fa510660494fd2", "score": "0.53843987", "text": "function showData () {\n\t\ttoggleControls(\"on\");\n\t\tif(localStorage.length === 0) {\n\t\t\talert(\"There are no games in your library so the default games have been added.\");\n\t\t\tautoFillGames();\n\t\t}\n\t\t//Write data from local storage to the browser\n\t\tvar makeDiv = document.createElement('div');\n\t\tmakeDiv.setAttribute(\"id\", \"items\");\n\t\tvar makeList = document.createElement('ul');\n\t\tmakeDiv.appendChild(makeList);\n\t\tdocument.body.appendChild(makeDiv);\n\t\t$('items').style.display = \"block\";\n\t\tfor(var i=0, len=localStorage.length; i<len;i++) {\n\t\t\tvar makeLi = document.createElement('ol');\n\t\t\tvar linksLi = document.createElement('li');\n\t\t\tmakeList.appendChild(makeLi);\n\t\t\tvar key = localStorage.key(i);\n\t\t\tvar value = localStorage.getItem(key);\n\t\t\t//Convert the string from local storage value back to an object\n\t\t\tvar obj = JSON.parse(value);\n\t\t\tvar makeSubList = document.createElement('ul');\n\t\t\tmakeLi.appendChild(makeSubList);\n\t\t\tgetImage(obj.platforms[1], makeSubList);\n\t\t\tfor(var n in obj) {\n\t\t\t\tvar makeSubli = document.createElement('li');\n\t\t\t\tmakeSubList.appendChild(makeSubli);\n\t\t\t\tvar optSubText = obj[n][0]+\" \"+obj[n][1];\n\t\t\t\tmakeSubli.innerHTML = optSubText;\n\t\t\t\tmakeSubList.appendChild(linksLi);\n\t\t\t}\n\t\t\tmakeItemLinks(localStorage.key(i), linksLi); //Create our edit and delete buttons/link for each item in local storage.\n\t\t}\n\t}", "title": "" }, { "docid": "c66140017efe7505edd646e5cb6581b9", "score": "0.5383495", "text": "function getstandings() {\n if (\"caches\" in window) {\n caches.match(base_url + \"competitions/2019/standings?standingType=TOTAL\", {\n headers: {\n 'X-Auth-Token': \"2e757173d9c24a2689902c37e49daef3\"\n }\n }).then(function(response) {\n if (response) {\n response.json().then(function(data) {\n\n // console.log();\n // Objek/array JavaScript dari response.json() masuk lewat data.\n\n // Menyusun komponen card artikel secara dinamis\n var standingsHTML = \"\";\n data.standings[0].table.forEach(funStandings);\n function funStandings(standing){\n standingsHTML += `\n <tr>\n <td>${standing.position}</td>\n <td><img src=\"${standing.team.crestUrl}\" width=\"40px\" /></td>\n <td> \n <a href=\"./club.html?id=${standing.team.id}\" style=\"text-decoration: none;\" >\n ${standing.team.name}\n </a>\n </td>\n <td>${standing.playedGames}</td>\n <td>${standing.won}</td>\n <td>${standing.draw}</td>\n <td>${standing.lost}</td>\n <td>${standing.points}</td>\n <td>${standing.goalsFor}</td>\n <td>${standing.goalsAgainst}</td>\n <td>${standing.goalDifference}</td>\n </tr>\n `;\n }\n\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"standings\").innerHTML = standingsHTML;\n });\n }\n });\n }\n\n\n fetch(base_url + \"competitions/2019/standings?standingType=TOTAL\", {\n headers: {\n 'X-Auth-Token': \"2e757173d9c24a2689902c37e49daef3\"\n }\n })\n .then(status)\n .then(json)\n .then(function(data) {\n console.log('sukses fetch');\n // console.log(data.standings[0].table[12].team.name, \"Poor :'(\" );\n\n // console.log();\n // Objek/array JavaScript dari response.json() masuk lewat data.\n\n // Menyusun komponen card artikel secara dinamis\n var standingsHTML = \"\";\n data.standings[0].table.forEach(funStandings);\n function funStandings(standing){\n // console.log(standing.team.name);\n standingsHTML += `\n <tr>\n <td>${standing.position}</td>\n <td><img src=\"${standing.team.crestUrl}\" width=\"40px\" /></td>\n <td> \n <a href=\"./club.html?id=${standing.team.id}\" style=\"text-decoration: none;\" >\n ${standing.team.name}\n </a>\n </td>\n <td>${standing.playedGames}</td>\n <td>${standing.won}</td>\n <td>${standing.draw}</td>\n <td>${standing.lost}</td>\n <td>${standing.points}</td>\n <td>${standing.goalsFor}</td>\n <td>${standing.goalsAgainst}</td>\n <td>${standing.goalDifference}</td>\n </tr>\n `;\n }\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"standings\").innerHTML = standingsHTML;\n })\n .catch(error);\n}", "title": "" }, { "docid": "71ee9a22f8d6c1d316526d08e7dd81cc", "score": "0.5381999", "text": "function loadScoreboardInGame() {\n\n $.ajaxSetup({ cache: true});\n \n $.getJSON(\"http://data.nba.com/data/v2015/json/mobile_teams/nba/2016/scores/gamedetail/\" + gameID + \"_gamedetail.json\", \n function(data){\n \n var gamestatus = data.g[\"stt\"];\n var clock = data.g[\"cl\"];\n\n if (cavsHOME == 1){\n var oppBox = data.g.vls[\"s\"];\n var cavsBox = data.g.hls[\"s\"];\n } else {\n var oppBox = data.g.hls[\"s\"];\n var cavsBox = data.g.vls[\"s\"];\n }\n\n if (gamestatus == \"Halftime\" || gamestatus == \"Final\") {\n var status = gamestatus;\n } else {\n var status = clock + ' - '+ gamestatus; //clock + ' - '+ gamestatus\n }\n\n document.getElementById(\"opp-score\").innerHTML=oppBox;\n document.getElementById(\"cavs-score\").innerHTML=cavsBox; \n document.getElementById(\"api-gameday\").innerHTML=status;\n\n \n \n });\n\n}", "title": "" }, { "docid": "205bd4326a36cabcb3acb5da405ba743", "score": "0.5380571", "text": "function getSports() {\n hideButtonsAndText();\n let url = INDEX_URL + \"sport=list\";\n fetch(url, {mode: 'cors'})\n .then(checkStatus)\n .then(showSports)\n .catch(printError);\n }", "title": "" }, { "docid": "a9a90ed0de15dc52f498c3d863930227", "score": "0.5380426", "text": "function buildInitialListOfGames() {\n for (var i = 0; i < dataForPreSelectedGames.length; i++) {\n new BuildGameItem(dataForPreSelectedGames[i][0], dataForPreSelectedGames[i]\n [1], dataForPreSelectedGames[i][2], dataForPreSelectedGames[i][3],\n dataForPreSelectedGames[i][4], dataForPreSelectedGames[i][5],\n dataForPreSelectedGames[i][6], dataForPreSelectedGames[i][7], 'gameId' + [\n i\n ], false);\n }\n}", "title": "" }, { "docid": "dbbdf550e16dea7a44dbb2d705bf1c2d", "score": "0.53743327", "text": "function overviewPage(req, res) {\n\tres.locals.query = req.query;\n\n\tlet promiseData = [];\n\n\tif(Object.keys(req.query).length == 0) {\n\t\tpromiseData.push(rawg.getNewTrendingList());\n\t\tpromiseData.push(rawg.getList('genres'));\n\t} \n\telse promiseData.push(rawg.getList('games', req.query));\n\n\tPromise.all(promiseData)\n\t\t.then( data => {\n\t\t\tif(data.length > 1) res.locals.genres = data[1].results;\n\t\t\telse res.locals.genres = [];\n\n\t\t\tres.locals.next = data[0].next;\n\t\t\tres.locals.prev = data[0].previous;\n\n\t\t\treturn data[0].results;\n\t\t})\n\t\t.then((games) => data.checkImage(games))\n\t\t.then((games) => data.checkParentPlatforms(games))\n\t\t.then((games) => {\n\t\t\tres.locals.games = games;\n\t\t})\n\t\t.catch(() => res.locals.notification = { type: 'error' })\n\t\t.finally(() => res.render('games/overview-page.ejs'));\n}", "title": "" }, { "docid": "747a67a778d93e31c82cd1d1badc30e9", "score": "0.5373455", "text": "getLiveLeagueGames() {\n const query_params = {\n key: this.apiKey\n }\n return fetch(BASE_URL + DOTA_MATCHES + 'GetLiveLeagueGames/v1/?' + handleQueryParams(query_params))\n .then(response => responseHandler(response))\n .catch(e => e)\n }", "title": "" }, { "docid": "8ddb235925e3997e3b93cb97b6c16f42", "score": "0.5369859", "text": "function getAllData() {\n fillPlayerList();\n}", "title": "" }, { "docid": "37ddc870bcadab62f9bd42c7e38f70dc", "score": "0.5367645", "text": "function getGamesList(){ \n\n var games_deserialized = JSON.parse(localStorage.getItem('gamesStored'));\n\n var games = games_deserialized.games;\n\n /* Creates a Form Select element to allow choosing the Game to display the information*/\n var output = '<div id=\"choose-game-div\">';\n output += '<p id=\"select-paragraph\">Select your game: </p>';\n output += '<form>';\n output +='<select id=\"games_select\" onchange=\"gamesSelect()\" >';\n output += '<option value=\"choose\">Choose Game</option>';\n for (var i=0; i < games.length; i++){\n output += '<option value=\"'+i+'\">'+ games[i].name+'</option>';\n }\n output += '</select>';\n output += '</form>';\n output += '</div>';\n\n /* Creates a Form Select element to choose which game is to be deleted from list */\n output += '<div id=\"delete-game-div\">';\n output += '<p id=\"delete-paragraph\">Delete game from list: </p>';\n output += '<form>';\n output +='<select id=\"game_delete\" onchange=\"gameDelete()\">';\n output += '<option value=\"choose\">Choose Game</option>';\n for (var i=0; i < games.length; i++){\n output += '<option value=\"'+i+'\">'+ games[i].name+'</option>';\n }\n output += '</select>';\n output += '</form>';\n output += '</div>';\n \n document.getElementById(\"game-name\").innerHTML=output;\n}", "title": "" }, { "docid": "7ed19488eef7367ea37ccd15f791cc96", "score": "0.53676385", "text": "async function getAllFutureGames(){\n // Next games\n const currentDate = new Date();\n const timestamp = currentDate.getTime(); \n const future_games = await DButils.execQuery(\n `SELECT * FROM dbo.Games WHERE game_timestamp >= '${timestamp}' `\n );\n future_games.sort(function(first, second) {\n return first.game_timestamp - second.game_timestamp;\n });\n return future_games\n}", "title": "" }, { "docid": "b28fcb41bc2ad71d279bd05297be5f88", "score": "0.5365172", "text": "function getStanding() {\n if (\"caches\" in window) {\n caches.match(ENDPOINT_COMPETITION).then(function (response) {\n if (response) {\n response.json().then(function (data) {\n console.log(\"Competition Data: \" + data);\n showStanding(data);\n });\n }\n });\n }\n\n fetchAPI(ENDPOINT_COMPETITION)\n .then((data) => {\n showStanding(data);\n })\n .catch((error) => {\n console.log(error);\n });\n}", "title": "" }, { "docid": "ff692f3dddf3d1ca2253b8da58304e64", "score": "0.5358763", "text": "function getTeam() {\n if (\"caches\" in window) {\n caches.match(base_url + \"teams\").then(function(response) {\n if (response) {\n response.json().then(function(data) {\n\n // Untuk pengambilan nya benar atau tidak?\n \n var standingsHTML = \"\";\n teams.forEach(function(team) {\n standingsHTML += `\n\n <div class=\"card\">\n <div class=\"card-image waves-effect waves-block waves-light\">\n <img src=\"${team.crestUrl}\" />\n </div>\n </a>\n <div class=\"card-content\">\n <span class=\"card-title truncate\">${team.name}</span>\n </div>\n </div>\n \n `; ''});\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"clubs\").innerHTML = standingsHTML;\n });\n }\n });\n }\n\n\n fetch(\"https://api.football-data.org/v2/competitions/2014/teams\", {\n method: \"GET\",\n headers: {\n \"X-Auth-Token\": \"eef638e30ce248bcaef620dfedb5a12e\"\n }\n })\n .then(status)\n .then(json)\n .then(function(data) {\n // Objek/array JavaScript dari response.json() masuk lewat data.\n\n // Menyusun komponen card artikel secara dinamis\n var standingsHTML = \"\";\n teams.forEach(function(team) {\n standingsHTML += `\n\n <div class=\"card\">\n <div class=\"card-image waves-effect waves-block waves-light\">\n <img src=\"${team.crestUrl}\" />\n </div>\n </a>\n <div class=\"card-content\">\n <span class=\"card-title truncate\">${team.name}</span>\n </div>\n </div>\n \n `; ''});\n // Sisipkan komponen card ke dalam elemen dengan id #content\n document.getElementById(\"clubs\").innerHTML = standingsHTML;\n })\n .catch(error);\n}", "title": "" }, { "docid": "90a4f1864a967a002ee2a3b387de08b9", "score": "0.5355249", "text": "getGames() {\n return axios.get(Constants.GAMES_ENDPOINT)\n .then((result) => {\n return result.data;\n })\n }", "title": "" }, { "docid": "a36d9d21a7483eb997b74898a99c25a2", "score": "0.53255314", "text": "function onLoad() {\n //Load top 3 popular animes on the page\n MakeAPICallToPopularAnimeInfo();\n //Load the ranking by members\n MakeAPICallToRanking('members');\n //Load the ranking by ranking\n MakeAPICallToRanking('ranked');\n //Load the ranking by score\n MakeAPICallToRanking('score');\n}", "title": "" }, { "docid": "efa535b635404015d92eae7b41522fba", "score": "0.5325081", "text": "async function fetchData() {\n const request = await axios.get(fetchUrl);\n setGames(request.data.results);\n return request;\n }", "title": "" }, { "docid": "142be8aa7e3c5bf08109ce406f2b1f29", "score": "0.5323066", "text": "function loadTeams() {\n doAjax(TEAM_URL + '/get').then(data => {\n data.forEach(team => {\n console.log('Team ->', team.name);\n });\n });\n}", "title": "" }, { "docid": "f229ceb07759103c2ad2e2f370e88fbf", "score": "0.5322596", "text": "function fetchReplay(command, replayIdOrName, apiUrl, callback){\r\n\r\n const includes = 'include=mapVersion,playerStats,mapVersion.map,playerStats.player,featuredMod,playerStats.player.globalRating,playerStats.player.ladder1v1Rating';\r\n let fetchUrl = apiUrl+'game?filter=id=='+replayIdOrName+'&'+includes;\r\n\r\n if (command == 'lastreplay'){\r\n\t\tfetchUrl = apiUrl+'game?filter=playerStats.player.login==\"'+replayIdOrName+'\"&sort=-endTime&page[size]=1&'+includes;\r\n }\r\n\r\n utils.httpsFetch(fetchUrl, function(d){\r\n\t\tif (Number.isInteger(d)){\r\n\t\t\tcallback(\"Server returned the error `\"+d+\"`.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst data = JSON.parse(d);\r\n\r\n\t\tif (data != undefined && data.data != undefined && (\r\n\t\t\t\t(Array.isArray(data.data) && data.data.length > 0) || data.data.attributes != undefined)\r\n\t\t\t){\r\n\r\n\t\t\tdata.data = data.data[0];\r\n\r\n\t\t\tlet replay = {\r\n\t\t\t\tid : replayIdOrName,\r\n\t\t\t\tname : data.data.attributes.name,\r\n\t\t\t\treplayUrl : data.data.attributes.replayUrl.replace(/( )/g, \"%20\"),\r\n\t\t\t\tstartTime : data.data.attributes.startTime,\r\n\t\t\t\tvictoryCondition : data.data.attributes.victoryCondition,\r\n\t\t\t\tvalidity : data.data.attributes.validity,\r\n\t\t\t\tgameType: \"\",\r\n\t\t\t\ttechnicalGameType: \"\",\r\n\t\t\t\timgUrl: \"\",\r\n\t\t\t\tmapName: \"\",\r\n\t\t\t\tmapVersion: \"\",\r\n\t\t\t\tmapType: \"\",\r\n\t\t\t\tmapSize: \"\",\r\n\t\t\t\tplayers: {},\r\n\t\t\t\tranked:false\r\n\t\t\t}\r\n\r\n\t\t\tconst inc = data.included;\r\n\r\n\t\t\tfor (let i = 0; i < inc.length; i++){\r\n\t\t\t\tlet thisData = inc[i];\r\n\t\t\t\tswitch (thisData.type){\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"mapVersion\":\r\n\t\t\t\t\t\treplay.imgUrl = thisData.attributes.thumbnailUrlSmall.replace(/( )/g, \"%20\");\r\n\t\t\t\t\t\treplay.mapVersion = thisData.attributes.version;\r\n\t\t\t\t\t\treplay.mapSize = ((thisData.attributes.width/512)*10)+\"x\"+((thisData.attributes.height/512)*10)+\" km\";\r\n\t\t\t\t\t\treplay.ranked = thisData.attributes.ranked;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"map\":\r\n\t\t\t\t\t\treplay.mapName = thisData.attributes.displayName;\r\n\t\t\t\t\t\treplay.mapType = thisData.attributes.mapType;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"gamePlayerStats\":\r\n\t\t\t\t\t\tconst gpsid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\tif (replay.players[gpsid] == undefined){\r\n\t\t\t\t\t\t\treplay.players[gpsid] = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treplay.players[gpsid].slot = thisData.attributes.startSpot;\r\n\t\t\t\t\t\treplay.players[gpsid].score = thisData.attributes.score;\r\n\t\t\t\t\t\treplay.players[gpsid].faction = thisData.attributes.faction;\r\n\t\t\t\t\t\treplay.players[gpsid].ai = thisData.attributes.ai;\r\n\t\t\t\t\t\treplay.players[gpsid].team = thisData.attributes.team;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"player\":\r\n\t\t\t\t\t\tconst pid = thisData.id;\r\n\t\t\t\t\t\tif (replay.players[pid] == undefined){\r\n\t\t\t\t\t\t\treplay.players[pid] = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treplay.players[pid].name = thisData.attributes.login;\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"featuredMod\":\r\n\t\t\t\t\t\tswitch (thisData.attributes.technicalName){\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\treplay.gameType = thisData.attributes.displayName;\r\n\t\t\t\t\t\t\t\treplay.technicalGameType = thisData.attributes.technicalName;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase \"faf\":\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"ladder1v1Rating\":\r\n\t\t\t\t\t\tconst lid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\treplay.players[lid].ladderRating = Math.floor(thisData.attributes.rating);\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"globalRating\":\r\n\t\t\t\t\t\tconst gid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\treplay.players[gid].globalRating = Math.floor(thisData.attributes.rating);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet gm = replay.gameType;\r\n\t\t\tif (replay.gameType != \"\"){\r\n\t\t\t\tgm = \"[\"+gm+\"] \";\r\n\t\t\t}\r\n\r\n\t\t\tlet embedMes = {\r\n\t\t\t \"embed\": {\r\n\t\t\t\t\"title\": \"**Download replay #\"+replay.id+\"**\",\r\n\t\t\t\t\"url\": replay.replayUrl,\r\n\t\t\t\t\"color\": 0xFF0000,\r\n\t\t\t\t\"thumbnail\": {\r\n\t\t\t\t \"url\": replay.imgUrl\r\n\t\t\t\t},\r\n\t\t\t\t\"author\": {\r\n\t\t\t\t \"name\": gm+replay.name,\r\n\t\t\t\t \"url\": replay.replayUrl,\r\n\t\t\t\t},\r\n\t\t\t\t\"fields\": [\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Start time\",\r\n\t\t\t\t\t\"value\": replay.startTime,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Victory Condition\",\r\n\t\t\t\t\t\"value\": replay.victoryCondition,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Validity\",\r\n\t\t\t\t\t\"value\": replay.validity,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Map is ranked\",\r\n\t\t\t\t\t\"value\": replay.ranked.toString(),\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Map info\",\r\n\t\t\t\t\t\"value\": replay.mapName+\" [\"+replay.mapVersion+\"] (\"+replay.mapSize+\")\"\r\n\t\t\t\t }\r\n\t\t\t\t]\r\n\t\t\t }\r\n\t\t\t}\r\n\r\n\t\t\tconst keys = Object.keys(replay.players);\r\n\t\t\tfor (let i = 0; i < keys.length; i++){\r\n\t\t\t\tconst id = keys[i];\r\n\t\t\t\tconst p = replay.players[id];\r\n\r\n\t\t\t\tlet rating = \"0\";\r\n\r\n\t\t\t\tif (replay.technicalGameType == \"ladder1v1\"){\r\n\t\t\t\t\trating = \"L\"+p.ladderRating;\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\trating = \"G\"+p.globalRating;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet pNameString = \"\"+utils.getFaction(p.faction).substring(0, 1).toUpperCase()+\" - \"+p.name+\" [\"+rating+\"]\";\r\n\r\n\t\t\t\tlet value = \"\";\r\n\r\n\t\t\t\tif (!replay.validity.includes(\"FFA\")){\r\n\t\t\t\t\tvalue += \"Team \"+p.team+\"\\n\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvalue += \"Score: \"+p.score+\"\\n\";\r\n\t\t\t\tif (p.ai){\r\n\t\t\t\t\tpNameString = \"AI \"+pNameString;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tembedMes[\"embed\"].fields.push({\"name\":pNameString, \"value\": value, \"inline\": true});\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcallback(embedMes);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tcallback(\"Replay not found.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n });\r\n}", "title": "" }, { "docid": "a1fb984b7b9d3dafda7b0fda0b39423a", "score": "0.5322596", "text": "function fetchReplay(command, replayIdOrName, apiUrl, callback){\r\n\r\n const includes = 'include=mapVersion,playerStats,mapVersion.map,playerStats.player,featuredMod,playerStats.player.globalRating,playerStats.player.ladder1v1Rating';\r\n let fetchUrl = apiUrl+'game?filter=id=='+replayIdOrName+'&'+includes;\r\n\r\n if (command == 'lastreplay'){\r\n\t\tfetchUrl = apiUrl+'game?filter=playerStats.player.login==\"'+replayIdOrName+'\"&sort=-endTime&page[size]=1&'+includes;\r\n }\r\n\r\n utils.httpsFetch(fetchUrl, function(d){\r\n\t\tif (Number.isInteger(d)){\r\n\t\t\tcallback(\"Server returned the error `\"+d+\"`.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst data = JSON.parse(d);\r\n\r\n\t\tif (data != undefined && data.data != undefined && (\r\n\t\t\t\t(Array.isArray(data.data) && data.data.length > 0) || data.data.attributes != undefined)\r\n\t\t\t){\r\n\r\n\t\t\tdata.data = data.data[0];\r\n\r\n\t\t\tlet replay = {\r\n\t\t\t\tid : replayIdOrName,\r\n\t\t\t\tname : data.data.attributes.name,\r\n\t\t\t\treplayUrl : data.data.attributes.replayUrl.replace(/( )/g, \"%20\"),\r\n\t\t\t\tstartTime : data.data.attributes.startTime,\r\n\t\t\t\tvictoryCondition : data.data.attributes.victoryCondition,\r\n\t\t\t\tvalidity : data.data.attributes.validity,\r\n\t\t\t\tgameType: \"\",\r\n\t\t\t\ttechnicalGameType: \"\",\r\n\t\t\t\timgUrl: \"\",\r\n\t\t\t\tmapName: \"\",\r\n\t\t\t\tmapVersion: \"\",\r\n\t\t\t\tmapType: \"\",\r\n\t\t\t\tmapSize: \"\",\r\n\t\t\t\tplayers: {},\r\n\t\t\t\tranked:false\r\n\t\t\t}\r\n\r\n\t\t\tconst inc = data.included;\r\n\r\n\t\t\tfor (let i = 0; i < inc.length; i++){\r\n\t\t\t\tlet thisData = inc[i];\r\n\t\t\t\tswitch (thisData.type){\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"mapVersion\":\r\n\t\t\t\t\t\treplay.imgUrl = thisData.attributes.thumbnailUrlSmall.replace(/( )/g, \"%20\");\r\n\t\t\t\t\t\treplay.mapVersion = thisData.attributes.version;\r\n\t\t\t\t\t\treplay.mapSize = ((thisData.attributes.width/512)*10)+\"x\"+((thisData.attributes.height/512)*10)+\" km\";\r\n\t\t\t\t\t\treplay.ranked = thisData.attributes.ranked;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"map\":\r\n\t\t\t\t\t\treplay.mapName = thisData.attributes.displayName;\r\n\t\t\t\t\t\treplay.mapType = thisData.attributes.mapType;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"gamePlayerStats\":\r\n\t\t\t\t\t\tconst gpsid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\tif (replay.players[gpsid] == undefined){\r\n\t\t\t\t\t\t\treplay.players[gpsid] = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treplay.players[gpsid].slot = thisData.attributes.startSpot;\r\n\t\t\t\t\t\treplay.players[gpsid].score = thisData.attributes.score;\r\n\t\t\t\t\t\treplay.players[gpsid].faction = thisData.attributes.faction;\r\n\t\t\t\t\t\treplay.players[gpsid].ai = thisData.attributes.ai;\r\n\t\t\t\t\t\treplay.players[gpsid].team = thisData.attributes.team;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"player\":\r\n\t\t\t\t\t\tconst pid = thisData.id;\r\n\t\t\t\t\t\tif (replay.players[pid] == undefined){\r\n\t\t\t\t\t\t\treplay.players[pid] = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treplay.players[pid].name = thisData.attributes.login;\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"featuredMod\":\r\n\t\t\t\t\t\tswitch (thisData.attributes.technicalName){\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\treplay.gameType = thisData.attributes.displayName;\r\n\t\t\t\t\t\t\t\treplay.technicalGameType = thisData.attributes.technicalName;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase \"faf\":\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"ladder1v1Rating\":\r\n\t\t\t\t\t\tconst lid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\treplay.players[lid].ladderRating = Math.floor(thisData.attributes.rating);\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"globalRating\":\r\n\t\t\t\t\t\tconst gid = thisData.relationships.player.data.id;\r\n\t\t\t\t\t\treplay.players[gid].globalRating = Math.floor(thisData.attributes.rating);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet gm = replay.gameType;\r\n\t\t\tif (replay.gameType != \"\"){\r\n\t\t\t\tgm = \"[\"+gm+\"] \";\r\n\t\t\t}\r\n\r\n\t\t\tlet embedMes = {\r\n\t\t\t \"embed\": {\r\n\t\t\t\t\"title\": \"**Download replay #\"+replay.id+\"**\",\r\n\t\t\t\t\"url\": replay.replayUrl,\r\n\t\t\t\t\"color\": 0xFF0000,\r\n\t\t\t\t\"thumbnail\": {\r\n\t\t\t\t \"url\": replay.imgUrl\r\n\t\t\t\t},\r\n\t\t\t\t\"author\": {\r\n\t\t\t\t \"name\": gm+replay.name,\r\n\t\t\t\t \"url\": replay.replayUrl,\r\n\t\t\t\t},\r\n\t\t\t\t\"fields\": [\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Start time\",\r\n\t\t\t\t\t\"value\": replay.startTime,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Victory Condition\",\r\n\t\t\t\t\t\"value\": replay.victoryCondition,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Validity\",\r\n\t\t\t\t\t\"value\": replay.validity,\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Ranked\",\r\n\t\t\t\t\t\"value\": replay.ranked.toString(),\r\n\t\t\t\t\t\"inline\": true\r\n\t\t\t\t },\r\n\t\t\t\t {\r\n\t\t\t\t\t\"name\": \"Map info\",\r\n\t\t\t\t\t\"value\": replay.mapName+\" [\"+replay.mapVersion+\"] (\"+replay.mapSize+\")\"\r\n\t\t\t\t }\r\n\t\t\t\t]\r\n\t\t\t }\r\n\t\t\t}\r\n\r\n\t\t\tconst keys = Object.keys(replay.players);\r\n\t\t\tfor (let i = 0; i < keys.length; i++){\r\n\t\t\t\tconst id = keys[i];\r\n\t\t\t\tconst p = replay.players[id];\r\n\r\n\t\t\t\tlet rating = \"0\";\r\n\r\n\t\t\t\tif (replay.technicalGameType == \"ladder1v1\"){\r\n\t\t\t\t\trating = \"L\"+p.ladderRating;\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\trating = \"G\"+p.globalRating;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet pNameString = \"\"+utils.getFaction(p.faction).substring(0, 1).toUpperCase()+\" - \"+p.name+\" [\"+rating+\"]\";\r\n\r\n\t\t\t\tlet value = \"\";\r\n\r\n\t\t\t\tif (!replay.validity.includes(\"FFA\")){\r\n\t\t\t\t\tvalue += \"Team \"+p.team+\"\\n\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvalue += \"Score: \"+p.score+\"\\n\";\r\n\t\t\t\tif (p.ai){\r\n\t\t\t\t\tpNameString = \"AI \"+pNameString;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tembedMes[\"embed\"].fields.push({\"name\":pNameString, \"value\": value, \"inline\": true});\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcallback(embedMes);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tcallback(\"Replay not found.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n });\r\n}", "title": "" }, { "docid": "7f5abf318c5bdb383583b5e065273b15", "score": "0.53224957", "text": "function getGames() {\n let url = 'https://limitless-tor-81099.herokuapp.com/gamesapi';\n fetch(url)\n .then((resp) => resp.json())\n .then(function(data) {\n\n generateGamesList(data);\n\n // form event listener (for delete and edit), needs to be here as games are added to DOM\n $('.modify').on('submit', function (event) {\n event.preventDefault();\n // var to grab ID for delete function\n let deleteId = $(this).closest('.card-content').find('.js-gameid').text();\n // var to find closest cancel button (only one) within clicked game\n let cancelBtn = $(this).closest('.card-content').find('.cancelBtn');\n // var to find closest modal (only one) within clicked game\n let modal = document.getElementById('editmodal-'+deleteId);\n // var for URL of specific game\n let url = `https://limitless-tor-81099.herokuapp.com/gamesapi/${deleteId}`;\n // grab the clicked button type (either edit or delete)\n let id = $(document.activeElement).attr('id')\n\n if (id == 'edit')\n {\n console.log(\"ID of game is \"+deleteId);\n // listen for clicks to cancel button, and outside of modal\n cancelBtn[0].addEventListener('click', closeModal);\n window.addEventListener('click', clickOutside);\n\n // close modal\n function closeModal(){\n modal.style.display = 'none';\n }\n\n // close modal if outside clicked\n function clickOutside(e){\n if(e.target == modal){\n modal.style.display = 'none';\n }\n }\n // pop up modal specific\n modal.style.display = 'block';\n }\n else {\n // delete game using Fetch\n // doesn't seem to throw the catch if there's an error\n fetch(url, {\n method: 'delete'\n })\n .then(function(res) {\n // if res.status != 200 or deleted\n toastr.success('Game has been deleted', 'Success');\n getGames();\n return res.json();\n })\n .catch(function(err) { \n console.log('Error deleting game', err); \n })\n }\n });\n\n // form event listener for modal (PUT) and update function\n // need to set up a unique id for the event listerer and hope it works, otherwise need to set unique IDs for each item in the form object\n $(`.modal-form`).on('submit', function(event) {\n event.preventDefault();\n // debugger;\n // grab the form data, I'm wondering if find closest would work\n const formData = {\n \"_id\": $(this).closest('.modal-body').find(':hidden').val(),\n \"title\": $(this).closest('.modal-body').find('.edittitle').val(),\n \"platform\": $(this).closest('.modal-body').find('.editplatform').val(),\n \"status\": $(this).closest('.modal-body').find('.editstatus').val(),\n \"comments\": $(this).closest('.modal-body').find('.editcomments').val(),\n \"dateAdded\": $(this).closest('.modal-body').find('.editdateadded').val(),\n \"lastPlayed\": $(this).closest('.modal-body').find('.editlastplayed').val()\n }\n \n // debug for JSON object\n console.log(\"stringified \"+JSON.stringify(formData));\n \n // grab the ID of the game and set up the request URL\n const updateId = $(this).closest('.modal-body').find(':hidden').val();\n console.log(updateId);\n let url = `https://limitless-tor-81099.herokuapp.com/gamesapi/${updateId}`;\n \n // update game using Fetch API PUT\n \n fetch(url, {\n method: 'put',\n headers: {\n 'Content-Type': 'application/json'\n },\n // adding JSON.stringify to add \"\" to JS object keys\n body: JSON.stringify(formData)})\n .then(function(res) {\n // adding toastr alert\n toastr.success('Game has been updated', 'Success');\n // get new games list\n getGames();\n return res.json();\n })\n .catch(function(err) { console.log('Error updating game', err); \n }); \n }); \n })\n }", "title": "" }, { "docid": "1066df36c0a14daa4705407b2a563ef5", "score": "0.5320285", "text": "async getGameInfos() {\n\t\tawait this.login(LOGIN_ACCOUNT_GAUTIER)\n\t\tconst game = await this.sendRequest({ rsn:'2ynbmhanlb',guide:{ login:{ language:1,platform:'gaotukc',ug:'' } } }, '699002934')\n\n\t\treturn game.a\n\t}", "title": "" }, { "docid": "76e220bde49ab9aa6a085f886e75de55", "score": "0.53023016", "text": "async function main(){\n validateReportPaths();\n let tabsContents = await fetchAllTabs();\n //no tabs have items or api limit\n if(failedToFetch){\n console.log(\"failed to fetch Items\"); \n return 404;\n }\n failedToFetch = false;\n\n let hortiItems = fetchHortiItems(tabsContents);\n hortiItems = formatCrafts(hortiItems);\n let groupedCrafts = GroupCrafts_FunctionTypeLevel(hortiItems);\n \n toFile(groupedCrafts);\n toDiscordFile(groupedCrafts);\n console.log(\"updated\", new Date().toTimeString())\n}", "title": "" }, { "docid": "4f64310cab4b98086bb8cc3974b533e7", "score": "0.5296951", "text": "function newGameFetch() {\n event.preventDefault();\n let playerOneId = selectPlayerOne[selectPlayerOne.selectedIndex].dataset.playerId\n let playerTwoId = selectPlayerTwo[selectPlayerTwo.selectedIndex].dataset.playerId\n playerOneName.innerHTML = selectPlayerOne[selectPlayerOne.selectedIndex].innerHTML\n playerTwoName.innerHTML = selectPlayerTwo[selectPlayerTwo.selectedIndex].innerHTML\n fetch('http://localhost:3000/api/v1/games', postGameObj(playerOneId, playerTwoId))\n .then(res => res.json())\n .then(gameData => appendGamePage(gameData))\n .catch(errors => console.log(errors.messages))\n}", "title": "" }, { "docid": "24315ab0519ed8cc364835b592ddcea2", "score": "0.5291628", "text": "renderGameList() {\n if (this.state.games) {\n if (this.state.games.length > 0) {\n return _.map(this.state.games, (game, id) =>\n <LinkContainer to={\"/pick-tickets?event=\" + game.event_id}>\n <div className={'childItem'}>\n <Card interactive={true} elevation={3}>\n <div className={'versusDate'}><Time value={game.date} format={\"D\"}/></div>\n <div className={'versusMonth'}><Time value={game.date} format={\"MMMM\"}/></div>\n <div className={'versusTime'}><Time value={game.date} format={\"h:mmA\"}/></div>\n </Card>\n </div>\n </LinkContainer>\n );\n }\n return <h4 className='unselectable text-center'>No games against selected team</h4>;\n }\n return <h3 className='unselectable text-center' style={{paddingTop: '30px'}}>\n Select a team logo to find your game</h3>\n }", "title": "" }, { "docid": "52cb4f5fb501852db51ac12e86dc6d44", "score": "0.5289588", "text": "function parseGames() {\n // Array of games\n gameArr = [];\n // Function for the parser\n var parseGame = function (articles) {\n $.map(articles, function (val, index) {\n var gameData = {};\n gameArr.push(gameData);\n });\n return gameArr;\n };\n // Create Jquery object\n var articles = AIData;\n // Save all the games\n gameArr = parseGame(articles);\n // Display the current game\n //showGame();\n } // --> parseGames", "title": "" }, { "docid": "4cc025bffe7eef4ea1baf3243d7751b2", "score": "0.5285704", "text": "function getStandings() {\n if (\"caches\" in window) {\n caches.match(base_url + \"competitions/2002/standings\").then(function(response) {\n if (response) {\n response.json().then(function(data) {\n var articlesHTML = \n `<table class=\"responsive-table\" style=\"font-size:16px center;\">\n <thead>\n <tr> \n <th>Team</th>\n <th>Logo</th>\n <th>Won</th>\n <th>Draw</th>\n <th>Lost</th>\n <th>Goal Difference</th>\n <th>Goal Against</th> \n <th>Goal</th>\n <th>Played Games</th> \n <th>Points</th>\n <th>Position</th>\n </tr>\n </thead>\n <tbody>\n `;\n data.standings[\"0\"].table.forEach(function(item){\n articlesHTML += `\n <tr>\n <td>${item.team.name}</td>\n <td style><img style=\"width:50px;\" src=\"${item.team.crestUrl.replace(/^http:\\/\\//i, 'https://')}\"></td>\n <td>${item.won}</td> \n <td>${item.draw}</td>\n <td>${item.lost}</td>\n <td>${item.goalDifference}</td>\n <td>${item.goalsAgainst}</td>\n <td>${item.goalsFor}</td>\n <td>${item.playedGames}</td>\n <td>${item.points}</td>\n <td>${item.position}</td>\n </tr>\n `;\n });\n articlesHTML += `\n </tbody>\n </table>\n `;\n });\n document.getElementById(\"articles\").innerHTML = articlesHTML;\n var save = document.getElementById(\"save\");\n }\n });\n }\n \n fetchApi(base_url + \"competitions/2002/standings\") \n .then(res => {\n if (res.status !== 200) {\n console.log(\"Error : \" + response.status);\n return Promise.reject(new Error(response.statusText))\n } else {\n return Promise.resolve(res)\n }\n })\n .then(res => res.json())\n .then(function(data) {\n var articlesHTML = \n `<table class=\"responsive-table\" style=\"font-size:16px center;\">\n <thead>\n <tr> \n <th>Team</th>\n <th>Logo</th>\n <th>Won</th>\n <th>Draw</th>\n <th>Lost</th>\n <th>Goal Difference</th>\n <th>Goal Against</th> \n <th>Goal</th>\n <th>Played Games</th> \n <th>Points</th>\n <th>Position</th>\n </tr>\n </thead>\n <tbody>\n `;\n data.standings[\"0\"].table.forEach(function(item){\n articlesHTML += `\n <tr>\n <td>${item.team.name}</td>\n <td style><img style=\"width:50px;\" src=\"${item.team.crestUrl.replace(/^http:\\/\\//i, 'https://')}\"></td>\n <td>${item.won}</td> \n <td>${item.draw}</td>\n <td>${item.lost}</td>\n <td>${item.goalDifference}</td>\n <td>${item.goalsAgainst}</td>\n <td>${item.goalsFor}</td>\n <td>${item.playedGames}</td>\n <td>${item.points}</td>\n <td>${item.position}</td>\n </tr>\n `;\n });\n articlesHTML += `\n </tbody>\n </table>\n `;\n document.getElementById(\"articles\").innerHTML = articlesHTML;\n })\n .catch(error);\n }", "title": "" }, { "docid": "f63289f4c8f17670ab1ce8e918ac41ee", "score": "0.52842444", "text": "function getTeamOverview(teamSearch) {\n // setup ajax livescore api parameters.\n const searchTeamInfo = {\n async: true,\n crossDomain: true,\n url:\n \"https://api-football-v1.p.rapidapi.com/v2/teams/search/\" + teamSearch,\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\": \"a62afeb123msh75f0a7b08cdeb06p120e70jsn9ea6adc294d7\",\n \"x-rapidapi-host\": \"api-football-v1.p.rapidapi.com\",\n },\n };\n \n $.ajax(searchTeamInfo).done(function (response) {\n \n // Clears all old content that may be present within the main content container\n $(\"#main-content\").empty();\n \n // Grabs team ID to use as the parameter for another AJAX call\n var teamID = response.api.teams[0].team_id;\n // Stores the team logo url, the team name, country of origin, and founding date\n var logo = response.api.teams[0].logo;\n var name = response.api.teams[0].name;\n var founding = response.api.teams[0].founded;\n var country = response.api.teams[0].country;\n var stadium = response.api.teams[0].venue_name;\n var stadiumCap = response.api.teams[0].venue_capacity;\n \n // Dynamically Adds in the div containers and sections for the statistics api\n var topDivider = $(\"<div>\")\n .addClass(\"card-divider divL small-12\")\n .attr(\"id\", \"top-divider\")\n .appendTo($(\"#main-content\"));\n var topLeftCard = $(\"<div>\")\n .addClass(\"card-section small-6 secL\")\n .attr(\"id\", \"top-left-card\")\n .appendTo($(\"#main-content\"));\n \n var topRightCard = $(\"<div>\")\n .addClass(\"card-section small-6 secR\")\n .attr(\"id\", \"top-right-card\")\n .appendTo($(\"#main-content\"));\n \n var bottomDivider = $(\"<div>\")\n .addClass(\"card-divider divM small-12\")\n .attr(\"id\", \"bottom-divider\")\n .appendTo($(\"#main-content\"));\n \n var bottomLeftCard = $(\"<div>\")\n .addClass(\"card-section small-6 secM\")\n .attr(\"id\", \"bottom-left-card\")\n .appendTo($(\"#main-content\"));\n \n var bottomRightCard = $(\"<div>\")\n .addClass(\"card-section small-6 secN\")\n .attr(\"id\", \"bottom-right-card\")\n .appendTo($(\"#main-content\"));\n \n var teamName = $(\"<h3>\")\n .addClass(\"team-name\")\n .text(name)\n .appendTo($(\".divL\"));\n \n var teamLogo = $(\"<img style='width:45px; height:45px'>\")\n .addClass(\"team-logo\")\n .attr(\"src\", logo)\n .appendTo($(\".team-name\"));\n \n var overview = $(\"<p style='font-size: 18px'>\")\n .addClass(\"overview\")\n .text(\"Overview\")\n .appendTo(\".secL\");\n \n var foundingDate = $(\"<p style='font-size: 12px'>\")\n .addClass(\"founding-date\")\n .text(\"Founded: \" + founding)\n .appendTo($(\".secL\"));\n \n var teamCountry = $(\"<p style='font-size: 12px'>\")\n .addClass(\"team-country\")\n .text(\"Country: \" + country)\n .appendTo($(\".secL\"));\n \n var teamStadium = $(\"<p style='font-size: 12px'>\")\n .addClass(\"team-stadium\")\n .text(\"Stadium: \" + stadium)\n .appendTo($(\".secL\"));\n \n var teamStadiumCap = $(\"<p style='font-size: 12px'>\")\n .addClass(\"team-stadium-cap\")\n .text(\"Capacity: \" + stadiumCap)\n .appendTo($(\".secL\"));\n \n // Gets current team wins and lineups\n function getTeamWinsLineups() {\n const searchTeamStats = {\n async: true,\n crossDomain: true,\n url:\n \"https://api-football-v1.p.rapidapi.com/v2/leagues/team/\" + teamID,\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\":\n \"a62afeb123msh75f0a7b08cdeb06p120e70jsn9ea6adc294d7\",\n \"x-rapidapi-host\": \"api-football-v1.p.rapidapi.com\",\n },\n };\n \n $.ajax(searchTeamStats).done(function (response) {\n console.log(response);\n \n // stores api response for the list of titles a team has won\n var titles = response.api.leagues;\n // Tracks the number of title and cup wins in order to count and display the total\n var titleWins = 0;\n var cupWins = 0;\n \n // loops through total tital wins and adds +1 depeding on if it was a league title or cup title\n for (var i = 0; i < titles.length; i++) {\n if (titles[i].type == \"League\") {\n titleWins++;\n } else if (titles[i].type == \"Cup\") {\n cupWins++;\n }\n }\n // Appends titles won (league and cup)\n var Titles = $(\"<p style='font-size: 18px'>\")\n .addClass(\"titles\")\n .text(\"Trophies\")\n .appendTo($(\".secR\"));\n \n var leagueTitles = $(\"<p style='font-size: 12px'>\")\n .addClass(\"league-titles\")\n .text(\"League Titles: \" + titleWins)\n .appendTo($(\".secR\"));\n \n var cupTitles = $(\"<p style='font-size: 12px'>\")\n .addClass(\"cup-list\")\n .text(\"Cup Titles: \" + cupWins)\n .appendTo($(\".secR\"));\n });\n }\n // function that gets the starting lineup of a club\n function getStartingLineup() {\n var currentSeason = 2019; // Could use new Date() for teams with up to date lineups.. until then use 2019\n const searchTeamStats = {\n async: true,\n crossDomain: true,\n url:\n \"https://api-football-v1.p.rapidapi.com/v2/players/squad/\" +\n teamID +\n \"/\" +\n currentSeason,\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\":\n \"a62afeb123msh75f0a7b08cdeb06p120e70jsn9ea6adc294d7\",\n \"x-rapidapi-host\": \"api-football-v1.p.rapidapi.com\",\n },\n };\n \n $.ajax(searchTeamStats).done(function (response) {\n \n // Lineup header appended to divR\n var lineupHeader = $(\"<p style='font-size: 18px'>\")\n .addClass(\"lineup-header\")\n .text(\"Current Lineup\")\n .appendTo($(\".secN\"));\n \n // object shortcut variable\n var startingLineup = response.api.players;\n // loops 11 times to get the starting 11 players\n for (var i = 0; i < 11; i++) {\n var playerName = startingLineup[i].player_name;\n var playerPosition = startingLineup[i].position;\n var playerAge = startingLineup[i].age;\n var playerInfoCol = $(\"<p style='font-size: 12px'>\")\n .addClass(\"lineup-col\")\n .text(\n playerName + \", \" + playerPosition\n )\n .appendTo($(\".secN\"));\n }\n });\n }\n \n // Function that retrieves upcoming fixture information\n function getUpcomingFixtures() {\n const upcomingFixtures = {\n async: true,\n crossDomain: true,\n url:\n \"https://api-football-v1.p.rapidapi.com/v2/fixtures/team/\" +\n teamID,\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\":\n \"a62afeb123msh75f0a7b08cdeb06p120e70jsn9ea6adc294d7\",\n \"x-rapidapi-host\": \"api-football-v1.p.rapidapi.com\",\n },\n };\n \n $.ajax(upcomingFixtures).done(function (response) {\n \n // object shortcut variable\n var fixtures = response.api.fixtures;\n // Count variable that will limit the number of responses returned\n var count = 0;\n \n // Returns \"Upcoming Fixtures headline\"\n var futureHeadline = $(\"<p style='font-size: 18px'>\")\n .addClass(\"matchups\")\n .text(\"Upcoming Matchups\")\n .appendTo($(\".secM\"));\n \n // Returns 5 values\n for (var k = 0; k < fixtures.length; k++) {\n \n // If the match status is not FT (full time)\n if (fixtures[k].statusShort == \"NS\" || fixtures[k].statusShort == \"TBD\") {\n // Limit 5 results\n if (count < 5) {\n \n // Stores variables for home team, away team, logos, match date, and match type\n var homeTeam = fixtures[k].homeTeam.team_name;\n var homeLogo = fixtures[k].homeTeam.logo;\n var awayTeam = fixtures[k].awayTeam.team_name;\n var awayLogo = fixtures[k].awayTeam.logo;\n var matchDate = fixtures[k].event_date;\n var matchType = fixtures[k].league.name;\n console.log(matchDate)\n \n var type = $(\"<p style='font-size: 12px'>\")\n .addClass(\"match-type\")\n .text(matchType)\n .appendTo(\".secM\");\n \n var logoHome = $(\"<img style='display: inline'>\")\n .addClass(\"logo-home\")\n .attr(\"src\", homeLogo)\n .appendTo(\".secM\");\n \n var home = $(\"<p style='font-size: 12px; display: inline'>\")\n .addClass(\"home-team\")\n .text(homeTeam + \" Vs. \")\n .appendTo(\".secM\");\n \n var away = $(\"<p style='font-size: 12px; display: inline'>\")\n .addClass(\"away-team\")\n .text(awayTeam)\n .appendTo(\".secM\");\n \n var logoAway = $(\"<img style='display: inline'>\")\n .addClass(\"logo-away\")\n .attr(\"src\", awayLogo)\n .appendTo(\".secM\");\n \n // Formats date as YYYY-MM-DD\n date = new Date(matchDate)\n year = date.getFullYear();\n dt = date.getDate();\n month = date.getMonth() + 1;\n \n if (dt < 10) {\n dt = '0' + dt;\n }\n if (month < 10) {\n month = '0' + month;\n }\n \n var date = $(\"<p style='font-size: 12px'>\")\n .addClass(\"match-date\")\n .appendTo(\".secM\")\n .text(year + \"-\" + month + \"-\" + dt);\n // increases count by 1\n count++\n }\n }\n }\n })\n }\n getStartingLineup();\n getTeamWinsLineups();\n getUpcomingFixtures();\n });\n }", "title": "" }, { "docid": "793e8dcbd9772803002844bd966b9ed5", "score": "0.527929", "text": "searchGames(game, callback){\n\n console.log(\"Searching for: \", game)\n\n fetch('https://api.twitch.tv/kraken/search/games?query=' + game, {\n method: 'GET',\n headers: {\n 'Accept': 'application/vnd.twitchtv.v5+json',\n 'Client-ID': Twitch.clientID\n }\n }).then(response => response.json()).then(json => {\n console.log(json.games);\n callback(json.games)\n })\n }", "title": "" }, { "docid": "cfb6f38c41f37ce547e83876cfc9d021", "score": "0.52751255", "text": "function useData(gameData) {\n var cardList = document.getElementById(\"card-list\");\n cardList.textContent = \"\";\n if (gameData.length > 0) {\n for (var i = 0; i < gameData.length; i++) {\n // Creating card elements\n var card = document.createElement(\"div\");\n var imageContainer = document.createElement(\"div\");\n var cardImage = document.createElement(\"img\");\n var cardHeader = document.createElement(\"div\");\n var cardTitle = document.createElement(\"div\");\n var cardButton = document.createElement(\"a\");\n\n // Adding img sources, information links, and titles to the new elements\n cardImage.setAttribute(\"class\", \"customImg\");\n if (gameData[i].image == null) {\n cardImage.setAttribute(\n \"src\",\n \"https://s3-us-west-1.amazonaws.com/5cc.images/games/empty+box.jpg\"\n );\n } else {\n cardImage.setAttribute(\"src\", gameData[i].image);\n }\n card.setAttribute(\"class\", \"card game-card\");\n imageContainer.append(cardImage);\n cardHeader.setAttribute(\"class\", \"card-header\");\n cardTitle.setAttribute(\"class\", \"card-title h6 cardTitle\");\n cardButton.setAttribute(\"class\", \"btn btn-primary customButtons viewBtn\");\n cardButton.setAttribute(\"href\", gameData[i].link);\n cardButton.setAttribute(\"target\", \"_blank\");\n cardButton.textContent = \"view\";\n cardTitle.textContent = gameData[i].name;\n\n // Append elements to the card then add to the list\n cardHeader.append(cardTitle, cardButton);\n\n imageContainer.setAttribute(\"class\", \"card-image\");\n card.append(imageContainer, cardHeader);\n\n cardList.append(card);\n }\n } else {\n // If the incoming list is empty, then display a message to the user telling them there were no results\n let dispMesg = document.createElement(\"h2\");\n dispMesg.setAttribute(\"style\", \"color: var(--text);\");\n dispMesg.textContent = \"Whoops! We didn't find any results for that...\";\n cardList.append(dispMesg);\n }\n}", "title": "" }, { "docid": "943eb06f46e7407d8d74e7f86c687bca", "score": "0.5274608", "text": "function showGames(games){\n\tvar dom = $();\n\tgames.forEach(function(game) {\n\t\tdom = dom.add( showGame(game) );\n\t})\n\t$(\"#games\").html(dom);\n}", "title": "" }, { "docid": "05c6a5528415db1281fb7b445401b17e", "score": "0.52629095", "text": "async function refreshInventory () {\n\ttry {\n\t\tlet inventoryResponse = await $.ajax({\n\t\t\turl: window.serverData.inventoryUri,\n\t\t\theaders: { 'Authorization': 'Bearer ' + GAME_TOKEN }\n\t\t});\n\n\t\t// Update the list of this player's assets that reside solely on the game database.\n\t\tlet updatedListGame = $('<ul id=\"ownedListGame\" style=\"list-style-type:circle\"></ul>');\n\t\tlet inventory = inventoryResponse.inventory;\n\t\tif (inventory.length > 0) {\n\t\t\t$('#ownedTitleGame').html('You own the following in-game assets:');\n\t\t}\n\t\tlet updatedGameItems = [];\n\t\tfor (let i = 0; i < inventory.length; i++) {\n\t\t\tlet item = inventory[i];\n\t\t\tlet itemId = item.itemId;\n\t\t\tlet itemAmount = item.amount;\n\n\t\t\t// Try to retrieve metadata about each item.\n\t\t\ttry {\n\t\t\t\tlet itemMetadataResponse = await $.ajax({\n\t\t\t\t\turl: window.serverData.metadataUri + itemId\n\t\t\t\t});\n\t\t\t\tlet itemMetadata = itemMetadataResponse.metadata;\n\t\t\t\tlet itemName = itemMetadata.name;\n\t\t\t\tlet itemImage = itemMetadata.image;\n\t\t\t\tlet itemDescription = itemMetadata.description;\n\n\t\t\t\tupdatedGameItems.push({\n\t\t\t\t\tid: itemId,\n\t\t\t\t\tamount: itemAmount,\n\t\t\t\t\tname: itemName,\n\t\t\t\t\tdescription: itemDescription,\n\t\t\t\t\timage: itemImage\n\t\t\t\t});\n\n\t\t\t// If unable to retrieve an item's metadata, flag such an item.\n\t\t\t} catch (error) {\n\t\t\t\tupdatedGameItems.push({\n\t\t\t\t\tid: itemId,\n\t\t\t\t\tamount: itemAmount,\n\t\t\t\t\tname: 'unknown',\n\t\t\t\t\tdescription: 'unable to retrieve metadata',\n\t\t\t\t\timage: ''\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Update our list and remove the loading indicator.\n\t\tgameItems = updatedGameItems;\n\n\t\t// If enabled, show the option to select items which can be ascended.\n\t\tlet ascendableItems = new Set();\n\t\tif (window.serverData.ascensionEnabled) {\n\t\t\ttry {\n\t\t\t\tlet screeningResponse = await $.post(window.serverData.screeningUri, {\n\t\t\t\t\tunscreenedItems: gameItems\n\t\t\t\t});\n\n\t\t\t\t// Display ascendable items within the inventory in a special way.\n\t\t\t\tif (screeningResponse.status === 'SCREENED') {\n\t\t\t\t\tlet screenedItems = screeningResponse.screenedItems;\n\t\t\t\t\tfor (let i = 0; i < screenedItems.length; i++) {\n\t\t\t\t\t\tlet item = screenedItems[i];\n\t\t\t\t\t\tlet itemAmount = item.amount;\n\t\t\t\t\t\tlet itemId = item.id;\n\t\t\t\t\t\tascendableItems.add(parseInt(itemId));\n\t\t\t\t\t\tlet itemName = item.name;\n\t\t\t\t\t\tlet itemDescription = item.description;\n\t\t\t\t\t\tupdatedListGame.append('<li>' + itemAmount + ' x (' + itemId + ') ' + itemName + ': ' + itemDescription + '\\t\\t<input id=\"amount-' + itemId + '\" class=\"input\" itemId=\"' + itemId + '\" type=\"number\" value=\"0\" min=\"0\" max=\"' + itemAmount + '\" step=\"1\" style=\"float: right\"/></li>');\n\t\t\t\t\t}\n\n\t\t\t\t// If there was a screening error, notify the user.\n\t\t\t\t} else if (screeningResponse.status === 'ERROR') {\n\t\t\t\t\tlet errorBox = $('#errorBox');\n\t\t\t\t\terrorBox.html(screeningResponse.message);\n\t\t\t\t\terrorBox.show();\n\n\t\t\t\t// Otherwise, display an error about an unknown status.\n\t\t\t\t} else {\n\t\t\t\t\tlet errorBox = $('#errorBox');\n\t\t\t\t\terrorBox.html('Received unknown message status from the server.');\n\t\t\t\t\terrorBox.show();\n\t\t\t\t}\n\n\t\t\t// If unable to screen a user's mintable item inventory, show an error.\n\t\t\t} catch (error) {\n\t\t\t\tshowError('Unable to verify item mintability at this time.');\n\t\t\t}\n\t\t}\n\n\t\t// Also display the unascendable items.\n\t\tfor (let i = 0; i < updatedGameItems.length; i++) {\n\t\t\tlet item = updatedGameItems[i];\n\t\t\tlet itemAmount = item.amount;\n\t\t\tlet itemId = item.id;\n\t\t\tlet itemName = item.name;\n\t\t\tlet itemDescription = item.description;\n\t\t\tif (!ascendableItems.has(parseInt(itemId))) {\n\t\t\t\tupdatedListGame.append('<li>' + itemAmount + ' x (' + itemId + ') ' + itemName + ': ' + itemDescription + '</li>');\n\t\t\t}\n\t\t}\n\t\t$('#ownedListGame').html(updatedListGame.html());\n\t\t$('#gameServerSpinner').remove();\n\n\t// If we were unable to retrieve the server inventory, throw error.\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tshowError('Unable to retrieve the server inventory.');\n\t\t$('#ownedListGame').html('Unable to retrieve the server inventory.');\n\t}\n}", "title": "" }, { "docid": "5aa8e2a24491a5428fdc29a035532f08", "score": "0.5260994", "text": "function xboxFetch(){\n\tvar createInfo = document.getElementById(\"xboxData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-add-back-btn\", \"true\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"Xbox 360\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" }, { "docid": "25159e415be7f29dae39911fe20302ab", "score": "0.5252817", "text": "async function getAllGameInfo(game){\n const res = await fetch(\"/api/game/info\",{\n method:\"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n info:{\n game: game,\n admin: adminId\n }\n })\n });\n return res.json();\n}", "title": "" }, { "docid": "ca88b2a56e2353ecf12298a4185f16b1", "score": "0.5251448", "text": "function getGameProgress(date, awayTeamName, homeTeamName, awayTeamCity, homeTeamCity, playoff = false){\n //TODO: Need to determine if the game is a playoff game or not for the \"currentSeason\"\n // I guess what we could do is on failure of the Ajax call we could try for the Playoff game instead\n // Since we know that the date, awayTeam and homeTeam do exist\n var year = date.slice(0,4);\n var month = date.slice(5,7);\n var day = date.slice(8,10);\n\n // Determine the years that should be used for the \"Current Season\"\n var currentSeason;\n if(parseInt(month) >= 9){\n var nextYear = parseInt(year) + 1;\n currentSeason = year + \"-\" + nextYear + \"-regular\";\n }else{\n var prevYear = parseInt(year) - 1;\n currentSeason = prevYear + \"-\" + year + \"-regular\";\n }\n\n var updatedDate = year + \"\" + month + \"\" + day;\n\n // Instead we want to be retrieving stats for a playoff game\n if(playoff == true){\n currentSeason = year + \"-playoff\";\n }\n// gameProgress.innerHTML = \"Whatever was returned from the Ajax call\";\n $.ajax({\n type: \"GET\",\n url: \"/ajax\",\n dataType: 'json',\n async: false,\n data: {\n url: currentSeason + \"/scoreboard.json?fordate=\" + updatedDate\n },\n success: function (data){\n // TODO: Need to check for failure - in that case we need to retieve info for a playoff game instead.\n var games = data.scoreboard.gameScore;\n var currentGame;\n for(var i = 0; i < games.length; i++){\n var tempGame = games[i];\n if(tempGame.game.awayTeam.Name == awayTeamName && tempGame.game.homeTeam.Name == homeTeamName){\n currentGame = tempGame;\n }\n }\n var isCompleted = currentGame.isCompleted;\n var isInProgress = currentGame.isInProgress;\n var currentIntermission = currentGame.currentIntermission;\n\n var gameProgress = document.getElementById(\"gameProgress\");\n if(isCompleted != \"false\"){\n // The game is over\n gameProgress.innerHTML = \"Final\";\n }else if(currentIntermission == 1){\n // in between first and second quarter\n gameProgress.innerHTML = \"Quarter: 2 - 12:00\";\n }else if(currentIntermission == 2){\n // Half Time\n gameProgress.innerHTML = \"Halftime\";\n }else if(currentIntermission == 3){\n // In between third and fourth quarter\n gameProgress.innerHTML = \"Quarter: 4 - 12:00\";\n }else if(currentIntermission == 4){\n // The game has been completed, but that returned data still has isCompleted as \"false\"\n gameProgress.innerHTML = \"Finished\";\n }else if(isInProgress){\n // The game is still in progress\n\n var currentQuarter = currentGame.currentQuarter;\n var timeRemaining = currentGame.currentQuarterSecondsRemaining;\n\n var minutesRemaining = Math.floor(parseInt(timeRemaining) / 60);\n var secondsRemaining = parseInt(timeRemaining) % 60;\n\n if(secondsRemaining.toString().length <= 1){\n secondsRemaining = \"0\" + secondsRemaining.toString();\n }\n\n if(String(secondsRemaining).length ==1){\n secondsRemaining = String(secondsRemaining) + \"0\";\n }\n // gameProgress.innerHTML = \"Quarter: \" + currentQuarter + \" - \" + minutesRemaining + \":\" + secondsRemaining;\n gameProgress.innerHTML = \"<span style='color: green;'>Q\" + currentQuarter + \"</span> <span style='color: red'>\" + minutesRemaining + \":\" + secondsRemaining + \"</span>\";\n }\n\n // The game isn't over yet, periodically retrieve the updated BoxScore and Game Status through Ajax Calls\n if(isCompleted == \"false\"){\n startInterval(updatedDate, currentSeason, awayTeamName, homeTeamName, awayTeamCity, homeTeamCity);\n }\n\n }\n });\n\n}", "title": "" }, { "docid": "848162a2a6a38c4c8f6462f2917ec741", "score": "0.52482396", "text": "async function games() {\n const allGamesResponse = await axios.get(`https://api.steampowered.com/ISteamApps/GetAppList/v2/`);\n // console.log(allGames);\n // console.log(allGames.data.applist.apps);// indiviudal item will be an element inside the array apps; the entire array of apps exist would be data.applist.apps\n const allGames = allGamesResponse.data.applist.apps\n return allGames;\n}", "title": "" }, { "docid": "03a953a34ecc33c8d34784fb93b1e25b", "score": "0.52467906", "text": "function pcFetch(){\n\tvar createInfo = document.getElementById(\"pcData\");\n\tcreateInfo.innerHTML = (\"\");\n\tif(localStorage.length === 0){\n\t addGameData();\n \t}\n\t\tvar createUL = document.createElement(\"ul\");\n\t\tcreateUL.setAttribute(\"id\", \"listCreation\");\n\t\tcreateUL.setAttribute(\"data-role\", \"listview\");\n\t\tcreateUL.setAttribute(\"data-filter\", \"true\");\n\t\tcreateUL.setAttribute(\"data-filter-placeholder\", \"Search for a game...\");\n\t\tcreateInfo.appendChild(createUL);\n\t\tfor (var e = 0, f = localStorage.length; e < f; e++) {\n\t\t var gameKey = localStorage.key(e);\n\t\t var gameValue = localStorage.getItem(gameKey);\n\t\t var gameInfoObject = JSON.parse(gameValue);\n\t\t if (gameInfoObject.console[1] === \"PC\") {\n\t\t\tvar newLi = document.createElement(\"li\");\n\t\t\tcreateUL.appendChild(newLi);\n\t\t\tvar newHeader = document.createElement(\"h3\");\n\t\t\tnewHeader.innerHTML = gameInfoObject.gameTitle[1];\n\t\t\tnewLi.appendChild(newHeader);\n\t\t\tvar consoleName = document.createElement(\"p\");\n\t\t\tconsoleName.innerHTML = gameInfoObject.console[1];\n\t\t\tnewLi.appendChild(consoleName);\n\t\t\timageAddition(gameInfoObject.console[1], newLi);\n\t\t\tvar gameList = document.createElement(\"ul\");\n\t\t\tnewLi.appendChild(gameList);\n\t\t\t for (var g in gameInfoObject) {\n\t\t\t var createGameList = document.createElement(\"li\");\n\t\t\t createGameList.setAttribute(\"id\", \"gameInfoList\");\n\t\t\t gameList.appendChild(createGameList);\n\t\t\t var gameTextOutput = gameInfoObject[g][0] + gameInfoObject[g][1];\n\t\t\t createGameList.innerHTML = gameTextOutput;\n\t\t\t }\n\t\t }\n\t\t}\n }", "title": "" } ]
f1242778e2a4789c274888325c1d3939
Returns true if any of the descenders in the active or recursive set consider the current state a final destination
[ { "docid": "f31473f27f61d1c39682bd92a1f4a291", "score": "0.64582425", "text": "isDestination() {\n var arrival = this.active.find(descender => {\n if (descender.hasArrived()) {\n return true;\n }\n\n return false;\n });\n return !!arrival;\n }", "title": "" } ]
[ { "docid": "44f0bcd277770c59c20e16b595a25a42", "score": "0.58424044", "text": "static hasActiveTarget(state){\n if (! state.leg) return false;\n return state.leg.isRouting();\n }", "title": "" }, { "docid": "556789765796b4bfba4c2f30fa216d39", "score": "0.57796323", "text": "function is_end(){\r\n let ck = true;\r\n\r\n // checking if we can make a move in one of the four directions or not\r\n if (merge_board_check()) ck = false;\r\n\r\n rev();\r\n if (merge_board_check()) ck = false;\r\n rev(); \r\n\r\n tranpose();\r\n if (merge_board_check()) ck = false;\r\n tranpose();\r\n\r\n tranpose(); rev();\r\n if (merge_board_check()) ck = false;\r\n rev(); tranpose();\r\n\r\n return ck;\r\n}", "title": "" }, { "docid": "34b343945522ffa070a41d68cc032a86", "score": "0.5735152", "text": "areAllOppositeTransitFree() {\n let transitName = this.transit === \"left\" ? \"right\" : \"left\";\n return this.zones.every(zone => !zone.isLocked(transitName));\n }", "title": "" }, { "docid": "2ab9e99a8564027fabb6fd3019485e2b", "score": "0.56678927", "text": "function differentDestination(formation: Formation) {\n const groups = formation.allFahrzeuggruppe;\n\n if (groups.length > 1) {\n const firstDestination = groups[0].zielbetriebsstellename;\n\n return groups.some(g => g.zielbetriebsstellename !== firstDestination);\n }\n\n return false;\n}", "title": "" }, { "docid": "f02a59d609944dc13d27964c955a66ca", "score": "0.5580881", "text": "allVisited() {\n for (let i = 0; i < this.g.length; i++) {\n if (this.g[i].visited === false) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "8566f74a8b9688b951c54543056bb79a", "score": "0.55351007", "text": "isCycle() {\n for (let i = 0; i < this.edges.length; i++) {\n const [src, dest] = this.edges[i];\n const srcParent = this.find(src);\n const destParent = this.find(dest);\n\n if (srcParent == destParent)\n return true;\n\n this.union(srcParent, destParent);\n }\n\n return false;\n }", "title": "" }, { "docid": "8566f74a8b9688b951c54543056bb79a", "score": "0.55351007", "text": "isCycle() {\n for (let i = 0; i < this.edges.length; i++) {\n const [src, dest] = this.edges[i];\n const srcParent = this.find(src);\n const destParent = this.find(dest);\n\n if (srcParent == destParent)\n return true;\n\n this.union(srcParent, destParent);\n }\n\n return false;\n }", "title": "" }, { "docid": "cc0fc8982aded09ee0b04b40b7e52fb3", "score": "0.5508365", "text": "function isNonCurrAlt(mPath) {\n const state = P.mc.getState(mPath);\n if (state) { // check if state is a non-current alternative child\n const parent = state.parent;\n if (parent.hasOwnProperty(\"curr\") && parent.hasOwnProperty(\"cc\")) {\n if (parent.cc[parent.curr] === state.name) {\n return false;\n } else {\n return true;\n }\n }\n }\n return false;\n}", "title": "" }, { "docid": "cf7d106140f6ed6280c7488d34ef3873", "score": "0.5431653", "text": "isDescendantAssay(allegedDescendant) {\n if (childAssay === undefined) {\n return false;\n }\n if (childAssay === allegedDescendant) {\n return true;\n }\n return childAssay.isDescendantAssay(allegedDescendant);\n }", "title": "" }, { "docid": "cc98317f3ee1bae165c0df5592d27a2c", "score": "0.54264605", "text": "isFinished()\n {\n let finished = true;\n\n this.AIs.forEach(ai => {\n if(ai.state !== \"finish\")\n {\n finished = false;\n return;\n }\n });\n\n return finished;\n }", "title": "" }, { "docid": "d0043edce36df6d8bca314bddf0c00f9", "score": "0.5366166", "text": "done() {\n return this.stage == 1;\n //return (this.stage == this.cycleStop) && (this.stages[LEARNED].length == this.words.length);\n }", "title": "" }, { "docid": "36cdb320e7b1f693ddfd96a71cb6b2ea", "score": "0.5365406", "text": "checkIfFound(visitedNodes) {\n if (visitedNodes.length == 0) {\n return false;\n }\n else if (visitedNodes[visitedNodes.length - 1].isEnd) {\n return true;\n }\n else {\n return false;\n }\n }", "title": "" }, { "docid": "0a1ef0c22c90eeac5b40e709537615e4", "score": "0.536236", "text": "function endStateReached(state, endState) {\n if ((state instanceof ReplicatedData.GCounter) && endState.gcounter) {\n return state.value === endState.gcounter.value.toNumber();\n }\n return false;\n}", "title": "" }, { "docid": "10b19e4eb56b15ed348254c3e47a7fbb", "score": "0.5331203", "text": "function doneTrans(elevator){\n return elevator.destinationQueue.length == 0;\n }", "title": "" }, { "docid": "80699f0f3eb19b61185bec033b62c32d", "score": "0.53010595", "text": "checkVisited() {\n for (let i = 0; i < this.nodes.length; i++) {\n for (let j = 0; j < this.nodes[i].length; j++) {\n if (this.nodes[i][j].isActuallyVisited && this.nodes[i][j].isShortestPath)\n return true;\n }\n }\n return false;\n }", "title": "" }, { "docid": "905e025ff8e814ced951ddea685633e6", "score": "0.5294695", "text": "isMazeResolved() {\n const currentItem = document.querySelector('.maze-item.active');\n\n return currentItem.classList.contains('last');\n }", "title": "" }, { "docid": "9186e378450e45f036b8fc70965a6877", "score": "0.5291319", "text": "function exitsInTail(target) {\n var current = target;\n while (current && current.node && current.inList && current.container && !current.isFunction()) {\n for (var i = current.key + 1; i < current.container.length; i++) {\n var sibling = current.container[current.key + 1];\n if (pathsReturnOrThrow(current).any) {\n return true;\n }\n }\n current = current.parentPath;\n }\n return false;\n }", "title": "" }, { "docid": "43addf9955e9ab2ee2252d26b5a430f1", "score": "0.5244504", "text": "isCurrentPathValid() {\n\t\tconst end = this.currentPath[this.currentPath.length - 1];\n\t\tconst endNode = this.grid.getNode(end[0], end[1]);\n\n\t\tconst next3AreClean = this.currentPath.slice(0, 3).reduce((result, coord) => {\n\t\t\tconst node = this.grid.getNode(coord[0], coord[1]);\n\t\t\treturn node.isClean() && result;\n\t\t}, true);\n\n\t\treturn this.isEndNode(endNode) && next3AreClean && this.currentPath.length > 1;\n\t}", "title": "" }, { "docid": "f16fa366f54704bd88b789fe4b094b96", "score": "0.5171232", "text": "function is_goal_state(state) {\n ++helper_eval_state_count; //Keep track of how many states are evaluated (DO NOT REMOVE!)\n \n return state.grid[0][0] == 1 && state.grid[0][1] == 2 && state.grid[0][2] == 3 &&\n state.grid[1][2] == 4 && state.grid[2][2] == 5 && state.grid[2][1] == 6 &&\n state.grid[2][0] == 7 && state.grid[1][0] == 8 && state.grid[1][1] == 0;\n}", "title": "" }, { "docid": "6669ee5ebb06112d51e26400464e28d4", "score": "0.5153597", "text": "function topocodeFinished() {\n var finished = true;\n $(steps_alti_ary).each(function(i) {\n finished = (finished && (steps_alti_ary[i][1] != null));\n });\n \n return finished;\n}", "title": "" }, { "docid": "b3e96cf59ce019eed42636da204d19e0", "score": "0.51489437", "text": "_isConnected(src, dest) {\n const visited = {}\n const toVisit = [ src ]\n\n while (toVisit.length) {\n const next = toVisit.pop()\n if (next.id === dest.id) {\n return true\n }\n if (!visited[next.id]) {\n visited[next.id] = true\n for (let id in next.to) { const child = next.to[id]; toVisit.push(child.entity) }\n }\n }\n\n return false\n }", "title": "" }, { "docid": "f2d8c05f7d3b3e5e148a14452ba871b5", "score": "0.5110067", "text": "ar() {\n return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state;\n }", "title": "" }, { "docid": "18355371b9412dde756baa01e6947e72", "score": "0.5103672", "text": "function finished(){\n\t\tvar currentPosition = startingPosition(); // get the current displaied layout\n\t\tvar original = document.querySelectorAll(\".puzzle\");\n\n\t\tfor(var i = 0; i < original.length; i++){\n\t\t\tif(original[i] != currentPosition[parseInt(i / PUZZLE_SIZE)][i % PUZZLE_SIZE]){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// if the current is not\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// in the original place\n\t\t\t\treturn false; // not finished\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "title": "" }, { "docid": "dfe91cc5496f74f11f62fc3e679acc96", "score": "0.51004356", "text": "function hasValidDestination(road) {\n for(var d in road.gm_bindings_.directions) {\n for(var d2 in road.gm_bindings_.directions[d]) {\n if(road.gm_bindings_.directions[d][d2] == \"directions\") {\n for(var d3 in road.gm_bindings_.directions[d]) {\n if(\"\"+road.gm_bindings_.directions[d][d3] == \"[object Object]\") {\n return road.gm_bindings_.directions[d][d3].enabled;\n }\n }\n }\n }\n }\n }", "title": "" }, { "docid": "5ef5a5eed1f180dc27232f0e386165a2", "score": "0.50885093", "text": "function isEndOfLevel() {\n var ended = true;\n for (var ballId = 0; ballId < balls.length; ballId++) {\n var ball = balls[ballId];\n if (ball.waitClic == 1) {\n ended = false;\n }\n }\n return ended;\n}", "title": "" }, { "docid": "d1d45f1a855fd5b884d44fa25ab96d6c", "score": "0.50743407", "text": "function isAutomataComplete() {\n\tvar exitSymbols = alphabet.sort();\n\tvar result = true;\n\tvar error = \"\";\n\tvar aux = [];\n\t\n\tstateList.forEach(\n\t\tst => { st.transitionsOut.forEach(\n\t\t\ttr => tr.symbols.forEach(\n\t\t\t\tx => aux.unshift(x)\n\t\t\t)\n\t\t);\n\t\taux.sort().join() == exitSymbols.join() ? undefined : (\n\t\t\terror += \"state #\" + st.id + \" has no exit transition containing the symbols.<br>\",\n\t\t\tresult = false\n\t\t);\n\t\taux = [];\n\t\t}\n\t)\n\n\t!result ? logError(\"AUTOMATA NOT COMPLETE\", error) : undefined;\n\treturn result;\n}", "title": "" }, { "docid": "f66928bd6f0eb9282d8d9492c7d7a5fd", "score": "0.5071079", "text": "function check(currNode){\n\t\tif(currNode.i == goalState.i && currNode.j== goalState.j){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "title": "" }, { "docid": "d44775464733e340690bf887b596cc17", "score": "0.5071001", "text": "function percolates() {\n for (var i = (n * n) - n; i < n * n; i++) {\n if (sites[i] == state('full')) return true;\n }\n}", "title": "" }, { "docid": "4184fdf71912f9b8cc00e9c4aa837877", "score": "0.5061313", "text": "checkLeave(movement, actors, targetTile) {\n //check all objects\n return this.objects.reduce(\n (ok, o) =>\n ok && (!o.checkLeave || o.checkLeave(movement, actors, targetTile)),\n true\n )\n }", "title": "" }, { "docid": "7b01181e0bfa83e26c60d1d62b8e35bc", "score": "0.5058799", "text": "stageIsComplete() {\n\t\n\t\tlet result = false;\n\n\t\tswitch (this._getCurrentStage()) {\n\n\t\t\tcase gameStages.PREGAME:\n\n\t\t\t\tresult = this._stagePregameIsComplete();\n\n\t\t\t\tbreak;\n\n\t\t\tcase gameStages.LOADING_PANORAMA:\n\n\t\t\t\tresult = this._stageLoadingPanoramaIsComplete();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tresult = this._viewIsComplete();\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\treturn result;\n\n\t}", "title": "" }, { "docid": "720f002460846d3850fe0be8071166c5", "score": "0.50523365", "text": "areAllCompatibleTransitFree() {\n return this.zones.every(zone => !zone.isLocked(this.transit));\n }", "title": "" }, { "docid": "c44f4e8902ba2443799ea181528b6efb", "score": "0.5041801", "text": "function edgeCanBePlaced() {\n // If user has not clicked a node different to the selected node, return false\n if (selectedItem == null || currentItem == null || currentItem == selectedItem ||\n currentItem instanceof Edge || selectedItem instanceof Edge) {\n return false;\n }\n \n // If an edge already exists between the two nodes, return false\n for (var i = 0; i < edges.length; i++) {\n if ((edges[i].getFromNode() == selectedItem && \n edges[i].getToNode() == currentItem) ||\n (edges[i].getToNode() == selectedItem && \n edges[i].getFromNode() == currentItem)) {\n // Note that the last two expressions disallow directed graphs for now\n return false;\n }\n }\n // If no edge already exists between the two nodes, return true\n return true;\n }", "title": "" }, { "docid": "d86c7b72d42c565b9212649b56c0aa38", "score": "0.5040959", "text": "checkDone() {\n\t\t// rows\n\t\tfor(let x = 0; x < this.width; x++) {\n\t\t\tlet bool = true;\n\t\t\tfor(let y = 0; y < this.height; y++) {\n\t\t\t\tif(this.grid[x][y].state != 2)\n\t\t\t\t\tbool = false;\n\t\t\t}\n\t\t\tif(bool)\n\t\t\t\treturn true;\n\t\t}\n\n\t\t//columns\n\t\tfor(let y = 0; y < this.height; y++) {\n\t\t\tlet bool = true;\n\t\t\tfor(let x = 0; x < this.width; x++) {\n\t\t\t\tif(this.grid[x][y].state != 2)\n\t\t\t\t\tbool = false;\n\t\t\t}\n\t\t\tif(bool)\n\t\t\t\treturn true;\n\t\t}\n\n\t\t// diagonals\n\t\tlet bool = true;\n\t\tfor(let x = 0; x < this.width; x++) {\n\t\t\tif(this.grid[x][x].state != 2)\n\t\t\t\tbool = false;\n\t\t}\n\t\tif(bool)\n\t\t\treturn true;\n\n\t\tbool = true;\n\t\tfor(let x = 0; x < this.width; x++) {\n\t\t\tif(this.grid[x][this.width-x-1].state != 2)\n\t\t\t\tbool = false;\n\t\t}\n\t\treturn bool;\n\t}", "title": "" }, { "docid": "722b711544cd4c61077e03a9315db4ef", "score": "0.5015926", "text": "isBeingLookedAt() {\n let isOnDashboard = ['dashboard'].includes(this.$state.current.name) && this.active;\n let isExploreOrCardBuilder = ['cardExplore', 'cardBuilder'].includes(this.$state.current.name);\n let isCurrentCard = this.id === parseInt(this.$state.params.cardId);\n let isOnHomepage = ['home'].includes(this.$state.current.name) && this.active;\n\n return isOnHomepage || isExploreOrCardBuilder && isCurrentCard || isOnDashboard;\n }", "title": "" }, { "docid": "30ed166eca1bac6bd145d948954ceb2c", "score": "0.5005463", "text": "function visited(item, closed) {\r\n return closed.filter(curr => (item.x === curr.x) && (curr.y === item.y)).length === 0;\r\n}", "title": "" }, { "docid": "682edb49b7483c2f69fa6294748a8809", "score": "0.5003246", "text": "Cu() {\n return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state;\n }", "title": "" }, { "docid": "5ddc1b49bc49c566d36d845c003bef89", "score": "0.5002443", "text": "isDone(){\n \tfor (agent in this.agents) {\n \t\tif (agent.is_alive()) {\n \t\t\tvar dead = false;\n \t\t\treturn false;\n \t\t}\n \t}\n \treturn true;\n }", "title": "" }, { "docid": "2cb2810bdb1299a86e2ae6b2cd94cc52", "score": "0.49935025", "text": "function dfs(target, state) {\n const key = state.toString();\n if (memo.has(key)) {\n return memo.get(key);\n }\n\n for (let i = 1; i < state.length; i++) {\n if (state[i] === 0) {\n state[i] = 1;\n //我拿完这个直接赢了 || 下一轮 对手赢不了\n if (target - i <= 0 || !dfs(target - i, state)) {\n memo.set(key, true); //!!!!存的是key 而不是state.toString()!!!!\n state[i] = 0;\n\n return true;\n }\n state[i] = 0;\n }\n }\n memo.set(key, false);\n return false;\n }", "title": "" }, { "docid": "b2eb881cad7bc3d5d80c9995ea9c7819", "score": "0.4985444", "text": "isAllDead () {\n return !this.balls.find(({ dead, reachedGoal }) => !dead && !reachedGoal);\n }", "title": "" }, { "docid": "b52ff3ed9c13bdd60cc27f4e81a87bb2", "score": "0.4977419", "text": "function dirIterationCheck(a) {\n return a.visited === false;\n}", "title": "" }, { "docid": "e7a0cca93384e723746860db04fac03b", "score": "0.49769235", "text": "isComplete() {\n const { campaign } = this.props;\n const { headline, dailySpendCap, lifetimeSpendCap, goal, adType } = campaign;\n\n if (\n !headline ||\n headline === '' ||\n !dailySpendCap ||\n dailySpendCap === '0' ||\n !lifetimeSpendCap ||\n lifetimeSpendCap === '0' ||\n !goal ||\n goal === '' ||\n !adType ||\n adType === ''\n ) {\n return false;\n }\n return true;\n }", "title": "" }, { "docid": "ff372d97b9d1e0c3ec28af7b372c09c3", "score": "0.49678573", "text": "function isComplete(flags) {\n return (flags & FLAGS.COMPLETE) === FLAGS.COMPLETE;\n}", "title": "" }, { "docid": "6240afbc496f4bae8294fd62e7dbb6b1", "score": "0.49638695", "text": "isTangled(){\n let head = this.getHead;\n let rest = this.tail.slice( 0, this.tail.length -1);\n\n return rest.some( snakeBit => {\n return( head.x === snakeBit.x && head.y === snakeBit.y);\n });\n }", "title": "" }, { "docid": "38cd651e176d0c1b20430ba7f101886c", "score": "0.4953891", "text": "function hasDepthTarget() {\n return !!states.depthTarget;\n }", "title": "" }, { "docid": "2be30c6f1ff32ea4e508e01637e5c9cf", "score": "0.49515146", "text": "function allActionsComplete() {\n\tif (incompleteActions <= 0) {\n\t\treturn (true);\n\t}\n\treturn (false);\n}", "title": "" }, { "docid": "92318ba6f013f52678d6741867ede5cc", "score": "0.49511427", "text": "isEndRound() {\n var roundEnded = true;\n for (var i = 0; i < this.players.length; i++) {\n if (!this.players[i].actionTaken && !this.players[i].folded) {\n roundEnded = false;\n }\n }\n return roundEnded;\n }", "title": "" }, { "docid": "01c50e23b2d3b6245b9fe7028bb3578d", "score": "0.49481946", "text": "endsAt(pos) {\n return this._source.done && this._history.length === pos;\n }", "title": "" }, { "docid": "6437c8d761b207b723b3efbd91166cf4", "score": "0.49444917", "text": "duplex(){\n if(this.extraDpto()===false){\n let duplexArea = this.getAreaRestante() + this.getAreaRestante();\n if(duplexArea >= this.areaMin)\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "f1ce2eed916da6a433f6f21fc23b08e6", "score": "0.4942111", "text": "getPossibleDirections() {\n const possibleDirections = this.currentCell.neighbors.filter((cell) => {\n if (cell.type !== CellType.CLEAR && cell.type !== this.goal)\n return false;\n if (this.lastCell && this.lastCell === cell)\n return false;\n return true;\n });\n if (possibleDirections.length === 0 && this.lastCell)\n possibleDirections.push(this.lastCell);\n return possibleDirections;\n }", "title": "" }, { "docid": "474e3cc4db4ae4f4256f06879692598d", "score": "0.49327874", "text": "function isLastStep () {\n return vm.currentStep === (vm.cntSteps - 1);\n }", "title": "" }, { "docid": "c88874edbe1a9bb91e1e2fc14acfc070", "score": "0.49298614", "text": "checkIfNeighboursAllowColoration () {\n if (this.neighbouringWallSegments.length > 0)\n {\n return true;\n }\n\n for (let i = 0; i < this.neighbouringSticks.length; i += 1) {\n if (this.neighbouringSticks[i].isActive()) {\n return true;\n }\n }\n return false;\n }", "title": "" }, { "docid": "4e1ee527bcc02ae9bde75f047478a48a", "score": "0.4926634", "text": "isEnd(editor, point, at) {\n var end = Editor.end(editor, at);\n return Point.equals(point, end);\n }", "title": "" }, { "docid": "4e08caf52a66d75f9755d042ad59319c", "score": "0.49201456", "text": "function isAllComplete() {\n return vm.parent.tasks.every((task) => task.isComplete || task.isForbidden);\n }", "title": "" }, { "docid": "0ac4b05c8e3099a92049396aaf0ccd1b", "score": "0.49198174", "text": "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "title": "" }, { "docid": "0ac4b05c8e3099a92049396aaf0ccd1b", "score": "0.49198174", "text": "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "title": "" }, { "docid": "0ac4b05c8e3099a92049396aaf0ccd1b", "score": "0.49198174", "text": "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "title": "" }, { "docid": "0ac4b05c8e3099a92049396aaf0ccd1b", "score": "0.49198174", "text": "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "title": "" }, { "docid": "0ac4b05c8e3099a92049396aaf0ccd1b", "score": "0.49198174", "text": "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "title": "" }, { "docid": "063508f4568551c0a080a0db4dda373c", "score": "0.49179578", "text": "function isIn(fullStateName) {\n var current = state;\n while (current) {\n if (current.fullName == fullStateName) return true;\n current = current.parent;\n }\n return false;\n }", "title": "" }, { "docid": "063508f4568551c0a080a0db4dda373c", "score": "0.49179578", "text": "function isIn(fullStateName) {\n var current = state;\n while (current) {\n if (current.fullName == fullStateName) return true;\n current = current.parent;\n }\n return false;\n }", "title": "" }, { "docid": "1b01c469a50851942806876e3d70410c", "score": "0.49033135", "text": "function isDestinyTheStartingSection(){\n var destinationSection = getSectionByAnchor(getAnchorsURL().section);\n\n return !destinationSection.length || destinationSection.length && destinationSection.index() === startingSection.index();\n }", "title": "" }, { "docid": "1b01c469a50851942806876e3d70410c", "score": "0.49033135", "text": "function isDestinyTheStartingSection(){\n var destinationSection = getSectionByAnchor(getAnchorsURL().section);\n\n return !destinationSection.length || destinationSection.length && destinationSection.index() === startingSection.index();\n }", "title": "" }, { "docid": "993c2f13929db8b969a5416f2a279aa5", "score": "0.4895368", "text": "_viewGuessingLocationIsComplete(props) {\n\n\t\tconst { gameplay, prompt } = props;\n\n\t\tconst { currentTurn } = gameplay;\n\n\t\treturn currentTurn.submitted && (lifecycle.AFTER === prompt.displaying);\n\n\t}", "title": "" }, { "docid": "c8305b3861d1f07aa7b470889313b4f8", "score": "0.48814815", "text": "allCodePathsPresent(): boolean {\n return this.statements[this.statements.length - 1].allCodePathsPresent();\n }", "title": "" }, { "docid": "049b437e573891f300428138365c7874", "score": "0.4880929", "text": "isCompleteCalculation(){\n\t\tvar isComplete = this.afterEqual || !this.pending; \n\t\tif(isComplete){\n\t\t\tthis.internalProgram = [];\n\t\t}\n\t\treturn isComplete;\n\t}", "title": "" }, { "docid": "8609c4021e717a99d185afddd03c22d1", "score": "0.487663", "text": "function isSolved() {\n\n\tvar currentBoard = _game_args.board.boardConfig;\n\t\n\tfor(var i = 0; i < currentBoard.length; i++) {\n\t\t\n\t\tif(currentBoard[i] != _game_args.finalBoard[i])\n\t\t\treturn false;\n\t}\n\treturn true;\n}", "title": "" }, { "docid": "744530bed67c3ea32e0c4344a4951559", "score": "0.48707747", "text": "function isDestinyTheStartingSection(){\n var destinationSection = getSectionByAnchor(getAnchorsURL().section);\n return !destinationSection || destinationSection.length && destinationSection.index() === startingSection.index();\n }", "title": "" }, { "docid": "b8a88f8d183f9f7dfeacb81af45abf18", "score": "0.48596734", "text": "reachedCurrentStage() {\n for (let i = 0; i < this.numberOfPlayers; i++) {\n if (i == this.currentPlayer) {\n continue;\n } else if (i != this.currentPlayer && this.getStages(i) >= this.getStages(this.currentPlayer)) {\n return true;\n }\n }\n return false;\n }", "title": "" }, { "docid": "0cc9ffad131a0801456d64591f504915", "score": "0.48535535", "text": "function complete(which) {\n const cur = sets[which];\n\n forEachCanExpand(cur.items, function(drule) {\n const ruleNo = drule.ruleNo;\n const pos = drule.pos;\n const origin = drule.origin;\n const sym = grammar[ruleNo].sym;\n if (pos < grammar[ruleNo].symbols.length) return;\n\n if (drule.leo != null) {\n sets[drule.leo].items.forEach(function(item) {\n\n // Non-leo items will be handled below.\n if (sym == nextSymbol(item)) {\n add(cur, {\n ruleNo: item.ruleNo,\n pos: item.pos + 1,\n origin: item.leo != null ? item.leo : item.origin,\n kind: 'L'\n });\n }\n });\n } else {\n\n // Rules already confirmed and realized in prior Earley sets get advanced\n sets[origin].items.forEach(function(candidate) {\n\n if (sym == nextSymbol(candidate)) {\n const newRule = {\n ruleNo: candidate.ruleNo,\n pos: candidate.pos + 1,\n origin: candidate.origin,\n kind: 'C'\n };\n add(cur, newRule);\n predictCandidate(newRule, which);\n }\n });\n }\n\n });\n\n }", "title": "" }, { "docid": "2ae42a1384ed97077cd2eedbab7e85d3", "score": "0.48532218", "text": "function isDestinyTheStartingSection(){\n var destinationSection = getSectionByAnchor(getAnchorsURL().section);\n return !destinationSection || typeof destinationSection !=='undefined' && index(destinationSection) === index(startingSection);\n }", "title": "" }, { "docid": "bb2de7d2f041dfefd7aa12b932b62a7d", "score": "0.48506144", "text": "function WINGAMEGoal(p) {if (CoreState.state == \"Ending\") {return true;} return false;}", "title": "" }, { "docid": "f5c390285285faaf438bfc03d6b46098", "score": "0.48502743", "text": "hasOnlyRests() {\n const hasOnlyRests = true;\n for (const gve of this.graphicalVoiceEntries) {\n for (const graphicalNote of gve.notes) {\n const note = graphicalNote.sourceNote;\n if (!note.isRest()) {\n return false;\n }\n }\n }\n return hasOnlyRests;\n }", "title": "" }, { "docid": "3b14c248cc4dadc8d0e01b58a86be8fb", "score": "0.4838168", "text": "validateDestinationTarget() {\n return _.has(this.scheme[this.getDestination()], this.getTarget());\n }", "title": "" }, { "docid": "2cb597f45b8b0abee8f46910c886876d", "score": "0.4834491", "text": "isSolved() {\n let i;\n for (i = 0; i < this.cornerLoc.length; i++) {\n if (this.cornerLoc[i] != i) {\n return false;\n }\n if (this.cornerOrient[i] != 0) {\n return false;\n }\n }\n\n for (i = 0; i < this.edgeLoc.length; i++) {\n if (this.edgeLoc[i] != i) {\n return false;\n }\n if (this.edgeOrient[i] != 0) {\n return false;\n }\n }\n\n for (i = 0; i < this.sideLoc.length; i++) {\n if (this.sideLoc[i] != i) {\n return false;\n }\n if (this.sideOrient[i] != 0) {\n return false;\n }\n }\n\n return true;\n }", "title": "" }, { "docid": "12ab4d52a4ae5f7247c11babb521e496", "score": "0.4831101", "text": "function canGetDirections() {\n\t\treturn (self.startLocation !== null) && (self.startStation !== null) && (self.endLocation !== null) && (self.endStation !== null);\n\t}", "title": "" }, { "docid": "fd1081495801682f3862d58c105a5989", "score": "0.48247352", "text": "function orbsAreOnScreen() {\n\tfor (var h=0; h<game_map.statics.length; h++) {\n\t\tif ((game_map.statics[h].layersCurrent > 0) && orbIsOnScreen(game_map.statics[h])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "title": "" }, { "docid": "d203cef654c8faff2f0954589d14494c", "score": "0.481923", "text": "function goalTest(state1, state2) {\n return (state1.x == state2.x) && (state1.y == state2.y);\n}", "title": "" }, { "docid": "4c4943a9b5ade4790a03db775b168284", "score": "0.48170897", "text": "_allPlayerMovesMade() {\n for (let state of this.playerMap.values()) {\n if (!state.hasMadeMove()) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "4c438a5be8a88caa57bf73bcbef9a673", "score": "0.48162955", "text": "function isGoal(start, goal){\n var dist_x = Math.abs(start.x - goal.x);\n\n if( dist_x <= steps){\n var dist_y = Math.abs(start.y - goal.y);\n\n if(dist_y <= steps){\n return true;\n }\n }\n return false;\n}", "title": "" }, { "docid": "348ff1fdb300f772fd68506a8be66f51", "score": "0.48153186", "text": "percolates() {\n\t\treturn this.percolateUF.connected(this.top, this.bottom)\n\t}", "title": "" }, { "docid": "42b44de45f418894d485761c2b7ac04e", "score": "0.4804991", "text": "is(state) {\n return this._states.current[state] && this._states.current[state] > 0;\n }", "title": "" }, { "docid": "6fccc428dacd22f6c3ef8839b62d98aa", "score": "0.48003456", "text": "detectedPickup() {\n if (!this.carried) { // If flag is unposessed\n if (org.cursor.x - org.col > this.x - this.width / 2\n && org.cursor.x + org.col < this.x + this.width / 2\n && org.cursor.y - org.col > this.y - this.height / 2\n && org.cursor.y + org.col < this.y + this.height / 2) { // If org collides with flag\n return true;\n }\n }\n return false;\n }", "title": "" }, { "docid": "44919964e809ecfb30edcc79abbdafa7", "score": "0.47974497", "text": "isReverse () {\n\t\treturn this.forward !== null;\n\t}", "title": "" }, { "docid": "4aa8f445374f843523ff4222149212e8", "score": "0.47845137", "text": "function isDestinyTheStartingSection(){\n var anchor = getAnchorsURL();\n var destinationSection = getSectionByAnchor(anchor.section);\n return !anchor.section || !destinationSection || typeof destinationSection !=='undefined' && index(destinationSection) === index(startingSection);\n }", "title": "" }, { "docid": "2a46ce660c00c86265fdda119d11107e", "score": "0.47832742", "text": "isMazeValid() {\n let q = new Queue();\n q.put(this.maze[0][0]);\n let current = this.maze[0][0];\n let target = this.maze[this.width-1][this.height-1];\n \n while(!q.isEmpty() && current!==target) {\n current = q.get();\n current.visited = true;\n if(current === target) {\n return true;\n }\n this._getNeighbors(current).forEach( function(neighbor) {\n if(! neighbor.visited) {\n q.put(neighbor);\n }\n })\n }\n if(q.isEmpty()) {\n return false;\n }\n return true;\n }", "title": "" }, { "docid": "c3c93d6e99e296ec3bbbd0df57a453f0", "score": "0.4782371", "text": "function isLoop(task, target, visited) {\n //var prof= new Profiler(\"gm_isLoop\");\n //console.debug(\"isLoop :\"+task.name+\" - \"+target.name);\n if (target == task) {\n return true;\n }\n\n var sups = task.getSuperiors();\n\n //my parent' superiors are my superiors too\n var p = task.getParent();\n while (p) {\n sups = sups.concat(p.getSuperiors());\n p = p.getParent();\n }\n\n //my children superiors are my superiors too\n var chs = task.getChildren();\n for (var i = 0; i < chs.length; i++) {\n sups = sups.concat(chs[i].getSuperiors());\n }\n\n\n var loop = false;\n //check superiors\n for (var i = 0; i < sups.length; i++) {\n var supLink = sups[i];\n if (supLink.from == target) {\n loop = true;\n break;\n } else {\n if (visited.indexOf(supLink.from.id + \"x\" + target.id) <= 0) {\n visited.push(supLink.from.id + \"x\" + target.id);\n if (isLoop(supLink.from, target, visited)) {\n loop = true;\n break;\n }\n }\n }\n }\n\n //check target parent\n var tpar = target.getParent();\n if (tpar) {\n if (visited.indexOf(task.id + \"x\" + tpar.id) <= 0) {\n visited.push(task.id + \"x\" + tpar.id);\n if (isLoop(task, tpar, visited)) {\n loop = true;\n }\n }\n }\n\n //prof.stop();\n return loop;\n }", "title": "" }, { "docid": "c3c93d6e99e296ec3bbbd0df57a453f0", "score": "0.4782371", "text": "function isLoop(task, target, visited) {\n //var prof= new Profiler(\"gm_isLoop\");\n //console.debug(\"isLoop :\"+task.name+\" - \"+target.name);\n if (target == task) {\n return true;\n }\n\n var sups = task.getSuperiors();\n\n //my parent' superiors are my superiors too\n var p = task.getParent();\n while (p) {\n sups = sups.concat(p.getSuperiors());\n p = p.getParent();\n }\n\n //my children superiors are my superiors too\n var chs = task.getChildren();\n for (var i = 0; i < chs.length; i++) {\n sups = sups.concat(chs[i].getSuperiors());\n }\n\n\n var loop = false;\n //check superiors\n for (var i = 0; i < sups.length; i++) {\n var supLink = sups[i];\n if (supLink.from == target) {\n loop = true;\n break;\n } else {\n if (visited.indexOf(supLink.from.id + \"x\" + target.id) <= 0) {\n visited.push(supLink.from.id + \"x\" + target.id);\n if (isLoop(supLink.from, target, visited)) {\n loop = true;\n break;\n }\n }\n }\n }\n\n //check target parent\n var tpar = target.getParent();\n if (tpar) {\n if (visited.indexOf(task.id + \"x\" + tpar.id) <= 0) {\n visited.push(task.id + \"x\" + tpar.id);\n if (isLoop(task, tpar, visited)) {\n loop = true;\n }\n }\n }\n\n //prof.stop();\n return loop;\n }", "title": "" }, { "docid": "b5faa957ce88b800a89953d4c193eaa1", "score": "0.47817713", "text": "pe () {\n if (edgeUid[this.euid].lastState === false && this.state === true) {\n return true\n } else {\n return false\n }\n }", "title": "" }, { "docid": "c61a727e0e6528ebe27e9597f16a5103", "score": "0.4767514", "text": "function isEnd(room) {\n var citizenCount = 0;\n var mafiaCount = 0;\n for (var i = 0; i < room.roles.length; i++) {\n if (room.roles[i].isDead == true) {\n if (room.roles[i].role == 'Mafia')\n mafiaCount++;\n else\n citizenCount++;\n }\n }\n if (mafiaCount == 2)\n return true;\n else if (citizenCount == 5)\n return false;\n else\n return null;\n}", "title": "" }, { "docid": "e8ed216afeafef330761332d83a5c383", "score": "0.4764993", "text": "isWalkable(gameState, tile) {\r\n\t\treturn tile.value !== TILE.FOG_OBSTACLE && \r\n\t\t\ttile.value !== TILE.OFF_LIMITS &&\r\n\t\t\ttile.value !== TILE.MOUNTAIN && \r\n\t\t\t!this.isCity(gameState, tile);\r\n\t}", "title": "" }, { "docid": "0f376d29e8bd35e22e94203feadf3044", "score": "0.47642118", "text": "function reachedEndIIIS (n) {\n\tif (!n) return true;\n\treturn (n.isBottom () && n.index() === this.searchingFor);\n}", "title": "" }, { "docid": "292bcd082fbe34a184f6a955834ed106", "score": "0.47575685", "text": "function endsWith(str, targets) {\n\t\tvar endsWithAny = false;\n\t\ttargets.forEach(function(target) {\n\t\t\tif(_.endsWith(str, target)) {\n\t\t\t\tendsWithAny = true;\n\t\t\t\treturn false; //exit iteration early once the first one is found\n\t\t\t}\n\t\t});\n\t\treturn endsWithAny;\n\t}", "title": "" }, { "docid": "b1a21423b172c9ad6bc68f9d6b5da356", "score": "0.47554216", "text": "_u() {\n return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state;\n }", "title": "" }, { "docid": "d64bac784e7aeed38c70297667de1ec4", "score": "0.4744198", "text": "_allMinesDiscoverd() {\n let res = true;\n\n this._forEachCell((x,y,cell) => {\n if(!cell.haveMine && !cell.isExposed)\n res = false;\n });\n\n return res;\n }", "title": "" }, { "docid": "6a96cc9780d8ba46b0828738df5621d5", "score": "0.47383037", "text": "get isCombination() {\r\n return (this.madeFrom !== undefined);\r\n }", "title": "" }, { "docid": "0949e80ec566a99455ca69ead44d9233", "score": "0.4733869", "text": "function canWalkToEnd(arr) {\n let maxSoFar = 0;\n for (let i=0; i<arr.length; i++) {\n const val = arr[i];\n if (i > maxSoFar) break;\n maxSoFar = Math.max(maxSoFar, i + val);\n }\n return maxSoFar >= arr.length-1;\n}", "title": "" }, { "docid": "19c55e13f92c7237462dbf9568a26f82", "score": "0.4733765", "text": "detectCycleDFS(curr,whiteSet,greySet,blackSet){\n // node and its children are already visited\n if(blackSet.has(curr)){\n return false;\n }\n // node currenlt in visiting state and again introduced by another node\n // which means there is a cycle\n if(greySet.has(curr)){\n return true;\n }\n // add the current node to geySet indicating its currently visiting\n greySet.add(curr);\n // node\n let node = this.getNode(curr);\n \n for(let i=0; i<node.adjacent.length; i++){\n whiteSet.splice(whiteSet.indexOf(node.adjacent[i]),1);\n\n if(greySet.has(node.adjacent[i])){\n return true;\n }\n \n let r = this.detectCycleDFS(node.adjacent[i].destid,whiteSet,greySet,blackSet);\n\n if(r){\n return true;\n }\n }\n greySet.delete(curr);\n blackSet.add(curr);\n\n return false;\n }", "title": "" }, { "docid": "709d472c5d6dbbbe6186a15ad5a90406", "score": "0.4732156", "text": "isMatched() {\n return !(this.tree.filterMode && !this.match);\n }", "title": "" }, { "docid": "b65b2122fedfe0ad21bdb0dcbb99820c", "score": "0.47271657", "text": "isMovePossible(src, dest, isDestEnemyOccupied, isEnemyBeforeOccupied) {\n const xSrc = src[0],\n ySrc = src[1],\n xDest = dest[0],\n yDest = dest[1];\n let xDiff = xDest - xSrc,\n yDiff = yDest - ySrc;\n if (\n !isDestEnemyOccupied &&\n !(xDiff === 0 && yDiff === 0) &&\n xDiff >= -1 &&\n xDiff <= 1 &&\n yDiff >= -1 &&\n yDiff <= 1\n ) {\n return true;\n } else if (\n isEnemyBeforeOccupied &&\n !isDestEnemyOccupied &&\n (xDiff === 2 || xDiff === -2 || xDiff === 0) &&\n (yDiff === 2 || yDiff === -2 || yDiff === 0) &&\n !(xDiff === 0 && yDiff === 0)\n ) {\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "bd444c5860a2299630b0ebae30212ebc", "score": "0.47256255", "text": "get hasNext() {\n const stack = this.stack;\n\n if (stack.length === 0) {\n return false;\n }\n\n if (stack[stack.length - 1].right) {\n return true;\n }\n\n for (let s = stack.length - 1; s > 0; --s) {\n if (stack[s - 1].left === stack[s]) {\n return true;\n }\n }\n\n return false;\n }", "title": "" } ]
3a7b16fb20d94aeabe8ce39c5f1e6570
Visits a YieldExpression node.
[ { "docid": "96ae61e2acf77498a52b025358cb57ac", "score": "0.8158335", "text": "function visitYieldExpression(node) {\n // `yield` expressions are transformed using the generators transformer.\n return ts.visitEachChild(node, visitor, context);\n }", "title": "" } ]
[ { "docid": "7a6d7dd0f2e870805b89b53bfc5c7d2f", "score": "0.7517478", "text": "function visitYieldExpression(node) {\n // [source]\n // x = yield a();\n //\n // [intermediate]\n // .yield resumeLabel, (a())\n // .mark resumeLabel\n // x = %sent%;\n var resumeLabel = defineLabel();\n var expression = ts.visitNode(node.expression, visitor, ts.isExpression);\n if (node.asteriskToken) {\n var iterator = (ts.getEmitFlags(node.expression) & 8388608 /* Iterator */) === 0\n ? ts.createValuesHelper(context, expression, /*location*/ node)\n : expression;\n emitYieldStar(iterator, /*location*/ node);\n }\n else {\n emitYield(expression, /*location*/ node);\n }\n markLabel(resumeLabel);\n return createGeneratorResume(/*location*/ node);\n }", "title": "" }, { "docid": "ca6eb4649353b37de27ded70d78713f7", "score": "0.7425793", "text": "function parseYield() {\n var node = startNode();\n next();\n if (eat(_semi) || canInsertSemicolon()) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = eat(_star);\n node.argument = parseExpression(true);\n }\n return finishNode(node, \"YieldExpression\");\n }", "title": "" }, { "docid": "ca6eb4649353b37de27ded70d78713f7", "score": "0.7425793", "text": "function parseYield() {\n var node = startNode();\n next();\n if (eat(_semi) || canInsertSemicolon()) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = eat(_star);\n node.argument = parseExpression(true);\n }\n return finishNode(node, \"YieldExpression\");\n }", "title": "" }, { "docid": "9baea90b2294192b4fbfb8c2169cf182", "score": "0.73234344", "text": "function parseYieldExpression() {\n\t var argument, expr, delegate, previousAllowYield;\n\n\t argument = null;\n\t expr = new Node();\n\t delegate = false;\n\n\t expectKeyword('yield');\n\n\t if (!hasLineTerminator) {\n\t previousAllowYield = state.allowYield;\n\t state.allowYield = false;\n\t delegate = match('*');\n\t if (delegate) {\n\t lex();\n\t argument = parseAssignmentExpression();\n\t } else {\n\t if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n\t argument = parseAssignmentExpression();\n\t }\n\t }\n\t state.allowYield = previousAllowYield;\n\t }\n\n\t return expr.finishYieldExpression(argument, delegate);\n\t }", "title": "" }, { "docid": "6b930bf2936f0c6a1fc6b176d33ebdcc", "score": "0.73218316", "text": "function parseYieldExpression() {\n\t var argument, expr, delegate, previousAllowYield;\n\t\n\t argument = null;\n\t expr = new Node();\n\t delegate = false;\n\t\n\t expectKeyword('yield');\n\t\n\t if (!hasLineTerminator) {\n\t previousAllowYield = state.allowYield;\n\t state.allowYield = false;\n\t delegate = match('*');\n\t if (delegate) {\n\t lex();\n\t argument = parseAssignmentExpression();\n\t } else {\n\t if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n\t argument = parseAssignmentExpression();\n\t }\n\t }\n\t state.allowYield = previousAllowYield;\n\t }\n\t\n\t return expr.finishYieldExpression(argument, delegate);\n\t }", "title": "" }, { "docid": "6b930bf2936f0c6a1fc6b176d33ebdcc", "score": "0.73218316", "text": "function parseYieldExpression() {\n\t var argument, expr, delegate, previousAllowYield;\n\t\n\t argument = null;\n\t expr = new Node();\n\t delegate = false;\n\t\n\t expectKeyword('yield');\n\t\n\t if (!hasLineTerminator) {\n\t previousAllowYield = state.allowYield;\n\t state.allowYield = false;\n\t delegate = match('*');\n\t if (delegate) {\n\t lex();\n\t argument = parseAssignmentExpression();\n\t } else {\n\t if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n\t argument = parseAssignmentExpression();\n\t }\n\t }\n\t state.allowYield = previousAllowYield;\n\t }\n\t\n\t return expr.finishYieldExpression(argument, delegate);\n\t }", "title": "" }, { "docid": "6b930bf2936f0c6a1fc6b176d33ebdcc", "score": "0.73218316", "text": "function parseYieldExpression() {\n\t var argument, expr, delegate, previousAllowYield;\n\t\n\t argument = null;\n\t expr = new Node();\n\t delegate = false;\n\t\n\t expectKeyword('yield');\n\t\n\t if (!hasLineTerminator) {\n\t previousAllowYield = state.allowYield;\n\t state.allowYield = false;\n\t delegate = match('*');\n\t if (delegate) {\n\t lex();\n\t argument = parseAssignmentExpression();\n\t } else {\n\t if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n\t argument = parseAssignmentExpression();\n\t }\n\t }\n\t state.allowYield = previousAllowYield;\n\t }\n\t\n\t return expr.finishYieldExpression(argument, delegate);\n\t }", "title": "" }, { "docid": "6b930bf2936f0c6a1fc6b176d33ebdcc", "score": "0.73218316", "text": "function parseYieldExpression() {\n\t var argument, expr, delegate, previousAllowYield;\n\t\n\t argument = null;\n\t expr = new Node();\n\t delegate = false;\n\t\n\t expectKeyword('yield');\n\t\n\t if (!hasLineTerminator) {\n\t previousAllowYield = state.allowYield;\n\t state.allowYield = false;\n\t delegate = match('*');\n\t if (delegate) {\n\t lex();\n\t argument = parseAssignmentExpression();\n\t } else {\n\t if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n\t argument = parseAssignmentExpression();\n\t }\n\t }\n\t state.allowYield = previousAllowYield;\n\t }\n\t\n\t return expr.finishYieldExpression(argument, delegate);\n\t }", "title": "" }, { "docid": "6d5313b268f934f402926ed43059743f", "score": "0.7274325", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "6d5313b268f934f402926ed43059743f", "score": "0.7274325", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "6d5313b268f934f402926ed43059743f", "score": "0.7274325", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "f7a6275ce7dac892c159ffccea5411a1", "score": "0.72469115", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "f7a6275ce7dac892c159ffccea5411a1", "score": "0.72469115", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "f7a6275ce7dac892c159ffccea5411a1", "score": "0.72469115", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "f7a6275ce7dac892c159ffccea5411a1", "score": "0.72469115", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "f7a6275ce7dac892c159ffccea5411a1", "score": "0.72469115", "text": "function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }", "title": "" }, { "docid": "08a4393da3b0ec63c50329fff3c63610", "score": "0.72329843", "text": "visitYield_expr(ctx) {\r\n console.log(\"visitYield_expr\");\r\n if (ctx.yield_arg() !== null) {\r\n return { type: \"YieldStatement\", arg: this.visit(ctx.yield_arg()) };\r\n } else {\r\n return { type: \"YieldStatement\", arg: [] };\r\n }\r\n }", "title": "" }, { "docid": "a60297aea06dcf41661b5b5fa97ef504", "score": "0.7050502", "text": "visitYield_stmt(ctx) {\r\n console.log(\"visitYield_stmt\");\r\n return this.visit(ctx.yield_expr());\r\n }", "title": "" }, { "docid": "8a281030a402d486762cfd74bec06bdf", "score": "0.70129025", "text": "function emitYield(expression, location) {\n emitWorker(6 /* Yield */, [expression], location);\n }", "title": "" }, { "docid": "374a47a271a186096b0f0b03bf63dbce", "score": "0.69927794", "text": "function YieldExpression(childNodes) {\n (0, _classCallCheck3.default)(this, YieldExpression);\n return (0, _possibleConstructorReturn3.default)(this, (YieldExpression.__proto__ || (0, _getPrototypeOf2.default)(YieldExpression)).call(this, 'YieldExpression', childNodes));\n }", "title": "" }, { "docid": "06ca70ee4ffe91b9cda44e12a1c6be57", "score": "0.69043607", "text": "YieldExpression() {\n\n /* istanbul ignore else */\n if (stack.length > 0) {\n stack[stack.length - 1] += 1;\n }\n }", "title": "" }, { "docid": "12ac538210f3d5b043bd2f7f49c24e68", "score": "0.6509158", "text": "function writeYield(expression, operationLocation) {\n lastOperationWasAbrupt = true;\n writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression\n ? [createInstruction(4 /* Yield */), expression]\n : [createInstruction(4 /* Yield */)])), operationLocation), 384 /* NoTokenSourceMaps */));\n }", "title": "" }, { "docid": "2400b41fe007078e5472cdb48a7b9e9e", "score": "0.6468296", "text": "function emitYieldStar(expression, location) {\n emitWorker(7 /* YieldStar */, [expression], location);\n }", "title": "" }, { "docid": "8744dce735e350a279e3585e0cb89055", "score": "0.64642453", "text": "function visitJavaScriptContainingYield(node) {\n switch (node.kind) {\n case 194 /* BinaryExpression */:\n return visitBinaryExpression(node);\n case 195 /* ConditionalExpression */:\n return visitConditionalExpression(node);\n case 197 /* YieldExpression */:\n return visitYieldExpression(node);\n case 177 /* ArrayLiteralExpression */:\n return visitArrayLiteralExpression(node);\n case 178 /* ObjectLiteralExpression */:\n return visitObjectLiteralExpression(node);\n case 180 /* ElementAccessExpression */:\n return visitElementAccessExpression(node);\n case 181 /* CallExpression */:\n return visitCallExpression(node);\n case 182 /* NewExpression */:\n return visitNewExpression(node);\n default:\n return ts.visitEachChild(node, visitor, context);\n }\n }", "title": "" }, { "docid": "01e2b1d744fad2a96978f124b52bee06", "score": "0.6444227", "text": "function visitJavaScriptInStatementContainingYield(node) {\n switch (node.kind) {\n case 212 /* DoStatement */:\n return visitDoStatement(node);\n case 213 /* WhileStatement */:\n return visitWhileStatement(node);\n case 221 /* SwitchStatement */:\n return visitSwitchStatement(node);\n case 222 /* LabeledStatement */:\n return visitLabeledStatement(node);\n default:\n return visitJavaScriptInGeneratorFunctionBody(node);\n }\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "0a4b725023e89aca2b0aae7eee0ebed3", "score": "0.62539077", "text": "function matchYield() {\n return state.yieldAllowed && matchKeyword('yield', !strict);\n }", "title": "" }, { "docid": "2098077e53cb86b46e285e730a6041ff", "score": "0.62365216", "text": "function parseYield() {\n _index3.next.call(void 0, );\n if (!_index3.match.call(void 0, _types3.TokenType.semi) && !_util.canInsertSemicolon.call(void 0, )) {\n _index3.eat.call(void 0, _types3.TokenType.star);\n parseMaybeAssign();\n }\n}", "title": "" }, { "docid": "6dd9d2147375ecd5e15dda65de6f7e8b", "score": "0.61627656", "text": "function visitElementAccessExpression(node) {\n if (containsYield(node.argumentExpression)) {\n // [source]\n // a = x[yield];\n //\n // [intermediate]\n // .local _a\n // _a = x;\n // .yield resumeLabel\n // .mark resumeLabel\n // a = _a[%sent%]\n var clone_5 = ts.getMutableClone(node);\n clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));\n clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);\n return clone_5;\n }\n return ts.visitEachChild(node, visitor, context);\n }", "title": "" }, { "docid": "5aa2c2cf9f0bf1fd0d3eb7370f6be47c", "score": "0.61552864", "text": "function visitAwaitExpression(node) {\n return ts.setOriginalNode(ts.setTextRange(ts.createYield(\n /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);\n }", "title": "" }, { "docid": "15c6eaa09b76b0b3c2bd5d5e26d60d79", "score": "0.5994526", "text": "function visitFunctionExpression(node) {\n // Currently, we only support generators that were originally async functions.\n if (node.asteriskToken) {\n node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(\n /*modifiers*/ undefined, \n /*asteriskToken*/ undefined, node.name, \n /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), \n /*type*/ undefined, transformGeneratorFunctionBody(node.body)), \n /*location*/ node), node);\n }\n else {\n var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n var savedInStatementContainingYield = inStatementContainingYield;\n inGeneratorFunctionBody = false;\n inStatementContainingYield = false;\n node = ts.visitEachChild(node, visitor, context);\n inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n inStatementContainingYield = savedInStatementContainingYield;\n }\n return node;\n }", "title": "" }, { "docid": "787e8ec0769323fe706c80c7eb15a93d", "score": "0.5984678", "text": "getAst() {\n\n return {\n type: 'yields',\n target: this.target.getAst()\n };\n }", "title": "" }, { "docid": "8dafc513abff99b637d191134f97c9d5", "score": "0.5882697", "text": "function writeYieldStar(expression, operationLocation) {\n lastOperationWasAbrupt = true;\n writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([\n createInstruction(5 /* YieldStar */),\n expression\n ])), operationLocation), 384 /* NoTokenSourceMaps */));\n }", "title": "" }, { "docid": "61b364782af03a579e7e0dde02e7cff6", "score": "0.58271533", "text": "function visitCommaExpression(node) {\n // [source]\n // x = a(), yield, b();\n //\n // [intermediate]\n // a();\n // .yield resumeLabel\n // .mark resumeLabel\n // x = %sent%, b();\n var pendingExpressions = [];\n visit(node.left);\n visit(node.right);\n return ts.inlineExpressions(pendingExpressions);\n function visit(node) {\n if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) {\n visit(node.left);\n visit(node.right);\n }\n else {\n if (containsYield(node) && pendingExpressions.length > 0) {\n emitWorker(1 /* Statement */, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]);\n pendingExpressions = [];\n }\n pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression));\n }\n }\n }", "title": "" }, { "docid": "e3379ba84c339cf269accf5e41c3eeed", "score": "0.5769892", "text": "function visitGenerator(node) {\n switch (node.kind) {\n case 228 /* FunctionDeclaration */:\n return visitFunctionDeclaration(node);\n case 186 /* FunctionExpression */:\n return visitFunctionExpression(node);\n default:\n ts.Debug.failBadSyntaxKind(node);\n return ts.visitEachChild(node, visitor, context);\n }\n }", "title": "" }, { "docid": "aace5088163c3ac1ee1bce3ea0cb1b20", "score": "0.5529621", "text": "visitYield_arg(ctx) {\r\n console.log(\"visitYield_arg\");\r\n if (ctx.FROM() !== null) {\r\n return [this.visit(ctx.test())];\r\n } else {\r\n return this.visit(ctx.testlist());\r\n }\r\n }", "title": "" }, { "docid": "db981aac30c42fc0cbc5d53cee1eb99f", "score": "0.542248", "text": "*[Symbol.iterator]() {\n\t\tlet node = this.head;\n\n\t\twhile (node) {\n\t\t\tyield node;\n\t\t\tnode = node.next;\n\t\t}\n\t}", "title": "" }, { "docid": "a38f789d41e95b3cd280d31be56f6bdb", "score": "0.5298332", "text": "*[Symbol.iterator]() {\n const nodesStack = [...this.children];\n let currentNode;\n yield this;\n while (nodesStack.length > 0) {\n currentNode = nodesStack.pop();\n yield currentNode;\n nodesStack.push(...currentNode.children);\n }\n }", "title": "" }, { "docid": "d4e328a209a12cc6a2b57c02e5b7e69a", "score": "0.52635735", "text": "*[Symbol.iterator]() {\r\n yield 1;\r\n }", "title": "" }, { "docid": "b7bc838938cb04023a5f4ea86e7a15bc", "score": "0.52288735", "text": "function bind( x, next ) {\n if (x instanceof Yield) {\n const cont = x.cont; // capture locally\n x.cont = function(arg) { return bind(cont(arg),next); };\n return x;\n }\n else {\n return next(x);\n }\n}", "title": "" }, { "docid": "8e989b73a3347805282fe7588b7a6759", "score": "0.5200707", "text": "function hello() {\n console.log('Hello');\n yield 1;\n\n console.log('from');\n yield 3;\n\n console.log('Function');\n}", "title": "" }, { "docid": "23bc4ba68a1229eb7d8fed7537e20767", "score": "0.5190275", "text": "function visitConditionalExpression(node) {\n // [source]\n // x = a() ? yield : b();\n //\n // [intermediate]\n // .local _a\n // .brfalse whenFalseLabel, (a())\n // .yield resumeLabel\n // .mark resumeLabel\n // _a = %sent%;\n // .br resultLabel\n // .mark whenFalseLabel\n // _a = b();\n // .mark resultLabel\n // x = _a;\n // We only need to perform a specific transformation if a `yield` expression exists\n // in either the `whenTrue` or `whenFalse` branches.\n // A `yield` in the condition will be handled by the normal visitor.\n if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) {\n var whenFalseLabel = defineLabel();\n var resultLabel = defineLabel();\n var resultLocal = declareLocal();\n emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), /*location*/ node.condition);\n emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), /*location*/ node.whenTrue);\n emitBreak(resultLabel);\n markLabel(whenFalseLabel);\n emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), /*location*/ node.whenFalse);\n markLabel(resultLabel);\n return resultLocal;\n }\n return ts.visitEachChild(node, visitor, context);\n }", "title": "" }, { "docid": "434e0f094b2b8e46892653e196d1f23d", "score": "0.5185552", "text": "*[Symbol.iterator]() {\n let node = this.head;\n\n while(node){\n yield node;\n node = node.next;\n }\n }", "title": "" }, { "docid": "45b9017ae7d5d429ed7b851adbc4d7b4", "score": "0.51459974", "text": "*[Symbol.iterator]() {\n let node = this.head;\n while (node) {\n yield node;\n node = node.next;\n }\n }", "title": "" }, { "docid": "89766161da1a59a7ebd5dd64bc683f9d", "score": "0.5116617", "text": "function visitExpressionStatement(node) {\n // If we are here it is most likely because our expression is a destructuring assignment.\n switch (node.expression.kind) {\n case 185 /* ParenthesizedExpression */:\n return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));\n case 194 /* BinaryExpression */:\n return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));\n }\n return ts.visitEachChild(node, visitor, context);\n }", "title": "" }, { "docid": "565f32d04e2dda46a8fce851665beb6e", "score": "0.50711155", "text": "*[Symbol.iterator](){\n yield this.content;\n //can't use array helpers here\n for (let child of this.children){ //for every node of this.child\n yield* child; //go into this.child, see if its iterable, if it is iterate through it\n }\n }", "title": "" }, { "docid": "0d561a74b1688054e6e46c4a9a502296", "score": "0.5065874", "text": "function visitRightAssociativeBinaryExpression(node) {\n var left = node.left, right = node.right;\n if (containsYield(right)) {\n var target = void 0;\n switch (left.kind) {\n case 179 /* PropertyAccessExpression */:\n // [source]\n // a.b = yield;\n //\n // [intermediate]\n // .local _a\n // _a = a;\n // .yield resumeLabel\n // .mark resumeLabel\n // _a.b = %sent%;\n target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);\n break;\n case 180 /* ElementAccessExpression */:\n // [source]\n // a[b] = yield;\n //\n // [intermediate]\n // .local _a, _b\n // _a = a;\n // _b = b;\n // .yield resumeLabel\n // .mark resumeLabel\n // _a[_b] = %sent%;\n target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));\n break;\n default:\n target = ts.visitNode(left, visitor, ts.isExpression);\n break;\n }\n var operator = node.operatorToken.kind;\n if (isCompoundAssignment(operator)) {\n return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node);\n }\n else {\n return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression));\n }\n }\n return ts.visitEachChild(node, visitor, context);\n }", "title": "" }, { "docid": "024118d1a008e44de8dc4d8d651f3c29", "score": "0.50641555", "text": "*[Symbol.iterator] () {\n for(let e of this.employees){\n // console.log('e' , e);\n yield e;\n } \n }", "title": "" }, { "docid": "a8c3b24ad750b19559f96675cefc20c4", "score": "0.50566375", "text": "enterLoopExpression(ctx) {\n\t}", "title": "" }, { "docid": "badbbe88436a1c667c54b9f0f052204a", "score": "0.5022243", "text": "visitExpression(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "14dedcacb693d19d50b99c0c2f00aaa5", "score": "0.5020654", "text": "function _yield_iter_resume( iter, arg ) {\n let res = (arg instanceof ExceptionValue ? iter.throw(arg.exn) : iter.next(arg));\n if (!res.done) {\n const yld = res.value;\n _assert(yld instanceof Yield, \"regular operations should be wrapped in `to_iter` to lift them to an iterator (function*)\");\n if (yld.branch.resume_kind > _resume_kind.Once || yld.branch.resume_kind === _resume_kind.Scoped) return _yield_iter_not_once(yld);\n const cont = yld.cont; // capture locally\n yld.cont = function(argval) {\n if (cont === _cont_id) {\n return _yield_iter_resume(iter,argval);\n }\n else {\n return bind(cont(argval), function(bindarg) {\n return _yield_iter_resume(iter,bindarg);\n });\n }\n };\n }\n return res.value;\n}", "title": "" }, { "docid": "ddd6294f721d45aeb1454b0d479f703a", "score": "0.5004636", "text": "enterExpression(ctx) {\n\t}", "title": "" }, { "docid": "ddd6294f721d45aeb1454b0d479f703a", "score": "0.5004636", "text": "enterExpression(ctx) {\n\t}", "title": "" }, { "docid": "73cad4dbaf10a1cc945ff53f3ca2d4bb", "score": "0.49864498", "text": "_$generator() {\n super._$generator();\n\n this._value.generator = this._node.generator;\n }", "title": "" }, { "docid": "4459d895ad3e3afc55d4f6d3b724f065", "score": "0.49793044", "text": "enterForExpression(ctx) {\n\t}", "title": "" }, { "docid": "c20fb746c0aa863897f15af796e7189b", "score": "0.49451932", "text": "function yield_iter( x ) {\n return (_is_iterator(x) ? _yield_iter_resume(x) : x);\n}", "title": "" }, { "docid": "7aa0d6938a093634ded8a5168414209c", "score": "0.48946708", "text": "function visitAccessorDeclaration(node) {\n var savedInGeneratorFunctionBody = inGeneratorFunctionBody;\n var savedInStatementContainingYield = inStatementContainingYield;\n inGeneratorFunctionBody = false;\n inStatementContainingYield = false;\n node = ts.visitEachChild(node, visitor, context);\n inGeneratorFunctionBody = savedInGeneratorFunctionBody;\n inStatementContainingYield = savedInStatementContainingYield;\n return node;\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "f66d07f87df17861f8606abc2429f3d0", "score": "0.488682", "text": "function next() {\n index++;\n c = expression.charAt(index);\n }", "title": "" }, { "docid": "1f146fe0dfc9c2fdaee66ba738373d2e", "score": "0.4869296", "text": "function YieldBlock(to, params) {\n return [op('SimpleArgs', {\n params,\n hash: null,\n atNames: true\n }), op(24\n /* GetBlock */\n , to), op(25\n /* JitSpreadBlock */\n ), op('Option', op('JitCompileBlock')), op(64\n /* InvokeYield */\n ), op(40\n /* PopScope */\n ), op(1\n /* PopFrame */\n )];\n}", "title": "" }, { "docid": "acab794f0a064a6ba62cd8b5cca0a3bd", "score": "0.48577356", "text": "*[Symbol.iterator]() {\n yield* this.privEdges;\n }", "title": "" }, { "docid": "b646109c348a43359707009f9cf3298f", "score": "0.4840991", "text": "enterExpressionStatement(ctx) {\n\t}", "title": "" }, { "docid": "6f85de80a9562fae036502af93c8e186", "score": "0.48237348", "text": "yieldNotWarp() {\n if (!this.isWarp) {\n this.source += 'yield;\\n';\n this.yielded();\n }\n }", "title": "" }, { "docid": "7c544f751c423c0c4344b733efee1364", "score": "0.48048034", "text": "function next() {\n index++;\n c = expression.charAt(index);\n}", "title": "" }, { "docid": "9b70b0ce797ce23287e442586cb9d906", "score": "0.4798031", "text": "visitStar_expr(ctx) {\r\n console.log(\"visitStar_expr\");\r\n if (ctx.STAR() !== null) {\r\n return { type: \"StarExpression\", value: this.visit(ctx.expr()) };\r\n }\r\n return this.visit(ctx.expr());\r\n }", "title": "" }, { "docid": "e43ff23cebb5e0aa4f360ada1395604c", "score": "0.47917977", "text": "function evaluate_generator(gen) {\r\n let next = gen.next();\r\n while (!next.done) {\r\n next = gen.next(); \r\n }\r\n return next.value;\r\n }", "title": "" }, { "docid": "82bf40e2b21226e13a7735680f5a3391", "score": "0.47839868", "text": "visitNode(node) { }", "title": "" }, { "docid": "7aeb318066aac1d31ecaed37a5f2f95f", "score": "0.4781132", "text": "visitCursor_expression(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "0ba79f505f62930953d8c991a7328713", "score": "0.4777544", "text": "enterAssignmentExpression(ctx) {\n\t}", "title": "" }, { "docid": "4ad4b21045011605a5bbe2157f46927f", "score": "0.47740874", "text": "*end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }", "title": "" }, { "docid": "4b0b60115dd9e2246a99cc2ee1d9bf99", "score": "0.4763724", "text": "Return(_, exp) { return new ReturnStatement(exp.ast()); }", "title": "" }, { "docid": "4284b534e2bf6f3e566ba7c3f246f968", "score": "0.47341332", "text": "IterationStatement() {\n switch (this._lookahead.type) {\n case \"while\":\n return this.WhileStatement();\n case \"do\":\n return this.DoWhileStatement();\n case \"for\":\n return this.ForStatement();\n }\n }", "title": "" }, { "docid": "f4f5328e07f0f859914cd7f6e637c560", "score": "0.4733447", "text": "visitExpr(ctx) {\r\n console.log(\"visitExpr\");\r\n let length = ctx.getChildCount();\r\n let value = this.visit(ctx.xor_expr(0));\r\n for (var i = 1; i * 2 < length; i = i + 1) {\r\n if (ctx.getChild(i * 2 - 1).getText() === \"|\") {\r\n value = {\r\n type: \"BinaryExpression\",\r\n operator: \"|\",\r\n left: value,\r\n right: this.visit(ctx.xor_expr(i)),\r\n };\r\n }\r\n }\r\n return value;\r\n }", "title": "" }, { "docid": "5d277b17dc123b77c65d53a0c67852b8", "score": "0.47255316", "text": "visit(node) {\n node.visit(this);\n }", "title": "" }, { "docid": "fbc48c5c2f3b12d26191e66e4a0c9b47", "score": "0.47090158", "text": "function visitJavaScriptInGeneratorFunctionBody(node) {\n switch (node.kind) {\n case 228 /* FunctionDeclaration */:\n return visitFunctionDeclaration(node);\n case 186 /* FunctionExpression */:\n return visitFunctionExpression(node);\n case 153 /* GetAccessor */:\n case 154 /* SetAccessor */:\n return visitAccessorDeclaration(node);\n case 208 /* VariableStatement */:\n return visitVariableStatement(node);\n case 214 /* ForStatement */:\n return visitForStatement(node);\n case 215 /* ForInStatement */:\n return visitForInStatement(node);\n case 218 /* BreakStatement */:\n return visitBreakStatement(node);\n case 217 /* ContinueStatement */:\n return visitContinueStatement(node);\n case 219 /* ReturnStatement */:\n return visitReturnStatement(node);\n default:\n if (node.transformFlags & 16777216 /* ContainsYield */) {\n return visitJavaScriptContainingYield(node);\n }\n else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) {\n return ts.visitEachChild(node, visitor, context);\n }\n else {\n return node;\n }\n }\n }", "title": "" }, { "docid": "6f34ccaa1c4e0d09957f10c26fb6acb4", "score": "0.47077203", "text": "function emitReturn(expression, location) {\n emitWorker(8 /* Return */, [expression], location);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "92c1966b9eef2e70ffd53b58e331cb10", "score": "0.46953782", "text": "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "title": "" }, { "docid": "ceab44c8373530b2a793cf7f1421c2f5", "score": "0.468677", "text": "function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n }", "title": "" }, { "docid": "d16cd84907b2e7f67219d8e7312dfa45", "score": "0.46848744", "text": "* __pathsGenerator(path, node) {\n const endingSlash =\n (node.children.length > 0 || node.endsWithSlash) ? '/' : '';\n const currentPath = path + node.name + endingSlash;\n if (!node.visited) {\n yield currentPath;\n node.visited = true;\n }\n for (const child of node.children) {\n yield * this.__pathsGenerator(currentPath, child);\n }\n }", "title": "" }, { "docid": "3263cfe5100e27536ef6b9f90717b2d5", "score": "0.4669892", "text": "ExpressionStatement() {\n const expression = this.Expression();\n this._eat(\";\");\n return factory.ExpressionStatement(expression);\n }", "title": "" }, { "docid": "d31bb0559e97e96fd7de72a9cd5bcd73", "score": "0.466275", "text": "function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n }", "title": "" }, { "docid": "3cf87cca39c0227c858ff9dc018fc936", "score": "0.46619236", "text": "*[Symbol.iterator]() {\n for (const element of this.elements) {\n yield element;\n }\n }", "title": "" } ]
66669ca20e283122c3585a3b68f10ab2
vuerouter v3.0.1 (c) 2017 Evan You
[ { "docid": "3a1bca8591b416d8a0534b630a3da51a", "score": "0.0", "text": "function r(t,e){0}", "title": "" } ]
[ { "docid": "76b189c5c94c6f8061067a8576898f3e", "score": "0.6447737", "text": "function Vu(){}", "title": "" }, { "docid": "2d5243a59b27021c808a2a81f0ac9072", "score": "0.59940135", "text": "function Scm_vau() {}", "title": "" }, { "docid": "4b17224dadea64a6a7e1b682c11dfc64", "score": "0.59386986", "text": "function __vue_normalize__$5(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\PreviewResult.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "1f8554c69c69f3d954a75772d9844b8c", "score": "0.5937417", "text": "function BF(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"source.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "4cd6c6a03165fe5fe7afaa584c25e9d1", "score": "0.5863027", "text": "vampireWithName(name) {\n \n }", "title": "" }, { "docid": "e6f8f08d2c3c3899091f17869502031a", "score": "0.57840383", "text": "function qw(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "c2db169496e8317faa3d1ab0dd87cabe", "score": "0.575757", "text": "function __vue_normalize__$6(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\handlers\\\\SimpleHandler.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "fcf4393abdee56364043e4462a0f131c", "score": "0.57495207", "text": "function __vue_normalize__$3(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\BoundingBox.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "037fb7e3fdff85abdf854b6f3338967e", "score": "0.57162887", "text": "function __vue_normalize__$1(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\HandlerWrapper.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "f87d84667cf6f67cb1b4f7cef97ec390", "score": "0.571185", "text": "function yb(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "3ec756bcdca2e9467f46dfbdc5a68884", "score": "0.5691062", "text": "function Hx(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"source.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "b32296c9277f12125b2b12f11cd351cf", "score": "0.5671617", "text": "function Vy(){var t=this;hr()(this,{$source:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&ll()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$sourceContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.sourceContainer}}})}", "title": "" }, { "docid": "f73315326895f040e4d1b43ffdf13646", "score": "0.5661823", "text": "function __vue_normalize__$a(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\Cropper.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "7dde58d7e34e1b7defe2b93c46560bc5", "score": "0.56575465", "text": "function Ib(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "5821a1f65d844321086fabf717abfbac", "score": "0.56518465", "text": "function __vue_normalize__$9(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\stencils\\\\CircleStencil.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "6ae15432c0d537c04f5e44e3b2fa8c9f", "score": "0.5638943", "text": "function aj(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"source.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "64ae5ae78cf2a3c8abfc764560643918", "score": "0.56372243", "text": "function Bz(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "c5bf779a43590bcf90de8b59da75b953", "score": "0.5634864", "text": "function SigV4Utils() {}", "title": "" }, { "docid": "97c607e6f4846728d9a873e545f28f58", "score": "0.5630502", "text": "function gvjs_om(a){var b=gvjs_0ba;this.$e=[];this.Xca=b;this.L8=a||null;this.lI=this.dC=!1;this.ek=void 0;this.M3=this.ika=this.MV=!1;this.pU=0;this.rd=null;this.TV=0}", "title": "" }, { "docid": "51b82234f90fb16d3584f54b2503310b", "score": "0.5614506", "text": "function SigV4Utils(){}", "title": "" }, { "docid": "963db9b5e33aa9b745f41fdded71b2dc", "score": "0.5605148", "text": "function __vue_normalize__$8(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\stencils\\\\RectangleStencil.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "1e3adfc192846e37dfdc43e465878b32", "score": "0.55981845", "text": "function __vue_normalize__$b(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\helpers\\\\PreviewImage.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "39fafd4f6cd12787b9c9ed6c7b282868", "score": "0.5579815", "text": "function Sk(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"source.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "a1abdc4d26d9fc4caddc46a154b09804", "score": "0.55719155", "text": "function ky(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "acffe366305a123ddf65c9f97713c0bb", "score": "0.55578166", "text": "function ___PRIVATE___(){}", "title": "" }, { "docid": "622fe02e5757d2b788815a90939ccc43", "score": "0.5544053", "text": "function YI(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "a5544666fd82b6923c33c74a82c53301", "score": "0.5538715", "text": "function mT(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "cc3299280aaa398b4da420b54f1b6a16", "score": "0.553115", "text": "function __vue_normalize__$2(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\LineWrapper.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "dac94822b3a7c320d672097734af31a2", "score": "0.54660404", "text": "function Ld(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "97c399081bdaaefa1a63330467c4211e", "score": "0.54569477", "text": "function attachVUScripts (){\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.kick1);\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.kick2);\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.snare1);\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.snare2);\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.hihat1);\n rhyth.visualisations.vuScriptBuilder(rhyth.mixer.vuMeters.hihat2);\n}", "title": "" }, { "docid": "cd19d91a12851abe656e4bb89a4c5c01", "score": "0.54510695", "text": "function __vue_normalize__$7(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\lines\\\\SimpleLine.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "981e4656908b3b603831b3b77a24cdc2", "score": "0.54376775", "text": "function VIVID$static_(){ContainerSkin.VIVID=( new ContainerSkin(\"vivid\"));}", "title": "" }, { "docid": "6922512ba3a1a88625941892028facd4", "score": "0.54207927", "text": "function vV(a,b,c,d,e,g,h,k,m,p){if(fa[id]){this.iVa=p?p:Pja;t:{p=this.iVa;var r=fa[xc][Bc]||fa[xc].hash;if(null==p)p=r;else{if(r)for(var r=r[$d](1)[tc](Ee),t=0;t<r[H];t++)if(r[t][$d](0,r[t][md](nf))==p){p=r[t][$d](r[t][md](nf)+1);break t}p=O}}this.LTa=p;this.ub={};this.qra={};this.attributes=[];a&&this[u](dN,a);b&&this[u](hJ,b);c&&this[u](ti,c);d&&this[u](lh,d);e&&this[u](hO,new wV(e[mc]()[tc](Ue)));t:if(a=new wV([0,0,0]),ex.plugins&&ex.mimeTypes[H])(b=ex.plugins[Lha])&&b.description&&(a=new wV(b.description[zb](/([a-zA-Z]|\\s)+/,\nO)[zb](/(\\s+r|\\s+b[0-9]+)/,Ue)[tc](Ue)));else if(ex[wc]&&0<=ex[wc][md](Wha))for(b=1,c=3;b;)try{c++,b=new ActiveXObject(Nha+c),a=new wV([c,0,0])}catch(v){b=null}else{b=null;try{b=new ActiveXObject(Pha)}catch(y){try{b=new ActiveXObject(Oha),a=new wV([6,0,21]),b.N5a=NE}catch(A){if(6==a.OE)break t}try{b=new ActiveXObject(Mha)}catch(I){}}null!=b&&(a=new wV(b.GetVariable(Xfa)[tc](ne)[1][tc](Re)))}this.DW=a;!ca.opera&&fa.all&&7<this.DW.OE&&(xV=!0);g&&this.Nu(Tia,g);this.Nu(fna,h?h:UI);this[u](UN,!1);this[u](HH,\n!1);this[u](wO,k?k:ca[xc]);this[u](OL,O);m&&this[u](OL,m)}}", "title": "" }, { "docid": "d177852bfd771601d7ae3e9576e49c86", "score": "0.5417302", "text": "function jP(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"layer.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "0c6fb45c032ea806de49d714b52e60c0", "score": "0.54103416", "text": "version() {}", "title": "" }, { "docid": "9555bf1b7fbf4323305c504118fca906", "score": "0.5406517", "text": "function __vue_normalize__$4(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\DraggableArea.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "149429567e90430ceabc892f64a510a8", "score": "0.53993773", "text": "function __vue_normalize__(e,t,n,i,o){const a=(\"function\"==typeof n?n.options:n)||{};// For security concerns, we use only base name in production mode.\nreturn a.__file=\"C:\\\\Live\\\\Projects\\\\Hot\\\\Vue Cropper\\\\vue-advanced-cropper-rollup\\\\src\\\\components\\\\service\\\\DraggableElement.vue\",a.render||(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0,o&&(a.functional=!0)),a._scopeId=i,a}", "title": "" }, { "docid": "05fbe3a9ad4029b55300e4e1fa637f5b", "score": "0.53990453", "text": "function HT(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "b08f43a52cd92e2347ccf1f0264dc8d2", "score": "0.5396945", "text": "function ex(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"layer.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "ea50172ea8df54227740b250a1dd5d1c", "score": "0.5394827", "text": "function vumeter(parent, gui, name) {\n var display = lightsDisplay(parent, 32);\n var graph = scrollingCanvas(parent, 1024, 80).title('Instananeous and averaged total energy, relaxed max/min averaged energy (x3)').xaxisFromFps(60);\n\n\n var settings = {\n vu_size : 32,\n vu_draw_graph : true,\n vu_avg_windowing : 'none',\n vu_avg_window : 5,\n vu_avg_scale : 995,\n vu_br_range : 1.0,\n vu_scale_min : true,\n vu_decay_r : 997,\n vu_sustain_t : 3000,\n vu_bin_exponent : 2,\n\n updateVuSize : function() {\n display.setSize(settings.vu_size);\n }\n };\n\n var avgMax = 0.0; // Total averaged energy max\n var avgMaxLastSet = 0; // Last timestamp when averaged energy max set\n var avgMin = 0.0; // Total averaged energy min\n var avgMinLastSet = 0; // Last timestamp when total averaged energy min was set\n\n var instMax = 0.0; // Total instantaneous energy max\n var instMaxLastSet = 0; // Last timestamp when instantaneous energy max set\n var instMin = 0.0; // Total instantaneous energy min\n var instMinLastSet = 0; // Last instantaneous when total averaged energy min was set\n\n\n\n var energyBuffer = [];\n var energyBufferPos = 0;\n\n\n\n var vuf = gui.addFolder('VU Meter' + (name ? (' - ' + name) : ''));\n vuf.add(settings, 'vu_size').min(1).max(256).step(1).onChange(settings.updateVuSize);\n vuf.add(settings, 'vu_draw_graph').onChange(graph.show);\n vuf.add(settings, 'vu_br_range').min(0).max(1);\n vuf.add(settings, 'vu_avg_windowing', ['none', 'max', 'prod', 'expdecay']);\n vuf.add(settings, 'vu_avg_window').min(1).max(50).step(1);\n vuf.add(settings, 'vu_avg_scale').min(1).max(1000);\n\n vuf.add(settings, 'vu_scale_min');\n vuf.add(settings, 'vu_decay_r').min(900).max(1000);\n vuf.add(settings, 'vu_sustain_t').min(0).max(5000);\n vuf.add(settings, 'vu_bin_exponent', [1, 2]);\n vuf.open();\n\n var ret = {\n changeSamplingParameters(freqBinCount, samplerate) {\n // TODO\n },\n /**\n * Notify new spectrum.\n * @param spectrum - as an uint8\n * @param samplerate - sample rate\n * @param ctims - current time stamp\n * @returns {undefined}\n */\n byteFrequencyData : function(spectrum, samplerate, ctims) {\n\n\n // Calc instantaneous energy\n\n var instantaneousEnergy = 0;\n\n for (var i = 0; i < spectrum.length; i++) {\n var s = spectrum[i] / 255;\n var ss = s;\n for (var j = 1; j < settings.vu_bin_exponent; j++) {\n ss *= s;\n }\n instantaneousEnergy += ss;\n }\n instantaneousEnergy /= spectrum.length;\n\n\n // Windowing\n // Maintenance : window size might have increased\n while (energyBuffer.length < settings.vu_avg_window) {\n energyBuffer.push(instantaneousEnergy);\n }\n // Maintenance : window size might have decreased and buffer might point out\n if (settings.vu_avg_window <= energyBufferPos) {\n energyBufferPos = 0;\n }\n energyBufferPos++;\n\n if (energyBufferPos >= settings.vu_avg_window) {\n energyBufferPos = 0;\n }\n\n energyBuffer[energyBufferPos] = instantaneousEnergy;\n\n var energyAvg = 0;\n\n if (settings.vu_avg_windowing === 'none') {\n energyAvg = instantaneousEnergy;\n } else if (settings.vu_avg_windowing === 'max') {\n for (var i = 0; i < settings.vu_avg_window; i++) {\n //energyAvg = energyBuffer[i] * (i == 0 ? 1 : energyAvg);\n energyAvg = Math.max(energyAvg, energyBuffer[i]);\n }\n } else if (settings.vu_avg_windowing === 'prod') {\n energyAvg = energyBuffer[0];\n for (var i = 1; i < settings.vu_avg_window; i++) {\n energyAvg *= energyBuffer[i];\n }\n } else if (settings.vu_avg_windowing === 'expdecay') {\n var st = 0.0\n var p = energyBufferPos;\n for (var i = 0; i < settings.vu_avg_window; i++) {\n var scale = Math.pow(settings.vu_avg_scale / 1000, i);\n energyAvg += energyBuffer[p] * scale;\n st += scale;\n p--;\n if (p < 0) {\n p = settings.vu_avg_window - 1;\n }\n }\n energyAvg /= st;\n }\n\n if (ctims - avgMaxLastSet > settings.vu_sustain_t) {\n // wait predefined time before scaling down max\n avgMax *= settings.vu_decay_r / 1000;\n }\n if (ctims - avgMinLastSet > settings.vu_sustain_t) {\n // wait predefined time before scaling up min\n avgMin = 1 - ( 1 - avgMin) * settings.vu_decay_r / 1000;\n }\n if (ctims - instMaxLastSet > settings.vu_sustain_t) {\n // wait predefined time before scaling down max\n instMax *= settings.vu_decay_r / 1000;\n }\n if (ctims - instMinLastSet > settings.vu_sustain_t) {\n // wait predefined time before scaling up min\n instMin = 1 - ( 1 - instMin) * settings.vu_decay_r / 1000;\n }\n if ( energyAvg > avgMax ) { avgMax = energyAvg; avgMaxLastSet = ctims; }\n if ( energyAvg < avgMin ) { avgMin = energyAvg; avgMinLastSet = ctims; }\n if ( instantaneousEnergy > instMax ) { instMax = instantaneousEnergy; instMaxLastSet = ctims; }\n if ( instantaneousEnergy < instMin ) { instMin = instantaneousEnergy; instMinLastSet = ctims; }\n\n\n // scaled energy\n var scaledAvgEnergy;\n var scaledInstEnergy;\n if (settings.vu_scale_min) {\n scaledAvgEnergy = avgMax <= avgMin ? 0 : (energyAvg - avgMin)/(avgMax - avgMin);\n scaledInstEnergy = instMax <= instMin ? 0 : (instantaneousEnergy - instMin)/(instMax - instMin);\n } else {\n scaledAvgEnergy = avgMax <= 0 ? 0 : energyAvg /avgMax;\n scaledInstEnergy = instMax <= 0 ? 0 : instantaneousEnergy /instMax;\n }\n\n // display on graph\n if (settings.vu_draw_graph) {\n graph.barAndDot(scaledInstEnergy, scaledAvgEnergy, 3 * avgMax, 3 * avgMin);\n }\n\n // calc and display on lights\n var vudata = [];\n\n var pp = display.size * scaledAvgEnergy;\n for (var i = 0; i < display.size; i++) {\n var v = pp > 1.0 ? 1.0 : pp;\n pp -= v;\n vudata.push(v * (settings.vu_br_range * scaledAvgEnergy + 1 - settings.vu_br_range));\n }\n display.set(vudata);\n\n }\n };\n return ret;\n}", "title": "" }, { "docid": "2aa3bdf4c05402daf216e8834671e56b", "score": "0.53664786", "text": "function fS(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"layer.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "2823c15495cf14b9654511c047c000d5", "score": "0.5355719", "text": "function Qm(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "cf934fef02b1fc254db3ab220aeb13bf", "score": "0.53187263", "text": "function createDV() {\n// gets document.body's child nodes which are direct child html elements\n let keysArray = Object.keys(domNodes[0].children);\n \n// initialize empty arrays to store node objects\n let rootNodes = [];\n let components = [];\n let dvComponents = [];\n \n// iterate through keysArray to push only Vue root nodes into rootNodes array\n function findRoots() {\n for (let i = 0; i < keysArray.length; i += 1) {\n const testNode = domNodes[0].children[keysArray[i]];\n if (!rootNodes.includes(testNode) && testNode.__vue__) rootNodes.push(testNode);\n }\n return rootNodes;\n };\n findRoots();\n// console.log('rootNodes', rootNodes)\n// traverses a domNode to push all vue components into components array\n function findComponents(node) {\n let childrenArray;\n if (rootNodes.includes(node)) {\n// console.log('findcomponentsroot');\n// fix for apps that have a root with vue$3 instead of __vue__\n if (components.includes(rootNodes[0].__vue__)) \n components.unshift(rootNodes[0].__vue__); \n childrenArray = node.__vue__.$children;\n }\n else {\n// console.log('findcomponentschild');\n childrenArray = node.$children;\n }\n childrenArray.forEach((child) => {\n components.push(child);\n if(child.$children.length > 0) findComponents(child)\n });\n };\n for (let i = 0; i < rootNodes.length; i += 1) {\n findComponents(rootNodes[i])\n } \n let count = 0;\n while(components[0].$parent === undefined) {\n components.shift();\n count += 1;\n } \n while(components[0] === components[1]) components.shift();\n// constructor for each component to grab data DejaVue cares about\n function CompConstructor(node) {\n// -> _uid\n this.id = node._uid;\n//assigns name to node - if router-link attempts to get text content as name otherwise uses component tag as name - removes \"vue-component-\" and adds unique ID to end in case components have the same name (fixes parent/child relationships)\n if(node.$options._componentTag !== undefined) {\n if(node.$options._componentTag.includes(\"router-link\")) node.$slots.default[0].text? this.name = node.$slots.default[0].text + ' link -' + node._uid : this.name = 'router-link-' + node._uid;\n else this.name = node.$options._componentTag + '-' + node._uid;\n }\n else if (node.$vnode.tag) {\n let temp = node.$vnode.tag.slice(16);\n while(temp[0] === \"-\" || typeof temp[0] === 'number') {\n temp = temp.slice(1);\n }\n this.name = temp + '-' + node._uid;\n }\n// console.log(this.name)\n// if(node.$options._componentTag === undefined) this.name = \"root\"\n// $parent -> _uid\n this.parentID = node.$parent._uid;\n \n// $parent -> $options -> _componentTag\n //assigns parent name to node - removes \"vue-component-\" and adds unique ID to end in case components have the same name (fixes parent/child relationships)\n if(node.$parent.$vnode === undefined) this.parentName = 'Vuee';\n else if (node.$parent.$options._componentTag !== undefined) this.parentName = node.$parent.$options._componentTag + '-' + node.$parent._uid;\n else {\n let temp = node.$parent.$vnode.tag.slice(16);\n while(temp[0] === \"-\" || typeof temp[0] === 'number') {\n temp = temp.slice(1);\n }\n this.parentName = temp + '-' + node.$parent._uid;\n }\n// to be filled by d3 object mapper\n this.children = [];\n// grab _data object \n this.variables = [];\n this.props = [];\n this.slots = [];\n// this.directives = [];\n }\n// console.log('vue components', components)\n// run each component through the DVconstructor\n function createDvComps(components) {\n for (let i = 0; i < components.length; i += 1) {\n node = components[i];\n dvComponents.push(new CompConstructor(node));\n let varKeys = Object.keys(node.$data).filter((key) => {\n if (key.match(/\\s/g)) return false;\n return true;\n });\n if (varKeys) {\n varKeys.forEach((variable) => {\n if (variable) dvComponents[dvComponents.length - 1].variables.push({ [variable]: node.$data[variable] });\n });\n }\n if(node.$slots.default) \n {\n dvComponents[dvComponents.length - 1].slots.push(node.$slots.default[0].text);\n } \n \n compElem = Object.keys(node);\n for (let j = 0; j < compElem.length; j++) {\n if (compElem[j][0] !== '_' && compElem[j][0] !== '$') {\n dvComponents[dvComponents.length - 1].props.push(compElem[j]);\n }\n }\n }\n return dvComponents;\n };\n createDvComps(components);\n// console.log('deja vue components1', dvComponents)\n \n// conversion of components array to JSON object for D3 visualization \n data = [new treeNode({name: 'Vuee', parent: undefined})]\n function treeNode(node) {\n this.name = node.name;\n this.parent = node.parentName;\n this.props = node.props;\n this.variables = node.variables;\n this.slots = node.slots;\n }\n dvComponents.forEach(function(node) {\n data.push(new treeNode(node))\n })\n \n// console.log('data', data)\n \n return data\n}", "title": "" }, { "docid": "63c39c3914ca83becc7c8a20a08b1b55", "score": "0.52927405", "text": "function Gx(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"layer.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "627bed78283e8ab47c5fb6efe1f40d24", "score": "0.5287288", "text": "function hy(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"geom.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "2dbfdaba43cfe677fd4c3b45788a0803", "score": "0.52838224", "text": "function Viewer() {}", "title": "" }, { "docid": "ba1aa0f2d87abc469b480199eaeed6cf", "score": "0.5281513", "text": "mounted () {\n \n \n \n }", "title": "" }, { "docid": "07274eff88e833a0bcd602775715af31", "score": "0.52780807", "text": "function PI(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"geom.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "06bbb0b3f0cfb86c2a25ae96f72fa2d4", "score": "0.5275594", "text": "function Visitor(q,v){function y(a){function c(a,d,c){c=c?c+=\"|\":c;return c+(a+\"=\"+encodeURIComponent(d))}for(var b=\"\",e=0,f=a.length;e<f;e++){var g=a[e],h=g[0],g=g[1];g!=i&&g!==t&&(b=c(h,g,b))}return function(a){var d=(new Date).getTime(),a=a?a+=\"|\":a;return a+(\"TS=\"+d)}(b)}if(!q)throw\"Visitor requires Adobe Marketing Cloud Org ID\";var a=this;a.version=\"1.10.0\";var m=window,l=m.Visitor;l.version=a.version;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);a._c=\"Visitor\";a._il=m.s_c_il;a._in=m.s_c_in;a._il[a._in]=\r\na;m.s_c_in++;a.ja={Fa:[]};var u=m.document,i=l.Cb;i||(i=null);var E=l.Db;E||(E=void 0);var j=l.Oa;j||(j=!0);var k=l.Ma;k||(k=!1);a.fa=function(a){var c=0,b,e;if(a)for(b=0;b<a.length;b++)e=a.charCodeAt(b),c=(c<<5)-c+e,c&=c;return c};a.s=function(a,c){var b=\"0123456789\",e=\"\",f=\"\",g,h,i=8,k=10,l=10;c===n&&(w.isClientSideMarketingCloudVisitorID=j);if(1==a){b+=\"ABCDEF\";for(g=0;16>g;g++)h=Math.floor(Math.random()*i),e+=b.substring(h,h+1),h=Math.floor(Math.random()*i),f+=b.substring(h,h+1),i=16;return e+\r\n\"-\"+f}for(g=0;19>g;g++)h=Math.floor(Math.random()*k),e+=b.substring(h,h+1),0==g&&9==h?k=3:(1==g||2==g)&&10!=k&&2>h?k=10:2<g&&(k=10),h=Math.floor(Math.random()*l),f+=b.substring(h,h+1),0==g&&9==h?l=3:(1==g||2==g)&&10!=l&&2>h?l=10:2<g&&(l=10);return e+f};a.Ra=function(){var a;!a&&m.location&&(a=m.location.hostname);if(a)if(/^[0-9.]+$/.test(a))a=\"\";else{var c=a.split(\".\"),b=c.length-1,e=b-1;1<b&&2>=c[b].length&&(2==c[b-1].length||0>\",ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,ax,az,ba,bb,be,bf,bg,bh,bi,bj,bm,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,cl,cm,cn,co,cr,cu,cv,cw,cx,cz,de,dj,dk,dm,do,dz,ec,ee,eg,es,et,eu,fi,fm,fo,fr,ga,gb,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,im,in,io,iq,ir,is,it,je,jo,jp,kg,ki,km,kn,kp,kr,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,na,nc,ne,nf,ng,nl,no,nr,nu,nz,om,pa,pe,pf,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,rs,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sx,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,yt,\".indexOf(\",\"+\r\nc[b]+\",\"))&&e--;if(0<e)for(a=\"\";b>=e;)a=c[b]+(a?\".\":\"\")+a,b--}return a};a.cookieRead=function(a){var a=encodeURIComponent(a),c=(\";\"+u.cookie).split(\" \").join(\";\"),b=c.indexOf(\";\"+a+\"=\"),e=0>b?b:c.indexOf(\";\",b+1);return 0>b?\"\":decodeURIComponent(c.substring(b+2+a.length,0>e?c.length:e))};a.cookieWrite=function(d,c,b){var e=a.cookieLifetime,f,c=\"\"+c,e=e?(\"\"+e).toUpperCase():\"\";b&&\"SESSION\"!=e&&\"NONE\"!=e?(f=\"\"!=c?parseInt(e?e:0,10):-60)?(b=new Date,b.setTime(b.getTime()+1E3*f)):1==b&&(b=new Date,f=\r\nb.getYear(),b.setYear(f+2+(1900>f?1900:0))):b=0;return d&&\"NONE\"!=e?(u.cookie=encodeURIComponent(d)+\"=\"+encodeURIComponent(c)+\"; path=/;\"+(b?\" expires=\"+b.toGMTString()+\";\":\"\")+(a.cookieDomain?\" domain=\"+a.cookieDomain+\";\":\"\"),a.cookieRead(d)==c):0};a.h=i;a.J=function(a,c){try{\"function\"==typeof a?a.apply(m,c):a[1].apply(a[0],c)}catch(b){}};a.Xa=function(d,c){c&&(a.h==i&&(a.h={}),a.h[d]==E&&(a.h[d]=[]),a.h[d].push(c))};a.r=function(d,c){if(a.h!=i){var b=a.h[d];if(b)for(;0<b.length;)a.J(b.shift(),\r\nc)}};a.v=function(a,c,b,e){b=encodeURIComponent(c)+\"=\"+encodeURIComponent(b);c=x.vb(a);a=x.mb(a);if(-1===a.indexOf(\"?\"))return a+\"?\"+b+c;var f=a.split(\"?\"),a=f[0]+\"?\",e=x.$a(f[1],b,e);return a+e+c};a.Qa=function(a,c){var b=RegExp(\"[\\\\?&#]\"+c+\"=([^&#]*)\").exec(a);if(b&&b.length)return decodeURIComponent(b[1])};a.Wa=function(){var d=i,c=m.location.href;try{var b=a.Qa(c,r.Z);if(b)for(var d={},e=b.split(\"|\"),c=0,f=e.length;c<f;c++){var g=e[c].split(\"=\");d[g[0]]=decodeURIComponent(g[1])}return d}catch(h){}};\r\na.ba=function(){var d=a.Wa();if(d&&d.TS&&!(((new Date).getTime()-d.TS)/6E4>r.Ka||d[I]!==q)){var c=d[n],b=a.setMarketingCloudVisitorID;c&&c.match(r.u)&&b(c);a.j(s,-1);d=d[p];c=a.setAnalyticsVisitorID;d&&d.match(r.u)&&c(d)}};a.Va=function(d){function c(d){x.pb(d)&&a.setCustomerIDs(d)}function b(d){d=d||{};a._supplementalDataIDCurrent=d.supplementalDataIDCurrent||\"\";a._supplementalDataIDCurrentConsumed=d.supplementalDataIDCurrentConsumed||{};a._supplementalDataIDLast=d.supplementalDataIDLast||\"\";a._supplementalDataIDLastConsumed=\r\nd.supplementalDataIDLastConsumed||{}}d&&d[a.marketingCloudOrgID]&&(d=d[a.marketingCloudOrgID],c(d.customerIDs),b(d.sdid))};a.l=i;a.Ta=function(d,c,b,e){c=a.v(c,\"d_fieldgroup\",d,1);e.url=a.v(e.url,\"d_fieldgroup\",d,1);e.m=a.v(e.m,\"d_fieldgroup\",d,1);w.d[d]=j;e===Object(e)&&e.m&&\"XMLHttpRequest\"===a.la.C.D?a.la.ib(e,b,d):a.useCORSOnly||a.ia(d,c,b)};a.ia=function(d,c,b){var e=0,f=0,g;if(c&&u){for(g=0;!e&&2>g;){try{e=(e=u.getElementsByTagName(0<g?\"HEAD\":\"head\"))&&0<e.length?e[0]:0}catch(h){e=0}g++}if(!e)try{u.body&&\r\n(e=u.body)}catch(k){e=0}if(e)for(g=0;!f&&2>g;){try{f=u.createElement(0<g?\"SCRIPT\":\"script\")}catch(l){f=0}g++}}!c||!e||!f?b&&b():(f.type=\"text/javascript\",f.src=c,e.firstChild?e.insertBefore(f,e.firstChild):e.appendChild(f),e=a.loadTimeout,o.d[d]={requestStart:o.o(),url:c,ta:e,ra:o.ya(),sa:0},b&&(a.l==i&&(a.l={}),a.l[d]=setTimeout(function(){b(j)},e)),a.ja.Fa.push(c))};a.Pa=function(d){a.l!=i&&a.l[d]&&(clearTimeout(a.l[d]),a.l[d]=0)};a.ga=k;a.ha=k;a.isAllowed=function(){if(!a.ga&&(a.ga=j,a.cookieRead(a.cookieName)||\r\na.cookieWrite(a.cookieName,\"T\",1)))a.ha=j;return a.ha};a.b=i;a.c=i;var F=l.Ub;F||(F=\"MC\");var n=l.ac;n||(n=\"MCMID\");var I=l.Yb;I||(I=\"MCORGID\");var H=l.Vb;H||(H=\"MCCIDH\");var L=l.Zb;L||(L=\"MCSYNCS\");var J=l.$b;J||(J=\"MCSYNCSOP\");var K=l.Wb;K||(K=\"MCIDTS\");var B=l.Xb;B||(B=\"MCOPTOUT\");var D=l.Sb;D||(D=\"A\");var p=l.Pb;p||(p=\"MCAID\");var C=l.Tb;C||(C=\"AAM\");var A=l.Rb;A||(A=\"MCAAMLH\");var s=l.Qb;s||(s=\"MCAAMB\");var t=l.bc;t||(t=\"NONE\");a.L=0;a.ea=function(){if(!a.L){var d=a.version;a.audienceManagerServer&&\r\n(d+=\"|\"+a.audienceManagerServer);a.audienceManagerServerSecure&&(d+=\"|\"+a.audienceManagerServerSecure);a.L=a.fa(d)}return a.L};a.ka=k;a.f=function(){if(!a.ka){a.ka=j;var d=a.ea(),c=k,b=a.cookieRead(a.cookieName),e,f,g,h,l=new Date;a.b==i&&(a.b={});if(b&&\"T\"!=b){b=b.split(\"|\");b[0].match(/^[\\-0-9]+$/)&&(parseInt(b[0],10)!=d&&(c=j),b.shift());1==b.length%2&&b.pop();for(d=0;d<b.length;d+=2)if(e=b[d].split(\"-\"),f=e[0],g=b[d+1],1<e.length?(h=parseInt(e[1],10),e=0<e[1].indexOf(\"s\")):(h=0,e=k),c&&(f==H&&\r\n(g=\"\"),0<h&&(h=l.getTime()/1E3-60)),f&&g&&(a.e(f,g,1),0<h&&(a.b[\"expire\"+f]=h+(e?\"s\":\"\"),l.getTime()>=1E3*h||e&&!a.cookieRead(a.sessionCookieName))))a.c||(a.c={}),a.c[f]=j}c=a.loadSSL?!!a.trackingServerSecure:!!a.trackingServer;if(!a.a(p)&&c&&(b=a.cookieRead(\"s_vi\")))b=b.split(\"|\"),1<b.length&&0<=b[0].indexOf(\"v1\")&&(g=b[1],d=g.indexOf(\"[\"),0<=d&&(g=g.substring(0,d)),g&&g.match(r.u)&&a.e(p,g))}};a.Za=function(){var d=a.ea(),c,b;for(c in a.b)!Object.prototype[c]&&a.b[c]&&\"expire\"!=c.substring(0,6)&&\r\n(b=a.b[c],d+=(d?\"|\":\"\")+c+(a.b[\"expire\"+c]?\"-\"+a.b[\"expire\"+c]:\"\")+\"|\"+b);a.cookieWrite(a.cookieName,d,1)};a.a=function(d,c){return a.b!=i&&(c||!a.c||!a.c[d])?a.b[d]:i};a.e=function(d,c,b){a.b==i&&(a.b={});a.b[d]=c;b||a.Za()};a.Sa=function(d,c){var b=a.a(d,c);return b?b.split(\"*\"):i};a.Ya=function(d,c,b){a.e(d,c?c.join(\"*\"):\"\",b)};a.Jb=function(d,c){var b=a.Sa(d,c);if(b){var e={},f;for(f=0;f<b.length;f+=2)e[b[f]]=b[f+1];return e}return i};a.Lb=function(d,c,b){var e=i,f;if(c)for(f in e=[],c)Object.prototype[f]||\r\n(e.push(f),e.push(c[f]));a.Ya(d,e,b)};a.j=function(d,c,b){var e=new Date;e.setTime(e.getTime()+1E3*c);a.b==i&&(a.b={});a.b[\"expire\"+d]=Math.floor(e.getTime()/1E3)+(b?\"s\":\"\");0>c?(a.c||(a.c={}),a.c[d]=j):a.c&&(a.c[d]=k);b&&(a.cookieRead(a.sessionCookieName)||a.cookieWrite(a.sessionCookieName,\"1\"))};a.da=function(a){if(a&&(\"object\"==typeof a&&(a=a.d_mid?a.d_mid:a.visitorID?a.visitorID:a.id?a.id:a.uuid?a.uuid:\"\"+a),a&&(a=a.toUpperCase(),\"NOTARGET\"==a&&(a=t)),!a||a!=t&&!a.match(r.u)))a=\"\";return a};a.k=\r\nfunction(d,c){a.Pa(d);a.i!=i&&(a.i[d]=k);o.d[d]&&(o.d[d].Ab=o.o(),o.I(d));w.d[d]&&w.Ha(d,k);if(d==F){w.isClientSideMarketingCloudVisitorID!==j&&(w.isClientSideMarketingCloudVisitorID=k);var b=a.a(n);if(!b||a.overwriteCrossDomainMCIDAndAID){b=\"object\"==typeof c&&c.mid?c.mid:a.da(c);if(!b){if(a.B){a.getAnalyticsVisitorID(i,k,j);return}b=a.s(0,n)}a.e(n,b)}if(!b||b==t)b=\"\";\"object\"==typeof c&&((c.d_region||c.dcs_region||c.d_blob||c.blob)&&a.k(C,c),a.B&&c.mid&&a.k(D,{id:c.id}));a.r(n,[b])}if(d==C&&\"object\"==\r\ntypeof c){b=604800;c.id_sync_ttl!=E&&c.id_sync_ttl&&(b=parseInt(c.id_sync_ttl,10));var e=a.a(A);e||((e=c.d_region)||(e=c.dcs_region),e&&(a.j(A,b),a.e(A,e)));e||(e=\"\");a.r(A,[e]);e=a.a(s);if(c.d_blob||c.blob)(e=c.d_blob)||(e=c.blob),a.j(s,b),a.e(s,e);e||(e=\"\");a.r(s,[e]);!c.error_msg&&a.A&&a.e(H,a.A)}if(d==D){b=a.a(p);if(!b||a.overwriteCrossDomainMCIDAndAID)(b=a.da(c))?b!==t&&a.j(s,-1):b=t,a.e(p,b);if(!b||b==t)b=\"\";a.r(p,[b])}a.idSyncDisableSyncs?z.za=j:(z.za=k,b={},b.ibs=c.ibs,b.subdomain=c.subdomain,\r\nz.wb(b));if(c===Object(c)){var f;a.isAllowed()&&(f=a.a(B));f||(f=t,c.d_optout&&c.d_optout instanceof Array&&(f=c.d_optout.join(\",\")),b=parseInt(c.d_ottl,10),isNaN(b)&&(b=7200),a.j(B,b,j),a.e(B,f));a.r(B,[f])}};a.i=i;a.t=function(d,c,b,e,f){var g=\"\",h,k=x.ob(d);if(a.isAllowed()&&(a.f(),g=a.a(d,M[d]===j),a.disableThirdPartyCalls&&!g&&(d===n?(g=a.s(0,n),a.setMarketingCloudVisitorID(g)):d===p&&!k&&(g=\"\",a.setAnalyticsVisitorID(g))),(!g||a.c&&a.c[d])&&(!a.disableThirdPartyCalls||k)))if(d==n||d==B?h=F:\r\nd==A||d==s?h=C:d==p&&(h=D),h){if(c&&(a.i==i||!a.i[h]))a.i==i&&(a.i={}),a.i[h]=j,a.Ta(h,c,function(c,b){if(!a.a(d))if(o.d[h]&&(o.d[h].timeout=o.o(),o.d[h].nb=!!c,o.I(h)),b===Object(b)&&!a.useCORSOnly)a.ia(h,b.url,b.G);else{c&&w.Ha(h,j);var e=\"\";d==n?e=a.s(0,n):h==C&&(e={error_msg:\"timeout\"});a.k(h,e)}},f);if(g)return g;a.Xa(d,b);c||a.k(h,{id:t});return\"\"}if((d==n||d==p)&&g==t)g=\"\",e=j;b&&(e||a.disableThirdPartyCalls)&&a.J(b,[g]);return g};a._setMarketingCloudFields=function(d){a.f();a.k(F,d)};a.setMarketingCloudVisitorID=\r\nfunction(d){a._setMarketingCloudFields(d)};a.B=k;a.getMarketingCloudVisitorID=function(d,c){if(a.isAllowed()){a.marketingCloudServer&&0>a.marketingCloudServer.indexOf(\".demdex.net\")&&(a.B=j);var b=a.z(\"_setMarketingCloudFields\");return a.t(n,b.url,d,c,b)}return\"\"};a.Ua=function(){a.getAudienceManagerBlob()};l.AuthState={UNKNOWN:0,AUTHENTICATED:1,LOGGED_OUT:2};a.w={};a.ca=k;a.A=\"\";a.setCustomerIDs=function(d){if(a.isAllowed()&&d){a.f();var c,b;for(c in d)if(!Object.prototype[c]&&(b=d[c]))if(\"object\"==\r\ntypeof b){var e={};b.id&&(e.id=b.id);b.authState!=E&&(e.authState=b.authState);a.w[c]=e}else a.w[c]={id:b};var d=a.getCustomerIDs(),e=a.a(H),f=\"\";e||(e=0);for(c in d)Object.prototype[c]||(b=d[c],f+=(f?\"|\":\"\")+c+\"|\"+(b.id?b.id:\"\")+(b.authState?b.authState:\"\"));a.A=a.fa(f);a.A!=e&&(a.ca=j,a.Ua())}};a.getCustomerIDs=function(){a.f();var d={},c,b;for(c in a.w)Object.prototype[c]||(b=a.w[c],d[c]||(d[c]={}),b.id&&(d[c].id=b.id),d[c].authState=b.authState!=E?b.authState:l.AuthState.UNKNOWN);return d};a._setAnalyticsFields=\r\nfunction(d){a.f();a.k(D,d)};a.setAnalyticsVisitorID=function(d){a._setAnalyticsFields(d)};a.getAnalyticsVisitorID=function(d,c,b){if(a.isAllowed()){var e=\"\";b||(e=a.getMarketingCloudVisitorID(function(){a.getAnalyticsVisitorID(d,j)}));if(e||b){var f=b?a.marketingCloudServer:a.trackingServer,g=\"\";a.loadSSL&&(b?a.marketingCloudServerSecure&&(f=a.marketingCloudServerSecure):a.trackingServerSecure&&(f=a.trackingServerSecure));var h={};if(f){var f=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+f+\"/id\",e=\"d_visid_ver=\"+\r\na.version+\"&mcorgid=\"+encodeURIComponent(a.marketingCloudOrgID)+(e?\"&mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\"),i=[\"s_c_il\",a._in,\"_set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\"],g=f+\"?\"+e+\"&callback=s_c_il%5B\"+a._in+\"%5D._set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\";h.m=f+\"?\"+e;h.oa=i}h.url=g;return a.t(b?n:p,g,d,c,h)}}return\"\"};a._setAudienceManagerFields=function(d){a.f();a.k(C,d)};a.z=function(d){var c=a.audienceManagerServer,b=\"\",e=a.a(n),f=a.a(s,j),\r\ng=a.a(p),g=g&&g!=t?\"&d_cid_ic=AVID%01\"+encodeURIComponent(g):\"\";a.loadSSL&&a.audienceManagerServerSecure&&(c=a.audienceManagerServerSecure);if(c){var b=a.getCustomerIDs(),h,i;if(b)for(h in b)Object.prototype[h]||(i=b[h],g+=\"&d_cid_ic=\"+encodeURIComponent(h)+\"%01\"+encodeURIComponent(i.id?i.id:\"\")+(i.authState?\"%01\"+i.authState:\"\"));d||(d=\"_setAudienceManagerFields\");c=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+c+\"/id\";e=\"d_visid_ver=\"+a.version+\"&d_rtbd=json&d_ver=2\"+(!e&&a.B?\"&d_verify=1\":\"\")+\"&d_orgid=\"+encodeURIComponent(a.marketingCloudOrgID)+\r\n\"&d_nsid=\"+(a.idSyncContainerID||0)+(e?\"&d_mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\")+(f?\"&d_blob=\"+encodeURIComponent(f):\"\")+g;f=[\"s_c_il\",a._in,d];b=c+\"?\"+e+\"&d_cb=s_c_il%5B\"+a._in+\"%5D.\"+d;return{url:b,m:c+\"?\"+e,oa:f}}return{url:b}};a.getAudienceManagerLocationHint=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerLocationHint(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerLocationHint(d,\r\nj)}));if(b)return b=a.z(),a.t(A,b.url,d,c,b)}return\"\"};a.getLocationHint=a.getAudienceManagerLocationHint;a.getAudienceManagerBlob=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerBlob(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerBlob(d,j)}));if(b){var b=a.z(),e=b.url;a.ca&&a.j(s,-1);return a.t(s,e,d,c,b)}}return\"\"};a._supplementalDataIDCurrent=\"\";a._supplementalDataIDCurrentConsumed={};a._supplementalDataIDLast=\"\";a._supplementalDataIDLastConsumed=\r\n{};a.getSupplementalDataID=function(d,c){!a._supplementalDataIDCurrent&&!c&&(a._supplementalDataIDCurrent=a.s(1));var b=a._supplementalDataIDCurrent;a._supplementalDataIDLast&&!a._supplementalDataIDLastConsumed[d]?(b=a._supplementalDataIDLast,a._supplementalDataIDLastConsumed[d]=j):b&&(a._supplementalDataIDCurrentConsumed[d]&&(a._supplementalDataIDLast=a._supplementalDataIDCurrent,a._supplementalDataIDLastConsumed=a._supplementalDataIDCurrentConsumed,a._supplementalDataIDCurrent=b=!c?a.s(1):\"\",a._supplementalDataIDCurrentConsumed=\r\n{}),b&&(a._supplementalDataIDCurrentConsumed[d]=j));return b};l.OptOut={GLOBAL:\"global\"};a.getOptOut=function(d,c){if(a.isAllowed()){var b=a.z(\"_setMarketingCloudFields\");return a.t(B,b.url,d,c,b)}return\"\"};a.isOptedOut=function(d,c,b){return a.isAllowed()?(c||(c=l.OptOut.GLOBAL),(b=a.getOptOut(function(b){a.J(d,[b==l.OptOut.GLOBAL||0<=b.indexOf(c)])},b))?b==l.OptOut.GLOBAL||0<=b.indexOf(c):i):k};a.appendVisitorIDsTo=function(d){var c=r.Z,b=y([[n,a.a(n)],[p,a.a(p)],[I,a.marketingCloudOrgID]]);try{return a.v(d,\r\nc,b)}catch(e){return d}};var r={q:!!m.postMessage,La:1,aa:864E5,Z:\"adobe_mc\",u:/^[0-9a-fA-F\\-]+$/,Ka:5};a.Eb=r;a.na={postMessage:function(a,c,b){var e=1;c&&(r.q?b.postMessage(a,c.replace(/([^:]+:\\/\\/[^\\/]+).*/,\"$1\")):c&&(b.location=c.replace(/#.*$/,\"\")+\"#\"+ +new Date+e++ +\"&\"+a))},U:function(a,c){var b;try{if(r.q)if(a&&(b=function(b){if(\"string\"===typeof c&&b.origin!==c||\"[object Function]\"===Object.prototype.toString.call(c)&&!1===c(b.origin))return!1;a(b)}),window.addEventListener)window[a?\"addEventListener\":\r\n\"removeEventListener\"](\"message\",b,!1);else window[a?\"attachEvent\":\"detachEvent\"](\"onmessage\",b)}catch(e){}}};var x={M:function(){if(u.addEventListener)return function(a,c,b){a.addEventListener(c,function(a){\"function\"===typeof b&&b(a)},k)};if(u.attachEvent)return function(a,c,b){a.attachEvent(\"on\"+c,function(a){\"function\"===typeof b&&b(a)})}}(),map:function(a,c){if(Array.prototype.map)return a.map(c);if(void 0===a||a===i)throw new TypeError;var b=Object(a),e=b.length>>>0;if(\"function\"!==typeof c)throw new TypeError;\r\nfor(var f=Array(e),g=0;g<e;g++)g in b&&(f[g]=c.call(c,b[g],g,b));return f},va:function(a,c){return this.map(a,function(a){return encodeURIComponent(a)}).join(c)},vb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(c):\"\"},mb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(0,c):a},$a:function(a,c,b){a=a.split(\"&\");b=b!=i?b:a.length;a.splice(b,0,c);return a.join(\"&\")},ob:function(d,c,b){if(d!==p)return k;c||(c=a.trackingServer);b||(b=a.trackingServerSecure);d=a.loadSSL?b:c;return\"string\"===\r\ntypeof d&&d.length?0>d.indexOf(\"2o7.net\")&&0>d.indexOf(\"omtrdc.net\"):k},pb:function(a){return Boolean(a&&a===Object(a))}};a.Kb=x;var N={C:function(){var a=\"none\",c=j;\"undefined\"!==typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&(\"withCredentials\"in new XMLHttpRequest?a=\"XMLHttpRequest\":(new Function(\"/*@cc_on return /^10/.test(@_jscript_version) @*/\"))()?a=\"XMLHttpRequest\":\"undefined\"!==typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(c=k),0<Object.prototype.toString.call(window.Bb).indexOf(\"Constructor\")&&\r\n(c=k));return{D:a,Nb:c}}(),jb:function(){return\"none\"===this.C.D?i:new window[this.C.D]},ib:function(d,c,b){var e=this;c&&(d.G=c);try{var f=this.jb();f.open(\"get\",d.m+\"&ts=\"+(new Date).getTime(),j);\"XMLHttpRequest\"===this.C.D&&(f.withCredentials=j,f.timeout=a.loadTimeout,f.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),f.onreadystatechange=function(){if(4===this.readyState&&200===this.status)a:{var a;try{if(a=JSON.parse(this.responseText),a!==Object(a)){e.n(d,i,\"Response is not JSON\");\r\nbreak a}}catch(c){e.n(d,c,\"Error parsing response as JSON\");break a}try{for(var b=d.oa,f=window,g=0;g<b.length;g++)f=f[b[g]];f(a)}catch(j){e.n(d,j,\"Error forming callback function\")}}});f.onerror=function(a){e.n(d,a,\"onerror\")};f.ontimeout=function(a){e.n(d,a,\"ontimeout\")};f.send();o.d[b]={requestStart:o.o(),url:d.m,ta:f.timeout,ra:o.ya(),sa:1};a.ja.Fa.push(d.m)}catch(g){this.n(d,g,\"try-catch\")}},n:function(d,c,b){a.CORSErrors.push({Ob:d,error:c,description:b});d.G&&(\"ontimeout\"===b?d.G(j):d.G(k,\r\nd))}};a.la=N;var z={Na:3E4,$:649,Ja:k,id:i,T:[],Q:i,xa:function(a){if(\"string\"===typeof a)return a=a.split(\"/\"),a[0]+\"//\"+a[2]},g:i,url:i,kb:function(){var d=\"http://fast.\",c=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);this.g||(this.g=\"nosubdomainreturned\");a.loadSSL&&(d=a.idSyncSSLUseAkamai?\"https://fast.\":\"https://\");d=d+this.g+\".demdex.net/dest5.html\"+c;this.Q=this.xa(d);this.id=\"destination_publishing_iframe_\"+this.g+\"_\"+a.idSyncContainerID;return d},cb:function(){var d=\r\n\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);\"string\"===typeof a.K&&a.K.length&&(this.id=\"destination_publishing_iframe_\"+(new Date).getTime()+\"_\"+a.idSyncContainerID,this.Q=this.xa(a.K),this.url=a.K+d)},za:i,ua:k,W:k,F:i,cc:i,ub:i,dc:i,V:k,H:[],sb:[],tb:[],Ba:r.q?15:100,R:[],qb:[],pa:j,Ea:k,Da:function(){return!a.idSyncDisable3rdPartySyncing&&(this.ua||a.Gb)&&this.g&&\"nosubdomainreturned\"!==this.g&&this.url&&!this.W},O:function(){function a(){e=document.createElement(\"iframe\");\r\ne.sandbox=\"allow-scripts allow-same-origin\";e.title=\"Adobe ID Syncing iFrame\";e.id=b.id;e.style.cssText=\"display: none; width: 0; height: 0;\";e.src=b.url;b.ub=j;c();document.body.appendChild(e)}function c(){x.M(e,\"load\",function(){e.className=\"aamIframeLoaded\";b.F=j;b.p()})}this.W=j;var b=this,e=document.getElementById(this.id);e?\"IFRAME\"!==e.nodeName?(this.id+=\"_2\",a()):\"aamIframeLoaded\"!==e.className?c():(this.F=j,this.Aa=e,this.p()):a();this.Aa=e},p:function(d){var c=this;d===Object(d)&&(this.R.push(d),\r\nthis.xb(d));if((this.Ea||!r.q||this.F)&&this.R.length)this.I(this.R.shift()),this.p();!a.idSyncDisableSyncs&&this.F&&this.H.length&&!this.V&&(this.Ja||(this.Ja=j,setTimeout(function(){c.Ba=r.q?15:150},this.Na)),this.V=j,this.Ga())},xb:function(a){var c,b,e;if((c=a.ibs)&&c instanceof Array&&(b=c.length))for(a=0;a<b;a++)e=c[a],e.syncOnPage&&this.qa(e,\"\",\"syncOnPage\")},I:function(a){var c=encodeURIComponent,b,e,f,g,h;if((b=a.ibs)&&b instanceof Array&&(e=b.length))for(f=0;f<e;f++)g=b[f],h=[c(\"ibs\"),c(g.id||\r\n\"\"),c(g.tag||\"\"),x.va(g.url||[],\",\"),c(g.ttl||\"\"),\"\",\"\",g.fireURLSync?\"true\":\"false\"],g.syncOnPage||(this.pa?this.N(h.join(\"|\")):g.fireURLSync&&this.qa(g,h.join(\"|\")));this.qb.push(a)},qa:function(d,c,b){var e=(b=\"syncOnPage\"===b?j:k)?J:L;a.f();var f=a.a(e),g=k,h=k,i=Math.ceil((new Date).getTime()/r.aa);f?(f=f.split(\"*\"),h=this.yb(f,d.id,i),g=h.gb,h=h.hb,(!g||!h)&&this.wa(b,d,c,f,e,i)):(f=[],this.wa(b,d,c,f,e,i))},yb:function(a,c,b){var e=k,f=k,g,h,i;for(h=0;h<a.length;h++)g=a[h],i=parseInt(g.split(\"-\")[1],\r\n10),g.match(\"^\"+c+\"-\")?(e=j,b<i?f=j:(a.splice(h,1),h--)):b>=i&&(a.splice(h,1),h--);return{gb:e,hb:f}},rb:function(a){if(a.join(\"*\").length>this.$)for(a.sort(function(a,b){return parseInt(a.split(\"-\")[1],10)-parseInt(b.split(\"-\")[1],10)});a.join(\"*\").length>this.$;)a.shift()},wa:function(d,c,b,e,f,g){var h=this;if(d){if(\"img\"===c.tag){var d=c.url,b=a.loadSSL?\"https:\":\"http:\",j,k,l;for(e=0,j=d.length;e<j;e++){k=d[e];l=/^\\/\\//.test(k);var m=new Image;x.M(m,\"load\",function(b,c,d,e){return function(){h.T[b]=\r\ni;a.f();var g=a.a(f),j=[];if(g){var g=g.split(\"*\"),k,l,m;for(k=0,l=g.length;k<l;k++)m=g[k],m.match(\"^\"+c.id+\"-\")||j.push(m)}h.Ia(j,c,d,e)}}(this.T.length,c,f,g));m.src=(l?b:\"\")+k;this.T.push(m)}}}else this.N(b),this.Ia(e,c,f,g)},N:function(d){var c=encodeURIComponent;this.H.push((a.Hb?c(\"---destpub-debug---\"):c(\"---destpub---\"))+d)},Ia:function(d,c,b,e){d.push(c.id+\"-\"+(e+Math.ceil(c.ttl/60/24)));this.rb(d);a.e(b,d.join(\"*\"))},Ga:function(){var d=this,c;this.H.length?(c=this.H.shift(),a.na.postMessage(c,\r\nthis.url,this.Aa.contentWindow),this.sb.push(c),setTimeout(function(){d.Ga()},this.Ba)):this.V=k},U:function(a){var c=/^---destpub-to-parent---/;\"string\"===typeof a&&c.test(a)&&(c=a.replace(c,\"\").split(\"|\"),\"canSetThirdPartyCookies\"===c[0]&&(this.pa=\"true\"===c[1]?j:k,this.Ea=j,this.p()),this.tb.push(a))},wb:function(d){if(this.url===i||d.subdomain&&\"nosubdomainreturned\"===this.g)this.g=\"string\"===typeof a.ma&&a.ma.length?a.ma:d.subdomain||\"\",this.url=this.kb();d.ibs instanceof Array&&d.ibs.length&&\r\n(this.ua=j);this.Da()&&(a.idSyncAttachIframeOnWindowLoad?(l.Y||\"complete\"===u.readyState||\"loaded\"===u.readyState)&&this.O():this.ab());\"function\"===typeof a.idSyncIDCallResult?a.idSyncIDCallResult(d):this.p(d);\"function\"===typeof a.idSyncAfterIDCallResult&&a.idSyncAfterIDCallResult(d)},bb:function(d,c){return a.Ib||!d||c-d>r.La},ab:function(){function a(){c.W||(document.body?c.O():setTimeout(a,30))}var c=this;a()}};a.Fb=z;a.timeoutMetricsLog=[];var o={fb:window.performance&&window.performance.timing?\r\n1:0,Ca:window.performance&&window.performance.timing?window.performance.timing:i,X:i,P:i,d:{},S:[],send:function(d){if(a.takeTimeoutMetrics&&d===Object(d)){var c=[],b=encodeURIComponent,e;for(e in d)d.hasOwnProperty(e)&&c.push(b(e)+\"=\"+b(d[e]));d=\"http\"+(a.loadSSL?\"s\":\"\")+\"://dpm.demdex.net/event?d_visid_ver=\"+a.version+\"&d_visid_stg_timeout=\"+a.loadTimeout+\"&\"+c.join(\"&\")+\"&d_orgid=\"+b(a.marketingCloudOrgID)+\"&d_timingapi=\"+this.fb+\"&d_winload=\"+this.lb()+\"&d_ld=\"+this.o();(new Image).src=d;a.timeoutMetricsLog.push(d)}},\r\nlb:function(){this.P===i&&(this.P=this.Ca?this.X-this.Ca.navigationStart:this.X-l.eb);return this.P},o:function(){return(new Date).getTime()},I:function(a){var c=this.d[a],b={};b.d_visid_stg_timeout_captured=c.ta;b.d_visid_cors=c.sa;b.d_fieldgroup=a;b.d_settimeout_overriden=c.ra;c.timeout?c.nb?(b.d_visid_timedout=1,b.d_visid_timeout=c.timeout-c.requestStart,b.d_visid_response=-1):(b.d_visid_timedout=\"n/a\",b.d_visid_timeout=\"n/a\",b.d_visid_response=\"n/a\"):(b.d_visid_timedout=0,b.d_visid_timeout=-1,\r\nb.d_visid_response=c.Ab-c.requestStart);b.d_visid_url=c.url;l.Y?this.send(b):this.S.push(b);delete this.d[a]},zb:function(){for(var a=0,c=this.S.length;a<c;a++)this.send(this.S[a])},ya:function(){return\"function\"===typeof setTimeout.toString?-1<setTimeout.toString().indexOf(\"[native code]\")?0:1:-1}};a.Mb=o;var w={isClientSideMarketingCloudVisitorID:i,MCIDCallTimedOut:i,AnalyticsIDCallTimedOut:i,AAMIDCallTimedOut:i,d:{},Ha:function(a,c){switch(a){case F:c===k?this.MCIDCallTimedOut!==j&&(this.MCIDCallTimedOut=\r\nk):this.MCIDCallTimedOut=c;break;case D:c===k?this.AnalyticsIDCallTimedOut!==j&&(this.AnalyticsIDCallTimedOut=k):this.AnalyticsIDCallTimedOut=c;break;case C:c===k?this.AAMIDCallTimedOut!==j&&(this.AAMIDCallTimedOut=k):this.AAMIDCallTimedOut=c}}};a.isClientSideMarketingCloudVisitorID=function(){return w.isClientSideMarketingCloudVisitorID};a.MCIDCallTimedOut=function(){return w.MCIDCallTimedOut};a.AnalyticsIDCallTimedOut=function(){return w.AnalyticsIDCallTimedOut};a.AAMIDCallTimedOut=function(){return w.AAMIDCallTimedOut};\r\na.idSyncGetOnPageSyncInfo=function(){a.f();return a.a(J)};a.idSyncByURL=function(d){var c,b=d||{};c=b.minutesToLive;var e=\"\";a.idSyncDisableSyncs&&(e=e?e:\"Error: id syncs have been disabled\");if(\"string\"!==typeof b.dpid||!b.dpid.length)e=e?e:\"Error: config.dpid is empty\";if(\"string\"!==typeof b.url||!b.url.length)e=e?e:\"Error: config.url is empty\";if(\"undefined\"===typeof c)c=20160;else if(c=parseInt(c,10),isNaN(c)||0>=c)e=e?e:\"Error: config.minutesToLive needs to be a positive number\";c={error:e,ec:c};\r\nif(c.error)return c.error;var e=d.url,f=encodeURIComponent,b=z,g,e=e.replace(/^https:/,\"\").replace(/^http:/,\"\");g=x.va([\"\",d.dpid,d.dpuuid||\"\"],\",\");d=[\"ibs\",f(d.dpid),\"img\",f(e),c.ttl,\"\",g];b.N(d.join(\"|\"));b.p();return\"Successfully queued\"};a.idSyncByDataSource=function(d){if(d!==Object(d)||\"string\"!==typeof d.dpuuid||!d.dpuuid.length)return\"Error: config or config.dpuuid is empty\";d.url=\"//dpm.demdex.net/ibs:dpid=\"+d.dpid+\"&dpuuid=\"+d.dpuuid;return a.idSyncByURL(d)};0>q.indexOf(\"@\")&&(q+=\"@AdobeOrg\");\r\na.marketingCloudOrgID=q;a.cookieName=\"AMCV_\"+q;a.sessionCookieName=\"AMCVS_\"+q;a.cookieDomain=a.Ra();a.cookieDomain==m.location.hostname&&(a.cookieDomain=\"\");a.loadSSL=0<=m.location.protocol.toLowerCase().indexOf(\"https\");a.loadTimeout=3E4;a.CORSErrors=[];a.marketingCloudServer=a.audienceManagerServer=\"dpm.demdex.net\";var M={};M[A]=j;M[s]=j;if(v&&\"object\"==typeof v){for(var G in v)!Object.prototype[G]&&(a[G]=v[G]);a.idSyncContainerID=a.idSyncContainerID||0;a.ba();a.f();N=a.a(K);G=Math.ceil((new Date).getTime()/\r\nr.aa);!a.idSyncDisableSyncs&&z.bb(N,G)&&(a.j(s,-1),a.e(K,G));a.getMarketingCloudVisitorID();a.getAudienceManagerLocationHint();a.getAudienceManagerBlob();a.Va(a.serverState)}else a.ba();if(!a.idSyncDisableSyncs){z.cb();x.M(window,\"load\",function(){l.Y=j;o.X=o.o();o.zb();var a=z;a.Da()&&a.O()});try{a.na.U(function(a){z.U(a.data)},z.Q)}catch(O){}}}", "title": "" }, { "docid": "0ef2dd0c222d4b8804827c1c2ccb4317", "score": "0.5242782", "text": "function VNode() {}", "title": "" }, { "docid": "f22529cdf641232dbca44a9f332d8fdd", "score": "0.5215952", "text": "function VDvehicle(){}", "title": "" }, { "docid": "97c34560d1627e62f63a99c800209cfd", "score": "0.52075565", "text": "function Qz(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"style.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "a59cffb80b0709ad7bfd1ec8a73a3970", "score": "0.520002", "text": "function CubeV_Help(){\n\t\t\t\t\tconsole.log(\"For CubeV(), You can find volume of a cube! Ex: Cube(5) output is 125.\")\n\n\t\t\t\t}", "title": "" }, { "docid": "bf7fdd1311c429d72f34915163c3fd9d", "score": "0.51906836", "text": "function VideoChatUtil(){}", "title": "" }, { "docid": "61d727bf96fc6e1dcffb58d82e26d53e", "score": "0.51886487", "text": "function ZP(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"layer.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "7a8b0e75fecd41ee42f7f4862a08da1a", "score": "0.51813334", "text": "function TriPriV_Help(){\n\t\t\t\t\tconsole.log(\"TriPriV() can help you find the Volume if a Triangler prisim, for example, TriPri(2,3,4) will get out put 12.\")\n\t\t\t\t}", "title": "" }, { "docid": "52779efb569d477f52fcec7e0317ac4b", "score": "0.5180615", "text": "function zP(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"style.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "68696b86cf4922381678ad336febc65a", "score": "0.51738", "text": "init() { \n \n }", "title": "" }, { "docid": "0bdc06d56d18dfac84f9ae7026ce8a82", "score": "0.513511", "text": "install(Vue, options) {\n Vue.VERSION = 'v0.0.1';\n\n let userOptions = {...defaultOptions, ...options};\n // console.log(userOptions)\n\n // create a mixin\n Vue.mixin({\n // created() {\n // console.log(Vue.VERSION);\n // },\n methods: {\n async $updateGroupe(url){\n let g = {url: url}\n const dataset = await getSolidDataset(url);\n g.things = getThingAll(dataset, url);\n g.thing = g.things[0]\n g.name = getStringNoLocale(g.thing, VCARD.fn);\n g.types = getUrl(g.thing, RDF.type);\n g.purpose = getStringNoLocale(g.thing, 'http://www.w3.org/ns/org#purpose');\n g.subgroups = getUrlAll(g.thing, 'http://www.w3.org/ns/org#hasSubOrganization');\n g.members = getUrlAll(g.thing, VCARD.hasMember);\n g.inbox = getUrl(g.thing, 'http://www.w3.org/ns/ldp#inbox');\n g.parent = getUrl(g.thing, 'http://www.w3.org/ns/org#subOrganizationOf');\n g.created = getStringNoLocale(g.thing, DCTERMS.created);\n g.maker = getUrl(g.thing, FOAF.maker);\n return g\n },\n }\n\n\n\n });\n Vue.prototype.$italicHTML = function (text) {\n return '<i>' + text + '</i>';\n }\n Vue.prototype.$boldHTML = function (text) {\n return '<b>' + text + '</b>';\n }\n\n // define a global filter\n Vue.filter('preview', (value) => {\n if (!value) {\n return '';\n }\n return value.substring(0, userOptions.cutoff) + '...';\n })\n\n // add a custom directive\n Vue.directive('focus', {\n // When the bound element is inserted into the DOM...\n inserted: function (el) {\n // Focus the element\n el.focus();\n }\n })\n\n }", "title": "" }, { "docid": "764b76a1db026b65df3f44bcc52c317d", "score": "0.5133573", "text": "function yw(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"style.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "ee235c237a7387ebc764a34992fc45f5", "score": "0.51285315", "text": "function vV(a,b){this.af=[];this.Iea=a;this.Sda=b||null;this.qL=this.xE=!1;this.ht=void 0;this.f4=this.sra=this.x3=!1;this.nU=0;this.Xd=null;this.t3=0}", "title": "" }, { "docid": "4b10975751a94f79c9ef3ec271894577", "score": "0.5127132", "text": "function m_(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"layer.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "83dc43f678dabf45a4be86ef03be1a0b", "score": "0.5127046", "text": "function P_(t,e,n,i,r,o,a,s){var c=(\"function\"===typeof n?n.options:n)||{};return c.__file=\"layer.vue\",c.render||(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),c._scopeId=i,c}", "title": "" }, { "docid": "0186459e4ce622a72f71947a8077227c", "score": "0.511737", "text": "init() {\n\n\t}", "title": "" }, { "docid": "8a38f0ec07805cfd42406081dd449a87", "score": "0.51122916", "text": "function Yj(t,e,n,i,r,a,o,c){var s=(\"function\"===typeof n?n.options:n)||{};return s.__file=\"style.vue\",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "78dc4d7acfbc7b81b7ca903afba98639", "score": "0.51116085", "text": "constructor() {\n \n\n \n \n\n \n\n \n }", "title": "" }, { "docid": "4ca15b8dd6a0b744fbe754dff6b6bd56", "score": "0.5093985", "text": "trengerRep() {\n s_status.TrengerReparasjon(this.v_id);\n this.mounted();\n this.skjulInfoPop();\n }", "title": "" }, { "docid": "9aff5b306da4ae8d8a61f3f6904252c8", "score": "0.5090201", "text": "function v(){}", "title": "" } ]
57bbc1dcbcf5f9ab2d8dcc8d58e87dc5
Hack an instance of Argv with process.argv into Argv so people can do require('yargs')(['beeble=1','z','zizzle']).argv to parse a list of args and require('yargs').argv to get a parsed version of process.argv.
[ { "docid": "d5353397e54f6a18dc14378a7b855c1b", "score": "0.5410194", "text": "function singletonify (inst) {\n Object.keys(inst).forEach(function (key) {\n if (key === 'argv') {\n Argv.__defineGetter__(key, inst.__lookupGetter__(key))\n } else {\n Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]\n }\n })\n}", "title": "" } ]
[ { "docid": "f9859e43aa8d49d0abe818213704f297", "score": "0.7176042", "text": "_initArgv() {\n // Initialize yargs\n this.argv = yargs\n .usage('$0 [options]', this.description)\n .help('h')\n .alias('h', 'help')\n .version(false)\n .wrap(null)\n .strict(true);\n // Add this ManagementApi script options\n Object.keys(this.options).forEach(optionKey => {\n this.argv = this.argv.option(optionKey, this.options[optionKey])\n });\n // Process to the check\n this.argv = this.argv.argv;\n }", "title": "" }, { "docid": "385f3d633738c9a3a5a5a0475aef0668", "score": "0.6796528", "text": "normaliseArgv( argv ){\n\n forEach( argv, (arg, i) => {\n // Ignore any non options\n if ( arg[0] !== '-' ) return\n\n // Detect some mishaps\n\n // `-` can possibly be stdin!?\n if ( !arg[1] ) return\n //if ( !arg[1] ) this.processError('No argument on', arg, argv)\n\n // `--` can be end of args\n if ( arg[1] === '-' && !arg[2] ) return\n //if ( arg[1] === '-' && !arg[2] ) this.processError('No argument on', arg, argv) args\n\n // `---` nope - but do we really need to error? in case someone wants to use `---`\n if ( arg[1] === '-' && arg[2] === '-' ) this.processError('Invalid argument', arg, argv)\n\n // We don't need to normalize already single args `-x`\n if ( arg[1] !== '-' && arg.length === 2 ) return\n\n // or long args that are left over `--whatever`\n if ( arg[1] === '-' ) return\n\n // Seperate multiple args out\n debug('normalise found a short arg with multiple opts', arg)\n argv.splice(i, 1)\n let arg_length = arg.length\n forEach( arg.slice(1), (letter, j) => {\n if ( j+2 < arg_length ) {\n let arg_conf = this.lookupShort(letter)\n if ( arg_conf && !arg_conf.isFlag() )\n this.processError('Combined arguments can only be flags.', letter, arg)\n }\n argv.splice(j, 0, `-${letter}`)\n })\n debug('normalise set argv', argv)\n //debug('plain arg', arg)\n })\n\n this.argv = argv\n }", "title": "" }, { "docid": "c18921c0a38da1884504329f3c8f2ac1", "score": "0.6684704", "text": "function processArgv(argv) {\n let command = getCommand(argv);\n let isInternalCommand = true;\n\n logger.info(`SKY UX processing command ${command}`);\n\n switch (command) {\n case 'version':\n require('./lib/version').logVersion(argv);\n break;\n case 'new':\n require('./lib/new')(argv);\n break;\n case 'help':\n require('./lib/help')(argv);\n break;\n case 'install':\n require('./lib/install')(argv);\n break;\n default:\n isInternalCommand = false;\n }\n\n invokeCommand(command, argv, isInternalCommand);\n}", "title": "" }, { "docid": "31eb572b32e906b33100564e2cbd739c", "score": "0.66215885", "text": "constructor() {\n this.argvs = [];\n var argvs = process.argv.slice(2);\n this.parse(argvs);\n }", "title": "" }, { "docid": "7e0357361a2db62be5d6c53452abe062", "score": "0.644576", "text": "function argv(args, options) {\n options = options || this.options.argv\n var result = parse(args || process.argv.slice(2), options)\n , k;\n for(k in result.flags) {\n this.storage.argv[k] = result.flags[k];\n }\n for(k in result.options) {\n this.storage.argv[k] = result.options[k];\n }\n return this;\n}", "title": "" }, { "docid": "462f1df2958232ea9a523530001516e0", "score": "0.6394491", "text": "function parseArgv(argv) {\n params = {}\n argv.forEach(function(arg, i) {\n if (arg.substr(0, 2) == '--') {\n paramName = arg.substr(2, arg.length)\n nextArg = argv[i+1]\n if ((typeof nextArg == 'string' && nextArg.substr(0, 2) == '--') || nextArg == undefined) {\n params[paramName] = true\n }\n else {\n params[paramName] = nextArg\n }\n }\n })\n return params\n}", "title": "" }, { "docid": "922042ac86b688e340dd29f5e7d16e3e", "score": "0.6279661", "text": "args(...args) {\n if (this.proc) {\n throw new Error(\"already started?\");\n }\n\n args.forEach((a) => {\n if (typeof a !== \"object\") {\n this._args.push('' + a);\n } else {\n Object.keys(a).forEach((key) => {\n const value = a[key];\n this._args.push(\"--\" + key);\n this._args.push('' + value);\n });\n }\n });\n\n }", "title": "" }, { "docid": "2004117b5475445441795769c47ffcc1", "score": "0.6132188", "text": "function normalizeArgv(rawArgv) {\n const argv = rawArgv.slice(2);\n const length = argv.length;\n const args = [];\n\n argv.forEach((arg, idx) => {\n const needDefault = defaultsWhenSpecified.has(arg)\n && (idx === length - 1 || argv[idx + 1].startsWith('-'));\n\n if (needDefault) {\n args.push(arg, defaultsWhenSpecified.get(arg));\n }\n else {\n args.push(arg);\n }\n });\n\n return args;\n}", "title": "" }, { "docid": "20ca6391b502f6ad578ddb8fd32f274f", "score": "0.6098753", "text": "function parseArgv(argv, defines) {\n const [scope, args] = argv.length >= 1 && defines[argv[0]] ?\n [argv[0], argv.slice(1)] : ['default', argv.slice()];\n if (args.length === 0) {\n args.push('--help');\n }\n return [scope, args];\n}", "title": "" }, { "docid": "fc84ce1edeed1cc19a3c14bbf57acfb4", "score": "0.6076747", "text": "function _parse() {\n const args = {};\n if (process.argv.length <= 2) {\n return {};\n }\n const argArr = process.argv.slice(2);\n for (let i = 0; i < argArr.length; i++) {\n const arg = argArr[i];\n const nextArg = argArr[i + 1];\n // only support --arg value and -flag\n if (arg[0] === '-') {\n if (arg[1] === '-') {\n args[arg.slice(2)] = !isNaN(nextArg) ? parseInt(nextArg) : nextArg;\n i++;\n } else {\n args[arg.slice(1)] = true;\n }\n }\n }\n args.debug && console.log(args);\n return args;\n}", "title": "" }, { "docid": "8aa2a5a35b848d7aa4ad26fa070cadb0", "score": "0.6065565", "text": "get argv() {\n return this.get('rawOptions', {})\n }", "title": "" }, { "docid": "be141b5256e828577e4df13cf2766646", "score": "0.600615", "text": "function cleanupArgv(argv) {\n\tconst argSet = new Set(ArgvParser.parse(argv).args);\n\treturn argv.slice(2).filter(arg => !argSet.has(arg));\n}", "title": "" }, { "docid": "1d0615b549622b2fe66da34f5c62d928", "score": "0.5991992", "text": "function argv2o(argv,m,mm){var rt={};for(k in argv)(m=(rt[\"\"+k]=argv[k]).match(/^(\\/|--?)([a-zA-Z0-9-_]*)=\"?(.*)\"?$/))&&(rt[m[2]]=m[3]);return rt}", "title": "" }, { "docid": "2ef54161d87eb7640f3d6b4df9e161e4", "score": "0.592513", "text": "function argv(arg,defVal)\n{\n if (arg!=null) {\n\n return arg;\n }\n else\n {\n return defVal;\n }\n}", "title": "" }, { "docid": "b76a6b6e737b03d9826a54c77310e08c", "score": "0.59055686", "text": "function getProvidedArguments()\n{\n\tvar params = [];\n\tfor (var i = 2; i < process.argv.length; i++)\n\t{\n\t\tparams.push(process.argv[i]);\n\t}\n\t\n\treturn params;\n}", "title": "" }, { "docid": "a459ab9398c0da8262df754562c381b9", "score": "0.5904696", "text": "function getArgs() {\n args.option('port', 'The port on which the app will be running', 3000);\n args.option('open', 'Open app in default browser window', true);\n\n const pArgs = process.argv.map(a => ['false', 'true'].includes(a) ? JSON.parse(a) : a)\n const flags = args.parse(pArgs, {\n version: false,\n usageFilter: (msg) => {\n const lines = msg.split('\\n \\n');\n lines[1] = ' <app_name> is optional and defaults to \\'restool-app\\'';\n return lines.join('\\n \\n')\n .replace('[options] [command]', '<app_name> [options]')\n .replace('33mcreate', '33mnpm init')\n .replace('<n>', ' ');\n }\n });\n return {\n ...flags,\n appName: args.sub[0]\n };\n}", "title": "" }, { "docid": "b2e08ba70ce0119c0764ac53ee71830a", "score": "0.5873981", "text": "function getCommandLine(arg_array_position = 2){\r\n return process.argv[arg_array_position] \r\n}", "title": "" }, { "docid": "e6c05196abb3a1e1319212d1adf27579", "score": "0.5855993", "text": "function checkArgs() {\r\n var args = process.argv.splice(2);\r\n\r\n if(args.length === 0) {\r\n Options.paths[0] = '.';\r\n }\r\n else {\r\n Options.paths.push.apply(Options.paths, args);\r\n }\r\n}", "title": "" }, { "docid": "c4691fae63a09c007f034c300ba4ecea", "score": "0.58351547", "text": "function getProcessArgs(aExtraArgs) {\n if (!aExtraArgs) {\n aExtraArgs = [];\n }\n\n let appBinPath = getApplyDirFile(DIR_MACOS + FILE_APP_BIN, false).path;\n if (/ /.test(appBinPath)) {\n appBinPath = '\"' + appBinPath + '\"';\n }\n\n let args;\n if (IS_UNIX) {\n let launchScript = getLaunchScript();\n // Precreate the script with executable permissions\n launchScript.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);\n\n let scriptContents = \"#! /bin/sh\\n\";\n scriptContents += appBinPath + \" -no-remote -process-updates \" +\n aExtraArgs.join(\" \") + \" \" + PIPE_TO_NULL;\n writeFile(launchScript, scriptContents);\n logTestInfo(\"created \" + launchScript.path + \" containing:\\n\" +\n scriptContents);\n args = [launchScript.path];\n } else {\n args = [\"/D\", \"/Q\", \"/C\", appBinPath, \"-no-remote\", \"-process-updates\"].\n concat(aExtraArgs).concat([PIPE_TO_NULL]);\n }\n return args;\n}", "title": "" }, { "docid": "472fff8fa8b6e3b2d66dd61b16168db4", "score": "0.58253264", "text": "function postProcessPositional (yargs, argv, key) {\n var coerce = yargs.getOptions().coerce[key]\n if (typeof coerce === 'function') {\n try {\n argv[key] = coerce(argv[key])\n } catch (err) {\n yargs.getUsageInstance().fail(err.message, err)\n }\n }\n }", "title": "" }, { "docid": "73e2a11eb131ce2d78933f3a95085d90", "score": "0.5818349", "text": "function postProcessPositional (yargs, argv, key) {\n\t\t\t var coerce = yargs.getOptions().coerce[key]\n\t\t\t if (typeof coerce === 'function') {\n\t\t\t try {\n\t\t\t argv[key] = coerce(argv[key])\n\t\t\t } catch (err) {\n\t\t\t yargs.getUsageInstance().fail(err.message, err)\n\t\t\t }\n\t\t\t }\n\t\t\t }", "title": "" }, { "docid": "c7ff9fdcbced9bbdcb89a4969270aee9", "score": "0.58137697", "text": "_parse() {\n\t\treturn parseArgs(process.argv.slice(2));\n\t}", "title": "" }, { "docid": "abb8931f13179cff84bff5bfe67ad833", "score": "0.5791867", "text": "function isValidArgv(argv) {\n // using a set of the arguments that will be allowed to be use in the command line \n var commandList = new Set([`concert-this`, `spotify-this-song`, `movie-this`, `do-what-it-says`])\n var userCommand = argv[2]\n if (argv.length < 3) {\n console.log(`Error: Not enough arguments in command line`)\n return false\n }\n else if (!commandList.has(userCommand)) {\n console.log(`Error: Invalid argument`)\n return false\n }\n return true\n}", "title": "" }, { "docid": "08c16646a4fec2119b843d38bec944ca", "score": "0.57827526", "text": "static parseInternalOptions(argv) {\n var opts = GetOpt.getOptions({\n \"debug\": { type: \"boolean\", aliases: [ \"fg-debug\", \"fgdebug\", \"debugfg\", \"debug-fg\" ] },\n \"bgdebug\": { type: \"boolean\", aliases: [ \"bg-debug\", \"debug-bg\", \"debugbg\" ] },\n \"help\": { type: \"boolean\" },\n }, argv);\n\n return opts;\n}", "title": "" }, { "docid": "23836dbc8459b27308c941b8935ca089", "score": "0.57798725", "text": "function parseOpt (argv, opt, data) {\n \n if (!argv.length) return [];\n \n // we're only interested in the next 1 or 2 args.\n if (opt && opt._prefix && argv[0] !== opt._prefix) {\n return argv;\n }\n var value = opt._prefix ? argv[1] : argv[0];\n \n if (opt.name) data = data || {};\n else data = data || null;\n \n // support multiple flags like rsync -vazu or -vvv for triple-verbose\n argv = multiFlag(argv);\n \n // p(\"parseOpt \"+argv+ \" \"+JSON.stringify(opt));\n // figure out what kind of argument this opt refers to.\n if ( Array.isArray(opt) || (opt && opt.list) ) {\n if (opt.name) data = data[opt.name] = data[opt.name] || {};\n return parseOptList(argv, opt.list || opt, data);\n } else if ( opt.optGroup ) {\n if (opt.name) data = data[opt.name] = data[opt.name] || {};\n return parseOptGroup(argv, opt.optGroup, data);\n } else if ( opt.type === \"argv\" ) {\n // swallow the rest of the argv\n // todo: take a restricted number of args, like 2 things or something\n if (opt.name) {\n if (Array.isArray(data[opt.name])) data[opt.name].concat(argv);\n else if (data[opt.name]) data[opt.name] = [data[opt.name]].concat(argv);\n else {\n if (argv[argv.length - 1] === \"\") argv.pop();\n data[opt.name] = argv;\n }\n }\n else data = argv;\n return [];\n } else if (Array.isArray(opt.options)) {\n // make sure it's one of the options\n if (opt.options.indexOf(value) === -1) {\n if (opt.required) throw new Error(\n \"Required option not specified: \"+opt.name);\n return argv;\n }\n if (opt.name) data[opt.name] = value;\n return argv.slice( opt._prefix ? 2 : 1 );\n } else if (typeof(opt.match) === \"function\" && opt.match(value)) {\n if (opt.name) data[opt.name] = value;\n return argv.slice( opt._prefix ? 2 : 1 );\n } else if ( opt.flag ) {\n if (opt.usage) throw true;\n if (opt.name) value = data[ opt.name ] = (data[ opt.name ] || 0) + 1;\n else value = 0;\n return argv.slice(1);\n } else {\n // no restrictions, just a simple --key val thing\n if (opt.name) data[opt.name] = value;\n return argv.slice( opt._prefix ? 2 : 1 );\n }\n return argv;\n}", "title": "" }, { "docid": "29e9a140a5ee9e5a66988e0da56d1f36", "score": "0.57690036", "text": "static parseCommandLine(text) {\n var argv = ShellParse.split(text);\n\n // To support internal options as the first word, consider the entire\n // command line.\n return FactotumBg.parseInternalOptions(argv);\n}", "title": "" }, { "docid": "938ccb9111bfc96c43e32b58cbbd65d9", "score": "0.57684624", "text": "function parseArgv(argv){\n const uri = argv.find(arg => arg.startsWith('lightning:'))\n uri && handleUri(uri)\n}", "title": "" }, { "docid": "edf16c6f069a8b561f1ee08e55a8fab3", "score": "0.5756429", "text": "function _yargsOverrides (settings, argv) {\n const prefix = 'arg-'\n Object.keys(argv)\n .filter(key => key.startsWith(prefix))\n .forEach(key => {\n const val = argv[key]\n const path = key.replace(prefix, '').split('.')\n if (path.length === 1) {\n return _setIn(settings.common, path, val)\n }\n _setIn(settings, path, val)\n })\n return settings\n }", "title": "" }, { "docid": "31acd93c81cc38e3704b29b842aabb3b", "score": "0.5751628", "text": "function setupArgsAndParse (program, argv) {\n program\n .version(pkg.version)\n .option('-h, --host [host]', 'host of redis server, the default is localhost')\n .option('-a, --auth [password]', 'password of redis server')\n .option('-p, --port [number]', 'port of redis server, the default is 6379')\n .option('-n, --name <queueName>', 'name of the queue')\n .option('-c, --config [config]', 'name of file with configuration')\n .parse([].slice.call(argv)) // in case it's an `arguments` Object, convert to array\n\n program.password = program.auth\n\n return program\n}", "title": "" }, { "docid": "04dc43e21bf8e7650356ef4a201f2934", "score": "0.5686234", "text": "function parseArgs(argv) {\n var results = { '_': [] }, current = null;\n for (var i = 1, len = argv.length; i < len; i++) {\n var x = argv[i];\n if (x.length > 2 && x[0] == '-' && x[1] == '-') {\n if (current != null) { results[current] = true; }\n current = x.substring(2);\n } else {\n if (current != null) { results[current] = toNumberIfNumber(x); current = null; } else { results['_'].push(toNumberIfNumber(x)); }\n }\n }\n if (current != null) { results[current] = true; }\n return results;\n}", "title": "" }, { "docid": "b1fa4eedbf0aafae0eb6a916857d7898", "score": "0.56717855", "text": "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n\n // This makes `appname` a required argument.\n this.argument('appname', {\n type: String,\n required: true\n });\n\n this.options.appname=_.kebabCase(this.options.appname);\n\n // And you can then access it later; e.g.\n this.log(this.options.appname);\n\n // Next, add your custom code\n //this.option('babel'); // This method adds support for a `--babel` flag\n\n// // This method adds support for a `--coffee` flag\n// this.option('coffee');\n//\n// // And you can then access it later; e.g.\n// this.scriptSuffix = (this.options.coffee ? \".coffee\" : \".js\");\n\n\n }", "title": "" }, { "docid": "212fd1fd8dbecd1dc63dc4dc04722b3c", "score": "0.5646384", "text": "go( process_argv = process.argv ){\n debug('go processing argv', process_argv)\n debug('go config has keys', Object.keys(this.config_options))\n this.binary = process_argv[0]\n this.script = process_argv[1]\n if ( ! this._label ) this._label = this.script\n this.processArgs(process_argv.slice(2))\n if ( this._handler ){\n debug('running handler', this._handler)\n const fn = this._handler\n return fn(this.getOptions(), this)\n }\n return this.getOptions()\n //return this.toJSON()\n }", "title": "" }, { "docid": "df6a9533f9a53650011fda5147d9133a", "score": "0.5643365", "text": "function getCommandLineArgs() {\n\treturn { \n\t\tdebug: process.argv.indexOf(\"--debug\") >= 0 || process.argv.indexOf(\"-d\") >= 0\n\t}\n}", "title": "" }, { "docid": "9414d5b6031540443f5c156d89a8829f", "score": "0.5630152", "text": "function getArgs () {\n return yargs\n .option('filter', {\n alias: 'f',\n describe: 'filter to apply before deleting documents',\n default: ''\n })\n .option('query', {\n alias: 'q',\n describe: 'query to apply',\n default: ''\n })\n .option('return', {\n alias: 'r',\n describe: 'fields to return'\n })\n .option('out', {\n alias: 'o',\n describe: 'write results to this file'\n })\n .option('is_nlq', {\n describe: 'query is a natural langauge query',\n type: 'boolean',\n default: true\n })\n .option('extra_params', {\n alias: 'x',\n describe: 'an extra parameter to include in NodeJS SDK request for WDS query API. Provided as key:value. For instance, count:5. Can be specified multiple times.'\n })\n .option('dry_run', {\n alias: 'z',\n describe: 'dry run of operation',\n type: 'boolean',\n default: false\n })\n .option('connection', {\n alias: 'c',\n describe: 'WDS connection info JSON'\n })\n .demandOption(['connection'], 'Requires a WDS connection')\n .argv\n}", "title": "" }, { "docid": "41238b8e917cb3938a760c9c0de4229c", "score": "0.56207013", "text": "processCommandLineArgs(commandLineArgs) {\r\n commandLineArgs.forEach((val, index, arr) => {\r\n if(val.indexOf('=') > 0) {\r\n const rowValue = val.split('=');\r\n this.args[rowValue[0]] = rowValue[1];\r\n }\r\n })\r\n }", "title": "" }, { "docid": "fd56ac4339a63b3c4e9b23a2a0f14c2d", "score": "0.56151724", "text": "enterArglist(ctx) {}", "title": "" }, { "docid": "392263568bfd985be4a69d222cee781f", "score": "0.559754", "text": "function arg(argv, spec) {\n try {\n return arg_1.default(spec, { argv, stopAtPositional: true });\n }\n catch (err) {\n return err;\n }\n}", "title": "" }, { "docid": "1277e6fcdd8e7589bc97504d314fb349", "score": "0.5584858", "text": "constructor(exe, orderedArgs, unorderedArgs, flagArg) {\n this.exe = exe;\n this.orderedArgs = orderedArgs;\n this.unorderedArgs = unorderedArgs;\n this.flagArg = flagArg;\n }", "title": "" }, { "docid": "ca515ea71da0a04ebc3da6393b8d4d70", "score": "0.5584702", "text": "function getArguments(glob) {\n return glob.process.argv;\n }", "title": "" }, { "docid": "2205fde4985696e28e3f7524dc0a005c", "score": "0.5583233", "text": "function serverArgs(args) {\n if (!args) {\n args = ['--localhost', '--mem', '/dgwnu'];\n }\n return args;\n}", "title": "" }, { "docid": "45228399466e4c005c4f7331d03880ca", "score": "0.55666614", "text": "function getProcessArgs(aExtraArgs) {\n if (!aExtraArgs) {\n aExtraArgs = [];\n }\n\n // Pipe the output from the launched application to a file so the output from\n // its console isn't present in the xpcshell log.\n let appConsoleLogPath = getAppConsoleLogPath();\n\n let args;\n if (IS_UNIX) {\n let launchScript = getLaunchScript();\n // Precreate the script with executable permissions\n launchScript.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);\n\n let scriptContents = \"#! /bin/sh\\n\";\n // On Mac OS X versions prior to 10.6 the i386 acrhitecture must be used.\n if (gIsLessThanMacOSX_10_6) {\n scriptContents += \"arch -arch i386 \";\n }\n scriptContents += gAppBinPath + \" -no-remote -process-updates \" +\n aExtraArgs.join(\" \") + \" 1> \" +\n appConsoleLogPath + \" 2>&1\";\n writeFile(launchScript, scriptContents);\n logTestInfo(\"created \" + launchScript.path + \" containing:\\n\" +\n scriptContents);\n args = [launchScript.path];\n }\n else {\n args = [\"/D\", \"/Q\", \"/C\", gAppBinPath, \"-no-remote\", \"-process-updates\"].\n concat(aExtraArgs).\n concat([\"1>\", appConsoleLogPath, \"2>&1\"]);\n }\n return args;\n}", "title": "" }, { "docid": "9f2442f75977bbd9dcafb2a684466f7d", "score": "0.555088", "text": "function grabParams(flag) {\n let index = process.argv.indexOf(flag);\n return index === -1 ? null : process.argv[index + 1];\n }", "title": "" }, { "docid": "19bc30fd74bc3a142dd717861e4df40f", "score": "0.55388653", "text": "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n this.option(\"version\");\n // this.argument(\"appname\", { type: String, required: false });\n this.params = {};\n }", "title": "" }, { "docid": "df897bb277792204aea970929143c59a", "score": "0.5535207", "text": "cli() {\n commander.parse(process.argv);\n }", "title": "" }, { "docid": "ca9940166ccd666fe14850e472268a44", "score": "0.5515214", "text": "function singletonify (inst) {\n\t\t\t Object.keys(inst).forEach(function (key) {\n\t\t\t if (key === 'argv') {\n\t\t\t Argv.__defineGetter__(key, inst.__lookupGetter__(key))\n\t\t\t } else {\n\t\t\t Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]\n\t\t\t }\n\t\t\t })\n\t\t\t}", "title": "" }, { "docid": "0245b1a9bf45b0322326e62cbc89940c", "score": "0.5494544", "text": "static extract_cmd_args(cmd_name, full_command){\n let end_of_cmd_name_pos = full_command.indexOf(cmd_name) + cmd_name.length\n let cmd_args_str = full_command.substring(end_of_cmd_name_pos)\n let semicolon_pos = cmd_args_str.indexOf(\";\")\n if(semicolon_pos != -1) {\n cmd_args_str = cmd_args_str.substring(0, semicolon_pos)\n }\n cmd_args_str = cmd_args_str.trim()\n let args = []\n let cur_arg = \"\"\n let in_arg = false\n let cur_arg_delimiter = \" \"\n for(let char of cmd_args_str){\n if(char == '\"'){\n if(in_arg){\n if(cur_arg_delimiter == char) { //found end of cur arg\n args.push(cur_arg)\n cur_arg_delimiter = \" \"\n in_arg = false\n cur_arg = \"\"\n }\n else {\n dde_error(\"While parsing command input args, got a double_quote where it wasn't expected:<br/>\" +\n cmd_args_str)\n }\n }\n else { //beginning of a double quoted arg\n cur_arg_delimiter = char\n cur_arg = \"\"\n in_arg = true\n }\n }\n else if (char == \" \") {\n if(in_arg){\n if(cur_arg_delimiter == char) { //found end of cur arg\n args.push(cur_arg)\n cur_arg_delimiter = \" \"\n in_arg = false\n cur_arg = \"\"\n }\n else {\n dde_error(\"While parsing command input args, got a space where it wasn't expected:<br/>\" +\n cmd_args_str)\n }\n }\n else { //beginning of a new space-delimited arg\n in_arg = true\n cur_arg_delimiter = \" \"\n cur_arg = \"\"\n }\n }\n else {\n in_arg = true //could be the first char of a space-delimited arg.\n cur_arg += char\n }\n }\n if (in_arg && (cur_arg.length > 0)){\n if (cur_arg_delimiter == \" \") { args.push(cur_arg) }\n else {dde_error(\"While parsing command input args, got end of command without a closing double quote:<br/>\" +\n cmd_args_str)}\n }\n return args\n }", "title": "" }, { "docid": "84377db7e793b452b7d578cca082880b", "score": "0.548308", "text": "function cleanArgs (cmd) {\n const args = {}\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, ''))\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key]\n }\n })\n return args\n}", "title": "" }, { "docid": "15ad56e5125395b9ecc3a4e80c3f4122", "score": "0.5452737", "text": "set IndirectArguments(value) {}", "title": "" }, { "docid": "df7b6d8e58bbd80f4495388c6f5438a9", "score": "0.54479533", "text": "function arg(argv, spec, stopAtPositional = true, permissive = false) {\n try {\n return arg_1.default(spec, { argv, stopAtPositional, permissive });\n }\n catch (err) {\n return err;\n }\n}", "title": "" }, { "docid": "7b8f4611ad267198dbd99b22f5d9af80", "score": "0.54223895", "text": "function getArgs() {\n return [`--port=${options.port}`, options.file];\n}", "title": "" }, { "docid": "83902eab6fd59d74403a8e1789e59e9e", "score": "0.5420501", "text": "function cleanArgs(cmd) {\n const args = {}\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, ''))\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key]\n }\n })\n return args\n}", "title": "" }, { "docid": "e9e8524e1c176e319f581bb895ca02a3", "score": "0.54195297", "text": "function argControl() {\n if (process.argv[2] === \"my-tweets\") {\n twitterLogic();\n } else if (process.argv[2] === \"spotify-this-song\") {\n spotifyTune();\n } else if (process.argv[2] === \"movie-this\") {\n movieThis(\"Mr. Nobody\");\n } else if (process.argv[2] === \"do-what-it-says\") {\n doWhatItSays()\n } else {\n console.log(` Try one of the following commands:\n node liri my-tweets | node liri movie-this space jam\n node liri spotify-this-song old devil moon |\n node liri do-what-it-says\n `);\n return;\n }\n\n}", "title": "" }, { "docid": "dc62b93817c7295b4d38ecc671b39fc7", "score": "0.5417107", "text": "function parseArgs(args) {\n if (args.charAt(0) !== \"-\")\n return null;\n}", "title": "" }, { "docid": "78d824afaf465b846b1260cce132e5ff", "score": "0.5411074", "text": "function singletonify (inst) {\n Object.keys(inst).forEach((key) => {\n if (key === 'argv') {\n Argv.__defineGetter__(key, inst.__lookupGetter__(key))\n } else {\n Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]\n }\n })\n}", "title": "" }, { "docid": "1d2e36af84a749c3d7bc508cced3c276", "score": "0.5410411", "text": "function CmdArgParser() {\n this.banner = constants.DEFAULT_BANNER;\n this.optionsTitle = constants.DEFAULT_OPTION_TITLE;\n this.optionsTail = undefined;\n this.options = [];\n\n this.groupedOptions = [];\n\n this.mutuallyExclusiveOptions = [];\n}", "title": "" }, { "docid": "0f81e82ed3e801330958dc1a6a28ecbe", "score": "0.5409257", "text": "function singletonify (inst) {\n Object.keys(inst).forEach((key) => {\n if (key === 'argv') {\n Argv.__defineGetter__(key, inst.__lookupGetter__(key));\n } else {\n Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key];\n }\n });\n}", "title": "" }, { "docid": "3fd62e2390f6274ce0f8ed5b6cd2cdd2", "score": "0.54080087", "text": "function inComing(aString) {\n let orgPass = process.argv.slice(2);\n return orgPass\n}", "title": "" }, { "docid": "032d0b36d18fbe8aea01b1ec9286be83", "score": "0.53325397", "text": "function args() { return arguments; }", "title": "" }, { "docid": "66655ed11e87ff74ae2f6852e0875429", "score": "0.5323248", "text": "constructor(){\n this.ap = new ArgumentParser({\n version: \"0.0.1\",\n addHelp: true,\n description: \"Argparse Lib\"\n });\n\n this.addArguments();\n }", "title": "" }, { "docid": "aa07e713fb0720b659c9676989691952", "score": "0.532287", "text": "function cleanArgs(cmd) {\n const args = {};\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, ''));\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key];\n }\n });\n return args;\n}", "title": "" }, { "docid": "aa07e713fb0720b659c9676989691952", "score": "0.532287", "text": "function cleanArgs(cmd) {\n const args = {};\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, ''));\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key];\n }\n });\n return args;\n}", "title": "" }, { "docid": "0c358369a4d88e3ca722749ff8097b4f", "score": "0.5316792", "text": "function cleanArgs(cmd) {\n const args = {};\n if (cmd) {\n cmd.options.forEach((o) => {\n const key = utils.camelize(o.long.replace(/^--/, ''));\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key];\n }\n });\n if (cmd.parent && cmd.parent.rawArgs) {\n // eslint-disable-next-line prefer-destructuring\n args.command = cmd.parent.rawArgs[2];\n }\n }\n return args;\n}", "title": "" }, { "docid": "4d408ba7b28b1d10816a25a79fa6c21b", "score": "0.53152937", "text": "parse_args(args = undefined, namespace = undefined) {\n let argv\n [ args, argv ] = this.parse_known_args(args, namespace)\n if (argv && argv.length > 0) {\n let msg = 'unrecognized arguments: %s'\n this.error(sub(msg, argv.join(' ')))\n }\n return args\n }", "title": "" }, { "docid": "796e2fdea57a01c13b0ab018e9418b4d", "score": "0.53147227", "text": "function cleanArgs(cmd) {\n const args = {};\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, \"\"));\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== \"function\" && typeof cmd[key] !== \"undefined\") {\n args[key] = cmd[key];\n }\n });\n return args;\n}", "title": "" }, { "docid": "4c0ecb0ec69b83de7257fdd4ac907034", "score": "0.53022146", "text": "function cleanArgs(cmd) {\n const args = {};\n cmd.options.forEach(o => {\n const key = camelize(o.long.replace(/^--/, ''));\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function' && typeof cmd[key] !== 'undefined') {\n args[key] = cmd[key];\n }\n });\n return args;\n}", "title": "" }, { "docid": "34662e37cb13af4540e0c02797748626", "score": "0.5299359", "text": "function parseArguments(rawArgs) {\n const args = arg(\n {\n // Types\n \"--contributors\": [String],\n \"--repos\": [String],\n \"--preset\": String,\n\n // Aliases\n \"-c\": \"--contributors\",\n \"-r\": \"--repos\",\n \"-p\": \"--preset\",\n },\n {\n argv: rawArgs.slice(2),\n }\n )\n return {\n contributors: args[\"--contributors\"],\n repos: args[\"--repos\"],\n preset: args[\"--preset\"],\n }\n}", "title": "" }, { "docid": "9a898117c9bdb69994545fb785623b11", "score": "0.5296977", "text": "function grab(flag){\n let index = process.argv.indexOf(flag);\n return (index === -1) ? null : process.argv[index + 1];\n}", "title": "" }, { "docid": "b0856448e5560acf16aecae61e1276d1", "score": "0.52899176", "text": "function checkArgs() {\n function displayUsage() {\n console.log('Usage:');\n console.log('lifx --id LAMPID --cmd on|off|(color --hue HUE --saturation SAT --brightness BRI)');\n console.log('Optional parameter (with default):');\n console.log(' --kelvin 5000');\n console.log(' --duration 0');\n console.log(' --timeout 10000');\n console.log(' --debug false');\n process.exit(20);\n }\n\n // cmd and id is always needed\n if (typeof argv.cmd === 'undefined' || typeof argv.id === 'undefined') {\n displayUsage();\n }\n\n // Defaults\n // duration for on/off and related\n if (typeof argv.duration === 'undefined') {\n argv.duration=0;\n }\n // This script times out after this many milli seconds\n if (typeof argv.timeout === 'undefined') {\n argv.timeout=10000;\n }\n // Default color temparture\n if (typeof argv.kelvin === 'undefined') {\n argv.kelvin=5000;\n }\n // Debug\n if (typeof argv.debug === 'undefined') {\n argv.debug=false;\n }\n\n // More complex commands with mandatory parameters\n switch(argv.cmd) {\n case 'color': if (typeof argv.hue === 'undefined'\n || typeof argv.saturation === 'undefined'\n || typeof argv.brightness === 'undefined') {\n displayUsage();\n break;\n } \n }\n}", "title": "" }, { "docid": "31ed315a730c8f8ff5debb47d7ca93bb", "score": "0.5289762", "text": "function removeSquirrelCommand() {\n const result = [];\n\n process.argv.forEach((processArg) => {\n if (processArg.startsWith(squirrelSignature) === false) {\n result.push(processArg);\n }\n });\n\n // Override arguments with cleaned set\n process.argv = result;\n}", "title": "" }, { "docid": "f7b8ce0e6332bc3dd11b36299fd998ff", "score": "0.52890044", "text": "function generateExtraArgs(args) {\n const newArgs = [];\n\n for (const argName in args) {\n if (args.hasOwnProperty(argName) && argName !== '_' && argName !== 'inspect') {\n const value = args[argName];\n if (value === true) {\n newArgs.push(`--${argName}`);\n } else if (value !== false) {\n newArgs.push(`--${argName}=${value}`);\n }\n }\n }\n return newArgs.join(' ');\n}", "title": "" }, { "docid": "ea05eded3c079418460e3d7ff1a73b07", "score": "0.52808094", "text": "get IndirectArguments() {}", "title": "" }, { "docid": "ad86b8382d439a6a551e685b0e59ce42", "score": "0.52696586", "text": "function sigletonify(inst) {\n Object.keys(inst).forEach(function (key) {\n if (key === 'argv') {\n Argv.__defineGetter__(key, inst.__lookupGetter__(key));\n } else {\n Argv[key] = typeof inst[key] == 'function'\n ? inst[key].bind(inst)\n : inst[key];\n }\n });\n}", "title": "" }, { "docid": "47a117ec5d25465b640e847168a2a508", "score": "0.52643967", "text": "function cleanArgs(cmd) {\n const args = {};\n cmd.options.forEach(o => {\n const key = o.long.replace(/^--/, '');\n // if an option is not present and Command has a method with the same name\n // it should not be copied\n if (typeof cmd[key] !== 'function') {\n args[key] = cmd[key];\n }\n });\n return args;\n}", "title": "" }, { "docid": "5bf69f12a9057080f99678e814279701", "score": "0.5252536", "text": "function parseArgs (argv, args) {\n var argc = argv.length;\n var sel;\n if (argc === 1) {\n var arg = argv[0];\n if (typeof arg === 'string') {\n // selector with no arguments\n sel = arg;\n } else {\n // legacy API: an Object was passed in\n sel = [];\n Object.keys(arg).forEach(function (s) {\n sel.push(s);\n args.push(arg[s]);\n });\n sel.push('');\n sel = sel.join(':');\n }\n } else {\n // varargs API\n sel = [];\n for (var i=0; i<argc; i+=2) {\n sel.push(argv[i]);\n args.push(argv[i+1]);\n }\n sel.push('');\n sel = sel.join(':');\n }\n return sel;\n}", "title": "" }, { "docid": "775433e08cbef552e3b7f9a91185cb02", "score": "0.52334845", "text": "function grab(flag) {\n var index = process.argv.indexOf(flag);\n return (index === -1) ? null: process.argv[index+1];\n}", "title": "" }, { "docid": "9d1772e6d85f57e7c482d6c05c5db9c8", "score": "0.5226121", "text": "function grab(flag) {\n\tvar index = process.argv.indexOf(flag);\n\treturn (index === -1) ? null : process.argv[index+1];\n}", "title": "" }, { "docid": "69114478e853b8487ed88e182521c5d5", "score": "0.5220843", "text": "function parseCommandLine() {\n const re = /^slack:/i;\n let argList = _.clone(process.argv.slice(1));\n let protoUrl = argList.find((x) => x.match(re));\n argList = argList.filter((x) => !x.match(re));\n\n if (argList.find((x) => thingsIDontLike.find((r) => x.match(r)))) {\n process.exit(-1);\n }\n\n const options = yargs.usage(`Slack Client v${version}`)\n .option('f', {\n alias: 'foreground',\n type: 'boolean',\n describe: 'Keep the browser process in the foreground.'\n }).option('h', {\n alias: 'help',\n type: 'boolean',\n describe: 'Print this usage message.'\n }).option('l', {\n alias: 'log-file',\n type: 'string',\n describe: 'Log all output to file.'\n }).option('g', {\n alias: 'log-level',\n type: 'string',\n describe: `Set the minimum log level, e.g., 'info', 'debug', etc.`\n }).option('r', {\n alias: 'resource-path',\n type: 'string',\n describe: 'Set the path to the Atom source directory and enable dev-mode.'\n }).option('u', {\n alias: 'startup',\n type: 'boolean',\n describe: 'The app is being started via a Startup shortcut. Hide the window on Win32'\n }).option('v', {\n alias: 'version',\n type: 'boolean',\n describe: 'Print the version.'\n }).option('e', {\n //'Set QA/DEV Env'\n alias: 'devEnv',\n type: 'string',\n describe: false\n }).option('t', {\n //'Token for TSAuth'\n alias: 'tsaToken',\n type: 'string',\n describe: false\n }).help(false);\n\n const args = process.defaultApp ? options.argv : options.parse(process.argv.slice(1));\n\n if (args.help) {\n process.stdout.write(options.help());\n process.exit(0);\n }\n\n if (args.version) {\n process.stdout.write(`${version}\\n`);\n process.exit(0);\n }\n\n let webappSrcPath = args['webapp-src-path'] || process.env.SLACK_WEBAPP_SRC;\n webappSrcPath = webappSrcPath ? path.normalize(webappSrcPath) : webappSrcPath;\n\n const logFile = args['log-file'];\n const logLevel = args['log-level'];\n const devEnv = args.devEnv;\n const tsaToken = args.tsaToken;\n\n const invokedOnStartup = args.startup;\n const chromeDriver = !!process.argv.slice(1).find((x) => x.match(/--test-type=webdriver/));\n\n let devMode = args.dev || chromeDriver;\n let resourcePath = path.join(process.resourcesPath, 'app.asar');\n if (args['resource-path']) {\n devMode = true;\n resourcePath = args['resource-path'];\n }\n\n if (!fs.statSyncNoException(resourcePath)) {\n resourcePath = path.dirname(__dirname);\n }\n\n // If we were started via npm start, convert devXYZ to the protocol URL version\n if (isPrebuilt()) {\n const envToLoad = argList.find((x) => x.match(/^(dev[0-9]{0,3}|staging|qa[0-9]{0,3})$/i));\n if (envToLoad) protoUrl = `slack://open?devEnv=${envToLoad}`;\n }\n resourcePath = path.resolve(resourcePath);\n\n return {\n resourcePath,\n version,\n devMode,\n logFile,\n logLevel,\n protoUrl,\n invokedOnStartup,\n chromeDriver,\n webappSrcPath,\n devEnv,\n tsaToken\n };\n}", "title": "" }, { "docid": "94cf495b2531d8913bd5df5e5eebeaa5", "score": "0.5218405", "text": "addParallelCommand(argv) {\n this.parallelArgv.push(argv);\n return this;\n }", "title": "" }, { "docid": "136e67fa9e2aed00b62fde0155f1fe99", "score": "0.5217325", "text": "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n //this.argument(\"appname\", { type: String, required: true });\n }", "title": "" }, { "docid": "040d8423c128f03b4bf02034e6474422", "score": "0.5202121", "text": "static get cli() {\n return {\n get getArguments() {\n return () => require(\"../bin/cli-flags\");\n },\n get processArguments() {\n return require(\"../bin/process-arguments\");\n },\n };\n }", "title": "" }, { "docid": "b5ec7fe140463631b45fb3c4dee3118c", "score": "0.52014244", "text": "function grab(flag) {\n var index = process.argv.indexOf(flag);\n return (index === -1) ? null : process.argv[index + 1];\n}", "title": "" }, { "docid": "e6370f3ec8192dbd9a6d6373cd625df8", "score": "0.5192145", "text": "static parseArguments(str) {\n if (!str || !(typeof str === 'string' || str instanceof String)) {\n return [];\n }\n\n // Parse can return an object, not just a string. See the `ParseEntry` type def for all types\n // We must map them all to strings. Filter out comments that will not be needed as well.\n return ShellQuote.parse(str)\n .filter(arg => !arg.comment)\n .map(arg => arg.pattern ?? arg.op ?? `${arg}`);\n }", "title": "" }, { "docid": "ae53b5cb3c718fbec703314ad962b15b", "score": "0.51904577", "text": "addArguments() {\n this.ap.addArgument([\"-f\", \"--file\"], {\n help: \"The JSON file to beautify.\"\n });\n this.ap.addArgument([\"-o\", \"--out\"], {\n help: \"The output file post beautify.\"\n });\n }", "title": "" }, { "docid": "0f3833ed7eaa4b528b28b8ba05a289c4", "score": "0.5187674", "text": "function prepareCommandLineArguments(cmdArguments, config) {\n var argument;\n\n for (argument in cmdArguments) {\n if (cmdArguments.hasOwnProperty(argument)) {\n if (cmdArguments[argument].indexOf(\"--sense=\") !== -1) {\n config.senseInstanceURL = cmdArguments[argument].split(\"--sense=\")[1];\n }\n else if (cmdArguments[argument].indexOf(\"--port=\") !== -1) {\n config.port = cmdArguments[argument].split(\"--port=\")[1];\n }\n else if (cmdArguments[argument].indexOf(\"--wait=\") !== -1) {\n config.wait = cmdArguments[argument].split(\"--wait=\")[1];\n }\n else {\n // no action\n }\n }\n }\n }", "title": "" }, { "docid": "592eb3f336591ae8eee79251e0e15e20", "score": "0.51861477", "text": "static setBuilderArgs() {\n const keystoreFilePathArg = new CommandArg('keystore-file-path',\n 'string', 'ksp', 'The keystore file path.', 1, true)\n const cliInputJSON = new CommandArg('cli-input-json',\n 'string', 'cij', 'Performs service operation based on the JSON string provided.', 1, true)\n return [keystoreFilePathArg, cliInputJSON]\n }", "title": "" }, { "docid": "596ea43e09a8406366ca76520f21b4e5", "score": "0.5182977", "text": "exitArglist(ctx) {}", "title": "" }, { "docid": "193db2ff02ebb42cec4c3cc0dfde39e8", "score": "0.51797324", "text": "function test_args() {\n return [];\n}", "title": "" }, { "docid": "9f416eec9ddc8e233e3aa39f1d7cad63", "score": "0.5175275", "text": "function normalizeArgs(args, exclude) {\n var result = [];\n args = splitArgs(args || []);\n exclude = splitArgs(exclude || []);\n args.slice(0).forEach(function (arg) {\n var val;\n if (arg && arg.indexOf && ~arg.indexOf('=')) {\n var kv = arg.split('=');\n arg = kv[0];\n val = kv[1];\n }\n if (/^-{1}[a-z]+/i.test(arg)) {\n var spread = arg.slice(1).split('').map(function (a) { return '-' + a; });\n if (val)\n spread.push(val);\n result = result.concat(spread);\n }\n else {\n result.push(arg);\n if (val)\n result.push(val);\n }\n });\n return filterArgs(result, exclude);\n}", "title": "" }, { "docid": "f22a860780dd13805c223712cab50c16", "score": "0.5167675", "text": "function setupOptions() {\n yargs\n // Help option\n .option('help', {\n describe: 'Help documentation',\n alias: 'h',\n })\n // Port Option\n .option('port',{\n describe: 'Port to bind on',\n alias: 'p',\n default: 3000,\n })\n // Show routes option\n .option('routes',{\n describe: 'Show available routes',\n alias: 'R'\n });\n}", "title": "" }, { "docid": "703d97e808093c22e6741e9d83a315bd", "score": "0.51584405", "text": "function preParseArgs(args) {\n const startArg = args[2];\n if (['-a', '--action'].includes(startArg)) {\n args.forEach( (element, index, array) => {\n if (['-h', '--help'].includes(element)) { \n array[index] = ''; \n }\n });\n } \n}", "title": "" }, { "docid": "b2fa9fee41aafaae63b4816bad26501b", "score": "0.5127544", "text": "function GetExeArgs()\n{\n\tconst UrlArgs = Pop.GetExeArguments();\n\t\n\t//\tturn into keys & values - gr: we're not doing this in engine! fix so they match!\n\tconst UrlParams = {};\n\tfunction AddParam(Argument)\n\t{\n\t\tlet [Key,Value] = Argument.split('=',2);\n\t\tif ( Value === undefined )\n\t\t\tValue = true;\n\t\t\n\t\t//\tattempt some auto conversions\n\t\tif ( typeof Value == 'string' )\n\t\t{\n\t\t\tconst NumberValue = Number(Value);\n\t\t\tif ( !isNaN(NumberValue) )\n\t\t\t\tValue = NumberValue;\n\t\t\telse if ( Value == 'true' )\n\t\t\t\tValue = true;\n\t\t\telse if ( Value == 'false' )\n\t\t\t\tValue = false;\n\t\t}\n\t\tUrlParams[Key] = Value;\n\t}\n\tUrlArgs.forEach(AddParam);\n\treturn UrlParams;\n}", "title": "" }, { "docid": "4f33f071099075e8b95bde5d8dc6a117", "score": "0.5117655", "text": "constructor(args, opts) {\n super(args, opts)\n // this.argument('appname', { type: String, required: true })\n\n // And you can then accstartess it later; e.g.\n this.log('')\n }", "title": "" }, { "docid": "d11277daf928ca262b837563711bbfeb", "score": "0.51164186", "text": "function parseCommandLine() {\n const optionDefinitions = [\n { name: 'server', type: String },\n { name: 'testfile', alias: 't', type: String },\n { name: \"outfile\", alias: 'o', type: String }\n ]\n\n try {\n const options = commandLineArgs(optionDefinitions)\n if (options.server == undefined || options.testfile == undefined) {\n printUsage()\n process.exit(-1)\n }\n\n if( options.testfile.endsWith(\"json\")){\n options.fileType = \"json\"\n }else{\n options.fileType = \"yaml\"\n }\n\n return options\n } catch (err) {\n console.log(err)\n printUsage()\n process.exit(-1)\n }\n}", "title": "" }, { "docid": "3767c4e154c90266ce25d6bba7b74fb4", "score": "0.51156527", "text": "constructor(args,opts) {\n\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n\n this.argument('appName', { type: String, required: false });\n this.argument('mappingAPI', { type: String, required: false });\n }", "title": "" }, { "docid": "1194e5c8cd351e4d12778a3b6fcc0955", "score": "0.51151735", "text": "_read_args() {\n const args = this._init_argparser().parseArgs();\n\n // TODO: This does not work.\n for (const [arg_key, value] of Object.entries(args)) {\n if (value === null)\n continue;\n\n this._set_option(arg_key, value);\n }\n }", "title": "" }, { "docid": "38971da7fd3b51c168be9ca9da2d309b", "score": "0.5101811", "text": "function postProcessPositionals (argv, positionalMap, parseOptions) {\n // combine the parsing hints we've inferred from the command\n // string with explicitly configured parsing hints.\n const options = Object.assign({}, yargs.getOptions())\n options.default = Object.assign(parseOptions.default, options.default)\n options.alias = Object.assign(parseOptions.alias, options.alias)\n options.array = options.array.concat(parseOptions.array)\n delete options.config // don't load config when processing positionals.\n\n const unparsed = []\n Object.keys(positionalMap).forEach((key) => {\n positionalMap[key].map((value) => {\n unparsed.push(`--${key}`)\n unparsed.push(value)\n })\n })\n\n // short-circuit parse.\n if (!unparsed.length) return\n\n const parsed = Parser.detailed(unparsed, options)\n\n if (parsed.error) {\n yargs.getUsageInstance().fail(parsed.error.message, parsed.error)\n } else {\n // only copy over positional keys (don't overwrite\n // flag arguments that were already parsed).\n const positionalKeys = Object.keys(positionalMap)\n Object.keys(positionalMap).forEach((key) => {\n [].push.apply(positionalKeys, parsed.aliases[key])\n })\n\n Object.keys(parsed.argv).forEach((key) => {\n if (positionalKeys.indexOf(key) !== -1) {\n // any new aliases need to be placed in positionalMap, which\n // is used for validation.\n if (!positionalMap[key]) positionalMap[key] = parsed.argv[key]\n argv[key] = parsed.argv[key]\n }\n })\n }\n }", "title": "" }, { "docid": "9a9272968926321675ce159be81f8e8c", "score": "0.50997025", "text": "getCommandArgs() {\n const args = [];\n\n // download path\n if (this.downloadPath) {\n args.push(`--output=${this.downloadPath}`);\n }\n\n // connections\n args.push(`-n ${this.connections}`);\n\n // max speed limit\n if (this.maxSpeed !== 0) {\n args.push(`-s ${this.maxSpeed}`);\n }\n\n // user-agent\n if (this.userAgent) {\n args.push(`-U ${this.userAgent}`);\n }\n\n // headers\n if (this.headers.length) {\n args.push(\n this.headers.reduce((prev, curr) => `${prev} -H '${curr.key}: ${curr.value}'`, '')\n );\n }\n\n // download url\n args.push(this.url);\n\n return args;\n }", "title": "" }, { "docid": "856fca33b15b89917deb6654be599267", "score": "0.5094422", "text": "function argLogger() { \n console.log('DEBUG: arg parsing')\n process.argv.forEach(function (val, index, array) {\n console.log(` ${index}: ${val}`);\n });\n}", "title": "" } ]
1c2cc625093457275438cd45cf4f89cb
After the user submits the meeting URL the next step is to fetch an auth token
[ { "docid": "cfe51fd845d9b26c155d3c07d20605e2", "score": "0.7588315", "text": "function getToken(evt) {\n var input = evt.target.querySelector('input'),\n meetingUrl = input.value,\n request = new XMLHttpRequest(),\n data;\n\n evt.preventDefault();\n console.log('Fetching auth token from meeting url:', meetingUrl);\n\n function guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n }\n\n var sessionId = guid();\n data = 'ApplicationSessionId=' + sessionId +\n '&AllowedOrigins=' + encodeURIComponent(window.location.href) +\n '&MeetingUrl=' + encodeURIComponent(meetingUrl);\n\n request.onreadystatechange = function () {\n if (request.readyState === XMLHttpRequest.DONE) {\n if (request.status === 200) {\n var response = JSON.parse(request.response);\n\n authDetails.discoverUrl = response.DiscoverUri;\n authDetails.authToken = \"Bearer \" + response.Token;\n\n console.log('Successfully fetched the anonymous auth token and discoverUrl', authDetails);\n displayStep(2);\n }\n else {\n console.error('An error occured, fetching the anonymous auth token', request.responseText);\n }\n }\n };\n\n request.open('post', 'http://webrtctest.cloudapp.net/getAnonTokenJob');\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(data);\n }", "title": "" } ]
[ { "docid": "3304b6151cdb2b11287a349ef3951a0d", "score": "0.63422096", "text": "function getToken() {\n var hangout_id, user_hangout_id, plus_id, ajax_data;\n\n hangout_id = gapi.hangout.getHangoutId();\n // temp testing\n user_hangout_id = gapi.hangout.getParticipantId();\n plus_id = gapi.hangout.getParticipantById(user_hangout_id).id;\n alert(\"hangout_id = \" + hangout_id + \", user_hangout_id = \" + user_hangout_id + \", plus_id = \" + plus_id);\n ajax_data = {\n hangout_id: \"12345\",\n plus_id: plus_id\n };\n\n $.ajax({\n url: hostname_ + \"api/join_game\",\n success: function (data) {\n openChannel(data.channel_token);\n },\n data: ajax_data,\n dataType: \"jsonp\"\n });\n}", "title": "" }, { "docid": "832213ea4a1db2b266da4a42668a6756", "score": "0.6163883", "text": "async function fetchAuthToken() {\n const body = {\n grant_type: process.env.GRANT_TYPE,\n client_id: process.env.CLIENT_ID,\n client_secret: process.env.CLIENT_SECRET,\n audience: process.env.AUDIENCE\n };\n\n return await axios.post(process.env.HERO_AUTH_URL, body, {\n headers: { 'content-type': 'application/json'}\n })\n}", "title": "" }, { "docid": "053fb591d40b932eef26390c04696eff", "score": "0.6125656", "text": "function startAuthentication() {\n const theUrl =\n 'https://enterprise-drive-7194-dev-ed.lightning.force.com/services/oauth2/authorize?response_type=token&client_id=3MVG9KlmwBKoC7U3XOYyYdDI0wgOI4rnQD16irKpNO5KoUM.pH8.KR5.uA1YnEL4Pp2OsBcuXyI8s6O5jxbNt&redirect_uri=https://tracking-times.herokuapp.com/';\n\n var xmlHttp = new XMLHttpRequest();\n //console.log('do auth');\n xmlHttp.onreadystatechange = function() {\n if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {\n console.log(xmlHttp.responseText);\n }\n };\n xmlHttp.open('GET', theUrl, true); // true for asynchronous\n xmlHttp.send(null);\n}", "title": "" }, { "docid": "bd0b8965bac484b744d78aa74306de47", "score": "0.609647", "text": "function updateToken() {\n // Login to service and get auth token\n request.post(gate.login, {\n json: {\n 'email' : settings.tolotrack.user,\n 'password' : settings.tolotrack.pass,\n }},\n function(error, response, body){\n // TODO Print error if it exists\n // Save auth token to settings\n gate.token = body.response.authentication_token;\n jsonupdate (settingsfile, (data) => {\n data.tolotrack.token = gate.token\n return data\n });\n }\n );\n}", "title": "" }, { "docid": "64564e5eb989a1be31b8c59fd097c86b", "score": "0.60821074", "text": "function requestAPIToken(credentials){\n\n restClient.post('/authenticate', credentials, function(resterr, restreq, restres, restobj) {\n //check if error\n if(resterr){\n assert.ifError(resterr);\n }\n\n console.log('response token and other: \\n %j \\n', restobj); \n\n APItoken = restobj.token;\n exports.APItoken = APItoken;\n\n });\n}", "title": "" }, { "docid": "c2d91f87ad35f525a4aea7cc6384d93b", "score": "0.6079531", "text": "async function getToken(e) {\n\n e.preventDefault()\n\n let formData = new FormData()\n\n formData.append('username', username)\n formData.append('password', password)\n\n let options = {\n method: \"POST\",\n body: formData,\n }\n\n try {\n const url = `https://api.mediehuset.net/token`\n const response = await fetch(url, options)\n const data = await response.json()\n setToken(data)\n }\n catch (error) {\n console.log(error)\n }\n }", "title": "" }, { "docid": "b0e349357b393fcab0fdd87ea1c07de1", "score": "0.6006343", "text": "async function complete_auth() {\n var formData = new FormData();\n formData.set(\"id_token\", d.credential);\n try {\n await axios_inst.post('api/me', formData);\n props.setAuthRequired(false);\n } catch(e) {\n setLoginError(true);\n }\n }", "title": "" }, { "docid": "a9f81f05282d453deb711086d3466347", "score": "0.59837806", "text": "function getToken(){\n var queryURL = \"https://api.petfinder.com/v2/oauth2/token\";\n $.ajax({\n header: origin,\n url: queryURL,\n method: \"POST\",\n data:{\"grant_type\":\"client_credentials\",\n \"client_id\":\"C38uh1DS4F1g75CUZCu8m7iq2hTY5358shsEX4IttueHZjaDMt\",\n \"client_secret\":\"AUqzbULUZJs5KL1j6T6iEoRxwIqNuyH3UMXCqvYU\"\n } \n }).then(function(response) {\n var now = Date.now();\n var token = {\n value: response.access_token,\n expiry: now\n }\n localStorage.setItem(\"token\", JSON.stringify(token));\n })\n}", "title": "" }, { "docid": "07f93a9e9fb798554104be216516c01c", "score": "0.5968675", "text": "function getAuthToken() { return auth; }", "title": "" }, { "docid": "95dd1d8d58e0c481ff5930ca135412c9", "score": "0.5898555", "text": "function oauthSignIn() {\n // Google's OAuth 2.0 endpoint for requesting an access token\n var oauth2Endpoint = 'https://accounts.spotify.com/authorize';\n\n // Create <form> element to submit parameters to OAuth 2.0 endpoint.\n var form = document.createElement('form');\n form.setAttribute('method', 'GET'); // Send as a GET request.\n form.setAttribute('action', oauth2Endpoint);\n\n // Parameters to pass to OAuth 2.0 endpoint.\n var params = {\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: 'token',\n scope: 'user-read-private user-read-email',\n state: 'pass-through value',\n };\n\n // Add form parameters as hidden input values.\n for (var p in params) {\n var input = document.createElement('input');\n input.setAttribute('type', 'hidden');\n input.setAttribute('name', p);\n input.setAttribute('value', params[p]);\n form.appendChild(input);\n }\n\n // Add form to page and submit it to open the OAuth 2.0 endpoint.\n document.body.appendChild(form);\n form.submit();\n}", "title": "" }, { "docid": "983e2366d1beedf929a419b3775a65d4", "score": "0.5892564", "text": "function authorize() \n{\n\tvar request = require('request');\n request(\n\t{\n url: 'https://api-gw.it.umich.edu/token',\n method: 'POST',\n auth: \n\t\t{\n user: 'Client ID',\n pass: 'Client Secret'\n },\n form: \n\t\t{\n 'grant_type': 'client_credentials'\n }\n }, function(err, res) \n\t{\n var json = JSON.parse(res.body);\n console.log(\"Access Token:\", json.access_token);\n accessToken = json.access_token;\n });\n}", "title": "" }, { "docid": "6bb67e0c5682238a0fb70adb9ba24279", "score": "0.58884704", "text": "login () {\n this.acquireToken()\n }", "title": "" }, { "docid": "e221e31646ad271f1dec9c06e1b2157e", "score": "0.5875262", "text": "async getAuthToken() {\n try {\n const reponse = await axios.post(\"https://my.farm.bot/api\" + \"/tokens\", {\n user: {\n email: this.farmbotInformation.email,\n password: this.farmbotInformation.password,\n },\n });\n\n this.farmbotInformation.id = reponse.data.token.unencoded.bot;\n this.farmbotInformation.authToken = reponse.data.token.encoded;\n\n return true;\n } catch (err) {\n console.log(\"Error email or password invalid\");\n return false;\n }\n }", "title": "" }, { "docid": "37aa82719eea816ef12532a67f3af02b", "score": "0.58585274", "text": "function authStart(url, {email, password, returnSecureToken}) {\n\tconst authData = {\n\t\temail, password, returnSecureToken\n\t}\n\t//console.log(url)\n\treturn axios.post(url, authData).then(response => {\n\t\t\tconst expirationDate = new Date(new Date().getTime() + response.data.expiresIn * 1000);\n\t\t\tlocalStorage.setItem('token', response.data.idToken);\n\t\t\tlocalStorage.setItem('expirationDate', expirationDate.getTime());\n\t\t\tlocalStorage.setItem('userId', response.data.localId);\n\t\t\t//authSuccess(response.data.idToken, response.data.localId);\n\t\t\tconsole.log(response);\n\t\t\treturn {\n\t\t\t\tidToken: response.data.idToken,\n\t\t\t\tlocalId: response.data.localId\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\t//authFail(err.response.data.error);\n\t\t\treturn {error: err.response.data.error};\n\t\t})\n}", "title": "" }, { "docid": "6055a24e031c71f2cd7bdedefc2c443e", "score": "0.5856666", "text": "function get_token() {\n\n var form = {\n grant_type: \"client_credentials\",\n client_id: \"F13072A7-87CB-4BE4-A834-35985AC049C8\",\n client_secret: \"e2f304ec-b731-42e1-a240-290651e1df68\",\n scope: \"application\"\n };\n\n var formData = querystring.stringify(form);\n var content_length = formData.length;\n\n return rp.post({\n \"headers\": {\n \"Content-Length\": content_length,\n \"content-Type\": \"application/x-www-form-urlencoded\"\n },\n \"url\": \"https://identity.primaverabss.com/connect/token\",\n \"body\": formData\n })\n}", "title": "" }, { "docid": "ed26fbe1ed9da57cdf7a0612e014e5c1", "score": "0.58412325", "text": "function getToken(){\n fetch('https://api.petfinder.com/v2/oauth2/token', {\n method: 'POST',\n body: `grant_type=client_credentials&client_id=${apiKey}&client_secret=${secret}`,\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\" \n }\n })\n .then(function(response) {\n return response.json();\n })\n .then(function(data) {\n token=data;\n });\n}", "title": "" }, { "docid": "1b34d508ec1a069ed55127b417b23289", "score": "0.5822452", "text": "function getToken () {\n return new Promise(function (resolve, reject) {\n rp(TOWER_VARS.authOptions).then(function (response) {\n TOWER_VARS.token.value = response.token;\n TOWER_VARS.token.expires = response.expires;\n debug('getToken: ' + JSON.stringify(response));\n resolve(response);\n }).catch( function (err) {\n //console.log('Error occurred requesting token ' + err);\n reject(err);\n });\n });\n}", "title": "" }, { "docid": "8ea36926844860970469c64b024184b5", "score": "0.5790994", "text": "async function sendAuthorizationRequest() {\n let token = \"\";\n await fetch(\"https://v4.lib.virginia.edu/authorize\", {\n method: \"POST\",\n })\n .then((response) => {\n return response.text();\n })\n .then((serverToken) => {\n token = serverToken;\n })\n .catch((error) => {\n console.error(error);\n });\n return token;\n}", "title": "" }, { "docid": "3396d8f50123527303a47ffb3f087d93", "score": "0.5750974", "text": "function loginWithUber(){\n if(getToken()){\n window.location.href = \"/form\"\n }else{\n let loginURL = \"https://login.uber.com/oauth/v2/authorize?client_id=JYapbqi3iPPitJR6PHifGN0To2qhsPUi&response_type=code\";\n window.location.href = loginURL;\n }\n}", "title": "" }, { "docid": "2135ff061c1aec511fa7817fcfb17696", "score": "0.5750281", "text": "function echoAuth() {\n var payload = {\n 'email' : scriptProperties.getProperty('ECHO_EMAIL'),\n 'password': scriptProperties.getProperty('ECHO_PASSWORD') \n };\n var options = {\n 'method' : 'post',\n 'payload' : payload\n };\n var response = UrlFetchApp.fetch('https://groundwire.echoglobal.org/sessions.json', options);\n var dataJSON = JSON.parse(response.getContentText()); // Converts the response data into JSON and saves it to the dataJSON variable\n token = dataJSON.auth_token;\n return token;\n}", "title": "" }, { "docid": "92709fbcc505f011e8255e96a9ebd2d5", "score": "0.5744899", "text": "async setup(_expired) {\n // Get a token\n let TOKEN = null; //returned to the chache library\n if (this.isSet()) {\n trace('setup: token is already set on self, using that: ', this.token);\n TOKEN = this.token;\n } else {\n trace('setup: token is not set, checking tokenDB');\n // get token from local cache\n TOKEN = await this.checkTokenDB();\n\n if (!TOKEN || _expired) {\n //local cache does not have a token\n let urlObj = urlLib.parse(this._domain);\n let result;\n // Open the browser and the login popup\n if (typeof window === \"undefined\") {\n result = await oadaIdClient.node(urlObj.host, this._options);\n } else {\n // the library itself detects a browser environment and delivers .browser\n var gat = Promise.promisify(oadaIdClient.getAccessToken);\n result = await gat(urlObj.host, this._options);\n }\n TOKEN = result.access_token;\n // debug(\"setup token -> access token:\", result.access_token);\n this.put(TOKEN);\n } //if !TOKEN\n } //else\n return TOKEN;\n }", "title": "" }, { "docid": "16503f312468cb33a83048a338393a14", "score": "0.57330817", "text": "authenticate(credentials) {\n const { email, password } = credentials;\n const data = JSON.stringify({\n email,\n password,\n });\n\n // specify the request options\n const reqOptions = {\n url: this.tokenEndpoint,\n method: 'POST',\n mode: 'cors',\n body: data,\n dataType: JSON,\n headers: {\n 'Content-Type': 'application/json',\n },\n };\n\n return new Promise((resolve, reject) => {\n fetch(this.tokenEndpoint, reqOptions)\n .then((response) => {\n response.json()\n .then((data) => {\n // use run to wrapp asyn operation in ember\n run(() => {\n if (! data.error) {\n const [token, id] = data.access_token;\n resolve({token, user_id: id});\n } else {\n reject(data.error);\n }\n });\n }, (error) => {\n run(() => {\n reject(error);\n });\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }", "title": "" }, { "docid": "2a8d04a9f7f844fab91f58c8b23c59f0", "score": "0.5730217", "text": "async function getToken(outterreq, finalRes) {\r\n\r\n // Send the data as application/x-www-form-urlencoded\r\n // Help setting up the code to send data in this way obtained from:\r\n // https://www.codexpedia.com/node-js/node-js-making-https-post-request-with-x-www-form-urlencoded-data/\r\n\r\n var postData = querystring.stringify({\r\n code: outterreq.query.code,\r\n client_id: \"WaXZPC8klI4IXDaquw0BDKfGN086p1yM\",\r\n client_secret: \"YgM6UXRnt212KvFP5JLYAPKvK8cr5SurlqhkfDVuM7MGJ_9dZWcLWxhNweLy3dyR\",\r\n redirect_uri: \"https://childrem-cs493-final-project.appspot.com/login/userInfo\",\r\n grant_type: \"authorization_code\"\r\n });\r\n\r\n var options = {\r\n host: 'dev-plsxev-m.auth0.com',\r\n path: '/oauth/token',\r\n method: 'POST',\r\n headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': postData.length}\r\n };\r\n\r\n var req = https.request(options, function (res) {\r\n var result = '';\r\n res.on('data', function (chunk) {\r\n result += chunk;\r\n });\r\n \r\n res.on('end', function () {\r\n // Deal with returned response here\r\n \r\n let formattedResult = JSON.parse(result);\r\n\r\n // Help using the jsonwebtoken library obtained from:\r\n // https://github.com/auth0/node-jsonwebtoken\r\n\r\n var decoded = jwt.decode(formattedResult.id_token);\r\n\r\n \r\n context.id_token = formattedResult.id_token;\r\n\r\n // If this is a new user to the app, put them in the datastore database\r\n const userList = get_all_entities(USER)\r\n .then( (UserList) => {\r\n let UserNameFound = false;\r\n for (item of UserList) {\r\n if(item.sub === decoded.sub) {\r\n UserNameFound = true;\r\n }\r\n }\r\n\r\n if (!UserNameFound) { // This is a new user so need to add them to the database\r\n post_user(decoded.sub)\r\n .then( () => {\r\n finalRes.render('userInfo', context);\r\n });\r\n }\r\n\r\n else {\r\n finalRes.render('userInfo', context);\r\n }\r\n\r\n });\r\n \r\n });\r\n\r\n res.on('error', function (err) {\r\n console.log(err);\r\n });\r\n\r\n });\r\n\r\n // send the request with our form data\r\n\r\n req.write(postData);\r\n req.end();\r\n\r\n } // CLOSES TOKEN FXN", "title": "" }, { "docid": "b9a1b822a395e7d0010ab49817a50c08", "score": "0.5729477", "text": "async function verify() {\n \n // Get Google ticket info\n const ticket = await client.verifyIdToken( {\n idToken: token,\n audience: [ WEB_CLIENT_ID, IOS_CLIENT_ID ]\n } );\n \n console.log( \"User: \" + ticket.getPayload().email );\n res.locals.googleTokenPayload = ticket.getPayload();\n res.locals.userNetworkObject = {\n google_id: ticket.getPayload().sub,\n display_name: ticket.getPayload().email,\n google_access_token: token,\n admin_rights: false,\n user_rights: false,\n dev: false\n };\n \n } // Verify function", "title": "" }, { "docid": "bf6a4445a9ed7ab7cf501c70d69b9c7b", "score": "0.572338", "text": "function receiveAuth() {\n transitionToDay({dayKey: dateUtils.getCurrentDayKey()});\n}", "title": "" }, { "docid": "ad396d1e31f10423b83c436eccbccfd2", "score": "0.57173556", "text": "validate(t) {\n this.setState({ loading: true });\n fetch('//' + window.location.host + '/api/Members/Validate', {\n method: 'get',\n headers: {\n 'Authorization': 'Bearer ' + t\n }\n })\n .then(response => {\n if (response.status === 401) {\n //if token is not valid than remove token, set myself object with empty values\n localStorage.removeItem(\"token\");\n this.setState({ loggedin: false, loading: false, token: null });\n } else if (response.status === 200) {\n //if token is valid vet user information from response and set \"myself\" object with member id and name.\n //set state joinmeeting to true so that it does not ask for name and other info from user. Once the state\n //is set then start signalr hub\n response.json().then(data => {\n //console.log(data);\n\n this.setState({ loggedin: true, loading: false, myself: data });\n });\n\n //fetch contacts after validation is done\n this.fetchContacts();\n }\n });\n }", "title": "" }, { "docid": "3c9acc1a8221306bd1d9aaf77ec26cfe", "score": "0.5692064", "text": "async authenticate () {\n // Don't re-authenticate if we have a token\n if (this.accessToken !== undefined) {\n return\n }\n\n // Setup the API call\n const params = {\n 'grant_type': 'client_credentials'\n }\n const headers = {\n 'Authorization': Buffer.from(`${config.VIMEO_CLIENT_ID}:${config.VIMEO_CLIENT_SECRET}`).toString('base64')\n }\n // Make the call\n const response = await this.client.post(config.VIMEO_AUTH_PATH, {params, headers})\n // TODO: Re-try if there's an error making the request or we don't get what we expect back\n // Store the access token in memory\n this.accessToken = response['access_token']\n }", "title": "" }, { "docid": "94b66199dfda27c4b74b38881f417797", "score": "0.56905216", "text": "function doAuthorize() {\n //Create new authenticator\n var authenticator = new OfficeHelpers.Authenticator();\n\n //Parameters for authenticator\n var client_id = '40f52d05-f5d8-4b29-9356-4248678802ba'; //Replace with another valid application id after register app with microsoft portal\n var configs = {\n redirectUrl: 'https://mroishii.github.io/MessageRead.html',\n scope: 'https://graph.microsoft.com/mail.readwrite'\n };\n\n // register Microsoft (Azure AD 2.0 Converged auth) endpoint using parameters)\n authenticator.endpoints.registerMicrosoftAuth(client_id, configs);\n\n // Authentication for the default Microsoft endpoint\n authenticator\n .authenticate(OfficeHelpers.DefaultEndpoints.Microsoft)\n .then(function (token) { /* Microsoft Token */\n //console.log(token);\n $('#errormessage').text(\"Authorized\");\n var inThirtyMinutes = new Date(new Date().getTime() + 30 * 60 * 1000);\n Cookies.set('access_token', (String)(token.access_token), { expires: inThirtyMinutes });\n location.reload();\n })\n .catch(OfficeHelpers.Utilities.log);\n }", "title": "" }, { "docid": "29bc7fca36fbd761b007af6060f8ae36", "score": "0.5685076", "text": "async function oauth() {\n // Get the token from local storage\n let application_token = storageDriver(\n { key: \"application_token\" },\n \"local\",\n \"get\"\n );\n\n if (application_token == null) {\n // If token is not found\n return fetchNewAccessToken();\n } else {\n application_token = JSON.parse(application_token);\n\n // Check whether the token has timed-out\n let response = checkTimeout(application_token);\n\n if (response[\"status\"] == \"Miss\") {\n application_token = await fetchNewAccessToken();\n response[\"message\"] = \"Previous Token timed-out. Generated new token.\";\n } else {\n response[\"message\"] = \"Previous Token is still valid.\";\n }\n\n response[\"token\"] = application_token[\"token\"];\n return response;\n }\n}", "title": "" }, { "docid": "7eca528c44c2fc43e4b044a9e8e10f82", "score": "0.5684066", "text": "initAuth() {\r\n return new Promise(async (resolve, reject) => {\r\n try {\r\n const AuthenticatedUser = await GetAuthByToken(this.request.body.token)\r\n Responser.send(this.response, 200, \"Success\", AuthenticatedUser )\r\n }catch(err) { reject({ type: \"BadRequest\", message: err.message }) }\r\n })\r\n }", "title": "" }, { "docid": "9e3d5ed29470f3953456dbb869ffc024", "score": "0.5670298", "text": "async function postTokenRequest() {\r\n const result = await fetch('https://accounts.spotify.com/api/token', {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n // One string containing userid and user secret\r\n 'Authorization': `Basic ${credentials}` \r\n },\r\n body: 'grant_type=client_credentials'\r\n });\r\n\r\n const data = await result.json();\r\n return data.access_token\r\n}", "title": "" }, { "docid": "e4af968b792a2ab6e1a60f4fdf630d4b", "score": "0.56612533", "text": "function getToken() {\n const tokenpromise = axios.request({\n method: 'POST',\n url: authData.token_uri,\n headers: {'content-type': 'application/x-www-form-urlencoded'},\n data: qs.stringify({\n 'grant_type': 'client_credentials',\n 'client_id': authData.client_id,\n 'client_secret': authData.client_secret,\n 'audience': authData.audience[0]\n })\n });\n return tokenpromise;\n}", "title": "" }, { "docid": "35ee9106f029b66775e17ba30ae908f7", "score": "0.5646073", "text": "function getToken(callback){\n request.post({\n url: 'https://www.arcgis.com/sharing/rest/oauth2/token/',\n json:true,\n form: {\n 'f': 'json',\n 'client_id': '8fGZ5Sg9QzfWu0Lc',\n 'client_secret': 'fcf940813e67440dba5335a0fc1b9f3a',\n 'grant_type': 'client_credentials',\n 'expiration': '1440'\n }\n }, function(error, response, body){\n console.log(body.access_token);\n callback(body.access_token);\n });\n}", "title": "" }, { "docid": "8a255ad89af106514fd53f3b2649fcaa", "score": "0.56319493", "text": "function getAuth() {\n // Auth Route\n fetch(`https://app-5fyldqenma-uc.a.run.app/Users/` + route.params.UserId + `/Auth`, {\n method: 'GET',\n headers : {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'Authorization': 'Bearer ' + route.params.token\n },\n })\n .then(\n function(response) {\n if (response.status === 200 || response.status === 201) {\n // Successful GET\n // Set fields to correct values\n response.json().then(function(data) {\n setName(data.name);\n setEmail(data.email);\n setPassword(data.password);\n });\n } else {\n navigation.navigate(\"Login\");\n }\n }\n )\n .catch(function(err) {\n });\n }", "title": "" }, { "docid": "73ba8c0405030cc8b935e7494ed0cfa7", "score": "0.5625847", "text": "function getTokenAndJoinRoom(){\n let roomDetails = getRoomDetails();\n roomName = roomDetails.roomName;\n // var serverUrl = 'http://0.0.0.0:8080/';\n var serverUrl = 'https://twilio-video-twiliovideo.a3c1.starter-us-west-1.openshiftapps.com/';\n $.post(serverUrl + 'createRoom', {\n 'roomId': roomName,\n 'type': roomDetails.type\n }, function(data) {\n identity = data.identity;\n if (!roomName) {\n return;\n }\n log(\"Joining room '\" + roomName + \"'...\");\n var connectOptions = {\n name: roomName,\n audio: false,\n video: false\n };\n // Join the Room with the token from the server\n Video.connect(data.token, connectOptions).then(roomJoined, function(error) {\n logError('Could not connect to Twilio: ' + error.message);\n });\n \n });\n}", "title": "" }, { "docid": "3214e88a9ab79f339c5987613bf98994", "score": "0.56151754", "text": "function getForgeToken(callback) {\n jQuery.ajax({\n url: '/api/forge/oauth/public',\n success: function(res) {\n callback(res.access_token, res.expires_in);\n }\n });\n}", "title": "" }, { "docid": "29e4a6e28b5516e3d2a40c97e84ffb21", "score": "0.561331", "text": "function getUserAuthentication()\n{\n\n var url = window.location.href;\n var url_Split = url.split(\"/\");\n var token_id_final = \" \"\n var access_token = \" \"\n\n if(url.indexOf('&') > -1)\n {\n token_split = url_Split[url_Split.length - 1].split(\"&\");\n id_token = token_split[0].split(\"=\");\n var token_id_final = id_token[1];\n access_token_split = token_split[1].split(\"=\");\n var access_token = access_token_split[1];\n }\n\n return token_id_final\n\n}", "title": "" }, { "docid": "782cf475da0122b4bcf1fd7b416df3e5", "score": "0.56121606", "text": "function enterOtpbyemail(){\n\n var token = $(\"input[name=_token]\").val();\n var activation_token = $(\"input[name=activation_token]\").val();\n \n var datas = {\n _token:token,\n activation_token:activation_token\n };\n $(\".pleasewait\").html('Please wait...');\n // Ajax Post \n $.ajax({\n type: \"post\",\n url: 'http://112.196.38.115:4154/apexloads/byemailotp',\n data: datas,\n cache: false,\n dataType: \"json\",\n success: function (data)\n {\n if (data.success == true) {\n toastr.success(data.message);\n $(\".pleasewait\").html('Submit');\n $('#login').modal('show');\n $('#enterOtp').hide('show');\n // window.location.href = 'http://112.196.38.115:4154/apexloads/web/create-profile'; \n \n }else {\n toastr.error(data.message);\n $(\".pleasewait\").html('Submit');\n\n }\n }\n });\n return false;\n}", "title": "" }, { "docid": "6beafb81ecf7055a3c262881ad61f817", "score": "0.56095374", "text": "async getAuth ( ) {\n const AUTHORIZATION = 'Basic M0o3c2ZjQnhrSG4xYkZZbjdrdzBSVVAzQ1JNYTpOZmpMOXV2b0llallMZnIwR3RuT3dORllPcDRh'\n const PATH = 'token'\n const result = await fetch( `${ BASE_API_URL }${ PATH }`, {\n method: 'POST',\n headers: { Authorization: AUTHORIZATION, 'Content-Type': CONTENT_TYPE },\n body: getAccesEviroment ( )\n })\n .then( async ( query ) => await query.json ( ) )\n .catch ( error => console.log ( 'error', error ) ) \n return result\n }", "title": "" }, { "docid": "93bf8d92637194c712ed534fb2aa43ec", "score": "0.5609224", "text": "function token(req, res, next) {\t\t\n\t\treq.assert('grant_type', 'Invalid grant_type required').notEmpty();\n\t\treq.assert('appid', 'Invalid appid required').notEmpty();\n\t\treq.assert('secret', 'Invalid secret required').notEmpty();\n\t\t\n\t var errors = req.validationErrors();\n \tif (errors) {\n\t\t\tres.json({\n\t\t\t\t\"errcode\":40013,\n\t\t\t\t\"errmsg\":\"invalid appid\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(req.query['grant_type'] != 'client_credential'){\n\t\t\tres.json({\n\t\t\t\t\"errcode\":40014,\n\t\t\t\t\"errmsg\":\"invalid grant_type\"\n\t\t\t});\n\t\t\treturn;\n\t\t} \n\t\t\n\t\treturn res.json({\n\t\t\t\"access_token\":\"ACCESS_TOKEN\",\n\t\t\t\"expires_in\":7200\n\t\t});\n\t}", "title": "" }, { "docid": "024ed1938512f5572ce08501cfedb0e7", "score": "0.56045043", "text": "async function makeMeeting() {\n //rotate around the emails used so multiple meetings can happen concurrently\n const emailCounter = (await Counter.find({name:'email'}))[0];\n const emails = ['[email protected]','[email protected]', '[email protected]','[email protected]'];\n const email = emails[emailCounter.value];\n emailCounter.value = (emailCounter.value + 1) % emails.length;\n emailCounter.save();\n\n var options = {\n url: 'https://api.zoom.us/v2/users/' + email + '/meetings',\n method: 'POST',\n data: {\n type: 2,\n start_time: new Date().toISOString(),\n settings: {\n host_video: true,\n participant_video: true,\n join_before_host: true,\n mute_upon_entry: false,\n approval_type: 3,\n audio: 'both',\n auto_recording: 'none',\n enforce_login: false,\n waiting_room: false,\n meeting_authentication: false,\n },\n },\n headers: {\n 'User-Agent': 'Zoom-api-Jwt-Request',\n 'content-type': 'application/json',\n 'Authorization': `bearer ${token}`,\n },\n }\n\n const response = await axios(options);\n return response.data.join_url;\n}", "title": "" }, { "docid": "e587910f468a6815732467ee4ebcd953", "score": "0.55948216", "text": "async function verify( token ) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID, // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n const payload = ticket.getPayload();\n // const userid = payload['sub'];\n\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n return {\n userName: payload.name,\n userMail: payload.email,\n img: payload.picture,\n google: true,\n }\n}", "title": "" }, { "docid": "ae5128d1038576d4e359d1dc91dc0001", "score": "0.5593383", "text": "async refreshTokens(bot) {\n\t\tawait fetch(`https://id.twitch.tv/oauth2/token?client_id=${bot.config.api_keys.twitch.clientID}&client_secret=${bot.config.api_keys.twitch.clientSecret}&grant_type=client_credentials`, {\n\t\t\tmethod: 'POST',\n\t\t}).then(res => res.json()).then(data => {\n\t\t\taccess_token = data.access_token;\n\t\t}).catch(e => console.log(e));\n\t}", "title": "" }, { "docid": "ae35b8a9a994b3c5c976bbf7348ff6dc", "score": "0.5580746", "text": "function handleAuthClick(event) {\n // gapi.auth2.getAuthInstance().signIn();\n console.log(\"handleAuthClick\");\n console.log(tokenClient);\n\n tokenClient.callback = async (resp) => {\n if (resp.error !== undefined) {\n throw (resp);\n }\n // document.getElementById('signout_button').style.visibility = 'visible';\n // document.getElementById('authorize_button').innerText = 'Refresh';\n // await listMajors();\n console.log(resp);\n localStorage.setItem(\"clientToken\", JSON.stringify(gapi.client.getToken()));\n updateSigninStatus(true);\n };\n\n if (gapi.client.getToken() === null) {\n // Prompt the user to select a Google Account and ask for consent to share their data\n // when establishing a new session.\n tokenClient.requestAccessToken({prompt: 'consent'});\n } else {\n // Skip display of account chooser and consent dialog for an existing session.\n tokenClient.requestAccessToken({prompt: ''});\n }\n}", "title": "" }, { "docid": "b58a032a78e74679daa4dff93c6acab0", "score": "0.5572008", "text": "function getToken() {\n chrome.identity.getAuthToken({'interactive': interactive}, function (token) {\n if (!chrome.runtime.lastError) {\n // Check the token is available or not\n access_token = token;\n requestStart();\n } else {\n callback(chrome.runtime.lastError);\n }\n });\n }", "title": "" }, { "docid": "eb0919f92caeb462d03b9f2069d57489", "score": "0.55697787", "text": "function doGet(e) { \n UserProperties.setProperty(tokenPropertyName, '');\n if(e.parameters.code){//if we get \"code\" as a parameter in, then this is a callback. we can make this more explicit\n getAndStoreAccessToken(e.parameters.code);\n Logger.log(\"state = \" + e.parameters.state);\n return HtmlService.createHtmlOutput(\"<html><h2>\"+populateLinkedInData(true, e.parameters.state)+\"</h1></html>\");\n }\n else if(isTokenValid()){//if we already have a valid token, go off and start working with data \n return HtmlService.createHtmlOutput(\"<html><h2>\"+populateLinkedInData(false,'')+\"</h1></html>\");\n }\n else {//we are starting from scratch or resetting\n return HtmlService.createHtmlOutput(\"<html><h1>Fetch LinkedIn Data</h1><a href='\"+getURLForAuthorization()+\"'>click here to start</a></html>\");\n } \n}", "title": "" }, { "docid": "4b21243e73113dfdd6c9a480e8b521b5", "score": "0.5568471", "text": "async requestRoute(ctx) {\n const { utils } = this.auth;\n // Validate the mode and email\n let mode = this.auth.validateAuthMode(ctx.req.query.mode);\n let email = this.auth.validateEmail(ctx.req.query.email);\n // Create an registration token\n const auth = utils.jwtSign({\n typ: 'reg',\n mode: mode\n }, {\n subject: utils.hashEmail(email)\n });\n // Generate the link (JWTs should be url safe)\n const link = this.auth.makeAbsoluteLink('email', `check?token=${auth}`);\n // Send the email and return an 'ok' response\n try {\n await mail_1.default.send({\n to: email,\n from: this.config.fromEmail,\n subject: this.config.emailSubject,\n html: this.config.emailBody(email, link)\n });\n this.auth.sendData(ctx, 'Email sent');\n }\n catch (error) {\n throw new Error('Failed to send auth email');\n }\n }", "title": "" }, { "docid": "d9de58890149c276b632346080ceb28a", "score": "0.55676675", "text": "function create_token(ev) {\n api.submit_login(props.login);\n }", "title": "" }, { "docid": "884c78c6ee1fd0b690a1e4cc12bbc943", "score": "0.5567511", "text": "function setToken() {\r\n $.ajax({\r\n type: \"POST\",\r\n beforeSend: function (request) { // should probably be secret, but prototyped for now\r\n request.setRequestHeader(\"Authorization\", \"Basic \" +\r\n \"NWY0MGUwNmFhZGM5NGFlOGE0YjI1OTA3NDBjMWViMzU6ZGZlY2I3Y2JhY2ZiNDVmN2FkYjkzYmU1OTQyZTkzMTU=\");\r\n },\r\n contentType: \"application/x-www-form-urlencoded\",\r\n url: \"https://accounts.spotify.com/api/token\",\r\n data: \"grant_type=client_credentials\",\r\n success: function (tokenObj) {\r\n accessToken = tokenObj.access_token;\r\n console.log(accessToken);\r\n }\r\n });\r\n }", "title": "" }, { "docid": "e3e4ebcbc6d3bdad53087a55cbda7f74", "score": "0.5566909", "text": "async function verify(token) {\n var ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID, // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n\n var payload = ticket.getPayload();\n //const userid = payload['sub'];\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n return {\n name: payload.name,\n email: payload.email,\n img: payload.picture,\n google: true\n }\n}", "title": "" }, { "docid": "d82e2a235646e4969bc57ed53fe053ad", "score": "0.5564503", "text": "function getAccessToken(email,accessToken){\n \n fetch('https://www.universal-tutorial.com/api/getaccesstoken', {\n method: 'GET',\n headers: {\n \"api-token\": accessToken,\n \"user-email\": email,\n \"Accept\": \"application/json\"\n }\n })\n .then(response => response.json())\n .then(data => {\n console.log(data)\n });\n }", "title": "" }, { "docid": "bebd1c239f91719c8a95dd8a4ee32435", "score": "0.5554218", "text": "function tokenObtained(response) {\n\t\t\tvar params = {server:\"http://www.arcgis.com/sharing/rest\",ssl:false}\n\t\t\tparams.token = response.access_token;\n\t\t\tparams.expire = response.expires_in;\n\t\t\tparams.userId = responseObject.ArcGISOnlineClientID;\n\t\t\tesri.id.registerToken(params);\n\t\t\tPostInitialization(responseObject,extent,zoomExtent);\n\t\t\tInternationalization(true); //CanMod: Launch the internationalization function in internationalization.js along with the code block\n\t\t}", "title": "" }, { "docid": "e093d018b2f58e228c9fd5fd283a2d12", "score": "0.55454767", "text": "async getAppToken() {\n const tokenData = await this.requestToken({\n grant_type: 'client_credentials',\n });\n\n this.appToken = tokenData.accessToken;\n }", "title": "" }, { "docid": "5894603b52722537fb4f278848a80c6b", "score": "0.5535741", "text": "login() {\n\n // Initialize the auth request.\n hello.init( {\n aad: applicationId\n }, {\n redirect_uri: redirectUri,\n scope: 'user.readbasic.all+mail.send+files.read'\n });\n\n hello.login('aad', { \n display: 'page',\n state: 'abcd'\n });\n }", "title": "" }, { "docid": "ca0078ea9871bb768fc399c6b9f4adf5", "score": "0.5531146", "text": "function handleAuthResultPopup() {\n var token_object = gapi.auth.getToken();\n var access_token = token_object.access_token;\n var token_type = token_object.token_type;\n var expires_in = token_object.expires_in;\n alert(\"Access token: \" + access_token + \", token_type: \" + token_type + \", expires_in: \" + expires_in);\n\n $http.post(\"http://localhost:8080/oauthcallback.html#access_token=\" + access_token);\n }", "title": "" }, { "docid": "a71d0d6b23c1f0f900d881241dc185b7", "score": "0.55172265", "text": "loginUser(username,password){\n fetch(this.url+\"/login\",{\n method: 'GET'\n // body: JSON.stringify(username,password),\n // headers: {\n // 'Content-Type' : 'application/json'\n // }\n }).then((response) => response.json())\n .then((response) => {\n this.CURRENT_TOKEN = response;\n console.log(this.CURRENT_TOKEN);\n });\n // res should be a token\n}", "title": "" }, { "docid": "6021c405e379ae4b53041662c9433b97", "score": "0.5517016", "text": "async function getAccessToken()\n{\n \nvar options = { method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: '{\"client_id\":\"AQQFPs6alhdlGPXy1hHq66JZA1JqdYuD\",\"client_secret\":\"tj3hdzE1KIWE6uXBTtLHSrvj1j7OqNWNkC5Qzzr2IFAf5w7wzqJH_aDdCqveidvU\",\"audience\":\"https://localhost/\",\"grant_type\":\"client_credentials\"}' };\n\n\n const response = await fetch('https://rajdeepdev.auth0.com/oauth/token',options);\n const data = await response.json();\n //console.log(data.access_token);\n\n return data.access_token;\n\n}", "title": "" }, { "docid": "9dc96bf4ec7d82503014b9ebc9fb3b31", "score": "0.5516682", "text": "function interactiveSignIn() {\n //disableButton(signin_button);\n tokenFetcher.getToken(true, function(error, access_token) {\n if (error) {\n //showButton(signin_button);\n } else {\n getUserInfo(true);\n }\n });\n }", "title": "" }, { "docid": "4d530dc7979174315d7eeaf868cb7ea7", "score": "0.5516507", "text": "function retrieve_token(){\n socket.emit('token', {auth_code: auth_code, uid: unique_id});\n socket.on('token-response', ()=>{\n load('/app', startApp);\n });\n}", "title": "" }, { "docid": "fefcb72ab3041dfa35cb0f05fac9713c", "score": "0.5510129", "text": "function clickSubmmitOnSigninPage() {\n let username = userField.value;\n let password = passwordField.value;\n\n return fetch('orch.prov.org/signin', { // orch -> loadHomePage\n body: JSON.stringify({\n username: username,\n domain: 'patient',\n password: password}),\n method: 'POST'\n })\n .then(saveTokenInSessionStore)\n .then(showLoginSuccess)\n}", "title": "" }, { "docid": "994ee3eb382abb202eeb8dffbf66aff1", "score": "0.5504519", "text": "function getOAuth(){\n\t// To get the auth token, you'll have to call the API using a POST request. In the body of that request, you'll send along your credentials. Check out the URL we're posting to. This example is for Petfinder, but every API has its own endpoint for getting a token. Petfinder also requires an extra property called 'grant_type' with a value of 'client_credentials'. In the header, you have to specify the 'Content-Type', which for Petfinder is 'application/x-www-form-urlencoded'\n\treturn fetch(\n\t\t// The url of the endpoint\n\t\t\"https://api.petfinder.com/v2/oauth2/token\",\n\t\t// The options object\n\t\t{\n\t\t\t// Use post\n\t\t\tmethod: \"POST\",\n\t\t\tbody:\n\t\t\t\t// The credentials\n\t\t\t\t\"grant_type=client_credentials\" +\n\t\t\t\t\"&client_id=\" +\n\t\t\t\tkey +\n\t\t\t\t\"&client_secret=\" +\n\t\t\t\tsecret,\n\t\t\theaders: {\n\t\t\t\t// Different APIs use different content-types\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\"\n\t\t\t}\n\t\t}\n\t)\n\t\t// When the we get the response back, it arrives in a 'stream' that we need to convert to json\n\t\t.then(response => response.json())\n\t\t// We want to be able to use this authorization token again later to make additional calls to the API. For example, we might want to add pagination to our app and use a new request for each new page. So, we'll use the variables we created up above: token, tokenType and expires.\n\t\t.then(data => {\n\t\t\tconsole.log(\n\t\t\t\t\"This is the authorization token that we requested: \",\n\t\t\t\tdata\n\t\t\t);\n\n\t\t\t// The authorization token looks like this. In an actual case, the access_token would be another long hash:\n\n\t\t\t// {\n\t\t\t// \taccess_token: \"a1b2c3d4e5\",\n\t\t\t// \texpires_in: 3600,\n\t\t\t// \ttoken_type: \"Bearer\"\n\t\t\t// };\n\n\t\t\t// Store token data\n\t\t\ttoken = data.access_token;\n\t\t\ttokenType = data.token_type;\n\t\t\t// This is a little tricky. The token gives an 'expires_in' value, but we need a future time in milliseconds. We multiply the expires_in value by 1000 to get milliseconds. Then we add that to the current time. \n\t\t\texpires = new Date().getTime() + (data.expires_in * 1000);\n\t\t})\n\t\t// We want to catch any errors returned from the server.\n\t\t.catch(error=>console.log(\"Something went wrong. \", error));\n}", "title": "" }, { "docid": "f0fa4833b79e95d643f8f2604eba4250", "score": "0.5498826", "text": "async function verify(token) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID, // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n const payload = ticket.getPayload();\n // const userid = payload['sub'];\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n\n return {\n nombre: payload.name,\n email: payload.email,\n img: payload.picture,\n google: true\n }\n}", "title": "" }, { "docid": "c502210344e350e1cc3bf2bc0e2c5d5b", "score": "0.54969037", "text": "function obtainToken(email, password, request) {\n let onSuccess = request['success'];\n $.ajax({\n type: \"POST\",\n url: `${tokenUrl}/obtain/`,\n data: JSON.stringify({'email': email, 'password': password}),\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (data) {\n storeTokenPairs(data);\n onSuccess(data);\n },\n error: request['error']\n });\n}", "title": "" }, { "docid": "eb05991d1f34966df4eb01bcba1a53b4", "score": "0.5493013", "text": "function handleAuthClick(event) {\n\tgetAuthTokenInteractive();\n}", "title": "" }, { "docid": "96316f54a274ef58c276fb3b9cc7b9cf", "score": "0.5490082", "text": "async sendDeviceToken(deviceId) {\r\n let formData = new URLSearchParams();\r\n formData.append('token', deviceId);\r\n \r\n try {\r\n let response = await fetch(\r\n `${configuration.MAIN_URL}` + `${restApi.API_SET_DEVICE_TOKEN}`,\r\n {\r\n method: 'POST',\r\n headers: {\r\n 'Accept': 'application/json',\r\n\t\t\t \t'content-Type':'application/x-www-form-urlencoded',\r\n Authorization: 'Bearer ' + this.props.sessionId,\r\n },\r\n body:formData.toString()\r\n },\r\n );\r\n let result = await response.json();\r\n if(result.status)\r\n this.atteendance()\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n }", "title": "" }, { "docid": "68ec00fbce9760fe30bd5bd4dd43390c", "score": "0.54880655", "text": "async function Gettoken() {\n const result = await fetch(\"https://accounts.spotify.com/api/token\", {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Authorization': 'Basic ' + btoa(client_id + ':' + client_secret)\n },\n body: 'grant_type=client_credentials'\n });\n\n const data = await result.json();\n sessionStorage.setItem('token', data.access_token);\n GetPlaylists();\n}", "title": "" }, { "docid": "6ceb6fa9d1cd4512309b5beecc3010cb", "score": "0.5487459", "text": "function oAuthCallback(res, req){\n\t//TODO: Automate token capture within application\n\tconsole.log(\"oAuth Callback called\");\n\tvar myURL = url.parse(req.url);\n\tvar code = myURL.searchParams.get('code');\n\tvar state = myURL.searchParams.get('state');\n\t\n\tconsole.log(\"Auth code is: \" + code);\n\tconsole.log(\"Auth state is: \" + state);\n}", "title": "" }, { "docid": "2cc46cba471cb450fc0b44e0c0a9eae6", "score": "0.54802746", "text": "static logInGoogle(req, res, next){\n let email = null\n let username = null\n let id_token = req.body.id_token\n const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID)\n client.verifyIdToken({\n idToken: id_token,\n audience: process.env.GOOGLE_CLIENT_ID\n })\n .then(ticket=>{\n let payload = ticket.getPayload()\n email = payload.email\n username = payload.name\n return User.findOne({where:{email}})\n \n })\n .then(data=>{\n if(!data){\n return User.create({\n email,\n username,\n password: \"12345678\"\n })\n }else{\n return data\n }\n })\n .then(data=>{\n let payload = {\n id: data.id, \n email: data.email, \n username: data.username, \n }\n let access_token = generateToken(payload)\n return res.status(200).json({\n payload,\n access_token\n })\n })\n .catch(err=>{\n next(err)\n })\n }", "title": "" }, { "docid": "fb9962479a2ca5989959a2ca72c2259d", "score": "0.54791033", "text": "function requestAccessToken() {\n // Define request headers\n const authHeaders = new Headers({\n Authorization: 'Basic MTdlYzc2MmQyNDY1NDFjY2E5Mzg5OTk4MTAxMTZkN2Y6NzNiMTYwZjQ0ZTQ3NDhkYmE4NDgxZWY1ZGViMTBmMGU=',\n 'Content-Type': 'application/x-www-form-urlencoded',\n });\n // Spotify's Api endpoint to get access token\n const authUrl = 'https://accounts.spotify.com/api/token';\n\n // Options for token request\n const authOptions = {\n method: 'POST',\n headers: authHeaders,\n body: 'grant_type=client_credentials',\n json: true,\n };\n\n // Request access token and return it\n return fetch(authUrl, authOptions)\n .then((response) => {\n if (response.ok) {\n return response.json();\n }\n throw new Error(`Server response: ${response.status}`);\n })\n .then((bodyJson) => bodyJson.access_token)\n .catch((error) => renderError(error.message));\n}", "title": "" }, { "docid": "b658540443d671150b4605234eefa31d", "score": "0.54790986", "text": "function getToken() {\n spotifyApi.clientCredentialsGrant().then(function (data) {\n console.log(\"The access token expires in \" + data.body[\"expires_in\"]);\n console.log(\"The access token is \" + data.body[\"access_token\"]);\n // Save the access token so that it's used in future calls\n spotifyApi.setAccessToken(data.body[\"access_token\"]);\n }, function (err) {\n console.log(\"Something went wrong when retrieving an access token\", err);\n });\n}", "title": "" }, { "docid": "64b0043ca3a215b1a6d969a945e62956", "score": "0.5475083", "text": "function osLoginDone(response, status, jqXHR) {\n osToken = response[0].token\n }", "title": "" }, { "docid": "90404b7563a19bf6b71657f074365260", "score": "0.547339", "text": "function fetchAccessToken() {\n const options = {\n method: 'POST',\n url: config.authenticationUrl,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Keep-Alive': 'true',\n Cookie:\n 'fpc=ArKu6-Rb2XZKmTqf7DHLZMyysD6fAQAAAG_L09YOAAAA; x-ms-gateway-slice=prod; stsservicecookie=ests',\n },\n formData: {\n grant_type: 'client_credentials',\n client_id: config.clientId,\n client_secret: config.clientSecret,\n resource: config.powerAppsEnvURL,\n },\n };\n\n request(options, function (error, response) {\n if (error) throw new Error(error); // TODO: Need to fix\n\n const tokentObj = JSON.parse(response.body);\n const { access_token, expires_in } = tokentObj;\n\n ACCESS_TOKEN = access_token;\n\n const nextFetchTime = (expires_in - 600) * 1000; // 10 min before expiration.\n setTimeout(() => {\n fetchAccessToken();\n }, nextFetchTime);\n });\n}", "title": "" }, { "docid": "806aebe371307892f5fd95e0000d5886", "score": "0.5469417", "text": "function fetchToken(auth_code, callback){\n let url = \"https://login.uber.com/oauth/v2/token?client_id=\"+client_id\n +\"&client_secret=\"+client_secret+\"&grant_type=authorization_code&redirect_uri=http://127.0.0.1&code=\" + auth_code;\n fetch(url,{\n method: \"POST\"\n }).then(response => response.json()).then(json => callback(json));\n}", "title": "" }, { "docid": "bb96922ebf65f87429a6c72623e03cb6", "score": "0.54654527", "text": "async authorize () {\n\t\t// authentication is passed as a JSONWebToken in the query parameters\n\t\tlet error;\n\t\ttry {\n\t\t\tconst token = this.request.query.t;\n\t\t\tif (!token) {\n\t\t\t\terror = this.errorHandler.error('missingAuthorization');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.tokenPayload = this.api.services.tokenHandler.verify(token);\n\t\t\t}\n\t\t}\n\t\tcatch (e) {\n\t\t\terror = e;\n\t\t\tconst message = typeof error === 'object' ? error.message : error;\n\t\t\tif (message === 'jwt expired') {\n\t\t\t\terror = this.errorHandler.error('tokenExpired');\n\t\t\t}\n\t\t\telse {\n\t\t\t\terror = this.errorHandler.error('tokenInvalid', { reason: message });\n\t\t\t}\n\t\t}\n\t\tif (!error && this.tokenPayload.type !== 'unf') {\n\t\t\terror = this.errorHandler.error('tokenInvalid', { reason: 'not an unfollow token' });\n\t\t}\n\n\t\tif (error) {\n\t\t\tthis.gotError = error;\n\t\t}\n\t\telse {\n\t\t\tawait this.getUser();\n\t\t\treturn super.authorize();\n\t\t}\n\t}", "title": "" }, { "docid": "6cc67a82eaa92e58d56f42400110b461", "score": "0.5465093", "text": "_clientRequestAccessToken(token) {\n console.log(4444444444, token)\n }", "title": "" }, { "docid": "f69f61b18b7cb9d55f7a1189d44478a6", "score": "0.5461466", "text": "function populateAuthToken() {\n if (localStorage) {\n let token = localStorage.getItem(AUTH_TOKEN_KEY);\n if (token && token !== null) {\n authToken = token;\n }\n }\n}", "title": "" }, { "docid": "17d25d4a1c0679c80e74936657b0583c", "score": "0.5456259", "text": "async function verify(TOKEN) {\n const ticket = await client.verifyIdToken({\n idToken: TOKEN,\n audience: CLIENT_IDD, // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n const payload = ticket.getPayload();\n //const userid = payload['sub'];\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n return {\n name: payload.name,\n email: payload.email,\n img: payload.picture,\n google: true\n }\n }", "title": "" }, { "docid": "7060257c791c7cc3204f3ae238951446", "score": "0.545554", "text": "static async login(data) {\n let res = await this.request(`auth/token`, data, \"post\");\n return res.token;\n }", "title": "" }, { "docid": "5258492c7c050ac1eda989054721d48c", "score": "0.5454579", "text": "static async login(data) {\n let res = await this.request(`auth/token`, data, \"post\");\n return res.token;\n }", "title": "" }, { "docid": "1ae15c55e96d895577406a5b85d33f44", "score": "0.5453252", "text": "function getToken() {\n debug('trying to get token');\n if (this.TOKEN === false) return;\n debug('enqueue token request');\n this.TOKEN = false;\n\n const data = {\n grant_type: 'client_credentials',\n client_id: this.API_USER_ID,\n client_secret: this.API_SECRET,\n };\n\n this.sendRequest('oauth/access_token', 'POST', data, false, (response) => {\n debug('token response', response);\n this.TOKEN = response.access_token;\n\n // clear the loop\n if (this.pendingRequests.length > 0) {\n // eslint-disable-next-line prefer-spread\n this.pendingRequests.forEach(args => this.sendRequest.apply(this, args));\n this.pendingRequests = [];\n }\n });\n}", "title": "" }, { "docid": "42d15d16de92bbb815ce87ac1bd4416f", "score": "0.54465824", "text": "async function spotifyAuth() {\r\n const auth = await axios({\r\n url: \"https://accounts.spotify.com/api/token\",\r\n headers: {\r\n \"Accept\":\"application/json\",\r\n \"Content-Type\": \"application/x-www-form-urlencoded\"\r\n },\r\n method: \"post\",\r\n auth: {\r\n username: client_id,\r\n password: client_secret\r\n },\r\n params: { grant_type:\"client_credentials\" }\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n return;\r\n })\r\n console.log(\"Spotify auth:\",auth.data);\r\n current_access_token = auth.data.access_token;\r\n access_token_expiry = (auth.data.expires_in * 1000) + Date.now();\r\n return auth.data.access_token;\r\n}", "title": "" }, { "docid": "8e7e35142c9be60b617c77f617e5c1db", "score": "0.5445141", "text": "login() {\n var token = '';\n fetch('http://10.0.2.2:3333/api/v0.0.5/login', {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json',\n 'X-Authorization': token // store the generated token after validating the login\n },\n body: JSON.stringify({\n email: this.state.loginEmail,\n password: this.state.loginPass,\n })\n })\n\n .then((response) => {\n if (response.status === 400) { // if the inserted data was invalid, the user will not get an access\n Alert.alert(\"Invalid email/password\")\n }\n\n return response.json()\n\n .then((responseData) => {\n const JsonToken = responseData.token;\n const user = responseData.id;\n this.setState({\n token: JsonToken,\n user_id: user\n });\n if (response.status === 200) { // if the inserted data was valid, grant the user an access and navigate them to Newsfeed page\n this.storeId(this.state.user_id);\n this.storeToken(this.state.token);\n this.props.navigation.navigate('Newsfeed');//navigate to a page\n }\n })\n })\n .catch((error) => {\n console.log(error);\n });\n }", "title": "" }, { "docid": "cafa2d0f175df898c642b6ec89bb06eb", "score": "0.54433835", "text": "getToken() {\n if (this.token) {\n return Promise.resolve();\n }\n\n return VideoCallApi.requestToken().then(data => {\n this.identity = data.identity;\n this.token = data.token;\n });\n }", "title": "" }, { "docid": "50c6414f8bbf88ac559195d8eac0654d", "score": "0.5441717", "text": "static authenticateUser(token){\n localStorage.setItem('token',token);\n let toks = this.decodeToken(token);\n return toks;\n }", "title": "" }, { "docid": "657e8765bf7ae463d0677ad45fbc1eb5", "score": "0.5440959", "text": "async function verify(token) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n const payload = ticket.getPayload(); // aqui obtenemos toda la informacion de dicho usuario\n // const userid = payload['sub'];\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n // Retornamos los que nos interesa del payload\n return {\n nombre: payload.name,\n email: payload.email,\n img: payload.picture,\n google: true\n };\n}", "title": "" }, { "docid": "f04faf4fbbc0d6b6cddcb8ad7ca37e97", "score": "0.54399437", "text": "load() {\n getToken();\n }", "title": "" }, { "docid": "7dcba808267f2e319cbf16e2ea8ccfd3", "score": "0.54376656", "text": "async function GetAccessToken() {\n const urlParams = new URLSearchParams(window.location.search);\n const code = urlParams.get(\"code\");\n const error = urlParams.get(\"error\");\n\n if (code) {\n return fetch(`/get_access_token?code=${code}`)\n .then((response) => response.json())\n .then((data) => {\n if (data.error) {\n window.location = \"/playlist\";\n } else {\n SaveDatatoLocalStorage(data);\n hideSpotifyLoginDiv();\n }\n })\n .catch((error) => {\n M.toast({ html: \"There was a server error logging you into Spotify.\" });\n throw error;\n });\n }\n\n if (error) {\n window.alert(\"Failed to log into Spotify.\");\n }\n}", "title": "" }, { "docid": "4a8fd5e301018704f034e5569373350d", "score": "0.5437641", "text": "function getAccessToken() {\n let options = {\n method: 'POST',\n uri: 'https://azurespeechserviceeast.cognitiveservices.azure.com/sts/v1.0/issuetoken', // Be sure this base URL matches your region\n headers: {\n 'Ocp-Apim-Subscription-Key': subscriptionKey\n }\n }\n return rp(options);\n}", "title": "" }, { "docid": "4a8fd5e301018704f034e5569373350d", "score": "0.5437641", "text": "function getAccessToken() {\n let options = {\n method: 'POST',\n uri: 'https://azurespeechserviceeast.cognitiveservices.azure.com/sts/v1.0/issuetoken', // Be sure this base URL matches your region\n headers: {\n 'Ocp-Apim-Subscription-Key': subscriptionKey\n }\n }\n return rp(options);\n}", "title": "" }, { "docid": "d7103420fdaee08eeae5320bbe7e66cd", "score": "0.54367113", "text": "login () {\n const tokenRequest = {\n username: document.getElementById('username').value,\n email: document.getElementById('email').value,\n firstname: document.getElementById('firstname').value,\n lastname: document.getElementById('lastname').value\n };\n const request = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(tokenRequest)\n };\n fetch('/api/token', request)\n .then((response) => {\n return response.json();\n })\n .then((data) => {\n console.log('Using JWT to log in: ', data);\n this.activateUnbluJwt(data.token)\n .then((response) => {\n this.init();\n })\n .catch((error) => {\n document.getElementById('login-result').textContent = 'Login failed! ' + error;\n });\n });\n }", "title": "" }, { "docid": "2ddb106b810b2e6864975efe449c12e4", "score": "0.5428395", "text": "async function verify(token) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: '743582030731-r84206nq8crd356gicqc30pkj2kphfc5.apps.googleusercontent.com'\n }).catch((err) => {\n return res.status(403).json({\n ok: false,\n mensaje: \"error verifyIdToken\",\n err: err\n });\n });\n const payload = ticket.getPayload().catch((err) => {\n return res.status(403).json({\n ok: false,\n mensaje: \"error verifyIdToken\",\n err: err\n });\n });\n //const userid = payload['sub'];\n // If request specified a G Suite domain:\n //const domain = payload['hd'];\n\n return {\n name: payload.name,\n email: payload.email,\n picture: payload.picture,\n google: true\n }\n\n}", "title": "" }, { "docid": "6a26e98f5792c68f0b9fa33320c14ad5", "score": "0.5419632", "text": "async getToken() {\n const value = await AsyncStorage.getItem(\"token\");\n if (value != null && value.split(\" \")[0] === \"Bearer\") {\n return value;\n } else {\n return null;\n }\n }", "title": "" }, { "docid": "6b34448e53c219daebae278aa487436f", "score": "0.54117846", "text": "function getGAauthenticationToken(email, password) {\n password = encodeURIComponent(password);\n var response = UrlFetchApp.fetch(\"https://www.google.com/accounts/ClientLogin\", {\n method: \"post\",\n payload: \"accountType=GOOGLE&Email=\" + email + \"&Passwd=\" + password + \"&service=fusiontables&Source=testing\"\n });\n\n\tvar responseStr = response.getContentText();\n\tresponseStr = responseStr.slice(responseStr.search(\"Auth=\") + 5, responseStr.length);\n\tresponseStr = responseStr.replace(/\\n/g, \"\");\n\treturn responseStr;\n}", "title": "" }, { "docid": "1c46c0ff34e5f492c423bc1142efdebd", "score": "0.54108375", "text": "function tkTake(token, res){\n try{ const payload = branca.decode(token);\n return payload.toString();}\ncatch(e){ console.log(e) && res.status(401).json({ message: 'You are not authorized. Please sign in'});}\n}", "title": "" }, { "docid": "00d15bbd80cfd0f60c131bcec0789b95", "score": "0.54104286", "text": "function loginSuccess(data) {\n console.log('API call completed on promise resolve: ', data.body.access_token);\n token = data.body.access_token;\n}", "title": "" }, { "docid": "5d48e31ee95ffdce949df226b8a069b5", "score": "0.54092705", "text": "requestToken( callback ) {\n // check if no auth already in progress\n if (!this._authPromise) {\n this._authPromise = this._doRequest( null, '/rs/token', callback );\n }\n return this._authPromise;\n }", "title": "" }, { "docid": "4381e29ed05e690da084e7270636766f", "score": "0.5408876", "text": "function DoSignIn()\r\n{\r\n jqmDialogOpen(\"Signing In\");\r\n\r\n gEmailCheck = $.trim($(\"#email2\").val());\r\n gPassword = $.trim($(\"#password2\").val());\r\n\r\n //Check for valid email \r\n if(!validateEmail(gEmailCheck,1,0))\r\n {\r\n jqmSimpleMessage(\"Invaild Email. Try Again\", function(){});\r\n return;\r\n }\r\n\r\n ADL.XAPIWrapper.getStatements({\"verb\":ADL.verbs.registered.id}, null, ProfilesReceivedSignIn);\r\n}", "title": "" }, { "docid": "4c5f6862845fec787bec8877f6568abe", "score": "0.5408437", "text": "async generateToken(url, params = null) {\n return await this.instance.post(this.urlFilteration(url), {\n ...params,\n clientId: this.clientCredentials.id,\n clientSecret: this.clientCredentials.secret,\n }).then(response => response).catch(error => error);\n }", "title": "" }, { "docid": "7e64779ec158074979670ba9551bebb8", "score": "0.5407415", "text": "getSessionToken() {}", "title": "" }, { "docid": "c92882796bb42fae7295ce9a49717486", "score": "0.5406448", "text": "async verifyToken(token) {\n let accessToken = token\n\n try {\n let response = await fetch('http://localhost:3000/api/session');\n\n let res = await response.text();\n debugger;\n if (response.status >= 200 && response.status < 300) {\n //Verified token means user is logged in so we redirect him to home.\n this.navigate('home');\n } else {\n //Handle error\n let error = res;\n throw error;\n }\n } catch(error) {\n console.log(\"error response: \" + error);\n }\n }", "title": "" } ]
a20b20e84e18e4f7d4aa38b8da16b27e
Envia um elemento como resposta utilizando JSON
[ { "docid": "5ee0456067c4630b3a9f9de8f63763cc", "score": "0.57222074", "text": "json(arg) {\n\t\tconst {res} = this;\n\t\tres.writeHead(200, {'Content-Type': JSON_MIME});\n\t\tres.end(JSON.stringify(arg));\n\t\treturn this;\n\t}", "title": "" } ]
[ { "docid": "004e21c87876963dcb23e0c8cd21715e", "score": "0.6235687", "text": "function makejson() {\n jsonResp[\"response\"] = array;\n addtoDOM();\n}", "title": "" }, { "docid": "0413ab1bbb51db6fabfdc8c80146168e", "score": "0.6045036", "text": "function jsonResponse(res,obj){\r\n res.statusCode = 200;\r\n res.setHeader('Content-Type', 'application/json');\r\n res.write(JSON.stringify(obj));\r\n res.end('\\n');\r\n}", "title": "" }, { "docid": "ecf0d95efe5b84334450ca92ea1b8fb0", "score": "0.60154605", "text": "toJSON() {}", "title": "" }, { "docid": "87e5edeed6bf9d96546bf78116838ddb", "score": "0.58678466", "text": "function sendJSON (res, obj) { res.send(JSON.stringify(obj, null, 2)) }", "title": "" }, { "docid": "12cde9268961b579242a96356361283a", "score": "0.58239657", "text": "function toObject(){\r\n var name = document.getElementById('name').value;\r\n var surname = document.getElementById('surname').value;\r\n var email = document.getElementById('email').value;\r\n var json = {\r\n Nombre : name,\r\n Apellido : surname,\r\n email : email\r\n }\r\n console.log(json);\r\n}", "title": "" }, { "docid": "0c7c7a92b211e730bef1db08c0d38f3d", "score": "0.5789088", "text": "function makeResponseJSON() {\n var json = {\n x: x,\n y: y,\n zx: zx,\n zy: zy,\n gears: gears\n }\n}", "title": "" }, { "docid": "bf4b791c54bb8037002cd44d5ed20078", "score": "0.57797796", "text": "sendJSON(obj) {\n\n\t\tthis._res.writeHead(200, { 'Content-Type': 'application/json' });\n\n\t\tthis._res.end(JSON.stringify(obj));\n\t}", "title": "" }, { "docid": "7dd07d61825e5757d2c3942ec8481259", "score": "0.57582784", "text": "get(_, res) { \n let = produtos =[\n {'id': 1 ,'nome': 'Iphone','description': 'Iphone geração 10','quantidade':2},\n {'id': 2 ,'nome': 'Notebook','description': 'notebook core i7, 8 GB','quantidade':1},\n {'id': 3 ,'name': 'Samsung','description': 'Descrição do produto aqui','quantidade':1}\n ]; \n res.json(produtos);\n }", "title": "" }, { "docid": "bf9984f63e1ef8f3484ee004a7d7103b", "score": "0.5754109", "text": "function sendDados() {\n tabela = document.getElementById('venda');\n let venda = {\n date: document.getElementById('date').value,\n address: {\n zipcode: document.getElementById('cep').value,\n address: document.getElementById('logradouro').value,\n number: document.getElementById('numero').value,\n district: document.getElementById('bairro').value,\n city: document.getElementById('cidade').value,\n uf: document.getElementById('uf').value\n },\n productsId: listaDeProdutos()\n }\n\n campoJson = document.getElementById('json');\n campoJson.value = JSON.stringify(venda);\n}", "title": "" }, { "docid": "b3599dcb5326d73aad4e30d581decdd9", "score": "0.574602", "text": "function createJSON() {\n let id = document.getElementById(\"json\");\n let applicationData =\n \"application/json;charset=utf-8,\" +\n encodeURIComponent(JSON.stringify(periode));\n\n let json = document.createElement(\"a\");\n json.href = \"data:\" + applicationData;\n json.download = \"json.json\";\n json.innerHTML = \"Ready to download your json file\";\n\n id.appendChild(json);\n}", "title": "" }, { "docid": "5f4a97360af62495125488b7a5f1058f", "score": "0.5675132", "text": "json(body) {\n this.header('Content-Type', 'application/json').send(\n this._serializer(body)\n );\n }", "title": "" }, { "docid": "8a6bb84a3fbf178170aa5ca243e7ce43", "score": "0.5665878", "text": "json(dados) {\n return JSON.stringify(dados)\n }", "title": "" }, { "docid": "d8c615de6e336278fbb124fd220a9b2d", "score": "0.5639305", "text": "function outputJSON({ ctx, data, errno = 0, errmsg = 'success' }) {\n ctx.set('Content-type', 'application/json; charset=utf-8');\n let res = {\n errno,\n errmsg,\n data,\n };\n ctx.body = JSON.stringify(res);\n}", "title": "" }, { "docid": "73871cadb0f94a400434a525b884dd5e", "score": "0.56239605", "text": "json() {\n res.json(f);\n }", "title": "" }, { "docid": "41b5be72335888a4dfa3ae5fd9e72507", "score": "0.56232756", "text": "function criaJsonVazio(){\n\tvar json = {};\n\treturn json;\n}", "title": "" }, { "docid": "660fa14555c96034ca438f34a359ad53", "score": "0.56174964", "text": "async function generarJSON(req, res) {\n const data = {\n empresa: {\n nombre: req.body.empresa\n },\n cliente: {},\n productos: [],\n factura: req.body.factura,\n fecha_creacion: moment().format('DD/MM/YYYY'),\n fecha_vencimiento: moment().add(14, 'days').format('DD/MM/YYYY')\n };\n\n res.status(200).send({msg: data});\n }", "title": "" }, { "docid": "28a352f376cebb9577d9acbfd079a394", "score": "0.5611937", "text": "function respuestaAjaxJson(res, tipoMsj, mensaje, contenido){\n res.setHeader('Content-Type', 'application/json');\n\n var datos = {\n RESULTADO: tipoMsj\n };\n\n //Valores opcionales\n if (mensaje) datos.MENSAJE = mensaje;\n if (contenido) datos.CONTENIDO = contenido;\n\n //Enviar respuesta\n res.send(JSON.stringify( datos ));\n}", "title": "" }, { "docid": "85db8762d597006a37ef3b9866ecc77e", "score": "0.5599267", "text": "function createDevice()\n{\n var data = {};\n data[\"name\"] = document.getElementById(\"name\").value;\n data[\"imei\"] = document.getElementById(\"imei\").value;\n var myJson = JSON.stringify(data);\n console.log(myJson);\n apiChangeData(\"Device\", \"POST\", myJson, function (status) {\n printStatusHandleFormData(status);\n });\n}", "title": "" }, { "docid": "47285979080c7062c37863ee4675540c", "score": "0.55963874", "text": "function crearPedido(event) {\n event.preventDefault();\n\n var nombre = document.getElementById(\"name\").value;\n var cantidad_hab = document.getElementById(\"quantity_hab\").value;\n var cantidad_enchuf = document.getElementById(\"quantity_ench\").value;\n var num_tel = document.getElementById(\"phone\").value;\n\n var tipoSeleccionado = document.getElementById(\"tipo-instalacion\").options[document.getElementById(\"tipo-instalacion\").selectedIndex].text;\n\n var pedido = new Pedido(nombre, cantidad_hab, cantidad_enchuf, num_tel, tipoSeleccionado);\n\n var json = JSON.stringify(pedido);\n crearBin(json);\n}", "title": "" }, { "docid": "f81a96f0bfe4aff381568b7aea25d7bd", "score": "0.5584925", "text": "function makeJSON() {\n\n\n var json = {\n\n \"x\": x,\n \"y\": y,\n \"zx\": zx,\n \"zy\": zy,\n \"gears\": gears\n\n }\n\n ws.send(id + \":::\" + JSON.stringify(json));\n\n}", "title": "" }, { "docid": "c861404fd205a26e4230fbfa088f08f4", "score": "0.55514574", "text": "function ExportJSONProductos(){\r\n\r\nif(productosarray.length == 0 ){\r\n alert(\"Aun no hay productos existentes que se puedan exportar\");\r\n}else{\r\n //conversion de productos a JSON en otra variable\r\n let json = JSON.stringify(productosarray);\r\n\r\n //conversion JSON string a BLOB -> fichero de datos planos inmutables.\r\n json = [json];\r\n let blob1 = new Blob(json, { type: \"text/plain;charset=utf-8\" });\r\n\r\n //muchisima ayuda de stackoverflow por aca\r\n //Check the Browser.\r\n let isIE = false || !!document.documentMode;\r\n if (isIE) {\r\n window.navigator.msSaveBlob(blob1, \"productos.json\");\r\n } else {\r\n let url = window.URL || window.webkitURL;\r\n link = url.createObjectURL(blob1);\r\n let a = document.createElement(\"a\");\r\n a.download = \"productos.json\";\r\n a.href = link;\r\n document.body.appendChild(a);\r\n a.click();\r\n document.body.removeChild(a);\r\n }\r\n } \r\n}", "title": "" }, { "docid": "169b249d5bdecffdb6706d1b14b2af1c", "score": "0.55302525", "text": "function formToJSON() {\r\n\tvar trabalhoId = $('#trabalhoId').val();\r\n\treturn JSON.stringify({\r\n\t\t\"codigo\": trabalhoId == \"\" ? null : trabalhoId,\r\n\t\t\"descricao\": $('#descricao').val(),\r\n\t\t\"dataDeEntrega\": $('#dataDeEntrega').val(),\r\n\t\t\"codigoAula\": $('#codigoAula').val()\r\n\t\t});\r\n}", "title": "" }, { "docid": "aa4a34a54b1980021ab27e69ded3c61f", "score": "0.5523562", "text": "function toJSON() {\n\t\t\t// The private function toJSON() :\n\t\t\ttry {\n\n\t\t\t\t_JSONObject = JSON.parse(_request.responseText);\n\t\t\t\t// Converts the JSON response to an object that will be stored in _JSONObject.\n\t\t\t} catch (e) {\n\t\t\t\t// Handles the case of a corrupted JSON file or another content.\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "7970e839ac8bae80c6b972263c594fcf", "score": "0.5487961", "text": "function conPost() {\n var o = {\n nombre: \"MiNombre\",\n apellidos: \"MiApellido\",\n edad: 20,\n nota: 7\n }\n $.post(url, JSON.stringify(o), function (res) {\n console.log(res);\n });\n }", "title": "" }, { "docid": "fbbf64ecdb7eb16c8f85360ba14f7500", "score": "0.5451224", "text": "function ToJson (data) {return JSON.stringify(data);}", "title": "" }, { "docid": "9580d7216f0a0cf8b756904eb9a0c97f", "score": "0.5449728", "text": "function saveData(response){\n\tOBJETIVES =JSON.parse(response);\n}", "title": "" }, { "docid": "671affefa7a7a15e207284c9dc743318", "score": "0.54463595", "text": "function procesarJson(res) {\n var data = res;\n var r = \"\";\n for (var i = 0; i < res.length; i++) {\n r += data[i].nombre + \"<br />\";\n }\n $(\"#resultado\").html(r);\n }", "title": "" }, { "docid": "7d0e5cf61cf473a0705d501c2fd7e5b5", "score": "0.5406227", "text": "function ejemploJSON() {\n\n console.log('JSON forever!!');\n \n var usuario = {\n nombre: 'Manolo el del bombo',\n apellidos: 'De todos los antos',\n nif: '11111A'\n }\n var usuarios = [];\n usuarios.push(usuario);\n console.log('Usuarios -> ', usuarios)\n}", "title": "" }, { "docid": "7dff58c5976ade0aeaf5477b75ca993a", "score": "0.5386809", "text": "function sendJsonFormat() {\n return JSON.stringify(this);\n }", "title": "" }, { "docid": "a580a5352b4e2834dad14ea77c9b988c", "score": "0.5381081", "text": "function formToJSON() {\n\treturn JSON.stringify({\n\t\t\"id\": $('#prajituriId').val(), \n\t\t\"nume\": $('#nume').val(), \n\t\t\"data_valabilitate\": $('#data_valabilitate').val(),\n\t\t\"calorii\": $('#calorii').val(),\n\t\t\"tip\": $('#tip').val(),\n\t\t\"eveniment\": $('#eveniment').val(),\n\t\t\"picture\": currentPraji.picture,\n\t\t\"description\": $('#description').val()\n\t\t});\n}", "title": "" }, { "docid": "0c7be3f9612dd6421f0e6bd7ed856f65", "score": "0.5371861", "text": "function response() {\n return {\n json: function(data) {\n return ContentService\n .createTextOutput(JSON.stringify(data))\n .setMimeType(ContentService.MimeType.JSON);\n }\n }\n}", "title": "" }, { "docid": "99421a06a675f498f7295128da15e734", "score": "0.5358473", "text": "function enviarDatosModViatico(evento)\n{\n evento.preventDefault();\n var id_viaticos = $(\"#id_viaticoMod\").val();\n //alert(id_viaticos);\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModViatico\",\"Datos\":datos, \"Id_Viaticos\":id_viaticos};\n var jsonobj=JSON.stringify(request);\n // alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModViatico(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "d6dd28000ac0b5d3c8b176388bd47819", "score": "0.53579605", "text": "function enviarDatosModPedido(evento)\n{\n evento.preventDefault();\n var id_pedido = $(\"#id_PedidoMod\").val();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModPedido\",\"Datos\":datos, \"Id_Pedido\":id_pedido};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModPedido(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "e54e887a75142f51f42d8657fe1396c7", "score": "0.53495294", "text": "function guardarDonante(){\n var selTipoDonante = $('#selTipoDonante');\n var selSexos = $('#selSexos');\n var donNombre = $('#nombreD');\n var donCif = $('#cif');\n var donCorreo = $('#email');\n var donante = '{ \"tipoD\":\"'+selTipoDonante.val()+'\",';\n donante += '\"sexo\":\"'+selSexos.val()+'\",';\n donante += '\"full_name\":\"'+donNombre.val()+'\",';\n donante += '\"cif\":\"'+donCif.val()+'\",';\n donante += '\"email\":\"'+donCorreo.val()+'\"}';\n var donantejson = JSON.parse(donante);\n console.log(donante);\n console.log(JSON.stringify(donantejson));\n var jsonString = JSON.stringify(donantejson);\n $.ajax({\n url:urlApi+'crearDonante',\n method: \"post\",\n contentType: \"application/json\",\n data: jsonString\n });\n}", "title": "" }, { "docid": "9997480e3544848b71fe22ab54ebd1a1", "score": "0.5342556", "text": "json() {\n res.json(tasks);\n }", "title": "" }, { "docid": "9997480e3544848b71fe22ab54ebd1a1", "score": "0.5342556", "text": "json() {\n res.json(tasks);\n }", "title": "" }, { "docid": "9997480e3544848b71fe22ab54ebd1a1", "score": "0.5342556", "text": "json() {\n res.json(tasks);\n }", "title": "" }, { "docid": "c0f9498cdd0040e324b7c80e8b60ddc4", "score": "0.53422886", "text": "function linksJsonResponse(){\n const jsonLinks = JSON.stringify(LINKS_ARR)\n return new Response(jsonLinks, {\n headers: {\n \"content-type\": \"application/json;charset=UTF-8\"\n }\n })\n}", "title": "" }, { "docid": "b2c7409b929d98ca79197394b7dd3000", "score": "0.5339337", "text": "function enviarDatosModProductos(evento)\n{\n evento.preventDefault();\n var codigo_producto = $(\"#id_productoMod\").val();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModProducto\",\"Datos\":datos, \"Codigo_Productos\":codigo_producto};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModProducto(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "b6cfdc8d10ce5f02a991101e56bdd1de", "score": "0.53379536", "text": "toJSON() {\n return {\n\n };\n }", "title": "" }, { "docid": "4d144046666366c36ebc947475800716", "score": "0.5337296", "text": "function createJSON(tx, results) {\n var len = results.rows.length;\n var items = [];\n for (var i = 0; i < len; i++) { // loop as many times as there are row results\n items.push(JSON.stringify(results.rows.item(i)));\n }\n //alert(my_JSON_object);\n send_JSON_to_serwer('[' + items.join(',') + ']');\n}", "title": "" }, { "docid": "4ffee6ee1d6142fbbe910f3e1f36b8dd", "score": "0.5334216", "text": "function toJSON(response) {\n return response.json()\n}", "title": "" }, { "docid": "48b9f7f7dbde9d86c742e394ec4fde69", "score": "0.5330203", "text": "toJSON() {\n let obj = {}\n Object.entries(this).forEach(pair => obj[pair[0]] = pair[1])\n obj.xml = obj.xml.toString()\n return obj\n }", "title": "" }, { "docid": "22fe4028da8a256fc6ba9dc7d7503239", "score": "0.53252125", "text": "function escribirJSON(){\n return new Promise((resolve, reject) => {\n // console.log('DENTRO DE ESCRIBIR JSON');\n\n const pathJSON = path.join(__dirname, '../public/datos/fusionado.json');\n const numeroFusiones = fs.readdirSync(pathFusiones).length;\n\n const obj = {\n numero: numeroFusiones\n }\n\n let json_obj = JSON.stringify(obj);\n fs.writeFileSync(pathJSON, json_obj);\n\n resolve();\n });\n}", "title": "" }, { "docid": "1293e83931997bbca87299762f957467", "score": "0.53233147", "text": "function agregarElementosUsuario() {\n\n let myData = {\n id : $(\"#id_usuario\").val(),\n name : $(\"#name_usuario\").val(),\n email : $(\"#email_usuario\").val(),\n age : $(\"#age_usuario\").val()\n };\n \n $.ajax (\n {\n\n url : 'https://g21df42d0cfb53f-db202110061827.adb.sa-santiago-1.oraclecloudapps.com/ords/admin/client/client',\n type : 'POST',\n data : myData,\n dataType : 'json',\n\n success : function(response){\n alert(\"Se ha Agregado satisfactoriamente\");\n $(\"#id_usuario\").val(\"\");\n $(\"#name_usuario\").val(\"\");\n $(\"#email_usuario\").val(\"\");\n $(\"#age_usuario\").val(\"\");\n consultarElementosUsuario();\n console.log(response);\n \n },\n error : function(xhr,status){\n console.log( xhr);\n console.log(myData);\n }\n\n\n }\n );\n}", "title": "" }, { "docid": "2a8a9e44e9fab76d8553d28c53f105ab", "score": "0.5323247", "text": "function responseToJson(response){\n return response.json();\n }", "title": "" }, { "docid": "27e202ea035b832033a6fddf6b337221", "score": "0.53209764", "text": "function exportJSON() {\n\tvar blob = new Blob([JSON.stringify(nn)], {\n\t\ttype: \"text/json;charset=utf-8\"\n\t});\n\tsaveAs(blob, \"yamato.json\");\n}", "title": "" }, { "docid": "1e4c0ddbe75954ff57343e76138db03d", "score": "0.5318809", "text": "function json(data) {\n return {\n status: 200,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(data)\n };\n}", "title": "" }, { "docid": "9b56cf465f10a519bcb5d0811ab362b5", "score": "0.53163457", "text": "function agregarElementos() {\n\n let myData = {\n id : $(\"#id\").val(),\n brand : $(\"#brand\").val(),\n model : $(\"#model\").val(),\n category_id : $(\"#category_id\").val(),\n name : $(\"#name\").val()\n };\n \n $.ajax (\n {\n\n url : 'https://g21df42d0cfb53f-db202110061827.adb.sa-santiago-1.oraclecloudapps.com/ords/admin/costume/costume',\n type : 'POST',\n data : myData,\n dataType : 'json',\n\n success : function(response){\n alert(\"Se ha Agregado satisfactoriamente\");\n $(\"#id\").val(\"\");\n $(\"#brand\").val(\"\");\n $(\"#model\").val(\"\");\n $(\"#category_id\").val(\"\");\n $(\"#nombre\").val(\"\");\n console.log(response);\n \n },\n error : function(xhr,status){\n console.log( xhr);\n }\n\n\n }\n );\n}", "title": "" }, { "docid": "b9d6a6b64306f085a91ec934a91ac12f", "score": "0.5312735", "text": "toJSON() {\n\n var json = {\n name: this.name,\n content: this.content,\n contentType: this.contentType\n };\n\n if (this.contentId) {\n json.contentId = this.contentId;\n }\n \n if (this.customHeaders.length > 0) {\n var _ch = [];\n this.customHeaders.forEach(element => { \n _ch.push(toCustomHeader.convert(element).toJSON()); \n });\n json.customHeaders = _ch; \n } \n \n return json;\n }", "title": "" }, { "docid": "2e73241abc4bb3781996c042d6b76556", "score": "0.53097105", "text": "function enviar_empezar(){\n var json4 = mensaje(4);\n var j2={nombre:\"\",id:null};\n j2.nombre=nombre;\n j2.id=0;\n Cnom.push(j2);\n for (var i = 0; i <Cnom.length; i++) {\n json4.miembros.push(Cnom[i]);\n }\n enviarmulti(json4);\n empezar();\n}", "title": "" }, { "docid": "b0749f7aee4870fd3362e7fa9a382773", "score": "0.5308469", "text": "function adicionaCampoJson(json, nome, valor){\n\tjson[nome] = valor;\n\treturn json;\n}", "title": "" }, { "docid": "fa621915ef75ffaaaeb9ea9431296a77", "score": "0.53044176", "text": "function enviarDatosModTalla(evento)\n{\n evento.preventDefault();\n var cod_talla = $(\"#cod_tallamod\").val();\n //alert(id_viaticos);\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModTalla\",\"Datos\":datos, \"CodTalla\":cod_talla};\n var jsonobj=JSON.stringify(request);\n // alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModTalla(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "b793da174cd0bec068cd35bc3e106ea9", "score": "0.5298903", "text": "function devolverInstagramJson(res,body){\n res.status(200).send(body)\n}", "title": "" }, { "docid": "49976f0ac882d925ef5975f02f82cd9b", "score": "0.5292529", "text": "function enviarDatosAddPedidos(evento)\n{\n evento.preventDefault();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"AddPedido\",\"Datos\":datos};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarAddPedido(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "8cf2e20ec0cc6af885884bcbac84a044", "score": "0.528631", "text": "function CriandoJson(){\r\n \r\n\t\t\t\t\tlet i=0;\r\n\t\t\t\t\tlet string=\"{\";\r\n\t\t\t\t\tlet ValoresForm=$(\"form\").serializeArray();\r\n\t\t\t\t\t\tfor(j=0;j<campos.length;j++)\r\n\t\t\t\t\t\t\tif(j==2)\r\n\t\t\t\t\t\t\t\tstring+=\"\\\"\"+campos[j]+\"\\\"\"+\":\"+\"\\\"\"+ValoresForm[j].value+\"\\\"}\";\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tstring+=\"\\\"\"+campos[j]+\"\\\"\"+\":\"+\"\\\"\"+ValoresForm[j].value+\"\\\"\"+\",\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\talert(\"string:\"+string);\r\n\t\t\t\t\t//\tobj = JSON.parse(string);\r\n\t\t\t\t\t//\tfor(w in obj)\r\n\t\t\t\t\t//\talert(w+\":\"+obj[w]);\r\n\t\t\t\t\t}", "title": "" }, { "docid": "df216bd8c9b61c70c1602995e4732d4d", "score": "0.52843064", "text": "function enviarDatosAddProductos(evento)\n{\n evento.preventDefault();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"AddProducto\",\"Datos\":datos};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarAddProducto(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "457263ffeb59e2a3635c940011220737", "score": "0.528381", "text": "function createUser()\n{\n var data = {};\n data[\"name\"] = document.getElementById(\"name\").value;\n data[\"email\"] = document.getElementById(\"email\").value;\n var myJson = JSON.stringify(data);\n console.log(myJson);\n apiChangeData(\"User\", \"POST\", myJson, function (status) {\n printStatusHandleFormData(status);\n });\n}", "title": "" }, { "docid": "7cb5c52c525ba7f45644045f6fcf2efd", "score": "0.5282166", "text": "function ConvertFormToJSON(){\n var numeroBrinco = document.getElementById(\"numeroBrinco\").value;\n var categoriaAnimal = document.getElementById(\"categoriaAnimal\").value;\n var sexo = document.getElementById(\"sexo\").value;\n var pesoinicial = document.getElementById(\"pesoinicial\").value;\n var raca = document.getElementById(\"raca\").value;\n var pelagem = document.getElementById(\"pelagem\").value;\n var dataNascimento = document.getElementById(\"dataNascimento\").value;\n var lt = document.getElementById(\"combo-idlotes\");\n var lote = lt.options[lt.selectedIndex].value;\n\n var objeto = {\n numeroBrinco: numeroBrinco,\n categoriaAnimal: categoriaAnimal,\n sexo: sexo,\n pesoinicial: pesoinicial,\n raca: raca,\n pelagem: pelagem,\n dataNascimento: dataNascimento,\n lote: {\n id: lote\n }\n };\n\n return objeto;\n}", "title": "" }, { "docid": "f13735feefffdccac4cb774970af412d", "score": "0.52770764", "text": "function callbackForJson(){\n\n //Set JSON header and respond.\n response.writeHead({'Content-Type': 'application/json'});\n response.end( JSON.stringify(resultjson) );\n\n }", "title": "" }, { "docid": "5ba7fa9bcf9db9ed0bf7644df6572319", "score": "0.52770066", "text": "function enviarDatosModMaterial(evento)\n{\n evento.preventDefault();\n var codigo = $(\"#cod_materialmod\").val();\n //alert(id_viaticos);\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModMaterial\",\"Datos\":datos, \"Codigo\":codigo};\n var jsonobj=JSON.stringify(request);\n // alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModMaterial(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "80245645ac709cf2567cec16bc440e78", "score": "0.52744544", "text": "function json(response) {\r\n return response.json();\r\n }", "title": "" }, { "docid": "1ec5504af5485ab16eb3cc06dc1a1ac9", "score": "0.5273673", "text": "function createGroup()\n{\n var data = {};\n data[\"name\"] = document.getElementById(\"name\").value;\n data[\"prio\"] = document.getElementById(\"prio\").value;\n var myJson = JSON.stringify(data);\n console.log(myJson);\n apiChangeData(\"Group\", \"POST\", myJson, function (status) {\n printStatusHandleFormData(status);\n });\n}", "title": "" }, { "docid": "6d87140136de356e57b3e2a7e62a1902", "score": "0.5266732", "text": "function getJsonResponse(jsonData) {\n return new Response(JSON.stringify(jsonData), { headers: { 'Content-Type': 'application/json' } });\n}", "title": "" }, { "docid": "e39be577e3ac60f0441fb28bf833600a", "score": "0.5266407", "text": "function json(response) {\n return response.json()\n }", "title": "" }, { "docid": "e39be577e3ac60f0441fb28bf833600a", "score": "0.5266407", "text": "function json(response) {\n return response.json()\n }", "title": "" }, { "docid": "1a2529e47bc2981f5b214116940ffc26", "score": "0.52654964", "text": "json() {\n return Promise.resolve(this.body);\n }", "title": "" }, { "docid": "37626abfb96de5e8ec69559f5ecf0283", "score": "0.5263041", "text": "SaveToJson() {\r\n return {};\r\n }", "title": "" }, { "docid": "ee37fe480061bc9b18884c9dbb147c6d", "score": "0.5254099", "text": "function ObtenerTipoProducto()\n{\n var request = {\"Usuarios\":\"Tipo\"};\n var jsonobj=JSON.stringify(request);\n $.ajax({\n data: {administrador:jsonobj},\n dataType: 'json',\n url: 'ServletAdministrador',\n type: 'POST',\n success: function(jsonArray)\n {\n cargTipo(jsonArray); \n },\n error: function(jsonArray) \n {\n alert('Error al conectar con ServletAdministrador');\n }\n });\n}", "title": "" }, { "docid": "6d8a35c1a5c45624fba974ed57fd941c", "score": "0.5253365", "text": "function enviarDatosModVisita(evento)\n{\n evento.preventDefault();\n var id_visita = $(\"#id_visitaMod\").val();\n //alert(id_visitas);\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModVisita\",\"Datos\":datos, \"Id_Visitas\":id_visita};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModVisita(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "14f1a7a7ed24371518941beb4acc15b8", "score": "0.5249295", "text": "function enviarDatosModLinea(evento)\n{\n evento.preventDefault();\n var cod_linea = $(\"#cod_lineamod\").val();\n //alert(id_viaticos);\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModLinea\",\"Datos\":datos, \"CodLinea\":cod_linea};\n var jsonobj=JSON.stringify(request);\n // alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModLinea(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "31b8c93f26c53346aaf02730a56fde85", "score": "0.5245881", "text": "function enviarDatosAddViatico(evento)\n{\n evento.preventDefault();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"AddViatico\",\"Datos\":datos};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarAddViatico(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "43fd7e8fab67f2fc77503a094c52c1c3", "score": "0.5243687", "text": "function sendJSON(response, data) {\n response.writeHead(200, {'Content-Type': 'application/json'});\n response.end(JSON.stringify(data)); \n}", "title": "" }, { "docid": "75b4f86e96353a3d358d360cc24c75f7", "score": "0.52411056", "text": "toJSON() {\n return null;\n }", "title": "" }, { "docid": "75b4f86e96353a3d358d360cc24c75f7", "score": "0.52411056", "text": "toJSON() {\n return null;\n }", "title": "" }, { "docid": "b5d79d0a7ea2459a674cd161d1019ac1", "score": "0.5237203", "text": "function formToJSON() {\n\tvar idHotel = $('#idHotel').val();\n\treturn JSON.stringify({\n\t\t\"id\": idHotel == \"\" ? null : idHotel, \n\t\t\"name\": $('#nameHotel').val(), \n\t\t\"stars\": $('#starsHotel').val(),\n\t\t\"country\": $('#countryHotel').val(),\n\t\t\"description\": $('#descripHotel').val(),\n\t\t\"image\": actualHotel.image,\n\t\t});\n}", "title": "" }, { "docid": "67184cbae0f7080105b8290635065d84", "score": "0.52352273", "text": "toJSON(){\n return this.content\n }", "title": "" }, { "docid": "2a60c0494d8aba230f347ec9594ec41d", "score": "0.52299505", "text": "function inserir() { \n var description = document.getElementsByName(\"description\")[0].value;\n var price = document.getElementsByName(\"price\")[0].value;\n var inventory = document.getElementsByName(\"inventory\")[0].value;\n\n var product = {\n description: description,\n price: price,\n inventory: inventory\n }\n\n const options = {\n method: 'POST',\n mode: 'cors',\n body: JSON.stringify(product),\n headers: {\n 'Content-Type': 'application/json',\n 'Access-Control-Allow-Origin': '*'\n }\n }\n\n fetch(baseUrl, options)\n .then(response => response.text())\n .then(data => window.location.href(\"consulta.html\"))\n .catch((error) => {\n console.log(\"Não foi possivel consultar. Erro: \" + error.message);\n }\n\n )\n \n}", "title": "" }, { "docid": "56bdd03fd3bbe812330c8c70d0dbd20e", "score": "0.52214384", "text": "function requestToJSON() {\n var self = this;\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n };\n }", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "83dfa2300bc743ae235a78d47cc3e61c", "score": "0.52122146", "text": "function requestToJSON() {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "e701e6f667e276dda73a18c14f1c7fdc", "score": "0.5208812", "text": "function enviarDatosModCliente(evento)\n{\n evento.preventDefault();\n var id_cliente = $(\"#id_clienteMod\").val();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModCliente\",\"Datos\":datos, \"Id_Cliente\":id_cliente};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModCliente(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "e4a25a0c78e748bb7d53230b3be8021f", "score": "0.52065575", "text": "function enviarDatosModUsuario(evento)\n{\n evento.preventDefault();\n var id_usuario = $(\"#id_usuarioMod\").val();\n var datos_formulario = $(this).serializeArray(); \n var datos = JSON.stringify(SerializeToJson(datos_formulario));\n //alert(datos.toString());\n var request = {\"Usuarios\":\"ModUsuario\",\"Datos\":datos, \"Id_usuario\":id_usuario};\n var jsonobj=JSON.stringify(request);\n //alert(jsonobj.toString());\n \n $.ajax({ \n data: {administrador:jsonobj},\n type: 'POST',\n dataType: 'json',\n url: 'ServletAdministrador',\n success: function(jsonObj)\n {\n verificarModUsuario(jsonObj);\n },\n error: function() \n {\n alert('Error al conectar con el servidor');\n }\n });\n}", "title": "" }, { "docid": "ac6c6f218ee61ae6d176fa8f9b861ed8", "score": "0.52058846", "text": "exportJSON() {\n const jsonContent = 'data:text/json;charset=utf-8,' + JSON.stringify(this.pageData);\n this.downloadData(jsonContent, 'json');\n }", "title": "" }, { "docid": "16f7502a08bf20b816760157dc5ebc32", "score": "0.5204155", "text": "function conGetJson() {\n var o = {\n nombre: \"MiNombre\",\n apellidos: \"MiApellido\",\n edad: 20,\n nota: 7\n }\n $.getJSON(url, procesarJson);\n }", "title": "" }, { "docid": "ee882b693fef8b0b93dc070fe0d12950", "score": "0.5198779", "text": "toJSON() {\n return {};\n }", "title": "" }, { "docid": "ef37835b7504cf66181056de48d4532e", "score": "0.51977813", "text": "function sendJson(response, json){\n headers['Content-Type'] = 'application/json';\n response.writeHead(200, headers);\n response.write(JSON.stringify(json));\n response.end();\n}", "title": "" }, { "docid": "7a09eedef37e59a5b7465e96a450efc6", "score": "0.51977175", "text": "function jsonVeriEkle(e) {\n e.preventDefault();\n\n fetch('https://jsonplaceholder.typicode.com/posts',{\n method : 'POST',\n body : JSON.stringify({ //doğrudan js objesi gönderirsek hata alırız o yüzden jsona döndürdük\n title : \"Deneme\",\n body : \"Bu postun bodysi\",\n id : 4,\n }),\n headers : {\n 'Content-Type' : 'application/json' //gereklidir. ne tipte veri gönderdiğimizi belirlememiz önemli\n }\n }).then(response => response.json())\n .then(sonuc => console.log(sonuc));\n}", "title": "" }, { "docid": "ada7c9d7a8727932737fee12ea60d8df", "score": "0.51967245", "text": "function formToJSON() {\n     return JSON.stringify({\n         \"dzialkowicz.nrDzialkowicza\": $('#dzialkowicz.nrDzialkowicza').val(),\n         \"login\": $('#login').val(),\n   \"password\": $('#password').val(),\n   \"enabled\": $('#enabled').val(),\n         \"role\": $('#role').val()\n     \n         });\n}", "title": "" }, { "docid": "f38c4007306397655cbb7a04d15e22e8", "score": "0.51916474", "text": "function json(response) {\n return response.json();\n }", "title": "" }, { "docid": "a3de9d8c5ad82e875e831fd77f76f4ec", "score": "0.5185762", "text": "function requestToJSON () {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "a3de9d8c5ad82e875e831fd77f76f4ec", "score": "0.5185762", "text": "function requestToJSON () {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "a3de9d8c5ad82e875e831fd77f76f4ec", "score": "0.5185762", "text": "function requestToJSON () {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "a3de9d8c5ad82e875e831fd77f76f4ec", "score": "0.5185762", "text": "function requestToJSON () {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" }, { "docid": "a3de9d8c5ad82e875e831fd77f76f4ec", "score": "0.5185762", "text": "function requestToJSON () {\n var self = this\n return {\n uri: self.uri,\n method: self.method,\n headers: self.headers\n }\n}", "title": "" } ]
dbe84f8bedcb91e71a89e407859f4592
Result values are discarded and errors are thrown asynchronously. NOTE: this is different from the one in u: the function passed in must be fully bound with all of its arguments and will be immediately called (this does not return a function). This makes it work better with Flow: you get argument type checking by using `.bind`.
[ { "docid": "fd25935fbc84b77ee5d0eac5309260eb", "score": "0.0", "text": "function fireAndForgetPromise(fn) {\n fn().catch(err => {\n // Defer til later, so the error doesn't cause the promise to be rejected.\n setTimeout(() => {\n throw err;\n }, 0);\n });\n}", "title": "" } ]
[ { "docid": "78ee57329c56c4e2d393d0d67cd2428a", "score": "0.59694105", "text": "_handleResult(fun) {\n var newFuture = new CompletableFuture();\n this._addCallback(result => {\n try {\n var result2 = fun(result);\n _assert_result(result2);\n newFuture._completeResult(result2);\n } catch (err) {\n newFuture._completeResult(Result.exception(err));\n }\n });\n return newFuture;\n }", "title": "" }, { "docid": "cd73b2d4c0b040f31c3da32b7568cda9", "score": "0.59451157", "text": "do(...args) {\n const fn = _.last(args);\n if (!_.isFunction(fn)) throw new Error('invalid value for do');\n\n return this._rb.next(value => {\n const params = _.map(\n args.length > 1 ? args.slice(0, args.length - 1) : [value],\n param => {\n return param instanceof v\n ? param._rb.value\n : _.isFunction(param) ? param() : param;\n },\n );\n\n return Promise.map(params, param => param).then(_params => {\n return fn.apply(null, _params);\n });\n });\n }", "title": "" }, { "docid": "b0d4afa613ab8cbd055861e89e170209", "score": "0.5925385", "text": "function async(f) {\r\n return function () {\r\n var argsToForward = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n argsToForward[_i] = arguments[_i];\r\n }\r\n resolve(true).then(function () {\r\n f.apply(null, argsToForward);\r\n });\r\n };\r\n}", "title": "" }, { "docid": "b0d4afa613ab8cbd055861e89e170209", "score": "0.5925385", "text": "function async(f) {\r\n return function () {\r\n var argsToForward = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n argsToForward[_i] = arguments[_i];\r\n }\r\n resolve(true).then(function () {\r\n f.apply(null, argsToForward);\r\n });\r\n };\r\n}", "title": "" }, { "docid": "30bcffe2e39dcfcecfc74638bb5de7a1", "score": "0.5908433", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "de5f2dfe34416fa4bd7afbebd29fdd98", "score": "0.5879565", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n\n resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "5443797875151f43f46b6a0beade652c", "score": "0.57218754", "text": "async function Function_Call(thisValue, argumentsList) {\n return await Function_Construct(argumentsList);\n}", "title": "" }, { "docid": "0960a6e333e8d7d20a34885e195a68f5", "score": "0.57214195", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "0960a6e333e8d7d20a34885e195a68f5", "score": "0.57214195", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "0960a6e333e8d7d20a34885e195a68f5", "score": "0.57214195", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n promiseimpl.resolve(true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "3d3b234f737bfe3d3413d82160164184", "score": "0.5720258", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__[\"c\" /* resolve */](true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "3d3b234f737bfe3d3413d82160164184", "score": "0.5720258", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__[\"c\" /* resolve */](true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "3d3b234f737bfe3d3413d82160164184", "score": "0.5720258", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__[\"c\" /* resolve */](true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "3d3b234f737bfe3d3413d82160164184", "score": "0.5720258", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__[\"c\" /* resolve */](true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "3d3b234f737bfe3d3413d82160164184", "score": "0.5720258", "text": "function async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n __WEBPACK_IMPORTED_MODULE_0__promise_external__[\"c\" /* resolve */](true).then(function () {\n f.apply(null, argsToForward);\n });\n };\n}", "title": "" }, { "docid": "f7b0ae883f8c8111e432d230a5d2ae48", "score": "0.5700375", "text": "handle() {\n let result = undefined;\n try {\n result = this.function.apply(this.context, arguments);\n if (result && typeof result.then === 'function') {\n result = result.catch(error => {\n this._logEntry(error);\n this._runOnError();\n }).then(result => result);\n }\n } catch (error) {\n this._logEntry(error);\n this._runOnError();\n if (this.throw) {\n throw error;\n }\n }\n return result;\n }", "title": "" }, { "docid": "1555fa9cb1c03e59d44d88e56ebf039f", "score": "0.5686194", "text": "function async(f) {\n\t return function () {\n\t var argsToForward = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t argsToForward[_i] = arguments[_i];\n\t }\n\t promiseimpl.resolve(true).then(function () {\n\t f.apply(null, argsToForward);\n\t });\n\t };\n\t}", "title": "" }, { "docid": "2ec7c7487445027b784834ee33b87544", "score": "0.56711924", "text": "function fx(e,t,n,l){return new(n||(n=Promise))((function(a,o){function r(e){try{s(l.next(e))}catch(e){o(e)}}function i(e){try{s(l.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,i)}s((l=l.apply(e,t||[])).next())}))}", "title": "" }, { "docid": "699182a68addef70fd18c5311432e803", "score": "0.5618176", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"=\",\"hello\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "0233af54539f61e9ad4122a309f4e280", "score": "0.5594203", "text": "function wrapperCall(func) {\n\treturn async (req, res, next) => {\n\t\tconst functionName = func.name\n\n\t\ttry {\n\t\t\treturn await func.call(this, req, res, next, functionName);\n\t\t} catch (err) {\n\t\t\tif (err instanceof AbstractError) {\n\t\t\t\tnext(err)\n\t\t\t} else {\n\t\t\t\tnext(new InternalError(err, functionName));\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "382912929800bd6822ca6b89a7b83be6", "score": "0.5592835", "text": "function async(fn, onError) {\r\n\t return function () {\r\n\t var args = [];\r\n\t for (var _i = 0; _i < arguments.length; _i++) {\r\n\t args[_i] = arguments[_i];\r\n\t }\r\n\t Promise.resolve(true)\r\n\t .then(function () {\r\n\t fn.apply(void 0, args);\r\n\t })\r\n\t .catch(function (error) {\r\n\t if (onError) {\r\n\t onError(error);\r\n\t }\r\n\t });\r\n\t };\r\n\t}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "d1329dea6ebe1139a9d93e4cd63d1308", "score": "0.5563203", "text": "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "title": "" }, { "docid": "bc709be5cac3dda37217281c9d5ff33b", "score": "0.55496544", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "bc709be5cac3dda37217281c9d5ff33b", "score": "0.55496544", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "82d6381122976b300ec168daa7db2d0a", "score": "0.55492485", "text": "async function myFunc() {\n return (\n console.log(\"result: \", result),\n console.log(\"result2: \", result2),\n console.log(\"result3: \", result3)\n );\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "a8bc7a39acefbc02be64d735a1edcda8", "score": "0.5544127", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "65a8d9e21511d8ae0e8c7ed6880c0abf", "score": "0.5538322", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "65a8d9e21511d8ae0e8c7ed6880c0abf", "score": "0.5538322", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "0e9a9f648f52734a1ccf9a6f35ae4078", "score": "0.5522823", "text": "async function f() {\r\n return 1;\r\n}", "title": "" }, { "docid": "544b3cdf548d2020f82d4ce16a24513e", "score": "0.5517995", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"!=\",\"hello\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "760b86d53da85f2e65034abdda737717", "score": "0.5507953", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"is\",true]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "0c264b36a6102ff8639ba1584b3b0bd0", "score": "0.5506875", "text": "function failproofAsyncCall(handleError, _this, _fn) {\n var fn = function() {\n var args = Array.prototype.slice.call(arguments);\n try {\n _fn.apply(_this, args);\n } catch (err) {\n handleError(err, (_fn.length === 2) ? args[0] : args[1], (_fn.length === 2) ? args[1] : args[2]);\n }\n };\n return fn;\n /*return function() {\n // посмотреть может быть нужно убрать setImmediate?!\n var args = Array.prototype.slice.call(arguments);\n args.unshift(fn);\n setImmediate.apply(null, args);\n };*/\n}", "title": "" }, { "docid": "eb4d9d05412fc544fb09a2593977f373", "score": "0.54824626", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"<=\",2]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "22e489b12e77ca7f22f0c4cd28a01041", "score": "0.5475362", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"!>\",2]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "472a489633f74a1cc2c957044204bdf8", "score": "0.54651386", "text": "function run() {\n var index = -1;\n var input = slice.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done);\n }\n\n next.apply(null, [null].concat(input));\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index];\n var params = slice.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return;\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "title": "" }, { "docid": "472a489633f74a1cc2c957044204bdf8", "score": "0.54651386", "text": "function run() {\n var index = -1;\n var input = slice.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done);\n }\n\n next.apply(null, [null].concat(input));\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index];\n var params = slice.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return;\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "title": "" }, { "docid": "b502f2c8c3f7ab397dc3d9e8f3430272", "score": "0.5453802", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "b502f2c8c3f7ab397dc3d9e8f3430272", "score": "0.5453802", "text": "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "title": "" }, { "docid": "305350a080a1e00baec0da11e4761f03", "score": "0.54474604", "text": "function asyncFunctionReturningValueMultipleArguments(a, b, callback) {\n process.nextTick(function(){\n callback(null, a, b);\n })\n return 123;\n}", "title": "" }, { "docid": "5140f15baf78413431572f630758230d", "score": "0.54473937", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "4608138376920995bd3ef21ec5cff7e9", "score": "0.5444301", "text": "function async(fn, onError) {\n\t return function () {\n\t var args = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t args[_i] = arguments[_i];\n\t }\n\t Promise.resolve(true)\n\t .then(function () {\n\t fn.apply(void 0, args);\n\t })\n\t .catch(function (error) {\n\t if (onError) {\n\t onError(error);\n\t }\n\t });\n\t };\n\t}", "title": "" }, { "docid": "d126923eee591c32b22650f66c7f18e2", "score": "0.5438969", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\">\",2]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "a2030ab2483b1514280a2db17881d98a", "score": "0.54376805", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"<\",2]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "db5b5f01c6bf86c8560b07b7873b734b", "score": "0.54265624", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb_string);\r\n\t\t d.addFallback(_fb_int);\r\n\t\t d.addPromise([\"?\",\"string\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "352448a9d5e057c88758b337963574f0", "score": "0.54186165", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"*\",\"Yay world\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "f69275c751858ea01aafbff1a09232d6", "score": "0.5412121", "text": "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "title": "" }, { "docid": "d7f1af5c17a788db7a08cd4b2b3ae45a", "score": "0.5403581", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"is\",true], [\"?\",\"boolean\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "f75608d0a383653d601eb4b4e9454499", "score": "0.54002094", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var dl = defer.defered_list();\r\n\t\t dl.defered_list_addCallback(_cb);\r\n\t\t dl.addFallback(_fb);\r\n\t\t dl.addPromise([\"=\",\"hello\"]);\r\n\t\t dl.defered_list_addErrback(_eb);\r\n\t\t dl.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "578d8a68b496afc756ad4bde99c4d8b6", "score": "0.53977937", "text": "function wrapper(...args) {\n let result\n try {\n result = f.call(this, ...args)\n } catch (error) {\n throw config.modifyStack(name, error)\n }\n\n if (result instanceof config.Promise) {\n result = result.catch(error => {\n throw config.modifyStack(name, error)\n })\n }\n\n return result\n }", "title": "" }, { "docid": "280bf7d31b50bf9f86baadebfdda3794", "score": "0.5397135", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"is\",true]);\r\n\t\t\td.addPromise([\"!?\",\"int\"]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "f4f38e5c551e5628f69e6a1ad307455d", "score": "0.5396084", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"!<\",2]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "d15fa6b9bdb7bae87687fc2960d4a4c0", "score": "0.53867674", "text": "function _main2(a){ \r\n\t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"=\",\"hello\"]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "dee2fef877d74ccf4aae77acebbafa8c", "score": "0.53847873", "text": "function run() {\n var index = -1;\n var input = slice$1.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input));\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index];\n var params = slice$1.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap_1(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "title": "" }, { "docid": "91bdc0e752182eb7a4b7e24a46fa475b", "score": "0.5375645", "text": "function passResultErrors (func) {\n return (...args) => {\n const params = args.slice(0, args.length - 1)\n const callback = args[args.length - 1]\n\n func(...params, (err, results) => {\n if (err) {\n return callback(err)\n }\n\n const arrResults = Array.isArray(results) ? results : [results]\n const foundError = arrResults.find(x => x instanceof Error)\n return foundError\n ? callback(foundError, results)\n : callback(null, results)\n })\n }\n}", "title": "" }, { "docid": "667d3c7ed3a6a7d9a8026d973f6f9def", "score": "0.53682554", "text": "static handler(fn, event, context, cb) {\n try {\n fn();\n } catch (err) {\n if (!RequestHandler.isUserError(err)) {\n RequestHandler.logRequest(context, err, event);\n throw err;\n }\n const res = RequestHandler.getResponseBody(err, null, context);\n if (_.isObject(res.body)) {\n res.body = JSON.stringify(res.body);\n }\n RequestHandler.logRequest(context, err, event, res);\n return cb(null, res);\n }\n }", "title": "" }, { "docid": "97d00ad522fe89a2c1734f6124d0be12", "score": "0.53607535", "text": "function runFunction () {\n\t\t\tvar args = _.toArray(arguments);\n\n\t\t\t// If only arg is a parley callback object,\n\t\t\t// convert into classic (err,data) notation\n\t\t\targs = expandParleyActionObject(args);\n\n\t\t\t// Add callback as argument\n\t\t\targs.push(cb);\n\n\t\t\t// Add reference to discard stack as final argument\n\t\t\targs.push(parley.dStack);\n\t\t\n\n\t\t\t// Defer until the event loop finishes to avoid triggering before all functions have been added\n\t\t\t_.defer(function () {\n\t\t\t\t// Run function in proper context w/ proper arguments\n\t\t\t\t// (if ctx is null, the fn will run in the global execution context)\n\t\t\t\tfn.apply(ctx, args);\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "1b8b3cb6d89855a989a8b38a51f68325", "score": "0.5353527", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb_string);\r\n\t\t\td.addFallback(_fb_int);\r\n\t\t\td.addPromise([\"?\",\"int\"]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "67ab2e42431b51f4e9fc6a7ce0b80a65", "score": "0.53462833", "text": "function _main(a){ \r\n\t\t\t var ret = a;\r\n\t\t\t var d = defer.Deferred();\r\n\t\t\t d.addCallback(_cb);\r\n\t\t\t d.addFallback(_fb);\r\n\t\t\t d.addPromise([\"is\",true]);\r\n\t\t\t d.addPromise([\"?\",\"boolean\"]);\r\n\t\t\t d.addErrback(_eb);\r\n\t\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "a522f77c097824e645c81b4188b2fa32", "score": "0.5344086", "text": "function resultWrapper(func, processor) {\n var t = this;\n\n return getResult.call(t, func.call(t), undefined, processor);\n}", "title": "" }, { "docid": "5f1299d3a592fc32a7f0305e662f7419", "score": "0.5341773", "text": "function callbackify(fn) {\r\n return async(...args) => {\r\n let callback = args.pop();\r\n\r\n try {\r\n callback(null, await fn(...args));\r\n } catch(err) {\r\n callback(err);\r\n }\r\n };\r\n}", "title": "" }, { "docid": "2131511009bf62e7c356b32f7c721c2d", "score": "0.5340168", "text": "function handleErrors(fn) {\n console.log('handleErrors called')\n return async function(req, res, next) {\n try {\n return await fn(req, res)\n } catch (x) {\n next(x)\n }\n }\n}", "title": "" }, { "docid": "6f33260fc8d3bec92537ac3ed420b810", "score": "0.532828", "text": "function s(){return async(t,e)=>{}}", "title": "" }, { "docid": "28d393d12c78cc10ecc6be6523604840", "score": "0.5321367", "text": "function _main(a){ \r\n\t\t var ret = a;\r\n\t\t var d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t d.addFallback(_fb);\r\n\t\t d.addPromise([\"!=\",\"Nay\"]);\r\n\t\t d.addErrback(_eb);\r\n\t\t d.returnValue(ret);\r\n\t\t }", "title": "" }, { "docid": "c29504914bb2efa1132a2172fb7fdc12", "score": "0.53183234", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"<=\",2]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "0599f545d4a9871a85ba4dc431dbaf1f", "score": "0.5306814", "text": "executeAsync() {}", "title": "" }, { "docid": "2b382f8b6daeffe390676209b2efdaca", "score": "0.52866375", "text": "function _main2(a){ \r\n\t\t\t var ret = a;\r\n\t\t\t var dl = defer.defered_list();\r\n\t\t\t dl.defered_list_addCallback(_cb);\r\n\t\t\t dl.addFallback(_fb);\r\n\t\t\t dl.addPromise([\"=\",\"hello\"]);\r\n\t\t\t dl.defered_list_addErrback(_eb);\r\n\t\t\t dl.returnValue(ret);\r\n\t\t\t }", "title": "" }, { "docid": "c05755a148825c8fa81a37fdbeb33dce", "score": "0.5281594", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"is\",true]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "670da84eb6edda2d35bd696d77c7799f", "score": "0.52797735", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"<\",2]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "69c580761417e8f1fb829c86f4ace899", "score": "0.52754444", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"!=\",\"hello\"]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "9c8f0fe3f99e19c581e8ce74f9908c60", "score": "0.5274522", "text": "function wrapAsyncFn(fn, ...args) {\n return fn.bind(null, ...args);\n}", "title": "" }, { "docid": "ba0eb622c6666092eff7eeed23f9b6f3", "score": "0.5269518", "text": "function execute(callback, value, deferred) {\n process.nextTick(function () {\n try {\n var result = callback(value);\n if (result && typeof result.then === func)\n result.then(deferred.resolve, deferred.reject);\n else\n deferred.resolve(result);\n }\n catch (error) {\n deferred.reject(error);\n }\n });\n }", "title": "" }, { "docid": "0640d0e6afb2876099dfa8fe7738d685", "score": "0.526128", "text": "function _main22(a){ \r\n\t\t\tvar ret = a;\r\n\t\t\tvar dl = defer.defered_list();\r\n\t\t\tdl.defered_list_addCallback(_cb);\r\n\t\t\tdl.addFallback(_fb);\r\n\t\t\tdl.addPromise([\"is\",true], [\"!?\",\"string\"]);\r\n\t\t\tdl.defered_list_addErrback(_eb);\r\n\t\t\tdl.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "fca099c55496b475bc8520c9a8f572c4", "score": "0.5258059", "text": "function _main2(a){ \t\t\t\t \r\n\t\t\tvar ret = a;\r\n\t\t\tvar d = defer.Deferred();\r\n\t\t d.addCallback(_cb);\r\n\t\t\td.addFallback(_fb);\r\n\t\t\td.addPromise([\"!>\",2]);\r\n\t\t\td.addErrback(_eb);\r\n\t\t\td.returnValue(ret);\r\n\t\t\t}", "title": "" }, { "docid": "340b94ce1c98f6942a2ab0ea3415c3a7", "score": "0.5257733", "text": "function _main22(a){ \r\n\t\t\tvar ret = a;\r\n\t\t\tvar dl = defer.defered_list();\r\n\t\t\tdl.defered_list_addCallback(_cb);\r\n\t\t\tdl.addFallback(_fb);\r\n\t\t\tdl.addPromise([\"!=\",\"hello\"]);\r\n\t\t\tdl.defered_list_addErrback(_eb);\r\n\t\t\tdl.returnValue(ret);\r\n\t\t\t}", "title": "" } ]
eb0a6caa1d4127ac6b3f7abe406fce15
Returns true if the given pathname matches the active routes and params.
[ { "docid": "22cb90b0d5785bfeb4fff67db6806f42", "score": "0.8250534", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" } ]
[ { "docid": "634b6e847714b81a131f09e160592b09", "score": "0.8346915", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = _PatternUtils.matchPattern(pattern, remainingPathname);\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "9e734bbe64dbb0a9b632b3cb964614a6", "score": "0.83292127", "text": "function routeIsActive(pathname, routes, params) {\r\n\t var remainingPathname = pathname,\r\n\t paramNames = [],\r\n\t paramValues = [];\r\n\t\r\n\t // for...of would work here but it's probably slower post-transpilation.\r\n\t for (var i = 0, len = routes.length; i < len; ++i) {\r\n\t var route = routes[i];\r\n\t var pattern = route.path || '';\r\n\t\r\n\t if (pattern.charAt(0) === '/') {\r\n\t remainingPathname = pathname;\r\n\t paramNames = [];\r\n\t paramValues = [];\r\n\t }\r\n\t\r\n\t if (remainingPathname !== null && pattern) {\r\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\r\n\t if (matched) {\r\n\t remainingPathname = matched.remainingPathname;\r\n\t paramNames = [].concat(paramNames, matched.paramNames);\r\n\t paramValues = [].concat(paramValues, matched.paramValues);\r\n\t } else {\r\n\t remainingPathname = null;\r\n\t }\r\n\t\r\n\t if (remainingPathname === '') {\r\n\t // We have an exact match on the route. Just check that all the params\r\n\t // match.\r\n\t // FIXME: This doesn't work on repeated params.\r\n\t return paramNames.every(function (paramName, index) {\r\n\t return String(paramValues[index]) === String(params[paramName]);\r\n\t });\r\n\t }\r\n\t }\r\n\t }\r\n\t\r\n\t return false;\r\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "68c9af03ffc8c78872675652c22e8da8", "score": "0.8318472", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\t\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\t\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\t\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\t\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\t\n\t return false;\n\t}", "title": "" }, { "docid": "f37f5c361fdb8702b7b8ecedd5df8134", "score": "0.83145726", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(_PatternUtils__WEBPACK_IMPORTED_MODULE_0__[\"matchPattern\"])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "f37f5c361fdb8702b7b8ecedd5df8134", "score": "0.83145726", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(_PatternUtils__WEBPACK_IMPORTED_MODULE_0__[\"matchPattern\"])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "f37f5c361fdb8702b7b8ecedd5df8134", "score": "0.83145726", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(_PatternUtils__WEBPACK_IMPORTED_MODULE_0__[\"matchPattern\"])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "ab372a721fa59269927df5ae6588c89d", "score": "0.83102566", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "ab372a721fa59269927df5ae6588c89d", "score": "0.83102566", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "ab372a721fa59269927df5ae6588c89d", "score": "0.83102566", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "ab372a721fa59269927df5ae6588c89d", "score": "0.83102566", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "ab372a721fa59269927df5ae6588c89d", "score": "0.83102566", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "a5270c739e880cd7b661b583cdbec554", "score": "0.8305677", "text": "function routeIsActive(pathname, routes, params) {\n\t var remainingPathname = pathname,\n\t paramNames = [],\n\t paramValues = [];\n\n\t // for...of would work here but it's probably slower post-transpilation.\n\t for (var i = 0, len = routes.length; i < len; ++i) {\n\t var route = routes[i];\n\t var pattern = route.path || '';\n\n\t if (pattern.charAt(0) === '/') {\n\t remainingPathname = pathname;\n\t paramNames = [];\n\t paramValues = [];\n\t }\n\n\t if (remainingPathname !== null && pattern) {\n\t var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\t if (matched) {\n\t remainingPathname = matched.remainingPathname;\n\t paramNames = [].concat(paramNames, matched.paramNames);\n\t paramValues = [].concat(paramValues, matched.paramValues);\n\t } else {\n\t remainingPathname = null;\n\t }\n\n\t if (remainingPathname === '') {\n\t // We have an exact match on the route. Just check that all the params\n\t // match.\n\t // FIXME: This doesn't work on repeated params.\n\t return paramNames.every(function (paramName, index) {\n\t return String(paramValues[index]) === String(params[paramName]);\n\t });\n\t }\n\t }\n\t }\n\n\t return false;\n\t}", "title": "" }, { "docid": "35b27b7f6ec285f4e270a1921295be6d", "score": "0.8300669", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = __WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */](pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "7d735ff8a74320b85c36515be1047ce1", "score": "0.82997483", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "7d735ff8a74320b85c36515be1047ce1", "score": "0.82997483", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "7d735ff8a74320b85c36515be1047ce1", "score": "0.82997483", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = Object(__WEBPACK_IMPORTED_MODULE_0__PatternUtils__[\"c\" /* matchPattern */])(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "d411cb2ca78947ec4d40859f944dfded", "score": "0.82740194", "text": "function routeIsActive(pathname,routes,params){var remainingPathname=pathname,paramNames=[],paramValues=[]; // for...of would work here but it's probably slower post-transpilation.\nfor(var i=0,len=routes.length;i<len;++i){var route=routes[i];var pattern=route.path||'';if(pattern.charAt(0)==='/'){remainingPathname=pathname;paramNames=[];paramValues=[];}if(remainingPathname!==null&&pattern){var matched=(0,_PatternUtils.matchPattern)(pattern,remainingPathname);if(matched){remainingPathname=matched.remainingPathname;paramNames=[].concat(paramNames,matched.paramNames);paramValues=[].concat(paramValues,matched.paramValues);}else {remainingPathname=null;}if(remainingPathname===''){ // We have an exact match on the route. Just check that all the params\n// match.\n// FIXME: This doesn't work on repeated params.\nreturn paramNames.every(function(paramName,index){return String(paramValues[index])===String(params[paramName]);});}}}return false;}", "title": "" }, { "docid": "c503609109c37cf00ec6b18cf6de333f", "score": "0.8257419", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = [];\n\n // for...of would work here but it's probably slower post-transpilation.\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = matchPattern(pattern, remainingPathname);\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "e00996dd37d746d9f1fff648990580bc", "score": "0.8253086", "text": "function routeIsActive(pathname,routes,params){var remainingPathname=pathname,paramNames=[],paramValues=[]; // for...of would work here but it's probably slower post-transpilation.\n\tfor(var i=0,len=routes.length;i<len;++i){var route=routes[i];var pattern=route.path||'';if(pattern.charAt(0)==='/'){remainingPathname=pathname;paramNames=[];paramValues=[];}if(remainingPathname!==null&&pattern){var matched=(0,_PatternUtils.matchPattern)(pattern,remainingPathname);if(matched){remainingPathname=matched.remainingPathname;paramNames=[].concat(paramNames,matched.paramNames);paramValues=[].concat(paramValues,matched.paramValues);}else {remainingPathname=null;}if(remainingPathname===''){ // We have an exact match on the route. Just check that all the params\n\t// match.\n\t// FIXME: This doesn't work on repeated params.\n\treturn paramNames.every(function(paramName,index){return String(paramValues[index])===String(params[paramName]);});}}}return false;}", "title": "" }, { "docid": "e00996dd37d746d9f1fff648990580bc", "score": "0.8253086", "text": "function routeIsActive(pathname,routes,params){var remainingPathname=pathname,paramNames=[],paramValues=[]; // for...of would work here but it's probably slower post-transpilation.\n\tfor(var i=0,len=routes.length;i<len;++i){var route=routes[i];var pattern=route.path||'';if(pattern.charAt(0)==='/'){remainingPathname=pathname;paramNames=[];paramValues=[];}if(remainingPathname!==null&&pattern){var matched=(0,_PatternUtils.matchPattern)(pattern,remainingPathname);if(matched){remainingPathname=matched.remainingPathname;paramNames=[].concat(paramNames,matched.paramNames);paramValues=[].concat(paramValues,matched.paramValues);}else {remainingPathname=null;}if(remainingPathname===''){ // We have an exact match on the route. Just check that all the params\n\t// match.\n\t// FIXME: This doesn't work on repeated params.\n\treturn paramNames.every(function(paramName,index){return String(paramValues[index])===String(params[paramName]);});}}}return false;}", "title": "" }, { "docid": "a238bc08a75420ca7ae84ff4e35699d1", "score": "0.8243896", "text": "function routeIsActive(pathname, routes, params) {\n var remainingPathname = pathname,\n paramNames = [],\n paramValues = []; // for...of would work here but it's probably slower post-transpilation.\n\n for (var i = 0, len = routes.length; i < len; ++i) {\n var route = routes[i];\n var pattern = route.path || '';\n\n if (pattern.charAt(0) === '/') {\n remainingPathname = pathname;\n paramNames = [];\n paramValues = [];\n }\n\n if (remainingPathname !== null && pattern) {\n var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);\n\n if (matched) {\n remainingPathname = matched.remainingPathname;\n paramNames = [].concat(paramNames, matched.paramNames);\n paramValues = [].concat(paramValues, matched.paramValues);\n } else {\n remainingPathname = null;\n }\n\n if (remainingPathname === '') {\n // We have an exact match on the route. Just check that all the params\n // match.\n // FIXME: This doesn't work on repeated params.\n return paramNames.every(function (paramName, index) {\n return String(paramValues[index]) === String(params[paramName]);\n });\n }\n }\n }\n\n return false;\n}", "title": "" }, { "docid": "00010a059c43a0784ef3b1598550838e", "score": "0.7615268", "text": "function routeIsActive(pathname, activeRoutes, activeParams, indexOnly) {\n var route = getMatchingRoute(pathname, activeRoutes, activeParams); // 62\n // 63\n if (route == null) return false; // 64\n // 65\n if (indexOnly) return activeRoutes.length > 1 && activeRoutes[activeRoutes.length - 1] === route.indexRoute;\n // 67\n return true; // 68\n} // 69", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "980b8c3ee6fef1ddcefa0255fc4511a8", "score": "0.7316366", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "80baaa20327d0a5a318853b16287f703", "score": "0.7314457", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\t\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\t\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "80baaa20327d0a5a318853b16287f703", "score": "0.7314457", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\t\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\t\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "80baaa20327d0a5a318853b16287f703", "score": "0.7314457", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n\t var i = getMatchingRouteIndex(pathname, routes, params);\n\t\n\t if (i === null) {\n\t // No match.\n\t return false;\n\t } else if (!indexOnly) {\n\t // Any match is good enough.\n\t return true;\n\t }\n\t\n\t // If any remaining routes past the match index have paths, then we can't\n\t // be on the index route.\n\t return routes.slice(i + 1).every(function (route) {\n\t return !route.path;\n\t });\n\t}", "title": "" }, { "docid": "d69039b6d7fc6bb589ef04de210f4f34", "score": "0.72228116", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n if (location == null) return false; // 88\n // 89\n if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n // 91\n return queryIsActive(query, location.query); // 92\n} // 93", "title": "" }, { "docid": "9575eb92e1e6c0097728022e7c8ca656", "score": "0.7204629", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n var i = getMatchingRouteIndex(pathname, routes, params);\n\n if (i === null) {\n // No match.\n return false;\n } else if (!indexOnly) {\n // Any match is good enough.\n return true;\n }\n\n // If any remaining routes past the match index have paths, then we can't\n // be on the index route.\n return routes.slice(i + 1).every(function (route) {\n return !route.path;\n });\n}", "title": "" }, { "docid": "9575eb92e1e6c0097728022e7c8ca656", "score": "0.7204629", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n var i = getMatchingRouteIndex(pathname, routes, params);\n\n if (i === null) {\n // No match.\n return false;\n } else if (!indexOnly) {\n // Any match is good enough.\n return true;\n }\n\n // If any remaining routes past the match index have paths, then we can't\n // be on the index route.\n return routes.slice(i + 1).every(function (route) {\n return !route.path;\n });\n}", "title": "" }, { "docid": "9575eb92e1e6c0097728022e7c8ca656", "score": "0.7204629", "text": "function routeIsActive(pathname, routes, params, indexOnly) {\n var i = getMatchingRouteIndex(pathname, routes, params);\n\n if (i === null) {\n // No match.\n return false;\n } else if (!indexOnly) {\n // Any match is good enough.\n return true;\n }\n\n // If any remaining routes past the match index have paths, then we can't\n // be on the index route.\n return routes.slice(i + 1).every(function (route) {\n return !route.path;\n });\n}", "title": "" }, { "docid": "24eb24344a7a2e8483f30c615f3a35d2", "score": "0.71818435", "text": "activeRoute(routeName) {\n // return true;\n return this.props.location.pathname.indexOf(routeName) > -1;\n }", "title": "" }, { "docid": "c914887d0713ce7aee495c613f66d3c8", "score": "0.71574664", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n\t if (location == null) return false;\n\n\t if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n\t return queryIsActive(query, location.query);\n\t}", "title": "" }, { "docid": "c914887d0713ce7aee495c613f66d3c8", "score": "0.71574664", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n\t if (location == null) return false;\n\n\t if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n\t return queryIsActive(query, location.query);\n\t}", "title": "" }, { "docid": "c914887d0713ce7aee495c613f66d3c8", "score": "0.71574664", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n\t if (location == null) return false;\n\n\t if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n\t return queryIsActive(query, location.query);\n\t}", "title": "" }, { "docid": "c914887d0713ce7aee495c613f66d3c8", "score": "0.71574664", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n\t if (location == null) return false;\n\n\t if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n\t return queryIsActive(query, location.query);\n\t}", "title": "" }, { "docid": "a12f49929746b9878e93d680e0ced625", "score": "0.70176464", "text": "activeRoute(routeName) {\n\t\treturn this.props.location.pathname.indexOf(routeName) > -1 ? true : false;\n\t}", "title": "" }, { "docid": "216166ccad4d99ac7dff6dd4185aaf09", "score": "0.69837445", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n if (location == null) return false;\n\n if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n return queryIsActive(query, location.query);\n}", "title": "" }, { "docid": "216166ccad4d99ac7dff6dd4185aaf09", "score": "0.69837445", "text": "function isActive(pathname, query, indexOnly, location, routes, params) {\n if (location == null) return false;\n\n if (!routeIsActive(pathname, routes, params, indexOnly)) return false;\n\n return queryIsActive(query, location.query);\n}", "title": "" }, { "docid": "c37f4b3581019634db82f979319a1993", "score": "0.6835707", "text": "function activeRoute(routeName) {\n return location.pathname === routeName;\n }", "title": "" }, { "docid": "49f899e8661d7c71a7582ab2e7f989d3", "score": "0.67003804", "text": "function activeRoute(routeName) {\n return props.location.pathname.indexOf(routeName) > -1 ? true : false;\n }", "title": "" }, { "docid": "49f899e8661d7c71a7582ab2e7f989d3", "score": "0.67003804", "text": "function activeRoute(routeName) {\n return props.location.pathname.indexOf(routeName) > -1 ? true : false;\n }", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" }, { "docid": "ea226b3c2c7e0fc26ffbecface3f764d", "score": "0.6624582", "text": "function pathIsActive(pathname, currentPathname) {\n\t // Normalize leading slash for consistency. Leading slash on pathname has\n\t // already been normalized in isActive. See caveat there.\n\t if (currentPathname.charAt(0) !== '/') {\n\t currentPathname = '/' + currentPathname;\n\t }\n\t\n\t // Normalize the end of both path names too. Maybe `/foo/` shouldn't show\n\t // `/foo` as active, but in this case, we would already have failed the\n\t // match.\n\t if (pathname.charAt(pathname.length - 1) !== '/') {\n\t pathname += '/';\n\t }\n\t if (currentPathname.charAt(currentPathname.length - 1) !== '/') {\n\t currentPathname += '/';\n\t }\n\t\n\t return currentPathname === pathname;\n\t}", "title": "" } ]
5cbce8285c9c5008fa8c93e335adf3ed
FISHER YATES shuffle algorithm
[ { "docid": "62c86e7a7c866ea5f74ac5b98ef58435", "score": "0.0", "text": "function shuffle(array) {\n var counter = array.length;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n var index = Math.floor(Math.random() * counter);\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n var temp = array[counter];\n array[counter] = array[index];\n array[index] = temp;\n }\n\n return array;\n}", "title": "" } ]
[ { "docid": "38193c221df3f1249aece0921f8bfb8b", "score": "0.7693532", "text": "function shuffle() {\n}", "title": "" }, { "docid": "072eb2d7c2fe11377d8a756c77e06a81", "score": "0.72091365", "text": "function fischerYatesShuffle(list){\n\n var len = list.length;\n if (len <= 1) return list;\n \n for(var i=0 ; i < len ; i++) {\n \n random_choice_index = Math.random(i, len);\n \n swap(list, i, random_choice_index);\n }\n \n return list;\n}", "title": "" }, { "docid": "cd08d99c696fee0207865571db6b23f6", "score": "0.71474534", "text": "function shuffle(array){cov_28b7l1h514().f[0]++;cov_28b7l1h514().s[0]++;//returns given array if empty or no elements to swap around\nif(array.length<=1){cov_28b7l1h514().b[0][0]++;cov_28b7l1h514().s[1]++;return array;}else{cov_28b7l1h514().b[0][1]++;}let floor=(cov_28b7l1h514().s[2]++,0);let ceiling=(cov_28b7l1h514().s[3]++,array.length-1);cov_28b7l1h514().s[4]++;while(floor<ceiling){let randomIndex=(cov_28b7l1h514().s[5]++,getRandom(floor,ceiling));//current spot does not equal the random index generated\ncov_28b7l1h514().s[6]++;if(randomIndex!==floor){cov_28b7l1h514().b[1][0]++;let temp=(cov_28b7l1h514().s[7]++,array[floor]);cov_28b7l1h514().s[8]++;array[floor]=array[randomIndex];cov_28b7l1h514().s[9]++;array[randomIndex]=temp;cov_28b7l1h514().s[10]++;floor++;}else{cov_28b7l1h514().b[1][1]++;}}cov_28b7l1h514().s[11]++;return array;}", "title": "" }, { "docid": "f9b7a09e265259e3f0ddb656f973f88d", "score": "0.70738953", "text": "shuffleMain() {\n for(let i = this.shuffle.length -1; i > 0; i--) {\n let ii = Math.floor(Math.random() * (i + 1));\n let temp = this.shuffle[i];\n this.shuffle[i] = this.shuffle[ii];\n this.shuffle[ii] = temp;\n }\n return this.shuffle;\n // let random = this.deck.length, temp, i;\n\n // while(random) {\n // i = Math.floor(Math.random() * random --);\n // temp = this.deck[random];\n // this.deck[random] = this.deck[i];\n // this.deck[i] = temp;\n // }\n // return this.deck;\n }", "title": "" }, { "docid": "65868ed1047ae23d9695a3e3650ee670", "score": "0.69887483", "text": "shuffle() {\n return;\n }", "title": "" }, { "docid": "33d818bfae0697b24fb25eea74143186", "score": "0.69846714", "text": "function shuffle()\r\n{\r\n\treturn 0.5 - Math.random();\r\n}", "title": "" }, { "docid": "19e2003651a89e9fa55f42de058b1249", "score": "0.69426274", "text": "function shuffleAll() { //SHUFFLE EACH ARRAY SEPARATELY\n shuffle(lorem);\n shuffle(phish);\n shuffle(trek);\n shuffle(lies);\n}", "title": "" }, { "docid": "adac974cc2497e4122c003937b43d3a0", "score": "0.6930979", "text": "shuffle() {\n let a = Array.from(this.data);\n this.set(FudgeCore.Random.default.splice(a), FudgeCore.Random.default.splice(a), a[0]);\n }", "title": "" }, { "docid": "7775499b3eb1f100efda57846a053bc9", "score": "0.6876155", "text": "function shuffle(niz) {\n\t let n = niz.length, pom, i;\n\n\t while (n) {\n\n\t i = Math.floor(Math.random() * n--);\n\n\t pom = niz[n];\n\t niz[n] = niz[i];\n\t niz[i] = pom;\n\t }\n\n\t return niz;\n\t}", "title": "" }, { "docid": "7d6134c81e952e6a0060923d2907305e", "score": "0.6861148", "text": "function shuffle() {\n return Math.random() - 0.5;\n}", "title": "" }, { "docid": "8dfa978dd26ce77867588334214b22b5", "score": "0.68385804", "text": "function fyShuffle(array) {\n var i = array.length,\n j = 0,\n temp;\n\n while (i--) {\n j = Math.floor(Math.random() * (i+1));\n\n /* swap randomly chosen element with current element */\n temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "title": "" }, { "docid": "9a28f22e3672cf0c74236d5566c7db81", "score": "0.683437", "text": "function shuffleArrays() {\n shuffle(valueOptions);\n shuffle(crystals);\n }", "title": "" }, { "docid": "4df3818175f97dbb9a7047e526bc8380", "score": "0.6830752", "text": "shuffle(input) {\n console.log(\"shuffling\");\n input.forEach((v, i) => {\n this.swap(input, i, Math.floor(Math.random() * input.length));\n });\n\n return input;\n }", "title": "" }, { "docid": "d632ee3f1b99a02a6e91f4e16e089738", "score": "0.67889965", "text": "function shuffle(array) {\n let counter = array.length;\n // FISHER-YATES SORTING ALGORITHM\n while (counter > 0) {\n let index = Math.floor(Math.random() * counter);\n counter--;\n\n let temp = array[counter];\n array[counter] = array[index];\n array[index] = temp;\n }\n return array;\n}", "title": "" }, { "docid": "5796bada9106dcaa0e3bbfb7be7f93cc", "score": "0.67335254", "text": "shuffle() {\n // Durstenfeld shuffle algorithm.\n console.log(\"shuffle() BEGIN\"); //TEMP\n for (var i = this.items.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = this.items[i];\n this.items[i] = this.items[j];\n this.items[j] = temp;\n }\n console.log(\"shuffle() DONE\",this.items); //TEMP\n return true; // needed for cross-component functionality\n }", "title": "" }, { "docid": "754de420f23d90e65623c7cd8c975c0e", "score": "0.67168766", "text": "function fisherYates ( myArray ) {\n var iLen = myArray.length;\n if ( iLen == 0 ) return false;\n while ( --iLen ) {\n var j = Math.floor( Math.random() * ( iLen + 1 ) );\n var tempi = myArray[iLen];\n var tempj = myArray[j];\n myArray[iLen] = tempj;\n myArray[j] = tempi;\n } \n console.log(\"fisherYates: ok\");\n return myArray;\n}", "title": "" }, { "docid": "e0dfc9d7b039b11c7e956270b7c98d2c", "score": "0.66903895", "text": "function fisherYates (myArray) {\n var i = myArray.length, j, tempi, tempj;\n if (i === 0) {\n return;\n }\n while (--i) {\n j = Math.floor(Math.random() * (i + 1));\n tempi = myArray[i];\n tempj = myArray[j];\n myArray[i] = tempj;\n myArray[j] = tempi;\n }\n }", "title": "" }, { "docid": "a5145ef89edbdb4d28dbcb96658b2161", "score": "0.6647025", "text": "static shuffle(array) {\n let currentIndex = array.length;\n let tempValue;\n let randIndex;\n while (0 !== currentIndex) {\n randIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n tempValue = array[currentIndex];\n array[currentIndex] = array[randIndex];\n array[randIndex] = tempValue;\n }\n return array;\n }", "title": "" }, { "docid": "971a7c5976f2f6a3f1a65610476c309f", "score": "0.66452336", "text": "shuffle() {\n // https://javascript.info/task/shuffle\n for (let i = this.deck.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [this.deck[i], this.deck[j]] = [this.deck[j], this.deck[i]];\n }\n }", "title": "" }, { "docid": "2ddf8f8c1c8a79e6f9fddc0ae547a596", "score": "0.6639794", "text": "function shuffleCards() {\n for (let i = cards.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = cards[i];\n cards[i] = cards[j];\n cards[j] = temp;\n }\n create4Suits();\n}", "title": "" }, { "docid": "b720a78505108846870ace2d4576a85d", "score": "0.66278875", "text": "function shuffle(a) {\n\t\tvar j, x, i;\n\t\tfor (i = a.length; i; i--) {\n\t\t\tj = Math.floor(Math.random() * i);\n\t\t\tx = a[i - 1];\n\t\t\ta[i - 1] = a[j];\n\t\t\ta[j] = x;\n\t\t}\n\t}", "title": "" }, { "docid": "6ef07454d8531eadd1903b92a1923cc6", "score": "0.66277254", "text": "function shuffleCards(array){\n var i,j,x;\n for(i=array.length;i;i--){\n \tj = Math.floor(Math.random()*i);\n\tx = array[i-1];\n\tarray[i-1] = array[j];\n\tarray[j] = x;\n }\n}", "title": "" }, { "docid": "9090f90f91cc31a0bb614fd89d251881", "score": "0.66104656", "text": "function shuffle() {\n var flagIndex = flagsExtraHard.length;\n var index;\n var temp;\n\n while (flagIndex > 0) {\n index = Math.floor(Math.random() * flagIndex);\n flagIndex--;\n temp = flagsExtraHard[flagIndex];\n flagsExtraHard[flagIndex] = flagsExtraHard[index];\n flagsExtraHard[index] = temp;\n }\n }", "title": "" }, { "docid": "d16d024f1e4b01b15a59bd6bcfcaccdd", "score": "0.6609315", "text": "shuffle() {\n for (let i = this.deck.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [this.deck[i], this.deck[j]] = [this.deck[j], this.deck[i]];\n }\n }", "title": "" }, { "docid": "9ccc29bd685c9b8e30841e07eda93689", "score": "0.6598121", "text": "function shuffleGame(){\t\n\tshuffledArray = shuffle();\n\tloadMatrix(shuffledArray);\n}", "title": "" }, { "docid": "6135c6bbcb872380086b1d9f1da48cd0", "score": "0.65869415", "text": "shuffle() {\n\n /**\n * \n * @param {Array} arr an array of values\n * @param {Number} i first index\n * @param {Number} j second index\n */\n let swap = function (arr, i, j) {\n let temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n };\n for (let i = 0; i < this.deck.length; i++) {\n let nextSwap = Math.floor(Math.random() * this.deck.length);\n swap(this.deck, i, nextSwap);\n }\n return this;\n }", "title": "" }, { "docid": "702ae09437776da9eec97a606f956849", "score": "0.65796846", "text": "function shuffle(arra1) {\r\n var ctr = arra1.length, temp, index;\r\n while (ctr > 0) {\r\n index = parseInt(Math.randomSeed(0,ctr));\r\n ctr--;\r\n temp = arra1[ctr];\r\n arra1[ctr] = arra1[index];\r\n arra1[index] = temp;\r\n }\r\n return arra1;\r\n}", "title": "" }, { "docid": "e573525002e055de0fa797ce6c380216", "score": "0.65796673", "text": "function pseudo_shuffle(x) {\n x = shuffle(x);\n while (true) {\n x = shuffle(x);\n let item = 0;\n for (let idx = 0; idx < x.length; idx++) {\n // 1st trial must be inducer\n if ((idx === 0) & (x[idx].trialtype !== 'inducer')) {\n break;\n }\n // diagnostic trial cannot follow a catch trial\n if (idx > 0 && x[idx - 1].trialtype === 'catch' && x[idx].trialtype === 'diagnostic') {\n break;\n }\n item++;\n }\n if (item === x.length) {\n break;\n }\n }\n return x;\n}", "title": "" }, { "docid": "378a3bf6ec8daa4a1418e89250101e90", "score": "0.65735096", "text": "function shuffle(){\n var random=0;\n var x=0;\n for(i=0;i<fichas.length;i++){\n random = Math.round(Math.random()+1);\n x = fichas[i]; \n fichas[i]=fichas[random]; \n fichas[random]=x; \n }\n asignTiles(); // la llamo acá para que me asigne los data- despues del shuffle\n console.log(fichas);\n}", "title": "" }, { "docid": "239d082a00ee4b5096ae7dc2bda27f1d", "score": "0.65603954", "text": "shuffleElements() { \n this.deck.shuffle();\n }", "title": "" }, { "docid": "d07cbf73d6379724be35e49541151dfd", "score": "0.6556076", "text": "function shuffle(arr) {\nfor (var i = arr.length - 1; i > 0; i--) {\n\n\t// Generate random number\n\tvar j = Math.floor(Math.random() * (i + 1));\n\tvar temp = arr[i];\n\tarr[i] = arr[j];\n\tarr[j] = temp;\n}\n}", "title": "" }, { "docid": "49b2b143a58967fb816482091332d585", "score": "0.6554019", "text": "shuffle() {\n this.suggester.suggest();\n this.render();\n this.setBeatOffset(this.suggester.acceptIndex * 4);\n this.playScheduler();\n }", "title": "" }, { "docid": "88fc57a8563aa32e90d1195bc098256f", "score": "0.654896", "text": "function shuffle() { \n x = Math.floor(Math.random());\n }", "title": "" }, { "docid": "315fbe54c92810c3931f7596f672b46d", "score": "0.65480065", "text": "shuffleDeck() {\n\n for (let i = matching.deck.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [matching.deck[i], matching.deck[j]] = [matching.deck[j], matching.deck[i]];\n }\n\n matching.delayedGratification()\n }", "title": "" }, { "docid": "ae4a20c6ddd66906ecdca06a4ea0b9e1", "score": "0.65439713", "text": "function shuffle(arr) {\n let j, tmp\n for (let i = arr.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1))\n tmp = arr[j]\n arr[j] = arr[i]\n arr[i] = tmp\n }\n}", "title": "" }, { "docid": "8f99647305e1cca88822c4d6d4fe4580", "score": "0.65357465", "text": "function shuffle()\n {\n for (var i = 0; i < 1000; i++)\n {\n var location1 = Math.floor((Math.random() * deck.length));\n var location2 = Math.floor((Math.random() * deck.length));\n var tmp = deck[location1];\n\n deck[location1] = deck[location2];\n deck[location2] = tmp;\n }\n }", "title": "" }, { "docid": "88dcc948720ea22526be4400c38427a1", "score": "0.65317684", "text": "function shuffleDeck()\n\t{\n\t\tfor (var i = 0; i < dealersCards.length - 1; i ++)\n\t\t{\n\t\t\tvar range = dealersCards.length - 1 - i;\n\t\t\tvar newIndex = Math.floor(Math.random() * range) + i + 1;\n\t\t\tvar temp = dealersCards[i];\n\t\t\tdealersCards[i] = dealersCards[newIndex];\n\t\t\tdealersCards[newIndex] = temp;\n\t\t}\n\t}", "title": "" }, { "docid": "a4e661e2610c677045d0607403dc5b0a", "score": "0.6529946", "text": "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n\tswap(a, i, j);\n }\n}", "title": "" }, { "docid": "82569d6c10f766b3620ab83c30e52280", "score": "0.6528748", "text": "function shuffle(arr) {\n return arr.sort((a, b) => 0.5 - Math.random());\n }", "title": "" }, { "docid": "e2e19518df1df0691cf8f7716e7a2089", "score": "0.6525054", "text": "shuffle(){\n\t\t\tfor (let i = this.cards.length - 1; i > 0; i--) {\n\t\t\t\tlet j = Math.floor(Math.random()*(i+1));\n\t\t\t\tlet t = this.cards[i];\n\t\t\t\tthis.cards[i]= this.cards[j];\n\t\t\t\tthis.cards[j] = t;\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "d24fe86f1f206c7b730e52f84220f722", "score": "0.65188056", "text": "function shuffle(offerArr) {\r\n var a = offerArr.length,\r\n t,\r\n i;\r\n while (a) {\r\n i = Math.floor(Math.random() * a--);\r\n t = offerArr[a];\r\n offerArr[a] = offerArr[i];\r\n offerArr[i] = t;\r\n }\r\n return offerArr;\r\n }", "title": "" }, { "docid": "68b38feeb49b141f23489e935e7987af", "score": "0.6511814", "text": "shuffle() {\n\t\t\tconst { deck } = this\n\t\t\t// Loop over array backwards\n\t\t\tfor (let i = deck.length - 1; i > 0; i--) {\n\t\t\t\t// pick random index before current element\n\t\t\t\tlet j = Math.floor(Math.random() * (i + 1))\n\t\t\t\t// swap\n\t\t\t\t;[deck[i], deck[j]] = [deck[j], deck[i]]\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "b95f97eecd7f937a1c64e7c8f91c3a46", "score": "0.6508253", "text": "function yatesShuffle(array) {\n for(let i = array.length-1; i > 0; i--){\n const j = Math.floor(Math.random() * i)\n const temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n return array;\n }", "title": "" }, { "docid": "f4512fbfa48a39f813981d9c069df016", "score": "0.6500719", "text": "shuffle(){\n for (let i = this.deckOfCards.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [this.deckOfCards[i], this.deckOfCards[j]] = [this.deckOfCards[j], this.deckOfCards[i]];\n };\n }", "title": "" }, { "docid": "23b651c842971cf646ec1d88a277ad49", "score": "0.6496236", "text": "function shuffle (deck) {\n var i = 0\n var j = 0\n var temp = null\n\n for (i = deck.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1))\n temp = deck[i];\n deck[i] = deck[j];\n deck[j] = temp;\n }\n }", "title": "" }, { "docid": "88a32c2a8e82cbad0420acfd30dba048", "score": "0.64937115", "text": "function shuffle(arr) {\n\tvar count = 0;\n\tfor(var i = 1; i <= 4; i++) {\n\t\tfor(var j = 1; j <= 4; j++) {\n\t\t\tvar xPos = (j - 1) * 145;\n\t\t\tvar yPos = (i - 1) * 145; \n\t\t\tarr[count].style.left = xPos +'px';\n\t\t\tarr[count].style.top = yPos +'px';\n\t\t\tarr[count].src = \"img/tile-back.png\";\n\t\t\t$(arr[count]).data(\"flipped\", false);\n\t\t\t$(arr[count]).data(\"matched\", false);\n\t\t\tcount+=1;\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58acb684af4531eac8e23e5d91162978", "score": "0.64931977", "text": "shuffle (array) { array.sort((a, b) => Math.random() < 0.5); return array }", "title": "" }, { "docid": "9a3a63e5c2d3d8fd0e27b8a963d218e7", "score": "0.6487934", "text": "shuffle() {\n let a = this.cards;\n let n = a.length;\n while (n > 0) {\n let i = Math.floor(Math.random() * n);\n --n;\n let x = a[n];\n a[n] = a[i];\n a[i] = x;\n }\n }", "title": "" }, { "docid": "02ba13af0b7c2434bc8f2baae7db6aa6", "score": "0.6471113", "text": "function shuffle(arr) {\n let i = 0, j = 0, temp = null\n\n for (i = arr.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1))\n temp = arr[i]\n arr[i] = arr[j]\n arr[j] = temp\n }\n }", "title": "" }, { "docid": "70a9a430406179acf0e0bc3be4c5c89a", "score": "0.6470202", "text": "function shuffle(arr) {\n for (let i=0; i<arr.length; i++) {\n swap(arr, i, Math.floor(Math.random() * arr.length));\n }\n}", "title": "" }, { "docid": "757470e480fd6c2b9c525655b63e34d7", "score": "0.64644295", "text": "function shuffle(a) {\n let j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a\n }", "title": "" }, { "docid": "9be1a18da5f70cfbbc239222c65ac482", "score": "0.6459568", "text": "function shuffle(a) {\n var j, x, i;\n for (i = a.length; i; i--) {\n j = Math.floor(Math.random() * i);\n x = a[i - 1];\n a[i - 1] = a[j];\n a[j] = x;\n }\n}", "title": "" }, { "docid": "e20dc29bd2cd30630264614e2bd27cf2", "score": "0.64545554", "text": "function shuffle(){\n // select all cards and runs loop to shuffle the order\nvar board = document.querySelector('.board');\nfor (var i = board.children.length; i >= 0; i--) {\nboard.appendChild(board.children[Math.random() * i | 0]);\n\n // Get all DOM object with class \"flipped\". as its what was used for displaying \"hidden\" image.\n var flipped_cards = document.getElementsByClassName('flipped');\n // Loops through all flipped_cards and flip them back by toggling class \"flipped\" off\n // already initialized i in this function block. So no need for var i.\n for(i = 0; i < flipped_cards.length; i++){\n // classList.toggle. adds class if element does not have it and removes it if elements have it.\n flipped_cards[i].classList.toggle('flipped');\n }\n }\n}", "title": "" }, { "docid": "27e725e34c09fa30a7255d42d052963c", "score": "0.643615", "text": "function shuffle(rng, a) {\n for (var i=a.length-1; i>=1; i--) {\n var j = Random.integer(0, i)(rng);\n var t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n }", "title": "" }, { "docid": "6b79cb03b0ffb3df53b175cafb5b3127", "score": "0.6425348", "text": "function shuffle(a, rng) {\n \n for (let i = a.length - 1; i > 0; i--) {\n\t\tconst j = Math.floor(rng() * (i + 1));\n\t\t//console.log(j);\n //j = Math.floor(Math.random() * (i + 1));\n const x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n}", "title": "" }, { "docid": "f9e3cfdb970c0f35d9ab4a736e00485e", "score": "0.64195216", "text": "function shuffle(arr) {\n\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n\n}", "title": "" }, { "docid": "eb52a962724275eab13e55a49dcf1e0a", "score": "0.64182734", "text": "function indexShuffle(){\nlet a = [0, 1, 2, 3, 4, 5,6,7,8,9,10,11,12,13]\nfor (var i = 0; i < 100; i++)\n{\nvar index1 = Math.floor((Math.random() * a.length));// Get a random index1\nvar index2 = Math.floor((Math.random() * a.length));// Get a random index1\nvar tmp = a[index1]; //store in temp during shuffle \na[index1] = a[index2]; //change \na[index2] = tmp;\n}\nreturn a;\n}", "title": "" }, { "docid": "b10fdb1162631b597663732ee7139ae1", "score": "0.64135164", "text": "shuffle() {\n\t\tfor (let i = this.numberOfCards - 1; i > 0; i--) {\n\t\t\tconst newIndex = Math.floor(Math.random() * (i + 1))\n\t\t\tconst oldValue = this.cards[newIndex]\n\t\t\tthis.cards[newIndex] = this.cards[i]\n\t\t\tthis.cards[i] = oldValue\n\t\t}\n\t}", "title": "" }, { "docid": "87711a61dcaba5b06176f13be7f67ee7", "score": "0.641323", "text": "function shuffleDeck() {\n for (let i = 0; i < 1000; i++) {\n deck.sort(() => Math.random() - 0.5)\n }\n}", "title": "" }, { "docid": "810c931e468b30c63be9055a47d9b379", "score": "0.64055693", "text": "function shuffleHelper(array) {\n var i = array.length;\n if (i === 0) {\n return false;\n }\n while (--i) {\n var j = Math.floor(Math.random() * (i + 1)),\n tempi = array[i],\n tempj = array[j];\n // swapping \n array[i] = tempj;\n array[j] = tempi;\n }\n }", "title": "" }, { "docid": "4916a36790da1d4d6951093e62510699", "score": "0.6396377", "text": "function shuffle(array) {\n var i = 0, j = 0, temp = null\n for (i = array.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1))\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n }", "title": "" }, { "docid": "caa980e1076b6a1668cf528369792fa3", "score": "0.6389776", "text": "shuffle() {\n for (let i = this.cards.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [this.cards[i], this.cards[j]] = [this.cards[j], this.cards[i]];\n }\n }", "title": "" }, { "docid": "1482af4985dffc9d885170a235838f13", "score": "0.63858205", "text": "static shuffle(arr) {\n let sarr = Ex.clone(arr),\n l = arr.length,\n c = l - 1;\n\n while (c > 0) {\n let r = (Math.random() * (c + 1)) | 0;\n [sarr[c], sarr[r]] = [sarr[r], sarr[c]];\n c = c - 1;\n }\n\n return sarr;\n }", "title": "" }, { "docid": "89e95651d77aa22b60c6222d38e1c9da", "score": "0.6380947", "text": "function shuffle() {\n // Old randomizer\n deck.sort(() => Math.random() - 0.5);\n // Just shuffling deck items into random order\n // Setup for loop to go through deck in backwards order\n for (let i = deck.length - 1; i > 0; i--) {\n // Get a random index for the unshuffled deck\n const shuffleIndex = Math.floor(Math.random() * (i + 1));\n // Store the swap item temporarily\n let temp = deck[i];\n // Put the randomly picked item at the end of the unshuffled deck\n deck[i] = deck[shuffleIndex];\n // Put the temporarily stored item in place of the shuffled item\n deck[shuffleIndex] = temp;\n }\n}", "title": "" }, { "docid": "53f57542249668a0d23f4c7f91c2a4ff", "score": "0.63804084", "text": "function shuffle() {\n var currentIndex = cards.length, temporaryValue, randomIndex;\n\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = cards[currentIndex];\n cards[currentIndex] = cards[randomIndex];\n cards[randomIndex] = temporaryValue;\n }\n}", "title": "" }, { "docid": "142b7fd9c651e93d6684a6878326fecd", "score": "0.6379138", "text": "function shuffle(a) {\n var j, x, i;\n for (i = a.length; i; i--) {\n j = Math.floor(Math.random() * i);\n x = a[i - 1];\n a[i - 1] = a[j];\n a[j] = x;\n }\n}", "title": "" }, { "docid": "43627518394d9716fd14d6b2196d5ad6", "score": "0.6374064", "text": "function shuffle() {\r\n\t\tvar d = new Date();\r\n\t\tvar start = d.getTime();\r\n\t\tvar blank = document.getElementById(\"16\");\r\n\t\tfor (var i = 0; i < 1000; i++) {\r\n\t\t\tvar neighbors = getNeighbors(blank);\r\n\t\t\tvar neighbor = neighbors[parseInt(Math.random() * neighbors.length)];\r\n\t\t\tmove(blank, neighbor);\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "ba39ad898b208eace777f68560d13e13", "score": "0.6373033", "text": "function fisherYates(list) \n{\n\tvar currentIndex = list.length, temporaryValue, randomIndex;\n\twhile (0 !== currentIndex) {\n\t\trandomIndex = Math.floor(Math.random() * currentIndex);\n\t\tcurrentIndex -= 1;\n\n\t\ttemporaryValue = list[currentIndex]; \n\t\tlist[currentIndex] = list[randomIndex];\n\t\tlist[randomIndex] = temporaryValue;\n\t}\n\treturn list; \n}", "title": "" }, { "docid": "d5cabe5b5b36d47d17ed2c87cb5922fa", "score": "0.6366791", "text": "function shuffle() {\n\tcards.forEach(card => {\n\t\tlet randomPos = Math.floor(Math.random() * 16);\n\t\tcard.style.order = randomPos;\n\t});\n}", "title": "" }, { "docid": "b6f718477bf1e109f383aebe9591ad71", "score": "0.63652354", "text": "shuffleDeck(){\n let temp = null;\n let j = 0;\n for(let i = this.deck.length -1; i > 0; i-=1){\n j = Math.floor(Math.random()*(i + 1));\n temp = this.deck[i];\n this.deck[i]= this.deck[j];\n this.deck[j] = temp;\n \n }\n }", "title": "" }, { "docid": "06f0cb98fe70ea3c517eb5140cd442d9", "score": "0.63638604", "text": "shuffle(){\n\t\tthis.setCards = this.cards.map((value) => ({ value, sort: Math.random() }))\n\t\t.sort((a, b) => a.sort - b.sort)\n\t\t.map(({ value }) => value);\n\t}", "title": "" }, { "docid": "f5376b8feff9f707d9bbb4ac79e8c299", "score": "0.63628596", "text": "function shuffleTiles(){\n\n}", "title": "" }, { "docid": "406f412fc85dd40363956acda16cac2f", "score": "0.63552785", "text": "function shuffle ()\r\n\t{\r\n\t\tfor (var i = 0; i < 100; i++) //calls the ranomMove function multiple times\r\n\t\t{\r\n\t\t\trandomMove ();\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "f9f023e7283aced4bbd1811ad2d01e5a", "score": "0.63521886", "text": "randomShuffle(a) {\n let j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "title": "" }, { "docid": "eac228a73423a2d1b873c724a3c7a35c", "score": "0.63497066", "text": "function shuffle (array) {\n var i = 0\n var j = 0\n var temp = null\n\n for (i = array.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1))\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n }", "title": "" }, { "docid": "fb32af55ad2e1bb20436a61cd4f6eea2", "score": "0.63474447", "text": "function shuffle(arr) {\n var j, x, i;\n for (i = arr.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n}", "title": "" }, { "docid": "3a96537a637ed22d45f4fec9a1d3f2e0", "score": "0.6344712", "text": "function shuffle(array) {\n\n const length = array.length;\n\n // Fisher-Yates shuffle\n for (let iterator = 0; iterator < length; iterator += 1) {\n\n // define target randomized index from given array\n const target = Math.floor(Math.random() * (iterator + 1));\n\n // if target index is different of current iterator then switch values\n if (target !== iterator) {\n\n const temporary = array[iterator];\n\n // switch values\n array[iterator] = array[target];\n array[target] = temporary;\n }\n }\n\n // returns given array with mutation\n return array;\n}", "title": "" }, { "docid": "6ab3ce1ce2e50f32ca49c3ba07cc91d3", "score": "0.6340522", "text": "function shuffleSeed()\n{\n\tvar arr = [];\n\tfor (let i = 0; i < 52; i++)\n\t{\n\t\tarr.push(round(random(7, 80)))\n\t}\n\treturn arr\n}", "title": "" }, { "docid": "50547199cca6b7826f28a6ee6ca78033", "score": "0.6337079", "text": "function shuffleCards(array){\r\n\tfor (var i = 0; i < array.length; i++) {\r\n\t\tlet randomIndex = Math.floor(Math.random()*array.length);\r\n\t\tlet temp = array[i];\r\n\t\tarray[i] = array[randomIndex];\r\n\t\tarray[randomIndex] = temp;\r\n\t}\r\n}", "title": "" }, { "docid": "d1f267b1e4a7461cd4cf7665d441d3d5", "score": "0.633577", "text": "function shuffle(obj) {\n return sample_sample(obj, Infinity);\n}", "title": "" }, { "docid": "d1f267b1e4a7461cd4cf7665d441d3d5", "score": "0.633577", "text": "function shuffle(obj) {\n return sample_sample(obj, Infinity);\n}", "title": "" }, { "docid": "60b18f0a88df4a10da35f970619d3478", "score": "0.63245845", "text": "function shuffle()\n{\n for (var i = 0; i < n; i++) \n {\n var random = i + parseInt(Math.random() * (n-i));\n var temp = arr3[random];\n arr3[random] = arr3[i];\n arr3[i] = temp;\n }\n}", "title": "" }, { "docid": "f31067c1d3d9e36751d479207f7c2d6c", "score": "0.6320545", "text": "function shuffle(arr) {\n for (let i = arr.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * i);\n let temp = arr[i];\n arr[i] = arr[j]\n arr[j] = temp;\n }\n}", "title": "" }, { "docid": "d00498d3f8d47e53f6ba3f61c30f7b88", "score": "0.6318185", "text": "function shuffle(array) {\r\n for (let i = array.length - 1; i > 0; i--) {\r\n let j = Math.floor(Math.random() * (i + 1));\r\n let tmp = array[i];\r\n array[i] = array[j];\r\n array[j] = tmp;\r\n }\r\n}", "title": "" }, { "docid": "6fcd92a135c02fb4731e84d5d96c007b", "score": "0.6317854", "text": "function shuffle(array) {\n \t\tvar currentIndex = array.length, temporaryValue, randomIndex ;\n \t\twhile (0 !== currentIndex) {\n \t\trandomIndex = Math.floor(Math.random() * currentIndex);\n \t\tcurrentIndex -= 1;\n \t\ttemporaryValue = array[currentIndex];\n \t\tarray[currentIndex] = array[randomIndex];\n \t\tarray[randomIndex] = temporaryValue;\n \t\t}\n \t\treturn array;\n\t}", "title": "" }, { "docid": "5bbe382cd1e58d4bfb152714656c47e3", "score": "0.6315387", "text": "function shuffle(){\n\t\tfor(var i = 0; i<1000; i++){\n\t\t\tvar index = getIndexById(\"blank\");\n\t\t\tvar r = index[0]; var c = index[1];\n\t\t\tvar neigbor = [];\n\t\t\tcheckvaild(r,c,neigbor,true);\n\t\t\tvar random = parseInt(Math.random()*(neigbor.length));\n\t\t\trandom = neigbor[random].split(\".\");\n\t\t\tvar r1 = random[0]; var c2 = random[1];\n\t\t\tswap(r1,c2,r,c);\n\t\t}\n\t\tshowTiles();\n\t}", "title": "" }, { "docid": "af9314fa589df15edc96e3223209e212", "score": "0.6312411", "text": "function shuffleDeck() {\n\tconst shuffleArr = Array.from(document.querySelectorAll('.deck li'));\n\tconst shuffledDeck = shuffle(shuffleArr);\n\tfor (card of shuffledDeck) {\n\t\tdeck.appendChild(card);\n\t}\n\t//flips cards back over to starting position\n\tfor(let i = 0; i < shuffleArr.length; i++) {\n\t\tshuffleArr[i].classList.remove('match', 'open', 'show', 'disabled');\n\t}\n}", "title": "" }, { "docid": "53ce75c84271ce1ca412f992040ab459", "score": "0.6309277", "text": "function shuffle(o){ //v1.0\n for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n }", "title": "" }, { "docid": "fa2be9dea3faecc8a459cbcc2fdafb51", "score": "0.6304923", "text": "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temporaryHolder = array[i];\n array[i] = array[j];\n array[j] = temporaryHolder;\n }\n }", "title": "" }, { "docid": "253d66f581768d8b64b1beee85188632", "score": "0.63031244", "text": "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n}", "title": "" }, { "docid": "15ca852a65d205ce61d1f21947a716d9", "score": "0.6301558", "text": "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]]; // eslint-disable-line no-param-reassign\n }\n}", "title": "" }, { "docid": "b0fb2eb0fbcd19e243892cc1c6111a19", "score": "0.6298286", "text": "function shuffle(array) {\n var j, x, i;\n for (i = array.length; i; i--) {\n j = Math.floor(Math.random() * i);\n x = array[i - 1];\n array[i - 1] = array[j];\n array[j] = x;\n }\n}", "title": "" }, { "docid": "391b5890d2563b7bc072f36b09298488", "score": "0.6295202", "text": "function shuffleCube() {\r\n var shuffleCount = 10 ; // number of random moves\r\n \r\n resetCube() ;\r\n if(isMoving) return ;\r\n var myMoves = [\"L\",\"R\",\"l\",\"r\",\"U\",\"D\",\"u\",\"d\",\"B\",\"F\",\"b\",\"f\"] ;\r\n for(var i=0 ; i < shuffleCount ; i++) {\r\n rotateFace(myMoves[Math.floor(Math.random()*myMoves.length)], faces, pivot) ;\r\n updateCubies(rubiksCube) ;\r\n }\r\n}", "title": "" }, { "docid": "7e8363f9c61fefc3f1aae57eed01fff5", "score": "0.6293767", "text": "function shuffleDeck() {\n const cardsToShuffle = Array.from(document.querySelectorAll('.deck li'));\n const shuffleCards = shuffle(cardsToShuffle);\n//when you shuffle flip all cards back to backside, removing all shown, open, and currently matched\n for (card of shuffleCards) {\n card.classList.remove('show');\n card.classList.remove('open');\n card.classList.remove('match');\n deck.appendChild(card);\n }\n}", "title": "" }, { "docid": "a08772e70ec4c7a612303ec871e4fbe5", "score": "0.6293311", "text": "shuffle() {\n let secondCard, tempCard;\n\n for (let firstCard = 0; firstCard < this.CARD_COUNT; firstCard++) {\n secondCard = Math.floor((Math.random() * this.CARD_COUNT));\n tempCard = this.cards[firstCard];\n this.cards[firstCard] = this.cards[secondCard];\n this.cards[secondCard] = tempCard\n }\n this.cardOutput();\n }", "title": "" }, { "docid": "94be5a3d0c02cf37d536285860fdc993", "score": "0.6292144", "text": "function shuffle(array) {\n for (var i = array.length - 1; i > 0; --i) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "title": "" }, { "docid": "c0160e5061d35b4560332465ace265f3", "score": "0.6289102", "text": "function shuffle (array) {\n let i = 0;\n let j = 0\n let temp = null\n\n for (i = array.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1))\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n}", "title": "" }, { "docid": "1b54b791a704bcf88210211acb8b5e04", "score": "0.6286973", "text": "function shuffle(a) {\n\tvar j, x, i;\n\tfor (i = a.length - 1; i > 0; i--) {\n\t\tj = Math.floor(Math.random() * (i + 1));\n\t\tx = a[i];\n\t\ta[i] = a[j];\n\t\ta[j] = x;\n\t}\n\treturn a;\n}", "title": "" }, { "docid": "0a4e9ff292f3c9968896c9281140b9e7", "score": "0.6285399", "text": "function shuffle(arr) {\n let rand;\n for (let i = arr.length; i > 0; i--) {\n rand = Math.floor(Math.random() * i);\n arr[i - 1] = [arr[rand], arr[rand] = arr[i - 1]][0];\n }\n return arr;\n}", "title": "" }, { "docid": "3049039c2b4a07feca480450250a6acb", "score": "0.62811387", "text": "function anotherShuffle(deck) {\n for (let i = 0; i < deck.length ; i++) {\n let randomIndex = Math.floor(Math.random()*i);\n let temp = deck[randomIndex];\n deck[randomIndex] = deck[i];\n deck[i] = temp;\n }\n return deck;\n}", "title": "" }, { "docid": "ede575f077b3690350a2b9100426d935", "score": "0.6279071", "text": "function shuffle(a) {\n\t for (let i = a.length - 1; i > 0; i--) {\n\t const j = Math.floor(Math.random() * (i + 1));\n\t [a[i], a[j]] = [a[j], a[i]];\n\t }\n\t return a;\n\t}", "title": "" } ]
0358c5081ad3657f2ec118c0b6bf9080
Reset both modules and status vars
[ { "docid": "11fb54ac036447f158e9040fd2dfce63", "score": "0.65285575", "text": "async function reset() {\n\tawait status_reset(); // Reset some variables\n\tawait write(); // Write JSON files\n}", "title": "" } ]
[ { "docid": "45fdf0702ec05c29a0d4dfdea600ddc7", "score": "0.7657921", "text": "reset() {\n\t\tthis.modules = []\n\t}", "title": "" }, { "docid": "9e5d62c2bccfb5909a62b7fab9aa1d4c", "score": "0.7132971", "text": "function reset_update()\n {\n update_state_ = {};\n set_update_in_progress(false);\n\n Module.iterate_on_type(Module.TYPE.EXTERNAL_TOOL, function(module) {\n if (!module.is_enabled()) {\n return;\n }\n\n update_state_[module.name] = {\n module: module,\n name: I18N.get(module.name + '_name'),\n done: false,\n error: false,\n updating: false,\n };\n });\n }", "title": "" }, { "docid": "21bbd6bd81923611bcc8a8966a7fd385", "score": "0.7044006", "text": "function reset() {\n\tsm.reset();\n\tinit_variables();\n}", "title": "" }, { "docid": "852ee56b6a4aa9d30da353fadfe43327", "score": "0.6905626", "text": "reset () {\n this._statusTracker = new StatusTracker();\n this._eventEmitter = new events.EventEmitter();\n }", "title": "" }, { "docid": "acdfeaedacb0abf87068b8efa28bb898", "score": "0.66313773", "text": "function reset() {\n debug = false;\n prodId = 0;\n products = {};\n verId = 0;\n versions = {};\n}", "title": "" }, { "docid": "2b89df4f46d653b49d12993da2d3d49d", "score": "0.6621819", "text": "reset() {\r\n\tthis.stat=this.config.initial;\r\n\t}", "title": "" }, { "docid": "06b2b1de125feb4b353c6bd160390db2", "score": "0.6603865", "text": "reset() {\n _themes = {};\n _proxies = {};\n _components = {};\n }", "title": "" }, { "docid": "6655d721a696347816dd5ae7cddbbd8f", "score": "0.6570878", "text": "function resetCounters() {\n self.hcErrorCount = 0;\n self.hcWarningCount = 0;\n self.hcStatusCode = -1;\n self.hcErrorMessage = \"\";\n }", "title": "" }, { "docid": "be5d73d33def91c7eed3ffdc20cf108f", "score": "0.64013004", "text": "function Reset_status(){\n _rxBuf = [];\n bytes = [];\n _index = 0;\n in_bytes = [];\n index_tmp =0;\n confim = 1;\n Extp_Confirm = 0;\n _bytes = []; \n }", "title": "" }, { "docid": "6c97b761bbf40bbf3d473a9a57d06ed4", "score": "0.63997453", "text": "resetSystemVariable() {\n\t\tthis.isFighting = false; // state for fithing\n\t\tthis.isChoosing = false; // state for choosing\n\t\tthis.isLeveling = false; // state for leveling\n\t\tthis.hasLevelUp = false; // state for level up\n\t\tthis.currentLevelingPlayer = 0; // number of the current levling player\n\t\tthis.canSwitchChoose = false; // state for possible to switch target\n\t\tthis.playerAtk = null; // attack of the player TODO: komment weg\n\t\tthis.target = 0; // index of the target TODO: bessere logic\n\t\tthis.targetArr.length = 0; // clear the array\n\t\tthis.getEp = 0; // amount of ep the player gets\n\t\tthis.noFlee = false; // state of flee is possible\n\t}", "title": "" }, { "docid": "966fecb1e9c03ae14838c4a4f86645a4", "score": "0.6396462", "text": "reset() {\n this.deleteScript();\n this.done = false;\n this.loading = false;\n this.errors = [];\n this.onerrorEvent = null;\n }", "title": "" }, { "docid": "966fecb1e9c03ae14838c4a4f86645a4", "score": "0.6396462", "text": "reset() {\n this.deleteScript();\n this.done = false;\n this.loading = false;\n this.errors = [];\n this.onerrorEvent = null;\n }", "title": "" }, { "docid": "7dee5266f2a1144b2c36a59c52eada15", "score": "0.63735425", "text": "function reset(){settings=_Utils2.default.clone(defaultSettings);}", "title": "" }, { "docid": "2f4b4c405f82402412426cc61bbc6c88", "score": "0.63684875", "text": "reset() {\n this.logger.debug('reset the retry manager')\n this.clearSuccessTimer()\n this.retries = 0\n this.wait = 0\n }", "title": "" }, { "docid": "77c2a1fd6ace62fa353eb7fc061870f0", "score": "0.6359586", "text": "_reset() {\n\t\tthis.model = undefined;\n\t\tthis.logger = undefined;\n\t\tthis.config = undefined;\n\t\tthis.target_dir = undefined;\n\t\tthis.store = undefined;\n\t}", "title": "" }, { "docid": "4bca417c3dc28926a3eaaa6ff681e902", "score": "0.6358141", "text": "reset() {\n this.enable();\n this.init();\n }", "title": "" }, { "docid": "3a0cc207e42eab5e67ed818f4c3d6d8c", "score": "0.6352437", "text": "function resetUnloadedGapiModules() {\n // Clear last failed gapi.load state to force next gapi.load to first\n // load the failed gapi.iframes module.\n // Get gapix.beacon context.\n var beacon = _window().___jsl; // Get current hint.\n\n\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\n // Get gapi hint.\n for (var _i6 = 0, _Object$keys3 = Object.keys(beacon.H); _i6 < _Object$keys3.length; _i6++) {\n var hint = _Object$keys3[_i6];\n // Requested modules.\n beacon.H[hint].r = beacon.H[hint].r || []; // Loaded modules.\n\n beacon.H[hint].L = beacon.H[hint].L || []; // Set requested modules to a copy of the loaded modules.\n\n beacon.H[hint].r = _toConsumableArray(beacon.H[hint].L); // Clear pending callbacks.\n\n if (beacon.CP) {\n for (var i = 0; i < beacon.CP.length; i++) {\n // Remove all failed pending callbacks.\n beacon.CP[i] = null;\n }\n }\n }\n }\n }", "title": "" }, { "docid": "2ea5961cacbd3316947aed201450d373", "score": "0.63468856", "text": "function resetUnloadedGapiModules() {\r\n // Clear last failed gapi.load state to force next gapi.load to first\r\n // load the failed gapi.iframes module.\r\n // Get gapix.beacon context.\r\n const beacon = _window().___jsl;\r\n // Get current hint.\r\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\r\n // Get gapi hint.\r\n for (const hint of Object.keys(beacon.H)) {\r\n // Requested modules.\r\n beacon.H[hint].r = beacon.H[hint].r || [];\r\n // Loaded modules.\r\n beacon.H[hint].L = beacon.H[hint].L || [];\r\n // Set requested modules to a copy of the loaded modules.\r\n beacon.H[hint].r = [...beacon.H[hint].L];\r\n // Clear pending callbacks.\r\n if (beacon.CP) {\r\n for (let i = 0; i < beacon.CP.length; i++) {\r\n // Remove all failed pending callbacks.\r\n beacon.CP[i] = null;\r\n }\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "2ea5961cacbd3316947aed201450d373", "score": "0.63468856", "text": "function resetUnloadedGapiModules() {\r\n // Clear last failed gapi.load state to force next gapi.load to first\r\n // load the failed gapi.iframes module.\r\n // Get gapix.beacon context.\r\n const beacon = _window().___jsl;\r\n // Get current hint.\r\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\r\n // Get gapi hint.\r\n for (const hint of Object.keys(beacon.H)) {\r\n // Requested modules.\r\n beacon.H[hint].r = beacon.H[hint].r || [];\r\n // Loaded modules.\r\n beacon.H[hint].L = beacon.H[hint].L || [];\r\n // Set requested modules to a copy of the loaded modules.\r\n beacon.H[hint].r = [...beacon.H[hint].L];\r\n // Clear pending callbacks.\r\n if (beacon.CP) {\r\n for (let i = 0; i < beacon.CP.length; i++) {\r\n // Remove all failed pending callbacks.\r\n beacon.CP[i] = null;\r\n }\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "ea382897c20dd78ae427403f6a8e3c82", "score": "0.630714", "text": "function reset() {\n gameStatus = 0;\n level = 0;\n pattern = [];\n moveNum = 0;\n playerPattern = [];\n}", "title": "" }, { "docid": "209caeb19358c1f647c8ff09640c9730", "score": "0.6300688", "text": "function reset() {\r\n // if interpreter exists then blocks are executing\r\n if (myInterpreter) {\r\n clearTimeout(runTimeout);\r\n runButton.innerText = \"play_arrow\";\r\n enableAllButtonStates();\r\n }\r\n\r\n myInterpreter = null;\r\n resetStepUi();\r\n clearInstructionArray();\r\n clearBookUpdateArray();\r\n setupOnStart(levelCode);\r\n resetErrorArea();\r\n variableDisplayArea.innerHTML = '<h3>Variables:<h3>';\r\n instructionUpdateCounter = 0;\r\n}", "title": "" }, { "docid": "14800eafd0bcda7516e4e964a8c30be5", "score": "0.6289285", "text": "function reset() {\n stop();\n init();\n }", "title": "" }, { "docid": "95fe99df9922419fb9167839b3ce80f0", "score": "0.62821466", "text": "function reset() {\n TextColorSlider = app.TextColorSlider;\n TextColorSlider.initStaticFields();\n\n log.i('reset', 'All modules initialized');\n\n checkBrowserCompatibility();\n\n setUpColorSlider();\n }", "title": "" }, { "docid": "c0d3c5cfe1c4a91f5c07eceff128489a", "score": "0.6273226", "text": "function resetGlobalState() {\n\t globalState.resetId++;\n\t var defaultGlobals = new MobXGlobals();\n\t for (var key in defaultGlobals)\n\t if (persistentKeys.indexOf(key) === -1)\n\t globalState[key] = defaultGlobals[key];\n\t globalState.allowStateChanges = !globalState.strictMode;\n\t}", "title": "" }, { "docid": "c0d3c5cfe1c4a91f5c07eceff128489a", "score": "0.6273226", "text": "function resetGlobalState() {\n\t globalState.resetId++;\n\t var defaultGlobals = new MobXGlobals();\n\t for (var key in defaultGlobals)\n\t if (persistentKeys.indexOf(key) === -1)\n\t globalState[key] = defaultGlobals[key];\n\t globalState.allowStateChanges = !globalState.strictMode;\n\t}", "title": "" }, { "docid": "62e477160b3a095f7282fef4848aaa43", "score": "0.62690467", "text": "function resetCurrentData() {\n //remove current modules\n for(mod in modules)\n $('#' + modules[mod]['id']).remove();\n //reset the modules array\n modules = [];\n\n //remove all existant connections\n for(connection in connections)\n $('#' + connections[connection]['id']).remove();\n //reset the connections array\n connections = [];\n }", "title": "" }, { "docid": "517dd5c99f9d0d6bca6a1db4738fd0f6", "score": "0.62452996", "text": "function resetStatus() {\n isFirstSubmit = true;\n initFormElement = null;\n}", "title": "" }, { "docid": "f4b6be91ae0e43bfebd6c53f358cf24b", "score": "0.623558", "text": "function GlobalReset() {\n TallyReset();\n StopwatchReset();\n CountdownReset();\n CPSReset();\n}", "title": "" }, { "docid": "cc9e34ebc3e03d1e8fdfc7f0aa974ad0", "score": "0.62276435", "text": "clear() {\n // todo foreach?\n for (var i = this.modules.length - 1; i >= 0; i--) {\n this.removeModuleById(this.modules[i].id);\n }\n // reset counts\n this.countsByType = {};\n this.dispatchEvent(PatchEvent_1.default.PATCH_CLEARED);\n }", "title": "" }, { "docid": "11c8b9d67cf308a791600ac1278be734", "score": "0.6223222", "text": "reset() {\r\n this.changeState(this.localConfig.initial);\r\n }", "title": "" }, { "docid": "12fd7f3b0461df851ca0f32f8279f3ae", "score": "0.62103784", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "12fd7f3b0461df851ca0f32f8279f3ae", "score": "0.62103784", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "12fd7f3b0461df851ca0f32f8279f3ae", "score": "0.62103784", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "12fd7f3b0461df851ca0f32f8279f3ae", "score": "0.62103784", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "12fd7f3b0461df851ca0f32f8279f3ae", "score": "0.62103784", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "e1eb33188f9044a12966cd1fd3c77abb", "score": "0.62058115", "text": "resetState() {\n this.disabledConfigs = [];\n this.initConfigs();\n }", "title": "" }, { "docid": "f6794b12480cc20fd4c08748bfe89881", "score": "0.6201114", "text": "reset() {\r\n \tthis.active_state = this.config.initial;\r\n }", "title": "" }, { "docid": "84b6f2199738d83bcad476f1ccf4611d", "score": "0.61976373", "text": "function reset() {\n getService().reset();\n}", "title": "" }, { "docid": "84b6f2199738d83bcad476f1ccf4611d", "score": "0.61976373", "text": "function reset() {\n getService().reset();\n}", "title": "" }, { "docid": "c996c15b35637bb48397a0a02819354d", "score": "0.6196395", "text": "function reset() {\r\n\r\n }", "title": "" }, { "docid": "bf13d79a66281606d6e8067bb58a3ae2", "score": "0.6194319", "text": "function resetGlobalState$$1() {\n var defaultGlobals = new MobXGlobals$$1();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState$$1[key] = defaultGlobals[key];\n globalState$$1.allowStateChanges = !globalState$$1.enforceActions;\n}", "title": "" }, { "docid": "bf13d79a66281606d6e8067bb58a3ae2", "score": "0.6194319", "text": "function resetGlobalState$$1() {\n var defaultGlobals = new MobXGlobals$$1();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState$$1[key] = defaultGlobals[key];\n globalState$$1.allowStateChanges = !globalState$$1.enforceActions;\n}", "title": "" }, { "docid": "bf13d79a66281606d6e8067bb58a3ae2", "score": "0.6194319", "text": "function resetGlobalState$$1() {\n var defaultGlobals = new MobXGlobals$$1();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState$$1[key] = defaultGlobals[key];\n globalState$$1.allowStateChanges = !globalState$$1.enforceActions;\n}", "title": "" }, { "docid": "e6979254fade5dd7a966d36d79081b2e", "score": "0.61932987", "text": "function reset() {\n\t\tinstances = {};\n\t\tcallbacks = [];\n\t\tids = [];\n\t}", "title": "" }, { "docid": "03c636f7a93c230e5ac9d918566a6eb9", "score": "0.6188415", "text": "function resetGlobalState() {\r\n var defaultGlobals = new MobXGlobals();\r\n for (var key in defaultGlobals)\r\n if (persistentKeys.indexOf(key) === -1)\r\n globalState[key] = defaultGlobals[key];\r\n globalState.allowStateChanges = !globalState.enforceActions;\r\n}", "title": "" }, { "docid": "03c636f7a93c230e5ac9d918566a6eb9", "score": "0.6188415", "text": "function resetGlobalState() {\r\n var defaultGlobals = new MobXGlobals();\r\n for (var key in defaultGlobals)\r\n if (persistentKeys.indexOf(key) === -1)\r\n globalState[key] = defaultGlobals[key];\r\n globalState.allowStateChanges = !globalState.enforceActions;\r\n}", "title": "" }, { "docid": "6142af4821653e4985fa2fddf7d1240a", "score": "0.6187107", "text": "function reset_(){\n\t\t\n\t}", "title": "" }, { "docid": "61a854eb73790f6a2845ddde695206d2", "score": "0.61815256", "text": "resetTestEnvironment() {\n this.resetTestingModule();\n this._compiler = null;\n this.platform = null;\n this.ngModule = null;\n TestBedImpl._environmentTeardownOptions = undefined;\n ɵsetAllowDuplicateNgModuleIdsForTest(false);\n }", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "d7124711cfe389cd0c0ccfc0c0570fcf", "score": "0.61705065", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals)\n if (persistentKeys.indexOf(key) === -1)\n globalState[key] = defaultGlobals[key];\n globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "6857aa735897f21c68de173947e8797f", "score": "0.6169006", "text": "function resetGlobalState() {\n globalState.resetId++;\n var defaultGlobals = new MobXGlobals();\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];\n }globalState.allowStateChanges = !globalState.strictMode;\n}", "title": "" }, { "docid": "28ab9a9d51a5991ddd1de85dc3c2a91f", "score": "0.6161198", "text": "performResets() {\n this.resetFunctions.forEach(resetFunction => resetFunction());\n }", "title": "" }, { "docid": "4775d12908d381c39bb9f2d2c7250dcc", "score": "0.61593777", "text": "function reset() {\n \n }", "title": "" }, { "docid": "4775d12908d381c39bb9f2d2c7250dcc", "score": "0.61593777", "text": "function reset() {\n \n }", "title": "" }, { "docid": "0305549000be52b380477b9efa54034a", "score": "0.61573154", "text": "resetDependencies() {\n this._eachMocks((module, name, mock) => {\n module.__ResetDependency__(name, mock);\n });\n }", "title": "" }, { "docid": "5ace95f1e9cb0ebbb2c0a0bea8da8f9b", "score": "0.6145702", "text": "function reset() {\n getService_().reset();\n}", "title": "" }, { "docid": "5ace95f1e9cb0ebbb2c0a0bea8da8f9b", "score": "0.6145702", "text": "function reset() {\n getService_().reset();\n}", "title": "" }, { "docid": "5ace95f1e9cb0ebbb2c0a0bea8da8f9b", "score": "0.6145702", "text": "function reset() {\n getService_().reset();\n}", "title": "" }, { "docid": "1761aa8c246e66097a0e31424fe4857c", "score": "0.61441696", "text": "init() {\n this.resetAll();\n }", "title": "" }, { "docid": "bfac50f869d70a7b2e06c0ec68eb1d24", "score": "0.6143787", "text": "function resetGlobalState$$1() {\n var defaultGlobals = new MobXGlobals$$1();\n\n for (var key in defaultGlobals) if (persistentKeys.indexOf(key) === -1) globalState$$1[key] = defaultGlobals[key];\n\n globalState$$1.allowStateChanges = !globalState$$1.enforceActions;\n}", "title": "" }, { "docid": "1e88ba3893704871fd27af366cf058db", "score": "0.614102", "text": "function reset()\n\t{\n\t\tcountDowns = {};\n\t}", "title": "" }, { "docid": "3b7e663ea9da867d5e9823f82882bcdc", "score": "0.61403114", "text": "function resetGlobalState() {\n var defaultGlobals = new MobXGlobals();\n\n for (var key in defaultGlobals) {\n if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];\n }\n\n globalState.allowStateChanges = !globalState.enforceActions;\n}", "title": "" }, { "docid": "263de355e72bff1bb516b2aed27b8886", "score": "0.6124951", "text": "static reset() {\n globalId = 1;\n }", "title": "" }, { "docid": "202dc198123fcb122f176d84860103f1", "score": "0.61202335", "text": "function reset() {\n if (fw) {\n mocks.reset();\n }\n d = {};\n}", "title": "" }, { "docid": "8b898605c837235fd812597488c2dbe0", "score": "0.61199135", "text": "function resetAll () {\n\t\tresetPoints();\n\t\tresetRandom();\n\t\tresetScore();\n\t\tresetCrystal();\n\t}", "title": "" }, { "docid": "df0d4d4a792f37cf53ac98877ed6d2f7", "score": "0.611739", "text": "reset () {\n this.tree = null\n this[_awaitingUpdate] = new Map()\n this.data = {\n lockfileVersion,\n requires: true,\n packages: {},\n dependencies: {},\n }\n }", "title": "" }, { "docid": "82b3df7f9c23d5090ff44e3a4155517b", "score": "0.61153585", "text": "partialReset(state) {\n state.layout = \"\";\n state.userBoards = [];\n state.status = \"\";\n state.errors = [];\n state.isLoadingBoards = false;\n }", "title": "" }, { "docid": "6ef7c0594bdca2473cd6e1faa920dd72", "score": "0.61123645", "text": "function $$reset() {\n\t \t\t$$all('reset');\n\t \t} // $$reset();", "title": "" }, { "docid": "c518a861fa3b0e8226d13fc1acfc4bf8", "score": "0.6110345", "text": "resetAllSettings () {\n this._settings = Object.assign({}, this._defaultSettings)\n this._initSettings()\n }", "title": "" }, { "docid": "869d5e65838e6c18795c28d141fa87c3", "score": "0.61032075", "text": "function resetVars () {\n\t\t\tusername = new String();\n\t\t\tuser_exists = false;\n\t\t\tcurrent_urlsafe_key = new String();\n\t\t\topen_games = null;\n\t\t\tdice_operation = new String();\n\t\t\tnumber_of_tiles = new String();\n\t\t\tcontinue_game_present = false;\n\t\t\tajax_callback_resolve = new Function()\n\t\t\tgoogle_callback_resolve = new Function()\n\t\t\topen_games = new Array();\n\t\t\t$game_selection_shell = new Object();\n\t\t\t$game_selection_form = new Object();\n\t\t\t$dice_operation = new Object();\n\t\t\t$number_of_tiles = new Object();\n\t\t\t$addition_button = new Object();\n\t\t\t$multiplication_button = new Object();\n\t\t\t$nine_button = new Object();\n\t\t\t$twelve_button = new Object();\n\t\t\t$new_game_button = new Object();\n\t\t\t$radio_buttons_collection = new Object();\n\t\t\t$continue_game_button = new Object();\n\t\t}", "title": "" }, { "docid": "a35b9030599b7c035de61113b2dee64a", "score": "0.6102723", "text": "function variableReset () {\n blinkCounter = [];\n totalArray = [];\n $roundNumber = 0;\n hitValue = null;\n }", "title": "" }, { "docid": "d65e8950578322c99af1743a3a4ec17c", "score": "0.6098512", "text": "reset() {\r\n\t\t this.activeState = this.config.initial;\r\n\t }", "title": "" }, { "docid": "59184cdf70751853298dd9527044c335", "score": "0.609583", "text": "function restartStat(){\n stats.environment = startStat;\n stats.resources = startStat;\n stats.society = startStat;\n stats.economy = startStat;\n}", "title": "" }, { "docid": "97f88229e8fe693757647687cdf3aa41", "score": "0.60944384", "text": "reset() {\n if (this.incomplete || (this.completed && this.isRootTask() && this.isSuperTask() && !this.isFullyFinalised())) {\n this._state = TaskState.instances.Unstarted;\n this._initialAttempts = undefined;\n this._result = undefined;\n this._error = undefined;\n this._outcome = undefined;\n this._donePromise = undefined;\n }\n this._subTasks.forEach(subTask => subTask.reset());\n\n // If this is a master task then ripple the state change to each of its slave tasks\n if (this.isMasterTask()) {\n this._slaveTasks.forEach(slaveTask => slaveTask.reset());\n }\n }", "title": "" }, { "docid": "78730c4c6b573fc36dd39bf59468a32e", "score": "0.6092009", "text": "reset() {\n this.stopTriggerIntervals();\n this.observables_ = new FakeObservables();\n this.completedFirmwareUpdates_.clear();\n this.deviceId_ = '';\n this.isUpdateInProgress_ = false;\n this.registerObservables();\n }", "title": "" }, { "docid": "be35980c8587de45fcdb883bb2fdfc3f", "score": "0.6083591", "text": "reset() {\r\n this.activeState = this.config.initial;\r\n }", "title": "" }, { "docid": "15f938d0a1f64307de3f79f59489f1af", "score": "0.60809803", "text": "function clear_status()\n {\n DOM.import_status_message.textContent = \"\";\n previous_status_update_index = -1;\n }", "title": "" }, { "docid": "d42610fd862fafa7c97318ef98ff371f", "score": "0.6078391", "text": "async function reset() {\n try {\n bootPercent = 1;\n\n stopIntervalServices();\n\n await dockerLogic.stopNonPersistentContainers();\n await dockerLogic.pruneContainers();\n\n // Turn SSH on and resets SSH password\n const currentConfig = await diskLogic.readSettingsFile();\n currentConfig.system.sshEnabled = false;\n await saveSettings(currentConfig);\n await authLogic.hashAccountPassword(constants.DEFAULT_SSH_PASSWORD);\n\n // Delete volumes\n await wipeSettingsVolume();\n await wipeAccountsVolume();\n await dockerLogic.removeVolume('applications_channel-data');\n await dockerLogic.removeVolume('applications_lnd-data');\n await dockerLogic.removeVolume('applications_logs');\n\n // Delete tor data from the existing volumes. The volumes can't be deleted because the manager is dependant on it.\n await diskLogic.deleteItemsInDir('/root/.tor');\n await diskLogic.deleteItemsInDir('/var/lib/tor/');\n\n // Erase any details of a previous migration.\n await diskLogic.writeMigrationStatusFile({details: '', error: false});\n\n // Reset the user interface hidden service in memory.\n delete process.env.CASA_NODE_HIDDEN_SERVICE;\n\n } catch (error) {\n logger.error(error.message, 'factory-reset', error);\n } finally {\n\n // Start up all applications.\n await startup();\n bootPercent = 100; // eslint-disable-line no-magic-numbers\n }\n}", "title": "" }, { "docid": "7e349a379b66710e05392130a0e3897a", "score": "0.6076424", "text": "reset() {\n this.initialize(this.settings);\n }", "title": "" }, { "docid": "933ded9fdb1fcf97b773ace45122847d", "score": "0.607566", "text": "function reset() {\n currentMove = 0;\n userHistory = [];\n moveHistory = [];\n clickEvents.buttons = [];\n buttons = [];\n isSimulated = true;\n isWaitingTurn = false;\n gameState = gameView.GAME_END;\n setup();\n}", "title": "" }, { "docid": "84268dfbc9fdf884080caf9908c8a56b", "score": "0.6074744", "text": "reset() {\n this.switchState(STATES.STATE_IDLE);\n this.ignoreReset(false);\n }", "title": "" }, { "docid": "fe93fd1f9c6abc4cc70f9185fc199045", "score": "0.60734576", "text": "reset() {\r\n this.changeState(this.CurrentConfig.initial);\r\n }", "title": "" }, { "docid": "9e3527bfd2d375c8e23a1dd557ba3d2a", "score": "0.6069325", "text": "function reset() {\n sessionCounter = 0;\n finalScore = 0;\n initTest();\n }", "title": "" }, { "docid": "51a889802a67033bbbb959e0e2665755", "score": "0.60639864", "text": "reset() {\r\n this.state = this.config.initial; //возвращаем стартовую конфогурацию\r\n }", "title": "" }, { "docid": "aae87dd314fc1b507422b260cea23d24", "score": "0.60568", "text": "function _reset() {\n\t\t\t\t_audit = {};\n\t\t\t\t_isNewFlag = null;\n\t\t\t\t_containerMap = {}\n\t\t\t}", "title": "" }, { "docid": "3d848beafbbddc5076412f3333bdc0d7", "score": "0.60450864", "text": "reset() {\n\t\tthis.running = false;\n\t\tthis.actions.forEach(function(action){\n\t\t\taction.init();\n\t\t}, this);\n\t}", "title": "" }, { "docid": "41432cca1a3fae9dc9ac5abdff579b7f", "score": "0.60432327", "text": "_resetStates() {\n this._manifest = null;\n this.reps = { video: null, audio: null, text: null, images: null };\n this.adas = { video: null, audio: null, text: null, images: null };\n this.evts = {};\n this.frag = { start: null, end: null };\n this.error = null;\n this.images.next(null);\n this._currentImagePlaylist = null;\n }", "title": "" }, { "docid": "145a5a62db90cc83011e3c407857c8c6", "score": "0.60384804", "text": "reset() {\n\t\tthis.gameOver = true;\n\t\tthis.completed = false;\n\t\tthis.running = null;\n\t}", "title": "" }, { "docid": "3ecd561fd68af9cf1320239c57bddfc1", "score": "0.6036726", "text": "function reset( )\n\t{\n\t\t// noop\n\t}", "title": "" }, { "docid": "ab4872ff403fa3b4cb4aa32bbccb2d4b", "score": "0.6036351", "text": "reset() {}", "title": "" }, { "docid": "6cda74eeb52bf9430ef9f84ff570ef59", "score": "0.60299015", "text": "function reset() {\n var service = getService();\n service.reset();\n}", "title": "" }, { "docid": "6cda74eeb52bf9430ef9f84ff570ef59", "score": "0.60299015", "text": "function reset() {\n var service = getService();\n service.reset();\n}", "title": "" }, { "docid": "6cda74eeb52bf9430ef9f84ff570ef59", "score": "0.60299015", "text": "function reset() {\n var service = getService();\n service.reset();\n}", "title": "" }, { "docid": "6cda74eeb52bf9430ef9f84ff570ef59", "score": "0.60299015", "text": "function reset() {\n var service = getService();\n service.reset();\n}", "title": "" } ]
ea524d7735a5f953b943e7ce3f809803
only allow numbers to be keyed into the zip code field
[ { "docid": "761211fb428b09ffe59a57dd1caf3ef6", "score": "0.5471436", "text": "function numbersOnly(myfield, e, dec) {\n\t\tvar key,\n\t\t\tkeychar;\n\t\tif (window.event) key = window.event.keyCode;\n\t\telse if (e) key = e.which;\n\t\telse return true;\n\t\tkeychar = String.fromCharCode(key);\n\t\tif ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )\n\t\t return true;\n\t\telse if (((\"0123456789\").indexOf(keychar) > -1))\n\t\t return true;\n\t\telse if (dec && (keychar == \".\")){\n\t\t myfield.form.elements[dec].focus();\n\t\t return false;\n\t\t} else\n\t\t return false;\n\t}", "title": "" } ]
[ { "docid": "0949d63ad8dc7b380a2b3489112010ef", "score": "0.73436445", "text": "function validate_zip(value){\n var zip = clean_nonnumber(value);\n return validate(zip.length, eq, 5);\n }", "title": "" }, { "docid": "272018b905bedee0f96185d55831144f", "score": "0.72507876", "text": "function validZipCode() {\n\tlet result = true;\n\tlet num = zipCode.value;\n\tif (num === '') result = false;\n\tfor (let i = 0; i < num.length; i++) {\n\t\tif (num[i].charCodeAt() > 57 || num[i].charCodeAt() < 48 || num.length !== 5) result = false;\n\t}\t\n\treturn result;\n}", "title": "" }, { "docid": "7aafafea5252071d59504ecafa2ac3a3", "score": "0.7038584", "text": "function allnumeric()\r\n{ \r\nvar uzip = document.registration.zip;\r\nvar numbers = /^[0-9]+$/;\r\nif(uzip.value.match(numbers))\r\n{\r\n// Focus goes to next field i.e. email.\r\ndocument.registration.email.focus();\r\nreturn true;\r\n}\r\nelse\r\n{\r\nalert('ZIP code must have numeric characters only');\r\nuzip.focus();\r\nreturn false;\r\n}\r\n}", "title": "" }, { "docid": "cf0bca7b0452567576c46e955ade6120", "score": "0.6992483", "text": "function validateZipCode() {\n\t\t\t//fetch user name value\n\t\t\tvar zipCode = document.getElementById(\"zip\"),\n\t\t\t\trequireZip = document.getElementById(\"req-zip\"),\n\t\t\t\t//alphabets only\n\t\t\t\tzipMatch = /^\\d+$/;\n\n\t\t\tif (!zipMatch.test(zipCode.value)) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\trequireZip.innerHTML = \"<small>Required. Must be numeric only.</small>\";\n\t\t\t\tuserName.style = \"border: 1px solid red\";\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "b2a797ece8e25466d929959eff3469cc", "score": "0.69496834", "text": "function isZipcode(objField,displayFieldName)\r\n{\r\n\t//var s = new String(objField.attr(\"value\"));\r\n // var strField = new String(objField.attr(\"value\"));\r\n var s = new String(objField.val());\r\n\r\n\tif (s.length != 5 && s.length != 10)\r\n\t\t// inappropriate length\r\n\t\treturn false;\r\n\r\n\r\n\tfor (var i=0; i < s.length; i++)\r\n\t\tif ((s.charAt(i) < '0' || s.charAt(s) > '9') && s.charAt(i) != '-')\r\n\t\t { \r\n\t\t errorMessage = \"Invalid Zip Code for \" + displayFieldName ; \r\n\t\t DisplayError(objField,errorMessage); \r\n\t\t\t return false;\r\n }\r\n\treturn true;\r\n}", "title": "" }, { "docid": "447faae1dd5002300d48c770b3e38804", "score": "0.6919211", "text": "validatePostalCode(val) {\r\n let stringRegex = /^[0-9]*$/;\r\n return stringRegex.test(val);\r\n }", "title": "" }, { "docid": "b9f432c62d86b49c489910d9d4ad346b", "score": "0.68342876", "text": "function validateZip(zip) {\n if (!zip) {\n return false; \n }\n \n if (zip.length === 0) {\n return false; \n }\n \n if (!Number.isInteger(zip)) {\n var blockedZipWords = []; // for custom interal verbage eg. \"not supported\"\n \n if (blockedZipWords.indexOf(zip.toLowerCase()) !== -1) {\n return false;\n }\n }\n \n return zip; // can't get rid of added float, do it server side\n}", "title": "" }, { "docid": "35620c954132b14e53b89ccc0c3e1ac5", "score": "0.67188", "text": "function isZipcode(zipcode) {\n\treturn /^\\d{3}\\d{2}$/.test(zipcode);\n}", "title": "" }, { "docid": "e7a0876e0cb65003fbd20712187d7990", "score": "0.6716973", "text": "function zipCodeValidation() {\n const zipCode = $('#zip').val();\n const zipCodeRegex = /^\\d{5}$/;\n const isZipCodeValid = zipCodeRegex.test(zipCode);\n fieldValidity.zip = isZipCodeValid;\n return isZipCodeValid;\n}", "title": "" }, { "docid": "701c0dc5c89e1fb74bf7a729d6549755", "score": "0.6698716", "text": "function validateZIP() {\n\t\n\t// Validate ZIP code\n\tvar zipcode=document.forms[\"searchMechanicOtherZIP\"][\"zip\"].value;\n\tif ( isNaN(zipcode) || zipcode.length < 4 ) { // not a number\n\t\talert(\"Please enter ZIP Code\");\n\t\t//alert( zipcode + zipcode.length );\n\t\treturn false;\n\t}\n\t\n\t\n}", "title": "" }, { "docid": "41de4b61e388f99089e92802cee349bc", "score": "0.66876554", "text": "function validation_zip(){\n if(inputZip.value.length === 5 && !isNaN(inputZip.value)){\n return true;\n }\n else{\n return false;\n }\n}", "title": "" }, { "docid": "3106a107e8f2cabacad4eee52a9ade69", "score": "0.66861445", "text": "function isValidZipCode(val) {\r\n if(val.length < 4) {\r\n \treturn false;\r\n }\r\n else {\r\n \treturn true;\r\n }\r\n}", "title": "" }, { "docid": "fbd38c03e5f64266e422482e37a7c767", "score": "0.6645704", "text": "function check_zip_code_field(cnt, zip, address) {\n\tvar zip_error = false;\n\tvar rules = {};\n\tvar message = true;\n\n\tif (!isset(address))\n\t\tvar address = '';\n\n\tif (!zip || zip.value == \"\")\n\t\treturn true;\n\n zip.value = zip.value.replace(/^\\s+/g, '').replace(/\\s+$/g, '');\n\n\tvar c_code = config_default_country;\n\tif (cnt && cnt.options) {\n\t\tif ((cnt.options.length > 0) && (cnt.selectedIndex < cnt.options.length)) {\n\t\t\tc_code = cnt.options[cnt.selectedIndex].value;\n\t\t}\n\t}\n\n // bt:83803 According http://en.wikipedia.org/wiki/Postal_codes#Character_sets\n if (!isset(check_zip_code_rules[c_code]) && c_code != 'UA' && isset(txt_error_common_zip_code)) {\n check_zip_code_rules[c_code] = {\n error: txt_error_common_zip_code, \n rules: [/^([ a-z0-9-]+)$/gi]\n };\n }\n\n\tif (c_code && typeof(window.check_zip_code_rules) != 'undefined' && typeof(check_zip_code_rules[c_code]) != 'undefined') {\n\t\tvar rule = check_zip_code_rules[c_code];\n\t\tif (rule && rule.rules && rule.rules.constructor == Array && rule.rules.length > 0) {\n\t\t\tzip_error = true;\n\t\t\tfor (var i = 0; i < rule.rules.length && zip_error; i++) {\n\t\t\t\tif (zip.value.search(rule.rules[i]) != -1)\n\t\t\t\t\tzip_error = false;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (zip_error) {\n\t\tif (rule && rule.error && rule.error.length > 0) {\n\t\t\tmessage = rule.error.replace(/{{address}}/, address);\n\t\t\tif (!isset(check_zip_code_posted_alert) || check_zip_code_posted_alert.indexOf('<' + message + zip.value + '>') == -1) {\n\t\t\t\talert(message);\n\t\t\t\tcheck_zip_code_posted_alert = check_zip_code_posted_alert + '<' + message + zip.value + '>';\n\t\t\t}\n\t\t} \n\n\t\tif (zip.focus)\n\t\t\tzip.focus();\n\t}\n\n\treturn !zip_error;\n}", "title": "" }, { "docid": "537fa2d06d60360251cf4a7e6662777e", "score": "0.6627208", "text": "function validateZipCode(elementValue){\r\n var zipCodePattern = /^(0[289][0-9]{2})|([123456789][0-9]{3})$/;\r\n return zipCodePattern.test(elementValue);\r\n }", "title": "" }, { "docid": "2fb8d4601e21672c9196f5cbb0fcfe9d", "score": "0.66270244", "text": "function validateZip(field) {\n var error = \"\";\n\n // Change the regex to allow just 5 numbers. Hint: look at validateAge.\n var legalChars = / /;\n\n // Change the conditional to test against an empty input.\n if (true) {\n field.className = 'missing';\n error = \"The required zip code field must be filled in.\\n\";\n }\n\n // Change the conditional to test if the input does not match legalChars.\n // Hint: look at validateAge.\n else if (true) {\n field.className = 'invalid';\n error = \"The zip code can only contain 5 numbers.\\n\"\n }\n else {\n field.className = '';\n }\n return error;\n}", "title": "" }, { "docid": "979041a37bd02b7e94df94b47f19c341", "score": "0.66131735", "text": "function allnumeric(uzip)\r\n{ \r\n//Declaring a variable numbers that stores the regular expression that will be matched against\r\n var numbers = /^[0-9 :]+$/;\r\n//Statement to check whether the value input matches numbers\r\n if(uzip.value.match(numbers))\r\n {\r\n return true;\r\n }\r\n else\r\n {\r\n//Make an alert when the condition is not fulfilled with a popup \r\n alert('ZIP code must have numeric characters only');\r\n uzip.focus();\r\n return false;\r\n }\r\n}", "title": "" }, { "docid": "a4781a35fab648258c230109407b84b5", "score": "0.65865904", "text": "function checkZipCode(zipCode){\n var zipPattern = /^\\d{5}$|^\\d{5}-\\d{4}$/;\n return zipPattern.test(zipCode);\n } // a function to validate the entered ZIP code with Regex", "title": "" }, { "docid": "2c0525bda43f490b63531f072578e651", "score": "0.65809184", "text": "function isCreditZipCodeValid(zipcode){\n return /^\\d{5}$/.test(zipcode);\n}", "title": "" }, { "docid": "c725da58111581a23a1d4f6270f491b0", "score": "0.6548666", "text": "function validateZip(){\n if(regx.test(zip.value)){\n return true\n }else{\n return false\n }\n}", "title": "" }, { "docid": "8fc8a87b3b2f5c7d7a9d59196e1e35ed", "score": "0.6543798", "text": "function isValidZipCode(zipCode)\n{\n if (zipCode.length != 10 && zipCode.length != 5) {\n alert('Zip code length is incorrect.');\n return false;\n }\n\n var arrZipCode = zipCode.split('');\n\n for (var i in arrZipCode)\n {\n if (i == 5 && arrZipCode[i] != '-') {\n alert('Invalid zip code.');\n return false;\n }\n\n if (i != 5 && isNaN(arrZipCode[i])) {\n alert('Invalid zip code.');\n return false;\n }\n }\n\n return true;\n}", "title": "" }, { "docid": "261317dfaf9c012a82279c0e6b234cf3", "score": "0.65302414", "text": "function validateZip(el, typestr) {\n if (el.value.length != 5 || // Check if 5 character zip code\n isNaN(el.value) || // Check if form value is a number\n parseInt(el.value) < 0) { // Check if the number is negative\n doError(el, typestr + \" Information: 5 digit Zip Code is invalid or missing\");\n return false;\n }\n\n return true;\n}", "title": "" }, { "docid": "62c0599a55883a6142aee7acc2406421", "score": "0.64721173", "text": "function checkZipCode(input) {\n return (/(^\\d{5}$)|(^\\d{5}-\\d{4}$)/).test(input);\n }", "title": "" }, { "docid": "4da4159414203bb7764ba67316ba5c4b", "score": "0.64715594", "text": "function validateZipcode(zipcode)\n {\n var retValue = true;\n \n var zipRE = /^\\d{5}-?(\\d{4})?$/;\n retValue = zipRE.test(zipcode);\n \n return retValue;\n }", "title": "" }, { "docid": "4172c9f2f69b72d837ef4e37825060be", "score": "0.6464174", "text": "onZipInput(text) {\n this.setState({zipcode: text.replace(/[^0-9]/g, '')}, () => {\n localController.storeData('zipcode', this.state.zipcode);\n });\n }", "title": "" }, { "docid": "cb3d5d6e106efb57fef212a3bdfa82e9", "score": "0.6409076", "text": "function isValidZipCode() {\n const zipCodeValue = zipCodeInput.value;\n const zipCodeCheck = /^\\d{5}$/.test(zipCodeValue);\n if (!zipCodeCheck) {\n zipCodeInput.style.border = invalidBorderStyle;\n } \n return zipCodeCheck;\n}", "title": "" }, { "docid": "920c1dda4b1026bdeff8c2cc63b31edc", "score": "0.64072514", "text": "function isValidZIP(zip) {\n return /^[0-9]{5}$/.test(zip);\n}", "title": "" }, { "docid": "1048b3296fd92116aeddd96f95abf751", "score": "0.637191", "text": "function PhoneZipVlidation() {\n document.getElementById('phone').addEventListener('input', (e) => {\n const x = e.target.value.replace(/\\D/g, '').match(/(\\d{0,3})(\\d{0,3})(\\d{0,4})/);\n e.target.value = !x[2] ? x[1] : `${x[1]}${x[2]}${x[3] ? `${x[3]}` : ''}`;\n });\n \n const phone = document.getElementById('phone');\n const postalCode = document.getElementById('postal_code');\n \n postalCode.addEventListener('change', (() => {\n const postalCode = document.getElementById('postal_code');\n postalCode.value = postalCode.value.replace(/[^0-9]/g, '');\n }));\n \n postalCode.addEventListener('keyup', (e) => {\n let val = postalCode.value.replace(/\\D/g, '');\n if (val.length > 5) {\n val = val.slice(0, 5);\n postalCode.value = val;\n }\n postalCode.value = val;\n });\n }", "title": "" }, { "docid": "c35549efc2522438542c8ed78cc35fc8", "score": "0.6365014", "text": "function validateZip(val) {\n\tvar valtemp = val.replace(/[^\\d.]/g, \"\")+\"\";\n\treturn valtemp.substr(0, 6);\n}", "title": "" }, { "docid": "82790ef6da3239cc36f9aa84e89d82e3", "score": "0.63452405", "text": "function zipIsValid(input) {\n if (input.value.match(/^\\d{5}$/)) {\n input.classList.remove(\"invalid\");\n input.classList.add(\"valid\");\n return true;\n } else {\n input.classList.remove(\"valid\");\n input.classList.add(\"invalid\");\n return false;\n }\n}", "title": "" }, { "docid": "a09a359fa48591ce6b4ea95dc7f60cb1", "score": "0.6302107", "text": "function alphanumeric()\r\n{ \r\nvar uadd = document.registration.address;\r\nvar letters = /^[0-9a-zA-Z]+$/;\r\nif(uadd.value.match(letters))\r\n{\r\n\r\n// Focus goes to next field i.e. ZIP Code.\r\ndocument.registration.zip.focus();\r\nreturn true;\r\n}\r\n}", "title": "" }, { "docid": "30c42af0f4171387a6da58b3128ed592", "score": "0.63019544", "text": "function validateZipCode() {\n if ($('#payment').prop('selectedIndex') != 1) {\n return true;\n }\n if (!(validZipCodeRegEx.test($('#zip').val())) && $('.zip-code-error').length === 0) {\n $('#zip').before($(zipCodeInputError));\n return false;\n }\n if (!(validZipCodeRegEx.test($('#zip').val()))) {\n return false;\n }\n if ((validZipCodeRegEx.test($('#zip').val())) && $('.zip-code-error').length > 0) {\n $('.zip-code-error').remove();\n return true;\n }\n return true;\n}", "title": "" }, { "docid": "cc70e18b6fe41080fee55a720b7b9a62", "score": "0.62895685", "text": "function restrictField_Numbers(fieldClass){\n $('.'+fieldClass).keypress(function(e) {\n var a = [];\n var k = e.which;\n\n for (i = 48; i < 58; i++)\n a.push(i);\n\n if (!(a.indexOf(k)>=0))\n e.preventDefault();\n })\n}", "title": "" }, { "docid": "2670db1ca0d4547735789f59c4bb91c2", "score": "0.6235809", "text": "function isValidZip() { \n const nrIsOk = /^\\d{5}$/.test(zipInput.value);\n const errStr = getCustomNumberErrorStr(zipInput.value, 5, 5);\n return {\n isValid: nrIsOk,\n errorMessage: errStr\n };\n}", "title": "" }, { "docid": "dc506ede1338df9b60c71af4d3d871c4", "score": "0.62349546", "text": "function isZipCode(str) {\n\tvar re = /^[0-9]{4}[0-9]$/;\n\treturn (re.test(str));\n}", "title": "" }, { "docid": "aa8362a1a82dbc3b25473643cae697a9", "score": "0.6201263", "text": "validateZipcode() {\n const location = this.state.location;\n if (location.length === 0) {\n return 'Enter a zip code';\n } else if (!postcodeValidator(location, 'US')) {\n return 'Enter a valid zip code';\n }\n }", "title": "" }, { "docid": "c8469b8eb7ebfd08bd126d823c2eda10", "score": "0.61984533", "text": "function allowNumbersOnly(e) {\n //This checks the corresponding keyCode value for each e passed through it\n var code = (e.which) ? e.which : e.keyCode;\n if (code > 31 && (code < 48 || code > 57)) {\n e.preventDefault();\n }\n}", "title": "" }, { "docid": "e0f9dc4fa352f3d2e09ab4301e9faa0c", "score": "0.6172966", "text": "function checkValidZip(inputUserZip){\n\n (regexAllDigits.test(inputUserZip)&& inputUserZip.length==5)? hideValidationError('zip','zipError') : showValidationError('zip','Please enter a valid zip Number.','zipError');\n\n}", "title": "" }, { "docid": "78ef7be4d633d4d758a87acd21d221c9", "score": "0.6112131", "text": "function ValidateZipcode(zipcode) { \r\n let i;\r\n \r\n if(zipcode != \"\" && zipcode.length == 6) {\r\n for(i=0; i<zipcode.length;i++) {\r\n if(zipcode[i] >= 0 && zipcode[i] <= 9) {\r\n return true; \r\n }\r\n else {\r\n document.getElementById('zipcodetext').innerHTML = \"Please enter a valid zipcode!\";\r\n document.getElementById('zipcodetext').style.color = 'red';\r\n return false;\r\n }\r\n }\r\n }\r\n else {\r\n document.getElementById('zipcodetext').innerHTML = \"Zipcode is mandatory!\";\r\n document.getElementById('zipcodetext').style.color = 'red';\r\n return false;\r\n }\r\n}", "title": "" }, { "docid": "95c4dae538ad3e48fe5e7900f2caa152", "score": "0.6112111", "text": "function validateAddZip() {\n pzip = document.getElementById(\"paZip\").value\n if (isNaN(pzip) || pczip.length !== 5) {\n alert(\"Please enter a valid zip code.\")\n document.getElementById(\"paZip\").value = \"\"\n } \n}", "title": "" }, { "docid": "2d8aca978c7f11b156e94f00e6388def", "score": "0.6094028", "text": "function zipCheck(){ \n\t var zip =document.getElementById(\"zip\").value;\n\t if(zip.length > 5){\n\t\tdocument.getElementById(\"msgs\").innerHTML=\"Zip Code Must be 5 Numbers.\";\n\t var str5 = zip.substring(0,5);\n\t\tvar x = document.getElementById(\"zip\");\n\t\tx.value = str5; \n }\n\t \n}", "title": "" }, { "docid": "6852bb3243522a92404f2b79ebb91449", "score": "0.60824615", "text": "function isZipValid() {\n\tconst regexZip = /^\\d{5}$/.test(inputZip.value);\n\tif (!regexZip || inputZip.value === null) {\n\t\tnotValidated(inputZip);\n\t} else {\n\t\tvalidated(inputZip);\n\t}\n\treturn regexZip;\n}", "title": "" }, { "docid": "30c117e673bc336cd7210f86adb136ff", "score": "0.6046525", "text": "function ZipIncorrect() {\n var executionContextObj = document.EntityScript.ExecutionContextObj;\n if (executionContextObj.getEventArgs().getSaveMode() === 1 || executionContextObj.getEventArgs().getSaveMode() === 2 || executionContextObj.getEventArgs().getSaveMode() === 59) {\n var zipField = Xrm.Page.getAttribute(\"cog_zipcode\");\n if (zipField.getValue() !== null) {\n var isValidZip = /(^\\d{5}$)|(^\\d{5}-\\d{4}$)|(^\\d{5}\\d{4}$)/.test(zipField.getValue());\n\n if (!isValidZip) {\n alert(\"Must enter a valid 5 or 9 digit zip code before saving.\");\n executionContextObj.getEventArgs().preventDefault();\n }\n }\n }\n}", "title": "" }, { "docid": "ea62e59b67badf65124b8204736ab7a7", "score": "0.6040812", "text": "function validateZip(theZip, theClass) {\n\n\t// match all the zip code of the United States of America. \n\tvar zip = /^\\s*((\\d{5})|(\\d{5}-\\d{4}))(?!\\S)/;\n\n\tif (theZip.match(zip)) {\n\t\t\n\t\tdocument.getElementsByClassName(theClass)[0].style.visibility = 'hidden';\n\t}else{\n\t\tdocument.getElementsByClassName(theClass)[0].style.visibility = 'visible';\n\t}\n\n}", "title": "" }, { "docid": "623b228eac93e13b6e41cc658e842a06", "score": "0.6010684", "text": "function isValidUSZip(sZip) {\n return /^\\d{5}(-\\d{4})?$/.test(sZip);\n}", "title": "" }, { "docid": "374a2975fe841b85dd997553237913c7", "score": "0.6005123", "text": "allowOnlyNumber(e) {\n let char = e.which || e.keyCode\n if ((char >= 37 && char <= 40) || (char >= 48 && char <= 57) || (char >= 96 && char <= 105) || (char == 8) || (char == 9) || (char == 13)) {\n\n } else {\n e.preventDefault();\n }\n }", "title": "" }, { "docid": "bcb9736ccdfea819c4c71b3eb0a5a5be", "score": "0.5992496", "text": "function isValidZip(zip){\n var regex = /^([0-9]{6})+$/;\n return regex.test(zip);\n}", "title": "" }, { "docid": "bad47e5eaa0067302df877a4f9625824", "score": "0.5980712", "text": "function validZip() {\n const regexZip = /^\\d{5}$/;\n\n if (!(regexZip.test($('#zip').val()))) {\n $('#zip').css('border-color', '#B20000');\n $('[for=\"zip\"] span').remove();\n $('[for=\"zip\"]').append('<span><b> Please enter a valid zip code </b></span>').css('color', '#B20000');\n return false;\n } else {\n $('#zip').css('border-color', '#794880;');\n $('[for=\"zip\"] span').remove();\n $('[for=\"zip\"]').css('color', '#000000');\n return true;\n }\n}", "title": "" }, { "docid": "3eb812420a43dae181be2f07b7983959", "score": "0.59669745", "text": "function validateZip(req, res, next) {\n const zip = req.params.zip;\n if (zip.length !== 5 || isNaN(zip)) {\n next(`Zip (${zip}) is invalid!`);\n } else {\n next();\n }\n}", "title": "" }, { "docid": "7ff72715334fb04e4794e6083e3e6e1e", "score": "0.5940982", "text": "function zipRegex (inputZip) {\n return /^[0-9]{5}$/.test(inputZip)}", "title": "" }, { "docid": "c3df0b4417d1483dd82aa1c6edb00f24", "score": "0.5936552", "text": "function checkPostcode() {\r\n //Finds the value of the postcode field\r\n var input = $(\".postcode\").val();\r\n \r\n //Replaces any non-numeric characters with nothing, then update the input field\r\n input = input.replace(/\\D/g,'');\r\n $(\".postcode\").val(input);\r\n \r\n}", "title": "" }, { "docid": "7d362aec83366747622dcda54ab7193d", "score": "0.59052455", "text": "function validPostalCode() {\r\n\r\n inputPostalCode.onblur = () => testPostalCodeBlur();\r\n\r\n testPostalCodeFocus();\r\n }", "title": "" }, { "docid": "bf77bbe5f7412a091d996ed995e4f3a6", "score": "0.58961487", "text": "function checkZip(input){\n var zip = input.value;\n if(zip !== null){\n if(zip.length!==5){\n input.setCustomValidity(\"Please enter a valid 5-digit zip code\");\n }else{\n input.setCustomValidity('');\n }\n }\n}", "title": "" }, { "docid": "b97c1bdb85310be1362ffa86f46d4ad6", "score": "0.5881459", "text": "function zipValidate(){\n\tconst paymentValue = $('#payment').val();\n\tzip = $('#zip').val();\n\tif (isNaN(zip)){\n\t\t$('#zip').before(ccZipError)\n\t\treturn false;\n\t} else if (zip.length === 5 ||paymentValue === 'paypal' || paymentValue === 'bitcoin'){\n\t\tccZipError.hide();\n\t\treturn true;\n\t} else if (zip.length > 5 || zip === ''){\n\t\t$('#zip').before(ccZipError)\n\t\treturn false;\n\t}else {\n\t\treturn true;\n\t}\n}", "title": "" }, { "docid": "9e7b72565690c5ffa5d4eb1b8e2884bb", "score": "0.587678", "text": "function isZipFilled () {\n var zipCodeInUrl = window.location.search.split('=')[1]\n var zipCodeInput = document.getElementById('address-zipCode')\n if (zipCodeInUrl) {\n zipCodeInput.value = zipCodeInUrl\n return true\n }\n return false\n}", "title": "" }, { "docid": "5f19c2bce4b447d3c68a134e63538a0a", "score": "0.5868448", "text": "function validationCodePostal(inputId, spanId){\n\tvar value = document.getElementById(inputId).value;\n\tvar regex = /^[A-Za-z]\\d[A-Za-z]\\s?\\d[A-Za-z]\\d$/i;\n\tif (!regex.test(value)) {\n\t\tdocument.getElementById(spanId).innerHTML = \"Votre code postal n'est pas valide !\";\n\t\treturn false;\n\t}\n\treturn true;\n}", "title": "" }, { "docid": "0c76cb9cd4674adedc43916ab11c31d9", "score": "0.5862366", "text": "function only_numbers_on_range(){\n $(\"form input#location_range\").keydown(function(key){\n if((key.which > 47) && (key.which < 58)){\n $(this).text(String.fromCharCode(key.which));\n }\n else{\n return false;\n }\n });\n}", "title": "" }, { "docid": "615bd459cb1f70ee081ce26295d3b7fe", "score": "0.58504695", "text": "function checkZip() {\n\tvar zp = document.getElementById(\"inputZipcode\").value\n\tvar dispZp = document.getElementById(\"zipCode\").innerHTML\n\n\tif(zp != dispZp && zp != 0){\n\t\tif(!zp.match(/^\\d{5}$/)){\n\t\t\talert(\"Zip code must be 5 digits\")\n\t\t}\n\t\telse{\n\t\t\talert(\"Zip code updated, changing from \"+ dispZp +\" to \"+zp)\n\t\t\tdocument.getElementById(\"zipCode\").innerHTML = zp\n\t\t}\n\t}\n}", "title": "" }, { "docid": "127c728e1617aaa9066de8218d79b9b4", "score": "0.583196", "text": "function onAddressPasteRemoveZip() {\n let addrElem = document.getElementById('case_illegal_place');\n addrElem.addEventListener('paste', (event) => {\n\tlet paste = (event.clipboardData || window.clipboardData).getData('text');\n\tpaste = paste.replace(/^[0-9 ]*/, \"\");\n\taddrElem.value = paste;\n\n\tevent.preventDefault();\n });\n}", "title": "" }, { "docid": "8a34a81a4a6d3ee3ea3d2aea60b60bfb", "score": "0.5825568", "text": "function formatZipCode(znum){\n\tif(znum.length == 9){\n\t\treturn znum.substring(0,5) + \"-\" + znum.substring(5,znum.length);\n\t}\n\treturn znum;\n}", "title": "" }, { "docid": "08433e2f71a3a221329c2a84d933a2b4", "score": "0.5820973", "text": "function validate_pin(ph)\n\t{\n\tvar pattern=new RegExp(/^[0-9]$/);\n\treturn pattern.test(ph);\n\t}", "title": "" }, { "docid": "148417c17059151943ff472418497864", "score": "0.5808514", "text": "function zipCodekeyup() {\n let zipCodevalue = zipCode.value;\n if (zipCodevalue.length > 5 || zipCodevalue.length < 5) {\n zipCode.style.border = 'solid 2px red';\n // changeElemDisplay(button, 'none');\n }\n else if (zipCodevalue.length === 5) {\n zipCode.style.border = '3px solid lightgreen';\n // creditCardValidationBlock(creditCardCVV, creditCardNumber);\n }\n for (let index = 0; index < zipCodevalue.length; index++) {\n // zipcode validation conditions\n if (isNaN(zipCodevalue[index])) {\n zipCode.style.border = 'solid 2px red';\n // changeElemDisplay(button, 'none');\n }\n }\n}", "title": "" }, { "docid": "caf6d3e580ff025e8c96e1dcf902a0c6", "score": "0.5793049", "text": "function restrictNumbers(e)\r\n\t{\r\n\t\tvar x=e.which||e.keycode;\r\n\t\tif((x>=48 && x<=57) || x==8 ||\r\n\t\t\t(x>=35 && x<=40)|| x==46)\r\n\t\t\treturn false;\r\n\t\telse\r\n\t\t\treturn true;\r\n\t}", "title": "" }, { "docid": "fe7164c71e5366e62460c216c97b0803", "score": "0.5788798", "text": "function preventNumbers(event) {\n const keyCode = (event.keyCode ? event.keyCode : event.which);\n if (keyCode >= 48 && keyCode <= 57 || keyCode >= 96 && keyCode <= 105) {\n event.preventDefault();\n }\n}", "title": "" }, { "docid": "cb082d08d5f7a3a43aec58faa7d8c5b3", "score": "0.5777162", "text": "function readPostalCodeField() {\n $('#postalCode').on('blur', function() {\n findGeocodeAndMap();\n var postalCode = $.trim($('#postalCode').val()); \n var postalCodePatt = /^[A-Za-z]\\d[A-Za-z][ -]?\\d[A-Za-z]\\d$/;\n if(!checkIfEmptyField($('#postalCode'))) {\n if(!postalCode.match(postalCodePatt)) {\n displayError($('#postalCodeError'), $('#postalCode'), postalCode + \" is not a valid canadian postal code\"); \n } else {\n findGeocodeAndMap();\n }\n }\n });\n $('#postalCode').on('focus', function() {\n removeError($('#postalCodeError'),$('#postalCode')); \n });\n}", "title": "" }, { "docid": "7757c0af267af4af600c70b866076bf4", "score": "0.5770446", "text": "function AllowOnlyNumber() {\n\n AllowOnlyNumberValidation(\"new_customerphonenumber\");\n}", "title": "" }, { "docid": "99de2e31083b4f33eeb2594ff32ab7a8", "score": "0.57656956", "text": "function isDigitKey(key) {\n return /[0-9]/.test(key);\n }", "title": "" }, { "docid": "c444b5f65824381b519fae74aeb1b34c", "score": "0.5761582", "text": "function validatePIN (pin) {\n //return true or false\n\n console.log ( parseFloat( pin ));\n\n if ( pin.length === 4 || pin.length === 6) {\n\n if ( typeof parseFloat( pin ) != \"number\" || /\\D/.test(pin) || /[a-z]/.test(pin)) {\n return false;\n } else {\n return true;\n }\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "97e49c23eb589306a98d9ddbbc9886f3", "score": "0.5749452", "text": "function postalCodeCheck(postal_code)\r\n{ \r\n var pattern_ca = /([ABCEGHJKLMNPRSTVWXYZ]\\d){3}/i;\r\n var pattern_usa = /^[0-9]{5}(?:-[0-9]{4})?$/;\r\n\r\n if((postal_code.length < 5) || (postal_code.length > 12))\r\n { \r\n return false;\r\n }\r\n\r\n if(pattern_ca.test(postal_code))\r\n { \r\n return true;\r\n }\r\n else if (pattern_usa.test(postal_code))\r\n { \r\n return true;\r\n } \r\n else\r\n {\r\n return false;\r\n }\r\n}", "title": "" }, { "docid": "7e418d10f64bee72f6001f64be5dec71", "score": "0.5746632", "text": "restrictAlphabets(event) {\n var x = event.which || event.keycode;\n if ((x >= 48 && x <= 57))\n return true;\n else {\n event.preventDefault();\n return false;\n }\n\n }", "title": "" }, { "docid": "9570c3b411d43a12d39dd9376f331864", "score": "0.5746566", "text": "function pin_validation()\n\t{\n\t\tvar pincodetxt =document.getElementById(\"pincodetxt\").value;\n\t\tif(isNaN(pincodetxt))\n\t\t{alert(\"Enter valid number\");\n\t\t\tdocument.getElementById(\"pincodetxt\").value=\"\";\n\t\t\tdocument.getElementById(\"pincodetxt\").focus();\n\n\t\t}\n\t}", "title": "" }, { "docid": "672bc35027f0c33fbf62abff2552016d", "score": "0.5723426", "text": "function onZipKeyPress(evt) {\n var keyCode = window.event ? evt.keyCode : evt.which,\n KEY_0 = 48,\n KEY_9 = 57,\n KEY_BACKSPACE = 0,\n KEY_DELETE = 8,\n\n KEY_ENTER = 13;\n\n if ((keyCode === KEY_ENTER) && (!pointbreak.isCurrentBreakpoint(\"small\", \"medium\"))) {\n onZipSearchSubmit();\n if (evt.preventDefault) {\n evt.preventDefault();\n } else {\n evt.returnValue = false;\n }\n } else if (keyCode < KEY_0 || keyCode > KEY_9) {\n if (keyCode !== KEY_BACKSPACE && keyCode !== KEY_DELETE && !evt.ctrlKey) {\n if (evt.preventDefault) {\n evt.preventDefault();\n } else {\n evt.returnValue = false;\n }\n return false;\n }\n }\n }", "title": "" }, { "docid": "cc7e51562ff1f174522da026a7c656d8", "score": "0.5721571", "text": "function preventNumberInput(e) {\n var keyCode = (e.keyCode ? e.keyCode : e.which);\n if (keyCode > 47 && keyCode < 58) {\n e.preventDefault();\n }\n}", "title": "" }, { "docid": "553c9de4ae25ee2668474b594fc55d3d", "score": "0.5680334", "text": "function numberonly(event) {\n var num = event.which ? event.which : event.keyCode;\n if (num > 31 && (num < 48 || num > 57)) return false;\n return true;\n}", "title": "" }, { "docid": "88a8bd28951ef04364b2b02d3a3eb686", "score": "0.5676724", "text": "function acceptNumbers(e) {\n var keyControls = [8, 9, 13, 27, 46, 91, 92, 93];\n var keyNumbers = \"0123456789-\";\n\n var key;\n if (window.event) key = window.event.keyCode;\n else if (e) key = e.which;\n else return true;\n\n var keyChar = String.fromCharCode(key).toLowerCase();\n if (keyControls.indexOf(key) > -1) return true;\n else if (keyNumbers.indexOf(keyChar) > -1) return true;\n else {\n e.preventDefault();\n return false;\n }\n}", "title": "" }, { "docid": "3aadc0eb9168b7389f636b1e8a024f95", "score": "0.5675336", "text": "function isUSAZipCode(str) \r\n {\r\n return /^{5}/.test(str);\r\n }", "title": "" }, { "docid": "d989ad5969b4e4ce16046ccafea5760b", "score": "0.5671088", "text": "function ccZipValidator(num) {\n let testZip = ccZip.test(num);\n let zipValue = $('#zip').val();\n\n if ( zipValue.length === 0){\n $('#zip').css('border-color', 'red');\n $errorZip2.show();\n $errorZip1.hide();\n return false;\n } else if ( testZip === false){\n $('#zip').css('border-color', 'red');\n $errorZip1.show();\n $errorZip2.hide();\n return false;\n } else {\n $('#zip').css('border-color', '#6F9DDC');\n $errorZip1.hide();\n $errorZip2.hide();\n return true;\n }\n}", "title": "" }, { "docid": "4082322b364a6796a35e4b21bf4c0b5b", "score": "0.56435937", "text": "function writeZipCode(geoObj){\n var geocoder = new google.maps.Geocoder;\n\n geocoder.geocode({'latLng': geoObj}, function(results, status){\n if (status == google.maps.GeocoderStatus.OK) {\n var address = results[0].address_components;\n for (var i = 0; i<address.length; i++){\n // find results that can be coerced to number, and whose length is 5\n if (parseInt(address[i].long_name) && address[i].long_name.length == 5) {\n var zip = address[i].long_name;\n events.emit('zipCodeFromDrag', zip);\n }\n }\n }\n });\n }", "title": "" }, { "docid": "812517bc78064f1f63327944befbbd71", "score": "0.5640178", "text": "function isNumber(code) {\n return code > 47 && code < 58;\n }", "title": "" }, { "docid": "4515c751d7896e555967fd7ccaad7fcf", "score": "0.5629385", "text": "function numOnlyPin()\r\n\t\t{\r\n\t\t\tvar key = event.keyCode;\r\n\t\t\tif(key < 31 && (key > 48 || key < 57)|| key==8 || key==9)\r\n\t\t\t{\r\n\t\t\t\t$(\".numfeild1\").css(\"border\",\"none\");\r\n\t\t\t\t$(\"#ON5\").css(\"display\", \"none\");\r\n\t\t\t\treturn true;\r\n \r\n\t\t\t}\r\n\t\t\tif (key > 31 && (key < 48 || key > 57))\r\n\t\t\t{\r\n\t\t\t\t$(\"#ON5\").css(\"display\", \"block\");\r\n\t\t\t\t$(\".numfeild1\").css(\"border\",\"1px solid red\");\r\n\t\t\t\t$(\"#ON5\").text(\"* Enter number Only!\").css(\"color\",\"red\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n \r\n\t\t}", "title": "" }, { "docid": "4e3dcf5f8998f5046394b9f2676bd525", "score": "0.56163377", "text": "function OnlyNumber()\n{\n\tif(!\n\t(((window.event.keyCode >= 48) && (window.event.keyCode <= 57))\n\t|| (window.event.keyCode == 13) \n\t|| (window.event.keyCode == 46) \n\t|| (window.event.keyCode == 45))\n\t)\n\t{\n\t\twindow.event.keyCode = 0;\n\t}\n}", "title": "" }, { "docid": "6f19bddc3168172537f4b2416c01ddd3", "score": "0.56060845", "text": "function justNumbers(e) {\n\t\tvar keynum = window.event ? window.event.keyCode : e.which;\n\t\tif ( keynum == 8) return true;\n\t\treturn /\\d/.test(String.fromCharCode(keynum));\n\t}", "title": "" }, { "docid": "4f0593b790bd2de829acf10056cc6a96", "score": "0.5600298", "text": "function validatePIN (pin) {\n //return true or false\n var n = pin.length;\n if( n != 4 && n != 6)\n return false;\n for (var i in pin)\n if (pin[i] > '9' || pin[i] < '0')\n return false;\n return true;\n}", "title": "" }, { "docid": "f02c20a32be7b508ec8c706d83a50d4d", "score": "0.5597207", "text": "function validateNumberKeyPress(event) {\n var key = window.event ? event.keyCode : event.which;\n if (key === 44 || key === 8 || key === 0 ||\n (event.ctrlKey && key === 99) ||\n (event.ctrlKey && key === 97) ||\n (event.ctrlKey && key === 118)) {\n return true;\n }\n else if (key < 48 || key > 57) {\n return event.preventDefault();\n }\n else return true;\n}", "title": "" }, { "docid": "e7f7632f0b4da0145b44488bc8def3f5", "score": "0.556305", "text": "function zipValidator () {\n let userZip= zip.value;\n \n \n if (payment.children[1].selected) {\n if (zipRegex(userZip)) {\n zip.style.border = '2px solid green';\n zip.style.color = 'green';\n \n \n return validZip = true;\n } else {\n zip.style.border = '3px solid red';\n document.getElementById('zip').placeholder= \"Invalid Zip\";\n return validZip = false;\n }}\n else {return validZip = true;}\n }", "title": "" }, { "docid": "1eb402e5d2b969df689fcc7847b2ba9d", "score": "0.55610657", "text": "function allowOnlyNumeric(event) {\n const key = event.key;\n const keyCode = event.keyCode;\n\n switch (key) {\n case 'Backspace':\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowLeft':\n case 'ArrowRight':\n return true;\n case 'Enter':\n //event.preventDefault();\n }\n\n if (keyCode > 31 && (keyCode < 48 || keyCode > 57)) {\n event.preventDefault();\n return false;\n }\n return true;\n }", "title": "" }, { "docid": "e1d146cc859c3c31d26638d62ac7f3d0", "score": "0.55561775", "text": "function postalCodeCheck() {\n var str = document.getElementById(\"postalCode\").value;\n var regex = /^[A-Z]\\d[A-Z] ?\\d[A-Z]\\d$/;\n\n if (regex.test(str)){\n document.getElementById(\"postalCodeHelp\").innerHTML = \"\";\n }\n else{\n document.getElementById(\"postalCode\").focus();\n document.getElementById(\"postalCodeHelp\").innerHTML = \"Invalid format. Use (A#A #A#)\";\n }\n}", "title": "" }, { "docid": "ebb359600fd78170888d641f46fb739f", "score": "0.55410814", "text": "function validatePIN(pin) {\n let expr = new RegExp(/[\\D]/);\n if (expr.test(pin)) {\n return false\n } else if (pin.length !== 4 && pin.length !== 6) {\n return false\n } else {\n return true\n }\n}", "title": "" }, { "docid": "036dfb0ce32f1ac3fcc6f978938a84d8", "score": "0.5538607", "text": "function onlyNumber(event){\r\n\tevent = event || window.event;\r\n\tvar keyID = (event.which) ? event.which : event.keyCode;\r\n\tif ( (keyID >= 48 && keyID <= 57) || (keyID >= 96 && keyID <= 105) || keyID == 8 || keyID == 46 || keyID == 37 || keyID == 39 \r\n\t\t\t|| keyID == 9) \r\n\t\treturn;\r\n\telse\r\n\t\treturn false;\r\n}", "title": "" }, { "docid": "d476d3fe25a81353e7878b53fafc6f09", "score": "0.5530311", "text": "function validate_shipping_information() {\n\tvar input_zip = $('div#shipping_information.page input[name=zip]');\n\n\tif (input_zip.val() == '')\n\t\tinput_zip.val('0');\n\n\treturn original_validator();\n}", "title": "" }, { "docid": "0d9a0faae484875baec27f0f0a9d0fee", "score": "0.5528723", "text": "function numbersonly(myfield, e, dec)\r\n{\r\nvar key;\r\nvar keychar;\r\n\r\nif (window.event)\r\n key = window.event.keyCode;\r\nelse if (e)\r\n key = e.which;\r\nelse\r\n return true;\r\nkeychar = String.fromCharCode(key);\r\n\r\n// control keys\r\nif ((key==null) || (key==0) || (key==8) || \r\n (key==9) || (key==13) || (key==27) )\r\n return true;\r\n\r\n// numbers\r\nelse if (((\"0123456789\").indexOf(keychar) > -1))\r\n return true;\r\n\r\n// decimal point jump\r\nelse if (dec && (keychar == \".\"))\r\n {\r\n myfield.form.elements[dec].focus();\r\n return false;\r\n }\r\nelse\r\n\talert(\"<liferay-ui:message key='Accept-number-only'/>\")\r\n return false;\r\n}", "title": "" }, { "docid": "b69fd1d9f5b0a1d6210e45f995ed8320", "score": "0.5527761", "text": "function numonly(e) {\n\te = e || window.event;\n var key = e.keyCode || e.charCode;\n if (key < 48 || key > 57) { //top row keys only\n e.preventDefault();\n }\n\tif (key < 96 || key > 105) { //number pad keys only\n e.preventDefault();\n }\n}", "title": "" }, { "docid": "151c3222d53033f63f1a58ddcb42330c", "score": "0.55182415", "text": "function checkPcode() {\n var text = document.getElementById(\"pCode\");\n var exp = /^[A-Za-z]\\d[A-Z a-z] ?\\d[A-Za-z]\\d$/;\n if (exp.test(text.value)) {\n return true;\n } else {\n alert(\"This postal code is invalid, please enter a valid postal code\");\n pCode.focus();\n return false;\n }\n}", "title": "" }, { "docid": "cbe092c34212ba49eda3a43cfd2d3b6a", "score": "0.5510257", "text": "function onlyNumber(event) {\n return event.charCode >= 48 && event.charCode <= 57;\n}", "title": "" }, { "docid": "ca1c0a4012ab3cc4fbed7836a61180fd", "score": "0.5509599", "text": "function PincodeValidation(pincode)\n{\n if(pincodeRegex.test(pincode))\n {\n console.log(pincode +\" is in valid format\");\n }\n else throw \"Incorect Pincode Format\";\n}", "title": "" }, { "docid": "a180d3509768fb2a6339892ea09f5085", "score": "0.5502726", "text": "function getZipCode(){\n zipInput = document.getElementById(\"zip\").value;\n for(var i = 0; i < convert.codes.length; i++){\n if(zipInput == convert.codes[i].zip){\n fipsInput = convert.codes[i].stCountyFp;\n document.getElementById(\"place\").innerHTML = convert.codes[i].countyName + \", \" + convert.codes[i].state;\n }\n }\n getMaskData();\n}", "title": "" }, { "docid": "e0d6faecd8df210445fbcc50e132f52a", "score": "0.5489317", "text": "function checkZipCode() {\n\n const zipCode = userZipCode.value;\n const regex = /^[0-9]{5}$/;\n const match = regex.test(zipCode);\n \n if (match == true) {\n userZipCode.style.border = \"2px solid rgb(111, 157, 220)\";\n return true;\n } else {\n userZipCode.style.border = \"2px solid red\";\n return false;\n }\n \n}", "title": "" }, { "docid": "64ab6401ccc0df58519f99f629f7b64a", "score": "0.5484397", "text": "function onlyNumbers(event) {\n\t var mobile=document.getElementById(\"refnumber\").value;\n var e = event || evt; // for trans-browser compatibility\n var charCode = e.which || e.keyCode;\n \n if (charCode > 31 && (charCode < 48||charCode > 57))\n \t {\n return false;\n \t }\n return true;\n }", "title": "" }, { "docid": "898a2e8168c4cce0fddd67012b1f55e4", "score": "0.54824793", "text": "function isValidPincode(pin) {\n return /^[1-9]{1}[0-9]{5}$/.test(pin);\n}", "title": "" }, { "docid": "7a0b5c02d43ed49ac1c867555485cee3", "score": "0.5481826", "text": "function checkZipcodeInputErrors() {\n\tif (registration.payment.zipCode().length === 0) {\n\t\t// remove any error formatting that already exists\n\t\tremoveInputError(zipInput);\n\t\t// apply new error\n\t\tdisplayInputError(zipInput);\n\t\t// return error msg \n\t\treturn 'Please provide a zipcode.';\n\t}\n\telse if (registration.payment.zipCode().length !== 5) {\n\t\t// remove any error formatting that already exists\n\t\tremoveInputError(zipInput);\n\t\t// apply new error\n\t\tdisplayInputError(zipInput, '(5 digits)');\n\t\t// return error msg\n\t\treturn 'Zipcode must be 5 digits';\n\t} else {\n\t\t// remove all error styling for input\n\t\tremoveInputError(zipInput);\n\t\treturn null;\n\t}\n}", "title": "" }, { "docid": "49abbc12851faa684c46a645a9b085ff", "score": "0.5470566", "text": "function validatePIN (pin) {\n var isNumber = /^\\d+$/.test(pin) && (pin.length == 4 || pin.length == 6)\n return isNumber;\n}", "title": "" } ]
96d35525f90a1244dfc2c7ccb4847f77
Get the tldrs corresponding to one or more category names. Query string options: skip, limit (as usual) sort: 'createdAt' (latest), 'readCount' (most read) categories: 'cat1 cat2 cat3 ...'
[ { "docid": "f27fee0e653193a96e86d4b4811ea716", "score": "0.8550914", "text": "function getTldrsByCategoryName (req, res, next) {\n var options = {}\n , defaultLimit = 50\n ;\n\n if (!req.query.categories) { return res.send(403, i18n.missingCategoriesNames); }\n\n options.skip = req.query.skip;\n options.sort = req.query.sort;\n\n // TODO: customUtils function for this\n options.limit = parseInt(req.query.limit || defaultLimit, 10);\n options.limit = isNaN(options.limit) ? 1 : options.limit;\n options.limit = Math.min(defaultLimit, Math.max(1, options.limit));\n\n Tldr.findByCategoryName(req.query.categories, options, function (err, tldrs) {\n if (err) { return res.send(500, err); }\n\n return res.json(200, tldrs);\n });\n}", "title": "" } ]
[ { "docid": "2e031a6a191d11292f92302281d4c67d", "score": "0.62292653", "text": "function getAllCategoryList(){\n return $q.when(db.allDocs({include_docs:true,startkey: 'category-', endkey: 'category-\\uffff'}))\n .then(function(docs){\n console.log('%%% get all categories',docs.rows)\n return $q.when(_.map(docs.rows, function(l){return l.doc.catName}))\n })\n }", "title": "" }, { "docid": "514919fd170cbedd13d4462bd63bed0c", "score": "0.59797865", "text": "function listCategories () {\n return norrisClient.then(_mapToEndpoints()).then(_listCategories).then(prop('body'))\n}", "title": "" }, { "docid": "cacce522b529d876202fe235097386aa", "score": "0.58040434", "text": "function getCategoryByName(catName){\n return $q.when(db.allDocs({include_docs:true,startkey: 'category-', endkey: 'category-\\uffff'}))\n .then(function(docs){\n console.log('%%% get category by name',docs.rows)\n var allCats = docs.rows\n var ret = []\n _.forEach(allCats, function(c){\n if(c.doc.catName === catName){\n ret = c\n }\n })\n return ret\n })\n\n }", "title": "" }, { "docid": "4bacbbb414768281d03a332bcabd1bb6", "score": "0.57180244", "text": "async function getCategories() {\n // const response = await services.getAllAds();\n // console.log(response.categories)\n const categories = [{_id: 3, category: \"Робота\"},{_id: 2, category: \"Транспорт\"},{_id: 4, category: \"Електроніка\"},{_id: 5, category: \"Бізнес та послуги\"},{_id: 7, category: \"Віддам безкоштовно\"},{_id: 8, category: \"Обмін\"},{_id: 6, category: \"Відпочинок і спорт\"},{_id: 1, category: \"Нерухомість\"},];\n return categories;\n }", "title": "" }, { "docid": "dcfe4e6879be71669418340463703504", "score": "0.56834644", "text": "function getCategories(q) {\n let url = buildUrl(\"categories\");\n getData(url).done(result => {\n renderDrinkInfo(result);\n });\n}", "title": "" }, { "docid": "e6533d812ba26ac1061b8dbb41f845b9", "score": "0.56722337", "text": "function getCats(req, res) {\n let perPage = 5;\n let catSearch = {};\n if (req.query.q) {\n catSearch.name = new RegExp(req.query.q, 'i');\n }\n let query = Cat.find(catSearch);\n if (limitInUrl = parseInt(req.query.n)) {\n perPage = limitInUrl;\n }\n query.limit(perPage);\n if (pageInUrl = parseInt(req.query.p)) {\n query.skip((pageInUrl-1) * perPage);\n }\n query.exec((err, cats) => {\n if (err) res.send(err);\n res.json(cats)\n });\n}", "title": "" }, { "docid": "e804f7f6e780ce36f7c09db2e1e07982", "score": "0.55575645", "text": "function readCategories(callback){\n getConnection();\n var sql = \"SELECT id, Name FROM categories ORDER BY Name \";\n connection.query(sql, function(err, rows, fields){\n if(err){\n console.log(err);\n callback(err, null);\n }else{\n var categories = [];\n for (var i in rows){\n var cur = rows[i];\n categories.push(cur);\n }\n console.log('readCategories. categories = '+JSON.stringify(categories));\n callback(null, categories);\n }\n });\n}", "title": "" }, { "docid": "21b914b30c21fc78bd823b57da883784", "score": "0.5543616", "text": "function filterPrdCategory () {\n let cat = null;\n categoryList.forEach((item) => {\n if (item.url === props.match.params.categoryName)\n {cat=item.id}\n });\n return (cat);\n }", "title": "" }, { "docid": "d0baf811ea09b7ee76dc3341f87bc591", "score": "0.5518797", "text": "async function getAllCategories() {\n try {\n const { rows: categories } = await client.query(\n `\n SELECT *\n FROM categories;\n `\n );\n\n return categories;\n } catch (error) {\n throw error;\n }\n}", "title": "" }, { "docid": "419338b8083335d20cda39200388f1ac", "score": "0.55076385", "text": "function getCategories(){\n\t\treturn $http.get(host+\"/categories\", []).\n\t\t\tthen(end);\n\t}", "title": "" }, { "docid": "b4089acae3f7603ea6fb0caae45827f3", "score": "0.54908276", "text": "getNamesByCategory(category, branch) {\n return this.dao.all(\n `SELECT *\n FROM fila\n WHERE category = ?\n AND branch = ?\n ORDER BY id ASC`,\n [category, branch]\n )\n }", "title": "" }, { "docid": "05cd4db4456416f4dcdb14cb7aa2ec1b", "score": "0.54679763", "text": "function GetCategories() {\r\n var accountNumber = \"\";\r\n services.getService(apiUrl.category.Get(accountNumber)).then(function (response) {\r\n });\r\n}", "title": "" }, { "docid": "5da91b356706721488f75e0504e18bfa", "score": "0.543513", "text": "function getTicketsByCategory(categoryName, jqueryPath) {\n let returnList = [];\n let curentList = document.querySelectorAll(jqueryPath);\n\n curentList.forEach(element => {\n let obj = {\n text: element.innerText,\n category: categoryName,\n id: element.id\n }\n returnList.push(obj);\n });\n\n return returnList;\n}", "title": "" }, { "docid": "2a9fcbe6211d65419208936b2c0507ea", "score": "0.54051375", "text": "async getDrinksByCategory(category){\r\n //search by category\r\n const apiResponce = await fetch(\r\n `http://www.thecocktaildb.com/api/json/v1/1/filter.php?c=${category}`\r\n );\r\n\r\n //wait for responce and return json\r\n const coctails = await apiResponce.json();\r\n\r\n return {\r\n coctails,\r\n };\r\n }", "title": "" }, { "docid": "41516921c1a42217ab673028a08c0dc3", "score": "0.5394715", "text": "function getDataTypesCat(cat) {\n var dt = [];\n data.forEach(line => {\n if(!dt.includes(line[cat])) {\n dt.push(line[cat]);\n }\n });\n return dt;\n}", "title": "" }, { "docid": "c019d6abb5547572ac060cd630835142", "score": "0.5356028", "text": "async function getCategories() {\n let catArr = [];\n const response = await fetch(catUrl);\n const data = await response.json();\n catArr = data.trivia_categories;\n return catArr;\n}", "title": "" }, { "docid": "f44fbe9c9bb0cc5d79dbe2f41b6f2212", "score": "0.5353982", "text": "function findByKeywordAndCategory() {\n // escape special chars from keyword\n _keyword = stringHelper.escapeSpecialCharacters(_keyword);\n getSubByCategoryId()\n .then(subcate_ids => {\n // Check pagination\n _findQuery = _pageNumber === undefined ? Course.find({ 'name': { $regex: new RegExp(_keyword, \"i\") }, $or: [{ 'categoryid': _categoryId }, { 'categoryid': { $in: subcate_ids } }] }).sort('name').limit(_pageSize)\n : Course.find({ 'name': { $regex: new RegExp(_keyword, \"i\") }, $or: [{ 'categoryid': _categoryId }, { 'categoryid': { $in: subcate_ids } }] }).sort('name').skip((_pageNumber - 1) * _pageSize).limit(_pageSize);\n var countQuery = Course.count({ 'name': { $regex: new RegExp(_keyword, \"i\") }, $or: [{ 'categoryid': _categoryId }, { 'categoryid': { $in: subcate_ids } }] });\n\n // Execute the queries\n executeCountQuery(countQuery)\n .then(totalRecord => {\n executeFindQuery(totalRecord);\n })\n .catch(err => {\n logger.error(\"Error at function: CourseController.findAll->findByKeywordAndCategory\", err);\n return res.send({ code: 400, message: \"Data not found!\" });\n })\n })\n .catch(err => {\n logger.error(\"Error at function: CourseController.findAll->findByKeywordAndCategory\", err);\n return res.send({ code: 400, message: \"Data not found!\" });\n })\n }", "title": "" }, { "docid": "0acb7b115197d4bc3c90b38eaa0b8aa6", "score": "0.5325187", "text": "function get_categories(titles){\r\n\tvar filter = titles ? new OrFilter(titles.map(function(i){return new Filter({title: i})})) : {};\r\n\treturn app.getObjects(\"Category\", filter, {sort:{id:\"asc\"}});\r\n}", "title": "" }, { "docid": "3a7077d6ef4cd08a885abdb0f8401f88", "score": "0.5323394", "text": "getProductsByCategory(productCategoryId, numberProductPerPage) {\n return Repository.get(\n `${resource}/category/${productCategoryId}?perPage=${numberProductPerPage}`\n );\n }", "title": "" }, { "docid": "5226c216dc00e954b407fd4c3930025c", "score": "0.53114927", "text": "function getPostsByCategory(category) {\n var feed = [];\n\n _setCategoryInfo(category);\n\n return $http.get(apiUrl + '/posts/?filter[category_name]=' + category + '&page=' + currentCategoryPage + '&filter[posts_per_page]=10')\n .success(function(res, status, headers) {\n feed = factory.postsByCategory.concat(res);\n angular.copy(feed, factory.postsByCategory);\n currentCategoryPage += 1;\n });\n }", "title": "" }, { "docid": "1ab8fabfb8d3a27f4512684d1ad9295b", "score": "0.5303867", "text": "async function getCategories() {\n let categories = await request(\n `${process.env.REACT_APP_SERVER_URL}${endpoints.categories}`,\n getAccessTokenSilently,\n loginWithRedirect,\n \"GET\",\n );\n\n if (categories && categories.length > 0) {\n console.log(categories);\n setCategories(categories);\n }\n }", "title": "" }, { "docid": "d03fc7a95f85a74d3c9ef219ff91b8e3", "score": "0.52745706", "text": "function getAccountLogCategories() {\n\n var date = new Date();\n var cacheBuster = \"?cb=\" + date.getTime();\n\n return $http({ method: 'GET', url: urlBase + '/GetAccountLogCategories' + cacheBuster });\n }", "title": "" }, { "docid": "9af2c8f3b19f591af778fe212be25fc9", "score": "0.5264873", "text": "function buildMlGetCategories (opts) {\n // eslint-disable-next-line no-unused-vars\n const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts\n /**\n * Perform a [ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request\n *\n * @param {string} job_id - The name of the job\n * @param {long} category_id - The identifier of the category definition of interest\n * @param {int} from - skips a number of categories\n * @param {int} size - specifies a max number of categories to get\n * @param {object} body - Category selection details if not provided in URI\n */\n\n const acceptedQuerystring = [\n 'from',\n 'size'\n ]\n\n const snakeCase = {\n\n }\n\n return function mlGetCategories (params, options, callback) {\n options = options || {}\n if (typeof options === 'function') {\n callback = options\n options = {}\n }\n if (typeof params === 'function' || params == null) {\n callback = params\n params = {}\n options = {}\n }\n\n // check required parameters\n if (params['job_id'] == null && params['jobId'] == null) {\n const err = new ConfigurationError('Missing required parameter: job_id or jobId')\n return handleError(err, callback)\n }\n\n // validate headers object\n if (options.headers != null && typeof options.headers !== 'object') {\n const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)\n return handleError(err, callback)\n }\n\n var warnings = []\n var { method, body, jobId, job_id, categoryId, category_id, ...querystring } = params\n querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)\n\n if (method == null) {\n method = body == null ? 'GET' : 'POST'\n }\n\n var ignore = options.ignore\n if (typeof ignore === 'number') {\n options.ignore = [ignore]\n }\n\n var path = ''\n\n if ((job_id || jobId) != null && (category_id || categoryId) != null) {\n path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId)\n } else {\n path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories'\n }\n\n // build request object\n const request = {\n method,\n path,\n body: body || '',\n querystring\n }\n\n options.warnings = warnings.length === 0 ? null : warnings\n return makeRequest(request, options, callback)\n }\n}", "title": "" }, { "docid": "97cc02b25be924916beaadc4fbd037b6", "score": "0.5255745", "text": "category(categoryStr) {\r\n return new FluentRestaurants(this.data.filter(function (place) {\r\n if (lib220.getProperty(place, \"category\").found) {\r\n return lib220.getProperty(place, \"category\").value === categoryStr;\r\n }\r\n }));\r\n }", "title": "" }, { "docid": "1c7c42fe5449b9a9640643d8dda2220c", "score": "0.52555126", "text": "function getCategorias (req, res) {\n\tif (Object.keys(req.query).length > 0) {\t\t\n\t\tvar sql = `SELECT * FROM categorias `;\n\t\tvar connection = conectar();\n\t\tconnection.query(sql, function (err, result) {\n\t\t\tif (err) return res.status(500).send({ message: `Error al recuperar categorias: ${err}` });\n\t\t res.status(200).send({ result })\n\t\t});\n\t\tconnection.end();\n\t} else {\n\t\tvar sql = `SELECT * FROM categorias`;\n\t\tvar connection = conectar();\n\t\tconnection.query(sql, function (err, result) {\n\t\t\tif (err) return res.status(500).send({ message: `Error al recuperar categorias: ${err}` });\n\t\t res.status(200).send({ result })\n\t\t});\n\t\tconnection.end();\n\t}\n}", "title": "" }, { "docid": "e5a5408c98ace567704a57a8ba3ee7a8", "score": "0.5238435", "text": "function getCategoryList(req, res) {\n\n if (!validator.isValid(req.body.companyId)) {\n res.json({ code: Constant.ERROR_CODE, message: Constant.REQUIRED_FILED_MISSING });\n }\n else {\n category.find({ companyId: req.body.companyId })\n .sort({ categoryName: 1 })\n .exec(function (err, categoryList) {\n if (err) {\n res.json({ code: Constant.ERROR_CODE, message: Constant.INTERNAL_ERROR });\n }\n else {\n res.json({ code: Constant.SUCCESS_CODE, 'message': Constant.CATEGORY_LIST_FETCHED, data: categoryList });\n\n }\n });\n }\n}", "title": "" }, { "docid": "956867184bdd15b90700f9a2de521b3e", "score": "0.52334595", "text": "async fetchByCategory(category) {\n const calls = [];\n const snapshot = await this.AllCallsRef.where(\"category\", \"==\", category).get();\n snapshot.docs.forEach((callDoc) => {\n calls.push(callDoc.data());\n });\n return await this.db.fetchDisplayData(calls);\n }", "title": "" }, { "docid": "6932c025361cbe067d7f3d9d112f5dbc", "score": "0.52265686", "text": "function loadCategories() {\n return Object(_http_services__WEBPACK_IMPORTED_MODULE_0__[\"http\"])().get('/api/get-categories');\n}", "title": "" }, { "docid": "8007797205f2685ef4b70f036c76bfe2", "score": "0.51953316", "text": "async getCategory() {\n\t\t//getting 100 categories from Jeopardy API\n\t\tconst result = await axios.get('http://jservice.io/api/categories?count=100'); // is it neccessary to get 100 when number of categories is already defined?\n\t\tconst categoryIds = [];\n\t\tfor (let x = 0; x < this.width; x++) {\n\t\t\tconst random = Math.floor(Math.random() * result.data.length);\n\t\t\tcategoryIds.push(result.data[random].id);\n\t\t\tthis.topMostRowStyling(x, random, result);\n\t\t}\n\n\t\treturn categoryIds;\n\t}", "title": "" }, { "docid": "1fb9e97651eec96f693fec4c53df199c", "score": "0.51760477", "text": "function list_products_by_category (args, done) {\n const products = seneca.make(\"products\");\n products.list$({category: args.category}, done);\n }", "title": "" }, { "docid": "8357713a8159d70f479d046d7f6bffd3", "score": "0.5173062", "text": "function getAll (req, res) {\n const limit = req.query.limit;\n const category = req.query.category\n tripModel.getAll(limit, category, (err, result) => {\n if (err) res.send({message: 'something failed', error: err});\n res.send(result);\n });\n}", "title": "" }, { "docid": "142bfd971eb61cb7b629354d473c5521", "score": "0.5171387", "text": "function requestGetAllCategories() {\n return { type: REQUEST_GET_ALL_CATEGORIES };\n}", "title": "" }, { "docid": "d241c9c29240b4baaa40568846ea7d97", "score": "0.51710474", "text": "function getCategoryKeywords(index) {\n return localStorage.getItem(\"cat-name-\"+getCategoryName(index));\n}", "title": "" }, { "docid": "58d0274c9f25d3052e8c637d0bbe0f62", "score": "0.5167848", "text": "getSubCategories(category) {\n const itemsArray = this.getItemsInCategory(category);\n\n return StashCollection.sortCategories(itemsArray.map((item) => item.category[category]));\n }", "title": "" }, { "docid": "fdbf456212338eb9c385daae640589aa", "score": "0.51540756", "text": "async function filterCategories() {\n const CATEGORIES = {};\n let categories = await CATSREF.once('value', snap => {\n let data = snap.val();\n data.forEach(cat => {\n CATEGORIES[cat.id] ? null : CATEGORIES[cat.id] = {'id': cat.id, 'name': cat.name}\n });\n });\n return CATEGORIES\n}", "title": "" }, { "docid": "2aca3a5e3b4b50307acdfa74a9cff5f2", "score": "0.51342255", "text": "function list() {\n var endpoint = CATEGORIES_URI + '/list',\n Service = $resource(endpoint);\n\n return Service.get().$promise;\n }", "title": "" }, { "docid": "df7c5ea113548681fefd97ebc99bbc5a", "score": "0.51211673", "text": "function find() {\n return db('categories').orderBy('category_id')\n}", "title": "" }, { "docid": "c2c4ddd86b4cc5a768f197b6f4de80dc", "score": "0.5113589", "text": "function getSampleCategories(callback) {\n var promises = [];\n // currently, load Vietnamese categories only\n // ['vi_VN', 'en_US'].forEach(function(lang) {\n ['vi_VN'].forEach(function(lang) {\n promises.push(new Promise(function(resolve, reject) {\n let url = _config.api_resource_config + 'categories-' + lang + '.spl?token=' + token;\n $.get(url).done(function(res) {\n resolve({ language: '@' + lang, data: res });\n }).fail(function(res) {\n _helper.error(res.error);\n });\n }));\n });\n\n Promise.all(promises).then(function(results) {\n callback(results);\n });\n }", "title": "" }, { "docid": "44b7caf416510f3a16c80bbd1cc89968", "score": "0.50976104", "text": "findCategorySuggestions(str) {\n if ((typeof str) !== 'string') return;\n if (!str) return;\n\n const schema = [...this.categories];\n const result = [];\n\n while (result.length < 3 && schema.length) {\n const cat = schema.shift();\n if (cat.name.toLocaleLowerCase().indexOf(str.toLocaleLowerCase()) !== -1) {\n result.push(new KeywordSuggestion(cat.id, cat.name));\n }\n if (cat.children && Array.isArray(cat.children)) {\n schema.push(...cat.children);\n }\n }\n this.categorySuggestions = result || this.categorySuggestions;\n }", "title": "" }, { "docid": "aafb4e300d5aadfd6f213fbf085ceb66", "score": "0.50786406", "text": "function getCategories() {\n categories.forEach(function(category) {\n \n categoryName = category.category.charAt(0).toUpperCase() + category.category.substr(1);\n\n $(\"#category-list\").append(`\n <li class=\"category list-group-item\" data=${category.class}>${category.class} - ${categoryName}</li>\n `)\n })\n}", "title": "" }, { "docid": "f6122e783eb943d4433d4a5eef27b7ce", "score": "0.5070744", "text": "function fetchCategories() {\n fetch(API + \"categories\")\n .then(checkStatus)\n .then(JSON.parse)\n .then(function(categories) {\n displayCategories(categories);\n mapCategories(categories);\n })\n .catch(displayError);\n }", "title": "" }, { "docid": "b3eab66899dc204c969243e3bf860cb4", "score": "0.50672394", "text": "static getAllCategories(projectId){\n return new Promise(async (resolve, reject) => {\n try {\n const res = await axios.get(reqURL + '/projects/'+ projectId + '/categories?per_page=1000');\n const data = res.data;\n resolve(data);\n } catch (err){\n reject(err);\n }\n })\n }", "title": "" }, { "docid": "602092fc34db495a26bd7c341d59a488", "score": "0.5054053", "text": "getCategories() {\n return fetch(this.baseURL + '/categories').then(res => res.json()\n );\n }", "title": "" }, { "docid": "324b51f883de9361a1c53ece7bd81f53", "score": "0.5049882", "text": "function getAllCats(term,cmcontinue){\n\t\t\n\t\tvar query = \"https://en.wikipedia.org/w/api.php?action=query&format=json&list=categorymembers&cmtype=subcat&cmtitle=Category:\" + term;\n\t\tif ( (cmcontinue!==\"\") && (cmcontinue !== undefined)){\n\t\t\tquery += \"&cmcontinue=\" + cmcontinue;\t\t\t\t\t\t\t//\"&cmcontinue=subcat|3f372b49432937433d43335703422f4151374943413f2f414d273d043f372b49432937433d433357012b018f7a8f1d|17381965\"\n\t\t}\n\t// \tvar maxcatpages = 3;\n// \t\tvar catpagectr = 0;\n\t\t// get the subcats\n\t\t $.ajax({\n\t\t\turl: query,\n\t\t\tdataType: \"JSONP\",\n\t\t\tasync: false,\n\t\t\tsuccess: function (json){\n\t\t\t\tvar j = json;\n\t\t\t\t\n\t\t\t\tvar catarray = json['query']['categorymembers'];\n\t\t\t\tvar newcat;\n\t\t\t\tfor (var i=0; i < catarray.length; i++){\n\t\t\t\t\tnewcat = catarray[i]['title'];\n\t\t\t\t \tcats.push(newcat);\n\t\t\t\t \t\n\t\t\t\t }\n\t\t\t\t if (json['continue']){\n\t\t\t\t \tif (json['continue']['cmcontinue']){\n\t\t\t\t \t\tcmcontinue = json['continue']['cmcontinue'];\n\t\t\t\t \t}\n\t\t\t\t \telse {cmcontinue = \"\";\n\t\t\t\t \t\t$(\"#subcatbtn\").text(\"Done.\");\n\t\t\t\t \t}\n\t\t\t\t }\n\t\t\t\t else {cmcontinue = \"\";\n\t\t\t\t \t$(\"#subcatbtn\").text(\"Done.\");\n\t\t\t\t \t}\n\t\t\t\tif (cmcontinue != \"\"){\n\t\t\t\t\tgetAllCats(term,cmcontinue);\n\t\t\t\t}\n\t\t\t\tif (cmcontinue == \"\"){\n\t\t\t\t\n\t\t\t\t\t$.ajax({\n\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\tasync: false,\n\t\t\t\t\tdata: {\"term\" : term, \"names\" : cats},\n\t\t\t\t\turl: \"buildnamefile.php\", \n\t\t\t\t\tsuccess: function(data) {\n\t\t\t\t\t\t\t$(\"#results\").html($(\"#results\").html() + \"<br>wrote file\");\n\t\t\t\t\t\t },\n\t\t\t\t\t\t error: function (e){\n\t\t\t\t\t\t\tif (e.statusText !== \"OK\"){\n\t\t\t\t\t\t\t\talert(\"Failed to read recent files: \" . e.statusText, \"ERROR\");\n\t\t\t\t\t\t\t\t//statusUpdate(\"Failed to read recent files: \" . e.statusTex);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t});\n\n\t\t\t\t} // if cmcontinue == \"\"\n\t\t\t}\n\t\t});\n\t\n\t\n\treturn cats;\n\n}", "title": "" }, { "docid": "1da870de0897ebc679338b84d3877f15", "score": "0.5043137", "text": "function listBooks (request,limit,token, cb) {\n var key = dataset.key([kind, 5642779036221440]);\n\n transaction.get(key, function(err, entity) {\n cb(null, entity, false);\n });\n\n console.log(request);\n var q = ds.createQuery([kind]);\n\n if(request.cat_id !=''){\n q.filter('cat_id', '=' , cat_id);\n }\n if(request.keyword !=''){\n \n q.filter('name', 'LIKE' , '%'+request.keyword+'%');\n }\n q.start(token).order('cat_id').limit(limit);\n ds.runQuery(q, function (err, entities, nextQuery) {\n if (err) {\n return cb(err);\n }\n var hasMore = entities.length === limit ? nextQuery.startVal : false;\n cb(null, entities.map(fromDatastore), hasMore);\n });\n}", "title": "" }, { "docid": "930143b74e43211f4f8266afb48d18e1", "score": "0.503664", "text": "async getAllByCategory(req, res, next) {\n try {\n let data = await service.findAll({\n where: {\n id_category: req.params.id,\n },\n limit: parseInt(req.query.limit),\n offset: (parseInt(req.query.page) - 1) * parseInt(req.query.limit),\n });\n\n if (data.length === 0) {\n return next({ message: \"Data not found\", statusCode: 404 });\n }\n return res.status(200).json({\n message: \"Success\",\n data,\n });\n } catch (e) {\n return next(e);\n }\n }", "title": "" }, { "docid": "e6c1212ce9c52c9c8be73b5a2b56f539", "score": "0.5020828", "text": "async getCategories(req, res, next) {\n const categories = await categoriesModel.find();\n res.json(categories);\n }", "title": "" }, { "docid": "9dbd5f9db592d4d245f46f9388447870", "score": "0.5011555", "text": "function get_category_list() {\n let cat_list = [];\n \n config.categories.map((category) => {\n let data = {}; \n data.text = category.name;\n data.value = category.id;\n cat_list.push(data);\n })\n \n return cat_list;\n }", "title": "" }, { "docid": "a7173a63a681f8b6fa04cf0c56221e6c", "score": "0.50114614", "text": "async function getCategoryByName({ name }) {\n try {\n const { rows: category } = await client.query(\n `\n SELECT *\n FROM categories\n WHERE name=$1;\n `,\n [name]\n );\n\n return category;\n } catch (error) {\n throw error;\n }\n}", "title": "" }, { "docid": "2074d1aa03bff6d8dcfaab5cb265bea5", "score": "0.49776074", "text": "getCategories(){\n var url = Meteor.settings.spotify.url + '/browse/categories'\n\n var spotifySync = Meteor.wrapAsync(spotifyAsync);\n return spotifySync(url);\n }", "title": "" }, { "docid": "991a5677462dc97ffdb2500ffbab1ef6", "score": "0.4975969", "text": "function getFindCategorybyName(Category) {\n return strapi.query('category').find({ name: /`${Category}`/ });\n }", "title": "" }, { "docid": "f0f2cbd00b2f6bdd4cc269b752c79bc4", "score": "0.49538624", "text": "async function getAllCategories() {\n let sql = \"select * from categories\";\n\n try {\n let categoriesData;\n categoriesData = await connection.execute(sql);\n\n return categoriesData;\n } catch (error) {\n throw new ServerError(ErrorType.GENERAL_ERROR, sql, error);\n }\n}", "title": "" }, { "docid": "764b13ec5d6031ae2514b78b2e09224c", "score": "0.49348068", "text": "function getCategoryData(lat, long, name, week, category){\n var searchRequest = {\n term: category,\n latitude: lat,\n longitude: long,\n radius: rad,\n limit: lim\n };\n \n client.search(searchRequest).then(response => {\n const allResults = response.jsonBody;\n const prettyJson = JSON.stringify(allResults, null, 4);\n \n var t = response.jsonBody.total;\n console.log(\"NUMBER RESULTS: \" + t);\n var i = 0;\n if(t >= 50){\n console.log(\"RESULTS OVERFLOW\");\n t = 50;\n }\n console.log(prettyJson);\n //RECORD JSON DATA\n fs.writeFileSync(week + '_' + name + '_' + category + '.json', prettyJson); \n \n }).catch(e => {\n console.log(e);\n });\n console.log();\n}", "title": "" }, { "docid": "282414656e732e0ff534462aaec16664", "score": "0.49317837", "text": "function getPosts(category) {\n var categoryString = category || \"\";\n if (categoryString) {\n categoryString = \"/category/\" + categoryString;\n }\n $.get(\"/api/posts\" + categoryString, function(data) {\n console.log(\"Posts\", data);\n posts = data;\n if (!posts || !posts.length) {\n displayEmpty();\n }\n else {\n initializeRows();\n }\n });\n }", "title": "" }, { "docid": "4a5bc1f2b702c7730ac7f38fcd902b7e", "score": "0.4923293", "text": "function getCategories() {\n return $.get(\"https://opentdb.com/api_category.php\")\n .then(res => res.json())\n .then(res => res.trivia_categories);\n}", "title": "" }, { "docid": "19e6ffea60e89c23b6bba700534c8d8f", "score": "0.49203372", "text": "function returnCategoryNames() {\n var displayedCategoryNames = []\n for (i = 0; i < GLOBAL_DISPLAYED_CATEGORY.length; i++) {\n displayedCategoryNames.push(GLOBAL_DISPLAYED_CATEGORY[i][1])\n }\n return displayedCategoryNames\n\n}", "title": "" }, { "docid": "2845b1f0d8f16f10181379f3a20e476e", "score": "0.49175787", "text": "function getAllCategories(req, res) {\n let page = (req.query.p) ? req.query.p : 1;\n let skip = (page-1) * listPaging;\n let data = {max_page: 1, payload: []}\n\n // OLD\n // var query1=`\n // SELECT DISTINCT category.category_id AS id, category.name AS name, FORMAT(COUNT(DISTINCT BC.book_id),0) AS bookNum\n // FROM book_in_category BC JOIN category ON BC.category_id = category.category_id\n // GROUP BY category.category_id\n // LIMIT ?, ?;\n // `;\n\n var query1=`\n SELECT c.category_id AS id, c.name AS name, bookNum\n FROM (SELECT bic.category_id, FORMAT(COUNT(DISTINCT bic.book_id),0) AS bookNum\n FROM book_in_category bic\n GROUP BY bic.category_id) BC\n JOIN category c ON BC.category_id = c.category_id\n ORDER BY c.category_id\n LIMIT ?, ?;\n `;\n var query2=`SELECT count(*) AS max_items FROM category`;\n\n Promise.all([\n NQuery(query1, [skip, listPaging]),\n NQuery(query2, [])\n ]).then((result) => {\n data.payload = result[0];\n data.max_page = (result[1].length===0 || result[1][0].max_items===0) ? 1 : Math.ceil(result[1][0].max_items / listPaging);\n res.json(data);\n }).catch(err => {\n console.log(err);\n return res.status(400).json({err: 1});\n })\n\n // connection.query(query1, [skip, listPaging], (err, results) => {\n // if (err) console.log(err);\n // else {\n // data.payload = results;\n // connection.query(query2, (err, result) => {\n // if (err) console.log(err);\n // else {\n // data.max_page = (result.length===0) ? 1 :Math.ceil(result[0].max_items / listPaging);\n // res.json(data);\n // }\n // })\n // }\n // });\n}", "title": "" }, { "docid": "42682cc6358c2d0852603ae1eb69516e", "score": "0.49165738", "text": "async get(category) {\n return fetch(`${this.endPoint}/${category}.json/print=pretty`);\n }", "title": "" }, { "docid": "5c148e38b1bb60d92639183645ce5084", "score": "0.49140963", "text": "getCategories() {\n const responseLoader = Q.defer();\n\n try {\n const categories = JSON.parse(requireRaw(kCategoriesJsonFile));\n\n responseLoader.resolve(categories);\n } catch(err) {\n const errDesc = ExceptionsFactory.buildErrorDescriptor(ExceptionsFactory.CATEGORIES_ERR_DESC_NOTFOUND,\n err.toString());\n responseLoader.reject(errDesc);\n }\n\n return responseLoader.promise;\n }", "title": "" }, { "docid": "9cc6f4d9f6c54ab52f2876d72f03cf87", "score": "0.49119145", "text": "function getAllCategories() {\n $.get('/category/all/' + localStorage.getItem('token'), (allCategories) => {\n displayAllCategories(allCategories);\n });\n}", "title": "" }, { "docid": "19a3079cb0184da7827bb8e64b8b5f52", "score": "0.49081323", "text": "getByCategory(t){\n var o = [];\n try{\n var db = this.getDbs();\n var dbA = Object.values(db);\n dbA.map(function(_db){\n var dbfields = [];\n var empresas = _db.empresas;\n empresas = Object.values(empresas);\n if(empresas){\n empresas.map(function(empresa){\n var fields = empresa.fields;\n fields = Object.values(fields);\n var withType = fields.filter(f => f.category == t);\n withType.map(function(d){\n o.push(d);\n })\n })\n }\n })\n }catch{\n\n }\n\n return o;\n }", "title": "" }, { "docid": "ae543dea4fc98ca0b09c38c326c43865", "score": "0.49068063", "text": "function getData(category) {\n var categoryString = category || \"\";\n if (categoryString) {\n categoryString = \"/category/\" + categoryString;\n }\n $.get(\"/api/posts\" + categoryString, function(data) {\n console.log(\"Posts\", data);\n posts = data;\n if (!posts || !posts.length) {\n displayEmpty();\n }\n else {\n initializeRows();\n }\n });\n }", "title": "" }, { "docid": "917aedd1c0f47aa22805077d78bce904", "score": "0.490052", "text": "categoryQuery(params, projectName) { // query [use]\n return Api.get({\n path: \"/tag/query\",\n projectName,\n absolutePath: dev && (editorUrl + \"/group/getChildCategory?parentId=\" + params.parentId),\n body: params,\n ignoreAuthFailure: true,\n cancelPendingRequests: true,\n apiCallName: 'categoryQuery',\n parse: function(res) {\n if (res.body.code == 200) {\n this.done(res.body.data ? res.body.data : []);\n } else {\n this.fail({\n errorMessage: res.body.msg\n });\n }\n }\n })\n }", "title": "" }, { "docid": "dc8fbd2753030987dd50c2e942fba5d7", "score": "0.4887758", "text": "function glomeGetCategories()\n{\n log.debug('glomeGetCategories called');\n\n let q = 'SELECT * FROM categories WHERE subscribed = :subscribed';\n //log.debug(q);\n\n var statement = db.createStatement(q);\n statement.params.subscribed = 1;\n\n // Reset category data\n glome_ad_categories = {}\n\n statement.executeAsync\n (\n {\n handleResult: function(results)\n {\n var cat = glomeGetTable('categories');\n\n // Old stack\n var stack = {}\n for (k in glome_ad_categories)\n {\n stack[k] = false;\n }\n\n for (let row = results.getNextRow(); row; row = results.getNextRow())\n {\n var id = row.getResultByName('id');\n stack[id] = true;\n\n glome_ad_categories[id] = {};\n\n for (i in cat)\n {\n glome_ad_categories[id][i] = row.getResultByName(i);\n }\n }\n },\n handleCompletion: function(reason)\n {\n //log.debug('all categories processed; call updateticker');\n window.jQuery(document).trigger('updateticker');\n }\n }\n );\n}", "title": "" }, { "docid": "bad0f09c99ba2cfb188f58af4d78a862", "score": "0.48742577", "text": "function getCategory(c){ //*D4EL\n debugger;\n\treturn getCategoryObject(categorizeArticle(printArticle(c.term)));\n}", "title": "" }, { "docid": "98e882b7236c390f5a25fd0c96a9e688", "score": "0.48709175", "text": "async getDrinksByAlcohol(term){\r\n //search by category\r\n const apiResponce = await fetch(\r\n `http://www.thecocktaildb.com/api/json/v1/1/filter.php?a=${term}`\r\n );\r\n\r\n //wait for responce and return json\r\n const coctails = await apiResponce.json();\r\n\r\n return {\r\n coctails,\r\n };\r\n }", "title": "" }, { "docid": "39ea6bd1cc9dc247ea0364927979cc16", "score": "0.48536754", "text": "function getCategories() {\n var api = 'http://www.bestbuy.ca/api/v2/json/category/Departments';\n return $http({\n method:'GET',\n url: api\n })\n\n }", "title": "" }, { "docid": "9818cea16503bea6030726ae636f6d20", "score": "0.48464113", "text": "async function getCategory(catId) {\n\tconst response = await axios.get(`https://jservice.io/api/category?id=${catId}`);\n\tlet cat = response.data;\n\tlet allClues = cat.clues;\n\tlet randomClues = _.sampleSize(allClues, numCluesPerCat);\n\tlet clues = randomClues.map(c => ({\n\t\tquestion: c.question,\n\t\tanswer: c.answer,\n\t\tshowing: null\n\t}));\n\n\treturn { title: cat.title, clues };\n}", "title": "" }, { "docid": "7426174ed50d595c0344570501c48fe2", "score": "0.48442405", "text": "async getInquiryCategoriesByName(name) {\n const request = await axios.post('api/inquiry/get', null, { params: { name } });\n\n const initialCategory = [ { value: null, text: 'Choose a category' } ]\n\n const mainCategory = request.data.categories.map(e => {\n return { value: e.name, text: e.name }\n })\n\n return initialCategory.concat(mainCategory);\n }", "title": "" }, { "docid": "e99164c35011a5b8bd9076a0111727af", "score": "0.48432812", "text": "function glomeGetAdsForCategory(id)\n{\n // Get items for a category\n var id = Number(id);\n\n var q = \"SELECT * FROM ads WHERE adcategories LIKE '%\" + id + \"%' AND expires >= :datetime AND expired = 0\";\n //log.debug(q);\n var statement = db.createStatement(q);\n statement.params.datetime = glome.ISODateString();\n\n var ads = new Array();\n while (statement.executeStep())\n {\n var ad = {};\n var found = false;\n\n for (i in glomeGetTable('ads'))\n {\n if (typeof statement.row[i] == 'undefined')\n {\n ad[i] = null;\n continue;\n }\n\n var value = null;\n\n switch (i)\n {\n case 'adcategories':\n var value = JSON.parse(statement.row[i]);\n\n for (k = 0; k < value.length; k++)\n {\n if (value[k] == id)\n {\n found = true;\n break;\n }\n }\n\n var value = statement.row[i];\n break;\n\n default:\n var value = statement.row[i];\n }\n\n ad[i] = value;\n }\n\n //found = true;\n if (found)\n {\n ads.push(ad);\n }\n }\n\n return ads;\n}", "title": "" }, { "docid": "df64bcf151fa43261911107c89d6e34d", "score": "0.48422536", "text": "function getCategories(selectedCatID) {\n //var selectedCatID = \"cat00000\";\n kony.print(\"########## Selected Key:\" + selectedCatID);\n // Let's first check that the user picked a valid value\n if (!kony.string.equalsIgnoreCase(selectedCatID, \"none\")) {\n // Populating the input params for the service call and invoking the service\n var operationName = mobileFabricConfiguration.integrationServices[0].operations[0];\n var inputParams = {\n \"key\": mobileFabricConfiguration.bestByAPIKey,\n \"categoryID\": selectedCatID\n };\n //if (!kony.string.equalsIgnoreCase(selectedKey, \"none\")){\n //\tinputParams= {\"newsType\": selectedKey};\n // }else{\n //\t// The user didn't pick a value so we'll show the alert\n // kony.ui.Alert({ message: \"Please select a valid news type\",alertType:constants. ALERT_TYPE_INFO, alertTitle:\"Categories\",yesLabel:\"OK\"}, {});\n // }\n if (!mobileFabricConfiguration.isKonySDKObjectInitialized) {\n initializeMobileFabric(getCategories, selectedCatID);\n } else if (mobileFabricConfiguration.isKonySDKObjectInitialized) {\n getServiceResponse(operationName, inputParams, \"getting Best By Categories\", getCategoriesSuccessCallback);\n }\n } else {\n // The user didn't pick a value so we'll show the alert\n kony.ui.Alert({\n message: \"Please select a valid cat type\",\n alertType: constants.ALERT_TYPE_INFO,\n alertTitle: \"Categories\",\n yesLabel: \"OK\"\n }, {});\n }\n}", "title": "" }, { "docid": "8d0994d77ecea44bd50d31e664a21ebf", "score": "0.48327222", "text": "function getCategories() {\n Office.context.mailbox.masterCategories.getAsync((asyncResult) => {\n if (asyncResult.status === Office.AsyncResultStatus.Failed) {\n console.log(asyncResult.error.message);\n return;\n }\n\n let selection = document.createElement(\"select\");\n selection.name = \"applicable-categories\";\n selection.id = \"applicable-categories\";\n selection.multiple = true;\n let label = document.createElement(\"label\");\n label.innerHTML =\n \"<br/>Select the applicable categories.<br/><br/>Select and hold <b>Ctrl</b> to choose multiple categories.<br/>\";\n label.htmlFor = \"applicable-categories\";\n\n asyncResult.value.forEach((category, index) => {\n let displayName = category.displayName;\n if (displayName.includes(\"Office Add-ins Sample: \")) {\n let option = document.createElement(\"option\");\n option.value = index;\n option.text = category.displayName;\n selection.appendChild(option);\n selection.size++;\n }\n });\n\n document\n .getElementById(\"categories-container\")\n .appendChild(label)\n .appendChild(selection);\n });\n}", "title": "" }, { "docid": "f7f545ff413de6f67118c04fbc71adff", "score": "0.4832088", "text": "function GetCategories(){ \n \n var query = \"SELECT id, name, image FROM Category order by id\";\n \n BIDTSSdb.transaction(function(tx){\n tx.executeSql(query, null, \n function(tx, result){\n onGetCategoriesSuccess(result);\n }, errorHandler);\n });\n}", "title": "" }, { "docid": "07476aa1e40d683a8e8ca798b3ed2d62", "score": "0.48228997", "text": "function get_categories() {\n return $http.get('/api/books/categories/').then(function(response){\n angular.forEach(response.data, function(category){\n s.categories[category.id] = category;\n });\n });\n }", "title": "" }, { "docid": "3c66de75d861b94155fc4f3354f050b2", "score": "0.48149678", "text": "function getCatProducts(category) {\n kony.print(\"########## Selected category:\" + JSON.stringify(category));\n // Let's first check that the user picked a valid value\n if (!kony.string.equalsIgnoreCase(category.categoryID, \"none\")) {\n // Populating the input params for the service call and invoking the service\n var operationName = mobileFabricConfiguration.integrationServices[0].operations[1];\n var inputParams = {\n \"key\": mobileFabricConfiguration.bestByAPIKey,\n \"categoryID\": category.categoryID,\n \"pageNo\": category.pageNo\n };\n if (!mobileFabricConfiguration.isKonySDKObjectInitialized) {\n initializeMobileFabric(getCatProducts, category);\n } else if (mobileFabricConfiguration.isKonySDKObjectInitialized) {\n getServiceResponse(operationName, inputParams, \"getting Category Products\", getCatProductsSuccessCallback);\n }\n } else {\n // The user didn't pick a value so we'll show the alert\n kony.ui.Alert({\n message: \"Please select a valid cat \",\n alertType: constants.ALERT_TYPE_INFO,\n alertTitle: \"Categories\",\n yesLabel: \"OK\"\n }, {});\n }\n}", "title": "" }, { "docid": "3a856260b6d3e40e2599d7854fe441bf", "score": "0.48136374", "text": "async getCategories(){\r\n const apiResponce = await fetch('https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list');\r\n\r\n const categories = await apiResponce.json();\r\n\r\n return{\r\n categories\r\n }\r\n }", "title": "" }, { "docid": "dd1612db23695f8cb6268a6b03fb10a5", "score": "0.48129734", "text": "function retrieveCategories(dictUrl){\n var ss = SpreadsheetApp.openByUrl(dictUrl)\n var sheet = ss.getSheets()[0];\n var values = sheet.getSheetValues(1, 1, -1, -1);\n var categories = [];\n for each(var value in values){\n cat = new Category(value[0], value[1], value[2]);\n categories.push(cat);\n }\n return categories;\n}", "title": "" }, { "docid": "b916919b0d7c89873fd203da66072f50", "score": "0.48110238", "text": "function GetCategories2() {\r\n var accountNumber = \"\";\r\n services.getService(apiUrl.category.Get(accountNumber)).then(function (response) {\r\n });\r\n}", "title": "" }, { "docid": "bd17470a0b912fd5d78d178a1f2d155a", "score": "0.4806934", "text": "getAllBlogCategories() {\n return this.dbClient\n .then(db => db\n .collection(this.collection)\n .aggregate([\n { $sort: { created_timestamp: -1 } }\n ])\n .toArray()\n )\n .then(result => {\n return result;\n });\n }", "title": "" }, { "docid": "740b4f2c3aac3f5ea37e5b68dc5423fb", "score": "0.4803149", "text": "async function getCategoryIds() {\n\tlet response = await axios.get('https://jservice.io/api/categories/?count=60');\n\tlet catIds = response.data.map(c => c.id);\n\treturn _.sampleSize(catIds, numOfCategories);\n}", "title": "" }, { "docid": "c80763412644ce3fd5005d53cf89f7d7", "score": "0.4797775", "text": "async getCategories() {\n\n try {\n let url = `https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list`;\n\n const apiResponse = await fetch(url);\n const categories = await apiResponse.json();\n // return console.log(recipeInfo) \n return {\n categories\n }\n } catch (error) {\n ui.printMessage(error.message, 'alert-danger')\n }\n }", "title": "" }, { "docid": "932b71dd2bcd241f7cf36eb14234bdfb", "score": "0.47921294", "text": "async function getCategories () {\n const options = {\n method: 'GET',\n url: 'http://localhost:3001/categories',\n headers: { 'Authorization': '123456' },\n }\n\n const response = await axios(options)\n\n return response.data\n}", "title": "" }, { "docid": "b7e207e9cbecfaac4251b6e7d701fdf0", "score": "0.47871485", "text": "async function getCategoryIds() {\n let response = await axios.get(`${BASE_API_URL}`);\n //here is where we requet the categories\n let catIds =response.data.map(c => c.id);\n return _.sampleSize(catIds, NUM_CATEGORIES);\n}", "title": "" }, { "docid": "144eb23677a6d2dd18533078c16f5027", "score": "0.47859037", "text": "getCategories () {\n var categories = []\n categories.push(\n <ListGroupItem key='/'>\n <Link to='/'>\n All Posts\n </Link>\n </ListGroupItem>\n )\n for(let category in this.props.categories){\n let url = `/${category}`\n categories.push(\n <ListGroupItem key={category}>\n <Link to={url}>\n {category}\n </Link>\n </ListGroupItem>\n )\n }\n return categories\n }", "title": "" }, { "docid": "a74856c60e619aa6b1640f8a7b348e2d", "score": "0.47840595", "text": "function getCategory(req, res){\n let categoryName = req.body.category;\n categoryStorage.push(categoryName);\n\n const _getSubCatItems = `\n SELECT * FROM recyclables\n WHERE category = '${categoryName}'`;\n\n client.query(_getSubCatItems)\n .then(items => {\n console.log('getCategory client returns: ', items.rows[0].subcategory);\n if(items.rows[0].subcategory){\n let subCategoryArr = [];\n items.rows.forEach((item)=>{\n if(!subCategoryArr.includes(item.subcategory) && item.subcategory !== null){\n subCategoryArr.push(item.subcategory);\n }\n });\n console.log('the array of subcategories', subCategoryArr);\n res.render('./pages/material-subcat.ejs', {subCatArr: subCategoryArr, matSubCat: items.rows})\n }\n else{\n const specificItems = items.rows;\n res.render('./pages/item-list.ejs', {items:specificItems});\n }\n\n }).catch(console.error('error'))\n}", "title": "" }, { "docid": "27fc953c5c89d5edea99d798160cb5d1", "score": "0.4782966", "text": "function getDataTypesCatName(catNom, critNom) {\n var res = null;\n categories.forEach(cat => {\n if(cat.name == catNom) {\n cat.dataTypes.forEach(crit => {\n if(crit.name == critNom) {\n res = crit;\n }\n });\n }\n });\n return res;\n}", "title": "" }, { "docid": "bc16294d3742f26aadcc92ba85426a60", "score": "0.47822365", "text": "function filterKeywords(feedconfig) {\n\n\n // Feedconfig\n if(!(feedconfig instanceof FeedConfig.FeedConfig))\n throw new Error('not a feedconfig');\n\n // console.log(feedconfig)\n\n var _gender = feedconfig.gender;\n var _age = feedconfig.age;\n var _tier = feedconfig.tier;\n\n\n // Build request\n var genderFilter;\n\n if(_gender == \"Men\") genderFilter = function(p) { return p.gender == 'M' }\n else if (_gender == \"Women\") genderFilter = function(p) { return p.gender == 'F' }\n else genderFilter = function(p) { return p.gender == 'F' || p.gender == 'M' }\n\n var ageFilter;\n\n if( _age =='18-' ) ageFilter = function(p) {return p.age <= 18}\n else if( _age == '24-') ageFilter = function(p) {return p.age >= 18 && p.age <= 24}\n else if( _age == '35-') ageFilter = function(p) {return p.age >= 25 && p.age <= 35}\n else if( _age == '40+') ageFilter = function(p) {return p.age >= 36}\n else ageFilter = function(p) { return p.age }\n\n var tierFilter;\n if(_tier == '1') tierFilter = function(p) {return p.tier == \"T1\"}\n else if(_tier == '2') tierFilter = function(p) {return p.tier == \"T2\"}\n else if(_tier == '3') tierFilter = function(p) {return p.tier == \"T3\"}\n else tierFilter = function(p) {return p.tier }\n\n\n // Filter words\n var results = words\n .filter( genderFilter)\n .filter( ageFilter )\n .filter( tierFilter );\n \n // console.log(results)\n return results\n\n}", "title": "" }, { "docid": "29612ddc0723a0fe8502eb363b233e65", "score": "0.47804785", "text": "function getAllCategories(inputData) {\n var allCategories = [];\n for (var i = 0; i < inputData.length; i++) {\n allCategories[i] = inputData[i].description;\n }\n allCategories = reduceMultipleNames(allCategories);\n allCategories = allCategories.map(category => {\n return {\n label: category,\n id: category\n }\n })\n\n return allCategories;\n}", "title": "" }, { "docid": "ec9208d1d6aabc2785c448c72809adce", "score": "0.4776752", "text": "function getCategories() {\n\tvar rows = \"\";\n\n\tfor (var i in categories) {\n\t\tvar category = JSON.parse(categories[i]);\n\t\trows += \"<tr>\";\n\t\trows += \"<td><i class=\\\"fa fa-pencil-square-o category-edit\\\" data-id=\\\"\" + i + \"\\\"></i><i class=\\\"fa fa-trash-o category-delete\\\" data-id=\\\"\" + i + \"\\\"></i></td>\";\n rows += \"<td class=\\\"right\\\">\" + category.code + \"</td>\";\n\t\trows += \"<td>\" + category.name + \"</td>\";\n\t\trows += \"</tr>\";\n\t}\n\n\t$(\"#category-table\").append(rows);\n}", "title": "" }, { "docid": "9cb1b7552341606f8ea91170c6ddd680", "score": "0.47690734", "text": "function fetchCategories() {\n url = WAP_KASKUS_URL + \"/misc/get_categories/\" + catVersion + \"/\" + theme;\n $.retrieveJSON(url, {\n usergroupid: userGroupIdJSON,\n theme: theme\n }, function(categories) {\n if (retryFetch && categories.version != catVersion) {\n $.clearJSON(url, {\n usergroupid: userGroupIdJSON\n });\n retryFetch = 0;\n fetchCategories();\n } else {\n catLoad = true;\n $(\"#forum-categories\").append(categories.forum);\n $(\"#fjb-categories\").append(categories.jb);\n $(\"#filter-cat-fjb\").on(\"keyup\", function(a) {\n searchCategory(\"fjb\");\n });\n $(\"#filter-cat-forum\").on(\"keyup\", function(a) {\n searchCategory(\"forum\");\n });\n }\n }, 864e5);\n}", "title": "" }, { "docid": "e9a6917177c00132c95f732c8a27126a", "score": "0.476797", "text": "function getCategory(req, res){\n // using req.body, load object into res.render\n let categoryName = req.body.category;\n categoryStorage.push(categoryName);\n const _getSubCatItems = `\n SELECT * FROM recyclables\n WHERE category = '${categoryName}'`;\n\n client.query(_getSubCatItems)\n .then(subCatItems => {\n console.log('getCategory client returns: ', subCatItems.rows[0].subcategory);\n if(subCatItems.rows[0].subcategory){\n let subCategoryArr = [];\n subCatItems.rows.forEach((item)=>{\n if(!subCategoryArr.includes(item.subcategory) && item.subcategory !== null){\n subCategoryArr.push(item.subcategory);\n }\n });\n console.log('the array of subcategories', subCategoryArr);\n res.render('./pages/material-subcat.ejs', {subCatArr: subCategoryArr, matSubCat: subCatItems.rows})\n }\n else{\n const specificItems = subCatItems.rows;\n // console.log('trying to get the item name: ', subCatItems.rows)\n res.render('./pages/subcat.ejs', {items:specificItems});\n }\n\n }).catch(console.error('error'))\n}", "title": "" }, { "docid": "f69b8ef9a40eadedc11bc590c8aa28d6", "score": "0.47664467", "text": "async function getCategories() {\n try {\n const response = await fetch('/categories');\n return response.json();\n } catch (err) {\n console.log(err);\n }\n}", "title": "" }, { "docid": "a3051290dda0f597d617a1d374e7937b", "score": "0.47567916", "text": "function getCategories() {\n return new Promise(function (resolve, reject) {\n request.get(url)\n .end(function (res) {\n if (!res.ok) return reject(res.error);\n\n var $ = cheerio.load(res.text);\n var links = $('a.info-link');\n\n var categories = _.map(links, function (link, i) {\n $link = $(link);\n var href = urlResolve(url, $link.attr('href'));\n var title = $('h2', $link).html();\n title = title.replace(/(emoticons|emojis)/ig, '').trim().toLowerCase();\n return { title: title, href: href };\n });\n\n resolve(categories);\n });\n });\n}", "title": "" }, { "docid": "0029db993b800be958bc41f8f7c320a6", "score": "0.47465536", "text": "async function getAllCategories() {\n const selectAllQuery = `SELECT * FROM categorias;`\n const result = await knex.raw(selectAllQuery)\n\n return result\n}", "title": "" }, { "docid": "10d4679e0a9465228e9778f6d212d8e1", "score": "0.47425565", "text": "function getCategorys(){\n\t\n\t//Remove any existing data\n\t$('table').empty();\n\t\n\t$.get(\"https://u0018370.scm.tees.ac.uk/RIA_3/models/model.class.getMyCars.php?action=getCategorys\",\n\n\tfunction(data) {\n\t\n\t\t//table row\n\t\tvar tr;\n\t\t\n for (var i = 0; i < data.carData.length; i++) {\n tr = $('<tr/>');\n tr.append(\"<td>\" + data.carData[i] + \"</td>\");\n $('table').append(tr);\n }\n\n\t//Refresh JQM\n$( \"div#car-page[data-role=page]\" ).trigger(\"create\");\n\n\t\t}, \"json\");\n\t\n\n\treturn false;\n}", "title": "" }, { "docid": "16e1dfa7d06913dc36aac9f776fece87", "score": "0.47417206", "text": "function showDrinksByCatList(c) {\n PAGING_COUNT = 0; //first time called\n PAGING_TYPE = PAGING_TYPE_CATEGORY;\n CAT_TYPE_ID = c;\n\t\n $(\"repparw_tsil#\".z()).empty();\n var requestUrl = ROOT_URL + \"drinks/cats\" + CAT_TYPE_ID + \"0=xednItrats?\".z();\n\t\n processDrinks(requestUrl, true);\n}", "title": "" }, { "docid": "3aa98f4c1879816e08f8a65f33021cfa", "score": "0.4725328", "text": "function getCategory() {\n $.get(\"/api/category\", renderCategoryList);\n }", "title": "" }, { "docid": "e1aa043c625a0de41146b8fd5703a84b", "score": "0.47232825", "text": "async function categories(){\n const response = await fetch(\"https://cccpharma-api-jjlm.herokuapp.com/categories\");\n try{\n const json = await response.json();\n return json;\n\n }catch(e){\n return \"Não foram encontradas categorias\";\n }\n}", "title": "" }, { "docid": "071d38b3de6e8b13debc879650dfecb1", "score": "0.4720371", "text": "function getCategoryByVid(vid){\n return $q.when(db.allDocs({include_docs:true, startkey: 'category-', endkey: 'category-\\uffff'}))\n .then(function(docs){\n // console.log('%%% get category by vid', vid, docs.rows)\n var allCats = docs.rows\n var catList = []\n _.forEach(allCats, function(c){\n _.forEach(c.doc.vidList, function(v){\n if(v === vid){\n catList.push(c.doc.catName);\n }\n })\n })\n // console.log('%%% category list of ',vid, catList)\n return catList\n })\n }", "title": "" }, { "docid": "59ef9375769a2ff65059d98a4bc2a2d9", "score": "0.47194773", "text": "function getCategories(callback) {\n mongo.connect();\n var categories = [];\n models.CategoryModel.find(function (err, data) {\n if (err) {\n callback(err);\n console.log(err);\n } else {\n categories = data;\n }\n mongo.close();\n callback(null, categories);\n });\n}", "title": "" } ]
06a0e68db8c1fb4be4e0e615a3335cf4
calls the update method
[ { "docid": "2775b0e6ae542f9b03c8319646bf471e", "score": "0.0", "text": "function doUpd(cb){\n\t\t\t\tclearTimeout(mCSB_container[0].autoUpdate); \n\t\t\t\tmethods.update.call(null,$this[0],cb);\n\t\t\t}", "title": "" } ]
[ { "docid": "3f0a049417e347b74a90c0adadd6ceed", "score": "0.83781606", "text": "update() {\n\t\tsuper.update(); // this runs the update() method in the parent class as it is\n\t\t// here we can perform some other function operation\n\t}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "7d2da88beefe791ac8ddc4fd49eb3f38", "score": "0.83013743", "text": "function update() {}", "title": "" }, { "docid": "a89fbadfa228c6a5d0db308116ea96c3", "score": "0.8277009", "text": "update(){}", "title": "" }, { "docid": "a89fbadfa228c6a5d0db308116ea96c3", "score": "0.8277009", "text": "update(){}", "title": "" }, { "docid": "a89fbadfa228c6a5d0db308116ea96c3", "score": "0.8277009", "text": "update(){}", "title": "" }, { "docid": "4e0d2c18f2072e695b33842838ca5d60", "score": "0.8159311", "text": "Update() {}", "title": "" }, { "docid": "60a99aafc56ca360e500be51dd0c5ca2", "score": "0.8087448", "text": "update(){\n\t\t\n\t}", "title": "" }, { "docid": "602d5aa4c23c879fbd7489ed86142fda", "score": "0.8078554", "text": "update()\n\t{\n\t\t\n\t}", "title": "" }, { "docid": "33d84f91ea771d5f0c17b41ba0332ab1", "score": "0.7987013", "text": "update()\n\t{ }", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "68fe5354a9e700454f645d1bc3611a47", "score": "0.7927474", "text": "update() {}", "title": "" }, { "docid": "1040529cb7a597271fba2803a06ce880", "score": "0.79199725", "text": "function update() {\n\t\t\n\t}", "title": "" }, { "docid": "933330be96cc24bcfd68faf61c34dbad", "score": "0.78951436", "text": "function update() {\n }", "title": "" }, { "docid": "933330be96cc24bcfd68faf61c34dbad", "score": "0.78951436", "text": "function update() {\n }", "title": "" }, { "docid": "855a85b5f26b493702b9278efb119037", "score": "0.789327", "text": "update () {}", "title": "" }, { "docid": "855a85b5f26b493702b9278efb119037", "score": "0.789327", "text": "update () {}", "title": "" }, { "docid": "42a9d1c4d5fc4a55090c639ffdd9c90d", "score": "0.7852411", "text": "Update() {\n\n\t}", "title": "" }, { "docid": "18f368ac45196b3239839efd15106066", "score": "0.78331554", "text": "update() {\n //\n }", "title": "" }, { "docid": "99d03e96344cffed47d59f45fd6119ce", "score": "0.78151107", "text": "update() { }", "title": "" }, { "docid": "3cdd336cc96209de95176a3414613856", "score": "0.779169", "text": "_update() {\n }", "title": "" }, { "docid": "0c9af89977909f1e920a53a25f63661f", "score": "0.77025384", "text": "update () {\n \n }", "title": "" }, { "docid": "4ca3598f9fced2fca4e8bc4810e64956", "score": "0.7701926", "text": "Update() { }", "title": "" }, { "docid": "ee6a933258e3d0687f026bfc39189379", "score": "0.7680641", "text": "function update() {\n\n\n }", "title": "" }, { "docid": "aee6f05097e971a61eca0759634385a7", "score": "0.761657", "text": "update() {\n }", "title": "" }, { "docid": "aee6f05097e971a61eca0759634385a7", "score": "0.761657", "text": "update() {\n }", "title": "" }, { "docid": "91b9968245af33254ce3b4aa0a013509", "score": "0.7615238", "text": "update() {\n this.processAll();\n this.updateEvents();\n }", "title": "" }, { "docid": "d17931eb8cfce0e949230cbc57329c84", "score": "0.75923747", "text": "update() {\n this.forceUpdate(); // Refresh display\n this.updateDB(); // Update the database\n }", "title": "" }, { "docid": "8546fe6eeea3f117ced9ee1cc21ed557", "score": "0.75819916", "text": "update() {\n\n }", "title": "" }, { "docid": "8546fe6eeea3f117ced9ee1cc21ed557", "score": "0.75819916", "text": "update() {\n\n }", "title": "" }, { "docid": "8546fe6eeea3f117ced9ee1cc21ed557", "score": "0.75819916", "text": "update() {\n\n }", "title": "" }, { "docid": "2f4bb676b474d0b679ee331995b2a21a", "score": "0.74970096", "text": "onUpdate() {\n\t\tconsole.warn('updating');\n\t\tthis.forceUpdate();\n\t}", "title": "" }, { "docid": "962577faa4215bfb44bc1f4a782eebf0", "score": "0.74892443", "text": "update():void {}", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "a36939ca0b7882e26c1c711a2bb4a353", "score": "0.74794716", "text": "update() {\n\n }", "title": "" }, { "docid": "760a016e2c542a7b273b7f4404a3661d", "score": "0.7459267", "text": "update(){\n\n }", "title": "" }, { "docid": "2c2572da501a65c296882301cd2965a0", "score": "0.74517965", "text": "function update() {\n \n}", "title": "" }, { "docid": "b02b2172ca2042178e0c77c33a4afb44", "score": "0.7448885", "text": "function update() {\n\n}", "title": "" }, { "docid": "b02b2172ca2042178e0c77c33a4afb44", "score": "0.7448885", "text": "function update() {\n\n}", "title": "" }, { "docid": "a8844d41e5189c0a72431cbc9e63befb", "score": "0.7442393", "text": "update() {\n return update.call(this);\n }", "title": "" }, { "docid": "566b190090237581d147773ed4a17d8e", "score": "0.7422138", "text": "_update() {\n this._starfield.update(this.delta);\n this._quiz.update(this.delta);\n this._player.update(this.delta);\n\n }", "title": "" }, { "docid": "2c9cca4075c3a530f228662a4833ba64", "score": "0.7402786", "text": "update() {\n\n\t\tthis.events.publish('update', this.id);\n\t\n\t}", "title": "" }, { "docid": "3740409369adcd2117041a8489cbcafa", "score": "0.7389263", "text": "update () {\n super.update();\n }", "title": "" }, { "docid": "f929366a426cc78da6f205e282d3cd3c", "score": "0.73857814", "text": "static update() {}", "title": "" }, { "docid": "7d706da556688f2b8e598249e2e28a39", "score": "0.7346039", "text": "update() {\n }", "title": "" }, { "docid": "a7bd5d6e6d54e4b39ed7e234b399c872", "score": "0.7334833", "text": "updateAll() {\n this.updateData();\n this.updatePosition();\n this.updateSize();\n }", "title": "" }, { "docid": "30336ef7c943ee2487776bf64cae1e6a", "score": "0.7278542", "text": "function update()\n{\n \n}", "title": "" }, { "docid": "d873218bb0dd7152fae289c3927470bb", "score": "0.7217626", "text": "function update() {\n //\n}", "title": "" }, { "docid": "2be72da8594a775a8cd8e6a19d06b6d7", "score": "0.71614283", "text": "function update() { /* Don't delete this function! */ }", "title": "" }, { "docid": "2359707df20346b94ddd3a50c3bf1f39", "score": "0.7145001", "text": "update() {\n\n this.end();\n this.begin();\n\n }", "title": "" }, { "docid": "59d02cad1894da80c85bddbdaa65c190", "score": "0.71416414", "text": "function update(){\n}", "title": "" }, { "docid": "4d11b9f8285fbc6a3222bdeda017e9ef", "score": "0.71329284", "text": "update() {\n this.forceUpdate();\n }", "title": "" }, { "docid": "85e92e1b4530364f22336b9b9a9a0e35", "score": "0.712866", "text": "function update(){\n\n}", "title": "" }, { "docid": "cfddeda55fff566bb6b90227fea826c7", "score": "0.7127014", "text": "update() {\n \n }", "title": "" }, { "docid": "0c72035bc1c4aaf1d29fe38ba219bd85", "score": "0.71269965", "text": "update() {\n \n \n }", "title": "" }, { "docid": "ab554e3cc4d933fdecb04861df226171", "score": "0.7118665", "text": "update() {\n this._checkEvents();\n }", "title": "" }, { "docid": "1e7e6315e241662264855c23e93460b6", "score": "0.7100815", "text": "postUpdate() {}", "title": "" }, { "docid": "dc96bf1f5a322574fa7e26768959e37e", "score": "0.7069883", "text": "function runUpdate(){\n\t\tpeople.forEach(function(element){\n\t\t\telement.update();\n\t\t});\n\t}", "title": "" }, { "docid": "bb5ed5fa6ac780eabdc44dc2af924ba4", "score": "0.7065227", "text": "update (context, params) {\n this.update_func(context, params);\n }", "title": "" }, { "docid": "39badfab107eb08ec62472d5f93356d7", "score": "0.70541763", "text": "Update(Variant, Variant) {\n\n }", "title": "" }, { "docid": "b6adebbd01fffcb970264ee8b3692b4f", "score": "0.70403343", "text": "willUpdate() {}", "title": "" }, { "docid": "b6adebbd01fffcb970264ee8b3692b4f", "score": "0.70403343", "text": "willUpdate() {}", "title": "" }, { "docid": "b6adebbd01fffcb970264ee8b3692b4f", "score": "0.70403343", "text": "willUpdate() {}", "title": "" }, { "docid": "49da650047bd34b0a5ffc4eaa5ab957e", "score": "0.703747", "text": "async update() {\n forceUpdate(this);\n }", "title": "" }, { "docid": "44ec6ff7ebde8675e556dec541d1528a", "score": "0.70204103", "text": "update() {\n throw new Error(\"Class must implement function 'update'\");\n }", "title": "" }, { "docid": "d310c1b31d7c7d7fba5d56fa8cc2b221", "score": "0.7007946", "text": "update()\n {\n if (!this.destroyed)\n {\n this.onUpdate.run();\n }\n }", "title": "" }, { "docid": "5f59fc5c4d4aa6087b96a8cc027beccf", "score": "0.7001279", "text": "update(delta) {}", "title": "" }, { "docid": "759f20427ba94f6c1fd4b7bb6c00fd5d", "score": "0.6996109", "text": "function update() {\n\n l.update();\n}", "title": "" }, { "docid": "e92d35220b070fbc5c79bf86d1889959", "score": "0.69563025", "text": "update(){\n super.update();\n }", "title": "" }, { "docid": "9fd62625d57c02ec5cc28b56463fbd11", "score": "0.6935525", "text": "function update()\n {\n updateLinks();\n updateNodes();\n\n }", "title": "" }, { "docid": "0c1e78bd6b127346eb46304012966431", "score": "0.69333845", "text": "requestUpdateIfNeeded() {\n this.update();\n }", "title": "" }, { "docid": "0c1e78bd6b127346eb46304012966431", "score": "0.69333845", "text": "requestUpdateIfNeeded() {\n this.update();\n }", "title": "" }, { "docid": "a6e5662724f6fe8042dec1e951a5c827", "score": "0.69208133", "text": "update() {\n for (const batch of this.batches) {\n batch.update();\n }\n }", "title": "" }, { "docid": "6471a11623c7bfd629947135ef084fd1", "score": "0.6918394", "text": "update () {\n if (this.lazy) {\n this.dirty = true;\n } else if (this.sync) {\n this.run();\n } else {\n queueWatcher(this);\n }\n }", "title": "" }, { "docid": "feb4d577887a4b5e313ac5b53dcea2e5", "score": "0.689837", "text": "update (oldData) {\n\t}", "title": "" }, { "docid": "6017d8fc04fed836f9c69d5cc383e67f", "score": "0.6894243", "text": "function runUpdates() {\r\n updateWeather();\r\n updateCPUTemp();\r\n}", "title": "" }, { "docid": "286d6eb47738e3c65ad1a15042ec9ff5", "score": "0.6888073", "text": "update(input) {\n }", "title": "" }, { "docid": "72ae8fa1e5b05c5cdce91a30a9eaf5cf", "score": "0.6881357", "text": "function update() {\n updateInputs(getInputParameters())\n updateOutputs(getInputParameters())\n}", "title": "" }, { "docid": "5dbe75024c06af476baca4b2e7fc57f8", "score": "0.687811", "text": "update() {\n if (this.disposed) {\n logger.warn(\"update(): MapView has been disposed of.\");\n return;\n }\n this.dispatchEvent(this.UPDATE_EVENT);\n // Skip if update is already in progress\n if (this.m_updatePending) {\n return;\n }\n // Set update flag\n this.m_updatePending = true;\n this.startRenderLoop();\n }", "title": "" } ]
9bce943fccc040d22a06eb443fb1248e
Creates a new VersionedTextDocumentIdentifier literal.
[ { "docid": "95a5a1fcc4e034c5b7f33818dd2fe782", "score": "0.0", "text": "function create(uri, version) {\r\n return { uri: uri, version: version };\r\n }", "title": "" } ]
[ { "docid": "f8d26c5fd9bacd7bcd71fe635bc08893", "score": "0.56319445", "text": "function create_text(document, data) {\n return TextImpl_1.TextImpl._create(document, data);\n}", "title": "" }, { "docid": "f8d26c5fd9bacd7bcd71fe635bc08893", "score": "0.56319445", "text": "function create_text(document, data) {\n return TextImpl_1.TextImpl._create(document, data);\n}", "title": "" }, { "docid": "d00d29daece9a23a0613651cbf15406c", "score": "0.55074704", "text": "function pid(name) {\n return new PrimitiveIdentifier(name);\n}", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "34f521354883d7e71f120b0f67188ebb", "score": "0.5419424", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "a2595bd31b3745a8e8b95a3339103899", "score": "0.5400297", "text": "function create(uri, languageId, version, text) {\r\n return { uri: uri, languageId: languageId, version: version, text: text };\r\n }", "title": "" }, { "docid": "a2595bd31b3745a8e8b95a3339103899", "score": "0.5400297", "text": "function create(uri, languageId, version, text) {\r\n return { uri: uri, languageId: languageId, version: version, text: text };\r\n }", "title": "" }, { "docid": "258594e41a464ebdaf0b2ada7625f34d", "score": "0.53901434", "text": "function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }", "title": "" }, { "docid": "91d912eb6f87f63bd118394759d34576", "score": "0.5329552", "text": "function createUniqueName(text){var name=createIdentifier(text);name.autoGenerateFlags=3/* Unique */;name.autoGenerateId=nextAutoGenerateId;nextAutoGenerateId++;return name;}", "title": "" }, { "docid": "e5c2733a9abd8cc7022979f2699d125a", "score": "0.53083605", "text": "function create(textDocument, edits) {\r\n return { textDocument: textDocument, edits: edits };\r\n }", "title": "" }, { "docid": "e5c2733a9abd8cc7022979f2699d125a", "score": "0.53083605", "text": "function create(textDocument, edits) {\r\n return { textDocument: textDocument, edits: edits };\r\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "724cd737f021ef3474aedfb2ba8e1159", "score": "0.52966434", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "62fac8ce5cf83b6b1e2eaff060584421", "score": "0.5261142", "text": "function id(namespace, name) {\n return new Identifier(namespace, name);\n}", "title": "" }, { "docid": "394c424092e0f9d2727c9692602193d1", "score": "0.52589834", "text": "function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }", "title": "" }, { "docid": "30c391e245b0a7691f2cbe4ca0d354ac", "score": "0.5250111", "text": "static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }", "title": "" }, { "docid": "b6dd920f8f47741e2cd4fc04b6aaf71b", "score": "0.52255595", "text": "constructor(identifier) {\n super();\n this.text = null;\n this.cross_ref = [];\n this.comment = null;\n }", "title": "" }, { "docid": "3b18265200f2de529976b32a329d91da", "score": "0.52156335", "text": "function createIdentifier(isIdentifier,diagnosticMessage,privateIdentifierDiagnosticMessage){identifierCount++;if(isIdentifier){var node=createNode(75/* Identifier */);// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker\nif(token()!==75/* Identifier */){node.originalKeywordKind=token();}node.escapedText=ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));nextTokenWithoutCheck();return finishNode(node);}if(token()===76/* PrivateIdentifier */){parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage||ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);return createIdentifier(/*isIdentifier*/true);}// Only for end of file because the error gets reported incorrectly on embedded script tags.\nvar reportAtCurrentPosition=token()===1/* EndOfFileToken */;var isReservedWord=scanner.isReservedWord();var msgArg=scanner.getTokenText();var defaultMessage=isReservedWord?ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here:ts.Diagnostics.Identifier_expected;return createMissingNode(75/* Identifier */,reportAtCurrentPosition,diagnosticMessage||defaultMessage,msgArg);}", "title": "" }, { "docid": "60f56a00cf68ed3c3ad3ffa8abaa412c", "score": "0.5168795", "text": "function idNode(t, name) {\n var n = new Node(t, IDENTIFIER);\n n.name = n.value = name;\n return n;\n}", "title": "" }, { "docid": "68ce3929634c14f5165778f7e5091cb3", "score": "0.51232105", "text": "allocateId() {\n return ts.createIdentifier(`_t${this.nextId++}`);\n }", "title": "" }, { "docid": "74be1161a6494266a031d21a1cc62342", "score": "0.5118259", "text": "static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }", "title": "" }, { "docid": "e1bd3499d6ef9f368b17c331063b671f", "score": "0.5091171", "text": "static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }", "title": "" }, { "docid": "dca89144ca2d3fd41309adcfafdeabd0", "score": "0.506675", "text": "Identifier() {\n const name = this._eat('IDENTIFIER').value;\n return {\n type: 'Identifier',\n name,\n };\n }", "title": "" }, { "docid": "aabd0ca04d09ff4479589d2d480f5ab6", "score": "0.5020285", "text": "function create(uri, languageId, version, content) {\r\n return new FullTextDocument(uri, languageId, version, content);\r\n }", "title": "" }, { "docid": "aabd0ca04d09ff4479589d2d480f5ab6", "score": "0.5020285", "text": "function create(uri, languageId, version, content) {\r\n return new FullTextDocument(uri, languageId, version, content);\r\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "341ab65c7d6d7a53381ac73dfa3f93e0", "score": "0.5017494", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "c8c71cedb3d949364423dc6635542b0c", "score": "0.50069845", "text": "function ObjectId(text){\n return text;\n}", "title": "" }, { "docid": "09cdc096b08a5358d74ded78e46ec41e", "score": "0.4998011", "text": "function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }", "title": "" }, { "docid": "d7d01fa9345500411266d8c2edc5fd33", "score": "0.49868032", "text": "function text(text) { return new Text(text); }", "title": "" }, { "docid": "a955b766843d0beaa2f98b23b8697275", "score": "0.49346063", "text": "static newUnknownDocument(t, e) {\n return new Vt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);\n }", "title": "" }, { "docid": "1ded9c2cb23476fc1392c02174004ef0", "score": "0.49317154", "text": "function createText(value) {\n return { type: constants_ts_4.NodeKeys.Text, value };\n }", "title": "" }, { "docid": "1cfc03a83640fda89e9bd8ba0d1f5fc5", "score": "0.48781627", "text": "static _create(document, name, publicId = '', systemId = '') {\n const node = new DocumentTypeImpl(name, publicId, systemId);\n node._nodeDocument = document;\n return node;\n }", "title": "" }, { "docid": "5ef0dea1f015b0ed0892eb66a5ab9f8c", "score": "0.48616868", "text": "function create(newText, insert, replace) {\n return { newText: newText, insert: insert, replace: replace };\n }", "title": "" }, { "docid": "5ef0dea1f015b0ed0892eb66a5ab9f8c", "score": "0.48616868", "text": "function create(newText, insert, replace) {\n return { newText: newText, insert: insert, replace: replace };\n }", "title": "" }, { "docid": "5ef0dea1f015b0ed0892eb66a5ab9f8c", "score": "0.48616868", "text": "function create(newText, insert, replace) {\n return { newText: newText, insert: insert, replace: replace };\n }", "title": "" }, { "docid": "0f6e9737b6d5d416d16402cb3a0f227a", "score": "0.48348925", "text": "make_new_annotation_id() {\n var unq_str = uuidv4();\n return unq_str;\n }", "title": "" }, { "docid": "64fa866c1d77538e11196279cc902f88", "score": "0.4817014", "text": "function createIdEvaluator(nameLiteral) {\n generate.getter(literals[nameLiteral]);\n }", "title": "" }, { "docid": "dc1278f7cc46e2e03a044688781eb6a6", "score": "0.47950217", "text": "function identifierFactory (ast, reserved) {\n reserved = reserved || new Set\n\n ast.find(j.Identifier).forEach(path => {\n reserved.add(path.node.name)\n })\n\n ast.find(j.FunctionDeclaration).forEach(path => {\n reserved.add(path.node.id.name)\n })\n\n function identifier (name, suffix) {\n return j.identifier(identifier.string(name, suffix))\n }\n\n identifier.string = function (name, suffix) {\n let sfx = suffix == null ? '' : suffix\n , unique = name + sfx\n , n = 0\n\n while (reserved.has(unique)) {\n unique = name + (n++) + sfx\n }\n\n return unique\n }\n\n return identifier\n}", "title": "" }, { "docid": "fb82f530d13d07fe9d2be3b7e60f2740", "score": "0.47494757", "text": "function createId() {\n\tvar text = \"\";\n\tvar possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\n\tfor (var i = 0; i < 4; i++)\n\t\ttext += possible.charAt(Math.floor(Math.random() * possible.length));\n\n\treturn text;\n}", "title": "" }, { "docid": "5ed521bc2c1f8c1a90135bbb8c9b193a", "score": "0.47395134", "text": "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1da7158f;\n this.SUBCLASS_OF_ID = 0x5897069e;\n\n this.canNotSkip = args.canNotSkip || null;\n this.id = args.id;\n this.version = args.version;\n this.text = args.text;\n this.entities = args.entities;\n this.document = args.document || null;\n this.url = args.url || null;\n }", "title": "" }, { "docid": "5fba9a76b9c222d6aa7de4c990b35bd0", "score": "0.4731945", "text": "function IdentifierNode(context) {\n\t BaseExprElementNode.call(this, 'IdentifierNode');\n\n\t if(context) {\n\t this.businessType = context.businessType;\n\t this.isCollection = context.isCollection;\n\t this.rootObject = context.rootObject;\n\t this.attribute = context.attribute;\n\t this.associations = context.associations;\n\t //this.modifiers = context.modifiers;\n\t this.modifiers = {};\n\n\t if(context.modifiers) {\n\t for (var key in context.modifiers) {\n\t if(context.modifiers.hasOwnProperty(key)) {\n\t this.modifiers[key] = context.modifiers[key];\n\t }\n\t }\n\t }\n\n\t }\n\t else\n\t {\n\t this.businessType = null;\n\t this.isCollection = null;\n\t this.rootObject = null;\n\t this.attribute = null;\n\t this.associations = [];\n\t this.modifiers = {};\n\t }\n\t //this.scope = context;\n\t }", "title": "" }, { "docid": "f2ff6c3bba5b0e76c4d5e36f37a87fa5", "score": "0.47234443", "text": "function fromId(id, factory) {\n factory = factory || DataFactory; // Falsy value or empty string indicate the default graph\n\n if (!id) return factory.defaultGraph(); // Identify the term type based on the first character\n\n switch (id[0]) {\n case '_':\n return factory.blankNode(id.substr(2));\n\n case '?':\n return factory.variable(id.substr(1));\n\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory) return new Literal(id); // Literal without datatype or language\n\n if (id[id.length - 1] === '\"') return factory.literal(id.substr(1, id.length - 2)); // Literal with datatype or language\n\n var endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1), id[endPos + 1] === '@' ? id.substr(endPos + 2) : factory.namedNode(id.substr(endPos + 3)));\n\n default:\n return factory.namedNode(id);\n }\n} // ### Constructs an internal string ID from the given term or ID string", "title": "" }, { "docid": "3349f40b79a3995ecb0fdbb619e7b7f3", "score": "0.4716182", "text": "function Literal(txt ) {\n this.txt = txt;\n }", "title": "" }, { "docid": "3349f40b79a3995ecb0fdbb619e7b7f3", "score": "0.4716182", "text": "function Literal(txt ) {\n this.txt = txt;\n }", "title": "" }, { "docid": "20858e19ffaca18a1b24802b16948205", "score": "0.470762", "text": "function newObjectId() {\n //TODO: increase length to better protect against collisions.\n return randomString(10);\n}", "title": "" }, { "docid": "522b243e3228630c493590df224bab86", "score": "0.47001013", "text": "constructor(text) {\n this.text = text\n this.id = Date.now()\n //using 'Date.now' method we can give a unic id to each postit instance we make\n }", "title": "" }, { "docid": "ff661998aa5db2659b24da7cef1eabcb", "score": "0.46842268", "text": "function Const(){ return Identifier.apply(this,arguments) }", "title": "" }, { "docid": "a34d3f0749b11f57addd963849d89388", "score": "0.46500406", "text": "id(identifier) {\n this.$__identifier = true === identifier;\n\n return this;\n }", "title": "" }, { "docid": "25f04a7d7757bc31d0b77f09de144486", "score": "0.46469346", "text": "function documentcreatetextnode() {\n var success;\n if(checkInitialization(builder, \"documentcreatetextnode\") != null) return;\n var doc;\n var newTextNode;\n var newTextName;\n var newTextValue;\n var newTextType;\n \n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"staff\");\n newTextNode = doc.createTextNode(\"This is a new Text node\");\n newTextValue = newTextNode.nodeValue;\n\n assertEquals(\"value\",\"This is a new Text node\",newTextValue);\n newTextName = newTextNode.nodeName;\n\n assertEquals(\"name\",\"#text\",newTextName);\n newTextType = newTextNode.nodeType;\n\n assertEquals(\"type\",3,newTextType);\n \n}", "title": "" }, { "docid": "72fa6b0472a7034853da0e55aa88f3b4", "score": "0.46445", "text": "function hc_documentcreatetextnode() {\n var success;\n if(checkInitialization(builder, \"hc_documentcreatetextnode\") != null) return;\n var doc;\n var newTextNode;\n var newTextName;\n var newTextValue;\n var newTextType;\n \n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"hc_staff\");\n newTextNode = doc.createTextNode(\"This is a new Text node\");\n newTextValue = newTextNode.nodeValue;\n\n assertEquals(\"value\",\"This is a new Text node\",newTextValue);\n newTextName = newTextNode.nodeName;\n\n assertEquals(\"strong\",\"#text\",newTextName);\n newTextType = newTextNode.nodeType;\n\n assertEquals(\"type\",3,newTextType);\n \n}", "title": "" }, { "docid": "17fbef5fd84c7901a75281a5cd25a3a7", "score": "0.4639375", "text": "static initialize(obj, documentId, textContents) { \n obj['documentId'] = documentId;\n obj['textContents'] = textContents;\n }", "title": "" }, { "docid": "ed25a6ba947d060dc3b43052ea77603e", "score": "0.46288994", "text": "function compileIdentifier(word, options) {\n var opts = typeof options === 'object' ? options : {}\n\n var unreserve = typeof opts.reconcile === 'function' ? opts.reconcile : underscore\n var dialect = typeof opts.dialect === 'string' || typeof opts.dialect === 'number' ? opts.dialect : 6\n var strict = typeof opts.strict === 'boolean' ? opts.strict : true\n\n return reserved.check(word, dialect, strict) ? unreserve(word) : word\n}", "title": "" }, { "docid": "168eafc74a0bfb0b7ea6b508540243a9", "score": "0.46264443", "text": "function create_document() {\n return new DocumentImpl_1.DocumentImpl();\n}", "title": "" }, { "docid": "168eafc74a0bfb0b7ea6b508540243a9", "score": "0.46264443", "text": "function create_document() {\n return new DocumentImpl_1.DocumentImpl();\n}", "title": "" }, { "docid": "f5e9ed79adfd05653725899e6d26e6af", "score": "0.46259728", "text": "function Identifier(d, s, c){\n this._d = d;\n this._s = s;\n this._c = c;\n}", "title": "" }, { "docid": "e26c37cb3e7ead144a5a7af61942c76b", "score": "0.46103585", "text": "enterDocument_literal(ctx) {\n\t}", "title": "" }, { "docid": "0b305e491cc02e40c07032f4cae8e2e7", "score": "0.46054736", "text": "createDocument(){\n this.get('commandRegistry').execute(DOCUMENT_NEW, this.currentModel.project);\n }", "title": "" }, { "docid": "d9feddfd5ca3cd9d135e06bd577cb6fe", "score": "0.46043742", "text": "function generateNewRevisionId() {\n return generateId(9);\n }", "title": "" }, { "docid": "aaa1406e8124740046e47271eba60671", "score": "0.45929134", "text": "constructor(text_struct) {\n super(text_struct);\n this.setAttribute('type', 'TextDynamics');\n\n this.sequence = text_struct.text.toLowerCase();\n this.line = text_struct.line || 0;\n this.glyphs = [];\n\n _vex__WEBPACK_IMPORTED_MODULE_0__[\"Vex\"].Merge(this.render_options, {\n glyph_font_size: 40,\n });\n\n L('New Dynamics Text: ', this.sequence);\n }", "title": "" }, { "docid": "14acb5c9f57ff05ffa3ba906783c8978", "score": "0.45792273", "text": "static get identity() {\n\t\treturn SubString.of('')\n\t}", "title": "" }, { "docid": "1a1d09501080358080eb9fb0baf82cbb", "score": "0.4565754", "text": "function createTextElement(text) {\n\treturn {\n\t\ttype: \"TEXT_ELEMENT\",\n\t\tprops: {\n\t\t\tnodeValue: text,\n\t\t\tchildren: [],\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d05a675b2f02dbdf70ccb317d1d26e76", "score": "0.45529962", "text": "static newInvalidDocument(t) {\n return new Vt(t, 0 /* INVALID */ , W.min(), bt.empty(), 0 /* SYNCED */);\n }", "title": "" }, { "docid": "59b2b5c1f80611d6d11332ec5cadb9ae", "score": "0.45508832", "text": "function factory(options) {\n\n // initialize options (keys must be supported by Konva.Text() constructor)\n options = options || {};\n\n options.id = options.id || generateTextId();\n options.x = options.x || 0;\n options.y = options.y || 0;\n options.width = options.width || 300;\n options.padding = options.padding || 20;\n options.align = options.align || 'center';\n options.fontFamily = options.fontFamily || 'Calibri';\n options.fontSize = options.fontSize || 18;\n options.fill = options.fill || '#333';\n options.draggable = (options.draggable != undefined) ? options.draggable : true;\n\n options.text = options.content || 'COMPLEX TEXT\\n\\nAll the world\\'s a stage, and all the men and women merely players. They have their exits and their entrances.';\n \n return new Text(options);\n\n}", "title": "" }, { "docid": "a1ef4882f66f31695fef19c983b1aedb", "score": "0.45480376", "text": "function makeid(text) {\n const possible =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (let i = 0; i < 8; i++)\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n}", "title": "" }, { "docid": "41506db9a39bb36149703b5f8fbed932", "score": "0.4536272", "text": "function createID() {\n return uuidv4().replace(/-/g, \"\");\n}", "title": "" }, { "docid": "7d68c4d4061facd26ec7bdc715c444cf", "score": "0.45299768", "text": "async createControlDocument () {\n\t\tthis.controlDocument = {\n\t\t\ttext: 'goodbye',\n\t\t\tnumber: 54321,\n\t\t\tarray: [5, 4, 3, 2, 1],\n\t\t\tobject: {\n\t\t\t\tx: 3,\n\t\t\t\ty: 2.2,\n\t\t\t\tz: 'one'\n\t\t\t}\n\t\t};\n\t\tconst createdDocument = await this.data.test.create(this.controlDocument);\n\t\tthis.controlDocument.id = createdDocument.id;\n\t}", "title": "" }, { "docid": "4706bfc90282b9b40e0e065a4cab216a", "score": "0.4522554", "text": "function makeID() {\n idCounter++;\n return \"sectid\" + Math.random().toString(36).substr(2, 4) + idCounter;\n }", "title": "" }, { "docid": "7ca1950f56ad0bf7a391e622de613883", "score": "0.45199645", "text": "static newFoundDocument(t, e, n) {\n return new Vt(t, 1 /* FOUND_DOCUMENT */ , e, n, 0 /* SYNCED */);\n }", "title": "" }, { "docid": "b1f24f339b34a48811a5ac760c7d06ce", "score": "0.45179188", "text": "function makeID(name, type, number, year) {\n id = name.toLowerCase().replace(/[^a-z0-9]/g, '_');\n id += (type) ? ('-' + type.toLowerCase().replace(/[^a-z0-9]/g, '_')) : '';\n id += (number) ? ('-' + number.toLowerCase().replace(/[^a-z0-9]/g, '_')) : '';\n id += (year) ? ('-' + year) : '';\n return id;\n}", "title": "" }, { "docid": "004e0eca9e584c146affde2b9ab4fef9", "score": "0.45100725", "text": "function Term(name, id) {\n this.name = name;\n this.id = id;\n}", "title": "" }, { "docid": "955d8455689e5a39ce80ca9cbc54b167", "score": "0.44965398", "text": "function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {\n const hasBinding = text.match(BINDING_REGEXP);\n const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);\n if (hasBinding) {\n generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);\n }\n}", "title": "" }, { "docid": "955d8455689e5a39ce80ca9cbc54b167", "score": "0.44965398", "text": "function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {\n const hasBinding = text.match(BINDING_REGEXP);\n const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);\n if (hasBinding) {\n generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);\n }\n}", "title": "" }, { "docid": "955d8455689e5a39ce80ca9cbc54b167", "score": "0.44965398", "text": "function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {\n const hasBinding = text.match(BINDING_REGEXP);\n const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);\n if (hasBinding) {\n generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);\n }\n}", "title": "" }, { "docid": "a16c17eb180e40ff6338aed2af2000be", "score": "0.44958684", "text": "function fIdentifier(m) {\n // identifiers are transformed into strings\n return {\n type: \"string\",\n value: m[0],\n match: \"\\\"\" + m[0].replace(/./g, function (c) {\n return c === \"\\\\\" ? \"\\\\\\\\\" : c;\n }) + \"\\\"\",\n };\n }", "title": "" }, { "docid": "e3d5eb3473eaba20702064dabfa1ecfd", "score": "0.4489991", "text": "function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {\n const hasBinding = text.match(BINDING_REGEXP);\n const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);\n if (hasBinding) {\n generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);\n }\n}", "title": "" }, { "docid": "b2d94d497f5478bcaae5ba052b74061a", "score": "0.44762027", "text": "function idFromText(text) {\n\t\tvar words = text.split(/\\s+/);\n\t\twords = words.map(function(word){\n\t\t\treturn word[0].toUpperCase() + word.slice(1);\n\t\t});\n\n\t\treturn words.join('_');\n\t}", "title": "" }, { "docid": "03f2211d44884e2757db25fd3977a0e3", "score": "0.44719797", "text": "function document(x) {\n return new _named_node__WEBPACK_IMPORTED_MODULE_0__[\"default\"](docpart(x));\n}", "title": "" }, { "docid": "bc3efb4573332c2b5d2acf4ff83578ca", "score": "0.4470512", "text": "escapeIdentifier(str) {\n return '\"' + str.replace(/\"/g, '\"\"') + '\"'\n }", "title": "" }, { "docid": "bc3efb4573332c2b5d2acf4ff83578ca", "score": "0.4470512", "text": "escapeIdentifier(str) {\n return '\"' + str.replace(/\"/g, '\"\"') + '\"'\n }", "title": "" }, { "docid": "f82e4a84b3b75087301b1ebd396918d6", "score": "0.44683516", "text": "function ingestText(view, text) {\n view.create.push(ir.createTextOp(view.tpl.allocateXrefId(), text.value));\n}", "title": "" }, { "docid": "f82e4a84b3b75087301b1ebd396918d6", "score": "0.44683516", "text": "function ingestText(view, text) {\n view.create.push(ir.createTextOp(view.tpl.allocateXrefId(), text.value));\n}", "title": "" }, { "docid": "5455beb30a2b4e7baef37b1a5d9aff16", "score": "0.44655696", "text": "createIdForObject() {\n this.state.location.concept.metadata.object['@id'] = idGenerator()\n }", "title": "" }, { "docid": "ebd038bd5000c0069ace3bbdf704fae2", "score": "0.4465299", "text": "static newUnknownDocument(t, e) {\n return new qt(t, 3 /* UNKNOWN_DOCUMENT */ , e, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);\n }", "title": "" }, { "docid": "7c51947f5da234de5b46126f885ab5c5", "score": "0.44625574", "text": "function _createScriptNodeId (inRef) {\n\t\tvar idNum = inRef.scriptNodeIds.length;\n\t\treturn SCRIPT_NODE_ID_PREFIX + inRef.name + \"_\" + idNum;\n\t}", "title": "" }, { "docid": "5f1c9b49f313e337f872bb9a6b76415d", "score": "0.44546404", "text": "function createID(heading) {\n\t\theading.id = heading.textContent.replace(/\\W+/g, '-').toLowerCase();\n\t}", "title": "" }, { "docid": "c10e7fd3d6675b34aa2e18edeca6dde9", "score": "0.44419083", "text": "function createTextElement(text) {\n return {\n type: '#text',\n nodeValue: text\n };\n}", "title": "" }, { "docid": "bc4deafeb733f61d4d26ac4f159d0092", "score": "0.44389734", "text": "VarExp(id) {\n return new IdentifierExpression(id.ast())\n }", "title": "" } ]
ab7a8b7cd87965829e6e88dcf5812dcc
function that counts the number of occurrences of a character in a string
[ { "docid": "b3d9866b60ba22047e4b8d5a94ce4d19", "score": "0.8155527", "text": "function find_occurrences(str, char_to_count){\n return str.split(char_to_count).length - 1;\n }", "title": "" } ]
[ { "docid": "4fa83a0fe715a5ff4909fa31816c0604", "score": "0.85592383", "text": "function count(string,char) {\n var re = new RegExp(char,\"gi\");\n return string.match(re).length;\n }", "title": "" }, { "docid": "f68697843aa22712cbade1afbd8915d2", "score": "0.84906435", "text": "function countOccurrences(str, char) {\n let counter = 0;\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) === char) {\n counter += 1;\n }\n }\n return counter;\n}", "title": "" }, { "docid": "53ccbca1b4482731c715e5d1fdeafc7a", "score": "0.845103", "text": "function countCharacter(str, char) {\n // let count = 0;\n // for (let i = 0; i < input.length; i++) {\n // if (input[i] === char) {\n // count++;\n // }\n // }\n // return count;\n // return input.match(new RegExp(char, \"g\")).length;\n return (str.match(new RegExp(char, \"g\")) || []).length;\n}", "title": "" }, { "docid": "fac5028f452c82195fafc011445c3908", "score": "0.84252155", "text": "function countChar(string, char) {\n /*let result = 0;\n\n for (let c of string.split('')) {\n if (c.toLowerCase() === char.toLowerCase()) {\n result += 1;\n }\n }\n return result;*/\n\n return string.split('').filter(c => c.toLowerCase() === char.toLowerCase())\n .length;\n}", "title": "" }, { "docid": "f115942864c5d6f60adf616d7f3ba476", "score": "0.8390078", "text": "function char_count(str, letter){\n\t//code goes here\n}", "title": "" }, { "docid": "0d5add2c3303f094894fffe1e9b0c050", "score": "0.8321378", "text": "function countCharacters(string) {\n // TODO\n }", "title": "" }, { "docid": "1beb424d893113e91fb1bc3ba65266f1", "score": "0.83177125", "text": "function countChars(str, char) {\n var count = 0 \n for (var i = 0; i < str.length; i++) {\n if (str[i] === char) {\n count += 1\n }\n}\nreturn count\n}", "title": "" }, { "docid": "99bf6a5abce0127e9868a4b64961d6a8", "score": "0.8312276", "text": "function countCharacter(str, char) {\n // code here\n}", "title": "" }, { "docid": "0030e5769fea884fe68f3d5d5971b432", "score": "0.82683164", "text": "function char_count(str, letter) \n{\n var letter_Count = 0;\n for (var i = 0; i < str.length; i++) \n {\n if (str.charAt(i) == letter) \n {\n letter_Count += 1;\n }\n }\n return letter_Count;\n}", "title": "" }, { "docid": "1ba6dbd58744ebf371f0e16b13697b64", "score": "0.82558197", "text": "function countchar(s,c1){\r\n\tlet count=0;\r\n\tfor(let i=0;i<s.length;i++){\r\n\tif(c1===s.charAt(i)){\r\n\tcount++\r\n\t}\r\n\t}\r\n\treturn count;\r\n\t}", "title": "" }, { "docid": "11fea58ff032122bd1a0b2b12d5df5d7", "score": "0.8236343", "text": "function countChar(str,character)\n{\n var count = 0;\n for (var idx = 0; idx < str.length; idx++)\n {\n if (str.charAt(idx) == character){\n count++;\n }\n }\n\n return count;\n}", "title": "" }, { "docid": "abbc65988e454a9645272ad3ca5b2a20", "score": "0.8235848", "text": "function charactersOccurencesCount() {\n\n}", "title": "" }, { "docid": "f929331bcbf0e3453665e04a1ed34c1b", "score": "0.8222882", "text": "function findNumberOfOccurences(str, char) {\n for (var count = -1, index = -2; index != -1; count++, index = str.indexOf(char, index + 1));\n return count;\n}", "title": "" }, { "docid": "eaa54236b980731d0172fddcdbe8401e", "score": "0.8220983", "text": "function char_count(str, letter) \n{\n var letter_Count = 0;\n for (var position = 0; position < str.length; position++) \n {\n if (str.charAt(position) == letter) \n {\n letter_Count += 1;\n }\n }\n return letter_Count;\n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "3e9560096ed75fd97f882fbb97610e6b", "score": "0.8211617", "text": "function charactersOccurencesCount() {\n \n}", "title": "" }, { "docid": "d659b361c9b539530431e226f6dff8e5", "score": "0.8210705", "text": "function countChar(string, ch) {\n var counted = 0;\n for (var i = 0; i < string.length; i++)\n if (string.charAt(i) == ch)\n counted += 1;\n return counted;\n }", "title": "" }, { "docid": "7ebd360c57b9a093e2899df3109cc184", "score": "0.81994253", "text": "function freq (str, char) {\n var count = 0;\n var pos = str.indexOf(char);\n while (pos !== -1) {\n count++;\n pos = str.indexOf(char, pos + 1);\n }\n return count;\n}", "title": "" }, { "docid": "0c0ad0f1de59318434081c6d6f960d25", "score": "0.81990653", "text": "function char_count(str, letter) \r\n{\r\n var letter_Count = 0;\r\n for (var position = 0; position < str.length; position++) \r\n {\r\n if (str.charAt(position) == letter) \r\n {\r\n letter_Count += 1;\r\n }\r\n }\r\n return letter_Count;\r\n}", "title": "" }, { "docid": "0c0ad0f1de59318434081c6d6f960d25", "score": "0.81990653", "text": "function char_count(str, letter) \r\n{\r\n var letter_Count = 0;\r\n for (var position = 0; position < str.length; position++) \r\n {\r\n if (str.charAt(position) == letter) \r\n {\r\n letter_Count += 1;\r\n }\r\n }\r\n return letter_Count;\r\n}", "title": "" }, { "docid": "0c0ad0f1de59318434081c6d6f960d25", "score": "0.81990653", "text": "function char_count(str, letter) \r\n{\r\n var letter_Count = 0;\r\n for (var position = 0; position < str.length; position++) \r\n {\r\n if (str.charAt(position) == letter) \r\n {\r\n letter_Count += 1;\r\n }\r\n }\r\n return letter_Count;\r\n}", "title": "" }, { "docid": "6d3ab3b8890a0fa31f7095825ac35d40", "score": "0.8197905", "text": "function countChar(str, c) {\r\n let count = 0;\r\n for(let i = 0; i < str.length; i++) {\r\n if(str.charAt(i).toLowerCase() == c) {\r\n count++;\r\n } \r\n }\r\n return(count);\r\n}", "title": "" }, { "docid": "567847d8a5208d449fd9a32adcc02f3e", "score": "0.819766", "text": "function countOccurrences(string, character) { \n // your code is here\n var count = 0 ;\n var str = [] ;\n str = string.split(\"\") ;\n reduce(str,function(ele,i) {\n \tif(ele === character) {\n \t\tcount+=1 ;\n\n \t}\n })\n \treturn count\n }", "title": "" }, { "docid": "06ec1ffdf112b62213d651ef354d1cd1", "score": "0.8192668", "text": "function charCount(str){\n//do something \n//return an object with the count of the lowercase alphanumeruic character\n}", "title": "" }, { "docid": "57404614727b2effe409c7ff5cc1eb27", "score": "0.81921834", "text": "function countChar(string, char) {\n count = 0;\n for(let i = 0; i <= string.length -1; i++){\n if(string[i] === char){\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "16a26accd3515d0d8685cb662ca1757a", "score": "0.8164281", "text": "function countChar(string, ch) {\n var counted = 0;\n for (var i = 0; i < string.length; i++)\n if (string.charAt(i) == ch)\n counted += 1;\n return counted;\n}", "title": "" }, { "docid": "ed5a564010f33dce4c033d4fcfe52ef6", "score": "0.81533504", "text": "function countChars(string, character) {\n //make a counter variable to keep track of our place\n let counter = 0;\n //make a loop to iterate over the input string\n for (let i = 0; i < string.length; i++) {\n //if the character at the current index of string is equal to input character\n if(string.charAt(i) === character) {\n //increase counter\n counter++;\n }\n }\n //return counter\n return counter;\n}", "title": "" }, { "docid": "a768402e3ca74b20bf2a2f83f5887b6d", "score": "0.8141876", "text": "function countChar(string, char) {\n var count = 0;\n for (var i=0; i<string.length; i++) {\n if (string[i].toLowerCase() === char.toLowerCase()) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "85b7abe3f0e9432b9036514fe80ad79f", "score": "0.8140052", "text": "function countChars(str, char) {\n let count = 0;\n for(let i = 0; i < str.length; i++){\n if(str.charAt(i) === char){\n count += 1;\n }\n }\n return count;\n}", "title": "" }, { "docid": "6104cc444115a11ac9dc578c062449ad", "score": "0.81374985", "text": "function countChar(str, char){\n var count = 0;\n for(var i=0; i<str.length; i++){ // \n if( str[i] == char ){\n count++;\n }\n }\n return count\n}", "title": "" }, { "docid": "cb7a430681e43019bf7859c9a46b873d", "score": "0.81226325", "text": "function countChars(s, c) {\n var n = 0;\n for (var i=0; i<s.length; i++)\n if (s.charAt(i) == c) ++n;\n return n;\n}", "title": "" }, { "docid": "c32c8ee656e34bf176d070de2fcf16c3", "score": "0.81207067", "text": "function charCount(sampleChar,str){\r\n var counter=0;\r\n for(i=0;i<str.length;i++){\r\n if(sampleChar==str[i]){\r\n counter+=1;\r\n }\r\n }\r\n return counter;\r\n}", "title": "" }, { "docid": "ed4c9906154745a130d6d9bb8fcd487b", "score": "0.810741", "text": "function countCharacter( str, char ) {\n var count = 0;\n for( var i = 0; i < str.length; i++ ) {\n if( str.charAt( i ) === char ) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "b97a9967597b7d4058c861996bc8fd74", "score": "0.8107199", "text": "function countChars(string, character) {\n var count = 0;\n var stringArray = string.split(\"\");\n for (var i = 0; i < stringArray.length; i++) {\n if (stringArray[i] === character) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "14ff89c7440530c0bfd1eb90b7e557f1", "score": "0.8100497", "text": "function count_occurences(symbol, string)\n{\n\tlet count = 0;\n\n\tfor (let character of string)\n\t{\n\t\tif (character === symbol)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "c3722679d2691e7618b4a2948620ac5f", "score": "0.8077631", "text": "function countChars(str, char) {\n var strUpper = str.toUpperCase(); //Normalized to upper case, as by CA1308 standard lower case can't make a round trip\n var charUpper = char.toUpperCase();\n var count = 0\n for (var i = 0; i < str.length; i++) {\n if (strUpper[i] === charUpper) {\n count += 1\n }\n}\nreturn count\n}", "title": "" }, { "docid": "23c94209fba6665c6765d95474168ffe", "score": "0.807107", "text": "function char_count(str, letter){\n//Write your code here\nvar count=0;\nfor(var i=0; i<str.length;i+=1){\n if(str[i]===letter){\n count+=1;\n }\n}\nreturn count;\n}", "title": "" }, { "docid": "387d39a06d796af97b9512afbdef0a25", "score": "0.80621415", "text": "function countOccurrences(string, character) {\n // your code is here\n\n var arr = string.split(\"\");\n return reduce(arr, function(acc, element) {\n if (element === character) {\n acc++ ;\n }\n return acc; \n }, 0);\n\n}", "title": "" }, { "docid": "84f382dd8d14eac8c2032c617ccc1438", "score": "0.80404496", "text": "function char_count(str, letter) {\r\n var letter_Count = 0;\r\n for (var position = 0; position < str.length; position++) {\r\n if (str.charAt(position) == letter) {\r\n letter_Count += 1;\r\n }\r\n }\r\n return letter_Count;\r\n}", "title": "" }, { "docid": "3397847bca6df251d8368fcf9d1e931d", "score": "0.8021188", "text": "function count (string, letter) {\n var result= 0;\n for (var i = 0; i < string.length; i++) {\n if (string[i]===letter) {\n result++;\n }\n }\n return result;\n}", "title": "" }, { "docid": "49fa25964ceef610f5fbe9d91569b0a8", "score": "0.7993785", "text": "function countOccurence(str, char){\n var arr = str.split(char);\n return arr.length - 1;\n }", "title": "" }, { "docid": "c137938b6a2e03bce1036e9a93c7ed8f", "score": "0.79649", "text": "function occurrences(str, letter) {\n if (typeof letter !== 'string' || letter.length !== 1) {\n return -1;\n }\n var count = 0;\n for (var i = 0; i < str.length; i++) {\n if (str.charAt(i) == letter) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "1661f0e2607c688e8dcae2a8fa06babc", "score": "0.7959825", "text": "function countCharacter(str, char) {\n // your code here \n let countEle = 0;\n for (let i=0; i< str.length; i++){\n if (str[i] === char){\n countEle++;\n }\n }\n return countEle;\n }", "title": "" }, { "docid": "27188e3aed9a917b80976203d0fd4fe9", "score": "0.79597336", "text": "function letterOccurencesInString(str, letter) {\n\tlet count = 0;\n\tfor (var i = 0; i < str.length; i++) {\n\t\tif (str[i] === letter) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tconsole.log(count);\n}", "title": "" }, { "docid": "ba9b3c3af5fc25f4494dc1120168fdfc", "score": "0.7955894", "text": "function countCharacter(inputString, inputCharacter) {\n let count = 0;\n let string = inputString.toLowerCase();\n let character = inputCharacter.toLowerCase();\n for (let i = 0; i < string.length; i++) {\n if (string[i] === character) {\n count++;\n }\n }\n return count; \n}", "title": "" }, { "docid": "d2b2af4f5bb82944e22fe1a961959c80", "score": "0.7955648", "text": "function newCount(string) {\r\n return countChar(string, 'B');\r\n}", "title": "" }, { "docid": "0703207da7cfd7c599f532711199331f", "score": "0.7954524", "text": "function countChar(string, letter){\n let counter = 0;\n for(let i = 0; i < string.length; i++){\n if(string[i]=== letter){\n counter++\n }\n }\n console.log(counter)\n}", "title": "" }, { "docid": "b6b9663e52863e9e9ddc88429ffc2531", "score": "0.79288197", "text": "function strCount(str, letter){\n let letters_array = str.split('');\n let counter= 0;\n for(i = 0; i < letters_array.length; i++) {\n // console.log(letters_array[i]);\n if(letters_array[i] == letter ) {\n counter += 1;\n }\n }\n if (str == '') {\n return 0;\n }\n return counter;\n}", "title": "" }, { "docid": "c5d0d9fd8f0201feaeeb2fcb75ac0401", "score": "0.79177403", "text": "function countChars(string, char) {\n \n //declare variable container for counting matching characters\n let charCount = [];\n \n //create for loop to check every letter in the string\n //start: 0 index\n //stop: string.length - 1\n //iterate: +1\n for (let i = 0; i <= string.length - 1; i++) {\n //check strict equality to argument passed thru char parameter\n if (string[i] === char) {\n //push that letter into the array\n charCount.push(i);\n }\n }\n //use .length to count the matching letters in charCount array\n return charCount.length;\n}", "title": "" }, { "docid": "83c4aae59bce6f0351bd0e4463aad8c9", "score": "0.7913002", "text": "function countChar(str, ch)\n{\n\tvar sum = 0;\n\tfor (var i = 0; i < str.length; i++)\n\t\tif (str.charAt(i) == ch)\n\t\t\tsum++;\n\n\treturn sum;\n}", "title": "" }, { "docid": "1af22e80328ca884789b8304b31cb970", "score": "0.79078317", "text": "function char_count(str, letter){\n//Write your code here\n str = str.split('');\n let counter = 0;\n str.forEach(function(data, i){\n if (str[i] === letter) counter++;\n })\n return counter;\n}", "title": "" }, { "docid": "e3a864a3699b1e039d962d9a3c663b7c", "score": "0.7905468", "text": "function countChars(string){\n var charCount = {\n };\n var chars = string.split(\"\");\n chars.forEach(function(ele){\n if (charCount[ele]){\n charCount[ele] += 1;\n }\n else {charCount[ele] = 1;}\n });\n return charCount;\n}", "title": "" }, { "docid": "6d9ab3180b666db73eac06d634dc6a0c", "score": "0.789154", "text": "function getCount(str) {\n return (str.match(/[aeiou]/ig) || []).length\n}", "title": "" }, { "docid": "3dc07854fb81de848b38fe5581534ed3", "score": "0.78777486", "text": "function numberOfLetter (s){\n var counter = 0\n for (i=0; i<s.length; i++){\n if(s[i] === 'a'){\n counter ++;\n }\n \n }\n return counter\n\n}", "title": "" }, { "docid": "d16725c3b3a19394d41175328b222f80", "score": "0.78682214", "text": "function getCount(str) {\n var arr = str.split('');\n var count = 0;\n for (var x in arr){\n if(arr[x] === 'a' || arr[x] === 'e' || arr[x] === 'i' || arr[x] === 'o' || arr[x] === 'u'){\n count++;\n }\n}\n return count;\n}", "title": "" }, { "docid": "f4eeed488a66e1313f4036d62864a20b", "score": "0.78267354", "text": "function countChar(str, char) {\n // str and char are both strings\n return str.split(\"\").filter(ch => ch === char).length\n}", "title": "" }, { "docid": "93e4b4f0e1f73af204580e46fb79d3da", "score": "0.7819059", "text": "function countChars(string, character) {\n let characters = '';\n for(let i = 0; i < string.length; i ++) {\n if (string[i] === character) {\n characters += string[i];\n }\n } return characters.length;\n}", "title": "" }, { "docid": "1e0a96ee78fc115608fd5552c36b5158", "score": "0.77890986", "text": "function countChar(s, l) {\n let count = 0;\n for (let i = 0; i < s.length; i++) {\n if (s[i] == \"B\") count++;\n }\n return count\n}", "title": "" }, { "docid": "a6d502f3b45bd1e0a7cfcceea1c4f2e1", "score": "0.77823746", "text": "function findLetterCount(str, letter){\n var numberOfOccurences = 0;\n\nfor (let i = 0; i < str.length; i++){\n if ((str.charAt(i).toLowerCase())== letter){\n numberOfOccurences++\n }\n}\n return numberOfOccurences;\n\n}", "title": "" }, { "docid": "07086755fda9531aa110f7299d3ab664", "score": "0.7773056", "text": "function countOccurrences(string, character) { \n // your code is here\n if (countOccurrences === undifind){\n \tcountOccurrences = array[0];\n \tcountOccurrences = countOccurrences.count(1);\n }\n \treturn count;\n }", "title": "" }, { "docid": "55786e61dfd295c80f62485ee2bf729f", "score": "0.77391607", "text": "function charatercount1(str,letter){\n let len = str.length;\n var letter_Count = 0;\n for (let i=0; i<len; i++){\n if(str[i]==letter){\n letter_Count += 1;\n }\n console.log(str[i]);\n }\n console.log(letter_Count);\n}", "title": "" }, { "docid": "5951246ad2054fc715ca56574399d762", "score": "0.77367455", "text": "function numberLetter(s, char) {\n var count = 0;\n for (var i = 0; i < s.length; i++) {\n if (s[i] == char) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "810cedc171d9c9c16d28b0fce3f81182", "score": "0.7734245", "text": "function getCount(str) {\n const match = str.match(/[aeiou]/g);\n return match ? match.length : 0;\n}", "title": "" }, { "docid": "86a5246f38a5a9b1500a679eb1d6e99b", "score": "0.7728996", "text": "function getCount(str) {\n return [...str].filter(char => 'aeiouAEIOU'.indexOf(char) !== -1 ).length;\n}", "title": "" }, { "docid": "e13610c85b7ec9796d229c5cb820e219", "score": "0.77276963", "text": "function charFreq(string) {\n //...\n}", "title": "" }, { "docid": "16ea5635c503c536ec83db6f40089e71", "score": "0.7727484", "text": "function charCount(myChar, str) {\n\treturn [...str].filter(x => x===myChar).length;\n}", "title": "" }, { "docid": "277e3143e9cbff6b646b7ceb903ba9b0", "score": "0.77264893", "text": "function charFreq(string) {\n var charCount = new Object;\n for (i = 0; i < string.length; i++) {\n if (charCount[string[i]] === undefined) {\n charCount[string[i]] = 1;\n }\n\n else {\n charCount[string[i]]++;\n }\n }\n\n return charCount;\n}", "title": "" }, { "docid": "5f44aedef3a3718a5db2036104467113", "score": "0.7704472", "text": "function findOccurrences(string, char){\n let occurrences = 0;\n\n for (let index = 0; index < string.length; index++) {\n let element = string[index];\n \n if (element === char) {\n occurrences++;\n }\n }\n\n return occurrences;\n}", "title": "" }, { "docid": "7ce2d0517c6847228621e65c917333a6", "score": "0.76950186", "text": "function count_letter(str, letter) {\n let count = 0;\n for(i = 0; i < str.length; i++) {\n if(str[i] === letter) {\n count ++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "442fdc5d5ea9ae0c4ff449c2142bda8f", "score": "0.76921475", "text": "function count_occurences(symbol, string) {\n var count = 0; // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for counting brackets it is safe.\n // for (const character of string)\n\n for (var _iterator5 = string.split(''), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {\n var _ref5;\n\n if (_isArray5) {\n if (_i5 >= _iterator5.length) break;\n _ref5 = _iterator5[_i5++];\n } else {\n _i5 = _iterator5.next();\n if (_i5.done) break;\n _ref5 = _i5.value;\n }\n\n var character = _ref5;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n} // Repeats a string (or a symbol) N times.", "title": "" }, { "docid": "e65ceabc1ca8583d3a6a7f0466a651af", "score": "0.76883507", "text": "function count (string, letter) {\n var result = -1;\n for (var i = 0; i < string.length; i++) {\n \n if (string[i]===letter) {\n result = i;\n \n }\n }\n return result;\n}", "title": "" }, { "docid": "47ef0ada0ea85463a230cb92b83905b2", "score": "0.7678611", "text": "function count_occurences(symbol, string) {\n\tvar count = 0;\n\n\t// Using `.split('')` here instead of normal `for ... of`\n\t// because the importing application doesn't neccessarily include an ES6 polyfill.\n\t// The `.split('')` approach discards \"exotic\" UTF-8 characters\n\t// (the ones consisting of four bytes)\n\t// but template placeholder characters don't fall into that range\n\t// so skipping such miscellaneous \"exotic\" characters\n\t// won't matter here for just counting placeholder character occurrences.\n\tfor (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar character = _ref;\n\n\t\tif (character === symbol) {\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count;\n}", "title": "" }, { "docid": "9b073c90d4dc5c8860c60beb7838cd08", "score": "0.766256", "text": "function countChar(sentence, char){\n let count = 0;\n for (let i = 0; i < sentence.length; i++){\n if (sentence[i] === char){\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "3c7170f8103776729c6a6ed09b2a2f38", "score": "0.7658487", "text": "function getCount(str) {\n return Array.from(str).filter(letter => 'aeiou'.includes(letter)).length\n}", "title": "" }, { "docid": "a27e0768d5e8056099b372cdc7b136d1", "score": "0.7651756", "text": "function Char_Counts(str1) {\r\nvar uchars = {};\r\nstr1.replace(/\\S/g, function(l){uchars[l] = (isNaN(uchars[l]) ? 1 : uchars[l] + 1);});\r\nreturn uchars;\r\n}", "title": "" }, { "docid": "f5f79d3724961539aa0e32619486a1ca", "score": "0.76497155", "text": "function js_countOccurs(sString, cCharacter) {\n var iOccurs = 0;\n var iLength = sString.length;\n var indx = 0;\n\n for(indx = 0; indx < iLength; indx++) {\n if(sString[indx] == cCharacter) {\n iOccurs++;\n }\n }\n return iOccurs;\n}", "title": "" }, { "docid": "93a8c13521e9cb7fbeca28839b921d27", "score": "0.76309085", "text": "function charCount (str) {\n let result = {}\n for(let i = 0 ; i < str.length ; i++) {\n let char = str[i]\n if(result[char] > 0) {\n result[char]++\n } else {\n result[char] = 1\n }\n }\n return result\n}", "title": "" }, { "docid": "7bf53853723e9928f977930ad11f5d9d", "score": "0.7626075", "text": "function characterCount(str) {\n var charCount = {}\n\n var words = str.split(\"\")\n for(let i = 0; i < words.length; i++){\n let char = words[i];\n if(charCount[char]) {\n charCount[char] += 1\n }else {\n charCount[char] = 1\n }\n }\n return charCount;\n}", "title": "" }, { "docid": "e66a8a8859b58553ac629514e6e92336", "score": "0.76011527", "text": "function count (string, letter) {\n var result = -1;\n for (var i = 0; i < string.length; i++) {\n \n if (string[i]===letter) {\n result = i;\n break;\n }\n }\n return result;\n}", "title": "" }, { "docid": "4c8f7c0d34df16a5d702937e75202a6b", "score": "0.7600767", "text": "function countingChars(stringToCount)\n{\n console.log(stringToCount + \" has \" + stringToCount.length + \" chars\");\n}", "title": "" }, { "docid": "eefd0bd6d5835a46b96a83bd19481b37", "score": "0.7600569", "text": "function occurences(str,word){\r\n var count=0\r\n for(var m=0; m < str.length; m++){\r\n if(str[m]===word){\r\n count=count+1;\r\n }\r\n \r\n }\r\n document.write(count);\r\n}", "title": "" }, { "docid": "2f65b6f24a8e7d9f42a0f1b123aebedc", "score": "0.7589421", "text": "function getCount(str) {\n var vowels = ['a', 'e', 'i', 'o', 'u'];\n string = str.split('');\n \n var count = string.filter(function(letter) {\n return vowels.includes(letter)\n });\n return count.length;\n }", "title": "" }, { "docid": "a55770d9d902ebcbb06a0e9dee8a187a", "score": "0.75732815", "text": "function charCount(str){\nlet result={};\nfor(let i=0; i< str.length; i++){\n //make all characters lower case\n let char = str[i].toLowerCase();\n //regular expression to test if only numbers and characters are entered using test function\n if(/[a-z0-9]/.test(char)){\n if(result[char]>0){\n result[char]++;\n }\n else{\n result[char]=1;\n }}\n}\nreturn result;\n}", "title": "" }, { "docid": "551b22ab2705d04c00b0285e70c1e362", "score": "0.75725025", "text": "function charFreq(string){\n// .indexOf\n\n\n\n\n//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf\n}", "title": "" }, { "docid": "d43a2d55bcdde46c9640f337764b274a", "score": "0.75693214", "text": "function charCount(str) {\n // make object to return at end\n let result = {};\n // loop over string, for each character ...\n for (let i = 0; i < str.length; i++) {\n const element = str[i].toLowerCase();\n // if the char is a number/letter and is a key in object, add on to count\n\n if (result[element] > 0) {\n result[element]++;\n }\n // if the char is number/letter and is a not in object, add it adn set value to 1\n else {\n result[element] = 1;\n }\n }\n // if character is something else ( spac, period, etc .) don't do anything\n //return object at end\n return result;\n}", "title": "" }, { "docid": "9a6a469dacc41ab58a03dd750e51e7c5", "score": "0.75455225", "text": "function repeatChar(str, chr)\n{ var count=0;\n var arr=str.split('');\n var rep=arr.reduce((x,y)=>{\n if(y==chr)\n {\n return count++;\n }\n\n })\n console.log(count);\n}", "title": "" }, { "docid": "350261c7c7e3d24d12447cfa5bc961ee", "score": "0.7533071", "text": "function letOccur(str, a) {\n var countLetter = 0;\n for (var i = 0; i < str.length; i++) {\n if (str[i] === a) {\n countLetter ++\n }\n }\n return countLetter;\n}", "title": "" }, { "docid": "f48f57651e33d5d0de5efef4af553fd9", "score": "0.75240517", "text": "function charCount(str){\n var result = {};\n for(var char of str){\n char = char.toLowerCase();\n if(/[a-z0-9]/.test(char)){ \n result[char] ? ++result[char] : result[char]= 1; \n } \n }\n return result;\n}", "title": "" }, { "docid": "7f0f78954ee70b81ebe1100908c3f180", "score": "0.750712", "text": "function countChars(str) {\n const counter = {};\n\n for(let i = 0; i < str.length; i++) {\n let currChar = str[i];\n\n if(!counter[currChar]) {\n counter[currChar] = 1;\n } else {\n counter[currChar]++;\n }\n }\n\n return counter;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" }, { "docid": "75a1c3c666312a7a4db6cda0a523ee01", "score": "0.75067", "text": "function count(search, string) {\n // Count starts at -1 becuse a do-while loop always runs at least once\n var count = -1,\n index = -1;\n do {\n // First call or the while case evaluated true, meaning we have to make\n // count 0 or we found a character\n ++count;\n // Find the index of our search string, starting after the previous index\n index = string.indexOf(search, index + 1);\n } while (index !== -1);\n return count;\n}", "title": "" } ]
57165498b3da13d62356647cab8949e8
Sends user back to reservation form to correct selection
[ { "docid": "a219e8912d1f44f88667ee802ee092d6", "score": "0.0", "text": "handleEdit() {\n this.props.history.push(`/work/${this.state.workId}`);\n }", "title": "" } ]
[ { "docid": "e9c95734b4fa6836a7b56d9811355e28", "score": "0.6578089", "text": "function returnToSelection(){\n create_course_selection_screen()\n // popSelectedCourseForm()\n}", "title": "" }, { "docid": "dfc5e2fd3f80170626c8ababea75465f", "score": "0.6157095", "text": "function viewAdminReservation(reservation_id) {\n window.location.href = \"/adminpage/reservation/\" + reservation_id;\n}", "title": "" }, { "docid": "8a29cb600917e9bba6444e7fc2ad9b32", "score": "0.60995466", "text": "function newBookingHandler() {\n document.getElementById(\"bookingForm\").style.display = \"block\";\n document.getElementById(\"bookingConfirmation\").style.display = \"none\";\n\n setNumOfSeat(\"firstClassInput\", 0);\n setNumOfSeat(\"economyInput\", 0);\n updateCostAmount();\n\n setNewValue(\"startFrom\", \"\");\n setNewValue(\"endTo\", \"\");\n setNewValue(\"departureDate\", \"\");\n setNewValue(\"returnDate\", \"\");\n}", "title": "" }, { "docid": "7c38d3119ddbb6c2a89aebb93e91ab94", "score": "0.5996919", "text": "function viewReservation(reservation_id, user_id) {\n window.location.href = \"/history/\" + reservation_id + \"/\" + user_id;\n}", "title": "" }, { "docid": "468300bbbf4d10e2cd486e76ce0f1f52", "score": "0.59098953", "text": "function changeReservations(){\r\n document.location.href = \"index.html\";\r\n}", "title": "" }, { "docid": "ab80aa568a035f8914223fc9ec85b05c", "score": "0.59094274", "text": "function selected(selected) {\n var start_date = $('#datepicker').datepicker('getDate');\n var input = {\n 'start_date': start_date\n };\n // Ask backend whats up with this date\n $.ajax({\n url: previewUrl,\n data: input,\n success: function(data) {\n // Conflict: Date already reserved\n if (data.status === BOOKED) {\n $('#message').text(booked_text);\n $('#btn_book').attr('disabled', true);\n\n } else if (data.status === INQUERY) {\n $('#message').text(requested_text);\n $('#btn_book').attr('disabled', false);\n $('#reservation_start_date').val(start_date);\n\n } else { // Free\n $('#message').text(free_text);\n $('#btn_book').attr('disabled', false);\n $('#reservation_start_date').val(start_date);\n }\n }\n });\n }", "title": "" }, { "docid": "1623b21a2f90a84377c70438ed48bf68", "score": "0.5895477", "text": "handleAcceptReservation() {\n var reservation = this.state.reservation;\n reservation.dequeue(\n \"+61361446007\",\n \"WA175dc1ca1d0090f43d94780bc2e48625\",\n null,\n \"30\",\n null,\n null,\n \"client:TheAgent\",\n function(error, reservation) {\n if(error) {\n console.log(error.code);\n console.log(error.message);\n return;\n }\n console.log(\"reservation dequeued\");\n }\n );\n }", "title": "" }, { "docid": "b4e725cb7dd2b7d53ae67ee8a0d84316", "score": "0.5820051", "text": "function getId(reservation_id){\n\tvar id = reservation_id;\n\twindow.location='ReservationServlet?form_action=edit&reservation_id='+id;\n\t\n}", "title": "" }, { "docid": "770b7df33a1e41084060571d0d46c902", "score": "0.5811966", "text": "function go(){\n\tvar from = dates[parseInt($(\"#dropdown1 :selected\").attr(\"id\"))].time;\n\tvar to = dates2[parseInt($(\"#dropdown2 :selected\").attr(\"id\"))].time;\n\t\n\tfor(var i = 1; i < 10; i++){\n\t\tvar time = from.clone().add(15, 'minute');\n\t\tif(time.valueOf() + 450000 >= from.valueOf() && time.valueOf() - 450000 <= to.valueOf()){\n\t\t\tif(isReserved(time)){\n\t\t\t\t$(\"#button\").shake();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}else{\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\t$(\"#reserve\").html(\"<p class='reserved'>You have reserved the gym from \" + from.calendar().toLowerCase() + \" to \" + to.calendar().toLowerCase() + \"</p>\");\n\t\n\t$.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"reserve.php\",\n\t\tdata: {\"obj\": JSON.stringify({from: from.toJSON(), to: to.toJSON(), name: name, millis: to.valueOf()})},\n\t\tsuccess: function(result){\n\t\t\tconsole.log(result);\n\t\t}\n\t});\n}", "title": "" }, { "docid": "e4add907983f2a8c4a84136a5aee54b1", "score": "0.57890266", "text": "_onSubmitSelection(evt) {\n evt.preventDefault();\n if (!this.data[\"select1\"] || !this.data[\"select2\"]) {\n ui.notifications.warn(\"Please select two cards.\");\n return;\n }\n\n if (!game.user.isGM) {\n const content = { select1: this.data.select1, select2: this.data.select2 };\n game.socket.emit(\"module.forbidden-card-combat\", {\n operation: \"SubmitSelection\",\n user: game.user.id,\n content: content,\n });\n this.data[\"submitted\"] = true;\n // PLAYER GO TO RELEVATION STAGE\n this.switchToStage2();\n } else {\n if (this.data.submitted) {\n // GM GO TO RELEVATION STAGE\n this.switchToStage2();\n } else {\n ui.notifications.warn(\"Please wait for the opponent to select cards.\");\n }\n }\n }", "title": "" }, { "docid": "d83554e5d7df3d67b355d6d84b65973a", "score": "0.57865113", "text": "function finishSeating(table_id, reservation_id) {\n var answer = window.confirm(\n \"Is this table ready to seat new guests? This cannot be undone.\"\n );\n if (answer) {\n setFinishing(table_id);\n onConfirm(table_id, reservation_id);\n } else return;\n }", "title": "" }, { "docid": "1bf7a08c4fa7c5beac8083f7b6d0d9b4", "score": "0.57527167", "text": "function loadNowBooking(){\r\n jQuery(\"#now-booking\").click(function(){\r\n var bookoption = jQuery(this).attr('bookoption');\r\n if(bookoption == 0 || bookoption == 1){\r\n if(jQuery(\"#form-booking\").valid() ==true){\r\n MainBooking(bookoption);\r\n }\r\n }\r\n });\r\n}", "title": "" }, { "docid": "fdfd365904a53fcc0e0c9f96ed56efa7", "score": "0.57154185", "text": "function confirmCourtSelect(slotId, selectedCourts)\n{\n selectedCourts = (selectedCourts == \"-1\") ? '' : selectedCourts; // Any selected\n\n addSportsHallBooking(slotId, selectedCourts);\n} // confirmCourtSelect(selectedCourts)", "title": "" }, { "docid": "6d8ed00e706a69049229c9943bc8add1", "score": "0.5657787", "text": "function selectRoom() {\r\n /*Creating DatePickers on the checkInDate and checkOutDate input elements.\r\n *DatePicker code from: https://jqueryui.com/datepicker/\r\n */\r\n $(\"#checkInDate\").datepicker();\r\n $(\"#checkOutDate\").datepicker();\r\n\r\n //Current date\r\n var d = new Date();\r\n var twoDigitMonth = '0' + (d.getMonth() + 1);\r\n var currentDate = twoDigitMonth.slice(-2) + \"/\" + ('0' + d.getDay()).slice(-2) + \"/\" + d.getFullYear();\r\n\r\n //Clicking the find_room button:\r\n $(\"#find_room\").click(function() {\r\n var checkIn = $(\"#checkInDate\").val();\r\n var checkOut = $(\"#checkOutDate\").val();\r\n\r\n $(\"#error_message\").empty();\r\n var message = \"\";\r\n if(checkIn === \"\" || checkOut === \"\") {\r\n message = \"<p>Please select two dates.</p>\";\r\n $(\"#bookingContents\").empty();\r\n $(\"#error_message\").append(message);\r\n }else if(checkIn > checkOut){\r\n message = \"<p>Please select a valid check in and check out date.</p>\";\r\n $(\"#bookingContents\").empty();\r\n $(\"#error_message\").append(message);\r\n }else if(checkIn < currentDate){\r\n message = \"<p>Please select a valid check in date.</p>\";\r\n $(\"#bookingContents\").empty();\r\n $(\"#error_message\").append(message);\r\n }else{\r\n contents();\r\n }\r\n });\r\n }", "title": "" }, { "docid": "9df511c6a739f4b51e0db30c5c9b594b", "score": "0.56558657", "text": "function handleSelectionAccountList(e) {\n if (currentPage == \"account/create/finalize/acc_finalize\") {\n handleSelectionAccountListClose();\n\n if ((e.selectedValue1 != undefined) && (e.selectedValue1 != null)) {\n document.getElementById(\"id.accountno\").value = e.selectedValue1;\n }\n }\n }", "title": "" }, { "docid": "eb955526e38e6adcfcde466c0834da37", "score": "0.56472474", "text": "function displayReservationField() {\n tableNumber = this.id;\n table = tables[tableNumber];\n noTables.style.display = 'none';\n checkForm.style.display ='none';\n reserveForm.style.display = 'flex';\n reserveButton.setAttribute('tableNumber', table.tableNumber);\n}", "title": "" }, { "docid": "f1a330e75c491033e717471e9eabb2ee", "score": "0.5644203", "text": "function selectApplicant() {\n let continueSelection = confirm(\"Are you the sure you want to select \" + currentCandidate.name +\n \" for the \" + currentScholarship.data().name + \"?\");\n\n\n if (continueSelection) {\n processApplicantListing(\"offers\");\n }\n}", "title": "" }, { "docid": "9b34285bd688a76a90e07bebd419603f", "score": "0.5608809", "text": "function makeReservation() {\n //var - display msg for reservation\n //var reservationMessage;\n //calculate price of stay based on hotel room type\n /*var roomPrice = document.getElementById('roomType');\n var stayPrice;\n if (roomPrice == 1) {stayPrice = 159 * lengthOfStay;}\n else (roomPrice ==2) {stayPrice = 159 * lengthOfStay;}\n else (roomPrice == 3) {stayPrice = 159 * lengthOfStay;}\n else (roomPrice ==0 ) {//error message;}*/\n\n//calculate endDate\n\n//use string function to construct date from input, then add days from there\n//new Date(var, var, var)\n //var dateParts = document.getElementById('checkInDate').split('/');\n var inputDate = document.getElementById('checkInDate').value;\n var dateEntered = new Date(inputDate);\n//please put attention to the month (parts[0]), Javascript counts months from 0:\n// January - 0, February - 1, etc\n\n\n\n /*var lengthOfStay = document.getElementById('lengthOfStay');\n var addStayDays = startDate.getDate() + lengthOfStay;\n endDate = new Date(startDate.setDate(addStayDays));\n checkOutMessage = \"Your check-out date is \" + endDate.getMonth() + \"/ \" + endDate.getDate() + \".\";\n //check availability\n if (isAvailable() == true) {\n //print reservation message\n reservationMessage = \"We have made your reservation.\";\n reservationMessage += \"You have reserved \" + totalRoomsNeeded() + \" rooms. We now have \" + newRoomsAvailable() + \" rooms available.\";\n } else {\n //print message that there are not enough rooms available to make the reservation.\n reservationMessage = \"Your request cannot be satisfied.\";\n\n }\n //display reservation message on the html page\n document.getElementById('availableRooms').innerHTML = reservationMessage;*/\n document.getElementById('checkOutDate').innerHTML = dateEntered ;\n\n}", "title": "" }, { "docid": "90157a5bfcc3ec87b920ab745b80b2bf", "score": "0.5593612", "text": "function selectRestaurant() {\n\t// choose restaurant\n\t// get json to retrive information\n\n}", "title": "" }, { "docid": "3d554cdb48cb333dc223d97e82023f79", "score": "0.55635095", "text": "function reSelect(){\n //use inquirer to question whether the user would like to do another action\n inquirer\n .prompt([\n {\n //confirm returns a boolean\n type: 'confirm',\n message: 'Would you like to do something else?',\n name:'chooseRestart'\n }\n ]).then(function(data){\n //if user selects yes, run the initial manager controller function\n if(data.chooseRestart === true){\n managerStart();\n //if user selects no, end the connection to the database \n } else {\n console.log('Have a Nice Day.');\n connection.end();\n }\n })\n}", "title": "" }, { "docid": "d72f5c9b4c4be554a12c48a6f8745d36", "score": "0.5554225", "text": "function okAction() {\n if (userRole === \"Admin\") {\n let newStart = new Date(datePicker.value + \"T\" + startTimePicker.value + \"Z\");\n let newEnd = new Date(datePicker.value + \"T\" + endTimePicker.value + \"Z\");\n let newEmployee = undefined;\n if (employeeSelectShift.value !== \"\") {\n newEmployee = employeeSelectShift[employeeSelectShift.selectedIndex].getAttribute('data-employee');\n }\n let isUpdate = true;\n if ((selectedShiftEmployee !== undefined && newEmployee === undefined) ||\n (selectedShiftEmployee === undefined && newEmployee !== undefined)){\n //DO NOTHING\n }\n else if (selectedShiftEmployee === undefined && newEmployee === undefined\n && selectedShift.start === newStart.toISOString()\n && selectedShift.end === newEnd.toISOString()) {\n isUpdate = false;\n }\n else if (selectedShiftEmployee && newEmployee) {\n if (selectedShiftEmployee.name === newEmployee.name\n && selectedShift.start === newStart.toISOString()\n && selectedShift.end === newEnd.toISOString()) {\n isUpdate = false;\n }\n }\n\n if (isUpdate) {\n updates.push(createUpdate(selectedShift, newStart, newEnd, newEmployee));\n selectedShiftDiv.style.backgroundColor = \"#91A41C\";\n selectedShiftDiv.setAttribute(\"hasupdate\", \"changed\");\n selectedShiftDiv.onclick = undefined;\n }\n\n dayShift.style.display = \"inline-block\";\n shiftUpdate.style.display = \"none\";\n\n\n let info = selectedShiftDiv.getElementsByTagName(\"li\");\n if (newEmployee === undefined) {\n info[0].innerText = \"Ingen ansat\";\n } else {\n info[0].innerText = \"Ansat: \" + employeeSelectShift.options[employeeSelectShift.selectedIndex].innerHTML\n }\n info[1].innerText = \"Dato: \" + /[0-9]{4}-[0-9]{2}-[0-9]{2}/g.exec(newStart.toISOString());\n info[2].innerText = \"Starttid: \" + /[0-9]{2}:[0-9]{2}/g.exec(newStart.toISOString());\n info[3].innerText = \"Sluttid: \" + /[0-9]{2}:[0-9]{2}/g.exec(newEnd.toISOString());\n }\n checkShiftsOnclick();\n saveButtonEnable();\n}", "title": "" }, { "docid": "282270e3ea29c0c5a027e07bc0c8431f", "score": "0.5544098", "text": "function unreserveSeat() {\n // Check to see if the user has purchased a ticket\n if (venue.ticketsPurchased.length > 0) {\n \n // Get selected seat from user\n var seatReserved = document.getElementById(\"mySelectReserved\").value;\n document.getElementById(\"demo\").innerHTML = \"You have returned the ticket for seat \" + seatReserved + \".\";\n \n // Remove selected seat from ticketsAvaliable\n // Push selected room into ticketsPurchased\n venue.ticketsPurchased.splice(venue.ticketsAvaliable.indexOf(seatReserved), 1);\n venue.ticketsAvaliable.push(seatReserved);\n \n // Remove selected item from dropdown\n var removeRemoved = document.getElementById(\"mySelectReserved\");\n removeRemoved.remove(removeRemoved.selectedIndex);\n \n // Update total cost after returning ticket\n totalCost = totalCost - 100;\n document.getElementById(\"totalCost\").innerHTML = \"$ \" + totalCost;\n \n // if no tickets purchsed yet\n } else {\n document.getElementById(\"demo\").innerHTML = \"You have not purchased any tickets yet\";\n }\n}", "title": "" }, { "docid": "3d4b3af3d9ba6b3bd8982a5c42e26512", "score": "0.5538774", "text": "function completeScheduling(){\n View.parentTab.parentPanel.selectTab('select');\n}", "title": "" }, { "docid": "4ee2aa996db40fd79facffe05582abc2", "score": "0.5533625", "text": "function bookNowBtnHandler() {\n if (isInputOkay()) {\n document.getElementById(\"bookingForm\").style.display = \"none\";\n document.getElementById(\"bookingConfirmation\").style.display = \"block\";\n displayConfirmationInfo();\n }\n}", "title": "" }, { "docid": "91720017a773249b8ad50c4dc6ea25c2", "score": "0.55283105", "text": "function handleFormSubmit(event) {\n debugger;\n event.preventDefault();\n\n /*\n const ReservationSchema = new Schema({\n firstname: {\n type: String,\n require: true\n },\n lastname: {\n type: String,\n require: true,\n },\n\n email: {\n type: String,\n require: true\n },\n //Probably want a time range for delivery and for holding a reservation at a sit-down visit,\n //see time range by moment- range library https://www.npmjs.com/package/moment-range\n date: { //Date and time of reservation\n type: Date,\n require: true\n },\n delivery: {\n type: Delivery,\n require: false\n }\n\n});\n */\n debugger;\n if (formObject.firstname != null && formObject.lastname != null\n && formObject.email != null && formObject.date != null) { \n API.makeReservation({\n firstname: formObject.firstname,\n lastname: formObject.lastname,\n email: formObject.email,\n date: formObject.date\n })\n .then(res => loadReservations())\n .catch(err => console.log(err));\n } else {\n alert('Please fill in values for category and item name')\n }\n }", "title": "" }, { "docid": "a9be3c34a2af639347c91d27a348459b", "score": "0.55139", "text": "function backToSelect () {\n /* switch screens */\n if (SENTRY_INITIALIZED) Sentry.setTag(\"screen\", \"select-main\");\n\n if (useGroupBackgrounds) optionsBackground.activateBackground();\n\n\tscreenTransition($individualSelectScreen, $selectScreen);\n\tscreenTransition($groupSelectScreen, $selectScreen);\n}", "title": "" }, { "docid": "8d45bfa8316a84369d266a84371c7be4", "score": "0.549303", "text": "function handleReturn() {\n if (fieldsIsFilled()) {\n confirmationAlert(\n \"Atenção!\",\n \"Deseja realmente VOLTAR para a página de consulta de veículos? Os dados não salvos serão perdidos.\",\n \"returnPageConsult\"\n );\n } else {\n returnPageConsult();\n }\n }", "title": "" }, { "docid": "f97f51dd46dec3508ab2cc451daa795d", "score": "0.54916704", "text": "function returnHome()\n{\n form.draft.value=\"\" ;\n form.selection.value=\"\" ;\n form.submit() ;\n}", "title": "" }, { "docid": "4d2d6f811cd8364959b63aa42cf24320", "score": "0.5487253", "text": "function checkStrikeRptSelection() {\n airport_id = document.Query.Airport_id.value\n /*alert(\"here airport_id=\"+airport_id)*/\n state = document.Query.State2.value\n /*alert(\"here state=\"+state); */\n region = document.Query.FAARegion2.value\n /*alert(\"here region=\"+region);*/ \n\n /*NOTE: these paths may need to be adjusted when restriced/index.php is \nedited */\n if(airport_id != \"Select\") {\n document.location = \"strike_index/\" + airport_id + \".html\";\n }\n /*alert(\"state.selectedIndex=\"+document.Query.State2.selectedIndex);*/\n else if(state != \"Select\") {\n document.location = \"statsSummaryResults.php?state=\"+state;\n }\n /*alert(\"state.selectedIndex=\"+document.Query.FAARegion2.selectedIndex);*/\n\n else if(region != \"Select\") {\n document.location = \"statsSummaryResults.php?faaregion=\"+region;\n }\n\n}", "title": "" }, { "docid": "98c72ad474adae540ce1c5120adee994", "score": "0.54826736", "text": "function choosePreviousForm() {\n\n }", "title": "" }, { "docid": "ba5003cfc0b3c6733b04cc5576b014ff", "score": "0.54784954", "text": "function submit (event) {\n event.preventDefault();\n var confirm = `\n <div class=\"confirmation\">Thank you for your reservation! We look forward to seeing you soon.</div`;\n\n if (event.target.id===\"button\") {\n $(\".content-reservations\").html(confirm);\n }\n}", "title": "" }, { "docid": "d55a17effb30781ad0efe6a30ad19eff", "score": "0.5464239", "text": "function CarReserve_FormPackages(controller,carId, noDays, rentalType, meals, fuel) {\n window.location.href = '/' + controller + '/FormPackages?carId=' + carId + '&days=' + noDays +\n '&rentType=' + rentalType + '&meals=' + meals + '&fuel=' + fuel;\n}", "title": "" }, { "docid": "4dbe18038e01dbce0a978ca3eaf45da3", "score": "0.54576766", "text": "function redirectToSelectEndUserScreen(){\n\t\t\t$rootScope.$broadcast(\"toggle-editEndUser\");\n\t\t\t$scope.hideHeaderButton();\n\t\t\t$rootScope.goToState('selectEndUser');\n\t\t}", "title": "" }, { "docid": "f432426302711ca0aabd2bc816185f93", "score": "0.54401493", "text": "function nuevoEncuestador(){\n\n $(\"#search2\").val(\"\");\n $(\"#dni2\").val(\"\");\n $(\"#Nombres2\").val(\"\");\n $(\"#Correo2\").val(\"\");\n $(\"#Telefono2\").val(\"\");\n $(\"#Direccion2\").val(\"\");\n\n \n $(\"#cboDistrito option:selected\").attr(\"value\") == $(\"#cboDistrito\").val(\"1\"); ///combo distrito\n $('select').formSelect();\n $(\"#btnregistrar2\").attr(\"disabled\",false);\n}", "title": "" }, { "docid": "89b885f00241537deee9e36ec01fde90", "score": "0.54350257", "text": "function enterDateResponse()\n{\n \n document.getElementById('datepickerfrom').value = \"\";\n document.getElementById('datepickerTo').value = \"\";\n alert(\"Please select from the Calender !\");\n return false;\n}", "title": "" }, { "docid": "ad382667b431f29f50f94e44eb25556d", "score": "0.54146755", "text": "function addOneReservation( reservation ) {\n\n\tvar users = APP.users;\n\tvar studios = APP.studios;\n\tvar reservations = APP.reservations;\n\tvar current_user_id = APP.current_user_id;\n\n\t//console.log ( ' reservation id= ' + reservations[reservation].pk );\n\t// for each reservation we add a new row to the table that is inside a Day-Hour cell\n\t//console.log (reservations[reservation].fields.date_start.toString());\n\n\tvar date_start = new DayPilot.Date(reservations[reservation].fields.date_start, true);\n\tvar date_end = new DayPilot.Date(reservations[reservation].fields.date_end, true);\n\n\tvar hours = date_start.getHours();\n\t//console.log ( ' reservation is at = '+ hours + ' hours' );\n\n\tvar studioId = reservations[reservation].fields.studio_key;\n\t// assume that the id from PostGres are matching the table studioNames defined at the top of this js file\n\tvar studioName = getStudioName(studioId);\n\t//console.log ( ' studio name = ' + studioName);\n\n\tvar made_by_id = reservations[reservation].fields.made_by;\n\t// made_by identifiers are starting at 1 .. n => no need to modify the identifiers\n\t//var made_by = users[made_by_id].fields.first_name + ' ' + users[made_by_id].fields.last_name;\n\tvar made_by = getUserFullName(made_by_id);\n\n\t// use owner of the reservation - to allow modifying a reservation\n\t// need to strip the name of the studio to suppress space and get a class name\n\t// need to add a dash between the studio and the reservation name\n\t// the event id in the Calendar is the primary key of the DJANGO reservation database record\n\tvar event = new DayPilot.Event({\n\t\tstart: date_start,\n\t\tend: date_end,\n\t\tid: reservations[reservation].pk.toString(),\n\t\ttext: getStudioName(studioId) + ' ' + Dash + ' ' + reservations[reservation].fields.song,\n\t\tbackColor: getStudioBackColor(studioId),\n\t\tcssClass : studioName.replace(\" \", \"\"),\n\t\ttoolTip: made_by_id,\n\t\tbarColor: 'yellow',\n\t\tresource: studioId,\n\t\tsong: reservations[reservation].fields.song,\n\t});\n\n\t// update the daypilot\n\tvar dp = APP.dp;\n\tif (dp != undefined) {\n\t\tif (dp.find(reservations[reservation].pk.toString())) {\n\t\t\tdp.events.update(event);\n\t\t} else {\n\t\t\tdp.events.add(event);\n\t\t}\n\t\tdp.update();\n\t}\n}", "title": "" }, { "docid": "b487f5911a4624bc2d086db821f8dab7", "score": "0.54137254", "text": "function cancelReservation(reservation_id) {\n var answer = window.confirm(\n \"Do you want to cancel this reservation? This cannot be undone.\"\n );\n if (answer) {\n setFinishing(reservation_id);\n onConfirm(reservation_id);\n } else return;\n }", "title": "" }, { "docid": "cd5de372ee87180b91306e1eb4c6047a", "score": "0.54113626", "text": "function onTimeRangeSelected (event) {\n\n\tvar title = 'SVP veuillez confirmer la création';\n\t$(\"#dialogCreate\").dialog(\n\t\t\t{\n\t\t\t\tdialogClass : 'dialogCreate',\n\t\t\t\tresizable\t: false,\n\t\t\t\tmodal\t\t: true,\n\t\t\t\ttitle\t\t: title,\n\t\t\t\twidth\t\t: 400,\n\t\t\t\theight\t\t: 350,\n\t\t\t\topen: function() {\n\t\t\t\t\tvar htmlContent = buildEventDialogHtml(event, 'dialogCreate' );\n\t\t\t\t\t$(this).html(htmlContent);\n\t\t\t\t},\n\t\t\t\tclose: function() {\n\t\t\t\t\tremoveUiDialogs();\n\t\t\t\t\tvar dp = APP.dp;\n\t\t\t\t\tif (dp != undefined) {\n\t\t\t\t\t\t// erase the selection\n\t\t\t\t\t\tdp.clearSelection();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tbuttons: {\n\t\t\t\t\t\"Oui\": function () {\n\n\t\t\t\t\t\t// start URL related data with year and week or month\n\t\t\t\t\t\tvar data = getWeekOrMonthAjaxData();\n\n\t\t\t\t\t\t//console.log (' studio selected id = ' + $('#studioSelection').val() );\n\t\t\t\t\t\tvar studioPrimaryKey = $('#studioSelection').val();\n\t\t\t\t\t\tdata += '&studio=' + studioPrimaryKey ;\n\n\t\t\t\t\t\t//console.log ( ' song value = ' + $(\"#songSelection\").val() );\n\t\t\t\t\t\tvar song = $(\"#songSelection\").val();\n\t\t\t\t\t\tdata += '&song=' + encodeURIComponent(song);\n\n\t\t\t\t\t\t//console.log ( ' hour start = ' + getHourStart() );\n\t\t\t\t\t\tvar startingHour = getHourStart();\n\t\t\t\t\t\tdata += '&start=' + startingHour ;\n\n\t\t\t\t\t\t//console.log ( ' hour end = ' + getHourEnd() );\n\t\t\t\t\t\tvar endingHour = getHourEnd();\n\t\t\t\t\t\tdata += '&end=' + endingHour ;\n\n\t\t\t\t\t\t//console.log ( ' new date = ' + getNewDate() );\n\t\t\t\t\t\tvar selectedDate = getNewDate();\n\t\t\t\t\t\tdata += '&date=' + selectedDate ;\n\t\t\t\t\t\t\n\t\t\t\t\t\t// 2nd December 2017 - manage repetitive reservation\n\t\t\t\t\t\t// if repetitive selection is not available then user is not a superuser or not belonging \n\t\t\t\t\t\tvar repetitionSelectionItem = document.getElementById('repetitionSelection');\n\t\t\t\t\t\tif (repetitionSelectionItem != null) {\n\t\t\t\t\t\t\t// user is superuser or is belonging to staff\n\t\t\t\t\t\t\t//console.log(\"create a reservation => user is superuser or belongs to staff\");\n\t\t\t\t\t\t\tdata += '&repetition=' + String(repetitionSelectionItem.value);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// default number of reservation\n\t\t\t\t\t\t\tdata += '&repetition=' + String(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$.ajax( { \t\n\t\t\t\t\t\t\tmethod: 'post',\n\t\t\t\t\t\t\turl : \"addBooking\",\n\t\t\t\t\t\t\tdata: data ,\n\t\t\t\t\t\t\tasync : true,\n\t\t\t\t\t\t\tsuccess: function(data, status) {\n\t\t\t\t\t\t\t\t//alert(\"Data: \" + data + \"\\nStatus: \" + status);\n\t\t\t\t\t\t\t\tvar dataJson = eval(data);\n\n\t\t\t\t\t\t\t\t// update reservations\n\t\t\t\t\t\t\t\tinsertReservations(dataJson);\n\t\t\t\t\t\t\t} ,\n\t\t\t\t\t\t\terror: function(data, status) {\n\t\t\t\t\t\t\t\talert(\"Error - modify booking: \" + status + \" SVP veuillez contactez votre administrateur\");\n\t\t\t\t\t\t\t\tloadReservations();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcomplete: stopBusyAnimation ,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t$(this).dialog('close');\n\t\t\t\t\t},\n\t\t\t\t\t\"Non\": function () {\n\t\t\t\t\t\t$(this).dialog('close');\n\t\t\t\t\t\t//console.log ( 'suppression was cancelled !!!');\n\t\t\t\t\t\t$(\"#dialog-confirm\").html('');\n\t\t\t\t\t\t//$(this).remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t// now programmatically get the OUI button and disable it\n\tvar button = getDialogButton( '.dialogCreate', 'Oui' );\n\tif ( button ) \t{\n\t\tbutton.attr('disabled', 'disabled' ).addClass( 'ui-state-disabled' );\n\t}\n}", "title": "" }, { "docid": "1ebfa92de120650507fe7a8356f076dc", "score": "0.5407877", "text": "function ReservationSeating() {\n const { reservation_id } = useParams();\n const [tables, setTables] = useState([]); // state for the list of tables\n const [reservation, setReservation] = useState({}); // state for the reservation\n const [tableErrors, setTableErrors] = useState([]);\n const [reservationErrors, setReservationErrors] = useState([]);\n const [selectedTable, setSelectedTable] = useState(null);\n\n useEffect(loadReservation, [reservation_id]);\n useEffect(loadDropDown, [reservation_id]);\n\n // loads reservation information\n function loadReservation() {\n const abortController = new AbortController();\n getReservation(reservation_id, {}, abortController.signal)\n .then(setReservation)\n .catch(setReservationErrors);\n return () => abortController.abort();\n }\n\n // Loads the dropdown\n function loadDropDown() {\n const abortController = new AbortController();\n listTables({}, abortController.signal)\n .then(setTables)\n .catch(setTableErrors);\n return () => abortController.abort();\n }\n\n // Changes form when selected\n const changeHandler = (event) => {\n const tableInfo = event.target.value.split(\" - \");\n const currentTable = tables.find(\n (table) => table.table_name === tableInfo[0]\n );\n setSelectedTable(currentTable);\n };\n\n const history = useHistory();\n\n // Changes form when submitted\n const submitHandler = (event) => {\n event.preventDefault();\n seatReservation(reservation_id, selectedTable.table_id)\n .then(() => updateReservationStatus(reservation_id, \"seated\"))\n .then(() => history.push(\"/dashboard\"))\n .catch(setReservationErrors);\n };\n\n const handleCancel = (event) => {\n history.push(\"/reservations/new\"); // send user to home after canceling\n };\n\n return (\n <div className=\"ReservationSeating\">\n <h1>Seat a Reservation</h1>\n {reservationErrors.length !== 0 && (\n <Message negative className=\"alert alert-danger\">\n <Message.Header>Warning:</Message.Header>\n <ul>\n {reservationErrors.map((err) => {\n return <li>{err}</li>;\n })}\n </ul>\n </Message>\n )}\n {tableErrors.length !== 0 && (\n <Message negative className=\"alert alert-danger\">\n <Message.Header>Warning:</Message.Header>\n <ul>\n {tableErrors.map((err) => {\n return <li>{err}</li>;\n })}\n </ul>\n </Message>\n )}\n <form onSubmit={submitHandler}>\n <div className=\"form-group row\">\n <div className=\"col-auto my-1\">\n <h4 className=\"mb-0\">Seat Reservation {reservation_id}</h4>\n <h5>Party of {reservation.people}</h5>\n <select\n className=\"custom-select mr-sm-2\"\n id=\"inlineFormCustomSelect\"\n name=\"table_id\"\n onChange={changeHandler}\n >\n <option value>Choose...</option>\n {tables.map((table) => {\n return (\n <option key={table.table_id} name={table.table_id}>\n {table.table_name} - {table.capacity}\n </option>\n );\n })}\n </select>\n </div>\n </div>\n <div className=\"form-group row\">\n <div className=\"FormButtons\">\n <button type=\"submit\" className=\"btn btn-primary\">\n Submit\n </button>\n <button className=\"btn btn-secondary\" onClick={handleCancel}>\n Cancel\n </button>\n </div>\n </div>\n </form>\n </div>\n );\n}", "title": "" }, { "docid": "b6345c7333e99677268220e6369964f1", "score": "0.5393786", "text": "submitReservation() {\n this.timer.stop();\n this.timer = new Timer(20, 1);\n this.timer.start();\n this.loader.classList.add('hidden');\n this.reservationText.textContent = \"Vous avez reservé un vélo à \" + this.currentStation.address;\n //session storage\n sessionStorage.setItem('prenom', this.prenom.value);\n sessionStorage.setItem('nom', this.nom.value);\n sessionStorage.setItem('station', this.currentStation.address);\n //If true, the reservation will recommence\n sessionStorage.setItem('reservationInProgress', true);\n //Local storage for auto complete\n localStorage.setItem('prenom', this.prenom.value);\n localStorage.setItem('nom', this.nom.value);\n }", "title": "" }, { "docid": "ff3d98355a5b246bcc0466db7a590a3d", "score": "0.5391334", "text": "onReserve() {\n console.log(\"Reserving\", this.state.start_day.toString(), this.state.end_day.toString());\n\n if (this.state.start_day === null) {\n console.log(\"Start date is null.\");\n } else if (this.state.end_day === null) {\n console.log(\"End date is null\");\n } else {\n // Show Modal here.\n let newState = this.state;\n newState.modalShow = true;\n this.setState(newState);\n\n }\n }", "title": "" }, { "docid": "cc8d483ebd61a9455657776a812053ad", "score": "0.53680784", "text": "function returnToApplicants() {\n\n window.location.href = \"pickRecipient.html?\" + queryString;\n}", "title": "" }, { "docid": "e8e09dba1fbf2162a9c8bbf684e7647a", "score": "0.53595877", "text": "function onItrFormSubmit() {\n if (!$j(\"#upd_by\").hasClass(\"disabled\")) { set_form_updated(); } \n var enrollment = $j(\"#reg_enroll option:selected\").val();\n var not_enrolling = (enrollment != null && enrollment.indexOf(\"nr-\") == 0);\n if (not_enrolling) {\n $j(\"#nextpage\").val('');\n $j(\"#nexttitle\").val('');\n var new_title = $j(\"#donetitle\").val();\n if (new_title != '') {\n $j(\"#backtitle\").val(new_title);\n }\n }\n}", "title": "" }, { "docid": "6acc3bc1ddff8739f0c67124d65375ec", "score": "0.5349454", "text": "function reserveTrajet(req, res) {\n idUser = req.session.passport.user\n idTrajet = req.body.idTrajet\n nbPlace = req.body.nbPlace\n\n bdd.reservation(idUser, idTrajet, nbPlace, (result) => {\n if (result===true) {\n bdd.recup_trajet_reservations(idTrajet,(trajet)=>{\n res.send({\n message: \"trajet reservé avec succes\",\n trajet: trajet\n })\n })\n }else{\n res.send({message:result})\n }\n })\n}", "title": "" }, { "docid": "15015cac429369ed7c1fec92331b45ac", "score": "0.5344073", "text": "function russiaSelected() {\r\n if (countrySelection == \"RUSSIA\") {\r\n mktoForm.submittable(false);\r\n russia = true;\r\n }\r\n else {\r\n mktoForm.submittable(true);\r\n russia = false;\r\n }\r\n }", "title": "" }, { "docid": "4c89fed6998e737946aa36674b73b2ac", "score": "0.5329164", "text": "function onSubmit(performance_id,selected_seats) {\n const reservation_code = makeUniqueId();\n const client_email = document.getElementById('emailInput').value;\n\n // Send data to database\n const data=\"reservation_code=\"+reservation_code+\"&client_email=\"+client_email+\"&performance_id=\"+performance_id+\"&reserved_seats=\"+selected_seats; \n sendReservationToDb(data);\n\n addPromoCode.style.visibility='hidden';\n\n if (document.getElementsByClassName('delPromoCodeA')[0]) document.getElementsByClassName('delPromoCodeA')[0].remove();\n\n const firstname = document.getElementById('firstNameInput').value;\n const name = document.getElementById('lastNameInput').value;\n const cardType = document.querySelector('input[name=\"cardType\"]:checked').value;\n const cardNumConf = \"**** **** **** \"+document.getElementById('ccNumberInput').value.substring(12);\n\n userInstruction.innerHTML='Votre réservation est validée !';\n\n colRigth.innerHTML=`\n <div class='jumbotron p-3'>\n <h4>Merci pour votre commande `+firstname+` !</h4>\n <h5 class=\"lead\">Référence de votre commande à conserver : <span class=\"font-weight-bold\">`+reservation_code+`</span></h5>\n <p class=\"mb-0\"><small>Attention, ce code ainsi que votre email vous sera demandé si vous décidez d'annuler votre réservation.</small></p>\n <div class=\"mt-5 mb-5\">\n <h5>Vos informations personnelles</h5>\n <p>`+firstname+` `+name+`</p>\n <p>`+client_email+`</p>\n </div>\n <div class=\"mt-5 mb-5\">\n <h5>Votre paiement</h5>\n <p>Carte `+cardType+` n° `+cardNumConf+`</p>\n </div>\n <a id='quitBtn' class=\"btn btn-primary\" href=\"index.php\" role=\"button\">Retourner à l'accueil</a>\n </div>\n `;\n\n toastr[\"success\"](\"Vos sièges ont été réservés avec succès.\");\n window.onbeforeunload = null;\n}", "title": "" }, { "docid": "7cac420e4f317117859157cc066c8f04", "score": "0.5322399", "text": "function handleFormSubmit(event) {\r\n debugger;\r\n event.preventDefault();\r\n debugger;\r\n console.log(\"!!!!!!!!!!! category \" + formObject.category + \" itemName \" + formObject.itemName)\r\n if (formObject.category && formObject.itemName) {\r\n API.saveReservation({\r\n category: formObject.category,\r\n itemName: formObject.itemName,\r\n ingredientsUrl: formObject.ingredientsUrl\r\n })\r\n .then(res => loadReservations())\r\n .catch(err => console.log(err));\r\n } else {\r\n alert('Please fill in values for category and item name')\r\n }\r\n }", "title": "" }, { "docid": "e7bf178578b13dd52459bcf9784c208e", "score": "0.5320813", "text": "function presentAddToHome() {\n promptEvent.prompt(); // Wait for the user to respond to the prompt\n promptEvent.userChoice.then(choice => {\n if (choice.outcome === \"accepted\") {\n console.log(\"User accepted\");\n } else {\n console.log(\"User dismissed\");\n }\n });\n}", "title": "" }, { "docid": "57ad53f272f7200f6564b1e49739955d", "score": "0.53176236", "text": "function activar_seccion(pk, nombre){\n\tpk_seccion = pk;\n\testado_seccion =\"Activo\";\n\t$('#formActSeccion').show();\n\t$('#formElimSeccion').hide();\n\t$('#formModSeccion').hide();\n\t$('#formAgregarSeccion').hide();\n\t$(\"#confirmacion_activar\").text(\"¿Desea activar la sección \"+ nombre + \"?\");\n}", "title": "" }, { "docid": "adf10dde968b9a79d55c5ea6c795af06", "score": "0.53162974", "text": "function viewBackFromOther() {\n logInfo('Back send info user approve');\n flagCreSearch = false;\n\tgTrans.isBack = true;\n flagAccFinalize = false;\n}", "title": "" }, { "docid": "e6bdc4187e9a52c32982088ead444526", "score": "0.5315982", "text": "function stayOrLeave (){\n\tinquirer.prompt({\n \tname: \"stayOrLeave\",\n \ttype: \"list\",\n \tmessage: \"What would you like to do now?\",\n \tchoices: [\"Keep shopping\", \"Leave MeeshyD's Superstore\"]\n\t}).then(function(answer) {\n\t\tif (answer.stayOrLeave===\"Keep shopping\"){\n\t\t\tshowInventory();\n\t\t}else{\n\t\t\tconsole.log(\"\\n\\nThank you for visiting. Please come back soon!\\n\\n\")\n\t\t\tprocess.exit()\n\t\t};\n\t});\n}", "title": "" }, { "docid": "8cb93d099c802ab4b8dddf4c86482865", "score": "0.53129226", "text": "function switchToForm(invokingObj) {\n var iSpecies = getCurrentSpecies(invokingObj);\n\n classDisplay(\"selectSpecies\", \"none\");\n\n var sRacerPrefix = \"racer\" + nRacers;\n var elInputForm = document.getElementById(sRacerPrefix+\"_input\");\n elInputForm.style.display = \"block\";\n elInputForm.style.visibility = \"visible\";\n elRaceButton = document.getElementById(\"buttonRace\");\n elRaceButton.style.display = \"none\";\n elRaceButton.style.visibility = \"hidden\";\n elEnterContestant.style.display = \"block\";\n iCurrentSpecies = iSpecies;\n }", "title": "" }, { "docid": "dc866465ff2cad2490ed9baecfecbb16", "score": "0.53126806", "text": "function cancelModalYes(reservation_id) {\n var reservation_id = document.querySelector('#reservation_id').innerHTML;\n var reservation_drop_off = document.querySelector('#reservation_drop_off').innerHTML;\n\n $.ajax({\n url: '/requestCancellation',\n data: {\n reservationid: reservation_id,\n reservationdropoff: reservation_drop_off\n },\n success: function(data){\n alert(\"Your cancellation request has been submitted!\");\n window.location.reload();\n }\n });\n}", "title": "" }, { "docid": "946e2cf226d1e407907260f2e5ac2a25", "score": "0.5304547", "text": "function confirm(){\n\t\twindow.location.replace(\"http://localhost/CSR_Project/Voyager-Stories/VacationThankYou.html\");\n\t}", "title": "" }, { "docid": "4cae8ee64868c18604244fabde770b75", "score": "0.530356", "text": "submit() {\n let booking = new Booking(store.getState().reservation);\n\n // If not enough data in state to create Booking request\n if (typeof booking === \"object\" && booking.error === true) {\n let error = new PopupError(this.errorBlock, booking.errorText);\n error.show();\n return;\n }\n // Default hide errors\n if (booking instanceof Booking) {\n let popupError = new PopupError(this.errorBlock);\n popupError.hide();\n }\n\n this.loader.show();\n booking.request(this.destroy.bind(this), this.hideLoader.bind(this));\n }", "title": "" }, { "docid": "4d490ac02d74286cfef405c11236924a", "score": "0.5302546", "text": "function returnPageConsult() {\n history.push(\"/vehicles\");\n }", "title": "" }, { "docid": "67f7867b98545df1bd4b3380ded73f85", "score": "0.52990055", "text": "function buy(){\r\n\tvar owner = document.getElementById(\"owner\").value\r\n\tvar cvv = document.getElementById(\"cvvnumber\").value\r\n\tvar card = document.getElementById(\"cardnumber\").value\r\n\tvar title = document.getElementById(\"movtitle\").value\r\n\tvar contact = document.getElementById(\"contactnumber\").value\r\n\r\n\tif(owner == \"filip\" && cvv == \"123\" && card == \"123456789\" && title == \"The Commuter\" && contact == \"123456789\"){\r\n\t\talert(\"Successful payment, Your reservation is under your name(Owner) !\");\r\n\t\twindow.location.href = \"../index.html\"\r\n\t}\r\n\r\n\telse {\r\n\t\talert(\"Please fill out the form !\");\r\n\t\treturn false;\r\n\t}\r\n}", "title": "" }, { "docid": "e84763d730ea24bfbd546c8c275fe474", "score": "0.5293864", "text": "function displayReservation(){\n\t'use strict';\n\t\n\tvar numGuests = $(\"#guests\").val();\n\tvar resDate = $(\"#resDate\").val();\n\tvar resTime = $(\"#resTime\").val();\n\t\n\t$(\"#orderSummary\").append(\"<p>Number of Guests: \" + numGuests + \"</p>\"\n\t\t\t\t\t\t\t + \"<p>Reservation Date: \" + resDate + \"</p>\"\n\t\t\t\t\t\t\t + \"<p>Reservation Time: \" + resTime + \"</p>\"\n\t\t\t\t\t\t\t + \"We will contact you within the next 24 hours to confirm\" \n\t\t\t\t\t\t\t + \" your reservation.\");\n}", "title": "" }, { "docid": "026112bef31db6715935038412c108ca", "score": "0.52928436", "text": "function validate_Owner2 (response){\n \n if(response == \"It was successfully saved by the owner\"){\n alert(\"su Registro a sido exitoso\");\n window.location.href = \"/components/owner.html\"\n }else{\n alert(\"a ocurrido un problema, porfavor verifique su informacion\");\n location.reload();\n }\n}", "title": "" }, { "docid": "82e18cdbd5896186bc4666430cd0849b", "score": "0.52877986", "text": "function handleSave() {\n const data = {\n exclusionDates: selectedDays\n }\n const updateExclusionDatesRequest = async () => {\n const response = await Api.trips.updateExclusionDates(trip.id, data);\n const formattedDates = formatExclusionDates(response.data.trip_exclusion_dates);\n setSelectedDays(formattedDates);\n\n // Redirect to schedules for now\n window.location = `/trips/${trip.id}/schedules`\n }\n updateExclusionDatesRequest();\n }", "title": "" }, { "docid": "dcb6b564eeb5f864b924f51b2220214c", "score": "0.528569", "text": "function choose()\n{\n var\tform\t\t= this.form;\n var\tidir\t\t= form.IDIR.value;\n var givenname\t= form.GivenName.value;\n var\tsurname\t\t= form.Surname.value;\n var\tparentsIdmr\t= form.ParentsIdmr.value;\n var\tbirthmin\t= form.BirthMin.value;\n var\tbirthmax\t= form.BirthMax.value;\n var\tdebug\t\t= form.debug.value;\n\n window.open(\"/FamilyTree/chooseIndivid.php?idir=\" + idir +\n\t\t\"&name=\" + surname + \", \" + givenname +\n\t\t\"&parentsIdmr=\" + parentsIdmr + \n\t\t\"&birthmin=\" + birthmin + \n\t\t\"&birthmax=\" + birthmax + \n\t\t\"&debug=\" + debug, \n\t\t\"citation\",\n\t\t\"width=700,height=350,status=yes,resizable=yes,scrollbars=yes\");\n return true;\n}\t// editIndivid", "title": "" }, { "docid": "45e8a89fe5657fc96a7b5a5d09b0c999", "score": "0.5281729", "text": "function changeToUserInput(){\r\n window.sessionStorage.setItem(\"reserved_date\", document.getElementById('date').value);\r\n window.sessionStorage.setItem(\"reserved_time\", document.getElementById('time').value);\r\n window.location.href = \"RF2ndPage.html\";\r\n}", "title": "" }, { "docid": "55da1791a4933bdd4bcd0b595bd7772c", "score": "0.52741987", "text": "function confirmPrenotation(restName) {\r\n\r\n var isBookingPossible = false;\r\n\r\n //lista prenotazioni\r\n var reservationList = loadFromLocalStorage('reservationList');\r\n var reservations = reservationList.reservations;\r\n\r\n //lista utenti\r\n var usersList = loadFromLocalStorage('usersList');\r\n var users = usersList.users;\r\n\r\n var confirmBtn = document.getElementById(\"confirmBtn\");\r\n var seats = document.getElementById(\"reservation_seats\").value;\r\n var hour = document.getElementById(\"reservation_hour\").value;\r\n var day = document.getElementById(\"reservation_day\").value;\r\n var user = getCookie(\"username\");\r\n console.log(restName, user.toString(), seats, day, hour);\r\n\r\n //estraggo l'oggetto rappresentate il ristorante giusto\r\n var resturant = reservations.filter(function (resturantItem) {\r\n return resturantItem.name === restName;\r\n });\r\n\r\n //modifico la disponibilità di posti in base al giorno e l'orario\r\n if(hour == 0){\r\n if(resturant[0].f0[day] >= seats){\r\n resturant[0].f0[day] = resturant[0].f0[day] - seats;\r\n isBookingPossible = true;\r\n }\r\n\r\n } else if(hour == 1){\r\n if(resturant[0].f1[day] >= seats){\r\n resturant[0].f1[day] = resturant[0].f1[day] - seats;\r\n isBookingPossible = true;\r\n }\r\n\r\n }\r\n if(isBookingPossible){\r\n writeInLocalStorage('reservationList', reservationList);\r\n\r\n var userItem = users.filter(function (item) {\r\n return item.email === user.toString();\r\n });\r\n\r\n var newReservation = {\r\n \"resturant\": restName,\r\n \"day\": day,\r\n \"hour\": hour,\r\n \"seats\": seats\r\n };\r\n console.log(\"res item from user\",userItem[0].reservations);\r\n userItem[0].reservations.push(newReservation);\r\n writeInLocalStorage('usersList', usersList);\r\n\r\n alert(\"Grazie di aver prenotato con La Forchetta\");\r\n document.getElementById(\"resturant_booking\").style.display= \"none\";\r\n } else{\r\n //non è possibile prenotare quindi stoppo l'utente\r\n alert(\"Ci dispiace, il numero di posti da te richiesti non è disponibile\");\r\n }\r\n}", "title": "" }, { "docid": "90de8873decb96916b104ed817dd6b20", "score": "0.5272512", "text": "function bookFlight() {\n\tcopyValue(fbn['depDay'][fbn['depDay'].selectedIndex].value, fgt['date.0']);\n\tcopyValue(fbn['depMon'][fbn['depMon'].selectedIndex].value, fgt['mon_abbr.0']);\n\tcopyValue(fbn['retDay'][fbn['retDay'].selectedIndex].value, fgt['date.1']);\n\tcopyValue(fbn['retMon'][fbn['retMon'].selectedIndex].value, fgt['mon_abbr.1']);\n\t\n\tcopyValue(fbn['adults'][fbn['adults'].selectedIndex].value, fgt['persons.1']);\n\tcopyValue(fbn['seniors'][fbn['seniors'].selectedIndex].value, fgt['persons.2']);\n\t//copyValue(fbn['child'][fbn['child'].selectedIndex].value, fgt['persons.3']);\n\t\n\tcopyValue(fbn['origin'][fbn['origin'].selectedIndex].value, fgt['depart']);\n\tcopyValue(dest, fgt['dest.0']);\n\t\t\t\t\t\n\tif(validateAir(fgt)) fgt.submit();\n}", "title": "" }, { "docid": "147c64931d45df70c69de01059f488a4", "score": "0.52528256", "text": "function moveToPlanner() {\n var yearDegreeID = $(\"#ddlYearDegrees\").val();\n var majorID = $(\"#ddlMajors\").val();\n if (yearDegreeID === null || majorID === null) {\n alert(\"Select the appropriate values for degree or major.\");\n }\n else {\n window.location.href = \"/Plan/Create?yearDegreeID=\" + yearDegreeID + \"&majorID=\" + majorID;\n }\n}", "title": "" }, { "docid": "cedb428af868356d89c59e9f7445ddb3", "score": "0.5252025", "text": "function nextEventPage() {\n //Check if event was chosen\n var eventVar = $('#event-checkin-event').val();\n if(eventVar == null){\n $('#event-checkin-warning').removeAttr(\"hidden\");\n }\n else {\n //set eventID in the confirmation screen\n this.database.ref('/events/' + eventTitle).once('value').then((eventCheckInSnap) => {\n var eventCheckInData = eventCheckInSnap.val();\n var eventID = eventCheckInData.eventID;\n $('#event-checkin-display').html(eventID);\n });\n\n //Show confirmation div\n $('#event-checkin-edit').attr(\"hidden\", true);\n $('#event-checkin-confirm').removeAttr(\"hidden\");\n }\n}", "title": "" }, { "docid": "0718c4e6c08f53f9dc8fced7407bf4cf", "score": "0.52506006", "text": "function selectSeat() {\n // Check to see if any seats arw available\n if (venue.ticketsAvaliable.length > 0) {\n\n // Get selected seat from user\n var seatPicked = document.getElementById(\"mySelect\").value;\n document.getElementById(\"demo\").innerHTML = \"You picked seat \" + seatPicked + \".\";\n\n // Remove selected seat from ticketsAvaliable\n // Push selected room into ticketsPurchased\n venue.ticketsAvaliable.splice(venue.ticketsAvaliable.indexOf(seatPicked), 1);\n venue.ticketsPurchased.push(seatPicked);\n \n // Remove selected item from dropdown\n var ticketPurchasedRemoved = document.getElementById(\"mySelect\");\n ticketPurchasedRemoved.remove(ticketPurchasedRemoved.selectedIndex);\n \n // Display Total Cost of Tickets Purchased\n totalCost = venue.ticketsPurchased.length * 100;\n document.getElementById(\"totalCost\").innerHTML = \"$ \" + totalCost;\n \n // if tickets are all sold out\n } else {\n document.getElementById(\"demo\").innerHTML = \"I'm sorry there are no tickets available\";\n }\n}", "title": "" }, { "docid": "2823757161c4df049791077cd03d7655", "score": "0.5248521", "text": "function supervisorView(){\n inquirer\n .prompt({\n\n \n name: \"action\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products Sales by Department\",\n \"Create New Department\",\n \"Exit\"\n ]\n\n })\n .then(function(choice){\n switch (choice.action) {\n case \"View Products Sales by Department\":\n viewSalesByDept();\n break;\n \n case \"Create New Department\":\n createNewDept();\n break;\n \n case \"Exit\":\n connection.end(); \n break;\n \n \n default:\n console.log(\"Please chose proper choice:\");\n managerView();\n break;\n }\n\n });\n\n}", "title": "" }, { "docid": "564cecf8589ae0915b911f121f4c0318", "score": "0.5242358", "text": "function loadGuestsInfo(){\n hide(\"time-container\");\n hide(\"guests\");\n hide(\"loading\");\n hide(\"success\");\n show(\"confirmation\");\n show(\"book\");\n\n document.getElementById(\"confirm\").disabled = false;\n document.getElementById(\"book\").disabled = false;\n document.getElementById(\"name\").focus();\n document.getElementById(\"time\").setAttribute(\"class\", \"btn btn-default\");\n document.getElementById(\"people\").setAttribute(\"class\", \"btn btn-default\");\n document.getElementById(\"confirm\").setAttribute(\"class\", \"btn btn-warning\");\n\n if(chosenPeopleNumber <=1){\n document.getElementById(\"confirm\").innerHTML = (chosenPeopleNumber + \" person at \" + chosentime);\n }else{\n document.getElementById(\"confirm\").innerHTML = (chosenPeopleNumber + \" people at \" + chosentime);\n }\n\n $(\"#name\").keyup(function (e) {\n if (e.keyCode == 13) {\n document.getElementById(\"email\").focus();\n }\n });\n\n $(\"#email\").keyup(function (e) {\n if (e.keyCode == 13) {\n document.getElementById(\"book\").click();\n document.getElementById(\"book\").disabled = true;\n return false;\n }\n });\n\n}", "title": "" }, { "docid": "98f32238cc8766b43606102199496346", "score": "0.5240843", "text": "function populateregionDetails(selectedRegionId){\r\n\t\t\tregionId = selectedRegionId;\r\n\t\t\tcardId = document.getElementById('breezeCardId').value;\r\n\t\t\tif(regionId != '' && regionId != '0'){\r\n\t\t\t\tmoneyVal = document.getElementById('moneyValue').value;\r\n\t\t\t\tif(moneyVal != '' && (isNaN(moneyVal) || (moneyVal*1 <= 0))){\r\n\t\t\t\t alert('Please enter valid cash value');\r\n\t\t\t\t document.getElementById('regionId').value = currRegionId;\r\n\t\t\t\t return;\r\n\t\t\t\t}\t\t\r\n\t\t\t\tvar url = \"breezeCardAction.do?dispatchTo=getProductDetailsForBCard&regionId=\"+regionId+\"&tabLocation=addMoneyToCartDiv&cardId=\"+cardId;\r\n\t\t\t\tdocument.forms[0].action = url;\r\n\t\t\t\tdocument.forms[0].method = \"POST\";\r\n\t\t\t\tdocument.forms[0].submit();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t}\r\n\t\t}", "title": "" }, { "docid": "f5c3c8a3135d9a35e1f26ba522854fab", "score": "0.5240792", "text": "function makeBooking(timeslot) {\r\n\t\t// create AJAX request\r\n\t\tvar xhttp = new XMLHttpRequest();\r\n\t\t\r\n\t\tvar send_Date = vueInstance.preferenceDate;\r\n\t\tvar send_Time = timeslot;\r\n\t\tvar send_Guests = vueInstance.preferenceGuest;\r\n\t\tvar send_RestName;\r\n\t\tif(timeslot == \"Quick\") {\r\n\t\t\tsend_RestName = vueInstance.closestRestaurant;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsend_RestName = getUrlVars()[\"id\"];\r\n\t\t}\r\n\r\n\t\t\r\n\t\t// when server is ready\r\n\t\txhttp.onreadystatechange = function() {\r\n\t\t\tif (this.readyState == 4) {\r\n\t\t\t\tif(this.status == 200) {\r\n\t\t\t\t\tvar URL_query = \"?BookingID=\" + (JSON.parse(this.response)).Booking_ID;\r\n\t\t\t\t\twindow.location.assign(\"confirmation.html\" + URL_query);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.status == 403) {\r\n\t\t\t\t\talert(\"You need to be logged in to do this.\");\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tconsole.log(\"unexpected server response \" + this.status);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\t// open connection with server\r\n\t\txhttp.open(\"POST\",\"/insertBooking\", true);\r\n\t\t\r\n\t\t// set content type to JSON\r\n\t\txhttp.setRequestHeader(\"Content-type\", \"application/json\");\r\n\t\t\r\n\t\t// send request\r\n\t\tvar req_body = JSON.stringify({ Rest:send_RestName, Date:send_Date, Time:send_Time, Guests:send_Guests });\r\n\t\txhttp.send(req_body);\r\n\t}", "title": "" }, { "docid": "5c1001ef10b7abfa602e6e44647296af", "score": "0.5240388", "text": "function bookRoom(event) {\n currentCustomer.bookRoom(event.target.id, chosenDate)\n window.alert(`Room ${event.target.id} has been booked for ${chosenDate}.`)\n}", "title": "" }, { "docid": "222a4b61d1058336f1707a4dcc1680ba", "score": "0.5238968", "text": "onConfirmClicked(event){\n\t\tif (this.validateHabitDetails()){\n\t\t\tthis.state.habit.setTitle(this.state.titleInputText);\n\t\t\tthis.state.habit.setReason(this.state.reasonInputText);\n\t\t\tthis.state.habit.setStartDate(new Date(this.state.dateInputText));\n\t\t\tthis.state.habit.setDaysOfWeek(this.getSelectedDays());\n\t\t\tthis.state.onReturn(this.state.habit);\n\t\t}\n\t}", "title": "" }, { "docid": "8441d4271d3b1380ab5bcbbd5d4688bd", "score": "0.52292717", "text": "function appointmentAction(bankId, branch, timeSlot) {\n\tvar appointment = appointmentBank();\n\tif (appointment.bankId != 0) {\n\t\tBlockchainBank.cancelAppointment({gas: 300000});\n\t\talert(\"Appointment canceled!\");\n\t\treturn;\n\t}\n\tvar name = document.getElementById('name').value;\n\tBlockchainBank.createAppointment(name, parseInt(bankId), branch, timeSlot, {gas: 300000});\n\tdocument.getElementById('name').value = \"\";\n\talert(\"Booked appointment!\");\n}", "title": "" }, { "docid": "d1129986b3920a8ae241b0a3c89a1b49", "score": "0.5228314", "text": "function car_on_loc_and_date_reselect() {\n //get cars\n let all_cars = sc_get_cars();\n console.log(all_cars)\n //get the submit form by id\n let el_location = document.getElementById(\"car_location_select\").value;\n let el_date = document.getElementById(\"car_startDate2\").value;\n console.log(\"location \", el_location, \"Date \", el_date);\n //check for invalid location and date\n //get err div reference\n let err_div = document.getElementById(\"car_submit_error_div\");\n if (el_location == \"\" || el_location == undefined || el_location == null) {\n //invalid location\n //show message\n err_div.innerHTML = \"Please select a location\";\n err_div.style.visibility = \"visible\"\n return;\n } else if (el_date == \"\" || el_date == undefined || el_date == null) {\n //invalid date\n //show message\n err_div.innerHTML = \"Please select a date\";\n err_div.style.visibility = \"visible\"\n return;\n } else {\n //get the formatted date and location\n err_div.style.visibility = \"hidden\"\n\n //get location form the location array\n let locations = sl_get_locations();\n\n if (locations == null || locations == undefined || locations.length == 0) {\n err_div.innerHTML = \"No locations available , refresh and try again\";\n err_div.style.visibility = \"visible\"\n return;\n }\n\n let str_location = locations[el_location];\n let frmt_day = sl_get_day_def(moment(el_date, 'MM/DD/YYYY').toDate().getDay());\n\n console.log(\"Formatted location \", str_location, \"Formatted day \", frmt_day);\n\n //navigate to cars page\n //set the location and day in local storage\n localStorage[\"home_selected_location\"] = str_location;\n localStorage[\"home_selected_location_index\"] = el_location;\n localStorage[\"home_selected_day\"] = frmt_day;\n\n location.reload();\n }\n}", "title": "" }, { "docid": "0d999a7c778d1ed54691a83df8791237", "score": "0.522695", "text": "function selecciona_presupuesto(e) {\n\tif(frm.txtNumero) frm.txtNumero.value=e.numero\n\tif(frm.txtUnidad) frm.txtUnidad.value=e.unidad\n\tif(frm.txtCantidad) frm.txtCantidad.value=e.cantidad\n\tif(frm.cboConcepto) frm.cboConcepto.selectedIndex=e.concepto\n\tif(frm.txtDescripcion) frm.txtDescripcion.value=e.descripcion\n\tif(frm.txtFecha) frm.txtFecha.value=e.fecha\n\tif(frm.txtCostoUnitario) frm.txtCostoUnitario.value=e.unitario\n\tif(frm.txtCostoTotal) frm.txtCostoTotal.value=e.total\n\tif(frm.cboHotel) frm.cboHotel.value=e.hotel\n\tif(frm.txtEditar) frm.txtEditar.value=true\n}", "title": "" }, { "docid": "e02d15f14f9833be45b80c136538f0f9", "score": "0.5226931", "text": "function restoreViewVehicleBlock(id) {\n history.pushState(null, 'View Vehicle', '/view-vehicle/' + id);\n changePageTitle('View Vehicle - Transportation');\n\n viewVehicle(id);\n\n $('#my-vehicles .selectpicker').selectpicker('render');\n $('#my-vehicles .selectpicker').selectpicker('val', id);\n $('#my-vehicles form input').addClass('input-show');\n $('#my-vehicles textarea').addClass('disabled');\n $('#my-vehicles textarea').prop('disabled', 'disabled');\n $('#my-vehicles form input').prop('disabled', 'disabled');\n $('#my-vehicles select').hide();\n\n if($('#vehicle_passenger_delivery_control').attr('data-show') == 'passenger_delivery') {\n $('#vehicle_passenger_delivery_control').addClass('active');\n $('#my-vehicles form input[name=\"passenger_delivery\"]').prop('checked', true);\n\n }\n else {\n $('#vehicle_passenger_delivery_control').removeClass('active');\n $('#my-vehicles form input[name=\"passenger_delivery\"]').prop('checked', false);\n }\n if($('#vehicle_package_delivery_control').attr('data-show') == 'package_delivery') {\n $('#vehicle_package_delivery_control').addClass('active');\n $('#my-vehicles form input[name=\"package_delivery\"]').prop('checked', true);\n }\n else {\n $('#vehicle_package_delivery_control').removeClass('active');\n $('#my-vehicles form input[name=\"package_delivery\"]').prop('checked', false);\n }\n\n toggleVehicleTypeControl();\n toggleTempControl();\n\n $('#my-vehicles .new-vehicle').show();\n $('#my-vehicles .vehicle-selector').show();\n $('#my-vehicles .errors').remove();\n $('#my-vehicles .actions').show();\n $('#my-vehicles .nav-tabs').hide();\n $('#my-vehicles .buttons').hide();\n //\n $('#my-vehicles form input').addClass('input-show');\n $('#my-vehicles textarea').addClass('disabled');\n $('#my-vehicles textarea').prop('disabled', 'disabled');\n $('#my-vehicles textarea[data-show=\"hide\"]').hide();\n $('#my-vehicles form input').prop('disabled', 'disabled');\n $('#my-vehicles form input').show();\n $('#my-vehicles form input[data-show=\"hide\"]').hide();\n $('#my-vehicles form input[data-checked=\"false\"]').hide();\n $('#my-vehicles form .select-show').show();\n $('#my-vehicles select').hide();\n $('#my-vehicles #vehicle-carry-form').show();\n $('#my-vehicles .overflow').show();\n $('#my-vehicles .cost-label').removeClass('edit');\n}", "title": "" }, { "docid": "41fa7920a441e1281ad31f83683e5672", "score": "0.5225078", "text": "function choose() {\n currentYear = parseInt(selectYear.value);\n currentMonth = parseInt(selectMonth.value);\n showCalendar(currentMonth, currentYear);\n}", "title": "" }, { "docid": "36fa28c15b49ced1dee84323ebc7f9da", "score": "0.52171665", "text": "function btn_startJourney(){\n\n\t// CHECK CORNER CASES:\n\t// 1. CHECK IF USER HAS NOT ENTERED ANY ROUTE\n\tif(txt_routeno.value === ''){\n\t\talert('Oops! You have not selected any Bus Route');\n\t\treturn;\n\t}\n\n\t// CHECK IF THE SELECTION BELONGS TO THE BUS ROUTE\n\t// APPEND THE ROUTE ID TO THE URL FOR FURTHER PROCESSING\n\tif( localStorage[\"routeno\"].indexOf(txt_routeno.value) > -1 ){\n\t\turl = 'http://localhost:8080/route/' + Map[txt_routeno.value];\n\t}\n\telse {\n\t\talert('Oops! Bus Route does not exist on your Journey');\n\t\treturn;\n\t}\n\n\t// TODO:\n\t// 1. CALL WEB SERVCIE WITH ABOVE URL TO OBTAIN BUS ROUTE JOURNEY\n\tvar jsonDataFromAPI = getDataFromAPI(url);\n\n\tbusJourney = processJSONDataBusJourney(jsonDataFromAPI);\n\n\t// 2. DISPLAY THE SUBSET (USER JOURNEY) FROM THE BUS JOURNEY\n\tuserJourney = getUserJourney(busJourney);\n\n\tlocalStorage[\"userRoute\"] = txt_routeno.value;\n\tlocalStorage[\"userJourney\"] = userJourney;\n\n\twindow.location.href=\"user_journey.html\";\n}", "title": "" }, { "docid": "34afcdfd26f4b8fab0e3e5ca51101a9e", "score": "0.52159023", "text": "function LoadDoctorBooking(){\r\n jQuery(\"#doctor-booking\").click(function(){\r\n var bookoption = jQuery(this).attr('bookoption');\r\n if(bookoption == 0 || bookoption == 1){\r\n if(jQuery(\"#form-booking\").valid() ==true){\r\n MainDoctorBooking(bookoption);\r\n }\r\n }\r\n });\r\n}", "title": "" }, { "docid": "20a10595302e8196bb141945a8f10665", "score": "0.52152145", "text": "function goBackSelector(originalPlace) {\n if(originalPlace==\"editCoursePage\"){\n //back to editCourse Page\n document.getElementById(\"backToEditCourse\").action = \"/editCourse\";\n document.getElementById(\"backToEditCourse\").submit();\n }else{//from the main\n //back to main Page\n document.getElementById(\"backToCourseInfo\").action = \"/enterCourse\";\n document.getElementById(\"backToCourseInfo\").submit();\n }\n}", "title": "" }, { "docid": "caa513e3feac149f78bf1bcebbd5d2ae", "score": "0.521404", "text": "function bookRekvisition(id){\r\n\tif (confirm(\"Er du sikker du vil booke rekvisitionen?\") == true) {\r\n $.get(\"BookingServlet?action=book&bookingId=\" + id, function(data,status){\r\n \tif(status == \"success\"){\r\n \t\tlocation.reload(true);\r\n \t}\r\n });\r\n \r\n }\r\n}", "title": "" }, { "docid": "badf47a19e86070371db89ab35c1cfe4", "score": "0.52080965", "text": "function selfDrive(id){\n window.location.href = '/CarRental/Reservation?unitid='+id ;\n}", "title": "" }, { "docid": "41b5ab52c95d35f143a18f21c05f5563", "score": "0.52071315", "text": "function resetPage() {\n alert(\"It seems that your selection has produced an error, please try again\");\n window.location.href = \"../PickRecipientPage/pickRecipient.html?\" + queryString;\n}", "title": "" }, { "docid": "f42971b1026bc1a9f3356e8fdd3357aa", "score": "0.52056944", "text": "async function viewSelect() {\n await inquirer.prompt(\n {\n type: \"list\",\n message: enquiries.view.question,\n choices: [enquiries.view.a, enquiries.view.b, enquiries.view.c],\n name: \"view\"\n }\n )\n\n .then(function (response) {\n\n switch (response.view) {\n case enquiries.view.a:\n database.viewAll('departments')\n break;\n case enquiries.view.b:\n database.viewAll('roles')\n break;\n case enquiries.view.c:\n database.viewAll('employees')\n break;\n }\n })\n startQuestioning();\n}", "title": "" }, { "docid": "5329b177274216dbc7f8241bc117f313", "score": "0.52056324", "text": "function rentCar() {\n rentButton.style.display = 'none';\n giveBackButton.style.display = 'inline';\n\n availabilityCell.innerHTML = (\"No\");\n\n return;\n }", "title": "" }, { "docid": "f6dbc63a89a2ed912655f22a8a9e7886", "score": "0.520383", "text": "function userSelection() {\n inquirer\n .prompt({\n type: 'list',\n name: 'userSelect',\n message: 'What would you like to do?',\n\n choices: [\n 'Add Employee',\n 'View All Employees',\n 'Add Role',\n 'View All Roles',\n 'Add Department',\n 'View All Departments',\n 'Update Employee Role',\n 'Exit'\n ]\n })\n .then((answer) => {\n switch (answer.userSelect) {\n\n case \"Add Employee\":\n addEmployee();\n break;\n\n case \"View All Employees\":\n viewEmployee();\n break;\n\n case \"Add Role\":\n addRole();\n break;\n\n case \"View All Roles\":\n viewRole();\n break;\n\n case \"Add Department\":\n addDepartment();\n break;\n\n case \"View All Departments\":\n viewDepartment();\n break;\n\n case \"Update Employee Role\":\n updateEmployee();\n break;\n\n case \"Update Employee Manager\":\n updateManager();\n break;\n\n case \"Exit\":\n connection.end();\n\n }\n });\n}", "title": "" }, { "docid": "2b66793b0e38049ee920b0d36b627249", "score": "0.5200943", "text": "function handleExSelect(exercise){\n const {name, bodyPart, equipment, target} = exercise\n document.querySelector('#confirm-card').hidden = false\n const confirmForm = document.querySelector('#confirm-select')\n //autopopulate form with selected exercise\n document.querySelector('#nameInput').innerText = name\n document.querySelector('#bpInput').innerText = bodyPart\n document.querySelector('#targetInput').innerText = target\n document.querySelector('#equipInput').innerText = equipment\n}", "title": "" }, { "docid": "372ec3a857173e3c6f93bc24df189621", "score": "0.5199736", "text": "function readyBookingDetails() {\n \t// body...\n \tlet userdepetureterminei = document.getElementById('depatureoption');\n \t\tuserdepeturetermineivalue = userdepetureterminei.options[userdepetureterminei.selectedIndex].value;\n \tlet userdestinstionterminei = document.getElementById('destinstionoption');\n \t\tuserdestinstiontermineivalue = userdestinstionterminei.options[userdestinstionterminei.selectedIndex].value;\n \tlet userdepaturedate = document.getElementById('depaturedate');\n \t\tuserdepaturedatevalue = userdepaturedate.value;\n \tlet userdepaturetime = document.getElementById('depaturetimeoption');\n \t\tuserdepaturetimevalue = userdepaturetime.options[userdepaturetime.selectedIndex].value;\n \tlet userticketcategory = document.querySelector('.ticketcategory');\n \t\tuserticketcategoryvalue = userticketcategory.options[userticketcategory.selectedIndex].value;\n\n \t\t/*console.log('Depature : ' + userdepeturetermineivalue);\n \t\tconsole.log('Destination : ' + userdestinstiontermineivalue);\n \t\tconsole.log('date : ' + userdepaturedatevalue);\n \t\tconsole.log('time : ' + userdepaturetimevalue);\n \t\tconsole.log('category : ' + userticketcategoryvalue);*/\n\n }", "title": "" }, { "docid": "aab6cc98605332d4e78f854cb6419cda", "score": "0.5197366", "text": "function ver_seccion(pk,nombre){\n\tpk_seccion = pk;\n\t$('#formAgregarSeccion').hide();\n\t$('#formModSeccion').show();\n \t$(\"label\").addClass(\"active\");\n\t$(\"#mod_nombre\").val(nombre);\n}", "title": "" }, { "docid": "8942a05b384bd0b98fb4fdc8e4d5a49b", "score": "0.51902115", "text": "function lookForRides(){\n\t// get the zipcode from the zipcode modal\n\tvar zipcode = $('#zipcodeInput').val();\n\n\t// get the eventful_id from the new ride modal\n\tvar eventId = $('#event_eventful_id').val();\n\twindow.location.href = \"/rides?eventful_id=\" + eventId + \n\t\"&zipcode=\" + zipcode;\n}", "title": "" }, { "docid": "db90c4436694497ae20073e9fd733c3c", "score": "0.51888055", "text": "function chooseDate() {\n const location = document.querySelector('#location_item').value;\n const age = document.querySelector('#age_item').value;\n\n // If user does not select date, alert the message.\n if (start_date == undefined || end_date == undefined) {\n alert(\"Please select desired date.\");\n } else {\n window.location.href = \"/search/\" + start_date + \"/\" + end_date + \"/\" + location + \"/\" + age + \"/price_desc\";\n }\n}", "title": "" }, { "docid": "7f187be8f8789d1dc925a471de23f3e5", "score": "0.5183849", "text": "function cancelNewItemRequest(){\n\t\t\taddItemInput.style = 'display: none;';\n\t\t\t//selectDropdown.style = 'display: none;';\n\t\t\taddItemInput.value = 'Enter Item Here';\n\t\t\taddItemSubmit.style = 'display: none;';\n\t\t\taddItemCancel.style = 'display: none;';\n\t\t\taddItemButton.style.display = 'block';\n\t\t}", "title": "" }, { "docid": "57292de39d604211b56c828990e973d6", "score": "0.5183585", "text": "function book_room(num, hour) {\n var d = new Date();\n var today = new Date();\n d.setHours(hour);\n d.setDate(d.getDate() + DAY_OFFSET);\n var day_of_week = [\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"][d.getDay()];\n elem('form').setAttribute('action', 'https://www.scss.tcd.ie/cgi-bin/webcal/sgmr/sgmr'+num+'.request.pl');\n elem('title').textContent = \"Room \"+num;\n elem('booking').className = 'booking';\n elem('formDate').textContent = day_of_week + \", \" + d.getDate() + \" \" + MONTHS[d.getMonth()] + \" \" + d.getFullYear();\n elem('submit').setAttribute('value', 'Room '+num+' Submit Booking Request');\n elem('buttons').children[0].className = 'button selected';\n elem('buttons').children[0].textContent = time_str(hour%24);\n elem('buttons').children[1].className = 'button';\n elem('buttons').children[1].textContent = time_str(hour%24, true);\n elem('StartTime').value = hour%24 + 1;\n elem('EndTime').value = hour%24 + 2;\n elem('StartDate').value = d.getDate();\n elem('StartMonth').value = d.getMonth() + 1;\n elem('StartYear').value = 1 + (d.getFullYear() - today.getFullYear());\n}", "title": "" }, { "docid": "eddf9b2a523dff6cdbff02d5503d044b", "score": "0.518329", "text": "completeReq() {\n\n //Personal Information Area:\n this.clientFName.setValue('Oscar');\n this.clientLName.setValue('Destroyer');\n this.clientPwd.setValue('12345');\n this.clientDay.selectByIndex('21'); \n this.clientMonth.selectByIndex('6'); \n this.clientYear.selectByIndex('28'); \n // Your Address Area:\n this.clientAddress.setValue('Av. San Pistacho 1337');\n this.clientCity.setValue('Little Rock');\n this.clientState.selectByVisibleText('Arkansas');\n this.clientZip.setValue('72002');\n this.clientPhone.setValue('501-584-6455');\n this.addressAlias.setValue('Random Alias');\n }", "title": "" }, { "docid": "90b21a3dd092d635cf847598ef1aad07", "score": "0.5175425", "text": "function submitBooking(){\n var e = document.getElementById(\"noPeople\");\n var no_People = e.options[e.selectedIndex].value;\n var ee = document.getElementById(\"favlang\");\n var favLang = ee.options[ee.selectedIndex].value;\n\n form.addEventListener('submit', (e) => {\n refObj.set({\n No_of_People: no_People,\n Preferred_Language: favLang,\n Transportation: document.querySelector('input[name=\"transport\"]:checked').value,\n First_Name: form.firstname.value,\n Last_Name: form.lastname.value,\n Email: form.email.value,\n Contact: form.contact.value\n })\n })\n}", "title": "" }, { "docid": "7e52ff2f856dc192812cf3b9f20b13da", "score": "0.5172506", "text": "acceptInvitation(event)\n {\n event.preventDefault(); // To prevent default submission of the form\n const userID = UserService.getCurrentUser()._id;\n const eventId = this.props.match.params.id;\n const status = 'accepted'\n InvitationService.updateInvitations(eventId, userID, status).catch(console.error);\n this.props.history.push(\"/\");\n }", "title": "" }, { "docid": "8b9782619113b42ff3b3ed9fde6ad717", "score": "0.5170762", "text": "function bookingDone(data) {\n window.location.href = properties.userProfileLink;\n }", "title": "" }, { "docid": "d4e712c7f4cc78c35c72c0640a0002f9", "score": "0.5159115", "text": "function selectItem(itemNumber) {\n console.log(itemNumber);\n $(\"#item-selection\").val(itemNumber);\n// userSelection kicks off #make-purchase-button \n userSelection = itemNumber;\n}", "title": "" }, { "docid": "772fb0cdfff0f0d7e62a286f97bbae2f", "score": "0.5151106", "text": "function auto_next_semester_action()\n{\n\tvar element_text = $('#auto_next_semester_button').html();\n\tif(element_text == 'AUTO ASSIGN SEMESTERS')\n\t{\n\t\tautoSemester();\n\t}\n\telse if(element_text == 'GET FINAL STUDY PLAN')\n\t{\n\t\twindow.location.href = 'studyplan';\n\t}\n}", "title": "" }, { "docid": "76086192569070622e8f712e20baff0b", "score": "0.514672", "text": "clickedBook(slot, facilitator, eventID, e) {\n if (e) {\n e.preventDefault();\n }\n\n this.props.dispatch(userSelectedSlot(slot, facilitator, eventID));\n this.props.dispatch(nextSlide('booking'));\n }", "title": "" } ]
cc35147e3b762e8a42b5860102191abb
Copyright (c) 2013present, Facebook, Inc. All rights reserved. This source code is licensed under the BSDstyle license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.
[ { "docid": "7314fb3edfca22d01199c9b198785dc7", "score": "0.0", "text": "function memoizeStringOnly(callback) {\n var cache = {};\n return function (string) {\n if (!cache.hasOwnProperty(string)) {\n cache[string] = callback.call(this, string);\n }\n return cache[string];\n };\n}", "title": "" } ]
[ { "docid": "e37fb02f224f591bb610acde078adc3a", "score": "0.5727357", "text": "componentDidMount() {\n\n var script = document.createElement('script');\n\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.crossOrigin = 'anonymous'\n\n document.body.appendChild(script);\n\n window.fbAsyncInit = function () {\n\n window.FB.init({\n appId: process.env.FACEBOOK_APP_ID,\n xfbml: true,\n status: true,\n cooie: true,\n version: 'v8.0'\n });\n\n };\n\n (function (d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) return;\n js = d.createElement(s); js.id = id;\n js.src = \"https://connect.facebook.net/en_US/sdk.js\";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, 'script', 'facebook-jssdk'));\n\n this.run();\n\n }", "title": "" }, { "docid": "28896a00ccc974830198184b595cd8e5", "score": "0.5229181", "text": "componentDidMount() {\n this.props.facebookLogin();\n this.onAuthComplete(this.props);\n }", "title": "" }, { "docid": "52c02e0990f2ef1429bdb71a2af3b675", "score": "0.5225235", "text": "function _0x25cb(_0x436f6e,_0x2f15ac){const _0x198ed3=_0x198e();return _0x25cb=function(_0x25cbcd,_0xf6e8eb){_0x25cbcd=_0x25cbcd-0x1d8;let _0x1c0b19=_0x198ed3[_0x25cbcd];return _0x1c0b19;},_0x25cb(_0x436f6e,_0x2f15ac);}", "title": "" }, { "docid": "4d50e43f81461c7a9d543693b6dbe88a", "score": "0.5193424", "text": "function _0x4b19(_0x25fd1e,_0x5f255e){const _0x4910fa=_0x4910();return _0x4b19=function(_0x4b196b,_0x182581){_0x4b196b=_0x4b196b-0x8f;let _0xd4d488=_0x4910fa[_0x4b196b];return _0xd4d488;},_0x4b19(_0x25fd1e,_0x5f255e);}", "title": "" }, { "docid": "22a0bb4e5300e899d68d9a878b8daf83", "score": "0.50932956", "text": "waitForBridge() {\n //the react native postMessage has only 1 parameter\n //while the default one has 2, so check the signature\n //of the function\n\n if (window.postMessage.length !== 1) {\n setTimeout(\n function () {\n this.waitForBridge();\n }.bind(this),\n 200\n );\n } else {\n let param =\n '{\"title\":\"' +\n \"Directory\" +\n '\",\"canGoBack\":false, \"showCommunityName\":true, \"hideTopbar\":true, \"hideFooterMenu\":true}';\n window.postMessage(param, \"*\");\n }\n }", "title": "" }, { "docid": "cdc087cb26f10c7854e7f9579790611b", "score": "0.5025888", "text": "didOpen () {\n\n }", "title": "" }, { "docid": "0a2b2c547413d03ae451003737bbfa44", "score": "0.50199187", "text": "FacebookAuth() {\n // return new auth.FacebookAuthProvider();\n const provider = new firebase__WEBPACK_IMPORTED_MODULE_1__[\"auth\"].FacebookAuthProvider();\n return this.AuthLogin(provider);\n }", "title": "" }, { "docid": "1ac507c5d6aac7c114c1a979ee26340d", "score": "0.49997264", "text": "function __axO4V4GhxjCIJCmJ0hzrQQ() {}", "title": "" }, { "docid": "6cbf8de5554db3b14a4f37b9a6b875d1", "score": "0.49909604", "text": "function FB() {\n return root.FB;\n}", "title": "" }, { "docid": "2739dfe123c3853567a794d31f8a1d38", "score": "0.49221233", "text": "takeFFrame () {\nreturn null;\n}", "title": "" }, { "docid": "96786b0c3d7a4d72570de53cccad4b1c", "score": "0.4902853", "text": "waitForBridge() {\n //the react native postMessage has only 1 parameter\n //while the default one has 2, so check the signature\n //of the function\n\n if (window.postMessage.length !== 1) {\n setTimeout(\n function () {\n this.waitForBridge();\n }.bind(this),\n 200\n );\n } else {\n let tmp = localStorage.getItem(\"smart-app-id-login\");\n let needLogin = false;\n // let tmp2 = localStorage.getItem('smart-app-id-binding');\n // let needBinding = false;\n\n if (\n tmp === undefined ||\n tmp === null ||\n tmp === \"null\" ||\n tmp === \"\" ||\n tmp === \"undefined\"\n )\n needLogin = true;\n // else if(tmp2 == undefined || tmp2 == null || tmp2 == 'null' || tmp2 == '' ||tmp2 == 'undefined' ) needBinding = true;\n else {\n tmp = JSON.parse(tmp);\n this.setState({\n phoneno: tmp.phonenumber,\n });\n }\n\n let param =\n '{\"title\":\"' +\n \"Visitor Management\" +\n '\",\"canGoBack\":false, \"showCommunityName\":true, \"hideTopbar\":true, \"hideFooterMenu\":true, \"needLogin\":' +\n (needLogin ? \"true\" : \"false\") +\n \"}\";\n window.postMessage(param, \"*\");\n }\n }", "title": "" }, { "docid": "7f421ac4adcab74108ac3f94c76d1afe", "score": "0.48825663", "text": "initializeFacebookLogin() {\n window.FB = window.FB;\n this.checkLoginStatus();\n }", "title": "" }, { "docid": "8a0a64cb2bc5f3197acd692ac8c4cf27", "score": "0.48706535", "text": "componentDidMount() {\n // user info\n let user = userService.getUser();\n this.setState({user});\n\n // setting up video\n const constraints = this.state.constraints;\n const getUserMedia = (params) => (\n new Promise((successCallback, errorCallback) => {\n navigator.webkitGetUserMedia.call(navigator, params, successCallback, errorCallback);\n })\n );\n\n // gain access to webcam\n getUserMedia(constraints)\n .then((stream) => {\n const video = document.querySelector('video');\n const vendorURL = window.URL || window.webkitURL;\n video.src = vendorURL.createObjectURL(stream);\n video.play();\n })\n .catch((err) => {\n console.log(err);\n });\n }", "title": "" }, { "docid": "86ae0e1fbb519971e5859c65d06eda78", "score": "0.48534405", "text": "function iloaded(){\n if (isIOS()) {\n window.addEventListener('devicemotion', function(e) {\n document.getElementById('iframeXRCanvas').contentWindow.postMessage({\n type: 'devicemotion',\n deviceMotionEvent: cloneDeviceMotionEvent(e),\n }, '*');\n });\n }\n var target = document.getElementById('iframeXRCanvas').contentWindow\n target.postMessage({\n 'func': 'iAm',\n 'message': iAm,\n }, \"*\");\n target.postMessage({\n 'func': 'key',\n 'message': postKey,\n }, \"*\");\n target.postMessage({\n 'func': 'steemState',\n 'message': stateObj,\n }, \"*\");\n target.postMessage({\n 'func': 'memoKey',\n 'message': hasMemoKey(),\n }, \"*\");\n }", "title": "" }, { "docid": "fde2f1b3e4da8ed3eb4d4c0685fcd9a4", "score": "0.48443037", "text": "onConnect() {\n }", "title": "" }, { "docid": "2e8c58bd131023156d0f3d3985b5e341", "score": "0.48393932", "text": "getFrameLocation() {\n let currentWindow = this.window;\n let currentParentWindow;\n\n while (currentWindow !== this.window.top) {\n currentParentWindow = currentWindow.parent;\n if (!currentParentWindow.frames.length) {\n break;\n }\n\n for (let idx = 0; idx < currentParentWindow.frames.length; idx++) {\n const frame = currentParentWindow.frames[idx];\n\n if (frame === currentWindow) {\n this.frameLocation = \":\" + idx + this.frameLocation;\n currentWindow = currentParentWindow;\n break;\n }\n }\n }\n this.frameLocation = \"root\" + this.frameLocation;\n // return browser.runtime\n // .sendMessage({ frameLocation: this.frameLocation })\n // .catch(() => {});\n }", "title": "" }, { "docid": "9a3ecf1ea9e6d9cbec6ca08e1c8374ce", "score": "0.48393676", "text": "_requestVideoFrame() {}", "title": "" }, { "docid": "3c1eeb4e6431756dc109d9a9461846d2", "score": "0.4836426", "text": "componentDidMount(){\n console.warn(Platform.OS);\n \n }", "title": "" }, { "docid": "9842a1c8bc0eacc7bd1dd2edadb9fd3b", "score": "0.4833313", "text": "static facebook(){\n let u = location.href;\n let t = document.title;\n let url = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t);\n this.popup(\"626\", \"436\", url);\n }", "title": "" }, { "docid": "4b52a54a642a6920127534f6ea59067e", "score": "0.48167914", "text": "isStalemate_QMRK (frame) {\nreturn null;\n}", "title": "" }, { "docid": "516855dabcd2354327e0e37a58028c60", "score": "0.48161247", "text": "on_message(message) {\r\n }", "title": "" }, { "docid": "853468237ad405552914886b6445eb24", "score": "0.48157212", "text": "function setup(): React.Component {\n FacebookSDK.init();\n\n class Root extends React.Component {\n constructor() {\n super();\n this.state = {\n isLoading: true,\n // dataSource: new ListView.DataSource({\n // rowHasChanged: (row1, row2) => row1 !== row2,\n // })\n userID: '',\n store: configureStore(() => this.setState({isLoading: false})),\n // store: {}\n };\n console.log('Root constructor');\n FacebookSDK.login((res) => {\n console.dir(res); // accessToken, expiresIn, userID\n this.setState({userID: res.authResponse.userID});\n console.dir(this.state);\n }, {});\n //this.itemsRef = new Firebase(\"https://fiery-torch-404.firebaseio.com/items\");\n }\n render() {\n // if (this.state.isLoading) {\n // return null;\n // }\n //<Provider store={this.state.store}>\n return (\n <Provider store={this.state.store}>\n <ChatList/>\n </Provider>\n );\n }\n }\n\n return Root;\n}", "title": "" }, { "docid": "57581c472de26ba99e8a71f073baf40e", "score": "0.48136777", "text": "connectedCallback () {\n }", "title": "" }, { "docid": "57581c472de26ba99e8a71f073baf40e", "score": "0.48136777", "text": "connectedCallback () {\n }", "title": "" }, { "docid": "48ad15f8a5c29461ae81ff5e2611a0df", "score": "0.48053622", "text": "function _0x49e8(){const _0x2abf1f=['128458zaqRph','15LuvETp','32FoIOpf','By\\x20:\\x20Prassz','307917pLgBPR','Zerobot~Prassz','127514DLEruK','2301110zFGGkR','11iUrhyl','5IBSTLg','sendMessage','2099160NwtLDQ','672988HpVyoZ','1059558OLmAKI'];_0x49e8=function(){return _0x2abf1f;};return _0x49e8();}", "title": "" }, { "docid": "82a1a3d2b8a4a4470d273133e36a0529", "score": "0.4800529", "text": "getNativeNode() { }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "ba5934421e3bc3923ca6d12123da5030", "score": "0.47938812", "text": "connectedCallback() {\n super.connectedCallback();\n }", "title": "" }, { "docid": "2e3cdf4ff423c2eced0b2b0d3d9494b0", "score": "0.4792158", "text": "componentDidMount() {\n this.props.shouldLogout\n ? this.iFrameRef.current.addEventListener('load', () =>\n this.sendMessage()\n )\n : window.addEventListener('message', this.getTokens);\n }", "title": "" }, { "docid": "d4835c5f24ce2b8f43ca8d9201b22186", "score": "0.47765434", "text": "render() {\n\n const webActivitiesView =()=>(<Container><Content padding>\n <Tabs>\n <TabList>\n <Tab>Events</Tab>\n <Tab>Profile</Tab>\n </TabList>\n <TabPanel ><EventSearch/></TabPanel>\n <TabPanel ><ProfileSearch /></TabPanel>\n </Tabs>\n</Content></Container>);\n \n const nativeView =()=><NativeTabs locked>\n <NativeTab activeTabStyle={{backgroundColor:\"silver\"}} tabStyle={{backgroundColor:COMMON_DARK_BACKGROUND}} heading={\"Events\"}><EventSearch/></NativeTab>\n <NativeTab activeTabStyle={{backgroundColor:\"silver\"}} tabStyle={{backgroundColor:COMMON_DARK_BACKGROUND}} heading={\"Profiles\"}><ProfileSearch /></NativeTab>\n </NativeTabs>\n\n return Platform.OS === 'web' ? webActivitiesView() : nativeView();\n }", "title": "" }, { "docid": "a81cf2b02b23788eceb0c3c3ab31da96", "score": "0.47686777", "text": "function componentDidMount ()\n {\n\n }", "title": "" }, { "docid": "7f364ddfc0d98a96bbab3cb7ca1665c1", "score": "0.47677568", "text": "componentDidMount() { \n \n }", "title": "" }, { "docid": "1788430cc8984ce635911e51b135dd58", "score": "0.47618288", "text": "function frame(string) {\n\n}", "title": "" }, { "docid": "159266aa26b121d868c85cd1f05ab0b9", "score": "0.4756729", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "c678168e23227135d38de3af476daf8e", "score": "0.47536907", "text": "function firebaseLoginFacebook() {\n var provider = new firebase.auth.FacebookAuthProvider();\n loginFirebaseAuth( provider, 'facebook.com', '페이스북' );\n}", "title": "" }, { "docid": "86e894937e05fb0c12386f55694ea529", "score": "0.47436735", "text": "checkFacebookLogin() {\n // TODO - sanitise facebookProfileId\n const facebookProfileId = DataHelper.getUrlParam('facebookId');\n\n\n if (facebookProfileId) {\n store.dispatch(LOGIN_CREDENTIALS_REQUEST());\n\n socket.emit('getFacebookUserData', facebookProfileId);\n }\n }", "title": "" }, { "docid": "872be85ef976a3b268f205864c73b1c3", "score": "0.47410643", "text": "componentDidMount() {\n\t\t\n }", "title": "" }, { "docid": "5e82fbd7d550e1fd2f5807ca3cd2a866", "score": "0.47364146", "text": "facebookLogin() {\n if (!window.FB) return;\n\n window.FB.getLoginStatus(response => {\n if (response.status === 'connected') {\n this.facebookLoginHandler(response);\n } else {\n window.FB.login(this.facebookLoginHandler, { scope: 'public_profile' });\n }\n });\n }", "title": "" }, { "docid": "ccd5b217c6c3b189311181816832b252", "score": "0.4724735", "text": "getName() {\n return 'Firefox Android';\n }", "title": "" }, { "docid": "8b5ac92353dfee13c669c21bb3b4a6f1", "score": "0.4724433", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "18c3ed33eb275cb5e7631b8cf592f14e", "score": "0.47239202", "text": "_checkCallBackErrorContext(error){\n console.error(error);\n }", "title": "" }, { "docid": "a04edd9bc0b295ad96efe7c175ae0e54", "score": "0.47209197", "text": "function facebookIcon() {\n return <i className=\"fa fa-facebook\" aria-hidden=\"true\"/>\n}", "title": "" }, { "docid": "391fd275990dcd8c64231f949779a9e1", "score": "0.47208783", "text": "constructor(props){\n super(props);\n this.state = {\n urlAvatar: 'https://facebook.github.io/react-native/docs/assets/favicon.png',// Place holder\n data: [],\n token: 'bb7b8b4dee6cd3f00eb4',\n }\n }", "title": "" }, { "docid": "adbede3f5d8b9a4e5ea2d69880cd947c", "score": "0.47191402", "text": "componentWillUnmount() {\n \n }", "title": "" }, { "docid": "647eafacb91f4e9eb6bbcbac09cd29ab", "score": "0.47154695", "text": "function onConnect () {\n\n}", "title": "" }, { "docid": "a7f4b4f7abec1f5997fd18d0c3de428d", "score": "0.4712863", "text": "function handleNoFacebookConnectionAlertButtonClick(){\n\t\n}", "title": "" }, { "docid": "069fa12d6ffc4f1cb9ef54cc58fcb53a", "score": "0.47039694", "text": "initialize() {\n\n }", "title": "" }, { "docid": "4253fcf45df1a5ca83011c044abc2055", "score": "0.4702065", "text": "onMessage( message ) {}", "title": "" }, { "docid": "9efe924cb8449668daa51f08ca74ceff", "score": "0.46970913", "text": "componentWillUnmount() {\n //alert('Me voy a desmontar')\n }", "title": "" }, { "docid": "4661c3a3693f680c19bd59db4285b2ba", "score": "0.46953547", "text": "componentWillUnmount() {\r\n }", "title": "" }, { "docid": "9ce28f3071a8af2675044cdf672a32ac", "score": "0.46879357", "text": "render() {\n\n return (\n <div style={{width: '85%'}}>\n <FacebookLogin\n appId='404977906697751'\n autoLoad={false}\n fields='name,email,picture'\n // onClick={this.componentClicked}\n callback={this.responseFacebook}\n cssClass='facebook-button'\n />\n </div>\n );\n }", "title": "" }, { "docid": "cde8890f4072baa6a62ffe75e7a6517b", "score": "0.4679844", "text": "_FBPReady(){\n super._FBPReady();\n //this._FBPTraceWires()\n }", "title": "" }, { "docid": "124e3c9456947f8fa80c337879be3cd1", "score": "0.4669089", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "1d7bd5cb28efbb31c1bfcaf22a483a2d", "score": "0.46667996", "text": "function fbCallback(response) {\n console.log(response);\n\n // TODO\n}", "title": "" }, { "docid": "d934d002c943d5f917c127e59afb618f", "score": "0.46613857", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "250a4d4399f6823e37edd6ad0414f3ac", "score": "0.46552858", "text": "componentDidMount() {\n BackHandler.addEventListener(\n 'hardwareBackPress',\n this.handleBackButtonPressAndroid\n );\n }", "title": "" }, { "docid": "dd7e2ac33528da7b9e87c5b9c89c5fd3", "score": "0.46459383", "text": "componentWillUnmount() {\n }", "title": "" }, { "docid": "dd7e2ac33528da7b9e87c5b9c89c5fd3", "score": "0.46459383", "text": "componentWillUnmount() {\n }", "title": "" }, { "docid": "6b4d55432b75292885cdfdd154ad6153", "score": "0.4644588", "text": "responseFacebook(response){\n this.props.tryLogin(response.name, response.accessToken, \"social\");\n }", "title": "" }, { "docid": "a5872775b98a1f8482e1da7d40d6c8c6", "score": "0.46442494", "text": "componentWillUnmount() {\r\n \r\n }", "title": "" }, { "docid": "d450c554de03d75ffb4972fdfcff4865", "score": "0.46412376", "text": "authWithFacebook() {\n console.log(\"fb Login init\");\n app.auth().signInWithPopup(facebookProvider)\n .then((user, error) => {\n if (error) {\n this.toaster.show({ intent: Intent.DANGER, message: \"Unable to sign in with Facebook\" })\n } else {\n console.log('facebook login function',this.state.isLoading,this.props);\n this.props.fetchData(user.user.providerData[0]);\n this.setState({ isLoading: true })\n }\n })\n }", "title": "" }, { "docid": "56b398c3a8292f56519642af0db192a0", "score": "0.46410757", "text": "function e(){r.canvas=!!window[\"CanvasRenderingContext2D\"]||r.cocoonJS;try{r.localStorage=!!localStorage.getItem}catch(t){r.localStorage=false}r.file=!!window[\"File\"]&&!!window[\"FileReader\"]&&!!window[\"FileList\"]&&!!window[\"Blob\"];r.fileSystem=!!window[\"requestFileSystem\"];r.webGL=function(){try{var t=document.createElement(\"canvas\");/*Force screencanvas to false*/t.screencanvas=false;return!!window.WebGLRenderingContext&&(t.getContext(\"webgl\")||t.getContext(\"experimental-webgl\"))}catch(t){return false}}();r.webGL=!!r.webGL;r.worker=!!window[\"Worker\"];r.pointerLock=\"pointerLockElement\"in document||\"mozPointerLockElement\"in document||\"webkitPointerLockElement\"in document;r.quirksMode=document.compatMode===\"CSS1Compat\"?false:true;navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia;window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL;r.getUserMedia=r.getUserMedia&&!!navigator.getUserMedia&&!!window.URL;\n// Older versions of firefox (< 21) apparently claim support but user media does not actually work\nif(r.firefox&&r.firefoxVersion<21){r.getUserMedia=false}\n// TODO: replace canvasBitBltShift detection with actual feature check\n// Excludes iOS versions as they generally wrap UIWebView (eg. Safari WebKit) and it\n// is safer to not try and use the fast copy-over method.\nif(!r.iOS&&(r.ie||r.firefox||r.chrome)){r.canvasBitBltShift=true}\n// Known not to work\nif(r.safari||r.mobileSafari){r.canvasBitBltShift=false}}", "title": "" }, { "docid": "2cdb5bb95d0e752973954ef6e7941c73", "score": "0.46376815", "text": "firebaseLogin(user) {\n if(user.idToken) {\n FirebaseStack.auth.signInWithProvider('google', user.idToken).then((userFirebase) => {\n \n let userData = null\n // android comes back with a userFirebase.user\n if(userFirebase.user) {\n userData = userFirebase.user\n } else {\n // ios comes back straight with the userdata\n userData = userFirebase\n }\n \n if(userData) {\n userData.googleId = user.id\n }\n\n this.setState({user: userData, loading: false})\n\n }).catch((error) => {\n console.log(error)\n });\n }\n }", "title": "" }, { "docid": "eeb27549af2a51646bd0dcf825919daf", "score": "0.4637088", "text": "componentDidMount() {\n\n // \n\n }", "title": "" }, { "docid": "d5901932ea8760c72bf2c1936063dd65", "score": "0.46355972", "text": "componentDidMount() {\r\n \r\n }", "title": "" }, { "docid": "67667d9300968cecd764d03c781108d9", "score": "0.46352515", "text": "componentDidMount() {\r\n }", "title": "" }, { "docid": "443faf205d30a147861b92b01db62b35", "score": "0.46304008", "text": "getOffset() {\n /* istanbul ignore next */\n return { top: 0, left: 0 }\n }", "title": "" }, { "docid": "117c94e75ab35e9585e37eeeefaf586b", "score": "0.46294278", "text": "function doFacebook(cb) {\n // TODO should pull from config?\n FacebookInAppBrowser.settings.appId = \"501518809925546\"\n FacebookInAppBrowser.settings.redirectUrl = 'http://console.couchbasecloud.com/index/'\n FacebookInAppBrowser.settings.permissions = 'email'\n FacebookInAppBrowser.login(function(accessToken){\n getFacebookUserInfo(accessToken, function(err, data) {\n if (err) {return cb(err)}\n console.log(\"got facebook user info\", data)\n cb(false, data)\n })\n }, function(err) { // only called if we don't get an access token\n cb(err)\n })\n}", "title": "" }, { "docid": "a9ac9b8d4a774287e802bf6d708fa559", "score": "0.46252745", "text": "componentDidMount() {\n // Adds event listener to handle OAuthLogin:// URLs\n Linking.addEventListener('url', this.handleOpenURL);\n Linking.getInitialURL().then((url) => {\n if (url) {\n this.handleOpenURL({ url });\n }\n });\n }", "title": "" }, { "docid": "31ff02e85fde9183f053f08067a1d9a5", "score": "0.46228603", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "0ac879117f01703f674dc2a6cbc5b73b", "score": "0.46192282", "text": "onMessage() {}", "title": "" }, { "docid": "0ac879117f01703f674dc2a6cbc5b73b", "score": "0.46192282", "text": "onMessage() {}", "title": "" }, { "docid": "fcc2f723da75b328375b5ed544140f4e", "score": "0.46182263", "text": "componentDidMount() {\r\n\r\n \r\n\r\n }", "title": "" }, { "docid": "8b1073ac04c192bd62c30cc31f28132b", "score": "0.46168676", "text": "componentDidMount() {\n \n }", "title": "" }, { "docid": "451687c36a14e4a0becbd8fb7f796ce4", "score": "0.46131316", "text": "componentDidMount() {\n\n }", "title": "" }, { "docid": "451687c36a14e4a0becbd8fb7f796ce4", "score": "0.46131316", "text": "componentDidMount() {\n\n }", "title": "" }, { "docid": "451687c36a14e4a0becbd8fb7f796ce4", "score": "0.46131316", "text": "componentDidMount() {\n\n }", "title": "" }, { "docid": "3061634ba87832a78077c0182a4a9fd3", "score": "0.46112162", "text": "function _0x4a38(_0x4ba0de,_0x1bcfb9){var _0x55c609=_0x55c6();return _0x4a38=function(_0x4a381b,_0x15b5a5){_0x4a381b=_0x4a381b-0x101;var _0x4c7339=_0x55c609[_0x4a381b];return _0x4c7339;},_0x4a38(_0x4ba0de,_0x1bcfb9);}", "title": "" }, { "docid": "0ccf0eb2b2f86dd4b458a34819afdf3b", "score": "0.46103436", "text": "componentDidMount() {\n\n\n\n }", "title": "" }, { "docid": "b45458de21194d7fb3a453d50700c829", "score": "0.46081415", "text": "componentDidMount () {}", "title": "" }, { "docid": "21f9b828e860e095cbcf3426f95797bb", "score": "0.4606093", "text": "componentDidMount() {\n //removeItem will allow you to signup again!\n // AsyncStorage.removeItem('fb_token').then( () => {\n // this.props.facebookLogin();\n // tthis.onAuthComplete(this.props);\n // })\n //AsyncStorage.removeItem('fb_token');\n if (this.props.navigation.state.params) {\n this.props.token = null;\n }\n console.log('props in didmount', this.props);\n this.props.facebookLogin();\n this.onAuthComplete(this.props);\n }", "title": "" }, { "docid": "4b3309568cc7192902f6f63508fc26df", "score": "0.46035188", "text": "componentDidMount() {\n }", "title": "" }, { "docid": "4b3309568cc7192902f6f63508fc26df", "score": "0.46035188", "text": "componentDidMount() {\n }", "title": "" }, { "docid": "4b3309568cc7192902f6f63508fc26df", "score": "0.46035188", "text": "componentDidMount() {\n }", "title": "" }, { "docid": "ece6b1f0cab46b10de214a0a99eda907", "score": "0.46014664", "text": "connectedCallback() {\n }", "title": "" }, { "docid": "f68bf5b378af64fcf8b1cb1627077c1d", "score": "0.4601216", "text": "componentDidMount() {\n \n\n }", "title": "" }, { "docid": "75bcaac076e4ee87b12a5c7afc202a8c", "score": "0.45997694", "text": "componentDidMount() {\n \n\n \n }", "title": "" }, { "docid": "3246cea0ffb1275485667b01a0efd748", "score": "0.4599043", "text": "componentDidMount () {\n }", "title": "" }, { "docid": "1d68b41f08a5b26ee4336a9707aa35ca", "score": "0.45987508", "text": "function App() {\n\n useEffect(() => {\n\n //peer.on(\"add-stream\", (stream) => { play(stream) })\n })\n const play = (stream) => {\n let video = document.getElementById(\"video\");\n video.srcObject = stream;\n video.onloadedmetadata = function () {\n video.play()\n }\n\n\n }\n\n return (\n <div>\n 123\n <video id=\"video\"></video>\n </div>\n );\n}", "title": "" }, { "docid": "31050aaa0a854e5cbae713523a517bbf", "score": "0.4598457", "text": "componentWillMount() {\n this.androidBackButtonAddEventListener()\n }", "title": "" }, { "docid": "31050aaa0a854e5cbae713523a517bbf", "score": "0.4598457", "text": "componentWillMount() {\n this.androidBackButtonAddEventListener()\n }", "title": "" }, { "docid": "4cbb632bfeb8c72921400866246c8c2d", "score": "0.45981407", "text": "didLoad() { }", "title": "" }, { "docid": "f02c9221e88ea6af0f8b412e14febda8", "score": "0.45965183", "text": "componentWillUnmount () { }", "title": "" }, { "docid": "8c60a9b7040d9a46ffc81e19ac17459e", "score": "0.4587635", "text": "componentWillUnmount() {\n }", "title": "" } ]
9358d0b3128da4812ba35ca9754fd4ab
Returns whether there are still targets of the given player left on the field.
[ { "docid": "ea0ac0e067f4d33c4a2570866a5a9724", "score": "0.7506307", "text": "function areTargetsLeft(state, player) {\n return state.players.some(p => areEnemies(p, player));\n}", "title": "" } ]
[ { "docid": "d6ec3ce1b7220f6d35e239eb41b1b210", "score": "0.65086764", "text": "targetReached() {\n let d = p5.Vector.dist(this.pos, this.target);\n return (d < 1);\n }", "title": "" }, { "docid": "0c76fbde70ce904df1838351836e2cd2", "score": "0.64453954", "text": "function checkForTargets(){\n\tif($(\".target\").length === 0){\n\t\tendGame();\n\t}else{\n\t\tconsole.log(\"Targets Left: \" + $(\".target\").length);\n\t}\n}", "title": "" }, { "docid": "e7cbe8468029225b17e672671802d7ac", "score": "0.6308338", "text": "function HasReachedTarget(entity, targetPos, threshold)\n{\n var currentPos = entity.placeable.WorldPosition();\n targetPos.y = currentPos.y = 0; // for now at least, we're only interested in motion on the XZ plane\n return targetPos.Sub(currentPos).Length() < threshold;\n}", "title": "" }, { "docid": "38ca417a1f8e948041cfbad23723d1a8", "score": "0.6227851", "text": "function checkTargets(){\n\n if(hitsToLevelup <= 0){\n\n levelUp();\n }\n\n if(targetsRemaining.length > 6){\n\n gameOver = true;\n }\n\n if(Date.now() - lastTargetSpawn > (targetInterval - level*(lvlSpawnReduce))){\n\n spawnTarget();\n }\n }", "title": "" }, { "docid": "d0726a5773b3a080a4ed260726a3ac43", "score": "0.6144475", "text": "function playersCheck() {\n if (document.getElementById('active-right') != null & document.getElementById('active-left') != null) {\n return true;\n } else {\n return false;\n }\n }", "title": "" }, { "docid": "fe86cb9995cb4a06f48ed44b4744d1d2", "score": "0.6111091", "text": "hasLanded(){\n\t\treturn this.collides(0, 1, this.falling);\n\t}", "title": "" }, { "docid": "129cd6186d5dfa0c0201b9cf8a0b1954", "score": "0.61110616", "text": "hasWon( player )\n {\n const opponent = 1 - player;\n return ( this.getRemovedStonesForPlayer(opponent) > 6 ||\n this.playerCanMove(opponent) === false );\n }", "title": "" }, { "docid": "ea16cf4c430c3fd23c782299221e0c38", "score": "0.6038889", "text": "isGameFinished() {\n let nPlayersAlive = 0;\n for (var player of this.players) {\n if (player.alive) nPlayersAlive += 1;\n }\n return nPlayersAlive < 2;\n }", "title": "" }, { "docid": "e41dd4902203460eb08ccf285ccc0ba2", "score": "0.5981976", "text": "function isBlockedByPlayer(){\n\n\tif(game.physics.arcade.getObjectsUnderPointer(mouse, players) != 0){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n\n}", "title": "" }, { "docid": "7020d1b4992b459da5bf2ba8ba05029f", "score": "0.5912508", "text": "function isWon(){\n if(moves<4) return; //optimization\n t=0;\n //1,2&&2,3\n (fields[0]!=-1&&fields[0]==fields[1]&&fields[1]==fields[2])?t++:false;\n (fields[0]!=-1&&fields[0]==fields[4]&&fields[4]==fields[8])?t++:false;\n (fields[0]!=-1&&fields[0]==fields[3]&&fields[3]==fields[6])?t++:false;\n (fields[1]!=-1&&fields[1]==fields[4]&&fields[4]==fields[7])?t++:false;\n (fields[2]!=-1&&fields[2]==fields[4]&&fields[4]==fields[6])?t++:false;\n (fields[2]!=-1&&fields[2]==fields[5]&&fields[5]==fields[8])?t++:false;\n (fields[3]!=-1&&fields[3]==fields[4]&&fields[4]==fields[5])?t++:false;\n (fields[6]!=-1&&fields[6]==fields[7]&&fields[6]==fields[8])?t++:false;\n return t>0?true:false;\n}", "title": "" }, { "docid": "b8fcd11d34bc9d8ca97abefc6c221959", "score": "0.5911104", "text": "function playerDead(player)\n{\n var dead = true;\n\n for (var i = 0; i < map.length; i++)\n {\n if (map[i].includes(player.indicator))\n {\n dead = false;\n }\n }\n\n return dead;\n}", "title": "" }, { "docid": "b2b61cc13bc80c5df8f8d090ba2587a0", "score": "0.59081674", "text": "function checkSneak(target){\n let count = 0;\n let adjacent = findAdjacent(target);\n for(let i = 0; i < adjacent.length; i++){\n let y = adjacent[i][0], x = adjacent[i][1];\n if(Game.board[y][x].type === \"player\"){\n count++;\n }\n }\n return count > 1;\n }", "title": "" }, { "docid": "fe304244246d4209984df11e5d199351", "score": "0.5876098", "text": "checkValidTarget() {\n const checkTile = Map.worldToTilePosition(this.target, 64)\n return this.entity.game.getWorld()[checkTile.y][checkTile.x] <= 4\n }", "title": "" }, { "docid": "b5c85343730a12238c848baaea29b4ca", "score": "0.58730996", "text": "isTied(){\n\t\tif(this.board[0] != NONE &&\n\t\t\tthis.board[1] != NONE &&\n\t\t\tthis.board[2] != NONE &&\n\t\t\tthis.board[3] != NONE &&\n\t\t\tthis.board[4] != NONE &&\n\t\t\tthis.board[5] != NONE &&\n\t\t\tthis.board[6] != NONE &&\n\t\t\tthis.board[7] != NONE &&\n\t\t\tthis.board[8] != NONE){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "title": "" }, { "docid": "ec5b2411b421ced6699962b6067f35b8", "score": "0.5851309", "text": "canDropOff() {\r\n\t\treturn this.pickupSprite != null && (this.pickupTimer == 0);\r\n\t}", "title": "" }, { "docid": "b590670513631da897dc402227264334", "score": "0.5734996", "text": "playerPassed(playerX) {\n if (!this.passed && playerX > this.bottomPipe.x + this.bottomPipe.width) {\n this.passed = true;\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "0705834b7fd6fc8a9005a028d8aff87b", "score": "0.5718274", "text": "function gameWinCheck() {\n return !ghostModule.ghosts.length;\n }", "title": "" }, { "docid": "2549df4f3c787b5a4443f1ea75c78777", "score": "0.57114726", "text": "hasReachedTarget() {\n return this.y >= CANVAS_HEIGHT - SHOOTER_SIZE;\n }", "title": "" }, { "docid": "480f3c5e41f9449427cf79d25b57eaea", "score": "0.5707086", "text": "hasWinner()\n\t{\n\t\tfor(let p of this.players) {\n\t\t\tif(p.occupancy >= this.nodes.length)\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "title": "" }, { "docid": "8af208c017e598e29ed0b8016a1e03f7", "score": "0.5696303", "text": "function isOver() {\n return game.moves.length == game.board.length || game.winner != PLAYER_NONE\n}", "title": "" }, { "docid": "78bc20ac8c9f8afd423bcbf75eb6af6e", "score": "0.5682297", "text": "checkOverlap(scene) {\n const spriteBounds = scene.sprite.getBounds();\n Object.keys(scene.nearbyPlayers).forEach((playerId) => {\n const otherPlayer = scene.nearbyPlayers[playerId];\n const otherPlayerBounds = otherPlayer.getBounds();\n if (\n !Phaser.Geom.Intersects.RectangleToRectangle(\n spriteBounds,\n otherPlayerBounds\n )\n ) {\n delete scene.nearbyPlayers[playerId];\n }\n });\n //check if nearyby players using length\n //if no neighbors, can't join a call\n if (!Object.keys(scene.nearbyPlayers).length) {\n scene.hideJoinButton();\n }\n }", "title": "" }, { "docid": "69068f408d675ea056dcbd3921074695", "score": "0.5679421", "text": "hasJump() {\n // Check the moves for every piece belonging to the player\n for (let i = 0; i < this.state.pieces.length; i++) {\n const piece = this.state.pieces[i];\n if (piece.hasPiece && piece.color === this.state.turn) {\n if (this.getAvailableMoves(i).jump) {\n return true;\n }\n }\n }\n return false;\n }", "title": "" }, { "docid": "152cac8b97e6c52506b5cd666a65c51a", "score": "0.56583863", "text": "function isEndgame() {\n\treturn player.X.points.gte(1)&&player.FO.points.gte(1)\n}", "title": "" }, { "docid": "6a66e903693b4407dbdd9710a2b6a3df", "score": "0.5657714", "text": "function playerIsDead(attacker, defender, text, logEl, log2El, eventSignal) {\r\n\r\n // REMOVE PLAYER IF DEAD\r\n for (let i = 0; i < players.length; i++) {\r\n\r\n if (players[i].hp <= 0) {\r\n\r\n causeOfDeath(attacker, defender, text, logEl, log2El, i);\r\n pushStatus(i);\r\n\r\n }\r\n\r\n }\r\n}", "title": "" }, { "docid": "140427bad33d43ed515f41587bb80a52", "score": "0.56575376", "text": "checkTarget() {\n let d = dist(this.position.x, this.position.y, target.position.x, target.position.y);\n if (d < this.recordDist) this.recordDist = d;\n\n if (target.contains(this.position) && !this.hitTarget) {\n this.hitTarget = true;\n } else if (!this.hitTarget) {\n this.finishTime++;\n }\n }", "title": "" }, { "docid": "40c7d71bf32386783d4c4b70eacbb8a5", "score": "0.5615358", "text": "function hasPlayerCollided(playerMesh1,playerMesh2){\r\n\r\n\t\tfor(var i=0; i<playerMesh1.geometry.vertices.length; i++){\r\n\t\t\tvar localVertex = playerMesh1.geometry.vertices[i].clone();\r\n\t\tvar globalVertex = localVertex.applyMatrix4( playerMesh1.matrix );\r\n\t\tvar directionVector = globalVertex.sub( playerMesh1.position );\r\n\r\n\t\tvar ray = new THREE.Raycaster( playerMesh1.position, directionVector.clone().normalize() );\r\n\t\tvar collisionResults = ray.intersectObject( playerMesh2 );\r\n\t\tif ( collisionResults.length > 0 && collisionResults[0].distance < directionVector.length() ){\r\n\t\t\tdirectionVector = directionVector.normalize();\r\n\t\t\tplayerMesh1.position.x -= directionVector.x*2.5;\r\n\t\t\tplayerMesh1.position.z -= directionVector.z*2.5;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n}", "title": "" }, { "docid": "23e6b8657062ad859643f7969e8bd768", "score": "0.56140393", "text": "anyLegalMoves(player){\n for (var x = 0; x < this.pieces.length; x++){\n for (var y = 0; y < this.pieces[0].length; y++){\n if (this.getPiece(x,y) != null){\n if (this.getPiece(x,y).getLegalMoves(this).length >= 1 && player == this.getPiece(x,y).getColor()){\n return true;\n }\n }\n }\n }\n return false;\n }", "title": "" }, { "docid": "5659d6ddec8bf4f0d369e224b53847c1", "score": "0.56034434", "text": "function haveYouLost(grid) {\n return (checkUp(grid) && checkDown(grid) && checkLeft(grid) && checkRight(grid))\n}", "title": "" }, { "docid": "069c54f0c15ff017d07a59db9ffeefeb", "score": "0.557356", "text": "function isThereAWinner(player){\n\t\treturn player.hand.length === cards.length;\n\t}", "title": "" }, { "docid": "f2e35a7fd822cfd8ad0ad09771559f11", "score": "0.55545706", "text": "function playerAvailable() {\n if (typeof player === 'undefined') return false;\n if (typeof player.currentPlayingNode === 'undefined' || player.currentPlayingNode === null) return false;\n if (typeof player.currentPlayingNode.paused === 'undefined' || player.currentPlayingNode.paused === null) return false;\n if (player.currentPlayingNode.modulePtr === null) return false;\n return true;\n}", "title": "" }, { "docid": "63e835373b6f98ff4b7f17626ae37259", "score": "0.55455995", "text": "isFinished()\n {\n let finished = true;\n\n this.players.forEach(player => {\n if(player.state !== \"finish\")\n {\n finished = false;\n return;\n }\n });\n\n return finished;\n }", "title": "" }, { "docid": "e53eaabd095471720f9a0afa07291ccd", "score": "0.5540902", "text": "function reachPlayer() {\n const playerCollision = invaderArray.some(invader => {\n return cells[invader].classList.contains('spaceship')\n })\n if (playerCollision) {\n gameOver()\n } return\n }", "title": "" }, { "docid": "5731387030b6df47b79f78d0502de123", "score": "0.550815", "text": "function level_cleared() {\n if (enemies.every(out) || enemies.length == 0) {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "4e8c8a2a88c06f807e15839582782944", "score": "0.5487204", "text": "movedSinceLastGcd() {\n\t\treturn (\n\t\t\tMath.abs(this.combatants.selected.resources.x - this._pos.x) > 1 &&\n\t\t\tMath.abs(this.combatants.selected.resources.y - this._pos.y) > 1\n\t\t)\n\t}", "title": "" }, { "docid": "4e8c8a2a88c06f807e15839582782944", "score": "0.5487204", "text": "movedSinceLastGcd() {\n\t\treturn (\n\t\t\tMath.abs(this.combatants.selected.resources.x - this._pos.x) > 1 &&\n\t\t\tMath.abs(this.combatants.selected.resources.y - this._pos.y) > 1\n\t\t)\n\t}", "title": "" }, { "docid": "8ed3bf98bd8562eb17267e6d6ef29cb3", "score": "0.5482334", "text": "isLevelUp(){\n // This is first data update\n if (this.isGameOver() || this.prev === null) return true;\n\n return this.last.Level.LevelId != this.prev.Level.LevelId;\n }", "title": "" }, { "docid": "a37af238e1a0839f7d18405db0ee2850", "score": "0.54807377", "text": "anyLegalSkips(player){\n for (var x = 0; x < this.pieces.length; x++){\n for (var y = 0; y < this.pieces[0].length; y++){\n if (this.getPiece(x,y) != null){\n if (this.getPiece(x,y).getLegalSkips(this).length > 0 && player == this.getPiece(x,y).getColor()){\n return true;\n }\n }\n }\n }\n return false;\n }", "title": "" }, { "docid": "c380cddd1f39a041139c1bf8b241a66c", "score": "0.5478234", "text": "function isEndgame() {\n\treturn player.s.points.gt(1e132)\n}", "title": "" }, { "docid": "488a60d6ac0b22c59a9c72bd740781f0", "score": "0.5475849", "text": "function isGameEnded() {\n var remainPoints = 0;\n var group;\n for (var i = 0; i < targetGroups.length; i++) {\n group = targetGroups[i];\n if (targetsToComplete.includes(group.name)) {\n // if (targetGroups[i].countActive() != 0) {\n // return false;\n // }\n remainPoints += group.countActive() * targetConfigMap.get(group.name).value\n }\n }\n pointDifference = Math.abs(fork1.score - fork2.score);\n if (pointDifference > remainPoints) {\n return true;\n } else {\n return false;\n }\n}", "title": "" }, { "docid": "c32ff84544957c74cf6729561b19772f", "score": "0.54556847", "text": "couldJump() {\n // let onGround = this.body.blocked.down || this.body.touching.down\n let tile = this.scene.jumpTiles.getTileAtWorldXY(this.x, this.y)\n\n // return tile && tile.index === 1 && onGround\n return tile && tile.index === 1\n }", "title": "" }, { "docid": "1a48a0d24fad755c3cabbf2569d57e57", "score": "0.54433817", "text": "function checkHit(player) {\n ghostModule.ghosts.forEach(function (ghost, index, array) {\n if (ghost.xPos > player.xPos && ghost.xPos < (player.xPos + (player.width * 0.75)) && ghost.yPos > player.yPos && ghost.yPos < (player.yPos + (player.height * 0.75)) || (ghost.xPos + (ghost.width * 0.75)) > player.xPos && (ghost.xPos + (ghost.width * 0.75)) < (player.xPos + (player.width * 0.75)) && ghost.yPos > player.yPos && ghost.yPos < (player.yPos + (player.height * 0.75))) {\n gameOver = true;\n }\n });\n }", "title": "" }, { "docid": "273544da4eb1c07e57439f8b6102947d", "score": "0.54152656", "text": "function playerHasWon(player) {\n let signCssClass = player.PlayerSignCssClass;\n\n // the 3 rows\n if (IsBoxSetComplete([{ row: 1, column: 1 }, { row: 1, column: 2 }, { row: 1, column: 3 }], signCssClass)) return true;\n if (IsBoxSetComplete([{ row: 2, column: 1 }, { row: 2, column: 2 }, { row: 2, column: 3 }], signCssClass)) return true;\n if (IsBoxSetComplete([{ row: 3, column: 1 }, { row: 3, column: 2 }, { row: 3, column: 3 }], signCssClass)) return true;\n\n // the 3 columns\n if (IsBoxSetComplete([{ row: 1, column: 1 }, { row: 2, column: 1 }, { row: 3, column: 1 }], signCssClass)) return true;\n if (IsBoxSetComplete([{ row: 1, column: 2 }, { row: 2, column: 2 }, { row: 3, column: 2 }], signCssClass)) return true;\n if (IsBoxSetComplete([{ row: 1, column: 3 }, { row: 2, column: 3 }, { row: 3, column: 3 }], signCssClass)) return true;\n\n // the 2 diagonals\n if (IsBoxSetComplete([{ row: 1, column: 1 }, { row: 2, column: 2 }, { row: 3, column: 3 }], signCssClass)) return true;\n if (IsBoxSetComplete([{ row: 1, column: 3 }, { row: 2, column: 2 }, { row: 3, column: 1 }], signCssClass)) return true;\n\n return false;\n }", "title": "" }, { "docid": "936e4ac57de7ee4de9a8d0f6f2613eab", "score": "0.5405903", "text": "checkLose() {\r\n if (this.gs.board.findIndex(elt => elt === 0) > -1) {\r\n this.gs.over = false; // still have empty space\r\n return false;\r\n }\r\n for (let r = 0; r < this.dim; r++) {\r\n for (let c = 0; c < this.dim - 1; c++) {\r\n //horizontal direction\r\n let idx = this.dim * r + c;\r\n if (this.gs.board[idx] === this.gs.board[idx + 1]) {\r\n this.gs.over = false; return false;\r\n }\r\n //vertical direction\r\n idx = this.dim * c + r;\r\n if (this.gs.board[idx] === this.gs.board[idx + this.dim]) {\r\n this.gs.over = false; return false;\r\n }\r\n }\r\n }\r\n this.gs.over = true; // update gamestate\r\n this.onLose();\r\n return true;\r\n }", "title": "" }, { "docid": "7654f8af4417a1487d436dc208f4c055", "score": "0.5403978", "text": "checkIfLastLevelUnlocked() {\n if (\n this.stageIndex === this.lastLevelUnlocked.stage &&\n this.levelIndex === this.lastLevelUnlocked.level\n ) {\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "17c3052454d9b64030dc6f00710102af", "score": "0.5399933", "text": "hasAvailableSpots() {\n return this.players.length < this.playerLimit;\n }", "title": "" }, { "docid": "f8e635016f61828eafde4218ac8b7663", "score": "0.53972036", "text": "function isOccupiedBy (player) {\n return F.compose(F.equal(player), F.get('player'))\n}", "title": "" }, { "docid": "2dcdbbd27bea7166b0f1dc3e53ea4607", "score": "0.5392879", "text": "check_if_finished () {\n let finished = true\n this.players.forEach((player) => {\n if (! player.actionTaken && player.human) {\n finished = false\n }\n })\n if (finished) {\n this.next_stage()\n }\n }", "title": "" }, { "docid": "2922903cc45728cb5ef84b02884dfbd3", "score": "0.5390338", "text": "function remaining_tiles() {\r\n\r\n var tile_exist = false;\r\n var offset = 0;\r\n\r\n while( offset < 27 ) {\r\n\r\n if(game_tiles[ String.fromCharCode(65 + offset) ][ \"remaining\" ] !== 0) {\r\n tile_exist = true;\r\n }\r\n offset++;\r\n }\r\n\r\n return tile_exist;\r\n}", "title": "" }, { "docid": "063e77331a8ef3c43f1ef4ce128ac0ac", "score": "0.53780824", "text": "gameOver() {\n return this.avatar.isDead()\n }", "title": "" }, { "docid": "62965594e2780b1ff918f305c37fad19", "score": "0.537742", "text": "isLocalOnHold() {\n if (this.state !== CallState.Connected) return false;\n let callOnHold = true; // We consider a call to be on hold only if *all* the tracks are on hold\n // (is this the right thing to do?)\n\n for (const tranceiver of this.peerConn.getTransceivers()) {\n const trackOnHold = ['inactive', 'recvonly'].includes(tranceiver.currentDirection);\n if (!trackOnHold) callOnHold = false;\n }\n\n return callOnHold;\n }", "title": "" }, { "docid": "a7c08426ebda80c8da753b841ab6d547", "score": "0.53753304", "text": "isFull()\n\t{\n\t\tvar occupied = 0;\n\t\tfor(let p of this.players) {\n\t\t\toccupied = occupied + p.occupancy;\n\t\t}\n\t\treturn occupied == this.nodes.length;\n\t}", "title": "" }, { "docid": "a635806b177a5128c93c2a98d3cb0921", "score": "0.5370978", "text": "fallenTooFar()\n {\n return this.player.body.y - this.maxHeight > this.calculateMaxFallHeight() && !this.player.standingOnShard && !this.player.justReset;\n }", "title": "" }, { "docid": "4b75dfb9128efd91652eb0991bf90687", "score": "0.53543395", "text": "collisionCheck(player) {\r\n //Compares the enemy's position with the player's radius\r\n if (this.mtxLocal.translation.x <= (player.mtxLocal.translation.x + 0.5) && this.mtxLocal.translation.x >= (player.mtxLocal.translation.x - 0.5)\r\n && this.mtxLocal.translation.z <= (player.mtxLocal.translation.z + 0.5) && this.mtxLocal.translation.z >= (player.mtxLocal.translation.z - 0.5) && this.hitRecharge == 0) {\r\n //If there is a collision, begin the hit recharge.\r\n this.hitRecharge = 20;\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }", "title": "" }, { "docid": "5e0c923aea165184bd1fc2f23982dbc1", "score": "0.5351479", "text": "isTimeOver(){\n\t\tif(this.timeLeft <= 0) return true\n\t\treturn false \n\t}", "title": "" }, { "docid": "4c103fda53a710dd9100990a9cb5bc24", "score": "0.5349388", "text": "checkForPlayers(pd){\r\n\t\t\r\n\t\tthis.counter = 0;\r\n\t\t\r\n\t\t//for each player check the matrix.\r\n\t\tfor(this.i=0; this.i<pd.length; this.i++){\r\n\t\t\t\r\n\t\t\t//temporarily kill the player being checked.\r\n\t\t\tpd[this.i].setLive(false);\r\n\t\t\t\r\n\t\t\t//loop through all the mtrix fields.\r\n\t\t\tfor(this.f=0; this.f<this.matrix.length; this.f++){\r\n\t\t\t\t\r\n\t\t\t\t//if a player's colour is found, 'revive' the player\r\n\t\t\t\tif (this.matrix[this.f].includes(pd[this.i].getColour())){\r\n\t\t\t\t\tpd[this.i].setLive(true);\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t\r\n\t\t//count the number of live players.\r\n\t\tfor(this.i=0; this.i<pd.length; this.i++){\r\n\t\t\t(pd[this.i].checkLive()) && this.counter++;\r\n\t\t}\r\n\t\t\r\n\t\t//return false if there is more than a single player.\r\n\t\tif(this.counter > 1){\r\n\t\t\treturn false;\r\n\t\t}else{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "379a2ee9ab36ac42c294d7dc3bb5e034", "score": "0.53485453", "text": "isAlive() {\n if (this.hitPoints <= 0) {\n console.log(`${this.name} has been defeated!`);\n return false;\n }\n return true;\n }", "title": "" }, { "docid": "08f5a6325523fbd0d0876c8d2d145a7f", "score": "0.5339457", "text": "function isGameOver() {\n return lives <= 0 || beanCount === 0;\n }", "title": "" }, { "docid": "871fb343525a1bac19fc10b75198bed2", "score": "0.5326839", "text": "isGameWon() {\n for(let idx in this.currentWord) {\n if(!this.lettersFound.includes(this.currentWord[idx])) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "861adcdc9e0ceb8b659abee4ce3c0782", "score": "0.5318678", "text": "canMove(player) {\n for (var row = 0; row < this.numRows; row++) {\n for (var col = 0; col < this.numCols; col++) {\n\n var captured = this.tryCapture(player, row, col);\n\n if (!this.isMoveInvalid(row, col, captured.length)) {\n return true;\n } \n\n }\n }\n\n return false;\n }", "title": "" }, { "docid": "84bd1076e38afa980d56dfcd655e034f", "score": "0.5306628", "text": "function isGameOver(){\n return !(currentBlock.every(index =>{\n return (!squares[currentPosition + index].classList.contains('landed-block'));\n }));\n }", "title": "" }, { "docid": "b73f102b64931b252160c0b53ef6eb38", "score": "0.53039503", "text": "_isPlayerNeedToBeHealed() {\n return this._bot._isNeedUseSupportOnPlayer();\n }", "title": "" }, { "docid": "b8cfde4b032b2d7b5a2a427c6bbcb697", "score": "0.5270641", "text": "function isPaused() {\n\treturn !$('.pause-state');\n}", "title": "" }, { "docid": "759dafbbb4eb47ba6cf37deddb121b8a", "score": "0.5264657", "text": "function canMove() {\n newTime = millis();\n timeSinceMove = newTime - oldTime;\n\n if(timeSinceMove > moveTime){\n oldTime = newTime;\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "0111a6158ab1b4f86a068a6806f50020", "score": "0.5263618", "text": "function checkHasPositionalTracking () {\n var position = new THREE.Vector3();\n return (function () {\n if (isMobile() || isGearVR()) { return false; }\n controls.update();\n dolly.updateMatrix();\n position.setFromMatrixPosition(dolly.matrix);\n if (position.x !== 0 || position.y !== 0 || position.z !== 0) {\n return true;\n }\n return false;\n })();\n}", "title": "" }, { "docid": "0111a6158ab1b4f86a068a6806f50020", "score": "0.5263618", "text": "function checkHasPositionalTracking () {\n var position = new THREE.Vector3();\n return (function () {\n if (isMobile() || isGearVR()) { return false; }\n controls.update();\n dolly.updateMatrix();\n position.setFromMatrixPosition(dolly.matrix);\n if (position.x !== 0 || position.y !== 0 || position.z !== 0) {\n return true;\n }\n return false;\n })();\n}", "title": "" }, { "docid": "0111a6158ab1b4f86a068a6806f50020", "score": "0.5263618", "text": "function checkHasPositionalTracking () {\n var position = new THREE.Vector3();\n return (function () {\n if (isMobile() || isGearVR()) { return false; }\n controls.update();\n dolly.updateMatrix();\n position.setFromMatrixPosition(dolly.matrix);\n if (position.x !== 0 || position.y !== 0 || position.z !== 0) {\n return true;\n }\n return false;\n })();\n}", "title": "" }, { "docid": "f380404b5c9c56a510faefccb7b6ce63", "score": "0.52624387", "text": "function checkLives(){\n if(currentlives>=1)\n {\n lost = false;\n }\n else {\n lost = true;\n }\n}", "title": "" }, { "docid": "da535dc08f9c50c3a80adde1947b6f6a", "score": "0.525579", "text": "get gameWon() {\n if(this._colony.queenHasBees){ //queen has been reached\n return false; //we lost\n }\n else if(this._colony.allBees.length + this._hive.bees.length === 0){ //no more bees!\n return true; //we won!\n }\n \n return undefined; //ongoing\n }", "title": "" }, { "docid": "931873bc31a9882e8130aa49e5364ddb", "score": "0.52546984", "text": "function checkNoPlayersLeft({ gameState, playerId }) {\n const noPlayers = () => Rules.NoPlayersLeft(gameState);\n\n if (noPlayers()) {\n eventStream.next({ eventType: EngineEvents.noPlayersLeft, gameState, playerId });\n return null;\n }\n\n return { gameState };\n}", "title": "" }, { "docid": "e5f0b5ba7b8a250b7db569def3bd328e", "score": "0.52413833", "text": "function isOccupied(xPos, yPos){\n\n //Check if it's a black block\n if(xPos % 2 === 0 && yPos % 2 === 0){\n return true;\n }\n\n //Check the enemies\n for(let x = 0; x < enemyPositions.length; x++){\n if(enemyPositions[x] != null){\n if(enemyPositions[x][0] === xPos && enemyPositions[x][1] === yPos){\n return true;\n }\n }\n }\n\n //Check targets\n for(let x = 0; x < playerPositions.length; x++){\n if(playerPositions[x][0] === xPos && playerPositions[x][1] === yPos){\n console.log(\"target at: \" + xPos + \" \" + yPos);\n return true;\n }\n }\n\n //Check obstacles\n for(let x = 0; x < obstacles.length; x++){\n if(obstacles[x][1] === xPos && obstacles[x][2] === yPos){\n return true;\n }\n }\n\n //If there are no conflicts, return false\n return false;\n\n}//end isOccupied()", "title": "" }, { "docid": "39123d981d502df5d880d2a766702e08", "score": "0.5238451", "text": "function act(state, player) {\n if (!areTargetsLeft(state, player)) {\n return false;\n }\n\n moveIfRequired(state, player);\n\n const attackable = findAttackableEnemies(state, player);\n if (attackable.length === 0) {\n return true;\n }\n\n const attackPriorities = sortByHitPoints(sortByCoord(attackable));\n const target = attackPriorities[0];\n\n fight(player, target);\n\n if (target.hitpoints <= 0) {\n // Remove killed player.\n // TODO: Remove mutation\n state.players = state.players.filter(p => p !== target);\n }\n\n return true;\n}", "title": "" }, { "docid": "86c650357bd9448fd5e23a6b47c6ac3d", "score": "0.5230612", "text": "function isDead(target) {\n if (target.health <= 0) {\n console.log(`${target.name} has died.`)\n target.alive = false\n return true\n } else {\n return false\n }\n}", "title": "" }, { "docid": "454aa0cb40e6bb7a79b3366e28dd190c", "score": "0.52286154", "text": "function checkAllPlayersPresent(_players) {\n var onePlayerAbscent = false;\n for (var i = 0; i < _players.length; i++) {\n console.log(\"checkplayerspres: \" + JSON.stringify(_players[i]));\n if (_players[i].inGame == false) {\n onePlayerAbscent = true;\n }\n }\n return !onePlayerAbscent;\n }", "title": "" }, { "docid": "c8929d5ebb73d8155da53ecbec382187", "score": "0.52239585", "text": "isEnemyCanBeCaught() {\n let noCatch = document.querySelector('#divFightOptions .nocatch');\n return noCatch != null;\n }", "title": "" }, { "docid": "8082f4c282ea65bc1106cd83ff0da5e0", "score": "0.52237266", "text": "canBeMoved(freePositions,level,ringPos,player)\n {\n const idx = level * 8 + ringPos;\n if( (freePositions >> idx) & 1 )\n {\n //Place is not occupied. Check neighboring ring nodes.\n\n //Each node has at least two adjacent neighbors at its own ring:\n const ringPosLeft = level * 8 + (ringPos + 1 ) % 8;\n const ringPosRight = level * 8 + negMod(ringPos - 1 ,8);\n\n if( ( this.stones[player] >> ringPosLeft ) & 1 ||\n ( this.stones[player] >> ringPosRight ) & 1 )\n {\n return true;\n }\n\n if( ringPos % 2 )\n {\n //We are at an intersection with either 3 or 4 neighbors:\n //We need to check additional neighbors outside of current ring\n const upperLevelPos = ( level + 1 ) * 8 + ringPos;\n const lowerLevelPos = ( level - 1 ) * 8 + ringPos;\n\n if( upperLevelPos < 24 )\n {\n if( ( this.stones[player] >> upperLevelPos ) & 1 )\n {\n return true;\n }\n }\n\n if(lowerLevelPos >= 0) //Note\n {\n if( (this.stones[player] >> lowerLevelPos) & 1 )\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }", "title": "" }, { "docid": "f51cd18f4ce20a9a35cb397505168aa8", "score": "0.5219118", "text": "checkIfPlayerSafe(playerY) {\n for (let lava of this.lavaSlots) {\n if (playerY === lava.y && !lava.checkIfSafe()) {\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "8a04d2a89ee498cb849013e3c5dc8763", "score": "0.52162445", "text": "function isFinished(){\n\tvar result = true;\n\tfor (var i = 0; i < games.length; i++) {\n\t\tresult &= games[i].isFinished();\n\t};\n\treturn result;\n}", "title": "" }, { "docid": "ab18d031c4e46112de8351e28b0b9f4a", "score": "0.52135116", "text": "gameFinished() {\r\n return this._playerCol == this._exitCol && this._playerRow == this._exitRow;\r\n }", "title": "" }, { "docid": "381f88959f2287ed4ce7c2e2c924ef76", "score": "0.52057916", "text": "function hasWon() {\n return board.every(row => row.every(cell => !cell));\n }", "title": "" }, { "docid": "dc4ec99f4f3e58e491c623b3b0a9de85", "score": "0.52003723", "text": "isGameOverCheck(player1, player2) {\n if (player1.total <= 0 || player2.total <= 0) {\n // console.log(\"Game is over\");\n return true;\n } else {\n return false;\n }\n }", "title": "" }, { "docid": "b8bc586db47a3ce2f421cb45b66f4a04", "score": "0.5199691", "text": "collisionLeft() {\n if (this.posX + this.canvasWidth * 0.05 <= 0) {\n return true;\n }\n }", "title": "" }, { "docid": "98586ebb88248f5a14944825858a5215", "score": "0.519795", "text": "hasGameParent(){\n\t\tlet parent = this.parent;\n\t\twhile( parent ){\n\t\t\tif( parent instanceof Game )\n\t\t\t\treturn true;\n\t\t\tparent = parent.parent;\n\t\t}\n\t}", "title": "" }, { "docid": "95d1a68d0857abdce5f4b7c9121022c0", "score": "0.519747", "text": "static elementHasMoved(matchTargetRect, lastMatchTarget) {\n if (lastMatchTarget === null) {\n return true;\n }\n return lastMatchTarget.top !== matchTargetRect.top || lastMatchTarget.left !== matchTargetRect.left;\n }", "title": "" }, { "docid": "3f762dd55009e496bdd5b98b6cd2e638", "score": "0.51966757", "text": "function checkCollisions() {\n for (var enemy of allEnemies) {\n if (enemy.y === player.y && Math.abs(enemy.x - player.x) < 60) {\n return true;\n }\n }\n return false;\n}", "title": "" }, { "docid": "56d8ee8e8424c9ad88bd359db2fec363", "score": "0.51939994", "text": "touched() {\n // if the player touches it, they gain targetsHit\n let d = dist(this.x, this.y, player.x, player.y);\n if (d < this.size) {\n audioGoodHit.play();\n minigameHits++;\n var removed = targets.splice(this.index, 1);\n }\n }", "title": "" }, { "docid": "e7cccac76c0b87d1328c474e8110d06a", "score": "0.51900005", "text": "enemyAhead(warrior) {\n return !warrior.feel().isEmpty();\n }", "title": "" }, { "docid": "5aa3426cb2fc16211ac07bcf2a77ff3e", "score": "0.51891", "text": "justDown() {\n return this.keys.some(key => Phaser.Input.Keyboard.JustDown(key));\n }", "title": "" }, { "docid": "46cd6b300cee9222ad9dfc5e6267d586", "score": "0.5187189", "text": "function isWon() {\n var difference = player1Score - player2Score;\n if (difference < 0) {\n difference *= -1;\n }\n return difference >= 2 && (player1Score > 3 || player2Score > 3);\n }", "title": "" }, { "docid": "164ec891bced21132a2dc42d8d8def8c", "score": "0.5180892", "text": "function checkGameOver() {\n for (var i = 0; i < gStoragesPos.length; i++) {\n if (!gBoard[gStoragesPos[i].indexI][gStoragesPos[i].indexJ].isBoxHere)\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "76a86e868d219ef386139d0f7916cfc7", "score": "0.5176522", "text": "checkAllCherriesEaten() {\n if (!this.tree.animationFinished || this.tree.countCherriesAlive() !== 0) {\n return false;\n }\n\n this.tree.animationFinished = false;\n this.tree.kill();\n return true;\n }", "title": "" }, { "docid": "443ad1579d102f4078f110db24fb827e", "score": "0.5159051", "text": "function isBoardFull() {\n for (const space of state.board) {\n if (space.player === null) {\n return false;\n }\n }\n return true;\n}", "title": "" }, { "docid": "65f2a0944fc4c5129263721cd70c04b5", "score": "0.5157717", "text": "function hasWon() {\n return board.every((row) => row.every((cell) => !cell));\n }", "title": "" }, { "docid": "427bbb40655e5882fbed171607a53b0c", "score": "0.51567477", "text": "function checkPlayerMovement() {\r\n //Right\r\n if (cursors.right.isDown) {\r\n player.setVelocityX(100);\r\n player.anims.play('walk', true);\r\n player.flipX = false;\r\n }\r\n //Left\r\n else if (cursors.left.isDown) {\r\n player.setVelocityX(-100);\r\n player.anims.play('walk', true);\r\n player.flipX = true;\r\n }\r\n //Down\r\n else if (cursors.down.isDown) {\r\n player.setVelocityX(0);\r\n player.anims.play('down', true);\r\n }\r\n //Idle\r\n else {\r\n player.setVelocityX(0);\r\n player.anims.play('idle', true);\r\n }\r\n\r\n //Reset jumpCount. Important for double jumping.\r\n if (player.body.blocked.down) {\r\n player.jumpCount = 0;\r\n }\r\n\r\n //Check for the spacebar having JUST been pressed, and whether the player has any jumps left - Important for double jumping.\r\n //Then, jump.\r\n if (Phaser.Input.Keyboard.JustDown(cursors.space) && player.jumpCount < player.maxJump) {\r\n player.jumpCount++;\r\n sfx.jump.play();\r\n player.setVelocityY(-250);\r\n }\r\n\r\n //Display jumping or falling animations\r\n if (player.body.velocity.y < 0) {\r\n player.anims.play('jump', true);\r\n } else if (player.body.velocity.y > 0) {\r\n player.anims.play('fall', true);\r\n }\r\n}", "title": "" }, { "docid": "173d27eb2abe8fa6b0e833d8522cf562", "score": "0.5151116", "text": "function anyPress(player) {\r\n if (\r\n player.upPressed === true ||\r\n player.downPressed === true ||\r\n player.rightPressed === true ||\r\n player.leftPressed === true \r\n ) {\r\n return true;\r\n }\r\n return false;\r\n}", "title": "" }, { "docid": "0c9773951e04b4b8173c136c11259f49", "score": "0.51503664", "text": "gameOver() {\n return (\n this.level.isCollide(this.potato.bounds()) || this.potato.outOfBounds()\n )\n \n }", "title": "" }, { "docid": "43dc65a411a0c7cf7caf184d57e37a2c", "score": "0.5147492", "text": "oldEnoughToDelete() {\r\n return !this.fixed && (getTimeInServerRefFrame().diff(this.updateTime) > dropTrackTimeMS\r\n || (this.iconAltitude() <= 0 && getTimeInServerRefFrame().diff(this.updateTime) > dropTrackAtZeroAltTimeMS));\r\n }", "title": "" }, { "docid": "55f9142d333fe10ae0acfb9a22905c82", "score": "0.5141413", "text": "driverGoalReached() {\n return Math.abs(this.state.driverPos.x - this.state.driverGoal.x) < 5 &&\n Math.abs(this.state.driverPos.y - this.state.driverGoal.y) < 5;\n }", "title": "" }, { "docid": "78945635fad73420071c948d6af0b93b", "score": "0.51413774", "text": "function CanSeePlayer () : boolean {\n\tvar playerDirection : Vector3 = (player.position - character.position);\n\tvar hit : RaycastHit;\n\tPhysics.Raycast (character.position, playerDirection, hit, playerDirection.magnitude);\n\tif (hit.collider && hit.collider.transform == player) {\n\t\treturn true;\n\t}\n\treturn false;\n}", "title": "" }, { "docid": "138557c5eb455fb4d93d6cf76b304510", "score": "0.5140089", "text": "static isTargetNode(trgNodeId, targetNodes) {\n\t\treturn targetNodes.findIndex((tn) => tn.id === trgNodeId) > -1;\n\t}", "title": "" }, { "docid": "2f0d4d54af67acd6423084c101919a6d", "score": "0.5138309", "text": "checkEndTurn()\n {\n let endTurn = false;\n if(this.players.length != 0)\n {\n endTurn = true;\n this.players.forEach(player =>\n {\n if(!player.turnPlayed)\n {\n endTurn = false;\n }\n })\n }\n return endTurn;\n }", "title": "" } ]
4f9c03acc3084356619362f0dba848c4
Form // // verif All :
[ { "docid": "c54fd2ed872935b85067a7405e2fd7de", "score": "0.0", "text": "function verifAllParticipant(){\n\tif( verifText($('#name')) && verifText($('#firstname')) && verifDate($('#date')) && verifMail($('#mailpublic')) \n\t\t&& verifMail($('#mailprivate')) && verifPhone($('#tel')) && verifIsset($('#num')) && verifIsset($('#postal'))\n\t\t&& verifIsset($('#rue')) && verifIsset($('#ville')) && verifLogin($('#login')) && verifMdp() \n\t){\n\t\t$('#submit').attr(\"disabled\", false);\n\t\treturn true;\n\t}else{\n\t\t// $('#submit').attr(\"disabled\", true);\n\t\treturn false;\n\t}\n}", "title": "" } ]
[ { "docid": "cefeec5a5ff6bd88e20c95e28897b02e", "score": "0.7270388", "text": "function Form() {\n}", "title": "" }, { "docid": "13314a5d8cc0431d3cb8926c2314296c", "score": "0.68851703", "text": "function Forma() {}", "title": "" }, { "docid": "36552ff4a8f96f6f59e5ff4eef4dc3c8", "score": "0.67937744", "text": "function Form() {\n DataExtractor.call(this);\n}", "title": "" }, { "docid": "72e1bcc05fe964b518b05fe4e3d08a48", "score": "0.67411757", "text": "static mod2form() {\n var form;\n // variables:['url','opts'] \n form = 'p\\nform(action= url,method=\\'POST\\' id=\"bootform\")\\n - for(attr in opts){\\n .form-group\\n label(for= \\'id\\' + attr)= attr\\n - if(opts[attr].widget===\\'textarea\\')\\n textarea(class=\"form-control\",rows=\"5\",name=attr,id= \\'id\\' + attr) \\n - else{\\n - if(opts[attr].type === \\'integer\\') \\n - type=\\'number\\'\\n - else if(opts[attr].type === \\'timestamp\\')\\n - type=\\'datetime\\'\\n - else\\n - type=\\'text\\'\\n input(class=\"form-control\",id= \\'id\\' + attr,name= attr,type= type )\\n - }\\n - }\\n .form-group \\n button(class=\"idoido btn btn-lg btn-default\") Submit! \\np';\n return form;\n }", "title": "" }, { "docid": "3c471189aac711c19f46f1ccea2194d3", "score": "0.6674112", "text": "function ForgetForm(){\n this.trails = 0;\n this.form_tpl_html = '';\n}", "title": "" }, { "docid": "26bbf70698f5ff1ed8cd6725d638a92f", "score": "0.6565157", "text": "get form() {\n return this._internals.form;\n }", "title": "" }, { "docid": "975e2a619643d778fc82d5c2cbb558bc", "score": "0.65020895", "text": "function TopicForm() {\n\t}", "title": "" }, { "docid": "3c1abe5160b95ffced93d844267bdd3c", "score": "0.6490034", "text": "get form() {\n return this._formObs;\n }", "title": "" }, { "docid": "ed7c2bd8dadc94d0abcdf8a110fb1de2", "score": "0.6433764", "text": "function createForm(campi,body_class,form_class,action)\n{\n const body = document.getElementById(\"body\")\n body.className = body_class\n const form = addWidget(\"form\",body,{\"className\":form_class,\"action\":action})\n\n for (let i=0;i<campi.length;i+=1)\n addWidget(campi[i][0],form,campi[i][1])\n}", "title": "" }, { "docid": "b71a514dbd4e74c74a3692680d66f38d", "score": "0.64336085", "text": "function limpiarFormulario( form ){\n\t$(\"#\" + form + \" input\").not(\":button, :submit, :reset, :hidden\").each(function () {\n\t\tthis.value = this.defaultValue;\n\t\t$(this).removeClass(\"validate_success\");\n\t\t$(this).removeClass(\"validate_error\");\n\t});\n\t\n\t$(\"#\" + form + \" select option\").each(function ( index ) {\n\t\tif( index == 0 ){ \n\t\t\t$(this).attr(\"selected\", \"selected\" ); \n\t\t}else{\n\t\t\t$(this).removeAttr(\"selected\" );\n\t\t}\n\t});\n\t\n\t$(\"#\" + form + \" textarea\").each( function ( index ) {\n\t\t$(this).val(\"\"); \n\t});\n\t\n}", "title": "" }, { "docid": "ad979fba887b7601827144311eeba47d", "score": "0.6358568", "text": "function halShowForm(hf, href, title) {\n var elm, coll, val, f;\n var form, header, fs, p, inp;\n \n elm = d.find(\"form\");\n d.clear(elm);\n\n // grab HAL-FORM properties\n f = hf._templates.default;\n \n form = d.node(\"form\");\n form.action = href;\n form.method = f.method;\n form.setAttribute(\"halmethod\", f.method);\n form.className = f.rel;\n form.onsubmit = halSubmit;\n fs = d.node(\"div\");\n fs.className = \"ui form\";\n header = d.node(\"div\");\n header.innerHTML = title||\"Form\";\n header.className = \"ui dividing header\";\n d.push(header, fs);\n\n coll = f.properties;\n for(var prop of coll) {\n segment = d.node(\"div\");\n segment.className = \"ui green segment\";\n\n val = prop.value;\n if(g.hal[prop.name]) {\n val = val.replace(\"{\"+prop.name+\"}\",g.hal[prop.name]);\n } \n else {\n val = val.replace(\"{\"+prop.name+\"}\",\"\");\n }\n \n p = d.input({\n prompt:prop.prompt,\n name:prop.name,\n value:val, \n required:prop.required,\n readOnly:prop.readOnly,\n pattern:prop.pattern\n });\n d.push(p,fs);\n }\n \n p = d.node(\"p\");\n inp = d.node(\"input\");\n inp.type = \"submit\";\n inp.className = \"ui mini positive submit button\";\n d.push(inp,p);\n\n inp = d.node(\"input\");\n inp.type = \"button\";\n inp.value = \"Cancel\";\n inp.onclick = function(){elm = d.find(\"form\");d.clear(elm);}\n inp.className = \"ui mini cancel button\";\n d.push(inp,p);\n\n d.push(p,fs); \n d.push(fs,form);\n d.push(form, segment);\n d.push(segment, elm);\n }", "title": "" }, { "docid": "8037ebab20350862cfe938c9f5127039", "score": "0.6297676", "text": "function External_Form() {\n Form.call(this);\n}", "title": "" }, { "docid": "c53e7a1efdee02c29ff40cc37c00c901", "score": "0.62840027", "text": "function processForm(form) {\r\n \r\n\r\n\r\n\r\n\r\n\r\n return false;\r\n}", "title": "" }, { "docid": "9506d8e5a37aa7dfa21095dbd851e146", "score": "0.62779295", "text": "function getForms(){\n\t\treturn new DomCon([\"form\"]);\n\t}", "title": "" }, { "docid": "e4d3c6e7b4566deb05c13ca318579287", "score": "0.62588716", "text": "function cutiData(){\r\n\r\n var namacuti = document.getElementById(\"namaCuti\").value;\r\n var lamacuti = document.getElementById(\"lamaCuti\").value;\r\n var mulaicuti = document.getElementById(\"mulaiCuti\").value;\r\n var detail = document.getElementById(\"detail\").value;\r\n var tglmulai = tgl = yyyy + '-' + mm + '-' + dd; \r\n\r\n form.set(\"nama_cuti\",namacuti);\r\n form.set(\"lama_cuti\",lamacuti);\r\n form.set(\"mulai_cuti\",mulaicuti);\r\n form.set(\"alasan\",detail);\r\n form.set(\"id_user\",user_id);\r\n form.set(\"tgl_ajukan\",tglmulai); \r\n\r\n return form;\r\n}", "title": "" }, { "docid": "f133f70998fdbe9c2e4c913cd9b4f6d8", "score": "0.6244295", "text": "get formTab() {return browser.element(\"~Form\");}", "title": "" }, { "docid": "f133f70998fdbe9c2e4c913cd9b4f6d8", "score": "0.6244295", "text": "get formTab() {return browser.element(\"~Form\");}", "title": "" }, { "docid": "f133f70998fdbe9c2e4c913cd9b4f6d8", "score": "0.6244295", "text": "get formTab() {return browser.element(\"~Form\");}", "title": "" }, { "docid": "3ad7fed2f8c3a9e732c0e012539a72e8", "score": "0.62114817", "text": "get form() {\n return this.context.form;\n }", "title": "" }, { "docid": "0e14efd05c6e3a9821505b0811bbf6ee", "score": "0.62036407", "text": "formNotOK() {\n alert(\"verifiez les champs en rouge\");\n }", "title": "" }, { "docid": "98bc30083970bf88b23faddb49f0d599", "score": "0.6201818", "text": "function urlRedirector(form){\n var objectTextIndex = 0;\n var objectTextName = null;\n var parametro = null;\n var URL = form.action;\n var element = null; \n\n for (i = 0; i< form.elements.length; i++){ \n\n element = form.elements[i];\n parametro = \"\";\n\n if (element.type == \"select-one\"){\n objectTextName = element.options[element.selectedIndex].value;\n parametro = \"&\" + parametro + objectTextName + \"=\" + form.elements[objectTextIndex].value;\n } \n else {\n\n if (element.type == \"text\"){ \n objectTextIndex = i;\n }\n else{ \n if (element.tagName != \"FIELDSET\")\n parametro = \"&\" + parametro + element.name + \"=\" + element.value; \n }\n } \n\n URL = URL + parametro;\n\n }\n\n location.href = URL \n document.returnValue = false; \n return;\n\n}", "title": "" }, { "docid": "5256028d995bfb75b0609b74ebd366c7", "score": "0.6175149", "text": "_updateForm() {\n var form = this._getForm();\n form.find('#name').val(this.contact.name);\n form.find('#surname').val(this.contact.surname);\n form.find('#email').val(this.contact.email);\n form.find('#country').val(this.contact.country);\n }", "title": "" }, { "docid": "ebbef70859796b986549595ff2b95610", "score": "0.6158921", "text": "get f() { return this.form.controls; }", "title": "" }, { "docid": "ebbef70859796b986549595ff2b95610", "score": "0.6158921", "text": "get f() { return this.form.controls; }", "title": "" }, { "docid": "61daac942c2508b1c9cc425a94884a3d", "score": "0.6158306", "text": "function autoPildymas() {\n forma.firstname.value = duomenys.vardas;\n forma.lastname.value = duomenys.pavarde;\n forma.email.value = duomenys.emailas;\n}", "title": "" }, { "docid": "755bd166f8910f24e0b9ae09b61bd51f", "score": "0.6148743", "text": "function autoFormosUzpildymas () {\n forma.firstname.value = data.vardas;\n forma.lastname.value = data.pavarde;\n forma.email.value = data.pastas;\n}", "title": "" }, { "docid": "c213bf7ae694029c685db2f641a9e3e0", "score": "0.61331266", "text": "function ShowSelectedFieldInputForm(field_title, field_type, field_id){\n \n}", "title": "" }, { "docid": "1fce966c3efa17cb35e160001250aa64", "score": "0.6129529", "text": "constructor(form) {\n\n // Get the button and add event listener to validate the click.\n this._submitButton = form.querySelector('button[type=submit');\n this._submitButton.addEventListener('click', (e) => this.onClick(e));\n\n // Create instance of all inputs, to save their initial state.\n this._inputs = [];\n form.querySelectorAll('input:not([type=hidden]').forEach(input => {\n\n // Add event to the input.\n input.addEventListener('input', () => this.handleChange());\n input.addEventListener('changed', () => this.handleChange());\n\n // Add to the list of inputs.\n this._inputs.push(new TextInput(input));\n });\n\n this.handleChange();\n }", "title": "" }, { "docid": "4ae0f87e70e2eda8eba86e9a3153b2df", "score": "0.6128979", "text": "function classForm() {\n this.form; // form editor\n this.container; // form\n this.row;\n this.showBtnRomve;\n this.btnRomve = $('<a/>', {\n 'href': 'javasrcipt:void(0)',\n 'class': 'btnRomveExtra',\n text: 'X',\n click: function(e) {\n $(this).parent().remove();\n }\n });\n\n this.init = function (id, container) {\n // id is form editor when post data\n // container when click add and data will add this form\n this.form = $('#' + id);\n this.container = $('#' + container);\n return this.form;\n }\n\n // function create row\n this.createRow = function (label, input, showBtnRomve = true) {\n var row = $('<div/>', {\n 'class': 'row'\n });\n row.append(label).append(input);\n // check for btn remove\n if(showBtnRomve) row.append(this.btnRomve.clone(true));\n return row;\n }\n\n // function add 1 row into form when type === 'text', 'textarea', 'button'\n this.appendRow = function (label, input, showBtnRomve = true) {\n this.container.append(this.createRow(label, input, showBtnRomve));\n }\n\n // function create row list for extra form\n this.createRowList = function(list, showBtnRomve) {\n var rowList = $('<div/>', {\n 'class': 'extra-item'\n });\n rowList.append(list);\n if(showBtnRomve) rowList.append(this.btnRomve).clone(true);\n return rowList;\n }\n\n // function append rowlist when type = 'radio', 'checkbox'\n this.appendRowList = function(list, showBtnRomve = true) {\n this.container.append(this.createRowList(list, showBtnRomve));\n }\n\n // this.changeStyleForm = function() {\n // $('label, input').addClass('.change .change--label')\n // }\n }", "title": "" }, { "docid": "5e5b599a170232f06ebef403519fd24d", "score": "0.61066425", "text": "get form() {\n return this.elementInternals ? this.elementInternals.form : this.proxy.form;\n }", "title": "" }, { "docid": "c772283a8e01bd5c87fb804ab6386f68", "score": "0.60944945", "text": "function onChangeForm()\r\n{\r\n var upFormObject = LIST_FORM.getValue()\r\n var controlNames = getUPFormControlNames(upFormObject);\r\n if (controlNames.length)\r\n {\r\n LIST_FORMUSERNAME.setAll(controlNames, controlNames);\r\n LIST_FORMPASSWORD.setAll(controlNames, controlNames);\r\n\r\n // try to match existing form fields to username & password\r\n for (i=0; i<controlNames.length; i++)\r\n {\r\n if (controlNames[i].toUpperCase().search(\"USERNAME\") >= 0)\r\n {\r\n LIST_FORMUSERNAME.setIndex(i);\r\n }\r\n if (controlNames[i].toUpperCase().search(\"PASSWORD\") >= 0)\r\n {\r\n LIST_FORMPASSWORD.setIndex(i);\r\n }\r\n }\r\n if (LIST_FORMUSERNAME.getIndex() == LIST_FORMPASSWORD.getIndex())\r\n {\r\n if (LIST_FORMUSERNAME.getIndex() == 0)\r\n {\r\n LIST_FORMPASSWORD.setIndex(1)\r\n }\r\n else\r\n {\r\n LIST_FORMPASSWORD.setIndex(0)\r\n }\r\n }\r\n } \r\n else \r\n {\r\n LIST_FORMUSERNAME.setAll(new Array(MM.LABEL_NoFields), EMPTY_LIST);\r\n LIST_FORMPASSWORD.setAll(new Array(MM.LABEL_NoFields), EMPTY_LIST);\r\n }\r\n}", "title": "" }, { "docid": "8ec9ddd7fb9ba816ce626fc75b65fc05", "score": "0.60934335", "text": "displayForm(){\r\n\r\n $(\"#\"+this.id+\"-form\").html(\"\")\r\n\r\n if(this.bikes > 0 && this.status === \"OPEN\"){\r\n $(\"#\"+this.id+\"-form\").append(\"<form id=\"+this.id+\"-user></form>\")\r\n $(\"#\"+this.id+\"-user\").append(\"<label for='nom'>nom : </label>\")\r\n $(\"#\"+this.id+\"-user\").append(\"<input type='text' name='nom' id='nom' placeholder='Entrez votre nom' required />\")\r\n $(\"#\"+this.id+\"-user\").append(\"<label for='prenom'>prénom : </label>\")\r\n $(\"#\"+this.id+\"-user\").append(\"<input type='text' name='prenom' id='prenom' placeholder='Entrez votre prénom' required />\")\r\n $(\"#\"+this.id+\"-user\").append(\"<button id=\"+this.id+\"-confirm>Valider</button>\")\r\n }\r\n\r\n else if(this.bikes === 0){\r\n $(\"#\"+this.id+\"-form\").append(\"<p>Il n'y a aucun vélo disponible</p>\")\r\n }\r\n\r\n else if(this.status !== \"OPEN\"){\r\n $(\"#\"+this.id+\"-form\").append(\"<p>La station est fermée</p>\")\r\n }\r\n }", "title": "" }, { "docid": "502e4dec25ba90fcc5daee622eb8281f", "score": "0.60788506", "text": "getForm() {\n\t\treturn this.form_;\n\t}", "title": "" }, { "docid": "3cd8fcf0e04e7ce999b8b6eef5c40359", "score": "0.60775834", "text": "get form() {\n\t\treturn this.context && this.context.form;\n\t}", "title": "" }, { "docid": "f70cba42dd72d5f9c42af80eb6b62126", "score": "0.6070692", "text": "for( nCo=0; nCo < document.forms.item(0).elements.length; nCo++ ) {\n\t\t\t\t\tif( GetFormControl( nCo ).type != \"hidden\" ) {\n\t\t\t\t\t\t// Controlla che sia un controllo abilitato e visibile\n\t\t\t\t\t\tif(\t!GetFormControl( nCo ).disabled \n\t\t\t\t\t\t\t\t&& !GetFormControl( nCo ).readOnly\n\t\t\t\t\t\t\t\t&& GetFormControl( nCo ).style.display != \"none\" ) {\n\t\t\t\t\t\t\t//alert(GetFormControl( nCo ).name + \" \" + GetFormControl( nCo ).readOnly);\n \t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tGetFormControl( nCo ).focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch( e ) {\n\t\t\t\t\t\t\t\t// ignora eventuale errore\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}", "title": "" }, { "docid": "82770f4d8255a7f6b857336a4a07a07c", "score": "0.6064061", "text": "function i(t){return t&&1===t.nodeType&&\"FORM\"===t.tagName}", "title": "" }, { "docid": "82770f4d8255a7f6b857336a4a07a07c", "score": "0.6064061", "text": "function i(t){return t&&1===t.nodeType&&\"FORM\"===t.tagName}", "title": "" }, { "docid": "337ab390da68928554d099661b943e8e", "score": "0.60626274", "text": "function examineForm() {\n var fitems = form.getItems();\n for (var j = 0; j < fitems.length; j++) {\n console.log(`Item title for: #${j} - ${fitems[j].getTitle()} ID: ${fitems[j].getID()}`);\n }\n}", "title": "" }, { "docid": "8c456270a87223923afdcf8939559797", "score": "0.6060088", "text": "function UI()\n {\n var submitHandler; // Function which is later bound to handle form submits\n var mapMeta = {\n formDataProperty: \"smarty-form\", // Indicates whether we've stored the form already\n identifiers: {\n streets: { // both street1 and street2, separated later.\n names: [ // Names are hidden from the user; \"name\" and \"id\" attributes\n 'street',\n 'address', // This (\"address\") is a dangerous inclusion; but we have a strong set of exclusions below to prevent false positives.\n 'address1', // If there are automapping issues (specifically if it is too greedy when mapping fields) it will be because\n 'address2', // of these arrays for the \"streets\" fields, namely the \"address\" entry right around here, or potentially others.\n 'addr1',\n 'addr2',\n 'address-1',\n 'address-2',\n 'address_1',\n 'address_2',\n 'line',\n 'primary'\n ],\n labels: [ // Labels are visible to the user (labels and placeholder texts)\n 'street',\n 'address', // hazardous (e.g. \"Email address\") -- but we deal with that later\n 'line ',\n ' line'\n ]\n },\n secondary: {\n names: [\n 'suite',\n 'apartment',\n 'primary',\n //'box', // This false-positives fields like \"searchBox\" ...\n 'pmb',\n //'unit', // I hesitate to allow this, since \"Units\" (as in quantity) might be common...\n 'secondary'\n ],\n labels: [\n 'suite',\n 'apartment',\n 'apt:',\n 'apt.',\n 'ste:',\n 'ste.',\n 'unit:',\n 'unit.',\n 'unit ',\n 'box',\n 'pmb'\n ]\n },\n city: {\n names: [\n 'city',\n 'town',\n 'village',\n 'cityname',\n 'city-name',\n 'city_name',\n 'cities'\n ],\n labels: [\n 'city',\n 'town',\n 'city name'\n ]\n },\n state: {\n names: [\n 'state',\n 'province',\n 'region',\n 'section',\n 'territory'\n ],\n labels: [\n 'state',\n 'province',\n 'region',\n 'section',\n 'territory'\n ]\n },\n zipcode: {\n names: [\n 'zip',\n 'zipcode',\n 'zip-code',\n 'zip_code',\n 'postal_code',\n 'postal-code',\n 'postalcode',\n 'postcode',\n 'post-code',\n 'post_code',\n 'postal',\n 'zcode'\n ],\n labels: [\n 'zip',\n 'zip code',\n 'postal code',\n 'postcode',\n 'locality'\n ]\n },\n lastline: {\n names: [\n 'lastline',\n 'last-line',\n 'citystatezip',\n 'city-state-zip',\n 'city_state_zip'\n ],\n labels: [\n 'last line',\n 'city/state/zip',\n 'city / state / zip',\n 'city - state - zip',\n 'city-state-zip',\n 'city, state, zip'\n ]\n },\n country: { // We only use country to see if we should submit to the API\n names: [\n 'country',\n 'nation',\n 'sovereignty'\n ],\n labels: [\n 'country',\n 'nation',\n 'sovereignty'\n ]\n }\n }, // We'll iterate through these (above) to make a basic map of fields, then refine:\n street1exacts: { // List of case-insensitive EXACT matches for street1 field\n names: [\n 'address',\n 'street',\n 'address1',\n 'streetaddress',\n 'street-address',\n 'street_address',\n 'streetaddr',\n 'street-addr',\n 'street_addr',\n 'str',\n 'str1',\n 'street1',\n 'addr'\n ]\n },\n street2: { // Terms which would identify a \"street2\" field\n names: [\n 'address2',\n 'address_2',\n 'address-2',\n 'street2',\n 'addr2',\n 'addr_2',\n 'line2',\n 'str2',\n 'second',\n 'two'\n ],\n labels: [\n ' 2',\n 'second ',\n 'two'\n ]\n },\n exclude: { // Terms we look for to exclude an element from the mapped set to prevent false positives\n names: [ // The intent is to keep non-address elements from being mapped accidently.\n 'email',\n 'e-mail',\n 'e_mail',\n 'firstname',\n 'first-name',\n 'first_name',\n 'lastname',\n 'last-name',\n 'last_name',\n 'fname',\n 'lname',\n 'name', // Sometimes problematic (\"state_name\" ...) -- also see same label value below\n 'eml',\n 'type',\n 'township',\n 'zip4',\n 'plus4',\n 'method',\n 'location',\n 'store',\n 'save',\n 'keep',\n 'phn',\n 'phone',\n 'cardholder', // I hesitate to exclude \"card\" because of common names like: \"card_city\" or something...\n 'security',\n 'comp',\n 'firm',\n 'org',\n 'addressee',\n 'addresses',\n 'group',\n 'gate',\n 'fax',\n 'cvc',\n 'cvv',\n 'file',\n 'search',\n 'list' // AmeriCommerce cart uses this as an \"Address Book\" dropdown to choose an entire address...\n ],\n labels: [\n 'email',\n 'e-mail',\n 'e mail',\n ' type',\n 'save ',\n 'keep',\n 'name',\n 'method',\n 'phone',\n 'organization',\n 'company',\n 'addressee',\n 'township',\n 'firm',\n 'group',\n 'gate',\n 'cardholder',\n 'cvc',\n 'cvv',\n 'search',\n 'file',\n ' list',\n 'fax',\n 'book'\n ]\n }\n };\n\n var autocompleteResponse; // The latest response from the autocomplete server\n var autocplCounter = 0; // A counter so that only the most recent JSONP request is used\n var autocplRequests = []; // The array that holds autocomplete requests in order\n var loaderWidth = 24, loaderHeight = 8; // TODO: Update these if the image changes\n var uiCss = \"<style>\"\n + \".smarty-dots { display: none; position: absolute; z-index: 999; width: \"+loaderWidth+\"px; height: \"+loaderHeight+\"px; background-image: url('data:image/gif;base64,R0lGODlhGAAIAOMAALSytOTi5MTCxPTy9Ly6vPz6/Ozq7MzKzLS2tOTm5PT29Ly+vPz+/MzOzP///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBgAOACwAAAAAGAAIAAAEUtA5NZi8jNrr2FBScQAAYVyKQC6gZBDkUTRkXUhLDSwhojc+XcAx0JEGjoRxCRgWjcjAkqZr5WoIiSJIaohIiATqimglg4KWwrDBDNiczgDpiAAAIfkECQYAFwAsAAAAABgACACEVFZUtLK05OLkxMbE9PL0jI6MvL68bG5s7Ors1NbU/Pr8ZGJkvLq8zM7MXFpctLa05ObkzMrM9Pb0nJqcxMLE7O7s/P78////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWDgZVWQcp2nJREWmhLSKRWOcySoRAWBEZ8IBi+imAAcxwXhZODxDCfFwxloLI6A7OBCoPKWEG/giqxRuOLKRSA2lpVM6kM2dTZmyBuK0Aw8fhcQdQMxIwImLiMSLYkVPyEAIfkECQYAFwAsAAAAABgACACEBAIEpKak1NbU7O7svL68VFZU/Pr8JCIktLK05OLkzMrMDA4M9Pb0vLq87Ors9PL0xMLEZGZk/P78tLa05ObkzM7MFBIU////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWLgJVGCcZ2n9DASmq7nUwDAQaAPhCAEgzqNncIQodEWgxNht7tdDBMmorIw0gKXh3T3uCSYgV3VitUiwrskZTspGpFKsJMRRVdkNBuKseT5Tg4TUQo+BgkCfygSDCwuIgN/IQAh+QQJBgAXACwAAAAAGAAIAIRUVlS0srTk4uR8enz08vTExsRsbmzs6uyMjoz8+vzU1tRkYmS8urzMzsxcWly0trTk5uR8fnz09vTMyszs7uycmpz8/vz///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFYOBlUVBynad1QBaaEtIpIY5jKOgxAM5w5IxAYJKo8HgLwmnnAAAGsodQ2FgcnYUL5Nh0QLTTqbXryB6cXcBPEBYaybEL0wm9SNqFWfOWY0Z+JxBSAXkiFAImLiolLoZxIQAh+QQJBgAQACwAAAAAGAAIAIQEAgS0srTc2tz08vTMyszk5uT8+vw0MjS8ury0trTk4uT09vTMzszs6uz8/vw0NjT///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFWiAELYMjno4gmCfkDItoEEGANKfwAMAjnA1EjWBg1I4G14HHO5gMiWOAEZUqIAIm86eQeo/XrBbA/RqlMceS6RxVa4xZLVHI7QCHn6hQRbAWDSwoKoIiLzEQIQAh+QQJBgAXACwAAAAAGAAIAIRUVlS0srTk4uR8enz08vTExsRsbmzs6uyMjoz8+vzU1tRkYmS8urzMzsxcWly0trTk5uR8fnz09vTMyszs7uycmpz8/vz///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFY+B1SYQlntYBmeeVQJSZTEHAHCcUOUCEiwqDw4GQNGrIhGgA4DkGIsIC0ARUHsia4AKpOiGXghewyGq5YwCu4Gw6jlnJ0gu9SKvWRKH2AIt0TQN+F0FNRSISMS0XKSuLCQKKIQAh+QQJBgAXACwAAAAAGAAIAIQEAgSkpqTU1tTs7uy8vrxUVlT8+vwkIiS0srTk4uTMyswMDgz09vS8urzs6uz08vTEwsRkZmT8/vy0trTk5uTMzswUEhT///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFZOB1MY8knhJpnpchUKahIEjjnAxEE8xJHABA4VGhGQ0ighFBEA0swWBkYgxMEpfHkva4BKLBxRaBHdACCHT3C14U0VbkRWlsXgYLcERGJQxOD3Q8PkBCfyMDKygMDIoiDAIJJiEAIfkECQYAFwAsAAAAABgACACEVFZUtLK05OLkxMbE9PL0jI6MvL68bG5s7Ors1NbU/Pr8ZGJkvLq8zM7MXFpctLa05ObkzMrM9Pb0nJqcxMLE7O7s/P78////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWPgdUmEJZ4WaZ6XAlWmEgUBg5wSRRvSmRwOR0HSoBkVIoMxYBARFgBHdPJYBgSXijVAuAykUsBii5VsK96oelFc9i5K40MkgYInigHtAcHFH28XP1EFXSMwLBcWFRIrJwoCiCEAOw=='); }\"\n + \".smarty-ui { position: absolute; z-index: 99999; text-shadow: none; text-align: left; text-decoration: none; }\"\n + \".smarty-popup { border: 3px solid #4C4C4C; padding: 0; background: #F6F6F6; box-shadow: 0px 10px 35px rgba(0, 0, 0, .8); }\"\n + \".smarty-popup-header { background: #DDD; height: 12px; text-transform: uppercase; font: bold 12px/1em 'Arial Black', sans-serif; padding: 12px; }\"\n + \".smarty-popup-ambiguous-header { color: #333; }\"\n + \".smarty-popup-invalid-header { color: #CC0000; }\"\n + \".smarty-popup-close { color: #CC0000 !important; text-decoration: none !important; position: absolute; right: 15px; top: 10px; display: block; padding: 4px 6px; text-transform: uppercase; }\"\n + \".smarty-popup-close:hover { color: #FFF !important; background: #CC0000; }\"\n + \".smarty-choice-list .smarty-choice { background: #FFF; padding: 10px 15px; color: #1A1A1A; }\"\n + \".smarty-choice { display: block; font: 300 14px/1.5em sans-serif; text-decoration: none !important; border-top: 1px solid #CCC; }\"\n + \".smarty-choice-list .smarty-choice:hover { color: #EEE !important; background: #333; text-decoration: none !important; }\"\n + \".smarty-choice-alt { border-top: 1px solid #4C4C4C; background: #F6F6F6 !important; box-shadow: inset 0 4px 15px -5px rgba(0, 0, 0, .45); }\"\n + \".smarty-choice-alt .smarty-choice-abort, .smarty-choice-override { padding: 6px 15px; color: #B3B3B3 !important; font-size: 12px; text-decoration: none !important; }\"\n + \".smarty-choice-alt .smarty-choice:first-child { border-top: 0; }\"\n + \".smarty-choice-abort:hover { color: #333 !important; }\"\n + \".smarty-choice-override:hover { color: #CC0000 !important; }\"\n + \".smarty-tag { position: absolute; display: block; overflow: hidden; font: 15px/1.2em sans-serif; text-decoration: none !important; width: 20px; height: 18px; border-radius: 25px; transition: all .25s; -moz-transition: all .25s; -webkit-transition: all .25s; -o-transition: all .25s; }\"\n + \".smarty-tag:hover { width: 70px; text-decoration: none !important; color: #999; }\"\n + \".smarty-tag:hover .smarty-tag-text { color: #000 !important; }\"\n + \".smarty-tag-grayed { border: 1px solid #B4B4B4 !important; color: #999 !important; background: #DDD !important; box-shadow: inset 0 9px 15px #FFF; }\"\n + \".smarty-tag-green { border: 1px solid #407513 !important; color: #407513 !important; background: #A6D187 !important; box-shadow: inset 0 9px 15px #E3F6D5; }\"\n + \".smarty-tag-grayed:hover { border-color: #333 !important; }\"\n + \".smarty-tag-check { padding-left: 4px; text-decoration: none !important; }\"\n + \".smarty-tag-text { font-size: 12px !important; position: absolute; top: 0; left: 16px; width: 50px !important; text-align: center !important; }\"\n + \".smarty-autocomplete { border: 1px solid #777; background: white; overflow: hidden; white-space: nowrap; box-shadow: 1px 1px 3px #555; }\"\n + \".smarty-suggestion { display: block; color: #444; text-decoration: none !important; font-size: 12px; padding: 1px 5px; }\"\n + \".smarty-active-suggestion { background: #EEE; color: #000; border: none; outline: none; }\"\n + \".smarty-no-suggestions { padding: 1px 5px; font-size: 12px; color: #AAA; font-style: italic; }\"\n + \"</style>\";\n\n\n this.postMappingOperations = function()\n {\n // Injects materials into the DOM, binds to form submit events, etc... very important.\n\n if (config.ui)\n {\n // Prepend CSS to head tag to allow cascading and give their style rules priority\n $('head').prepend(uiCss);\n\n // For each address on the page, inject the loader and \"address verified\" markup after the last element\n var addresses = instance.getMappedAddresses();\n for (var i = 0; i < addresses.length; i++)\n {\n var id = addresses[i].id();\n $('body').append('<div class=\"smarty-ui\"><div title=\"Loading...\" class=\"smarty-dots smarty-addr-'+id+'\"></div></div>');\n var offset = uiTagOffset(addresses[i].corners(true));\n $('body').append('<div class=\"smarty-ui\" style=\"top: '+offset.top+'px; left: '+offset.left+'px;\"><a href=\"javascript:\" class=\"smarty-tag smarty-tag-grayed smarty-addr-'+id+'\" title=\"Address not verified. Click to verify.\" data-addressid=\"'+id+'\"><span class=\"smarty-tag-check\">&#10003;</span><span class=\"smarty-tag-text\">Verify</span></a></div>');\n\n // Move the UI elements around when browser window is resized\n $(window).resize({ addr: addresses[i] }, function(e)\n {\n var addr = e.data.addr;\n var offset = uiTagOffset(addr.corners(true)); // Position of lil' tag\n $('.smarty-tag.smarty-addr-'+addr.id())\n .parent('.smarty-ui')\n .css('top', offset.top+'px')\n .css('left', offset.left+'px');\n\n var addrOffset = addr.corners(); // Position of any popup windows\n $('.smarty-popup.smarty-addr-'+addr.id())\n .parent('.smarty-ui')\n .css('top', addrOffset.top+'px')\n .css('left', addrOffset.left+'px');\n\n if (config.autocomplete) // Position of autocomplete boxes\n {\n var containerUi = $('.smarty-autocomplete.smarty-addr-'+addr.id()).closest('.smarty-ui');\n var domFields = addr.getDomFields();\n if (domFields['street'])\n {\n containerUi.css({\n \"left\": $(domFields['street']).offset().left + \"px\",\n \"top\": ($(domFields['street']).offset().top + $(domFields['street']).outerHeight()) + \"px\"\n });\n }\n }\n });\n\n // Disable for addresses defaulting to a foreign/non-US value\n if (!addresses[i].isDomestic())\n {\n var uiTag = $('.smarty-ui .smarty-tag.smarty-addr-'+id)\n if (uiTag.is(':visible'))\n uiTag.hide();\n addresses[i].accept({ address: addresses[i] }, false);\n }\n }\n\n $('body').delegate('.smarty-tag-grayed', 'click', function(e)\n {\n // \"Verify\" clicked -- manually invoke verification\n var addrId = $(this).data('addressid');\n instance.verify(addrId);\n });\n\n $('body').delegate('.smarty-undo', 'click', function(e)\n {\n // \"Undo\" clicked -- replace field values with previous input\n var addrId = $(this).parent().data('addressid');\n var addr = instance.getMappedAddressByID(addrId);\n addr.undo(true);\n // If fields are re-mapped after an address was verified, it loses its \"accepted\" status even if no values were changed.\n // Thus, in some rare occasions, the undo link and the \"verified!\" text may not disappear when the user clicks \"Undo\",\n // The undo functionality still works in those cases, but with no visible changes, the address doesn't fire \"AddressChanged\"...\n });\n\n\n\n // Prepare autocomplete UI\n if (config.autocomplete && config.key)\n {\n // For every mapped address, wire up autocomplete\n for (var i = 0; i < forms.length; i++)\n {\n var f = forms[i];\n\n for (var j = 0; j < f.addresses.length; j++)\n {\n var addr = f.addresses[j];\n var domFields = addr.getDomFields();\n\n if (domFields['street'])\n {\n var strField = $(domFields['street']);\n var containerUi = $('<div class=\"smarty-ui\"></div>');\n var autoUi = $('<div class=\"smarty-autocomplete\"></div>');\n\n autoUi.addClass('smarty-addr-' + addr.id());\n containerUi.data(\"addrID\", addr.id())\n containerUi.append(autoUi);\n\n containerUi.css({\n \"position\": \"absolute\",\n \"left\": strField.offset().left + \"px\",\n \"top\": (strField.offset().top + strField.outerHeight()) + \"px\"\n });\n\n containerUi.hide().appendTo(\"body\");\n\n containerUi.delegate(\".smarty-suggestion\", \"click\", { addr: addr, containerUi: containerUi }, function(event) {\n var sugg = autocompleteResponse.suggestions[$(this).data('suggIndex')];\n useAutocompleteSuggestion(event.data.addr, sugg, event.data.containerUi);\n });\n\n containerUi.delegate(\".smarty-suggestion\", \"mouseover\", function() {\n $('.smarty-active-suggestion').removeClass('smarty-active-suggestion');\n $(this).addClass('smarty-active-suggestion');\n });\n\n containerUi.delegate(\".smarty-active-suggestion\", \"mouseleave\", function() {\n $(this).removeClass('smarty-active-suggestion');\n });\n\n\n strField.attr(\"autocomplete\", \"off\"); // Tell Firefox to keep quiet\n\n strField.blur({ containerUi: containerUi }, function(event) {\n setTimeout( (function(event) { return function() { if (event.data) event.data.containerUi.hide(); }; })(event), 300); // This line is proudly IE9-compatible\n });\n\n strField.keydown({ containerUi: containerUi, addr: addr }, function(event) {\n var suggContainer = $('.smarty-autocomplete', event.data.containerUi);\n var currentChoice = $('.smarty-active-suggestion:visible', suggContainer).first();\n var choiceSelectionIsNew = false;\n\n if (event.keyCode == 9) // Tab key\n {\n if (currentChoice.length > 0)\n {\n var domFields = event.data.addr.getDomFields();\n if (domFields['zipcode'])\n $(domFields['zipcode']).focus();\n else\n $(domFields['street']).blur();\n useAutocompleteSuggestion(event.data.addr, autocompleteResponse.suggestions[currentChoice.data(\"suggIndex\")], event.data.containerUi);\n return addr.isFreeform() ? true : suppress(event);\n }\n else\n event.data.containerUi.hide();\n return;\n }\n else if (event.keyCode == 40) // Down arrow\n {\n if (!currentChoice.hasClass('smarty-suggestion'))\n {\n currentChoice = $('.smarty-suggestion', suggContainer).first().mouseover();\n choiceSelectionIsNew = true;\n }\n\n if (!choiceSelectionIsNew)\n {\n if (currentChoice.next('.smarty-addr-'+event.data.addr.id()+' .smarty-suggestion').length > 0)\n currentChoice.next('.smarty-suggestion').mouseover();\n else\n currentChoice.removeClass('smarty-active-suggestion');\n }\n\n moveCursorToEnd(this);\n return;\n }\n else if (event.keyCode == 38) // Up arrow\n {\n if (!currentChoice.hasClass('smarty-suggestion'))\n {\n currentChoice = $('.smarty-suggestion', suggContainer).last().mouseover();\n choiceSelectionIsNew = true;\n }\n\n if (!choiceSelectionIsNew)\n {\n if (currentChoice.prev('.smarty-addr-'+event.data.addr.id()+' .smarty-suggestion').length > 0)\n currentChoice.prev('.smarty-suggestion').mouseover();\n else\n currentChoice.removeClass('smarty-active-suggestion');\n }\n\n moveCursorToEnd(this);\n return;\n }\n });\n\n // Flip the on switch!\n strField.keyup({ form: f, addr: addr, streetField: strField, containerUi: containerUi }, doAutocomplete);\n }\n }\n\n $(document).keyup(function(event) {\n if (event.keyCode == 27) // Esc key\n $('.smarty-autocomplete').closest('.smarty-ui').hide();\n });\n }\n\n // Try .5 and 1.5 seconds after the DOM loads to re-position UI elements; hack for Firefox.\n setTimeout(function() { $(window).resize(); }, 500);\n setTimeout(function() { $(window).resize(); }, 1500);\n }\n }\n\n if (config.submitVerify)\n {\n // Bind to form submits through form submit and submit button click events\n for (var i = 0; i < forms.length; i++)\n {\n var f = forms[i];\n\n submitHandler = function(e)\n {\n // Don't invoke verification if it's already processing or autocomplete is open and the user was pressing Enter to use a suggestion\n if ((e.data.form && e.data.form.processing) || $('.smarty-active-suggestion:visible').length > 0)\n return suppress(e);\n\n /*\n IMPORTANT!\n Prior to version 2.4.8, the plugin would call syncWithDom() at submit-time\n in case programmatic changes were made to the address input fields, including\n browser auto-fills. The sync function would detect those changes and force\n a re-verification to not let invalid addresses through. Unfortunately, this\n frequently caused infinite loops (runaway lookups), ultimately preventing\n form submission, which is unacceptable. As a safety measure to protect our\n customer's subscriptions, we've removed syncWithDom(). The website owner is\n responsible for making sure that any changes to address field values raise the\n \"change\" event on that element. Example: $('#city').val('New City').change();\n */\n\n if (!e.data.form.allActiveAddressesAccepted())\n {\n // We could verify all the addresses at once, but that can overwhelm the user.\n // An API request is usually quick, so let's do one at a time: it's much cleaner.\n var unaccepted = e.data.form.activeAddressesNotAccepted();\n if (unaccepted.length > 0)\n trigger(\"VerificationInvoked\", { address: unaccepted[0], invoke: e.data.invoke, invokeFn: e.data.invokeFn });\n return suppress(e);\n }\n };\n\n // Performs the tricky operation of uprooting existing event handlers that we have references to\n // (either by jQuery's data cache or HTML attributes) planting ours, then laying theirs on top\n var bindSubmitHandler = function(domElement, eventName)\n {\n if (!domElement || !eventName)\n return;\n\n var oldHandlers = [], eventsRef = $._data(domElement, 'events');\n\n // If there are previously-bound-event-handlers (from jQuery), get those.\n if (eventsRef && eventsRef[eventName] && eventsRef[eventName].length > 0)\n {\n // Get a reference to the old handlers previously bound by jQuery\n oldHandlers = $.extend(true, [], eventsRef[eventName]);\n }\n\n // Unbind them...\n $(domElement).unbind(eventName);\n\n // ... then bind ours first ...\n $(domElement)[eventName]({ form: f, invoke: domElement, invokeFn: eventName }, submitHandler);\n\n // ... then bind theirs last:\n // First bind their onclick=\"...\" or onsubmit=\"...\" handles...\n if (typeof domElement['on'+eventName] === 'function')\n {\n var temp = domElement['on'+eventName];\n domElement['on'+eventName] = null;\n $(domElement)[eventName](temp);\n }\n\n // ... then finish up with their old jQuery handles.\n for (var j = 0; j < oldHandlers.length; j++)\n $(domElement)[eventName](oldHandlers[j].data, oldHandlers[j].handler);\n };\n\n // Take any existing handlers (bound via jQuery) and re-bind them for AFTER our handler(s).\n var formSubmitElements = $(config.submitSelector, f.dom);\n\n // Form submit() events are apparently invoked by CLICKING the submit button (even jQuery does this at its core for binding)\n // (but jQuery, when raising a form submit event with .submit() will NOT necessarily click the submit button)\n formSubmitElements.each(function(idx) {\n bindSubmitHandler(this, 'click'); // These get fired first\n });\n\n // These fire after button clicks, so these need to be bound AFTER binding to the submit button click events\n bindSubmitHandler(f.dom, 'submit');\n }\n }\n\n trigger(\"MapInitialized\");\n };\n\n function doAutocomplete(event)\n {\n var addr = event.data.addr;\n var streetField = event.data.streetField;\n var input = $.trim(event.data.streetField.val());\n var containerUi = event.data.containerUi;\n var suggContainer = $('.smarty-autocomplete', containerUi);\n\n if (!input)\n {\n addr.lastStreetInput = input;\n suggContainer.empty();\n containerUi.hide();\n }\n\n if (event.keyCode == 13) // Enter/return\n {\n if ($('.smarty-active-suggestion:visible').length > 0)\n useAutocompleteSuggestion(addr, autocompleteResponse.suggestions[$('.smarty-active-suggestion:visible').first().data('suggIndex')], containerUi);\n containerUi.hide();\n streetField.blur();\n return suppress(event);\n }\n\n if (event.keyCode == 40) // Down arrow\n {\n moveCursorToEnd(streetField[0]);\n return;\n }\n\n if (event.keyCode == 38) // Up arrow\n {\n moveCursorToEnd(streetField[0]);\n return;\n }\n\n if (!input || input == addr.lastStreetInput || !addr.isDomestic())\n return;\n\n addr.lastStreetInput = input; // Used so that autocomplete only fires on real changes (i.e. not just whitespace)\n\n trigger('AutocompleteInvoked', {\n containerUi: containerUi,\n suggContainer: suggContainer,\n streetField: streetField,\n input: input,\n addr: addr\n });\n }\n\n this.requestAutocomplete = function(event, data)\n {\n if (data.input && data.addr.isDomestic() && autocompleteResponse)\n data.containerUi.show();\n\n var autocplrequest = {\n callback: function(counter, json)\n {\n autocompleteResponse = json;\n data.suggContainer.empty();\n\n if (!json.suggestions || json.suggestions.length == 0)\n {\n data.suggContainer.html('<div class=\"smarty-no-suggestions\">No suggestions</div>');\n return;\n }\n\n for (var j = 0; j < json.suggestions.length; j++)\n {\n var link = $('<a href=\"javascript:\" class=\"smarty-suggestion\">' + json.suggestions[j].text.replace(/<|>/g, \"\") + '</a>');\n link.data(\"suggIndex\", j);\n data.suggContainer.append(link);\n }\n\n data.suggContainer.css({\n \"width\": Math.max(data.streetField.outerWidth(), 250) + \"px\"\n });\n\n data.containerUi.show();\n\n // Delete all older callbacks so they don't get executed later because of latency\n autocplRequests.splice(0, counter);\n },\n number: autocplCounter++\n };\n\n autocplRequests[autocplrequest.number] = autocplrequest;\n\n $.getJSON(\"https://autocomplete-api.smartystreets.com/suggest?callback=?\", {\n \"auth-id\": config.key,\n prefix: data.input,\n city_filter: config.cityFilter,\n state_filter: config.stateFilter,\n prefer: config.cityStatePreference,\n suggestions: config.autocomplete,\n geolocate: config.geolocate\n }, function(json)\n {\n trigger(\"AutocompleteReceived\", $.extend(data, {\n json: json,\n autocplrequest: autocplrequest\n }));\n });\n };\n\n this.showAutocomplete = function(event, data)\n {\n if (autocplRequests[data.autocplrequest.number])\n autocplRequests[data.autocplrequest.number].callback(data.autocplrequest.number, data.json);\n };\n\n function useAutocompleteSuggestion(addr, suggestion, containerUi)\n {\n var domfields = addr.getDomFields();\n containerUi.hide(); // It's important that the suggestions are hidden before AddressChanged event fires\n\n if (addr.isFreeform())\n $(domfields['street']).val(suggestion.text).change();\n else\n {\n if (domfields['street'])\n $(domfields['street']).val(suggestion.street_line).change();\n if (domfields['city'])\n $(domfields['city']).val(suggestion.city).change();\n if (domfields['state'])\n $(domfields['state']).val(suggestion.state).change();\n if (domfields['lastline'])\n $(domfields['lastline']).val(suggestion.city + \" \" + suggestion.state).change();\n }\n }\n\n // Computes where the little checkmark tag of the UI goes, relative to the boundaries of the last field\n function uiTagOffset(corners)\n {\n return {\n top: corners.top + corners.height / 2 - 10,\n left: corners.right - 6\n };\n }\n\n // This function is used to find and properly map elements to their field type\n function filterDomElement(domElement, names, labels)\n {\n /*\n Where we look to find a match, in this order:\n name, id, <label> tags, placeholder, title\n Our searches first conduct fairly liberal \"contains\" searches:\n if the attribute even contains the name or label, we map it.\n The names and labels we choose to find are very particular.\n */\n\n var name = lowercase(domElement.name);\n var id = lowercase(domElement.id);\n var selectorSafeID = id.replace(/[\\[|\\]|\\(|\\)|\\:|\\'|\\\"|\\=|\\||\\#|\\.|\\!|\\||\\@|\\^|\\&|\\*]/g, '\\\\\\\\$&');\n var placeholder = lowercase(domElement.placeholder);\n var title = lowercase(domElement.title);\n\n // First look through name and id attributes of the element, the most common\n for (var i = 0; i < names.length; i++)\n if (name.indexOf(names[i]) > -1 || id.indexOf(names[i]) > -1)\n return true;\n\n // If we can't find it in name or id, look at labels associated to the element.\n // Webkit automatically associates labels with form elements for us. But for other\n // browsers, we have to find them manually, which this next block does.\n if (!('labels' in domElement))\n {\n var lbl = $('label[for=\"' + selectorSafeID + '\"]')[0] || $(domElement).parents('label')[0];\n domElement.labels = !lbl ? [] : [lbl];\n }\n\n // Iterate through the <label> tags now to search for a match.\n for (var i = 0; i < domElement.labels.length; i++)\n {\n // This inner loop compares each label value with what we're looking for\n for (var j = 0; j < labels.length; j++)\n if ($(domElement.labels[i]).text().toLowerCase().indexOf(labels[j]) > -1)\n return true;\n }\n\n // Still not found? Then look in \"placeholder\" or \"title\"...\n for (var i = 0; i < labels.length; i++)\n if (placeholder.indexOf(labels[i]) > -1 || title.indexOf(labels[i]) > -1)\n return true;\n\n // Got all the way to here? Probably not a match then.\n return false;\n };\n\n // User aborted the verification process (X click or esc keyup)\n function userAborted(uiPopup, e)\n {\n // Even though there may be more than one bound, and this disables the others,\n // this is for simplicity: and I figure, it won't happen too often.\n // (Otherwise \"Completed\" events are raised by pressing Esc even if nothing is happening)\n $(document).unbind('keyup');\n $(uiPopup).slideUp(defaults.speed, function() { $(this).parent('.smarty-ui').remove(); });\n trigger(\"Completed\", e.data);\n }\n\n // When we're done with a \"pop-up\" where the user chooses what to do,\n // we need to remove all other events bound on that whole \"pop-up\"\n // so that it doesn't interfere with any future \"pop-ups\".\n function undelegateAllClicks(selectors)\n {\n for (var selector in selectors)\n $('body').undelegate(selectors[selector], 'click');\n }\n\n // Utility function\n function moveCursorToEnd(el) // Courtesy of http://css-tricks.com/snippets/javascript/move-cursor-to-end-of-input/\n {\n if (typeof el.selectionStart == \"number\")\n el.selectionStart = el.selectionEnd = el.value.length;\n else if (typeof el.createTextRange != \"undefined\")\n {\n el.focus();\n var range = el.createTextRange();\n range.collapse(false);\n range.select();\n }\n }\n\n\n // If anything was previously mapped, this resets it all for a new mapping.\n this.clean = function()\n {\n if (forms.length == 0)\n return;\n\n if (config.debug)\n console.log(\"Cleaning up old form map data and bindings...\");\n\n // Spare none alive!\n\n for (var i = 0; i < forms.length; i++)\n {\n $(forms[i].dom).data(mapMeta.formDataProperty, '');\n\n // Clean up each form's DOM by resetting the address fields to the way they were\n for (var j = 0; j < forms[i].addresses.length; j++)\n {\n var doms = forms[i].addresses[j].getDomFields();\n for (var prop in doms)\n {\n if (config.debug)\n $(doms[prop]).css('background', 'none').attr('placeholder', '');\n $(doms[prop]).unbind('change');\n }\n if (doms['street'])\n $(doms['street']).unbind('keyup').unbind('keydown').unbind('blur');\n }\n\n // Unbind our form submit and submit-button click handlers\n $.each(forms, function(idx) { $(this.dom).unbind('submit', submitHandler); });\n $(config.submitSelector, forms[i].dom).each(function(idx) { $(this).unbind('click', submitHandler); });\n }\n\n $('.smarty-ui').undelegate('.smarty-suggestion', 'click').undelegate('.smarty-suggestion', 'mouseover').undelegate('.smarty-suggestion', 'mouseleave').remove();\n $('body').undelegate('.smarty-undo', 'click');\n $('body').undelegate('.smarty-tag-grayed', 'click');\n $(window).unbind('resize');\n $(document).unbind('keyup');\n\n forms = [];\n mappedAddressCount = 0;\n\n if (config.debug)\n console.log(\"Done cleaning up; ready for new mapping.\");\n };\n\n\n // ** AUTOMAPPING ** //\n this.automap = function(context)\n {\n if (config.debug)\n console.log(\"Automapping fields...\");\n\n this.clean();\n\n //$('form').add($('iframe').contents().find('form')).each(function(idx) // Include forms in iframes, but they must be hosted on same domain (and iframe must have already loaded)\n $('form').each(function(idx) // For each form ...\n {\n var form = new Form(this);\n var potential = {};\n\n // Look for each type of field in this form\n for (var fieldName in mapMeta.identifiers)\n {\n var names = mapMeta.identifiers[fieldName].names;\n var labels = mapMeta.identifiers[fieldName].labels;\n\n // Find matching form elements and store them away\n potential[fieldName] = $(config.fieldSelector, this)\n .filter(function()\n {\n // This potential address input element must be within the user's set of selected elements\n return $(context).has(this).length > 0; // (Using has() is compatible with as low as jQuery 1.4)\n })\n .filter(':visible') // No \"hidden\" input fields allowed\n .filter(function()\n {\n var name = lowercase(this.name), id = lowercase(this.id);\n\n // \"Street address line 1\" is a special case because \"address\" is an ambiguous\n // term, so we pre-screen this field by looking for exact matches.\n if (fieldName == \"streets\")\n {\n for (var i = 0; i < mapMeta.street1exacts.names.length; i++)\n if (name == mapMeta.street1exacts.names[i] || id == mapMeta.street1exacts.names[i])\n return true;\n }\n\n // Now perform the main filtering.\n // If this is TRUE, then this form element is probably a match for this field type.\n var filterResult = filterDomElement(this, names, labels);\n\n if (fieldName == \"streets\")\n {\n // Looking for \"address\" is a very liberal search, so we need to see if it contains another\n // field name, too... this helps us find freeform addresses (SLAP).\n var otherFields = [\"secondary\", \"city\", \"state\", \"zipcode\", \"country\", \"lastline\"];\n for (var i = 0; i < otherFields.length; i ++)\n {\n // If any of these filters turns up true, then it's\n // probably neither a \"street\" field, nor a SLAP address.\n if (filterDomElement(this, mapMeta.identifiers[otherFields[i]].names,\n mapMeta.identifiers[otherFields[i]].labels))\n return false;\n }\n }\n\n return filterResult;\n })\n .not(function()\n {\n // The filter above can be a bit liberal at times, so we need to filter out\n // results that are actually false positives (fields that aren't part of the address)\n // Returning true from this function excludes the element from the result set.\n var name = lowercase(this.name), id = lowercase(this.id);\n if (name == \"name\" || id == \"name\") // Exclude fields like \"First Name\", et al.\n return true;\n return filterDomElement(this, mapMeta.exclude.names, mapMeta.exclude.labels);\n })\n .toArray();\n }\n\n // Now prepare to differentiate between street1 and street2.\n potential.street = [], potential.street2 = [];\n\n // If the ratio of 'street' fields to the number of addresses in the form\n // (estimated by number of city or zip fields) is about the same, it's all street1.\n if (potential.streets.length <= potential.city.length * 1.5\n || potential.streets.length <= potential.zipcode.length * 1.5)\n {\n potential.street = potential.streets;\n }\n else\n {\n // Otherwise, differentiate between the two\n for (var i = 0; i < potential.streets.length; i++)\n {\n // Try to map it to a street2 field first. If it fails, it's street1.\n // The second condition is for naming schemes like \"street[]\" or \"address[]\", where the names\n // are the same: the second one is usually street2.\n var current = potential.streets[i];\n if (filterDomElement(current, mapMeta.street2.names, mapMeta.street2.labels)\n || (i > 0 && current.name == potential.streets[i-1].name))\n {\n // Mapped it to street2\n potential.street2.push(current);\n }\n else // Could not map to street2, so put it in street1\n potential.street.push(current);\n }\n }\n\n delete potential.streets; // No longer needed; we've moved them into street/street2.\n\n if (config.debug)\n console.log(\"For form \" + idx + \", the initial scan found these fields:\", potential);\n\n\n\n // Now organize the mapped fields into addresses\n\n // The number of addresses will be the number of street1 fields,\n // and in case we support it in the future, maybe street2, or\n // in case a mapping went a little awry.\n var addressCount = Math.max(potential.street.length, potential.street2.length);\n\n if (config.debug && addressCount == 0)\n console.log(\"No addresses were found in form \" + idx + \".\");\n\n for (var i = 0; i < addressCount; i++)\n {\n var addrObj = {};\n for (var field in potential)\n {\n var current = potential[field][i];\n if (current)\n addrObj[field] = current;\n }\n\n // Don't map the address if there's not enough fields for a complete address\n var hasCityAndStateOrZip = addrObj.zipcode || (addrObj.state && addrObj.city);\n var hasCityOrStateOrZip = addrObj.city || addrObj.state || addrObj.zipcode;\n if ((!addrObj.street && hasCityAndStateOrZip) || (addrObj.street && !hasCityAndStateOrZip && hasCityOrStateOrZip))\n {\n if (config.debug)\n console.log(\"Form \" + idx + \" contains some address input elements that could not be resolved to a complete address.\");\n continue;\n }\n\n form.addresses.push(new Address(addrObj, form, \"auto\" + (++mappedAddressCount)));\n }\n\n // Save the form we just finished mapping\n forms.push(form);\n\n if (config.debug)\n console.log(\"Form \" + idx + \" is finished:\", form);\n });\n\n if (config.debug)\n console.log(\"Automapping complete.\");\n\n trigger(\"FieldsMapped\");\n };\n\n\n // ** MANUAL MAPPING ** //\n this.mapFields = function(map, context)\n {\n // \"map\" should be an array of objects mapping field types\n // to a field by selector, all supplied by the user.\n // \"context\" should be the set of elements in which fields will be mapped\n // Context can be acquired like: $('#something').not('#something-else').LiveAddress( ... ); ...\n\n if (config.debug)\n console.log(\"Manually mapping fields given this data:\", map);\n\n this.clean();\n var formsFound = [];\n map = map instanceof Array ? map : [map];\n\n for (var addrIdx in map)\n {\n var address = map[addrIdx];\n\n if (!address.street)\n continue;\n\n // Convert selectors into actual DOM references\n for (var fieldType in address)\n {\n if (fieldType != \"id\")\n {\n if (!arrayContains(acceptableFields, fieldType))\n { // Make sure the field name is allowed\n if (config.debug)\n console.log(\"NOTICE: Field named \" + fieldType + \" is not allowed. Skipping...\");\n delete address[fieldType];\n continue;\n }\n var matched = $(address[fieldType], context);\n if (matched.length == 0)\n { // Don't try to map an element that couldn't be matched or found at all\n if (config.debug)\n console.log(\"NOTICE: No matches found for selector \" + address[fieldType] + \". Skipping...\");\n delete address[fieldType];\n continue;\n }\n else if (matched.parents('form').length == 0)\n { // We should only map elements inside a <form> tag; otherwise we can't bind to submit handlers later\n if (config.debug)\n console.log(\"NOTICE: Element with selector \\\"\" + address[fieldType] + \"\\\" is not inside a <form> tag. Skipping...\");\n delete address[fieldType];\n continue;\n }\n else\n address[fieldType] = matched[0];\n }\n }\n\n if (!((address.street) && (((address.city) && (address.state)) || (address.zipcode) || (address.lastline)\n || (!address.street2 && !address.city && !address.state && !address.zipcode && !address.lastline))))\n {\n if (config.debug)\n console.log(\"NOTICE: Address map (index \"+addrIdx+\") was not mapped to a complete street address. Skipping...\");\n continue;\n }\n\n // Acquire the form based on the street address field (the required field)\n var formDom = $(address.street).parents('form')[0];\n var form = new Form(formDom);\n\n // Persist a reference to the form if it wasn't acquired before\n if (!$(formDom).data(mapMeta.formDataProperty))\n {\n // Mark the form as mapped then add it to our list\n $(formDom).data(mapMeta.formDataProperty, 1);\n formsFound.push(form);\n }\n else\n {\n // Find the form in our list since we already put it there\n for (var i = 0; i < formsFound.length; i++)\n {\n if (formsFound[i].dom == formDom)\n {\n form = formsFound[i];\n break;\n }\n }\n }\n\n // Add this address to the form\n mappedAddressCount ++;\n form.addresses.push(new Address(address, form, address.id));\n\n if (config.debug)\n console.log(\"Finished mapping address with ID: \"+form.addresses[form.addresses.length-1].id());\n }\n\n forms = formsFound;\n trigger(\"FieldsMapped\");\n };\n\n\n this.disableFields = function(address)\n {\n // Given an address, disables the input fields for the address, also the submit button\n if (!config.ui)\n return;\n\n var fields = address.getDomFields();\n for (var field in fields)\n $(fields[field]).prop ? $(fields[field]).prop('disabled', true) : $(fields[field]).attr('disabled', 'disabled');\n\n // Disable submit buttons\n if (address.form && address.form.dom)\n {\n var buttons = $(config.submitSelector, address.form.dom);\n buttons.prop ? buttons.prop('disabled', true) : buttons.attr('disabled', 'disabled');\n }\n };\n\n this.enableFields = function(address)\n {\n // Given an address, re-enables the input fields for the address\n if (!config.ui)\n return;\n\n var fields = address.getDomFields();\n for (var field in fields)\n $(fields[field]).prop ? $(fields[field]).prop('disabled', false) : $(fields[field]).removeAttr('disabled');\n\n // Enable submit buttons\n if (address.form && address.form.dom)\n {\n var buttons = $(config.submitSelector, address.form.dom);\n buttons.prop ? buttons.prop('disabled', false) : buttons.removeAttr('disabled');\n }\n };\n\n this.showLoader = function(addr)\n {\n if (!config.ui || !addr.hasDomFields())\n return;\n\n // Get position information now instead of earlier in case elements shifted since page load\n var lastFieldCorners = addr.corners(true);\n var loaderUI = $('.smarty-dots.smarty-addr-'+addr.id()).parent();\n\n loaderUI.css(\"top\", (lastFieldCorners.top + lastFieldCorners.height / 2 - loaderHeight / 2) + \"px\")\n .css(\"left\", (lastFieldCorners.right - loaderWidth - 10) + \"px\");\n $('.smarty-dots', loaderUI).show();\n };\n\n this.hideLoader = function(addr)\n {\n if (config.ui)\n $('.smarty-dots.smarty-addr-'+addr.id()).hide();\n };\n\n this.markAsValid = function(addr)\n {\n if (!config.ui || !addr)\n return;\n\n var domTag = $('.smarty-tag.smarty-tag-grayed.smarty-addr-'+addr.id());\n domTag.removeClass('smarty-tag-grayed').addClass('smarty-tag-green').attr(\"title\", \"Address verified! Click to undo.\");\n $('.smarty-tag-text', domTag).text('Verified').hover(function () {\n $(this).text('Undo');\n }, function() {\n $(this).text('Verified');\n }).addClass('smarty-undo');\n };\n\n this.unmarkAsValid = function(addr)\n {\n var validSelector = '.smarty-tag.smarty-addr-'+addr.id();\n if (!config.ui || !addr || $(validSelector).length == 0)\n return;\n\n var domTag = $('.smarty-tag.smarty-tag-green.smarty-addr-'+addr.id());\n domTag.removeClass('smarty-tag-green').addClass('smarty-tag-grayed').attr(\"title\", \"Address not verified. Click to verify.\");\n $('.smarty-tag-text', domTag).text('Verify').unbind('mouseenter mouseleave').removeClass('smarty-undo');\n };\n\n this.showAmbiguous = function(data)\n {\n if (!config.ui || !data.address.hasDomFields())\n return;\n\n var addr = data.address;\n var response = data.response;\n var corners = addr.corners();\n corners.width = Math.max(corners.width, 300); // minimum width\n corners.height = Math.max(corners.height, response.length * 63 + 119); // minimum height\n\n var html = '<div class=\"smarty-ui\" style=\"top: '+corners.top+'px; left: '+corners.left+'px; width: '+corners.width+'px; height: '+corners.height+'px;\">'\n + '<div class=\"smarty-popup smarty-addr-'+addr.id()+'\" style=\"width: '+(corners.width - 6)+'px; height: '+(corners.height - 3)+'px;\">'\n + '<div class=\"smarty-popup-header smarty-popup-ambiguous-header\">'+config.ambiguousMessage+'<a href=\"javascript:\" class=\"smarty-popup-close smarty-abort\" title=\"Cancel\">x</a></div>'\n + '<div class=\"smarty-choice-list\">';\n\n for (var i = 0; i < response.raw.length; i++)\n {\n var line1 = response.raw[i].delivery_line_1, city = response.raw[i].components.city_name,\n st = response.raw[i].components.state_abbreviation,\n zip = response.raw[i].components.zipcode + \"-\" + response.raw[i].components.plus4_code;\n html += '<a href=\"javascript:\" class=\"smarty-choice\" data-index=\"'+i+'\">'+line1+'<br>'+city+', '+st+' '+zip+'</a>';\n }\n\n html += '</div><div class=\"smarty-choice-alt\">';\n html += '<a href=\"javascript:\" class=\"smarty-choice smarty-choice-abort smarty-abort\">Click here to change your address</a>';\n html += '<a href=\"javascript:\" class=\"smarty-choice smarty-choice-override\">Click here to certify the address is correct<br>('+addr.toString()+')</a>';\n html += '</div></div></div>';\n $(html).hide().appendTo('body').show(defaults.speed);\n\n // Scroll to it if needed\n if ($(document).scrollTop() > corners.top - 100\n || $(document).scrollTop() < corners.top - $(window).height() + 100)\n {\n $('html, body').stop().animate({\n scrollTop: $('.smarty-popup.smarty-addr-'+addr.id()).offset().top - 100\n }, 500);\n }\n\n data.selectors = {\n goodAddr: '.smarty-popup.smarty-addr-'+addr.id()+' .smarty-choice-list .smarty-choice',\n useOriginal: '.smarty-popup.smarty-addr-'+addr.id()+' .smarty-choice-override',\n abort: '.smarty-popup.smarty-addr-'+addr.id()+' .smarty-abort'\n };\n\n // User chose a candidate address\n $('body').delegate(data.selectors.goodAddr, 'click', data, function(e)\n {\n $('.smarty-popup.smarty-addr-'+addr.id()).slideUp(defaults.speed, function()\n {\n $(this).parent('.smarty-ui').remove();\n $(this).remove();\n });\n\n undelegateAllClicks(e.data.selectors);\n delete e.data.selectors;\n\n trigger(\"UsedSuggestedAddress\", {\n address: e.data.address,\n response: e.data.response,\n invoke: e.data.invoke,\n invokeFn: e.data.invokeFn,\n chosenCandidate: response.raw[$(this).data('index')]\n });\n });\n\n // User wants to revert to what they typed (forced accept)\n $('body').delegate(data.selectors.useOriginal, 'click', data, function(e)\n {\n $(this).parents('.smarty-popup').slideUp(defaults.speed, function()\n {\n $(this).parent('.smarty-ui').remove();\n $(this).remove();\n });\n\n undelegateAllClicks(e.data.selectors);\n delete e.data.selectors;\n trigger(\"OriginalInputSelected\", e.data);\n });\n\n // User presses Esc key\n $(document).keyup(data, function(e)\n {\n if (e.keyCode == 27) //Esc\n {\n undelegateAllClicks(e.data.selectors);\n delete e.data.selectors;\n userAborted($('.smarty-popup.smarty-addr-'+e.data.address.id()), e);\n suppress(e);\n }\n });\n\n // User clicks \"x\" in corner or chooses to try a different address (same effect as Esc key)\n $('body').delegate(data.selectors.abort, 'click', data, function(e)\n {\n undelegateAllClicks(e.data.selectors);\n delete e.data.selectors;\n userAborted($(this).parents('.smarty-popup'), e);\n });\n };\n\n\n this.showInvalid = function(data)\n {\n if (!config.ui || !data.address.hasDomFields())\n return;\n\n var addr = data.address;\n var response = data.response;\n var corners = addr.corners();\n corners.width = Math.max(corners.width, 300); // minimum width\n corners.height = Math.max(corners.height, 180); // minimum height\n\n var html = '<div class=\"smarty-ui\" style=\"top: '+corners.top+'px; left: '+corners.left+'px; width: '+corners.width+'px; height: '+corners.height+'px;\">'\n + '<div class=\"smarty-popup smarty-addr-'+addr.id()+'\" style=\"width: '+(corners.width - 6)+'px; height: '+(corners.height - 3)+'px;\">'\n + '<div class=\"smarty-popup-header smarty-popup-invalid-header\">'+config.invalidMessage+'<a href=\"javascript:\" class=\"smarty-popup-close smarty-abort\" title=\"Cancel\">x</a></div>'\n + '<div class=\"smarty-choice-list\"><a href=\"javascript:\" class=\"smarty-choice smarty-choice-abort smarty-abort\">Click here to change your address</a></div>'\n + '<div class=\"smarty-choice-alt\"><a href=\"javascript:\" class=\"smarty-choice smarty-choice-override\">Click here to certify the address is correct<br>('+addr.toString()+')</a></div>'\n + '</div></div>';\n\n $(html).hide().appendTo('body').show(defaults.speed);\n\n data.selectors = {\n useOriginal: '.smarty-popup.smarty-addr-'+addr.id()+' .smarty-choice-override ',\n abort: '.smarty-popup.smarty-addr-'+addr.id()+' .smarty-abort'\n }\n\n // Scroll to it if necessary\n if ($(document).scrollTop() > corners.top - 100\n || $(document).scrollTop() < corners.top - $(window).height() + 100)\n {\n $('html, body').stop().animate({\n scrollTop: $('.smarty-popup.smarty-addr-'+addr.id()).offset().top - 100\n }, 500);\n }\n\n // User rejects original input and agrees to double-check it\n $('body').delegate(data.selectors.abort, 'click', data, function(e)\n {\n userAborted('.smarty-popup.smarty-addr-'+e.data.address.id(), e);\n delete e.data.selectors;\n trigger(\"InvalidAddressRejected\", e.data);\n });\n\n // User certifies that what they typed is correct\n $('body').delegate(data.selectors.useOriginal, 'click', data, function(e)\n {\n userAborted('.smarty-popup.smarty-addr-'+e.data.address.id(), e);\n delete e.data.selectors;\n trigger(\"OriginalInputSelected\", e.data);\n });\n\n // User presses esc key\n $(document).keyup(data, function(e)\n {\n if (e.keyCode == 27) //Esc\n {\n $(data.selectors.abort).click();\n undelegateAllClicks(e.data.selectors);\n userAborted('.smarty-popup.smarty-addr-'+e.data.address.id(), e);\n }\n });\n };\n\n this.isDropdown = function(dom)\n {\n return dom && ((dom.tagName || dom.nodeName || \"\").toUpperCase() == \"SELECT\");\n };\n }", "title": "" }, { "docid": "f06f6524f3ab57367b574294e5f10d61", "score": "0.60588926", "text": "function encodeForm(form)\r\n{\r\n\tfunction encode(inputs)\r\n\t{\r\n\t\tfor (var i = 0; i < inputs.length; ++i)\r\n\t\t{\r\n\t\t\tif (inputs[i].name)\r\n\t\t\t\tif (inputs[i].type != \"checkbox\" || inputs[i].checked)\r\n\t\t\t\t\targs.push(inputs[i].name + \"=\" + escape(inputs[i].value));\r\n\t\t\t\telse\r\n\t\t\t\t\targs.push(inputs[i].name + \"=\" + escape(\"false\"));\r\n\t\t}\r\n\t}\r\n\r\n\tvar args = [];\r\n\tencode(form.getElementsByTagName(\"input\"));\r\n\tencode(form.getElementsByTagName(\"textarea\"));\r\n\tencode(form.getElementsByTagName(\"select\"));\r\n\treturn args;\t\r\n}", "title": "" }, { "docid": "42440c3f5594d4ab8cbf216b079a66ff", "score": "0.6057977", "text": "_renderForm() {\r\n const html = `\r\n <form action=\"\" method=\"POST\" id=\"form\">\r\n <label for=\"userName\">Nom</label>\r\n <input type=\"text\" id=\"userName\" />\r\n <small></small>\r\n <br />\r\n\r\n <label for=\"userSurname\">Prenom</label>\r\n <input type=\"text\" id=\"userSurname\" />\r\n <small></small>\r\n <br />\r\n\r\n <label for=\"userMail\">Email</label>\r\n <input type=\"email\" id=\"userMail\" />\r\n <small></small>\r\n <br />\r\n\r\n <label for=\"userPassword\">Mot de passe</label>\r\n <input type=\"password\" id=\"userPassword\" />\r\n <small></small>\r\n <br />\r\n\r\n <button type=\"submit\">Valider</button>\r\n </form>\r\n `;\r\n\r\n this.appEl.insertAdjacentHTML('beforeend', html);\r\n\r\n this._form = document.getElementById('form');\r\n this._userName = document.getElementById('userName');\r\n this._userSurname = document.getElementById('userSurname');\r\n this._userMail = document.getElementById('userMail');\r\n this._userPassword = document.getElementById('userPassword');\r\n }", "title": "" }, { "docid": "c0c3129da635f51ce1b7850c39e7bd8d", "score": "0.60549444", "text": "function FormHandler(form){\n this.form = form;\n this.manufacturer = form.querySelector('#id_manufacturer');\n this.model = form.querySelector('#id_model');\n this.year = form.querySelector('#id_year');\n this.token = form.querySelector('input[name=\"csrfmiddlewaretoken\"]').getAttribute('value');\n }", "title": "" }, { "docid": "767907a39fbbf691f9b75212a090a3bd", "score": "0.60544413", "text": "function form(location, name, id, method, action) {\n\tlocation.append(\"form\").attr(\"name\", name).attr(\"id\", id).attr(\"method\", method).attr(\"action\", action);\n}", "title": "" }, { "docid": "2445970440eb7135b942b59ed7c16c15", "score": "0.6044968", "text": "validate(form){\n\t\t//If the form was specified\n\t\tif(form){\n\t\t\tif(form instanceof ValidatedForm){\n\t\t\t\tform.validate();\n\t\t\t}else if($Alphabet.U.isDOM(form)){\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "7965bd1ba8b22b4d4a5695cb49f3585c", "score": "0.60427797", "text": "buildForm() {\n\n this.form = document.createElement('form');\n this.form.setAttribute('id', this.id);\n this.form.setAttribute('novalidate', true); // turn off browser validation 'cause we do it by hand\n if (this.name) { this.form.setAttribute('name', this.name); }\n this.form.setAttribute('method', this.method);\n if (this.enctype) { this.form.setAttribute('enctype', this.enctype); }\n this.form.setAttribute('role', 'form');\n this.form.setAttribute('autocomplete', this.autocomplete);\n this.form.classList.add('cornflowerblue');\n for (let c of this.classes) {\n this.form.classList.add(c);\n }\n\n this.form.addEventListener('submit', (e) => {\n e.preventDefault();\n this.submit();\n });\n\n if ((this.handler) && (typeof this.handler !== 'function') && (this.target)) {\n this.form.setAttribute('target', this.target);\n }\n\n this.contentbox.appendChild(this.headerbox);\n this.contentbox.appendChild(this.elementbox);\n\n this.form.appendChild(this.shade.container);\n this.form.appendChild(this.contentbox);\n if ((this.actions) && (this.actions.length > 0)) {\n this.form.appendChild(this.actionbox);\n } else {\n this.form.classList.add('noactions');\n }\n if ((this.passiveactions) && (this.passiveactions.length > 0)) { this.form.appendChild(this.passiveactionbox); }\n\n this.validate(true);\n\n if (this.passive) {\n this.pacify();\n }\n\n }", "title": "" }, { "docid": "dcb8e41e4465b7c4b19086cecd4446f0", "score": "0.60352397", "text": "function myform() {\n alert(\"Wow, that is cool!\");\n }", "title": "" }, { "docid": "444f63029ae07e05b7feeb20392ccb30", "score": "0.6020834", "text": "function n(e){return e&&1===e.nodeType&&\"FORM\"===e.tagName}", "title": "" }, { "docid": "e33e614fd11ab80f51ffa5c89de9891e", "score": "0.60142756", "text": "function ObjectFormController() {\n\t}", "title": "" }, { "docid": "839ae210593debb37f5314c9ad93710c", "score": "0.6000455", "text": "function form_prewrite() {\r\n return true\r\n}", "title": "" }, { "docid": "b9ddfc9f36e5ece401748921353062b0", "score": "0.599979", "text": "function verstuurFormulier(){\r\n document.forms[0].submit();\r\n document.forms[1].submit();\r\n \r\n\r\n}", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "a87c2de009a0ac993ea9e2874b6a0f2d", "score": "0.5996066", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function( props ) {\n for ( var i = 0, len = props.length; i < len; i++ ) {\n attrs[ props[i] ] = !!(props[i] in inputElem);\n }\n if (attrs.list){\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if ( bool ) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if ( /^(search|tel)$/.test(inputElemType) ){\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if ( /^(url|email)$/.test(inputElemType) ) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[ props[i] ] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "439c16425ea44de425f0108dae3db380", "score": "0.5993688", "text": "_setForm() {\n this._form = document.createElement(\"form\");\n this._form.id = this.typeId;\n\n //this._form.addEventListener(\"change\", this._formChanged.bind(this));\n\n return this._form;\n }", "title": "" }, { "docid": "84258874fbf7353a040414b8bc2b3e25", "score": "0.5984108", "text": "function enviar_formulario(tipo){\nif(tipo==0)\n check(document.formulario1,0);\nif(tipo==1)\n check(document.formulario2,1);\n\n\n}", "title": "" }, { "docid": "20849f1979da38a5e5dd0287e5d37980", "score": "0.59825", "text": "function webform_form(form, form_state, entity, entity_type, bundle) {\n try {\n\n // @TODO Add support for component weight (ordering), why doesn't the DGFAPI\n // handle this? It should, but maybe it only supports fields and extra\n // fields.\n \n form.options.attributes['class'] += ' webform ';\n\n /**\n * SUPPORTED COMPONENTS\n * [x] Date\n * [x] E-mail\n * [ ] Fieldset\n * [ ] File\n * [x] Grid\n * [x] Hidden\n * [x] Markup\n * [x] Number\n * [ ] Page break\n * [x] Select\n * [x] Textarea\n * [x] Textfield\n * [x] Time\n */\n\n //dpm('webform_form');\n //dpm(entity.webform);\n //console.log(entity.webform);\n \n // Append the entity type and id to the form id, otherwise we won't have a\n // unique form id when loading multiple webforms across multiple pages.\n form.id += '_' + entity_type + '_' + entity[entity_primary_key(entity_type)];\n\n // Attach the webform and the uuid to the form.\n form.webform = entity.webform;\n form.uuid = entity.uuid;\n\n // Place each webform components on the form.\n $.each(entity.webform.components, function(cid, component) {\n\n //dpm(component.name);\n //dpm(component);\n\n // Preset some component element variables.\n var title = component.name;\n if (component.extra.title_display == 'none') { title = ''; }\n var required = parseInt(component.required) == 1 ? true : false;\n var markup = null;\n var access = (component.extra['private'] && !user_access('access all webform results')) ? false : true;\n \n // Build the form element basics.\n form.elements[component.form_key] = {\n component: component,\n type: component.type,\n title: title,\n required: required,\n value: webform_tokens_replace(component.value),\n description: webform_tokens_replace(component.extra.description),\n disabled: component.extra.disabled,\n access: access,\n options: {\n attributes: {\n id: drupalgap_form_get_element_id(component.form_key, form.id) // without this, does the DGFAPI add an id?\n }\n },\n children: [],\n weight: parseInt(component.weight) // Not working...\n };\n \n // Some component types map cleanly, others do not. For those that don't\n // send them off to the component widget form handler.\n var function_name = 'webform_component_' + component.type + '_widget_form';\n if (function_exists(function_name)) {\n var fn = window[function_name];\n fn(form, form_state, entity, entity_type, bundle, component, form.elements[component.form_key]);\n }\n\n });\n\n // Submit button. \n var submit_text = empty(entity.webform.submit_text) ? 'Submit' : entity.webform.submit_text;\n form.elements['submit'] = {\n type: 'submit',\n value: submit_text\n };\n \n return form;\n }\n catch (error) { console.log('webform_form - ' + error); }\n}", "title": "" }, { "docid": "ef6b32feafacc375e6b406fb942b44d8", "score": "0.59777063", "text": "function pgi_addForm(obj) {\n var pgi_inputHtml = \"\";\n switch (obj.type) {\n case \"text\":\n case \"url\":\n case \"email\":\n case \"password\":\n pgi_inputHtml += \"<input name='\" + obj.name + \"' id='\" + obj.name + \"' value='\" + obj.def + \"' type='\" + obj.type + \"'></input>\";\n break;\n case \"textarea\":\n pgi_inputHtml += \"<textarea name='\" + obj.name + \"' id='\" + obj.name + \"' default='\" + obj.def + \"' type='textarea'>\" + obj.def + \"</textarea>\";\n break;\n default:\n }\n $(\"#pgiForm\").append(pgi_inputHtml);\n if (obj.req === true) $(\"#\" + obj.name).attr(\"required\", \"true\");\n if (obj.hid === true) $(\"#\" + obj.name).addClass(\"pgiHidden\");\n }", "title": "" }, { "docid": "6710159a6e9c0767c732fd022ce2fdd7", "score": "0.59752524", "text": "renderForm(item,labels) {\n return [\n <Input name=\"name\" value={item[\"name\"]} label={labels[\"name\"]} key=\"c1\"/>,\n <Select name=\"type\" value={item[\"type\"]} label={labels[\"type\"]} items={Company.getTypesList()} key=\"c2\"/>,\n <Input name=\"inn\" value={item[\"inn\"]} label={labels[\"inn\"]} keyboard=\"numeric\" key=\"c3\"/>,\n item[\"type\"] === 2 ? <Input name=\"kpp\" value={labels[\"kpp\"]} label={t(\"КПП\")} keyboard=\"numeric\" key=\"c4\"/> : null,\n <Input name=\"address\" value={item[\"address\"]} label={labels[\"address\"]} multiline={true} key=\"c5\"/>\n ]\n }", "title": "" }, { "docid": "fa5b4db1f6779c388cf12080eb352a4b", "score": "0.5971238", "text": "function controlForm() {\n let bool = true;\n span.innerHTML = \"\";\n let expRegex = {\n prénom: \"^[^\\\\s][a-zA-Zéèàêûçàôë\\\\s-]{2,25}$\",\n nom: \"^[^\\\\s][a-zA-Zéèàêûçàôë\\\\s-]{2,25}$\",\n adresse: \"^[^\\\\s][0-9]{0,2}[\\\\s][a-zA-Zéèàêûçàôë-\\\\s]{3,25}$\",\n ville: \"^[^\\s][a-zA-Zéèàêûçàôë\\\\s-]{2,25}$\",\n email: \"^[a-z0-9._-]+@[a-z0-9._-]+\\.[a-z]{2,6}$\"\n }\n for (let i in expRegex) {\n const pattern = new RegExp(expRegex[i]);\n const string = document.getElementById(i).value;\n if (pattern.test(string) == false) {\n errorView(\"Erreur de saisie dans le champ \"+i);\n bool = false;\n }\n i++;\n }\n return bool;\n}", "title": "" }, { "docid": "2308f5f8fb77b468d8556fab4d566759", "score": "0.59711313", "text": "function webforms() {\n /*>>input*/\n // Run through HTML5's new input attributes to see if the UA understands any.\n // We're using f which is the <input> element created early on\n // Mike Taylr has created a comprehensive resource for testing these attributes\n // when applied to all input types:\n // miketaylr.com/code/input-type-attr.html\n // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n // Only input placeholder is tested while textarea's placeholder is not.\n // Currently Safari 4 and Opera 11 have support only for the input placeholder\n // Both tests are available in feature-detects/forms-placeholder.js\n Modernizr['input'] = (function(props) {\n for (var i = 0, len = props.length; i < len; i++) {\n attrs[props[i]] = !!(props[i] in inputElem);\n }\n if (attrs.list) {\n // safari false positive's on datalist: webk.it/74252\n // see also github.com/Modernizr/Modernizr/issues/146\n attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n }\n return attrs;\n })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n /*>>input*/\n\n /*>>inputtypes*/\n // Run through HTML5's new input types to see if the UA understands any.\n // This is put behind the tests runloop because it doesn't return a\n // true/false like all the other tests; instead, it returns an object\n // containing each input type with its corresponding true/false value\n\n // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n Modernizr['inputtypes'] = (function(props) {\n\n for (var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++) {\n\n inputElem.setAttribute('type', inputElemType = props[i]);\n bool = inputElem.type !== 'text';\n\n // We first check to see if the type we give it sticks..\n // If the type does, we feed it a textual value, which shouldn't be valid.\n // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n if (bool) {\n\n inputElem.value = smile;\n inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n if (/^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined) {\n\n docElement.appendChild(inputElem);\n defaultView = document.defaultView;\n\n // Safari 2-4 allows the smiley as a value, despite making a slider\n bool = defaultView.getComputedStyle &&\n defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n // Mobile android web browser has false positive, so must\n // check the height to see if the widget is actually there.\n (inputElem.offsetHeight !== 0);\n\n docElement.removeChild(inputElem);\n\n } else if (/^(search|tel)$/.test(inputElemType)) {\n // Spec doesn't define any special parsing or detectable UI\n // behaviors so we pass these through as true\n\n // Interestingly, opera fails the earlier test, so it doesn't\n // even make it here.\n\n } else if (/^(url|email)$/.test(inputElemType)) {\n // Real url and email support comes with prebaked validation.\n bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n } else {\n // If the upgraded input compontent rejects the :) text, we got a winner\n bool = inputElem.value != smile;\n }\n }\n\n inputs[props[i]] = !!bool;\n }\n return inputs;\n })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n /*>>inputtypes*/\n }", "title": "" }, { "docid": "8b0402ede3f778801efdb0d0a4eecf63", "score": "0.59521997", "text": "function getForm(event){\n\tevent.preventDefault();\n\tform.style.display = \"inline\";\n\tlists.style.opacity = \"0.5\";\n}", "title": "" }, { "docid": "ebcf6bccb08f7ae4d33c44482b61f2d7", "score": "0.5945034", "text": "formOK() {\n alert(\"le formulaire a été transmis avec succès\");\n }", "title": "" }, { "docid": "a58bcf30ab28ba066b4f0be48daddce7", "score": "0.5933372", "text": "function FormField(name, description, type, id){\t\r\n\tthis.name = name;\r\n\tthis.description = description;\r\n\tthis.type = type;\t\r\n\tthis.id = id; // multi-use\r\n\tthis.isValid = function(f){\r\n\t\t\t\r\n\t\t\t\tswitch(this.type){\r\n\t\t\t\t\tcase \"text\" :\r\n\t\t\t\t\treturn (trim(f.elements[this.name].value) != \"\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"number\" :\r\n\t\t\t\t\tvar number_regex = /^[0-9]+$/;\r\n\t\t\t\t\treturn ( number_regex.test(f.elements[this.name].value) && f.elements[this.name].value!=parseInt(\"0\"));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"select\" :\r\n\t\t\t\treturn (f.elements[this.name].options[f.elements[this.name].selectedIndex].value != \"\");\r\n\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"character\" :\r\n\t\t\t\t\tvar number_regex = /^[A-Za-z]+$/;\r\n\t\t\t\t\treturn ( number_regex.test(f.elements[this.name].value));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"radio\" :\r\n\t\t\t\t\treturn ((document.form1.sellingType[0].checked == true ) || (document.form1.sellingType[1].checked == true));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase \"confirm\" :\r\n \t\t\t\treturn ( (f.elements[this.name].value != \"\") && (f.elements[this.additional_params].value == f.elements[this.name].value) );\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase \"checkbox\" :\r\n\t\t\t\treturn (f.elements[this.name].checked == true);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"email\" :\r\n\t\t\t\t\tvar email_regex = /^([a-z0-9_-]+\\.)*[a-z0-9_-]+@([a-z0-9_-]+\\.)+[a-z]{2,3}$/i;\r\n\t\t\t\t\treturn (email_regex.test(f.elements[this.name].value));\r\n\t\t\t\t\tbreak;\t\t\r\n\t\t\t\t\tdefault : return false;\r\n\t\t\t\t};\r\n\t\t};\r\n}", "title": "" }, { "docid": "a9e663c7f90c6b1b5cd395f2138f2463", "score": "0.59285057", "text": "function formDoNothing() {\n}", "title": "" }, { "docid": "83c9e3c0b726c4c9763145117dc2fda8", "score": "0.5926446", "text": "function setForm() {\n\t$('#id_name').attr('value', $('#name_profile').html());\n\t$('#id_age').attr('value', $('#age_profile').html());\n\t$('#id_description').html($.trim($('#desc_profile').html()));\n\t$('#profile').hide();\n\t$('#profile_form').css('display','inherit');\n\t$('#photo_form').css('display','inherit');\n}", "title": "" }, { "docid": "782b7622072282fbb047c74a021ab46d", "score": "0.59208345", "text": "function afficherForm() {\r\n // Crée une div pour le formulaire\r\n divForm = document.createElement('div')\r\n divForm.classList.add('form-inline')\r\n\r\n // Crée une zone de saisi pour le titre\r\n let inputTitle = document.createElement('input');\r\n inputTitle.type = 'text';\r\n inputTitle.id = 'title';\r\n inputTitle.placeholder = 'Entrer un titre';\r\n inputTitle.classList.add('form-control')\r\n\r\n // Crée une zone de saisi pour l'année\r\n let inputYears = document.createElement('input');\r\n inputYears.type = 'number';\r\n inputYears.id = 'years';\r\n inputYears.placeholder = 'Entrer une année';\r\n inputYears.classList.add('form-control')\r\n\r\n // Crée une zone de saisi pour le réalisateur\r\n let inputAuthor = document.createElement('input');\r\n inputAuthor.type = 'text';\r\n inputAuthor.id = 'authors';\r\n inputAuthor.placeholder = 'Entrer un auteur';\r\n inputAuthor.classList.add('form-control')\r\n\r\n // Crée un bouton pour sauvegarder le film\r\n btnAjouter = document.createElement('button');\r\n btnAjouter.textContent = \"Save\";\r\n btnAjouter.type = \"submit\";\r\n btnAjouter.classList.add('btn')\r\n btnAjouter.classList.add('btn-success')\r\n\r\n //Ajoute l'événement lors du click sur le bouton Ajouter\r\n btnAjouter.addEventListener('click', formAdd)\r\n\r\n // Ajoute les éléments du formulaire dans la div\r\n divForm.appendChild(inputTitle);\r\n divForm.appendChild(inputYears);\r\n divForm.appendChild(inputAuthor);\r\n divForm.appendChild(btnAjouter);\r\n\r\n // Remplace le bouton par le formulaire\r\n formElt.replaceChild(divForm, btnForm)\r\n }", "title": "" }, { "docid": "b5abc1b1a32611eae34116ef05f3289c", "score": "0.59174436", "text": "printForm() {\r\n\t\treturn (\r\n\t\t\t//create a form with a variable number of fields to be filled out and submitted\r\n\t\t\t<form onSubmit={this.handleSubmit}>\r\n\t\t\t\t<FieldList body={this.props.body} />\r\n\t\t\t\t<br style={{ lineHeight: 4 }} />\r\n\t\t\t\t<input type=\"submit\" value=\"Send Request\" />\r\n\t\t\t\t<br style={{ lineHeight: 2 }} />\r\n\t\t\t</form>\r\n\t\t);\r\n\t}", "title": "" }, { "docid": "d06b18770488c48401fe3aee87c7faf4", "score": "0.59091043", "text": "form(formName, ...args) {\n let Form = require(`${__dirname}/../src/form/${formName}.js`);\n return new Form(...args);\n }", "title": "" }, { "docid": "68dcb5e7a7eb112457bdca41675b1cab", "score": "0.59068024", "text": "function SwitchViewForm() {\n var _this = _super.call(this) || this;\n _this.container = document.createElement(\"form\");\n //フォーム開閉ボタン\n var p = document.createElement(\"p\");\n _this.container.appendChild(p);\n p.appendChild(_this.makeinput(function (input) {\n input.type = \"button\";\n input.value = \"設定\";\n input.dataset[\"open\"] = \"setting\";\n }));\n p.appendChild(_this.makeinput(function (input) {\n input.type = \"button\";\n input.value = \"入室者\";\n input.dataset[\"open\"] = \"userlist\";\n }));\n p.appendChild(_this.makeinput(function (input) {\n input.type = \"button\";\n input.value = \"その他\";\n input.dataset[\"open\"] = \"others\";\n }));\n p.appendChild(_this.makeinput(function (input) {\n input.type = \"button\";\n input.value = \"戻る\";\n input.dataset[\"open\"] = \"\";\n }));\n _this.container.addEventListener(\"click\", function (e) {\n var t = e.target;\n if (/^input$/i.test(t.tagName)) {\n var tar = t.dataset[\"open\"];\n _this.open(tar);\n }\n }, false);\n return _this;\n }", "title": "" }, { "docid": "948809ce70a68dd531273c6f750e15f1", "score": "0.5900504", "text": "function outputForm_(form) {\n var items = form.getItems();\n var questionS;\n\n for (j = 0; j < items.length; j += 1) {\n var thisItem = items[j];\n var itemTypeIs = thisItem.getType();\n //console.log(itemTypeIs.toString());\n switch (itemTypeIs) {\n case FormApp.ItemType.TEXT:\n var textItem = thisItem.asTextItem();\n var questionS = textItem.getTitle();\n console.log(`Text item number ${j} is: ${questionS}`);\n break;\n case FormApp.ItemType.DATE:\n var dateItem = thisItem.asDateItem();\n var questionS = dateItem.getTitle();\n console.log(`Date item number ${j} is: ${questionS}`);\n break;\n case FormApp.ItemType.MULTIPLE_CHOICE:\n var multiItem = thisItem.asMultipleChoiceItem();\n var questionS = multiItem.getTitle();\n console.log(`Multi item number ${j} is: ${questionS}`);\n break;\n default:\n break;\n }\n }\n return 1\n}", "title": "" }, { "docid": "bbdc57f5a407e1fa2989df02f61640c3", "score": "0.58972293", "text": "function formToView(formID) {\n var form = $('#' + formID);\n\n $(form.find('input, textarea, select')).each(\n function (index) {\n if ($(this).attr('type') == 'submit') {\n $(this).remove();\n return true;\n }\n\n if ($(this).attr('type') == 'hidden') {\n $(this).remove();\n return true;\n }\n\n if ($(this).attr('type') == 'checkbox') {\n $(this).prop('disabled', 'true');\n return true;\n }\n\n if (!$(this).attr('name')) {\n return true;\n }\n\n var html = '<div class=\"form-control>\"<label>' + ($(this).val() ? $(this).val() : '-') + '</label></div>';\n\n if ($(this).attr('data-inputmask-alias')) {\n $($(this).parent()).html(html);\n } else {\n $($(this).parent()).append(html);\n }\n\n $(this).remove();\n }\n );\n}", "title": "" }, { "docid": "430154a72536975e68f33389787c99ed", "score": "0.5896686", "text": "function getFormValues() { \n var str = \"\"; \n var aElements = document.body.getElementsByTagName(\"input\"); \n for(var i = 0;i < aElements.length;i++){ \n if(aElements[i].name.toUpperCase() != \"__VIEWSTATE\")\n str += aElements[i].name + \"=\" + aElements[i].value + \"&\";\n }\n\n var aElements = document.body.getElementsByTagName(\"select\");\n\n for(var i = 0;i < aElements.length;i++){ \n str += aElements[i].name + \"=\" + aElements[i].options[aElements[i].selectedIndex].value + \"&\";\n }\n\n str = str.substr(0,(str.length - 1)); \n\n return str; \n}", "title": "" }, { "docid": "63f9d737caee6b60dfdd6078aaf9881d", "score": "0.58939", "text": "function serialize(formObj) {\n var returnStr = \"\";\n for (i=0; i<formObj.elements.length; i++) {\n var el = formObj.elements[i];\n switch(el.type) { \n case \"text\": \n case \"hidden\": \n case \"password\": \n case \"textarea\":\n returnStr += el.name + \"=\" + encodeURI(el.value) + \"&\"; \n break;\n case \"checkbox\": \n case \"radio\": \n if(el.checked) returnStr += el.name + \"=\" + encodeURI(el.value) + \"&\"; \n break; \n case \"select\": \n returnStr += el.name + \"=\" + \n el.options[el.selectedIndex].value + \"&\"; \n break; \n } \n }\n return returnStr;\n}", "title": "" }, { "docid": "ebb8d49a65ca97664ddcd143ccdbc361", "score": "0.5887687", "text": "function generateCustomerMenuForm(){\n\n}", "title": "" }, { "docid": "d83518512cb2ac7ce850e0997a75a9c1", "score": "0.5885844", "text": "function getForm(form)\n{\n\treturn typeof (form) == 'string' ? document.getElementById(form) : form;\n}", "title": "" }, { "docid": "1ee0545fb144d2c4414b0688a9b16ec3", "score": "0.5885636", "text": "function parseFormInfoDev(e) { \n orpSummaryPage='1EupTnQ4Lh5m6Z0rYJ8Nwizl0Nb1pnvOCRwBVWKCc_D8'\n parseFormInfoAll(orpSummaryPage,e)\n}", "title": "" }, { "docid": "3c03d53d9d5154faeb45da26121125cd", "score": "0.5885074", "text": "function validar(form){\n\tif (estaVacio(form.nombre,\"debe escribir un nombre\")) {\n\t\tmostrarEnrojo(1);\n\t}else if (estaVacio(form.cedula,\"debe escribir una cedula\")) {\n\t\t mostrarEnrojo(2);\n QuitarRojo(1);\n\t }else if (estaVacio(form.nota,\"debe escribir su nota\")){\n mostrarEnrojo(3);\n QuitarRojo(2);\n }else{\n QuitarRojo(1);\n QuitarRojo(2);\n QuitarRojo(3);\n validarNota(form)\n }\n //(SEGUNDO) \n}", "title": "" }, { "docid": "8f2c5b4014b1a07710d7a25e7e419901", "score": "0.58840305", "text": "function fillForm(form, data){\n for(let I of Object.keys(data)){\n\tlet input = form.querySelector(printf('input[name=\"%1\"]', I));\n\tif(input.type == 'checkbox' || input.type == 'radio')\n\t input.checked = data[I];\n\telse\n\t input.value = data[I];\n }\n}", "title": "" }, { "docid": "da884f5fa47ac2fdebcc8a61da110277", "score": "0.5879151", "text": "function limpiar(form) {\n clearForm(form);\n}", "title": "" }, { "docid": "e5694226ff477f8df6f61e7e089082df", "score": "0.5877707", "text": "function enableElementForm() {\n\n}", "title": "" }, { "docid": "6d86934312a3b25901dc7e237b6726d8", "score": "0.58773184", "text": "function get_alle_formwerte() {\n\t\tvar f = {};\n\t\tf.pw = document.getElementById('pw').value;\n\t\tf.ta0 = document.getElementById('ta0').value;\n\t\tf.ta1 = document.getElementById('ta1').value;\n\t\tf.caesar = document.getElementById('caesar').checked || false;\n\t\tf.tea = document.getElementById('tea').checked || false;\n\t\treturn f;\n\t}", "title": "" } ]
4bc5fffc0d285ae150fd547442dfd5e6
Function to restore settings back to values when page loaded
[ { "docid": "d99d7baeb5e7d8e946cd6633a1a3952b", "score": "0.690937", "text": "function revertSettings() {\n localStorage.setItem('savedEmailSetting', initialEmailSetting);\n localStorage.setItem('savedPrivacySetting', initialPrivacySetting);\n localStorage.setItem('savedTimezoneSelection', initialTimezoneSelection);\n}", "title": "" } ]
[ { "docid": "fe8be8066ae20ce2f34fb4edacd2c27e", "score": "0.7623369", "text": "function restore_settings() {\n load_settings(function(settings) {\n globals.settings = settings\n document.getElementById('zonelist').value = settings.zonelist;\n document.getElementById('weekday').selectedIndex = settings.week_start_day;\n update_zones();\n });\n}", "title": "" }, { "docid": "89ab24f092d009d5e27f591420f31944", "score": "0.7387508", "text": "function restoreSettings(storedSettings) {\n\t\t\tapplyOptions(storedSettings);\n\t\t\trender();\n\t\t}", "title": "" }, { "docid": "2dfd8c5cd22256f8358e4ec197191f5c", "score": "0.7040997", "text": "function restoreSettings() {\n if( UserProfile.suportsLocalStorage() ) {\n var gravityEnabled = localStorage[ 'gravityEnabled' ];\n var depthEnabled = localStorage[ 'depthEnabled' ];\n var turbinesEnabled = localStorage[ 'turbinesEnabled' ];\n var infectionEnabled = localStorage[ 'infectionEnabled' ];\n\n if( gravityEnabled ) {\n settings.gravityEnabled = gravityEnabled == 'true';\n }\n\n if( depthEnabled ) {\n settings.depthEnabled = depthEnabled == 'true';\n }\n\n if( turbinesEnabled ) {\n settings.turbinesEnabled = turbinesEnabled == 'true';\n }\n\n if( infectionEnabled ) {\n settings.infectionEnabled = infectionEnabled == 'true';\n }\n }\n }", "title": "" }, { "docid": "9b9fa2ad15f9c823ea546e9227ad539c", "score": "0.700375", "text": "function restore_options() {\n\trestoreSettings();\n\n\tvar pollIntervalMin = document.getElementById(\"poll_interval_min\");\n\tvar pollIntervalMax = document.getElementById(\"poll_interval_max\");\n\tvar requestTimeout = document.getElementById(\"request_timeout\");\n\tvar filterByKeywords = document.getElementById(\"filter_by_keywords\");\n\tvar keywords = document.getElementById(\"keywords\");\n\tvar popupBgColor = document.getElementById(\"popup_bg_color\");\n\n\tpollIntervalMin.value = settings.pollIntervalMin;\n\tpollIntervalMax.value = settings.pollIntervalMax;\n\trequestTimeout.value = settings.requestTimeout;\n\tfilterByKeywords.checked = settings.filterByKeywords;\n\tkeywords.value = settings.keywords;\n\tpopupBgColor.value = settings.popupBgColor;\n}", "title": "" }, { "docid": "3cad597ebd2fa1f5abaf872d6b15e0ad", "score": "0.69728357", "text": "function restoreOptions() {\r\n if (isMultiHostEnabled()) {\r\n changeProfile();\r\n } else {\r\n restoreUrl();\r\n }\r\n\r\n if (isMultiHostEnabled()) {\r\n $('#enableMultiHost').prop(\"checked\", true);\r\n } else {\r\n $('#enableMultiHost').prop(\"checked\", false);\r\n }\r\n\r\n if (isDebugLogsEnabled()) {\r\n $('#enableDebugLogs').prop(\"checked\", true);\r\n } else {\r\n $('#enableDebugLogs').prop(\"checked\", false);\r\n }\r\n\r\n var showRepeat = localStorage[storageKeys.showRepeat];\r\n $('#showRepeat').val(showRepeat);\r\n var magnetAddOn = localStorage[storageKeys.magnetAddOn];\r\n $('#magnetAddOn').val(magnetAddOn);\r\n}", "title": "" }, { "docid": "786238eb5077bbd26ef04503b25debf1", "score": "0.68659383", "text": "function loadPageVariables() {\n var tmp = JSON.parse(localStorage.getItem('autoTrimpSettings'));\n if (tmp !== null) {\n autoTrimpSettings = tmp;\n }\n}", "title": "" }, { "docid": "1ec90340753a2a5414c57897c73213ed", "score": "0.6858601", "text": "function applyLocalSettings() {\n\t\t$.settings = [];\n\t\t\n\t\t$.settings.font_size = window.localStorage.getItem(\"font-size\");\n\t\t$.settings.font_size = (typeof $.settings.font_size !=\"undefined\" && $.settings.font_size == null) ? $.settings.font_size : 13;\n\t\t$(\"body\").css('font-size',$.settings.font_size+'px');\n\n\t\t$.settings.update_period = window.localStorage.getItem(\"update-period\");\n\t\t$.settings.update_period = (typeof $.settings.update_period !=\"undefined\" && $.settings.update_period == null) ? $.settings.update_period : 5;\n\t\twindow.localStorage.setItem(\"update-period\", $.settings.update_period);\n\n\t\t$(\"div#settingspage\").on(\"pagebeforeshow\", function(event) {\n\t \t$( \"#settingspage #font-size\").val($.settings.font_size).slider(\"refresh\");\n\t \t$( \"#settingspage #update-period\").val($.settings.update_period).slider(\"refresh\");\n\t\t});\t\t\n\n\n\t}", "title": "" }, { "docid": "7d888a6f29e30251ee659d47f30dc7b1", "score": "0.68398255", "text": "function loadSettings() {\n if (emailPref !== 'false') {\n email.checked = (emailPref === 'true');\n }\n if (profilePref !== 'false') {\n profile.checked = (emailPref === 'true');\n }\n if (timezonePref !== 'false') {\n select.value = localStorage.getItem('timezonePref');\n }\n}", "title": "" }, { "docid": "2c8ccfcd75a25b7f801d85a1483c8b29", "score": "0.6828561", "text": "loadSettings() {\n this.settings = {\n theme: localStorage.getItem('theme') || DEFAULT_THEME_NAME,\n storage: localStorage.getItem('storage') || DEFAULT_STORAGE\n };\n }", "title": "" }, { "docid": "1539b0048dc773cabc1d347a8462edce", "score": "0.67716503", "text": "function restoreDefaultOptions() {\n localStorage.clear();\n location.reload();\n}", "title": "" }, { "docid": "23547e070f9aee39e575114e399738a1", "score": "0.67644227", "text": "function restoreSettings() {\n if (appConfig.settings.gain.isAuto()) {\n fmRadio.setAutoGain();\n } else {\n fmRadio.setManualGain(appConfig.settings.gain.get());\n }\n fmRadio.setCorrectionPpm(appConfig.settings.ppm.get());\n }", "title": "" }, { "docid": "54847fd06ac4fb4353abab5296d2fcbe", "score": "0.67589164", "text": "function restore_options() {\n\tvar rules_value = localStorage[\"ttt_rules\"];\n\tvar rules_field = document.getElementById(\"edit-rules\");\n\tif (rules_value) {\n\t\trules_field.value = rules_value;\n\t}\n\telse {\n\t\t// Preset a default if the value isn't set yet\n\t\trules_field.value = \"prefix, *.local, LOCAL\";\n\t\tdocument.getElementById(\"status-defaults\").style.display = \"block\";\n\t}\n}", "title": "" }, { "docid": "41e8ad41a2f3bb4a94533979e4757db3", "score": "0.6729983", "text": "function restoreOptions() {\n chrome.storage.sync.get([\n 'skin',\n 'delay',\n 'merriamWebsterDictionary',\n 'maxTextCount'\n ], function(items) {\n document.getElementById('skin').value = items.skin || 'light';\n document.getElementById('delay').value = items.delay || 500;\n document.getElementById('dictionaryKey').value = items.merriamWebsterDictionary || '';\n document.getElementById('maxTextCount').value = items.maxTextCount || 3;\n });\n}", "title": "" }, { "docid": "3ea8a9bb7368431306d26604f46fa034", "score": "0.6727288", "text": "function restore_pb_values()\n{\n\tchain_count = get_storage_Value('pb_chain_count') ? get_storage_Value('pb_chain_count') : 4;\n\tpb_lang = get_storage_Value('pb_lang') ? get_storage_Value('pb_lang') : navigator.language.substr(0,2);\n\tenable_accesskey = get_storage_Value('pb_enable_accesskey') ? get_storage_Value('pb_enable_accesskey') : false;\n\n// \tif ( !is_localstorage() )\n// \t{\t//\tfor legacy cookie\n// \t\t//alert('local and session storage not supported by this browser.');\n// \t\tpb_lang = navigator.language.substr(0,2);\n// \t\tchain_count = 4;\n// \t}\n// \telse\n// \t{\t// for localstorage browsers\n// \t\tchain_count = localStorage.getItem('pb_chain_count') ? localStorage.getItem('pb_chain_count') : 4;\n// \t\tpb_lang = localStorage.getItem('pb_lang') ? localStorage.getItem('pb_lang') : navigator.language.substr(0,2);\n// \t}\n\t// Save changes if the user leaves the page.\n\twindow.onclose = function(){save_storage_Changes()};\n}", "title": "" }, { "docid": "d95971e2ecd8a9b254f87bd1b1d18c65", "score": "0.67262775", "text": "function restore_options() {\n chrome.storage.sync.get({\n settings: 'default',\n }, function (items) {\n document.getElementById('hideSettings').value = items.settings;\n });\n}", "title": "" }, { "docid": "c118d4a51113cc45d234c5d8a1e1a6df", "score": "0.6690031", "text": "function restoreOptions() {\n chrome.storage.sync.get({\n defaultPage: 'request'\n }, function (items) {\n document.querySelector('#page').value = items.defaultPage;\n });\n}", "title": "" }, { "docid": "81ce2501ac2e5d9dfdee547e26334fb4", "score": "0.665646", "text": "function setSettings() {\n\t\t$(\"#number_input\").val(localStorage.days);\n\n\t\t$(\"#settings_save\").click(function () {\n\t\t\tlocalStorage.days = $(\"#number_input\").val();\n\t\t\tajax.loadSettings();\n\t\t});\n\t}", "title": "" }, { "docid": "d5cd374115bfd7285d538b0a528479f1", "score": "0.6651954", "text": "loadSettings() {\n if (!this.page.configuration.pack) {\n this.page.configuration.reloadPack(() => this.loadSettings());\n return;\n }\n // Clear settings\n this.settingsForm.inputs.clear();\n // Add settings inputs\n this.addSettings(this.page.configuration.settings, this.page.configuration.settingsValues);\n // Set settings form visibility\n this.settingsForm.visible = this.settingsForm.inputs.count > 0;\n }", "title": "" }, { "docid": "9a2e85fcc779d99a1da13f6114640113", "score": "0.6644288", "text": "function restore_options() {\n\n // restore interval value\n var interval = localStorage[\"interval\"];\n if (!interval) {\n document.getElementById(\"interval\").value = 120;\n }\n else {\n var input = document.getElementById(\"interval\");\n input.value = interval;\n }\n\n // restore http endpoint\n var httpendpoint = localStorage[\"httpendpoint\"];\n if (!httpendpoint) {\n document.getElementById(\"httpendpoint\").value = \"http://example.com/speakeasy/new.json\";\n }\n else {\n var input = document.getElementById(\"httpendpoint\");\n input.value = httpendpoint;\n }\n\n}", "title": "" }, { "docid": "b1d5be29c1e66d8bbc3bc3a8c531a01a", "score": "0.66434795", "text": "function SVG_RestoreSettings()\n {\n SVG_Settings=JSON.parse(SVG_SettingStack.pop());\n }", "title": "" }, { "docid": "9a2005e2537bccaf5cc59ba130ef19b8", "score": "0.6643015", "text": "function restore_options() {\n getBackgroundPage().then(page => {\n document.getElementById('redirects-text').value =\n JSON.stringify(page.getRedirects(), null, \" \");\n document.getElementById('stats-checkbox').checked = page.getStatsConsent();\n })\n}", "title": "" }, { "docid": "cc558dc2f7e3d63efd3c019202aba12d", "score": "0.6626637", "text": "function restore_options() {\n chrome.storage.local.get(['ms_style_output', 'limit_num_qtr'], function(options) {\n\n if (isDefined(options.ms_style_output)) {ms_style_output = options.ms_style_output;}\n if (isDefined(options.limit_num_qtr)) {limit_num_qtr = options.limit_num_qtr;}\n\n $('#ms_style_output').prop('checked', ms_style_output);\n $('#limit_num_qtr').prop('checked', limit_num_qtr);\n });\n}", "title": "" }, { "docid": "36a5dde7af861272e939c1742092f2a7", "score": "0.6619946", "text": "function restore_options() {\n chrome.storage.local.get(\n [\"open_new_tab\", \"ms_style_output\", \"limit_num_qtr\", \"hide_extra\"],\n function (options) {\n if (isDefined(options.open_new_tab)) {\n open_new_tab = options.open_new_tab;\n }\n if (isDefined(options.ms_style_output)) {\n ms_style_output = options.ms_style_output;\n }\n if (isDefined(options.limit_num_qtr)) {\n limit_num_qtr = options.limit_num_qtr;\n }\n if (isDefined(options.hide_extra)) {\n limit_num_qtr = options.hide_extra;\n }\n\n $(\"#open_new_tab\").prop(\"checked\", open_new_tab);\n $(\"#ms_style_output\").prop(\"checked\", ms_style_output);\n $(\"#limit_num_qtr\").prop(\"checked\", limit_num_qtr);\n $(\"#hide_extra\").prop(\"checked\", hide_extra);\n }\n );\n}", "title": "" }, { "docid": "16cb0aba4222cfe29c5f80ca81575a86", "score": "0.66155356", "text": "function restore_options() {\n\n\tchrome.storage.local.get([\n\t\t'spider-search-use-google',\n\t\t'spider-search-max-timeout',\n\t], function(items) {\n\t\tlet t = items['spider-search-use-google'];\n\t\tdocument.getElementById('use-google').checked = (t != null && t != undefined) ? t : true;\n\t\tdocument.getElementById('max-timeout').value = items['spider-search-max-timeout'] || 2000;\n\t});\n}", "title": "" }, { "docid": "bef6229d2d1b220daaa7eb24fda0778f", "score": "0.6601029", "text": "function restoreOptions() {\n settingsHelper.getSettings(function (data) {\n settings = data;\n if (!settings.enableAgentConfiguration) {\n disableOptionsForm();\n }\n populateOptionsForm(settings);\n showSSOInputs();\n });\n }", "title": "" }, { "docid": "78231b214c497c13cd9e5081322eac4b", "score": "0.6570571", "text": "function restoreOptions() {\n chrome.storage.sync.get({\n startHour: defaults.startHour,\n endHour: defaults.endHour,\n skipWeekends: defaults.skipWeekends,\n checkoutButtonClassName: defaults.checkoutButtonClassName\n }, function(items) {\n setInputValsFromStartHour(items.startHour);\n setInputValsFromEndHour(items.endHour);\n document.getElementById('skipWeekends').checked = items.skipWeekends;\n document.getElementById('checkoutButtonClassName').value = items.checkoutButtonClassName;\n });\n}", "title": "" }, { "docid": "884b15ade04ef4e025c43cff87a06dae", "score": "0.65704393", "text": "function resetValues() {\n\t\tsetValues( Defaults );\n\t\t\n\t\tpreferences.save();\n\t}", "title": "" }, { "docid": "737ece2395b138d6ae1ed3e8dd507499", "score": "0.6559988", "text": "function restore_options() {\n\t// Use default value color = 'red' and likesColor = true.\n\tchrome.storage.sync.get({\n\t\tcollapsed: true,\n\t\tstyle: \"monokai-sublime\",\n\t\tantialiased: false,\n\t\tsize: '12px'\n\t}, function(items) {\n\t\tdocument.getElementById('style').value = items.style;\n\t\tdocument.getElementById('size').value = items.size;\n\t\tdocument.getElementById('collapsed').checked = items.collapsed;\n\t\tdocument.getElementById('antialiased').checked = items.antialiased;\n\t});\n}", "title": "" }, { "docid": "72b76ffb39b021c527c2c04c1bf7bdc4", "score": "0.65584415", "text": "function populateSettingsPage() {\n logger.debug('Loading values in settings page from settings files.');\n Object.keys(Constants.SETTINGS).map(k => {\n addTab(Constants.SETTINGS[k]);\n generateListFromStorage(Constants.SETTINGS[k]);\n });\n}", "title": "" }, { "docid": "e270fdce010aabb31a3569ea60728bf7", "score": "0.6547444", "text": "function loadSettings() {\n $('textarea.text-box9a').val(localStorage.plannerInput9a);\n $('textarea.text-box10a').val(localStorage.plannerInput10a);\n $('textarea.text-box11a').val(localStorage.plannerInput11a);\n $('textarea.text-box12p').val(localStorage.plannerInput12p);\n $('textarea.text-box1p').val(localStorage.plannerInput1p);\n $('textarea.text-box2p').val(localStorage.plannerInput2p);\n $('textarea.text-box3p').val(localStorage.plannerInput3p);\n $('textarea.text-box4p').val(localStorage.plannerInput4p);\n $('textarea.text-box5p').val(localStorage.plannerInput5p);\n\n}", "title": "" }, { "docid": "7a3d9b4ef1026102d12545b0ae6668a7", "score": "0.65269727", "text": "function restore_options() {\n\n // Use default value color = \"red\" and likesColor = true.\n chrome.storage.sync.get({\n autoMetadata: true,\n autoFeatureCounts: true,\n autoDomainCounts: true,\n defaultWebMapAsJSON: \"{\\\"operationalLayers\\\":[],\\\"baseMap\\\":{\\\"baseMapLayers\\\":[{\\\"id\\\":\\\"defaultBasemap\\\",\\\"opacity\\\":1,\\\"visibility\\\":true,\\\"url\\\":\\\"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer\\\"}],\\\"title\\\":\\\"Topographic\\\"},\\\"exportOptions\\\":{\\\"dpi\\\":300,\\\"outputSize\\\":[1280,1024]}}\"\n }, function(items) {\n document.getElementById(\"metadata\").checked = items.autoMetadata;\n document.getElementById(\"featurecounts\").checked = items.autoFeatureCounts;\n document.getElementById(\"domaincounts\").checked = items.autoDomainCounts;\n document.getElementById(\"defaultwebmapasjson\").value = items.defaultWebMapAsJSON;\n });\n}", "title": "" }, { "docid": "9418d57e361cf875bac74af71447b098", "score": "0.6524283", "text": "function restore_options() {\n restore_login();\n restore_emailAddress();\n restore_content();\n restore_cipher();\n restore_tab();\n restore_lastStatus();\n}", "title": "" }, { "docid": "9ca58718dd384705eab03d04dc0808be", "score": "0.651748", "text": "function loadSettings() {\n // Macro Processor re-/load\n macros.reloadSettings();\n\n // Re-/load other client settings.\n var localEchoSetting = localStorage.getItem('Client.Setting.LocalEcho');\n if (localEchoSetting) {\n localEcho = JSON.parse(localEchoSetting);\n } else {\n localEcho = false;\n }\n\n // Refresh UI\n $('button#localecho').html('Local Echo: ' + (localEcho==true ? 'an' : 'aus') + '');\n}", "title": "" }, { "docid": "5fed252bc4938c56303d4aedb14c938b", "score": "0.651249", "text": "function restore_options() {\n //$(\"#repo-url\").val(localStorage[\"repo-url\"]);\n $(\"#share-url\").val(localStorage[\"share-url\"]);\n}", "title": "" }, { "docid": "57c34d7d9cc159771f12211bcdab56e1", "score": "0.6508416", "text": "function restore_options() {\n chrome.storage.sync.get({\n showAddress: false,\n screenHeight: '1080',\n screenWidth: '1920',\n numWindowsWide: '3',\n numWindowsHeight: '2'\n }, function(items) {\n document.getElementById('showAddress').checked = items.showAddress;\n document.getElementById('screenWidth').value = items.screenWidth;\n document.getElementById('screenHeight').value = items.screenHeight;\n document.getElementById('numWindowsHeight').value = items.numWindowsHeight;\n document.getElementById('numWindowsWide').value = items.numWindowsWide;\n });\n }", "title": "" }, { "docid": "1d9c57a42099af64b1565b1780918cb0", "score": "0.650694", "text": "function restore_options() {\n\tvar skipPercentage = localStorage[\"skipPercentage\"];\n\tif (!skipPercentage) {\n\t\tskipPercentage = 33;\n\t}\n\t\n\tvar skipPercentageEle = document.getElementById(\"skipPercentage\");\n\tskipPercentageEle.value = skipPercentage;\n}", "title": "" }, { "docid": "2e2bbf549d02312fcc6cb68f42ea6bce", "score": "0.65068823", "text": "function restore_options() {\n\t\tchrome.storage.sync.get('options', function(data) {\n\t\t\tdocument.getElementById('replaceWysiwyg').checked = data.options.replaceWysiwyg;\n\t\t\tdocument.getElementById('fontSizeWysiwyg').value = data.options.fontSizeWysiwyg;\n\t\t\tdocument.getElementById('minHeightWysiwyg').value = data.options.minHeightWysiwyg;\n\t\t\tdocument.getElementById('maxHeightWysiwyg').value = data.options.maxHeightWysiwyg;\n\t\t\tdocument.getElementById('expand').checked = data.options.expand;\n\t\t\tdocument.getElementById('removeLazyLoading').checked = data.options.removeLazyLoading;\n\t\t\tdocument.getElementById('myWorkEnhancement').checked = data.options.myWorkEnhancement;\n\t\t\tdocument.getElementById('highlightId').checked = data.options.highlightId;\n\t\t\tdocument.getElementById('showPullRequestInfo').checked = data.options.showPullRequestInfo;\n\t\t\tdocument.getElementById('showCopyLinkToClipboard').checked = data.options.showCopyLinkToClipboard;\n\t\t\tdocument.getElementById('showCopyListOfStories').checked = data.options.showCopyListOfStories;\n\t\t\tdocument.getElementById('templateForRelease').value = data.options.templateForRelease;\n\t\t\tdocument.getElementById('templateForRelease').dispatchEvent(new Event('keyup'));\n\t\t\tdocument.getElementById('templateForReview').value = data.options.templateForReview;\n\t\t\tdocument.getElementById('templateForReview').dispatchEvent(new Event('keyup'));\n\t\t\tdocument.getElementById('templateForBacklog').value = data.options.templateForBacklog;\n\t\t\tdocument.getElementById('templateForBacklog').dispatchEvent(new Event('keyup'));\n\t\t});\n\t}", "title": "" }, { "docid": "f233228da01bc719262ab08811c45d02", "score": "0.6498964", "text": "function restore_options() {\n\t\tfor ( var i = 0, l = OPTIONS.length; i < l; i++ ) {\n\t\t var o = OPTIONS[i].id;\n\t\t var val = localStorage.getItem(o);\n\t\t val = val === null ? OPTIONS[i].def : val;\n\t\t var element = document.getElementById(o);\n\t\t if ( typeof val != 'undefined' && element ) {\n\t\t\t if ( element.nodeName == 'INPUT' ) {\n\t\t\t\t if ( element.type == 'checkbox' ) {\n\t\t\t\t\t if ( val )\n\t\t\t\t\t\t element.checked = true;\n\t\t\t\t } else if ( element.type == 'text' || element.type == 'password' ) {\n\t\t\t\t\t element.value = val;\n\t\t\t\t }\n\t\t\t } else { //selects.. radio groups..\n\n\t\t\t }\n\t\t }\n\t\t}\n\t}", "title": "" }, { "docid": "15bc51c806ae398d7309dffcb76a5a44", "score": "0.64703524", "text": "function initSettings()\n{\n\tvar timerMinutes = millisecondsToMinutes(localStorage['timer-mins']);\n\tvar timeoutMinutes = millisecondsToMinutes(localStorage['timeout-mins']);\n\n\tsettingsTimer.value = timerMinutes;\n\tsettingsTimeout.value = timeoutMinutes;\n}", "title": "" }, { "docid": "9b4b10572e40c8728f75223db5b45e6a", "score": "0.6461032", "text": "function loadSettings() {\n let settings_rloud = browser.storage.local.get(\"RATE_LOUD\");\n settings_rloud.then((a) => RATE_LOUD = a.RATE_LOUD ?? RATE_LOUD, () => {});\n let settings_rsilent = browser.storage.local.get(\"RATE_SILENT\");\n settings_rsilent.then((a) => RATE_SILENT = a.RATE_SILENT ?? RATE_SILENT, () => {});\n let settings_disabled = browser.storage.local.get(\"DISABLED\");\n settings_disabled.then((a) => disabled = a.DISABLED ?? false, () => {});\n}", "title": "" }, { "docid": "fa0e28aa189ea56accf3ef3b5c9b38d9", "score": "0.64340264", "text": "function resetSettings() {\n delete require.cache[\n require.resolve('../../app/scripts/settings')\n ];\n settings = require('../../app/scripts/settings');\n}", "title": "" }, { "docid": "8e630cf89307073ad3e7ca1ff3e241bc", "score": "0.64314336", "text": "function restore_options() {\n chrome.storage.sync.get({\n changeset: true,\n fieldset: true,\n setupsearch: true,\n apiname: false,\n setupcheckall: true,\n layoutuncheckall: false,\n selectfailedtests: true,\n fieldhistorynumallowedfields: 20\n }, function (items) {\n document.getElementById('changeset').checked = items.changeset;\n document.getElementById('fieldset').checked = items.fieldset;\n document.getElementById('setupsearch').checked = items.setupsearch;\n document.getElementById('apiname').checked = items.apiname;\n document.getElementById('setupcheckall').checked = items.setupcheckall;\n document.getElementById('layoutuncheckall').checked = items.layoutuncheckall;\n document.getElementById('selectfailedtests').checked = items.selectfailedtests;\n document.getElementById('fieldhistorynumallowedfields').value = items.fieldhistorynumallowedfields;\n });\n}", "title": "" }, { "docid": "cd45ef5dc9c7983559c1bd22d6577a71", "score": "0.6414161", "text": "function loadSettings() {\n defaultSettings();\n\n const settingsJSON = localStorage.getItem(StoreName.Settings);\n if (settingsJSON) {\n const newSettings = JSON.parse(settingsJSON);\n if (newSettings) {\n if (newSettings.Filters) {\n if (newSettings.Filters.Brightness) {\n Settings.Filters.Brightness = newSettings.Filters.Brightness;\n }\n\n if (newSettings.Filters.Contrast) {\n Settings.Filters.Contrast = newSettings.Filters.Contrast;\n }\n\n if (newSettings.Filters.Hue) {\n Settings.Filters.Hue = newSettings.Filters.Hue;\n }\n\n if (newSettings.Filters.Saturation) {\n Settings.Filters.Saturation = newSettings.Filters.Saturation;\n }\n }\n\n if (newSettings.Highlight1) {\n Settings.Highlight1 = newSettings.Highlight1;\n }\n\n if (newSettings.Highlight2) {\n Settings.Highlight2 = newSettings.Highlight2;\n }\n\n if (newSettings.Highlight3) {\n Settings.Highlight3 = newSettings.Highlight3;\n }\n\n if (newSettings.Menu) {\n Settings.Menu = newSettings.Menu;\n }\n\n if (newSettings.Theme) {\n Settings.Theme = newSettings.Theme;\n }\n\n if (newSettings.Zoom) {\n Settings.Zoom = newSettings.Zoom;\n }\n }\n }\n}", "title": "" }, { "docid": "6a56121061dc13cd2981b435327ec9be", "score": "0.6412566", "text": "function restore_options() {\n\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n fontsize: '16',\n linksbox: '',\n checkpage: 0,\n show_whois: false,\n }, function(items) {\n console.log(items);\n document.getElementById('fontsize').value = items.fontsize;\n document.getElementById('linksbox').value = items.linksbox;\n document.getElementById('checkpage').value = items.checkpage;\n document.getElementById('show_whois').checked=items.show_whois;\n });\n}", "title": "" }, { "docid": "f25608cf47b2711d721d385c809c9188", "score": "0.64093304", "text": "function loadSettings() {\n var saved = Cookies.get(\"settings\");\n\n if(saved == undefined) {\n // Default settings\n // Must stringify otherwise will error on first try\n saved = JSON.stringify(__defaultSettings);\n\n // Should last for their entire duration at sixth form (4 years to account\n // for issues caused by leap days)\n Cookies.set(\"settings\", saved, {expires: 1460});\n } else {\n result = JSON.stringify(amendSettings(JSON.parse(saved)));\n\n if(result[1] == true) {\n saved = result[0];\n Cookies.set(\"settings\", saved, {expires: 1460});\n }\n }\n\n return JSON.parse(saved);\n}", "title": "" }, { "docid": "9f3ac839dadfe23c31d6d11cd14c7ea4", "score": "0.6408282", "text": "function restore_options() {\n chrome.storage.sync.get({\n handshake: DEFAULT_HANDSHAKE,\n dns: DEFAULT_DNS,\n sia: DEFAULT_SIA\n }, function (items) {\n document.getElementById('handshake').innerHTML = items.handshake\n document.getElementById('dns').innerHTML = items.dns\n document.getElementById('sia').innerHTML = items.sia\n });\n}", "title": "" }, { "docid": "48e5d16771c82f5b732b588d96966e10", "score": "0.6405695", "text": "function restoreOptions() {\n var inputs = document.getElementsByTagName('input');\n\n for (var i = 0; i < inputs.length; i++) {\n var key = inputs[i].id;\n \n inputs[i].value = ( ! localStorage[key] ? inputs[i].dataset.default : localStorage[key]);\n }\n}", "title": "" }, { "docid": "3ba70a9ab03661905dc9b820e5557812", "score": "0.6404385", "text": "function loadPageState() {\n if (\"state\" in localStorage) {\n // If this is the first run then the defaults we\n // set earlier are what we're going to run with.\n state = JSON.parse(localStorage.getItem(\"state\"));\n }\n}", "title": "" }, { "docid": "86f7b45ae16f88000f8bedb1481aa386", "score": "0.6399536", "text": "function loadSettings() {\n let input = localStorage.getItem('keyboard_input');\n settings.keyboard_input = (input === null) ? true : input === 'true';\n let notes = localStorage.getItem('keyboard_notes');\n settings.keyboard_notes = (notes === null) ? true : notes === 'true';\n let arrowNav = localStorage.getItem('arrow_nav');\n settings.arrow_nav = (arrowNav === null) ? true : arrowNav === 'true';\n let quickNav = localStorage.getItem('quick_nav');\n settings.quick_nav = (quickNav === null) ? false : quickNav === 'true';\n let errors = localStorage.getItem('show_errors');\n settings.show_errors = (errors === null) ? true : errors === 'true';\n let removeNotes = localStorage.getItem('auto_remove_notes');\n settings.auto_remove_notes = (removeNotes === null) ? true : removeNotes === 'true';\n}", "title": "" }, { "docid": "d317b2e912f30963509e87e8f539de93", "score": "0.63830316", "text": "function restore_options() {\n \t\tvar usuario = localStorage[\"rss\"];\n \t\tif (!usuario) {\n \t\treturn;\n \t\t} else {\n \t\t\tdocument.getElementById(\"user\").value = localStorage[\"user\"];\n \t\t\tdocument.getElementById(\"api\").value = localStorage[\"api\"];\n \t\t\tdocument.getElementById(\"rss\").value = localStorage[\"rss\"];\n \t\t\tif(localStorage[\"nsfw\"]=='false') document.getElementById(\"nsfw\").checked = false;\n \t\t\tif(localStorage[\"m18\"]=='false') document.getElementById(\"m18\").checked = false;\n \t\t\tif(localStorage[\"v21\"]=='false') document.getElementById(\"v21\").checked = false;\n \t\t}\n\t}", "title": "" }, { "docid": "61c1994c619597a0017775bc8d789b2c", "score": "0.6382941", "text": "function restore_options(){\n // Set the image for the logo\n display_button();\n\n // Display currently selected always active mode selection\n let always_res = browser.storage.local.get('alwaysActive');\n always_res\n .then((res) => {\n document.getElementById(\"always-active\").checked = res.alwaysActive;\n });\n\n // Display currently saved start time\n let start_res = browser.storage.local.get('start');\n start_res\n .then((res) => {\n document.getElementById(\"start-time\").value = res.start;\n });\n\n // Display currently saved end time\n let end_res = browser.storage.local.get('end');\n end_res\n .then((res) => {\n document.getElementById(\"end-time\").value = res.end;\n });\n}", "title": "" }, { "docid": "62da6d2fda79733f6c254e8dd1dd559d", "score": "0.63821363", "text": "function restore_options() {\n\t// Use default value color = 'red' and likesColor = true.\n\tchrome.storage.local.get(bookmarklets.loginLogout.options, function(items) {\n//\t\tvar $greetings = $('*[data-greeting]');\n//\t\tvar $name = $greetings.filter('*[data-greeting=\"loginLogout\"][data-option=\"name\"]');\n\t\t$loginLogoutGreeting.filter('[data-option=\"name\"]').val(items[\"loginLogout.name\"]);\n\t\t$loginLogoutGreeting.filter('[data-option=\"password\"]').val(items[\"loginLogout.password\"]);\n\t});\n}", "title": "" }, { "docid": "257a0ccf95ed55f87c3e1cafaac61ae4", "score": "0.6381664", "text": "function scriptSettingsLoad() {\n scriptSettingsImport(window.localStorage.getItem('galefuryScriptSettings'), true);\n}", "title": "" }, { "docid": "e8d2e0c82a4cf6b853536723d79dc9b6", "score": "0.6363856", "text": "function restoreOptions() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get(\n {\n autoAudio: true,\n activePages: 'all',\n highlightElements: 'all',\n modifier: 'none'\n },\n function(settings) {\n document.getElementById('autoAudio').checked = settings.autoAudio;\n document.getElementById('activePages').value = settings.activePages;\n document.getElementById('highlightElements').value = settings.highlightElements;\n document.getElementById('modifier').value = settings.modifier;\n if (document.getElementById('highlightElements').value === 'all') {\n document.querySelector('#warning').style.display = 'block';\n }\n }\n );\n}", "title": "" }, { "docid": "c88f591c51d7345e5096987bf84aaa31", "score": "0.6345551", "text": "function restore_options() {\n var filetype = localStorage[\"filetype\"];\n if (!filetype) {\n return;\n }\n\n var url_prefix = localStorage[\"url_prefix\"];\n if (!url_prefix) {\n return;\n }\n\n var max_default_sleep = localStorage[\"max_default_sleep\"];\n if (!max_default_sleep) {\n return;\n }\n\n var min_default_sleep = localStorage[\"min_default_sleep\"];\n if (!min_default_sleep) {\n return;\n }\n\n var query_prefix = localStorage[\"query_prefix\"];\n if (!query_prefix) {\n return;\n }\n\n var input = document.getElementById(\"url_prefix\");\n input.value = url_prefix;\n\n input = document.getElementById(\"query_prefix\");\n input.value = query_prefix;\n\n input = document.getElementById(\"min_default_sleep\");\n input.value = min_default_sleep;\n\n input = document.getElementById(\"max_default_sleep\");\n input.value = max_default_sleep;\n\n var select = document.getElementById(\"filetype\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == filetype) {\n child.selected = \"true\";\n break;\n }\n }\n}", "title": "" }, { "docid": "c42e5070b5b5d273cbbeabe56d5b8e5e", "score": "0.63351184", "text": "function restore_options() {\n// Use default value color = 'red' and likesColor = true.\nchrome.storage.sync.get({\n bgColor: '#f7f7f7',\n fgColor: '#000000',\n fontSize: \"15\",\n bodyFont: \"Roboto\",\n titleFont: \"Ubuntu\",\n bodyLoadFromGoogle: true,\n titleLoadFromGoogle: true,\n singleColumn: false\n}, set_option_values);\n}", "title": "" }, { "docid": "b154581e8b1e45fd85401351e82c1ad6", "score": "0.63333833", "text": "function restore_options() {\n def = getWords();\n if (localStorage[\"GM_\" + god_name + \":useHeroName\"] == 'true'){\n $j('input#use_hero_name').attr('checked', 'checked');\n }\n if (localStorage[\"GM_\" + god_name + \":useHeil\"] == 'true'){\n $j('input#use_heil').attr('checked', 'checked');\n }\n if (localStorage[\"GM_\" + god_name + \":useShortPhrases\"] == 'true'){\n $j('input#use_short').attr('checked', 'checked');\n }\n if (localStorage[\"GM_\" + god_name + \":useWideScreen\"] == 'true'){\n $j('input#use_wide').attr('checked', 'checked');\n }\n if (localStorage[\"GM_\" + god_name + \":useBackground\"] == 'true'){\n $j('input#use_background').attr('checked', 'checked');\n }\n if (localStorage[\"GM_\" + god_name + \":useRelocateArena\"] == 'true'){\n $j('input#use_replace_arena').attr('checked', 'checked');\n }\n}", "title": "" }, { "docid": "bce16d3b883a2d5c4c2a615a32c6081f", "score": "0.6315289", "text": "function restore_options() {\n chrome.storage.sync.get(null, function(items) {\n for (var key in attributes) {\n document.getElementById(key).value = items[keyPrefix + key] || attributes[key];\n }\n });\n}", "title": "" }, { "docid": "cc598b9c14e19bec9a087eb709667da3", "score": "0.6303247", "text": "function resetAllSettings() {\n //Cancel any list calculations\n signalActiveList();\n restartLists();\n menu_items = calculateRenderedMenus();\n createEntryArray();\n post_list_dict = {};\n post_list_dict.a = [];\n post_list_dict.n = safelistPosts();\n //Side menu items\n $(\"#safelist-box\")[0].outerHTML = renderSidemenu();\n setListClicks();\n initialSessionData(true);\n $(\"#disable-safelist\").click();\n showHidePosts(safelistPosts());\n //Settings menu\n $(\"#show-safelist-settings-link\")[0].innerHTML = safelist_config.name;\n $(\"#safelist-settings\")[0].outerHTML = renderSettingMenu();\n $(\"#safelist-settings\").hide();\n setSettingsClicks();\n if (!safelist_config.enable_write_mode) {\n $.each($(\".safelist-push\"), (i,entry)=>{entry.setAttribute(\"disabled\",true);});\n }\n if (!safelist_config.enable_validate_mode) {\n $.each($(\".safelist-validate\"), (i,entry)=>{entry.setAttribute(\"disabled\",true);});\n }\n if (!safelist_config.enable_order_mode) {\n $.each($(\".safelist-order\"), (i,entry)=>{entry.setAttribute(\"disabled\",true);});\n }\n}", "title": "" }, { "docid": "db9ada7c2074bfa653458045d85d58dc", "score": "0.6293773", "text": "function restoreOptions() {\n console.debug(\"Restoring Options...\");\n var optionDefaults = {};\n optionDefinitions.forEach(function (option) {\n optionDefaults[option.id] = option.default;\n });\n\n chrome.storage.sync.get(optionDefaults,\n function (items) {\n optionDefinitions.forEach(function (option) {\n option.setValue(document.getElementById(option.id), items[option.id]);\n });\n });\n}", "title": "" }, { "docid": "a25b6365662804cf0b8f9c82711e990c", "score": "0.6284491", "text": "function saveSettings() {\n if( UserProfile.suportsLocalStorage() ) {\n localStorage[ 'gravityEnabled' ] = settings.gravityEnabled;\n localStorage[ 'depthEnabled' ] = settings.depthEnabled;\n localStorage[ 'turbinesEnabled' ] = settings.turbinesEnabled;\n localStorage[ 'infectionEnabled' ] = settings.infectionEnabled;\n }\n }", "title": "" }, { "docid": "2e6f862d425e902521828c95396e5b46", "score": "0.6281657", "text": "function restore_options() {\n document.querySelector('[name=\"isUseTogglMapping\"]').checked\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get([\n \"waitingSection\",\n \"workingSection\",\n \"completedSection\",\n \"trelloKey\",\n \"trelloToken\",\n \"togglToken\",\n \"togglProjectId\",\n \"isUseTogglMapping\"\n ], function (items) {\n document.querySelector('[name=\"waiting\"]').value = items.waitingSection ? items.waitingSection : \"\";\n document.querySelector('[name=\"working\"]').value = items.workingSection ? items.workingSection : \"\";\n document.querySelector('[name=\"completed\"]').value = items.completedSection ? items.completedSection : \"\";\n document.querySelector('[name=\"trello-key\"]').value = items.trelloKey ? items.trelloKey : \"\";\n document.querySelector('[name=\"trello-token\"]').value = items.trelloToken ? items.trelloToken : \"\";\n document.querySelector('[name=\"toggl-token\"]').value = items.togglToken ? items.togglToken : \"\";\n document.querySelector('[name=\"toggl-projectid\"]').value = items.togglProjectId ? items.togglProjectId : \"\";\n document.querySelector('[name=\"isUseTogglMapping\"]').checked = items.isUseTogglMapping ? items.isUseTogglMapping : false;\n });\n}", "title": "" }, { "docid": "9d456e033a9658d58f98566c39429364", "score": "0.62738925", "text": "settings() {\n // load the settings into the fields and show\n this.suiteView.displaySettings(false);\n }", "title": "" }, { "docid": "c6f65be04216821b42e275b9f1ddfa53", "score": "0.6267517", "text": "function scriptSettingsResetToDefault() {\n scriptSettings = {};\n scriptSettingsFillDefaults();\n scriptSettingsClean();\n scriptSettingsSave();\n scriptUpdateGuiFromSettings();\n}", "title": "" }, { "docid": "0b99966b4573be3fe29ed850294d10cf", "score": "0.6262999", "text": "function restoreOptions() {\n // Use default value recurringRandom = false\n chrome.storage.sync.get(\n {\n recurringRandom: false\n },\n (items) => {\n document.getElementById('config-recurring-random').checked =\n items.recurringRandom;\n }\n );\n}", "title": "" }, { "docid": "e377113703c04cf94445593bf7e325e9", "score": "0.6249722", "text": "function restore_options() {\n // use default value of undefined for AMP Private Cloud\n // use default value of AMP US Public Cloud\n chrome.storage.local.get({\n favGeo: 'us',\n favAMP: 'FQDN or IP'\n }, function(items) {\n document.getElementById('AMPPublicCloudGeo').value = items.favGeo;\n document.getElementById('AMPPrivateCloudIP').value = items.favAMP;\n });\n}", "title": "" }, { "docid": "466ec703d900be183fa8d27cdf65ab4f", "score": "0.6248805", "text": "function pageBuilderClearSettings() {\n\t\t\t\t$( '.page-builder-section .settings-container .settings' ).html( '' );\n\t\t\t\t$( '.page-builder-section .settings-container' ).slideUp( 'fast' );\n\t\t\t}", "title": "" }, { "docid": "90a25e2e9fcdade8ce2882044701976b", "score": "0.6242426", "text": "function restore_options(options) {\n \n console.log(\"restoring options from saved - options:\",options);\n \n chrome.storage.local.get({\n enabled: 'Ready',\n blockStreams: [],\n userSitePreset: [],\n sites: 'sites'\n }, function(items) {\n \n write_sites_to_page(items);\n \n //reset other options, too\n console.log(\"items.blockStreams\",items.blockStreams);\n document.getElementById(\"block_streams\").checked = items.blockStreams;\n document.getElementById('enabled_status').textContent = items.enabled;\n document.getElementById('new_site').value = items.userSitePreset;\n \n });\n}", "title": "" }, { "docid": "68937c398de6b4879ada13cf52c6a39f", "score": "0.6241414", "text": "function restore_options() {\r\n chrome.storage.local.get({\r\n enabled: false,\r\n url: ''\r\n }, function(items) {\r\n document.getElementById('enabled-parameter').checked = items.enabled;\r\n document.getElementById('url-parameter').value = items.url;\r\n\r\n var status = document.getElementById('status');\r\n status.style.display = 'none';\r\n\r\n change_enabled(null);\r\n });\r\n}", "title": "" }, { "docid": "fed0507df93b2bd5ea4a0ff340e53327", "score": "0.62387305", "text": "function restore_options() {\n // Use default value domain = 'simple' and open_in_new_tab = false.\n chrome.storage.sync.get({\n w_r_domain: 'simple',\n w_r_open_in_new_tab: false\n }, function (items) {\n document.getElementById('domain').value = items.w_r_domain;\n document.getElementById('open_in_new_tab').checked = items.w_r_open_in_new_tab;\n });\n}", "title": "" }, { "docid": "ea823abcf1010acf24de1c3485c0cfa7", "score": "0.62306863", "text": "function restore_options() {\r\n var options = JSON.parse(localStorage.getItem(\"options\"));\r\n document.getElementById(\"tableName\").value = options[\"tableName\"] || '';\r\n document.getElementById(\"urlRowName\").value = options[\"urlRowName\"] || '';\r\n document.getElementById(\"captionRowName\").value = options[\"captionRowName\"] || '';\r\n document.getElementById(\"textRowName\").value = options[\"textRowName\"] || '';\r\n }", "title": "" }, { "docid": "ec2f75d289499ece66b6f5530f0db476", "score": "0.6229208", "text": "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n font: 'Verdana',\n darkTheme: false,\n size: '13px'\n }, function(items) {\n document.getElementById('font').value = items.font;\n document.getElementById('darkTheme').checked = items.darkTheme;\n document.getElementById('size').value = items.size;\n });\n}", "title": "" }, { "docid": "4cf638015253b0b29d39b7cd8b1e881c", "score": "0.6227183", "text": "function restore_options() {\n var server = localStorage[\"server\"];\n var user = localStorage[\"user\"];\n var pass = localStorage[\"pass\"];\n if (server === undefined)\n server = \"127.0.0.1:8332\";\n if (user === undefined)\n user = \"\";\n if (pass === undefined)\n pass = \"\";\n $(\"#server\").val(server);\n $(\"#user\").val(user);\n $(\"#pass\").val(pass);\n}", "title": "" }, { "docid": "0ce9b56448670b214d6d52a5a341cf71", "score": "0.6225149", "text": "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n pushups: '20+',\n\tabs: '80+',\n\tleg: '80+',\n\twater: false\n }, function(items) {\n document.getElementById('pushup').value = items.pushups;\n \tdocument.getElementById('abs').value = items.abs;\n\tdocument.getElementById('legs').value = items.leg;\n\tdocument.getElementById('water').checked = items.water;\n\t});\n}", "title": "" }, { "docid": "27e1610e32aee38ea49e86afdd18760f", "score": "0.6211236", "text": "function restoreOptions() {\n try {\n browser.runtime.getBrowserInfo(function (info) {\n if (info.vendor != \"Mozilla\") {\n document.getElementById(\"non-mozilla\").hidden = false;\n }\n });\n } catch (e) {\n document.getElementById(\"non-mozilla\").hidden = false;\n }\n\n chrome.storage.local.get({\n \"twc-root-dir\": \"TiddlyWiki Classic\",\n \"tw5-root-dir\": \"TiddlyWiki\",\n \"tw5-saves-backup\": true,\n \"tw5-backup-dir\": \"Backup\",\n \"shows-warning\": true\n }, function (items) {\n document.getElementById(\"twc-root-dir\").value\n = items[\"twc-root-dir\"];\n document.getElementById(\"tw5-root-dir\").value\n = items[\"tw5-root-dir\"];\n document.getElementById(\"tw5-saves-backup\").checked\n = items[\"tw5-saves-backup\"];\n document.getElementById(\"tw5-backup-dir\").value\n = items[\"tw5-backup-dir\"];\n document.getElementById(\"shows-warning\").checked\n = items[\"shows-warning\"];\n });\n}", "title": "" }, { "docid": "49a0c1aa57884412d78cafceb77872b3", "score": "0.6200229", "text": "function restore_options() {\n chrome.storage.sync.get({\n peekbox: false,\n hidebox: true,\n scrollbox: false,\n absolutebox: false\n }, function(items) {\n document.getElementById('peek').checked = items.peekbox;\n document.getElementById('hide').checked = items.hidebox;\n document.getElementById('scroll').checked = items.scrollbox;\n document.getElementById('absolute').checked = items.absolutebox;\n });\n}", "title": "" }, { "docid": "a20738b6d6405896085ac67c6e86b883", "score": "0.62000597", "text": "function loadSettings() \n{\n\tfor(var i = 1; i <= 2; i++)\n\t{\n\t\tif(i<10)\n\t\t{\n\t\t\tvar val='PP0' + i + 'Value';\n\t\t\tvar txt_id='txtPP0' + i;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar val='PP' + i + 'Value';\n\t\t\tvar txt_id='txtPP' + i;\n\t\t}\n\t\t\n\t\tif(!sessionStorage.getItem(val))\n\t\t{\n\t\t\tdocument.getElementById(txt_id).value=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdocument.getElementById(txt_id).value=sessionStorage.getItem(val);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "340a5bfa844b185153d3ecf8192b39b8", "score": "0.6194396", "text": "function loadSettings() {\n\n function onError(error) {\n\tconsole.log(\"Error loading settings: \" + error);\n }\n\n function useLoadedRules(result) {\n\tif (result != null) {\n\t // console.log(\"useLoadedRules \" + typeof(result.rules) + \" \" + result.rules);\n\t var parsed_rules = JSON.parse(result.rules);\n\t rules = parsed_rules;\n\t updateOptionsUI(rules);\n\t}\n }\n\n var get = browser.storage.local.get();\n get.then(useLoadedRules, onError);\n}", "title": "" }, { "docid": "80e31a529ad22337f93f7f8cd2c20173", "score": "0.61724037", "text": "function restoreOptions() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.local.get({\n url: '',\n projectIds: []\n }, function(items) {\n document.getElementById('url').value = items.url;\n projectIds = items.projectIds;\n renderProjectIds();\n });\n}", "title": "" }, { "docid": "0c805bef36f320af5777327ad4ed2b3a", "score": "0.61689234", "text": "function restore_options() {\n\tchrome.storage.sync.get('user_inst', function(item) {\n\t\tdocument.querySelector('#inst').value = item.user_inst;\n\t\tconsole.log(\"Options restored. Current option is \" + document.querySelector('#inst').value);\n\t});\n\t\n}", "title": "" }, { "docid": "bb9f9e536aba82db8eb5bda719d3d6ad", "score": "0.6168421", "text": "load() {\n this.data = JSON.parse(localStorage.getItem(\"settings\")) || {};\n this.data.theme = this.data.theme || \"dark\";\n }", "title": "" }, { "docid": "8d2f799fa6bbdab6817fa5911fa15164", "score": "0.6165849", "text": "function resetSettings(){\n Settings.remove( KEYPREFIX );\n}", "title": "" }, { "docid": "8af85b8142d94f30ab167e652c2c3640", "score": "0.61630654", "text": "function restore_options() {\n// Use default value true\nchrome.storage.sync.get({\n brightness: true,\n calendar: true,\n badges: true,\n collegeServices: true,\n msTools: true,\n removeCourseSurvey: true,\n removeDyk: true,\n removeEmpDir: true,\n removeITS: true,\n removeMyOrg: true,\n removeMsSubjNote: true,\n removeNews: true,\n removeSpotlight: true,\n removeWebMail: true,\n themeDefault: true,\n themeDark: false,\n themeNew: false,\n forgotPass: true,\n fontSize\n}, function(items) {\n document.getElementById('adj-brightness').checked = items.brightness;\n document.getElementById('calendar').checked = items.calendar;\n document.getElementById('badges').checked = items.badges;\n document.getElementById('college-services').checked = items.collegeServices;\n document.getElementById('ms-tools').checked = items.msTools;\n document.getElementById('remove-course-survey').checked = items.removeCourseSurvey;\n document.getElementById('remove-dyk').checked = items.removeDyk;\n document.getElementById('remove-emp-dir').checked = items.removeEmpDir;\n document.getElementById('remove-its').checked = items.removeITS;\n document.getElementById('remove-my-org').checked = items.removeMyOrg;\n document.getElementById('remove-ms-subj-note').checked = items.removeMsSubjNote;\n document.getElementById('remove-news').checked = items.removeNews;\n document.getElementById('remove-spotlight').checked = items.removeSpotlight;\n document.getElementById('remove-webmail').checked = items.removeWebMail;\n document.getElementById('theme-default').checked = items.themeDefault;\n document.getElementById('theme-dark').checked = items.themeDark;\n document.getElementById('theme-new').checked = items.themeNew;\n document.getElementById('forgot-pass').checked = items.forgotPass;\n document.getElementById('fontSize').checked = items.fontSize;\n});\n}", "title": "" }, { "docid": "81f26eca269fc0da5774c568fdfb7ead", "score": "0.6159993", "text": "function restore_options() {\n // Use empty strings as default values\n chrome.storage.sync.get(\n {\n airtableUrl: '',\n airtableApiKey: ''\n },\n items => {\n document.getElementById('airtableUrl').value = items.airtableUrl\n document.getElementById('airtableApiKey').value = items.airtableApiKey\n }\n )\n}", "title": "" }, { "docid": "cb8252174ce7aaa486f81e11cf265587", "score": "0.61543876", "text": "function restore_options() {\n\t// Use default value color = 'red' and likesColor = true.\n\tchrome.storage.sync.get({\n\t\ttag: 'cat',\n\t\trating: \"r\"\n\t}, function(items) {\n\t\ttag.value = items.tag;\n\t\trating.value = items.rating;\n \t});\n}", "title": "" }, { "docid": "70ffe051e4c6f7c2ddd49ac6d64332aa", "score": "0.61479187", "text": "onLoad() {\n super.onLoad();\n this.items.add(this.settingForm);\n latte.Setting.getGlobalByName(this.globalSetting.name).send((s) => this.setting = s);\n }", "title": "" }, { "docid": "a7c36e42e1c264443ce9be6d7b81925f", "score": "0.613853", "text": "function setSafeModeDefaults() {\n time_between_actions = 0;\n reload_on_completion = false;\n}", "title": "" }, { "docid": "beb7104d8f750841a9b5bc53d3853311", "score": "0.6136998", "text": "resetPDFViewerSettings () {\n localStorage.removeItem('database')\n }", "title": "" }, { "docid": "beb7104d8f750841a9b5bc53d3853311", "score": "0.6136998", "text": "resetPDFViewerSettings () {\n localStorage.removeItem('database')\n }", "title": "" }, { "docid": "0df7baae203dce22a7f791272fae481d", "score": "0.61363924", "text": "function restore_options() {\n var intColor = localStorage[\"intColor\"];\n var floatColor = localStorage[\"floatColor\"];\n var stringColor = localStorage[\"stringColor\"];\n var boolColor = localStorage[\"boolColor\"];\n var objectColor = localStorage[\"objectColor\"];\n var arrayColor = localStorage[\"arrayColor\"];\n var nullColor = localStorage[\"nullColor\"];\n\n //first time restore fix\n intColor = (intColor == undefined)? \"default\": intColor;\n floatColor = (floatColor == undefined)? \"default\": floatColor;\n stringColor = (stringColor == undefined)? \"default\": stringColor;\n boolColor = (boolColor == undefined)? \"default\": boolColor;\n objectColor = (objectColor == undefined)? \"default\": objectColor;\n arrayColor = (arrayColor == undefined)? \"default\": arrayColor;\n nullColor = (nullColor == undefined)? \"default\": nullColor;\n\n document.getElementById(\"int-color\").value = intColor;\n document.getElementById(\"float-color\").value = floatColor;\n document.getElementById(\"string-color\").value = stringColor;\n document.getElementById(\"bool-color\").value = boolColor;\n document.getElementById(\"object-color\").value = objectColor;\n document.getElementById(\"array-color\").value = arrayColor;\n document.getElementById(\"null-color\").value = nullColor;\n document.getElementById(\"y-cas\").checked = (localStorage[\"cascade\"]===\"true\");\n document.getElementById(\"n-cas\").checked = (localStorage[\"cascade\"]===\"false\");\n document.getElementById(\"y-autoR\").checked = (localStorage[\"autorun\"]===\"true\");\n document.getElementById(\"n-autoR\").checked = (localStorage[\"autorun\"]===\"false\");\n}", "title": "" }, { "docid": "ffde28175123d25458b5301aec5efff8", "score": "0.61327136", "text": "function retrieveSettings() {\n\t//set default subreddits\n\t//in firefox not defined item is null not 'undefined' like in chrome -_- \n\tif ('undefined' == typeof localStorage['settings'] || null == localStorage['settings']) {\n\t\tlocalStorage.setItem('settings', JSON.stringify(Settings));\n\t} else {\n\t\tSettings = JSON.parse(localStorage.getItem('settings'));\n\t}\n}", "title": "" }, { "docid": "a74ccd2147b3b26d1ecb42f0cb64857e", "score": "0.613019", "text": "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n preImg: true,\n trueScroll: true\n }, function(items) {\n document.getElementById('rp_preimg').checked = items.preImg;\n document.getElementById('rp_scroll').checked = items.trueScroll;\n });\n}", "title": "" }, { "docid": "2a8c1f82715075f6cac94e8f423931e2", "score": "0.61125386", "text": "function restore() {\n}", "title": "" }, { "docid": "264ae0ac8d63318614b8e6d6731dd4c5", "score": "0.6107384", "text": "function restore_options() {\n // Default values\n chrome.storage.local.get({\n email: '[email protected]',\n firstName: 'Default',\n lastName: 'Name',\n addressLine1: 'Buckingham Palace',\n addressLine2: '',\n city: 'London',\n postcode: 'SW1A 1AA'\n }, function(items) {\n document.getElementById('emailToFillWith').value = items.email;\n document.getElementById('firstNameToFillWith').value = items.firstName;\n document.getElementById('lastNameToFillWith').value = items.lastName;\n document.getElementById('addressLine1ToFillWith').value = items.addressLine1;\n document.getElementById('addressLine2ToFillWith').value = items.addressLine2;\n document.getElementById('cityToFillWith').value = items.city;\n document.getElementById('postcodeToFillWith').value = items.postcode;\n });\n}", "title": "" }, { "docid": "6dbb3af292227b28b8cb49be9a8a7d27", "score": "0.61045897", "text": "function applySettings() {\n var $inputElements = $menu.find(\"input\");\n var settings = {};\n\n $.each($inputElements, function(index, element) {\n var $element = $(element);\n var inputType = $element.prop(\"type\").toLowerCase();\n var settingsName = $element.data(\"settings-name\");\n var settingsValue;\n\n switch (inputType) {\n case \"checkbox\":\n settingsValue = $element.prop(\"checked\");\n break;\n case \"text\":\n settingsValue = $element.val();\n break;\n default:\n settingsValue = $element.val();\n break;\n }\n\n settings[settingsName] = settingsValue;\n });\n\n saveSettingsToLocalStorage(settings);\n $menu.hide();\n\n alert(\"You may need to refresh dubtrack to see changes take effect.\");\n }", "title": "" }, { "docid": "c8916c20173597b0a87c2c9ec93915de", "score": "0.61044556", "text": "function restore_options() {\r\n\r\n chrome.storage.sync.get({\r\n subreddit: \"pics\",\r\n sort: \"hot\",\r\n zoom: \"contain\"\r\n }, function(items) {\r\n document.getElementById('subreddit').value = items.subreddit\r\n $(\"input[name=sort][value=\"+items.sort+\"]\").prop('checked', true)\r\n $(\"input[name=zoom][value=\"+items.zoom+\"]\").prop('checked', true)\r\n });\r\n}", "title": "" }, { "docid": "3c31387c76b19b1d73b6c663b6011a4b", "score": "0.6102312", "text": "function reset_save_data() {\n window.save_data = {\n 'item_list': [],\n 'db_total_item_count': 0,\n 'db_return_item_count': 0,\n 'db_max_page_idx': 0,\n 'view_max_page_count': 5,\n 'view_item_count_per_page': 10,\n 'view_start_page_idx': 0,\n 'view_current_page_idx': 0,\n 'view_current_page_count': 0,\n 'operator_list': [],\n 'have_been_changed': false,\n };\n}", "title": "" }, { "docid": "ac2270f9d51ae359e0179231acd4436d", "score": "0.60976064", "text": "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n document.getElementById('backgroundcolor').value = '#333333';\n document.getElementById('date').value = '11/03/1967';\n document.getElementById('passed').value = '19.1, 97.7, 100, 60';\n document.getElementById('left').value = '0, 0, 40, 25';\n\n chrome.storage.sync.set({\n color: '#333333', date: '11/03/1967', passed: '19.1, 97.7, 100, 60', left: '0, 0, 40, 25'}, function() {\n document.getElementById('status1').innerHTML = status.textContent = 'Default restored.';\n });\n}", "title": "" }, { "docid": "3b19b61c3e9c2780b57fad607e179665", "score": "0.6096944", "text": "function restore_options() {\n chrome.storage.sync.get(['bubble', 'fastAdd', 'showTranslate', 'closeButton', 'contextMenu'], (items) => {\n bubbleGlobalOption.checked = items.bubble;\n fastAddOption.checked = items.fastAdd;\n showTranslateOption.checked = items.showTranslate;\n closeButtonOption.checked = items.closeButton;\n contextMenuOption.checked = items.contextMenu;\n });\n }", "title": "" }, { "docid": "ce08871f04bada97b8f42e2239ff3c02", "score": "0.6096682", "text": "function restore_options() {\n chrome.storage.sync.get({\n influxUrl: null,\n influxCredentials: null \n }, function(items) {\n document.getElementById('influxurl').value = items.influxUrl;\n document.getElementById('credentials').value = items.influxCredentials;\n });\n}", "title": "" } ]
76da1b5b0f071fa7b3498ebf2c54d675
Get dimension of bullet
[ { "docid": "e254cd77bb2cbc6a223b2244a4d4de2d", "score": "0.57927203", "text": "getDimensions() {\n return { halfWidth: this.halfWidth, halfHeight: this.halfHeight };\n }", "title": "" } ]
[ { "docid": "bc5bf3f5b79e36b5042b02f374f536f4", "score": "0.6042361", "text": "function get_size(size)\n{\n return(size*(max_draw_size - min_draw_size) + min_draw_size)\n}", "title": "" }, { "docid": "0483038611c2653658962ccad8ad7664", "score": "0.6032347", "text": "async dimensions() {\n await this.load();\n return `${this.get('width')}x${this.get('height')}`;\n }", "title": "" }, { "docid": "87dc23d2df1faa11be2d67413479b9f7", "score": "0.60007775", "text": "get dimension() { return this.length }", "title": "" }, { "docid": "6e6c7759aba9aaeaaf4ac44bfcf1e348", "score": "0.59960216", "text": "width() { return this.tex_obj.width }", "title": "" }, { "docid": "258b64789a02aa10719f3f580d1af7e2", "score": "0.59734374", "text": "function Bullet() {\n this.srcX = 120;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 13;\n this.height = 8;\n this.explosion = new Explosion();\n}", "title": "" }, { "docid": "0f92aaf67298b8f87420a637d3048e2b", "score": "0.5960808", "text": "get spritePixelsPerUnit() {}", "title": "" }, { "docid": "f052981caa2cb7f1a49d0e7705025fb4", "score": "0.59365016", "text": "function getItemWidthHeightName(input) {\r var myLayer = doc.layers[input];\r var divNumber = myLayer.pathItems.length;\r for (var i = 0; i < divNumber; i++){\r var itemWidth = doc.pathItems[i].width;\r var itemHeight = doc.pathItems[i].height;\r var itemName = doc.pathItems[i].name;\r divHeightWidth.push(itemName, itemWidth, itemHeight); \r }\r return divHeightWidth;\r}", "title": "" }, { "docid": "411fb8a9725e0f3d877dd3a83f5c3d23", "score": "0.5934025", "text": "@flow\n get contentSize() {\n const [width, height] = this.attrSize;\n const boxSize = this.texturesSize || [0, 0];\n\n let [w, h] = [width, height];\n\n if(width === '') {\n w = boxSize[0] | 0;\n if(height !== '' && boxSize[1]) {\n w *= height / boxSize[1];\n }\n }\n if(height === '') {\n h = boxSize[1] | 0;\n if(width !== '' && boxSize[0]) {\n h *= width / boxSize[0];\n }\n }\n\n return [w, h];\n }", "title": "" }, { "docid": "f622f8c1a13bfcecea963e6ddd05b044", "score": "0.5929286", "text": "function hitboxScaleFromType(bulletType) {\n switch(bulletType) {\n case \"laser\":\n return 2\n break;\n case \"rice\":\n return 0.75\n break;\n case \"ball\":\n return 1.5\n break;\n case \"bubble\":\n return 2\n break;\n default:\n return 1\n break;\n }\n}", "title": "" }, { "docid": "d7bc5968f8134a832cef3af5a379dee2", "score": "0.59088004", "text": "get size() {\n return new Vec2(this.canvas.width, this.canvas.height);\n }", "title": "" }, { "docid": "5543652ab7c4f0357a053fc5cec1377d", "score": "0.5904993", "text": "function getDimension(dim) {\n switch(dim) {\n case \"container.width\":\n return availableWidth;\n case \"container.height\":\n return availableHeight;\n case \"interactive.left\":\n return leftBoundary;\n case \"interactive.top\":\n return topBoundary;\n case \"interactive.width\":\n case \"interactive.right\":\n return availableWidth - leftBoundary;\n case \"interactive.height\":\n case \"interactive.bottom\":\n return availableHeight - topBoundary - bottomBarWidth;\n default:\n dim = dim.split(\".\");\n return getDimensionOfContainer($containerByID[dim[0]], dim[1]);\n }\n }", "title": "" }, { "docid": "35100ae3f0d3e96bf33c67c20f5a92ea", "score": "0.589083", "text": "getDimensions() {\n return {\n w: this._w,\n h: this._h\n };\n }", "title": "" }, { "docid": "ee01ae98d46f7a0e434f9e760ee284d9", "score": "0.58862823", "text": "getSize () {\r\n return {\r\n width: this.size.x,\r\n height: this.size.y\r\n }\r\n }", "title": "" }, { "docid": "6f44861c5a1611f8f9df793573a6860d", "score": "0.5873815", "text": "get Size() {\n\t\treturn {\n\t\t\tx: this.limitX,\n\t\t\ty: this.limitY,\n\t\t};\n\t}", "title": "" }, { "docid": "f6ace5fcbfa2990cd607ad769fa6017b", "score": "0.58475864", "text": "getDimensions() {\n return {x: 1, y: 1, z: 1}\n }", "title": "" }, { "docid": "4d6341d2a0f4cf5c7c81959bd5cd7e42", "score": "0.5837401", "text": "getWidth(){}", "title": "" }, { "docid": "b602f896a4f3cdcec4dd8a245b09dec9", "score": "0.58372355", "text": "function setBullet() {\n bullet.posX = 0;\n bullet.posY = 0;\n bullet.height = 4;\n bullet.width = 4;\n }", "title": "" }, { "docid": "bbfa4bdefd059c241599ecc85e6cdd4d", "score": "0.58248955", "text": "get contentSize() {\n const [width, height] = this.attrSize;\n const boxSize = this.texturesSize || [0, 0];\n\n let [w, h] = [width, height];\n\n if (width === '') {\n w = boxSize[0] | 0;\n if (height !== '' && boxSize[1]) {\n w *= height / boxSize[1];\n }\n }\n if (height === '') {\n h = boxSize[1] | 0;\n if (width !== '' && boxSize[0]) {\n h *= width / boxSize[0];\n }\n }\n\n return [w, h];\n }", "title": "" }, { "docid": "d41f194a45cd4416d15593e151db5bb5", "score": "0.5805243", "text": "get_size() {\n var wrapper_info = this.svg_wrapper.node().getBoundingClientRect()\n return [wrapper_info.height, wrapper_info.width]\n }", "title": "" }, { "docid": "ed0678476bc8845fffddbb34edc55de7", "score": "0.5780577", "text": "get size() {\r\n return 12 * this.sides;\r\n }", "title": "" }, { "docid": "80842ff5e6026d3c9c5c813c6beabaaa", "score": "0.576599", "text": "_getWidth() {\n var mainShape = this.getTask().getShape('main');\n return mainShape.getWidth();\n }", "title": "" }, { "docid": "376889fed2869fc44e3c8a46ad0ee8bc", "score": "0.5761585", "text": "function proto_getHeight(element) {\n return proto_getDimensions(element)[1];\n}", "title": "" }, { "docid": "7a5b432d119a9770607550115f67e456", "score": "0.5716423", "text": "get dimensions () {\n\t\treturn this._dimensions;\n\t}", "title": "" }, { "docid": "df3d8b74b6cae60d4293f042273fab40", "score": "0.5691646", "text": "getDimensions() {\n return _spaceDimensions;\n }", "title": "" }, { "docid": "08b7909537719ae9516bbd223ca07e88", "score": "0.5687042", "text": "getHeight(){}", "title": "" }, { "docid": "c51af4d325c5f107ff0fbb45a9958146", "score": "0.5679693", "text": "function Bullet() {\r\n this.srcX = 100;\r\n this.srcY = 500;\r\n this.drawX = -20;\r\n this.drawY = 0;\r\n this.width = 5;\r\n this.height = 5;\r\n this.speed = 30;\r\n this.explosion = new Explosion ();\r\n}", "title": "" }, { "docid": "6ab56ee56e823279003754af23198215", "score": "0.5652581", "text": "function getWidth()\n{\n\treturn PLAYFIELD_SIZE_X;\n}", "title": "" }, { "docid": "79a640f649b712bcc85c30938d875e8d", "score": "0.5636979", "text": "getDiameter() {\n return this.size;\n }", "title": "" }, { "docid": "d325074548ea2a26f9df56c5b09026f7", "score": "0.56254125", "text": "function getTargetDimension () {\n const targetWidth = parseInt(container.style('width'))\n const targetHeight = Math.round(targetWidth / aspect)\n return { width: targetWidth, height: targetHeight }\n }", "title": "" }, { "docid": "5290603cfbfad2cfec506406cf33d647", "score": "0.56250155", "text": "get size() {\r\n return 6 * this.sides + 6 * this.sides * this.bands;\r\n }", "title": "" }, { "docid": "19675f945f76b0ae6a520f7191fe4666", "score": "0.56092626", "text": "get extents() {\n return this.getAttribute('extents');\n }", "title": "" }, { "docid": "d5abcae5c2175668bef13cce91559d63", "score": "0.5607703", "text": "getWidth() {\n const lastPlaceholder = this.placeholders[this.placeholders.length - 1];\n return lastPlaceholder.position.x + lastPlaceholder.getWidth() - this.position.x;\n }", "title": "" }, { "docid": "07c5e1a62cfdcb27dff3d2442ed2881e", "score": "0.5598741", "text": "function getDrawHeight() {\n return this.drawHeight;\n}", "title": "" }, { "docid": "4a8b738f7a0f6daea151ce93d0747cf0", "score": "0.5589229", "text": "function updateBulletBounds(obj){\r\n\tobj.x1 = obj.x;\r\n\tobj.y1 = obj.y;\r\n\tobj.x2 = obj.x;\r\n\tobj.y2 = obj.y;\r\n}", "title": "" }, { "docid": "8b227c17cec79121622896f71f5ea335", "score": "0.558318", "text": "function Bullet(x,y) {\n\t\n\treturn {\n\t\tx: x,\n\t\ty: y,\n\t\twidth: 5,\n\t\theight: 10,\n\t\tspeed: 5,\n\t\tcolor: 'yellow'\n\t};\n}", "title": "" }, { "docid": "13ed8eb1bb310e54ab4ce0718a56dfab", "score": "0.5569121", "text": "dimensions() {\n return [\n this.availableWidth() - (this.margins.left + this.margins.right),\n this.availableHeight() - (this.margins.top + this.margins.bottom),\n ];\n }", "title": "" }, { "docid": "aedc22a733347b8e2ed5d4142e5c0317", "score": "0.55555725", "text": "get size() {\n return Math.max( Math.abs(this.x), Math.abs(this.y) );\n }", "title": "" }, { "docid": "13bd4373cfaf6302176d35ba934a9314", "score": "0.55419725", "text": "calcDimensions() {\n var element = this.root;\n if (!element) {\n return 0.0;\n }\n \n //var txt = \"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\";\n var txt = \"0123456789\";\n \n var temp = document.createElement(\"span\");\n var css = window.getComputedStyle(element, null);\n var fontFamily = css.getPropertyValue(\"font-family\");\n var fontSize = css.getPropertyValue(\"font-size\");\n temp.setAttribute(\"style\",\"margin:0px;padding:0px;font-family:\"+fontFamily+\";font-size:\"+fontSize);\n temp.innerText = txt;\n temp = element.appendChild(temp);\n this.dims.width = temp.offsetWidth / 10.0;\n this.dims.height = temp.offsetHeight;\n temp.parentNode.removeChild(temp);\n \n return this.dims;\n }", "title": "" }, { "docid": "3367c8faef95188e4830dcc751a57fad", "score": "0.554125", "text": "function checkBulletBounds () {\n bullets.forEach(bullet => {\n if (bullet.x < 0) {\n bullet.stat = \"dead\"\n }\n if (bullet.y < 0) {\n bullet.stat = \"dead\"\n }\n if (bullet.x > 600) {\n bullet.stat = \"dead\"\n }\n if (bullet.x > 600) {\n bullet.stat = \"dead\"\n }\n })\n}", "title": "" }, { "docid": "1c642aa7bd196867c8b1d8e01bd4a1ed", "score": "0.55358887", "text": "bulletSquareY(i) {\n return this.lineY(i) - (this.bulletDiameter - this.lineHeight) / 2;\n }", "title": "" }, { "docid": "c1d59615b8ea7a54527ab22adb97fabf", "score": "0.55312276", "text": "getHeight() {\n return 144;\n }", "title": "" }, { "docid": "0441333c81b2bc280821296e05e6f122", "score": "0.55297375", "text": "getWidth() {\n return this.w;\n }", "title": "" }, { "docid": "31cb8b12dde67c660ed5a7a5d427c9c4", "score": "0.5516839", "text": "get dimensions() {\n return fromCache(this, CACHE_KEY_DIMENSIONS, () => {\n const inner = document.createElement('div');\n const outer = document.createElement('div');\n document.body.appendChild(outer);\n outer.style.position = 'absolute';\n outer.style.top = '0px';\n outer.style.left = '0px';\n outer.style.visibility = 'hidden';\n outer.appendChild(inner);\n // Disabled, not needed for current feature set.\n //\n // Calculate width:\n // inner.style.width = '100%';\n // inner.style.height = '200px';\n // outer.style.width = '200px';\n // outer.style.height = '150px';\n // outer.style.overflow = 'hidden';\n // w1 = inner.offsetWidth;\n // outer.style.overflow = 'scroll';\n // w2 = inner.offsetWidth;\n // w2 = (w1 === w2) ? outer.clientWidth : w2;\n // width = w1 - w2;\n // Calculate height:\n inner.style.width = '200px';\n inner.style.height = '100%';\n outer.style.width = '150px';\n outer.style.height = '200px';\n outer.style.overflow = 'hidden';\n const h1 = inner.offsetHeight;\n outer.style.overflow = 'scroll';\n let h2 = inner.offsetHeight;\n h2 = (h1 === h2) ? outer.clientHeight : h2;\n const height = h1 - h2;\n document.body.removeChild(outer);\n return {\n // width,\n height,\n };\n });\n }", "title": "" }, { "docid": "174d80f6ab5322522ac698513e0baa80", "score": "0.5513289", "text": "function scaleImageLength(l) {\n return modelView.model2px(0.01 * l);\n }", "title": "" }, { "docid": "905a640a3537d9071d424bc9e507a24b", "score": "0.55104834", "text": "function getDimension(type) {\n var max = 0,\n item,\n current;\n $items.each(function () {\n item = $(this);\n current = (type === 'height') ? item.outerHeight(true) : item.outerWidth(true);\n if (current > max) {\n max = current;\n }\n });\n return max;\n }", "title": "" }, { "docid": "53e383522af38e3921b1008e0e981435", "score": "0.5506855", "text": "get width() {\n return this.scale.x * this._targetWidth;\n }", "title": "" }, { "docid": "af79f35e050aa83acdd4639f5ade45b9", "score": "0.5505724", "text": "getShelfWidth() { return this.shelf_base_face_dimensions_axes[0]; }", "title": "" }, { "docid": "a13f1863fca2e93e0851728f166db27f", "score": "0.55026144", "text": "dimensions() {\r\n\t\treturn this.coordinates.length;\r\n\t}", "title": "" }, { "docid": "78a28995215878237296bcef66a47b89", "score": "0.55021924", "text": "function createBullet() {\n var bullet = {\n x: ship.x + Math.cos(ship.a) * SHIP_SIZE / 2, // x coordinate of the bullet's center (same as the tip of the ship)\n y: ship.y + Math.sin(ship.a) * SHIP_SIZE / 2, // y coordinate of the bullet's center (same as the tip of the ship)\n dx: Math.cos(ship.a) * BULLET_SPEED + ship.dx, // x velocity of the bullet (add the ship's velocity for realism)\n dy: Math.sin(ship.a) * BULLET_SPEED + ship.dy, // y velocity of the bullet (add the ship's velocity for realism)\n lifetime: BULLET_LIFETIME // how long the bullet should live in frames\n };\n bullets.push(bullet);\n}", "title": "" }, { "docid": "c22be4d7040e61fd8d30ae87f6dd2708", "score": "0.54915696", "text": "function Bullet(bulletSet, spriteTexture, spawnPos, speed, dir, size) {\n if (size === undefined) {\n this.kRefWidth = 130;\n\n } else {\n\n this.kRefWidth = size;\n }\n this.kRefHeight =this.kRefWidth *15/13;\n\n this.mBullet = new SpriteRenderable(spriteTexture);\n this.mBullet.setColor([1, 1, 1, 0.1]);\n this.mBullet.getXform().setPosition(spawnPos[0], spawnPos[1]);\n this.mBullet.getXform().setSize(this.kRefWidth / 50, this.kRefHeight / 50);\n // this.mBullet.setElementPixelPositions(510, 595, 23, 153);\n this.mBullet.setElementPixelPositions(0,64,0,64);\n\n this.mbulletSet = bulletSet;\n\n GameObject.call(this, this.mBullet);\n\n this.setSpeed(speed);\n this.setCurrentFrontDir(dir);\n\n this.kDemage = 0;\n\n\n this.spawnTime = Date.now();\n}", "title": "" }, { "docid": "293e8bf43ec8f474ddba65aedb708149", "score": "0.54904497", "text": "function create_bullet(){\n\t\tbullets.x.push(spaceship.x);\n\t\tbullets.y.push(spaceship.y);\n}", "title": "" }, { "docid": "53129822f2f6ccb4938f3ba41fe9723a", "score": "0.54795986", "text": "get lengthSqr()\n {\n return this.x * this.x + this.y * this.y;\n }", "title": "" }, { "docid": "05f38734eb8fc01214248dd97258dfb0", "score": "0.54755706", "text": "get length() {\n\t\treturn Math.sqrt(this.x * this.x + this.y * this.y);\n\t}", "title": "" }, { "docid": "57e20a44bf52cddcfee9d532b3d77c9e", "score": "0.546977", "text": "get length() {\r\n let x = this._x, y = this._y;\r\n return Math.sqrt(x * x + y * y);\r\n }", "title": "" }, { "docid": "cf9cc5d7f53c05a2745990f4ca625b50", "score": "0.5468657", "text": "getCurrentSize() {\n return this.ballHolder.items.length;\n }", "title": "" }, { "docid": "cf57c49a6908dda51cafd67c6870f326", "score": "0.54683405", "text": "function createBullet(){\r\n bullet = createSprite(displayWidth/2,displayHeight/2 + 100,50,10);\r\n bullet.addImage(bulletImg);\r\n bullet.x = player.x;\r\n bullet.velocityY = -6;\r\n bullet.lifetime = 100;\r\n bullet.scale = 0.1;\r\n bulletGroup.add(bullet);\r\n // shooterSound.play();\r\n}", "title": "" }, { "docid": "ff7fd4e726d2766c68f3410f6c128af5", "score": "0.5460492", "text": "get width() {\n return this._values[2];\n }", "title": "" }, { "docid": "86d586dd99944e54de16923f39d7622f", "score": "0.5454027", "text": "getWidth() { return this.width; }", "title": "" }, { "docid": "86d586dd99944e54de16923f39d7622f", "score": "0.5454027", "text": "getWidth() { return this.width; }", "title": "" }, { "docid": "86d586dd99944e54de16923f39d7622f", "score": "0.5454027", "text": "getWidth() { return this.width; }", "title": "" }, { "docid": "5fdfb073ce0d7874dcea71b81a8e754b", "score": "0.5451222", "text": "getShelfHeight() { return this.shelf_left_face_dimensions_axes[1]; }", "title": "" }, { "docid": "3b39cd23e2f7b92f3cc72a7adae6e872", "score": "0.544952", "text": "function calcArtDimensions() {\n // const rulerConverter = 17.456666;\n const rulerConverter = 16;\n let curWidth = $('#design-display').width();\n let curHeight = $('#design-display').height();\n let widthInInches = curWidth / rulerConverter;\n let heightInInches = curHeight / rulerConverter;\n widthInInches = widthInInches.toFixed(2);\n $('.current-width').text(`${widthInInches}\"`);\n heightInInches = heightInInches.toFixed(2);\n $('.current-height').text(`${heightInInches}\"`);\n }", "title": "" }, { "docid": "07bc94136446dc31edf7c343c3478eaf", "score": "0.5445263", "text": "get spriteBorder() {}", "title": "" }, { "docid": "18d20e2601dd57119c6a7c66cbf7f427", "score": "0.5438662", "text": "function X(){var t=l.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||l[e]:t.height||l[e]}", "title": "" }, { "docid": "ffc3c8b2d6595a4d4b462733bb445bb9", "score": "0.54364276", "text": "function calculateBulletSpeed(startPosition, endPosition, speed) {\r\n\tbulletSpeed = new Object();\r\n\tvector = new Object();\r\n\tvector.x = endPosition.x - startPosition.x;\r\n\tvector.y = endPosition.y - startPosition.y;\r\n\tvector.z = endPosition.z - startPosition.z;\r\n\t// (c) Pythagoras\r\n\tdistance = Math.sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z);\r\n\tc = distance / speed;\r\n\tbulletSpeed.x = vector.x / c;\r\n\tbulletSpeed.y = vector.y / c;\r\n\tbulletSpeed.z = vector.z / c;\r\n\treturn bulletSpeed;\r\n}", "title": "" }, { "docid": "daff926cc5f4863d5e0e06dddf1c56e1", "score": "0.5435533", "text": "get_position_size() {\n return [this.x, this.y, this.width, this.height];\n }", "title": "" }, { "docid": "c5e263e5551f0b8e53185a8c8f94d30e", "score": "0.54339796", "text": "getHeight() {\n const y_offset = (this.stem_direction === Stem.UP) ? this.stem_up_y_offset : this.stem_down_y_offset; // eslint-disable-line max-len\n return ((this.y_bottom - this.y_top) * this.stem_direction) +\n ((Stem.HEIGHT - y_offset + this.stem_extension) * this.stem_direction);\n }", "title": "" }, { "docid": "d4573fe1872e7048ae517418e18b2183", "score": "0.54326653", "text": "function H() {\n var t = d.getBoundingClientRect()\n , e = \"offset\" + [\"Width\", \"Height\"][n.ort];\n return 0 === n.ort ? t.width || d[e] : t.height || d[e]\n }", "title": "" }, { "docid": "5577c5ffdf7594c96d32e80eef6bb44e", "score": "0.54264855", "text": "function size(x) {\n if (x === null) return 0;\n else return x.size;\n }", "title": "" }, { "docid": "1e7153547a720e48b9d4a4038ceef5a4", "score": "0.5426353", "text": "function draw_bullet(i){\n\tctx.drawImage(bulletImage, bullets.x[i]+25/3, bullets.y[i]- 357/8, 25/2, 357/8);\n}", "title": "" }, { "docid": "6f995627b5d15f84d5a2b77c06e24391", "score": "0.54254013", "text": "function PtSize(elt)\n{\n\treturn new Point(elt.offsetWidth, elt.offsetHeight);\n}", "title": "" }, { "docid": "3fbcac4c54fcba4fd5399b23bcb9f4e9", "score": "0.5420758", "text": "get length()\n {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }", "title": "" }, { "docid": "9f4e95056b17893375988815c47cda69", "score": "0.541552", "text": "function createBullets() {\n var bullet= createSprite(100, 100, 60, 10);\n bullet.addImage(bulletImg);\n bullet.x = 360;\n bullet.y=gun.y;\n bullet.velocityX = 4;\n bullet.lifetime = 100;\n bullet.scale = 0.1;\n bulletsGroup.add(bullet);\n \n}", "title": "" }, { "docid": "13fbd1b827c13fac028c229c4d7195c2", "score": "0.5413014", "text": "getStemLength() {\n return _stem__WEBPACK_IMPORTED_MODULE_2__[\"Stem\"].HEIGHT + this.getStemExtension();\n }", "title": "" }, { "docid": "91a9ab9a34be1aa2d246eb3ce45a8179", "score": "0.54101425", "text": "function dimensionCalc() {\n if (width > height) {\n vMax = width / 100;\n vMin = height / 100;\n circleRad = height * 0.45;\n } else {\n vMax = height / 100;\n vMin = width / 100;\n circleRad = width * 0.45;\n }\n}", "title": "" }, { "docid": "74ca920745e57e4704f6d71c7efb49d5", "score": "0.5406084", "text": "getWidth() {\n return (this.width)\n }", "title": "" }, { "docid": "3923269614d102078fa6fab1e1079e4b", "score": "0.54040956", "text": "length() {\n const x = this.x\n const y = this.y\n\n return Math.sqrt(x * x + y * y)\n }", "title": "" }, { "docid": "5463e6dd1269caeadb5fdbe43db24376", "score": "0.5404011", "text": "get length()\n\t\t{\n\t\t\treturn Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n\t\t}", "title": "" }, { "docid": "622db2a61af2ce98303e239cde9563ff", "score": "0.5401997", "text": "width(dimension) {\n dimension = dimension || Width.Default;\n switch (dimension) {\n case Width.Inner:\n case Width.Outer:\n return this._width;\n default:\n return this._width - this.settings.stagePadding * 2 + this.settings.margin;\n }\n }", "title": "" }, { "docid": "b460a9728f0ea066f6fcdb003e54d781", "score": "0.5400089", "text": "function getProjectileWidth(projectile){\n if(projectile==\"magic missle\"){\n return 8;\n }\n else if(projectile==\"staff hit\"){\n return 20;\n }\n else if(projectile==\"bomb\"){\n return 20;\n }\n else if(projectile==\"fire ball\"){\n return 12;\n }\n else{\n return 0;\n }\n}", "title": "" }, { "docid": "66b4ed1e22eab18a985d2658f8d12b5f", "score": "0.53917944", "text": "get_width() {\n return this.#width\n }", "title": "" }, { "docid": "3f80064a9fb1a57890214905258f5ccc", "score": "0.5391563", "text": "function GetItemRectSize(out = new ImVec2()) {\n return bind.GetItemRectSize(out);\n}", "title": "" }, { "docid": "5ef0ae772a1cac108d5ccee7876d23a5", "score": "0.5384891", "text": "getWidth() {\n return this.$node.innerWidth();\n }", "title": "" }, { "docid": "685d5522b2557dbb11e56d9a23951d56", "score": "0.5377164", "text": "function Bullet(x, y, direction) {\n this.x = x;\n this.y = y;\n this.dir = direction;\n}", "title": "" }, { "docid": "a68c830470930833d4d5c3e9a3f29a45", "score": "0.5376921", "text": "function getElementSize(elem) \n{\n return { width:elem.offsetWidth, height:elem.offsetHeight };\n}", "title": "" }, { "docid": "ee21835fea8884603ec5bcd8b7f00650", "score": "0.53730464", "text": "get length() {\n \treturn Math.sqrt((this.x * this.x + this.y * this.y));\n }", "title": "" }, { "docid": "8bdb9893e6b686e8304a17fd431a1968", "score": "0.5370377", "text": "getWidth() {\n return this.canvas.width;\n }", "title": "" }, { "docid": "7129585ff3c32f0fbbc3e5ae3af4d3c8", "score": "0.53655285", "text": "function getDimensions(node) {\n\treturn node.getBoundingClientRect();\n}", "title": "" }, { "docid": "5310a222fd0db1c779db7080ad86c352", "score": "0.535778", "text": "get size() {\n if(this.hasAttribute('size')) {\n return +this.getAttribute('size');\n } else {\n return 100;\n }\n }", "title": "" }, { "docid": "477e73715d4c27284afa84e8d82c55b8", "score": "0.53515404", "text": "getShelfDepth() { return this.shelf_base_face_dimensions_axes[2]; }", "title": "" }, { "docid": "38c108271bbae9154c37ed9bd8875e3d", "score": "0.5348165", "text": "width(){return this.view.size.w;}", "title": "" }, { "docid": "e1772dee69f835d20639e92db418a371", "score": "0.5337441", "text": "get length() {\n\t \t\t\treturn Math.sqrt(this.x * this.x + this.y * this.y);\n\t \t\t\t// The length of a vector is the square root of the sum of the squares of the horizontal and vertical components.\n\t \t\t\t// The Math.sqrt() function returns the square root of a number,\n\t \t\t\t// in our case Math.sqrt returns √(x² + y²)\n\t \t\t}", "title": "" }, { "docid": "a35c65722a33454381ec00cb1ad84ddd", "score": "0.53317946", "text": "function specifiedSize(definition) {\n if (definition.nodeType === \"YulTypedName\") {\n return 32; //for handling Yul variables\n }\n let specified = typeIdentifier(definition).match(/t_[a-z]+([0-9]+)/);\n if (!specified) {\n return null;\n }\n let num = parseInt(specified[1]);\n switch (typeClass(definition)) {\n case \"int\":\n case \"uint\":\n case \"fixed\":\n case \"ufixed\":\n return num / 8;\n case \"bytes\":\n return num;\n default:\n debug(\"Unknown type for size specification: %s\", typeIdentifier(definition));\n }\n}", "title": "" }, { "docid": "72b651a5e6c15d60ad2edd2edeb48174", "score": "0.53317386", "text": "get lengthSqr()\n\t\t{\n\t\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\t\t}", "title": "" }, { "docid": "efe26950b2900c110a775c9d482baecb", "score": "0.53298575", "text": "get scale() {\n return (this.width - (2 * this.padding)) / this.maxLength;\n }", "title": "" }, { "docid": "5b38a44e18878896ee957d5b29acba26", "score": "0.5329478", "text": "getCategoryWidth() {\r\n let iv = this.i.getCategoryWidth();\r\n return (iv);\r\n }", "title": "" }, { "docid": "cb6a1bbe838ec756b9918401629ba42d", "score": "0.5328857", "text": "getSize() {\n switch(this.geomType) {\n case 'cube':\n return this.outerGeom.parameters.width;\n case 'cylinder':\n return this.outerGeom.parameters.radiusTop;\n case 'sphere':\n return this.outerGeom.parameters.radius;\n }\n }", "title": "" }, { "docid": "31ff7088a51ad15586863c42b7dd7f94", "score": "0.5327344", "text": "get SizePixels() {\n return this.internal.SizePixels;\n }", "title": "" }, { "docid": "413ee4a41fc47423c8d61ba26684cf99", "score": "0.53240186", "text": "function getFullSize() {\n\t\t\tvar w = 0;\n\t\t\t//console.log($('li', target).length);\n\t\t\t$('li', self).each(function() {\n\t\t\t\tw += $(this)[pickli.settings.prop_outer_size](true);\n\t\t\t});\n\t\t\treturn w;\n\t\t}", "title": "" }, { "docid": "ae9df1396bd35a5b16f5f29813177eab", "score": "0.53221834", "text": "function TRectF$Width(Self$4) {\n return Self$4.Right-Self$4.Left;\n}", "title": "" } ]
97d16cad714fb964494825cceb9a758b
Handler GET pour la collection de films.
[ { "docid": "0dcad3628781f01701b5fb452088592a", "score": "0.56334925", "text": "getAll(req, res) {\n //Réponse de base\n super.createResponse(res);\n \n let offset = null;\n let limit = null;\n let fieldsParam = null;\n \n //Fields\n //Vérifie que le query d'url fields n'est pas null.\n\t if (req.query.fields) {\n\t //L'enregistre dans une variable locale.\n\t fieldsParam = req.query.fields;\n\t //Prépare la chaîne string en séparant les éléments séparé par une virgule un à un.\n\t //Enregistre la liste de string résultante.\n\t fieldsParam = super.prepareFields(fieldsParam);\n\t }\n\n //Pagination\n //Offset et limit doivent tout les deux être utilisé pour bénéficier de la pagination.\n if (req.query.offset && req.query.limit) {\n //Si la validation passe.\n if (super.validateLimitOffset(req.query.limit,req.query.offset) ){\n //Enregistre offset et limit dans des variables locales.\n offset = req.query.offset;\n limit = req.query.limit;\n }\n }\n \n //Vue désiré des commentaires des films.\n\t let viewCommentaires = 'link';\n \n //Si le query d'url expand sur commentaires est utilisé, alors on change la vue à default pour faire l'expand.\n if (req.query.expand && req.query.expand === 'commentaires') {\n viewCommentaires = 'default';\n }\n \n let filmsQuery = queries.selectFilms(limit, offset);\n\n //Exécute la requête bd.\n connexion.query(filmsQuery, (error, rows, fields) => {\n //Dans le cas d'une erreur.\n if (error) {\n //code http 500\n res.status(500);\n let errorResponse = super.createError(500, \"Erreur Serveur\", error);\n res.send(errorResponse);\n } else {\n res.status(200);\n //Async itératif sur chaque film de la réponse bd.\n async.each(rows, function HandleFilm(film, next) {\n let uuid = film.uuid;\n //Fait le linking du film\n filmLogic.linking(film);\n //Récupère les commentaires du film avec la vue spécicié.\n commentaireLogic.retrieveView(uuid, viewCommentaires, null, null, (resultCommentaire) => {\n if (resultCommentaire.error) {\n //Gestion\n } else {\n //Rajoute la liste de commentaires au film.\n filmLogic.addCommentaires(film, resultCommentaire.commentaires);\n }\n //Sa marche pas comme sa les \"copies\"\n //TODO: Enlever sa\n let filmCopy = film;\n //Si la requête http utilise les fields\n if (fieldsParam) {\n //Applique la filtration des champs.\n filmLogic.handleFields(filmCopy, fieldsParam, (film) => {\n next();\n });\n } else {\n next();\n }\n });\n }, function SendResponse() {\n res.send(rows);\n });\n }\n });\n }", "title": "" } ]
[ { "docid": "6cc2d8153618961c122526932612c84a", "score": "0.70290476", "text": "function getFilmes(req, res, next) {\n filme.find({}).lean().exec(function (err, docs) {\n req.filmes = docs\n next()\n })\n}", "title": "" }, { "docid": "3104bca47a8e620f04ac244ed29eeec3", "score": "0.64734447", "text": "getListFilm(){\n\t\t\taxios.get('http://quicknote.bget.ru/', {\n\t\t\t\tparams:{\n\t\t\t\t\tid_user: this.userData.id,\n\t\t\t\t\ttype: \"serial\",\n\t\t\t\t\taction: 'getListFilm'\n\t\t\t\t}\n\t\t\t}).then(response => {\n\t\t\t\tlet request = response.data;\n\t\t\t\tapp.films = request.list;\n\t\t\t\tthis.htmlRequest = response.data.info;\n\t\t\t}).catch(error => {\t\t\t\t\t\n\t\t\t\tconsole.log(error);\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "a0642ecea7b779f9458929d515de0b62", "score": "0.594942", "text": "function getFilms(response) {\n\n var allFilms = response.films,\n ulEpisodes = document.getElementsByClassName('episodes')[0];;\n\n for (var i = 0; i < allFilms.length; i++) {\n\n spinnerShow();\n\n fetch(allFilms[i]\n ).then(function (response) {\n\n return response.json();\n\n }).then(function (response) {\n\n var li = document.createElement('li');\n li.textContent = 'Episode ' + response.episode_id + ': ' + response.title;\n ulEpisodes.appendChild(li);\n spinnerHide();\n\n })\n }\n }", "title": "" }, { "docid": "f0dc22dfafba0c9effd88a87f9b3ea40", "score": "0.5932322", "text": "function recup_liste_films_en_salle(){\n\tvar allocine_api = \"http://api.allocine.fr/rest/v3/movielist?partner=\"+key_allocine+\"&filter=nowshowing&format=json&order=datedesc\";\n\t$.getJSON(allocine_api, recup_liste);\n}", "title": "" }, { "docid": "dbbc52c32a4109bbcd21ac175028da1c", "score": "0.59295756", "text": "function requestFilms(searchString, currentPage) {\n \n /* this block of code removes spaces replacing them with a plus */\n let filmName = searchString.split(\" \");\n filmName = searchString.toLowerCase().trim().replace(/\\s+/g, \"+\");\n currentTitle = filmName;\n let pageParam = \"\";\n if (currentPage) {\n pageParam = `&page=${currentPage}`;\n }\n let url = `https://www.omdbapi.com/?apiKey=${apiKey}&s=${filmName}&${pageParam}`;\n if (filmName.length < 3) {\n url = `https://www.omdbapi.com/?apiKey=${apiKey}&t=${filmName}${pageParam}`;\n }\n console.log(url);\n /* Server request and display films */\n fetch(url)\n .then(request => request.json())\n .then(json => {\n processBodyResponse(json, currentPage);\n })\n}", "title": "" }, { "docid": "e0eb0bd61678ef7406935b2d5aed2f50", "score": "0.5910364", "text": "function handleGetMovies(req,res) {\n let response = MOVIES.movies;\n const name = req.query.title;\n const genre = req.query.genre;\n const country = req.query.country;\n const rating = req.query.rating;\n\n if (name) {\n response = response.filter(film => {\n return film.film_title.toLowerCase().includes(name.toLowerCase());\n });\n }\n if (genre) {\n response = response.filter(film => {\n return film.genre.toLowerCase().includes(genre.toLowerCase());\n });\n }\n if (country) {\n response = response.filter(film => {\n return film.country.toLowerCase().includes(country.toLowerCase());\n });\n }\n if (rating) {\n response = response.filter(film => {\n return film.avg_vote >= parseInt(rating);\n });\n }\n\n res.send(response);\n}", "title": "" }, { "docid": "c6388d73147c33a14e202d84b4eeddaa", "score": "0.58961767", "text": "function filmsShow(req, res){\n Film\n .findById(req.params.id) // This is only usable because we have the body-parser\n .populate('user reviews.user')\n .exec()\n .then(film => res.render('films/show', {film}))\n .catch(err => console.log(err));\n}", "title": "" }, { "docid": "04f79328be60ffd13a30e34f298bfd06", "score": "0.58198494", "text": "get() {\n console.clear();\n films() // getting Films by username\n .then(Films => {\n Films.forEach(el => {\n delete el._id;\n delete el.__v;\n })\n console.table(Films);\n rl.prompt();\n });\n }", "title": "" }, { "docid": "59f638f73c352a4b046544da7c602b9a", "score": "0.5767514", "text": "function getCollection(req, res, next) {\n\n req.locals.view = 'list'\n req.locals.title = req.locals.cl\n req.sreq.path('/data/' + req.locals.cl)\n\n switch(req.locals.cl) {\n\n case 'patches':\n req.sreq.query({links: [\n {from: 'users', type: 'watch', count: true},\n {from: 'messages', type: 'content', count: true},\n ]})\n break\n\n case 'users':\n req.sreq.query({links: [\n {to: 'patches', type: 'watch', count: 1,},\n {to: 'patches', type: 'create', count: 1,},\n {to: 'patches', type: 'like', count: 1,},\n ]})\n break\n\n case 'places':\n req.sreq.query({links: [\n {to: 'patches', type: 'poximity', count: true},\n ]})\n break\n\n case 'beacons':\n req.sreq.query({links: [\n {to: 'patches', type: 'poximity', count: true},\n ]})\n break\n }\n utils.renderData(req, res, next)\n}", "title": "" }, { "docid": "218b77f206a8849f4cb78d93b50d095f", "score": "0.5751821", "text": "get(req, res) {\n //Réponse de base\n super.createResponse(res);\n \n\t let fields = null;\n\t \n\t //Fields\n\t if (req.query.fields) {\n\t //Prépare la chaîne string en séparant les éléments séparé par une virgule un à un.\n\t //Enregistre la liste de string résultante.\n\t fields = req.query.fields;\n\t fields = super.prepareFields(fields);\n\t }\n\t \n\t //Vue sur les commentaires du film.\n\t let viewCommentaires = 'link';\n \n //Si la query url expand est utilisé pour le champ commentaires, alors on change la vue des commentaires à default pour faire l'expand.\n if (req.query.expand && req.query.expand === 'commentaires') {\n viewCommentaires = 'default';\n }\n \n //Récupère un objet film selon l'uuid qui est un param url.\n filmLogic.retrieve(req.params.uuidFilm, (result) => {\n if (result.error) {\n res.status(500);\n let errorResponse = super.createError(500, \"Erreur Serveur\", result.error);\n res.send(errorResponse);\n } else if (result.length === 0) {\n res.status(404);\n res.send();\n } else {\n res.status(200);\n let filmResponse = result.film;\n //Récupère les commentaires du film en appliquant la vue spécifié.\n commentaireLogic.retrieveView(req.params.uuidFilm, viewCommentaires, null, null, (resultCommentaire) => {\n if (resultCommentaire.error) {\n //Gestion\n } else {\n //Rajoute les commentaires au film.\n filmLogic.addCommentaires(filmResponse, resultCommentaire.commentaires);\n }\n //Si fields est utilisé, alors filtre les champs de l'objet film pour garder ceux demandés.\n if (fields) {\n filmLogic.handleFields(filmResponse, fields, (filmResponse) => {\n res.send(filmResponse);\n });\n } else {\n res.send(filmResponse);\n }\n });\n }\n });\n }", "title": "" }, { "docid": "e768e474b649bbb4c8dc74d9f9c2ff13", "score": "0.56565076", "text": "function getFilms(nomeFilm) {\r\n // qui viene gestita la richiesta http con l'oggetto XMLHttpRequest\r\n const xhr = new XMLHttpRequest();\r\n // nell'onreadystatechange gestiamo i vari step della richiesta\r\n xhr.onreadystatechange = function() {\r\n if (xhr.readyState == 4) {\r\n // se lo status della richiesta è 200 OK\r\n if (xhr.status == 200) {\r\n let response = JSON.parse(xhr.responseText);\r\n creaListaFilm(response.Search);\r\n } else {\r\n // altrimenti se qualcosa è andato male e lo status non è 200\r\n alert(\"Errore \"+xhr.status);\r\n throw(new Error(\"Errore nella richiesta http\"));\r\n }\r\n }\r\n }\r\n \r\n xhr.open('GET', `http://www.omdbapi.com/?apikey=${apikey}&s=${nomeFilm}`);\r\n \r\n xhr.send();\r\n \r\n}", "title": "" }, { "docid": "eab927549d678260d8c447ff3ab1f286", "score": "0.5646997", "text": "function list(req, res, next) {\n Movie.findAll({include:['genre', 'director', 'actors']})\n .then(objects => res.json(objects));\n}", "title": "" }, { "docid": "90fcfc65e63b194cbafa475d7eb2ad37", "score": "0.5626878", "text": "function fetchFilm(request, response, type, err, contents, ss, results)\n{\n \"use strict\";\n var query = \"SELECT title FROM Film\";\n\n canons.all(query, ready);\n\n function ready(err, data)\n {\n if(err) throw err;\n addFilm(request, response, type, err, contents, ss, results, data);\n }\n}", "title": "" }, { "docid": "2436b2008efe76d6ee4ac6680928a6f1", "score": "0.56117326", "text": "function grabCategories(req, res){\n db.Item.find({category: req.params.category}, (err,docs) => {\n if (err) console.log(err);\n else {\n res.json(docs);\n }\n });\n}", "title": "" }, { "docid": "b03da15d4e1bf6922f73b765b791ca01", "score": "0.5567046", "text": "function getMovieCollectionTypes(callback) {\n fetchDataFromApi(`http://localhost:3031/genres`, callback);\n //fetchDataFromApi('https://api.themoviedb.org/3/genre/movie/list?api_key=cea6ab96d4a919c98b0d4cad5404d30a&language=en-US', callback);\n}", "title": "" }, { "docid": "6116837231f67f1df0d7c7e2767ca1c1", "score": "0.5565794", "text": "index(request, response) {\n console.log(\"getting movies\");\n Movie.find({})\n .then(movies => response.json(movies))\n .catch(console.log)\n }", "title": "" }, { "docid": "e55c93a8a3a1eca12917b63fac11a15e", "score": "0.5543234", "text": "function getFilmById(id) {\n // TODO: send ajax and return promise with film data\n}", "title": "" }, { "docid": "b5e2521bc5b148c313fddedf86cf33d2", "score": "0.5539226", "text": "function getFruits(req, res) {\n let query = Fruit.find({});\n query.exec((err, fruits) => {\n if(err) return res.send(err);\n res.json({ message:\"List of all items\", fruits});\n });\n}", "title": "" }, { "docid": "ec68fb59d2cabd561d0259b03c86e16c", "score": "0.5532919", "text": "static async findAll (req, res, next) {\n try {\n const movies = await Movie.find()\n res.status(200).json(movies)\n } catch (error) {\n next(error)\n }\n }", "title": "" }, { "docid": "7f57ff1b6b4a61a9893f4f10f99c387f", "score": "0.5531733", "text": "getAll(req, res) {\n Frolicks.find((err, allFrolicks)=>{\n let tags = collectTags(allFrolicks);\n res.send({\n frolicks: allFrolicks,\n tags\n });\n })\n }", "title": "" }, { "docid": "9cc019ac81e37805ebb40272ad8b719f", "score": "0.5522096", "text": "getAll(page = 0){ // default page 0\n return axios.get(`http://guarded-savannah-47368.herokuapp.com/api/v1/movies?page=${page}`)\n }", "title": "" }, { "docid": "77f1c0e387f65c1c12cea4d5494676bd", "score": "0.5451019", "text": "function getMedicines (req, res) {\n utils.checkRole(req, res, ['admin', 'doctor']);\n var filterField = req.query.filters;\n if (filterField) {\n filterField = filterField.split(',').join(' ');\n }\n else {\n filterField = '';\n }\n if (req.query.search) {\n Medicine.find({\n $or: [\n {\n name: {\n $regex: req.query.search,\n $options: 'i'\n }\n }\n ]\n })\n .select(filterField)\n .then(\n function (results) {\n res.json({\n success: true,\n data: results\n });\n },\n function (error) {\n console.log(error);\n res.status(500).send({\n success: false,\n message: error,\n clientMessage: 'Cannot get medicine data.'\n });\n }\n );\n }\n else {\n Medicine.find().select(filterField).limit(10).then(\n function (results) {\n res.json({\n success: true,\n limit: 10,\n data: results\n });\n },\n function (error) {\n console.log(error);\n res.status(500).send({\n success: false,\n message: error,\n clientMessage: 'Cannot get medicine data.'\n });\n }\n );\n }\n }", "title": "" }, { "docid": "d747317a6584fc555bbfde791cc907ef", "score": "0.54410064", "text": "static getList() {\n return fetch(url + '/documents', {})\n .then(response => {\n return response.json()\n });\n }", "title": "" }, { "docid": "d9ae7acc0958f03bda0c864aec3e8bb2", "score": "0.5433309", "text": "function fetchMovies(){\n Files.fetchMovies((data)=>{\n var movies=JSON.parse(data).movies\n addMovies(movies)\n })\n}", "title": "" }, { "docid": "b962ac83a4a94a5ba33ba857e6c19cc1", "score": "0.5411901", "text": "function getMovies (req, res) {\n\t//Request the collection\n\trequest(\"http://api.usergrid.com/leikamt/sandbox/movies\", function (err, response, body) {\n\t\tif (err) {\n\t\t\tres.send(err);\n\t\t}\n\t\telse {\n\t\t\t//Parse the data returned into easy to read json\n\t\t\tbody = JSON.parse(body);\n\t\t\tbody = body.entities;\n\t\t\t\n\t\t\t//Will be used to extract just the title, release date, and actor array\n\t\t\tvar movie_list = [];\n\t\t\tvar movie = {};\n\t\t\t\n\t\t\tfor(i = 0; i < body.length; i++) {\n\t\t\t\t//Create a new JSON for the movie in body, and get its title, release date, and actor array\n\t\t\t\tmovie = {uuid:body[i].uuid, title:body[i].title, releaseDate:body[i].releaseDate, actors:body[i].actors};\n\t\t\t\t\n\t\t\t\t//Push the new movie JSON into an array that will be returned\n\t\t\t\tmovie_list.push(movie);\n\t\t\t}\n\t\t\t\n\t\t\t//Return the movie array that contains only titles, release dates, and actors\n\t\t\tres.send(movie_list);\n\t\t}\n\t});\n}", "title": "" }, { "docid": "e6f80bda7d527c6f3e13d199e61a2dfd", "score": "0.5406622", "text": "async function fetchMovies() {\n\tconst response = await fetch('https://ghibliapi.herokuapp.com/films', {\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t},\n\t});\n const data = await response.json();\n return data;\n}", "title": "" }, { "docid": "f35e748be72205208bd79b6453c0fbf6", "score": "0.54033506", "text": "function ajax(films, url) {\r\n $.ajax({\r\n 'url': url,\r\n 'method': 'GET',\r\n 'data': {\r\n 'api_key': '64a2fd972ada97403c0291bfb662a850',\r\n 'query': films ,\r\n 'language': 'it'\r\n },\r\n 'success': function(data) {\r\n display_movies(data.results);\r\n },\r\n 'error': function() {\r\n alert('errore');\r\n }\r\n });\r\n}", "title": "" }, { "docid": "7d8a0eab17898a62625f86a32f8f1423", "score": "0.53746456", "text": "function getFavoritos(req, res) {\n // Favorito.find({}, (err, favoritos) => {\n Favorito.find({}).sort(\"-title\").exec((err, favoritos) => { //por title descendente....\n if (err) {\n res.status(500).send({ message: \"Ha ocurrido un error al intentar obtener un favorito.\" });\n } else {\n if (!favoritos) {\n res.status(404).send({ message: \"No hay favoritos.\" });\n } else {\n res.status(200).send({ favoritos: favoritos });\n }\n }\n });\n}", "title": "" }, { "docid": "edc511f09410ec3f6ce8b4f73f46cc5e", "score": "0.53641504", "text": "function getMovies() {\n $.get(\"/api/movies\", function(data) {\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createMovieRow(data[i]));\n }\n renderMovieList(rowsToAdd);\n nameInput.val(\"\");\n });\n }", "title": "" }, { "docid": "b9fdee28957936fa690d98fb54c32c28", "score": "0.53574175", "text": "function list(req, res, next){\n const { limit = 50, skip = 0} = req.query;\n Card.list({limit, skip})\n .then((cards) => res.json(cards))\n .error((e) => next(e));\n}", "title": "" }, { "docid": "5ee58fc7a4d191d23e806cdb6cd50fe8", "score": "0.5314215", "text": "function review_list(req, res, next) {\n console.log('List of reviews');\n\n Reviews.find({})\n .then(reviews => {\n res.send(reviews);\n })\n .catch(error => next(error));\n}", "title": "" }, { "docid": "75de6fcfe5363395930284b52aafeb40", "score": "0.5310224", "text": "getlist(req, res) {\n //Check model is missing or not\n if(!this.model){\n res.json({ \n code: codes.FOEBIDDEN,\n message: messages.MODEL__REQUIRED,\n });\n return;\n }\n //Query the DB and if no errors, send all the docs\n let query = this.model.find({});\n query.exec((err, docs) => {\n if(err) {\n res.json({ \n code: codes.FOEBIDDEN,\n message: messages.FOEBIDDEN_ERROR,\n error: err\n });\n return;\n }\n res.json({\n code: codes.SUCCESS,\n message: messages.FIND,\n data: docs\n });\n });\n }", "title": "" }, { "docid": "ba50bbb23663d8168dd3b2b47aeab653", "score": "0.52833444", "text": "function getFileList(req, res, arg) {\n var mediaFolderUrl = config.mediaFolder;\n //console.log(mediaFolderUrl);\n\n\n walkDir(mediaFolderUrl, function(err, results) {\n if (!err) {\n res.writeHead(200, {'content-type': 'application/json'});\n res.end(JSON.stringify( filterMediaList(results, mediaFolderUrl) ) );\n } else {\n commandError(req, res, '\"(\"');\n }\n });\n}", "title": "" }, { "docid": "5b13e006b020f81f361d3cda96678cd1", "score": "0.5283162", "text": "async show(req, res){\n const box = await Box.findById(req.params.id).populate({\n path: 'files',\n options: {sort: {createdAt: -1}}\n }); //cria uma pasta no banco\n return res.json(box); //retorna as informações da pasta para o cliente\n }", "title": "" }, { "docid": "05c73446d57517fb9aeef9e9f98c8cac", "score": "0.52764285", "text": "function listar(req, res, next){\n ModelRespuesta.find()\n .select()\n .exec((err, items) =>{\n if(err || !items){\n return errorHandler(items, next, err);\n }\n\n return res.json({\n items : items\n })\n });\n}", "title": "" }, { "docid": "89839bc75700f28f5b0e594c81df2dd6", "score": "0.52726996", "text": "function getFavourList(req, res, next) {\r\n favourList.get(req.params.id, function (err, body) {//query by favourite recipe id\r\n if (!err) {//query success\r\n res.json({\"result\": true, \"count\": 1, \"favourList\": body});//body is the result data\r\n } else {//query failed\r\n console.log(err)\r\n res.json({\"result\": false, \"count\": 0, \"favourList\": []});\r\n }\r\n res.send();\r\n res.end();\r\n });\r\n}", "title": "" }, { "docid": "a55ff8aae4c2d74eb47e879606a24c59", "score": "0.5256374", "text": "function GetAlbumPhotos(req, res) {\n\tvar album = albums[req.aID];\n\tif (album != undefined && album.status != \"Deactive\") {\n\t\tres.json(album.photos);\n\t} \n\telse {\n\t\tres.status(404).send(\"Album \" + req.aID + \" not found.\");\n\t}\n}", "title": "" }, { "docid": "88f8f1abcc3ab09c77e763373fe06eb1", "score": "0.525218", "text": "function getCatList(req, res) {\n catModel.getAllCats(function(error, results) {\n res.json(results);\n });\n}", "title": "" }, { "docid": "cab8f4b18a3c83a30f41b627995a3da7", "score": "0.52382886", "text": "function getMovieFavorites() {\n return fetch(\"/favorites\")\n .then((res) => { return res.json(); });\n}", "title": "" }, { "docid": "911ac9b6216e1c3f078a34e9d52422b6", "score": "0.5234997", "text": "discoverMovies (page = 1) {\n const url = this.createUrl('/discover/movie', 'sort_by=popularity.desc&page=' + page)\n return vue.$http.get(url)\n }", "title": "" }, { "docid": "0091139bc11c87a23cee0d2b75af3fbc", "score": "0.5229215", "text": "function findall() {\n\t\t\tapiService.get('category')\n\t\t\t\t.then((data) => {\n\t\t\t\t\tvm.datas = data;\n\t\t\t\t\tconsole.log(data);\n\t\t\t\t})\n\t\t\t\t.catch((err) => {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t});\n\t\t}", "title": "" }, { "docid": "b199c365afcc7cc039b97ca91dea719d", "score": "0.5224664", "text": "list(request, response, next) {\n LinkModel.find(\n (error, links) => {\n response.json({links});\n }\n );\n }", "title": "" }, { "docid": "19780e9c516511ced5dba3f654bc94d9", "score": "0.5222932", "text": "function get (req, res) {\n let types_bikes = [];\n firestoreDb.collection('bikes_types').get()\n .then((snapshot) => {\n snapshot.forEach((doc) => {\n types_bikes.push(doc.data());\n });\n send(res, 200, types_bikes)\n })\n .catch(error => {\n console.error('[Firestore Error]', error)\n send(res, 500, {\n message: error,\n status: 1\n })\n });\n}", "title": "" }, { "docid": "39bcd2faaa3e8bc254f93835f78e41a8", "score": "0.5217831", "text": "function chiamata_api_film(query_ricerca){\n $.ajax({\n \"url\": api_url_base + \"search/movie\",\n \"data\":{\n \"api_key\": api_key,\n \"query\": query_ricerca,\n \"language\": \"it-IT\"\n },\n \"method\": \"get\",\n \"success\": function(data) {\n var film = data.results;\n // chiamo funzione per stampare i risultati\n cicla_stampa(film);\n $(\"#sezione-film\").addClass(\"visibile\");\n },\n \"error\": function(){\n alert(\"errore\");\n }\n });\n }", "title": "" }, { "docid": "03547351958ac127c41b6fd20a19c7fe", "score": "0.5208265", "text": "static get(req, res) {\n const albumId = parseInt(req.params.id)\n const requestedAlbum = albums.find(album => album.id === albumId)\n if (!requestedAlbum) {\n res.status(404).send('album is not found')\n return;\n }\n res.send(requestedAlbum)\n }", "title": "" }, { "docid": "08d9467de8b5e3c9413db3ce5197d134", "score": "0.52067125", "text": "function recup_liste(recup_movie){\n\t// If there are results...\n\tif (recup_movie.feed.totalResults > 0) {\n\t\t\n\t\t// Round up the number of pages\n\t\tnb_pages = Math.ceil(recup_movie.feed.totalResults/10);\n\t\tlastRelease = recup_movie.feed.movie[0].release.releaseDate;\n\t\t\n\t\t// Call the Allocine API as long as there is page's result\n\t\tfor(var j=1; j<= nb_pages; j++){\t\n\t\t\tvar allocine_api_page = \"http://api.allocine.fr/rest/v3/movielist?partner=\"+key_allocine+\"&filter=nowshowing&order=datedesc&format=json&page=\"+j;\n\t\t\t$.getJSON(allocine_api_page, recup_liste_films);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f1683c5938bbfd077a2dfaf141c5501", "score": "0.5206095", "text": "function httpGet(req, res){\n\t\tif (req.params.id != undefined){\n\t\t\treturn findById(req, res);\n\t\t}else{\n\t\t\treturn list(req, res);\n\t\t}\n\t}", "title": "" }, { "docid": "7388330876e624328e46b205668c76c8", "score": "0.52037203", "text": "function results(req, res) {\n db.collection('filters').find(new ObjectID(slug(req.params.id))).toArray(done)\n function done(err, data) {\n if (err) throw err;\n console.log(data);\n res.render('result.ejs', {id: req.params.id, data: data[0]})\n }\n}", "title": "" }, { "docid": "1144dca0b5aa70b68fdc3d6df4351d58", "score": "0.51960075", "text": "function getMovieent(request,response){\r\n var client = requestJson.createClient(url);\r\n const queryName='q={\"idcuenta\":\"'+request.params.id+'\"}&';\r\n client.get(config.mlab_collection_movieent+'?'+queryName+config.mlab_key, function(err, res, body) {\r\n var respuesta=body[0];\r\n response.send(respuesta);\r\n });\r\n}", "title": "" }, { "docid": "ab6171ca9cff5f35651c16959baea5b3", "score": "0.5186971", "text": "async fetchResource({commit, getters}, {type, id = null}) {\n // check if resource already exists in the store\n // if it's already been fetched before, just commit the\n // existing data\n // edit: need to fetch root objects every time because the app\n // can mistakenly think it's fetched _all_ films even though it hasn't\n // and the key is populated \n let resource = null;\n if (id && (resource = getters.getResource(type, id))) {\n commit('setResource', {type, id, resource});\n return;\n }\n \n let res;\n try {\n res = await get(`/${type}` + (id ? `/${id}` : \"\"), {promisify: true});\n } catch (err) { \n commit('addError', err);\n }\n\n // otherwise, process (unpack) the data first in a way\n // that we can store into Vuexs\n let {pages, lists} = unpackResources(res, id);\n\n // commit page data (e.g. set of details for one Film)\n // and list data (e.g. all of grouped People, Vehicles, and Planets \n // for the same Film, in terms of only their resource URL's so far\n for (id in pages) {\n let data = pages[id];\n data['lists'] = lists[id];\n data['id'] = id;\n commit('setResource', {\n type,\n id,\n resource: data,\n });\n }\n }", "title": "" }, { "docid": "fae3ff7768bace767556672c73e19738", "score": "0.51864755", "text": "function fetchList(page, filterData) {\n\t\tshowHideLoader(true);\n\t\tmovieService.fetchMovies(page, filterData)\n\t\t\t.then(handleListResponse)\n\t\t\t.catch(handleListError)\n\t\t\t.finally(function () {\n\t\t\t\tshowHideLoader(false);\n\t\t\t});\n\t}", "title": "" }, { "docid": "7b7145db3595149993fbe339419bffbc", "score": "0.5184791", "text": "async function getMovies(req, res) {\n try {\n const { title, genreMovie } = req.query;\n\n if (!title && !genreMovie) {\n const queryResponse = await db.query(\"SELECT image, title FROM movies\", {\n type: QueryTypes.SELECT,\n });\n res.json(queryResponse);\n }\n\n if (genreMovie && title) {\n let queryResponse = await db.query(\n \"SELECT image, title FROM movies WHERE genreMovie = ? AND title = ?\",\n {\n type: QueryTypes.SELECT,\n replacements: [genreMovie, title],\n }\n );\n res.json({ queryResponse });\n }\n\n // FILTER BY TITLE\n if (title && !genreMovie) {\n const movieTittle = \"%\" + title + \"%\";\n let queryResponse = await db.query(\n \"SELECT image, title FROM movies WHERE title LIKE ?\",\n {\n type: QueryTypes.SELECT,\n replacements: [movieTittle],\n }\n );\n res.json({ queryResponse });\n }\n\n // FILTER BY GENRE\n if (genreMovie && !title) {\n let queryResponse = await db.query(\n \"SELECT image, title FROM movies WHERE genreMovie = ?\",\n {\n type: QueryTypes.SELECT,\n replacements: [genreMovie],\n }\n );\n res.json({ queryResponse });\n }\n } catch (err) {\n console.error(err);\n\n res.status(500).json({\n success: false,\n error: \"Server internal error\",\n });\n }\n}", "title": "" }, { "docid": "0cb7cbe0d1dfc9f31885f368ff7eb987", "score": "0.51809597", "text": "_loadFilms() {\r\n\t\t//On lance un Vibration de 40ms\r\n\t\tVibration.vibrate(VIBRATION_DURATION);\r\n\r\n\t\tthis.setState({ isLoading: true });\r\n\r\n\t\tif (this.searchedText.length > 0) {\r\n\t\t\t//charger d'appeler l'API pour obtenir la liste de films en format JSON\r\n\t\t\tgetFilmsWithSearchedText(this.searchedText, this.page + 1).then((data) => {\r\n\t\t\t\t//On récupère la page courante et le nbre max de page\r\n\t\t\t\tthis.page = data.page;\r\n\t\t\t\tthis.totalPages = data.total_pages;\r\n\r\n\t\t\t\t//On modifie le state\r\n\t\t\t\tthis.setState({\r\n\t\t\t\t\t//On ajoute du contenue à notre tableau de films\r\n\t\t\t\t\tfilms: [ ...this.state.films, ...data.results ],\r\n\r\n\t\t\t\t\tisLoading: false\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "15815221de260c4159448c97bb2cc774", "score": "0.5180724", "text": "function showPostsByCategory(req, res, next) {\n let query = req.params.categories;\n postModel.searchGet({ categories: query , status:'accepted'})\n .then(data => {\n console.log(data);\n res.json(data);\n })\n .catch(err => next(err.message));\n}", "title": "" }, { "docid": "d72ab18695b3d9a520789b1ebcd56373", "score": "0.51770216", "text": "moviesIndex(req, res) {\n Movie.findAll({\n attributes: [\"image\", \"title\", \"creationDate\"]\n })\n .then(movies => res.status(200).json(movies))\n .catch(err => errServer(res, err))\n }", "title": "" }, { "docid": "237e9816bcab6a83de2b85ad8310f674", "score": "0.5158019", "text": "function recup_liste_films(recup_film){\n\n\t// As long as there are movies to collect...\n\tfor(k=0; k< recup_film.feed.movie.length; k++){\t\n\t\tfilm_recent++;\n\t\t\n\t\t// We put them in the array, only if we can collect the array\n\t\tif ((recup_film.feed.movie[k].defaultMedia != undefined) && (recup_film.feed.movie[k].defaultMedia.media.title != undefined)) {\n\t\t\tfilm = splitNom(recup_film.feed.movie[k].defaultMedia.media.title);\n\t\t\t\n\t\t\tcode_film = recup_film.feed.movie[k].code;\n\t\t\ttab_filmsEnSalle.push(code_film+\";\"+film);\n\t\t\t\n\t\t\t// If the movie's release is this week, we add the movie's id into the tab_thisWeeksRelease array to show 5 movies on the home page\n\t\t\tif ((!fin) && (recup_film.feed.movie[k].release.releaseDate == lastRelease)){\n\n\t\t\t\ttab_thisWeeksRelease.push(code_film+\";\"+film);\n\t\t\t} else if(tabIsOk){\n\t\t\t\ttabIsOk = false;\n\t\t\t\tshowMeFiveMovies(tab_thisWeeksRelease);\n\t\t\t\tfin = true;\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t// We put all the id of movies we couldn't collect the title into the tab_rates array in the purpose of verification\n\t\t\ttab_rates.push(recup_film.feed.movie[k].code);\n\t\t}\n\t\t\n\t}\n\n}", "title": "" }, { "docid": "c0c99207b91591420fc3355afd91d8fb", "score": "0.51437646", "text": "function GetPlastics(category){\r\n console.log(category);\r\n let dbRef = firebase.database().ref(\"materials/plastics\");\r\n dbRef.once('value', function(snap){\r\n list = snap.val();\r\n console.log(snap.val());\r\n\r\n DisplayList(list)\r\n });\r\n }", "title": "" }, { "docid": "6e1fad1e21f5091bee50eac7042a4833", "score": "0.51365477", "text": "function getChoferes (req,res){\n var page =1;\n var itemsPage=20;\n if(req.params.page){\n page=req.params.page;\n }\n Chofer.find().sort('fecha_inicio').paginate(page,itemsPage,(error,choferes,total)=>{\n if(error)return res.status(500).send({messages:'error en la peticion'});\n if(!choferes)return res.status(404).send({messages:'no se encuentra usuarios'});\n return res.status(200).send({\n choferes,\n total,\n pages:Math.ceil(total/itemsPage)\n });\n });\n}", "title": "" }, { "docid": "24fdad8d1b754d18da3b88ab7bf7eeb3", "score": "0.5125079", "text": "getMovies() {\r\n return fetch(this.baseUrl).then(res => res.json())\r\n }", "title": "" }, { "docid": "338a1778ab9abb2759e268cd981a4ae4", "score": "0.51245314", "text": "async getFavs() {\n this.getFavDevices();\n this.getFavRooms();\n this.getFavRoutines();\n }", "title": "" }, { "docid": "f5dbe33f185a1f71e87ce27d9256beed", "score": "0.51230013", "text": "function handleGetMovie(req, res){\n let response = moviedex;\n const genre = req.query.genre,\n country = req.query.country,\n vote = req.query.vote;\n \n // genre\n if(genre){\n // search for genre\n response = response.filter(movie =>{\n if(movie.genre.toLowerCase().includes(genre.toLowerCase())){\n // I tried doing it like in the example \n // but It wasnt returning anything at all\n return movie;\n }\n });\n }if(country){\n response = response.filter(movie =>{\n if(movie.country.toLowerCase().includes(country.toLowerCase())) return movie;\n });\n } if (vote) {\n let i=0;\n response = response.filter(movie => {\n if (movie.avg_vote >= Number(vote)) return movie;\n });\n }\n\n res.json(response);\n}", "title": "" }, { "docid": "d4c7f431e0008b543ab6d0fc76acf341", "score": "0.512223", "text": "fetchKittens( req, res, next){\n Cat.find({ kittens: {$size: 0 }})\n .populate(\"images\")\n .then((kittens)=>{\n res.json(kittens);\n })\n // catch any errors and call the next middleware\n .catch(next);\n }", "title": "" }, { "docid": "817fa7b35e5121f963aea0fa2d204e10", "score": "0.51200426", "text": "function movieHandler(req, res) {\n\n const url = `https://api.themoviedb.org/3/search/movie?api_key=${process.env.MOVIES_API_KEY}&language=en-US&query=${req.query.data.search_query}&page=1&include_adult=false`\n\n superagent.get(url).then(data => {\n let movieData = data.body.results.map(value => {\n return new Movies(value);\n });\n res.status(200).json(movieData);\n }).catch(error => errorHandler(error, req, res));\n}", "title": "" }, { "docid": "08d4668bdc62e40a9c7329df97d2e0cb", "score": "0.51178753", "text": "function retrieveByAlbum(req, res, next) {\n var callback = function (err, images) {\n if (err) {\n return next(err);\n }\n if (!images || !images.length) {\n return next(\"Can't find images for this album!\");\n }\n res.json(images);\n };\n\n var albumId = req.params.albumId,\n query = {uniqId: albumId};\n\n if (albumId.length == 24) {\n query = {album: albumId};\n }\n\n Gallery.find(query, callback);\n}", "title": "" }, { "docid": "23f3c746641c9d9a6ba6e90b71ca3148", "score": "0.51174855", "text": "function filterByGenre(event, content){\n event.preventDefault();\n\n let genre_id = this.hash.slice(1);\n\n fetch(`http://${Config.backend_host}/genres/${genre_id}`)\n .then(data => data.json())\n .then(movies => loadMovies(movies, content))\n .catch(error => {\n console.log(error);\n });\n}", "title": "" }, { "docid": "bee82961a69cb9ac362b96314c054132", "score": "0.5112991", "text": "async function list(req, res) {\r\n const { movieId } = req.params;\r\n const data = await service.list(movieId);\r\n res.json({ data });\r\n}", "title": "" }, { "docid": "397f001e40b70978212b5f0d5ab5fc92", "score": "0.5108385", "text": "function fetchingFiles() {\n return {\n type: FETCH_FILE_LIST\n }\n}", "title": "" }, { "docid": "09d67a2e2479d5875c8f71766c48b257", "score": "0.50921446", "text": "function listar(req, res, next) {\n ModeloActividad.find().exec((err, items) => {\n if (err || !items) return errorHandler(err, next, items);\n res.json({\n result: true,\n data: items\n });\n });\n}", "title": "" }, { "docid": "425743e126321ca324d507646c9a5b79", "score": "0.50909907", "text": "function filmsNew(req, res){\n res.render('films/new', {error: null}); // This doesn't need a slash because it automatically goes to views/films/new\n // There is an empty error object here, so it can be passed to filmsCreate\n}", "title": "" }, { "docid": "514846d79a52bdf83262c29c2c94df2b", "score": "0.50797206", "text": "function getMovies(req, res) {\r\n const url = `https://api.themoviedb.org/3/search/movie?api_key=${process.env.MOVIEDB_API_KEY}&query=${req.query.data.search_query}`;\r\n\r\n superagent.get(url).then(result => {\r\n const movieData = result.body.results.map(data => {\r\n return new Movie(data);\r\n });\r\n res.send(movieData);\r\n }).catch(error => handleError(error));\r\n}", "title": "" }, { "docid": "c29670610fc356ab527d8ee4716e72eb", "score": "0.50744855", "text": "function getMovies() {\n fetch(MOVIE_API_URL)\n .then(response => response.json())\n .then(jsonResponse => {\n setMovieList(jsonResponse.Search);\n });\n }", "title": "" }, { "docid": "9b6c24c0f14881a1783c0518ccf61039", "score": "0.5073571", "text": "function genreList(req, res, next) {\n genreService.getGenreList().then((values) => {\n res.render('./genre/genreListView', {\n title: 'Genre List',\n genre_list: values\n });\n }).catch((err) => {\n return next(err);\n });\n}", "title": "" }, { "docid": "a332b369c826b8c140a84b2afe1c9c3f", "score": "0.506047", "text": "thingsList() {\n return Thing.documents.find();\n }", "title": "" }, { "docid": "d57c6a1e74981b836c4aaa1bfb6cfeb9", "score": "0.5054722", "text": "getAll(req, res) {\n // Blank .find param gets all\n Airplane.find({})\n .then((airplanes) => res.json(airplanes))\n .catch((err) => res.status(400).json(err));\n }", "title": "" }, { "docid": "35ea9bbe91b16df0ba1335eea034bfbe", "score": "0.50536996", "text": "function getUAVs (req, res) {\r\n\tconsole.log ('GET /uavs');\r\n\tUAV.find(null, 'name _id', function(err, uavs) {\r\n\t if(err) {\r\n\t \tres.status(500).send({ message : 'Error while retrieving the uav list'});\r\n\t } else {\r\n\t\t if(!uavs) {\r\n\t\t \tres.status(404).send({ message : 'Error there are no uavs stored in the DB'});\r\n\t\t } else {\r\n\t\t\t\tres.status(200).jsonp(uavs);\r\n\t\t };\r\n\t\t};\r\n\t});\r\n}", "title": "" }, { "docid": "bbc80dbd8dce060f615b9820e7fe55aa", "score": "0.50529397", "text": "function filmsEdit(req, res) {\n Film\n .findById(req.params.id) // This is only usable because we have the body-parser\n\n // .populate('photos') // Why is this necessary here?\n .exec()\n .then(film => res.render('films/edit', {film}));\n}", "title": "" }, { "docid": "0a36095b5a8e9270ed361e4f7c839519", "score": "0.50519747", "text": "function list(req, res) {\n\t\treadFile((data) => {\n\t\t\tres.send(data);\n\t\t});\n\t}", "title": "" }, { "docid": "26298eb7d22db1cf66bb51ac45531bb8", "score": "0.50472224", "text": "changeFilterFilms() {\n\n switch (this.typeSearch) {\n case 'movies':\n this.filmsFiltered = this.filmsSearched.filter((elem) => {\n return elem.media_type == \"movie\"\n });\n break;\n\n case 'series':\n this.filmsFiltered = this.filmsSearched.filter((elem) => {\n return elem.media_type == \"tv\"\n });\n break;\n\n default:\n this.filmsFiltered = this.filmsSearched;\n }\n this.pageIndex = 0;\n this.setItemsPerPage();\n }", "title": "" }, { "docid": "1cc9e6654039ae0e448e8f6992ba1a25", "score": "0.50333023", "text": "function getMovies(page) {\n return RequestFactory.request('movie/popular', page);\n }", "title": "" }, { "docid": "579f96b385ef7cf84553dc4472126389", "score": "0.50302285", "text": "function query() {\r\n var search = $('#search').val();\r\n resetSearch();\r\n\r\n var api_key = '535029b12126fd0395272f6e0b4b8764';\r\n\r\n var url_movies = 'https://api.themoviedb.org/3/search/movie';\r\n var url_telefilms = 'https://api.themoviedb.org/3/search/tv';\r\n\r\n var typeFilms = 'films';\r\n var typeTelefilms = 'telefilms';\r\n\r\n getData(search, api_key, url_movies, typeFilms, '.list-films');\r\n getData(search, api_key, url_telefilms, typeTelefilms, '.list-telefilms');\r\n}", "title": "" }, { "docid": "3d2505abc3ec6cd22f6bb07771f79a3c", "score": "0.5028772", "text": "function showFirms()\n {\n\n db.allDocs\n (\n {\n include_docs: true,\n descending: true\n },\n function(err, doc)\n {\n redrawFirmUI(doc.rows);\n }\n );\n }", "title": "" }, { "docid": "976deeed32b0d51656ed59553fe14ea4", "score": "0.5023622", "text": "function getReaders(req, res){\n\n Reader.find({}).exec((err, items)=>{\n if(err){\n return res.status(500).send({\n ok:false,\n message: 'An error occurred while searching for the items'\n });\n }\n\n return res.status(200).send({\n ok:true,\n items\n });\n });\n}", "title": "" }, { "docid": "d049f1dd35cadb725def916896746a82", "score": "0.50177497", "text": "function getAllCats() {\n $http.get('/api/constant/getallCategory').then(function(res) {\n $scope.cats = res.data;\n })\n }", "title": "" }, { "docid": "9bb9b1fa596bb423f5de675463ce9765", "score": "0.501505", "text": "function listarTipoMuestreo(){\n $http.get('/api/tipoMuestreo').success(function(response){\n $scope.listaTipoMuestreo = response;\n });\n }", "title": "" }, { "docid": "5aeb4544b1d26e86b6b541d95c69d6e1", "score": "0.50092345", "text": "get({data, page, type} = {options}) {\n\n fetch(`https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=7b593d1a115b3d98bf97a2790a4646f6&tags=${data}&per_page=10&page=${page}&format=json&nojsoncallback=1`)\n .then(function(response) {\n return response.json();\n })\n .then(function (res) {\n photoDom.addPhotos([res, type]);\n })\n .catch(function (error) {\n console.log(error);\n });\n\n $(\"#loadIcon\").fadeOut();\n\n }", "title": "" }, { "docid": "7c686f7e40de7d45916da9fe1ad355e9", "score": "0.5009143", "text": "function list(req, res) {\n res.json({ data: dishes })\n}", "title": "" }, { "docid": "920f4b6db398ec6038ed4e4c5eaee050", "score": "0.5006495", "text": "function display_books(req,res){\n\n Book.find({},(err,books)=>{\n if(err)\n console.log(err);\n else{\n res.render('index',{books : books});\n }\n });\n}", "title": "" }, { "docid": "5e695dc3a1c7cdfe5a4a25a41725fafa", "score": "0.50046206", "text": "async function getFilm(){\n let films = await fetch(`${urlStarWars}/films/`)\n .then(res=>res.json()) //la pasa a Json\n .then(response => { //Nos traemos el Json\n console.log(response)\n for (let i=0; i<response.results.length; i++){ //creamos un bucle for para pasar por todos los titulos\n titleFilm.push(response.results[i].title)//Tenemos que para el push para incluir titulo\n yearFilm.push(response.results[i].release_date.substring(0,4)) // año pelicula\n \n } \n graphic (titleFilm,yearFilm) //\n }) \n .catch(error=>console.log(error));\n }", "title": "" }, { "docid": "01a6e53454c1715647fdbcedb371bde1", "score": "0.5003863", "text": "async function get(req,res){\n const fromUrl = req.originalUrl\n const typeModel = wichModel(res,fromUrl)\n await getRecords(res,typeModel)\n}", "title": "" }, { "docid": "29ea31c3fc0390b08812fec21d945b90", "score": "0.5003521", "text": "Next() {\n this.page ++;\n if (this.page > this.pages) {\n this.page = this.pages;\n }\n let p = this.page;\n this.Start();\n filmsList(searchUrl, p)\n }", "title": "" }, { "docid": "d6a41cf1c8e13ed4c5770306314bf85e", "score": "0.50023824", "text": "show(req, res) {\n Place.find({})\n .then((documents) => {\n res.json(documents);\n })\n .catch((err) => {\n res.json(err);\n });\n }", "title": "" }, { "docid": "40a8265bcb7957abc98402b0016df17e", "score": "0.49997094", "text": "async function getFilms() {\n console.log('Getting films...');\n try {\n const response = await fetch('https://ghibliapi.herokuapp.com/films');\n const responseData = await response.json(); // parses JSON response into native JavaScript objects\n\n responseData.forEach(movie => {\n // Create a div with a card class\n const card = document.createElement('div');\n card.setAttribute('class', 'card');\n\n // Create an h1 and set the text content to the film's title\n const h1 = document.createElement('h1');\n h1.textContent = movie.title;\n\n // Create a p and set the text content to the film's description\n const p = document.createElement('p');\n movie.description = movie.description.substring(0, 300); // Limit to 300 chars\n p.textContent = `${movie.description}...`; // End with an ellipses\n\n // Append the cards to the container element\n container.appendChild(card);\n\n // Each card will contain an h1 and a p\n card.appendChild(h1);\n card.appendChild(p);\n });\n } catch (error) {\n const errorMessage = document.createElement('marquee');\n errorMessage.textContent = `Gah, it's not working!`;\n app.appendChild(errorMessage);\n }\n}", "title": "" }, { "docid": "71f0376f08b27b0f14920e87c5277b42", "score": "0.49958205", "text": "function getMovieData(){\n movieService.getAllMovies(\n function (resp){\n $scope.movies=resp.data;\n }\n )\n }", "title": "" }, { "docid": "c2937231727dc00253b735438ff73f81", "score": "0.49940535", "text": "function filterResults(event) {\n\t//prevent form submission\n\tevent.preventDefault();\n\n\t//grab filter value\n\tconst filter = document.querySelector('input[name=\"filter\"]:checked').value;\n\n\tlet url = 'http://linserv1.cims.nyu.edu:11820/api/user_movies';\n\n\tif(filter) {\n\t\turl += '?filter=' + filter;\n\t}\n\n\t//get movie data\n\tconst req = new XMLHttpRequest();\n\treq.open('GET', url, true);\n\treq.addEventListener('load', function() {\n\t\tif(req.status >= 200 && req.status < 400) {\n\t\t\tconst movies = JSON.parse(req.responseText);\n\t\t\tlet updateList = '';\n\t\t\tconst str = movies.map(function(movie) {\n\t\t\t\tif(movie.seen === true) {\n\t\t\t\t\tlet dir = '';\n\t\t\t\t\tif(movie.director) {\n\t\t\t\t\t\tdir = ' | Director: ' + movie.director;\n\t\t\t\t\t}\n\t\t\t\t\tupdateList = `<li><s>${movie.name} <i>${movie.year}</i> | Genre: ${movie.genre}${dir}</s></li>`;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet dir = '';\n\t\t\t\t\tif(movie.director) {\n\t\t\t\t\t\tdir = ' | Director: ' + movie.director + ' ';\n\t\t\t\t\t}\n\t\t\t\t\tupdateList = `<li>${movie.name} <i>${movie.year}</i> | Genre: ${movie.genre}${dir} | Seen It? <input type=\"checkbox\" name=\"seen\" value=\"${movie.name}\"></li>`;\n\t\t\t\t}\n\t\t\t\treturn updateList;\n\t\t\t}).reduce(function(acc, el){\n\t\t\t\treturn acc+el;\n\t\t\t}, '');\n\t\t\tconst movieList = document.querySelector('#movie-list');\n\t\t\tmovieList.innerHTML = str;\n\t\t}\n\t});\n\treq.addEventListener('error', function(e) {\n\t\tconst err = document.createElement('p');\n\t\terr.innerHTML = '<p style=\"color:red;\">Something went wrong, please try again</p>';\n\t\tdocument.querySelector('.main').appendChild(err);\n\t});\n\treq.send();\n}", "title": "" }, { "docid": "741a65940168e984d1be21b50bfe3cd1", "score": "0.49868953", "text": "function getUAVModels (req, res) {\r\n\tconsole.log ('GET /uavs/models');\r\n\tres.status(200).jsonp(config.uavMotionModels);\r\n}", "title": "" }, { "docid": "5848a5f8e4b6f1635d403a14171d9034", "score": "0.4984461", "text": "function getCat(req, res) {\n var id = req.query.id;\n catModel.getCatById(id, function(error, results) {\n res.json(results);\n });\n}", "title": "" }, { "docid": "44ec2289478a16201ad84a4fd8b3733e", "score": "0.49826196", "text": "function moviesList () {\n\n let def = Q.defer();\n\t\n Film.find({}).exec()\n .then((movies) => def.resolve(movies))\n .catch((err) => def.reject(err));\n\n return def.promise;\n\n}", "title": "" }, { "docid": "6d38f43a257de32e2ef3c0b552d5d8ca", "score": "0.4978699", "text": "function getfilemeta() {\n\n\tconst requestOptions = {\n\t\tmethod: 'POST',\n\t\theaders: { 'Content-Type': 'application/x-www-form-urlencoded' },\n\t\tbody: 'action=getfilemeta',\n\t};\n\tfetch('api/index.php', requestOptions)\n\t.then(async response => {\n\t\tconst data = await response.json();\n\n\t\tlet file_meta_markup = '';\n\n\t\tfor (var key in data) {\n\t\t\tif (data.hasOwnProperty(key)) {\n\t\t\t\tfile_meta_markup += '<h4><a href=\"records/' + key + '\">' + key + '</a></h4>' + '<p style=\"margin-left:3em;\"><i>' + data[key] + '</i></p><br />';\n\t\t\t}\n\t\t}\n\n\t\tdocument.getElementById('searchable_documents_list').innerHTML = file_meta_markup;\n\n\t})\n\t.catch(error => {\n\t\tconsole.error(error);\n\t});\n\n}", "title": "" }, { "docid": "20734417938e42ebe9842351e9c11ea4", "score": "0.49740905", "text": "function list (req, res) {\n res.status(200).json({ data: dishes });\n}", "title": "" }, { "docid": "40a318e686b625e8ad25aaca70e5ab2a", "score": "0.49733782", "text": "getMovie (id) {\n const url = this.createUrl('/movie/' + id)\n return vue.$http.get(url)\n }", "title": "" } ]
f5bcc909f570130f49fdf5192f19a852
Appends children and returns the parent.
[ { "docid": "b3ba9c38810f082620dc06c81a00bce6", "score": "0.57460874", "text": "function ins (parent /* child1, child2, ...*/) {\n for (var i = 1, n = arguments.length; i < n; i++) {\n parent.appendChild(arguments[i])\n }\n\n return parent\n }", "title": "" } ]
[ { "docid": "9b6e856798deb890ecdce23157e213a2", "score": "0.61241156", "text": "setParent(parent) {\n var child, j, len, ref1, results;\n this.parent = parent;\n if (parent) {\n this.options = parent.options;\n this.stringify = parent.stringify;\n }\n ref1 = this.children;\n results = [];\n for (j = 0, len = ref1.length; j < len; j++) {\n child = ref1[j];\n results.push(child.setParent(this));\n }\n return results;\n }", "title": "" }, { "docid": "ae04620b13cd3101503905c7d098c2f8", "score": "0.6040161", "text": "function addChildren () {\n var args = _.isArray(arguments[0]) ? arguments[0] : arguments,\n self = this,\n children = [];\n _.each(args, function(child) {\n children.push(self.addChild.call(self, child));\n });\n return children;\n }", "title": "" }, { "docid": "6a441e400e307bb118bbd39bc1cd4f0c", "score": "0.591371", "text": "function append(parent, child) {\n return parent.appendChild(child);\n}", "title": "" }, { "docid": "e5347a53dd48418f3f827262b2447b98", "score": "0.5872638", "text": "children() {\n if (this.s.length > 0) {\n this.s.slice.call(this.s[0].children)\n } else {\n this.s = []\n }\n\n return this\n }", "title": "" }, { "docid": "1cf6a8e36abd47fac2246a09a68246e9", "score": "0.58712065", "text": "function append(parent, el) {\n return parent.appendChild(el);\n }", "title": "" }, { "docid": "c372a7a7c85766c1ae56871aae9ceb60", "score": "0.5855149", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i = 1, n = arguments.length; i < n; i++) {\n parent.appendChild(arguments[i])\n }\n\n return parent\n }", "title": "" }, { "docid": "1e3254449728164fc9bfcda6d3332e1b", "score": "0.58482367", "text": "function ins (parent /* child1, child2, ...*/) {\n\t for (var i = 1, n = arguments.length; i < n; i++) {\n\t parent.appendChild(arguments[i])\n\t }\n\t\n\t return parent\n\t }", "title": "" }, { "docid": "307152fa9eafc52477148efd8f245321", "score": "0.5842168", "text": "function addClonesToParent(self) {\n return self.parent.getCapability(\"composition\")\n .add(self.firstClone)\n .then(function (addedClone) {\n return self.parent.getCapability(\"persistence\").persist()\n .then(function () {\n return addedClone;\n });\n });\n }", "title": "" }, { "docid": "f974fcb7d2103121c85af0089850b7e8", "score": "0.5839849", "text": "addAllChildren() {\n this.updateAddAllChildrenEvents();\n }", "title": "" }, { "docid": "87733a7873654b399f329f491f9fe0f8", "score": "0.582978", "text": "function ins(parent /* child1, child2, ...*/) {\n\t for (var i=1, n=arguments.length; i<n; i++)\n\t parent.appendChild(arguments[i])\n\t\n\t return parent\n\t }", "title": "" }, { "docid": "9b84c699569b39d34444bc0addbbe1e2", "score": "0.5829004", "text": "function append(parent, el) {\n return parent.appendChild(el);\n}", "title": "" }, { "docid": "48fc97548a489685cc1be38dc2706acd", "score": "0.58239293", "text": "function ins (parent /* child1, child2, ...*/) {\n\t for (var i = 1, n = arguments.length; i < n; i++) {\n\t parent.appendChild(arguments[i])\n\t }\n\n\t return parent\n\t }", "title": "" }, { "docid": "c68f53bccb6ccbbe0072900aa5ca1b04", "score": "0.5808922", "text": "function ins(parent /* child1, child2, ...*/) {\r\n\t\t\tfor (var i=1, n=arguments.length; i<n; i++)\r\n\t\t\t\tparent.appendChild(arguments[i]);\r\n\r\n\t\t\treturn parent;\r\n\t\t}", "title": "" }, { "docid": "cfd1afac3e4d9a93997cf680cd461285", "score": "0.5807695", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n \n return parent\n }", "title": "" }, { "docid": "cfd1afac3e4d9a93997cf680cd461285", "score": "0.5807695", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n \n return parent\n }", "title": "" }, { "docid": "09c3d8f3e37aa857715c12b131a6bf1c", "score": "0.5788704", "text": "function multiAppend(parent, ...childs){\n childs.forEach (e => {\n parent.appendChild(e);\n })\n return parent;\n}", "title": "" }, { "docid": "e7a3994454f081744c1a36bac453b8ad", "score": "0.5783315", "text": "static addChild (parent, child) {\n if (!parent.children) { parent.children = [] }\n\n if (child.parent != parent) {\n parent.children.push(child)\n\n if (child.parent && child.parent.children) { child.parent.children = _.without(child.parent.children, child) }\n }\n child.parent = parent\n }", "title": "" }, { "docid": "16a44b2cdd4c8ac65e8c9cd548ee55bf", "score": "0.5764498", "text": "_closeParent () {\n const p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "bd35b96bd0c82930e38a716f163a3d88", "score": "0.5764273", "text": "done() {\n\t\tthis.parent.element.appendChild(this.element);\n\t\treturn this.parent;\n\t}", "title": "" }, { "docid": "7c39faf5e140b555966a31666bec600b", "score": "0.5740665", "text": "add(element, parent) {\n parent = parent || this.root;\n element.parent(parent);\n return element;\n }", "title": "" }, { "docid": "65927c0c615b185365443ceb1a52e6ff", "score": "0.57282174", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i = 1, n = arguments.length; i < n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "da96e76adacaec4600aa6dfdd23031af", "score": "0.57257074", "text": "function append(parent, element) {\n return parent.appendChild(element);\n}", "title": "" }, { "docid": "da96e76adacaec4600aa6dfdd23031af", "score": "0.57257074", "text": "function append(parent, element) {\n return parent.appendChild(element);\n}", "title": "" }, { "docid": "cf200dcb65b4cf059d580c827299310c", "score": "0.57212365", "text": "function append(parent, el) {\n return parent.appendChild(el);\n}", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "4af895d8c3967e59bdff44416d77c975", "score": "0.57195085", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++)\n parent.appendChild(arguments[i])\n\n return parent\n }", "title": "" }, { "docid": "a31535de3299dcabc8dbc3fff18a2f41", "score": "0.57155424", "text": "_closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "a31535de3299dcabc8dbc3fff18a2f41", "score": "0.57155424", "text": "_closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "a31535de3299dcabc8dbc3fff18a2f41", "score": "0.57155424", "text": "_closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "a31535de3299dcabc8dbc3fff18a2f41", "score": "0.57155424", "text": "_closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "a31535de3299dcabc8dbc3fff18a2f41", "score": "0.57155424", "text": "_closeParent () {\n var p = this._parents.pop()\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case c.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n )\n break\n case c.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length))\n break\n case c.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length))\n break\n case c.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length))\n break\n case c.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length))\n break\n case c.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length))\n break\n default:\n break\n }\n\n if (this._currentParent && this._currentParent.type === c.PARENT.TAG) {\n this._dec()\n }\n }", "title": "" }, { "docid": "4fc3e828951ba30d44ba4e5b306d87c2", "score": "0.56967586", "text": "addChild(tree) {\n this.children.push(tree);\n return this;\n }", "title": "" }, { "docid": "44068b0b7d5f3806f35b02b5a7131c7d", "score": "0.569194", "text": "function append(parent, el) {\n\treturn parent.appendChild(el)\n}", "title": "" }, { "docid": "44068b0b7d5f3806f35b02b5a7131c7d", "score": "0.569194", "text": "function append(parent, el) {\n\treturn parent.appendChild(el)\n}", "title": "" }, { "docid": "757d4da3c64976b58e69f72114f2df7d", "score": "0.56840473", "text": "function ins(parent /* child1, child2, ...*/) {\r\n for (var i=1, n=arguments.length; i<n; i++)\r\n parent.appendChild(arguments[i])\r\n\r\n return parent\r\n }", "title": "" }, { "docid": "757d4da3c64976b58e69f72114f2df7d", "score": "0.56840473", "text": "function ins(parent /* child1, child2, ...*/) {\r\n for (var i=1, n=arguments.length; i<n; i++)\r\n parent.appendChild(arguments[i])\r\n\r\n return parent\r\n }", "title": "" }, { "docid": "0e328b69f2e5fddb96b283d5eb426a10", "score": "0.5667025", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++) {\n parent.appendChild(arguments[i]);\n }\n return parent;\n }", "title": "" }, { "docid": "0e328b69f2e5fddb96b283d5eb426a10", "score": "0.5667025", "text": "function ins(parent /* child1, child2, ...*/) {\n for (var i=1, n=arguments.length; i<n; i++) {\n parent.appendChild(arguments[i]);\n }\n return parent;\n }", "title": "" }, { "docid": "dd0f4d79535a3ff8da2cca5609b1b22f", "score": "0.56321806", "text": "function append(parent,el)\n{\n\treturn parent.appendChild(el);\n}", "title": "" }, { "docid": "8c15ce39cead26865d775cf764559ab1", "score": "0.5630148", "text": "function ins(parent /* child1, child2, ...*/) {\r\n for (var i=1, n=arguments.length; i<n; i++) {\r\n parent.appendChild(arguments[i]);\r\n }\r\n return parent;\r\n }", "title": "" }, { "docid": "8c15ce39cead26865d775cf764559ab1", "score": "0.5630148", "text": "function ins(parent /* child1, child2, ...*/) {\r\n for (var i=1, n=arguments.length; i<n; i++) {\r\n parent.appendChild(arguments[i]);\r\n }\r\n return parent;\r\n }", "title": "" }, { "docid": "d14cec46af0f997252cc9e4de9a6900e", "score": "0.56221175", "text": "parent(parent) {\n if (!arguments.length) {\n return this._parent;\n }\n this._parent = parent;\n return this;\n }", "title": "" }, { "docid": "c13fb1e236b90bf57bad62270bd215e2", "score": "0.5606556", "text": "addChild(element) { this._children.push(element); return this }", "title": "" }, { "docid": "84709f6afda28b05181f9792c2f98292", "score": "0.56019473", "text": "function ins(parent /* child1, child2, ...*/) {\n\t for (var i=1, n=arguments.length; i<n; i++) {\n\t parent.appendChild(arguments[i]);\n\t }\n\t return parent;\n\t}", "title": "" }, { "docid": "5e0fbedb09436d51f2afd7c2f5c22a76", "score": "0.55978405", "text": "function ins(parent) {\n for (var i = 1, n = arguments.length; i < n; i++) parent.appendChild(arguments[i]);\n return parent;\n }", "title": "" }, { "docid": "9601f8f63bd8bb57dd151acbd122847a", "score": "0.5597344", "text": "putIn(parent){return makeInstance(parent).add(this)}", "title": "" }, { "docid": "45e09b06380ebe6963c2fb1ad2e8ea92", "score": "0.5571298", "text": "function appendChildren (parent, children) {\n function appendItem(item) {\n if (item instanceof HTMLElement) {\n parent.appendChild(item);\n } else {\n const text = document.createTextNode(String(item));\n parent.appendChild(text);\n }\n }\n\n if (Array.isArray(children)) {\n for (const child of children) {\n appendItem(child);\n }\n } else {\n appendItem(children);\n }\n}", "title": "" }, { "docid": "e88f14db6518d7655d16e8e3d4eebbc5", "score": "0.55711", "text": "get children() { throw new Error(\"Mixin: ParentNode not implemented.\"); }", "title": "" }, { "docid": "47aef56a7010b6ae44a68bf13a277a01", "score": "0.5561813", "text": "function noopAdd(node, parent) {\n if (parent) {\n parent.children.push(node)\n }\n\n return node\n}", "title": "" }, { "docid": "3c5f3734b43fb2d5d5c2ced1781b3ed0", "score": "0.5549778", "text": "parent() {\n return super.parent();\n }", "title": "" }, { "docid": "89d9fd2dd56e254e649830df6b1b25a0", "score": "0.554804", "text": "function appendChildren(el) {\n while(el.childNodes.length)\n this.append(el.childNodes[0]);\n}", "title": "" }, { "docid": "b7b3d3e973835c115ad712f426ab560c", "score": "0.5539351", "text": "addAnyChild(t) {\n if (!this.children) {\n this.children = [t];\n }\n else {\n this.children.push(t);\n }\n return t;\n }", "title": "" }, { "docid": "b7b3d3e973835c115ad712f426ab560c", "score": "0.5539351", "text": "addAnyChild(t) {\n if (!this.children) {\n this.children = [t];\n }\n else {\n this.children.push(t);\n }\n return t;\n }", "title": "" }, { "docid": "24157b4b5847de7df67e70436bedcae2", "score": "0.55216986", "text": "function append(parent, el) {\n return parent.appendChild(el); // Append the second parameter(element) to the first one\n }", "title": "" }, { "docid": "318e194e1a9856a8dd24c4e232c4c718", "score": "0.5495432", "text": "function addChild(parent, child) {\r\n return parent.appendChild(child)\r\n}", "title": "" }, { "docid": "a8f94ce5b459ba7c9de39b96ba65794d", "score": "0.54935396", "text": "async create() {\n var data = await canvas.post(this.getPath(false), this.getPostbody());\n this.setData(data);\n // update our children so they know their parent's id\n this.getSubs().forEach(sub => {\n if (sub.ids[sub.ids.length - 1] != this._id) {\n sub.ids.push(this._id);\n }\n });\n this.send('create');\n return this;\n }", "title": "" }, { "docid": "81cbe7c06185a706866466ea628a4c3d", "score": "0.5485106", "text": "addAnyChild(t) {\r\n if (!this.children) {\r\n this.children = [t];\r\n }\r\n else {\r\n this.children.push(t);\r\n }\r\n return t;\r\n }", "title": "" }, { "docid": "e250184084e5071dd67d56155780add9", "score": "0.54796076", "text": "function getChildren() {\n return [].concat(getHeadChildren()).concat(getBodyChildren());\n}", "title": "" }, { "docid": "697c1ed707e65f71d5c0278ed896f683", "score": "0.54591733", "text": "function ac(parent, child)\n{\n parent.appendChild(child);\n return child;\n}", "title": "" }, { "docid": "e7e93476ca9d1d14f471fb9783283f82", "score": "0.5457694", "text": "addTo(parent){return makeInstance(parent).put(this)}", "title": "" }, { "docid": "5cf781d308dc73c6cea9d44e0a3ad155", "score": "0.5434613", "text": "parent() {\n if (this.segments.length === 0) {\n return null;\n }\n return this.construct(this.segments.slice(0, this.segments.length - 1));\n }", "title": "" }, { "docid": "00b6845c4cf21f9872f88f72d8e3c010", "score": "0.54282707", "text": "addTo(parent, i) {\n return makeInstance(parent).put(this, i);\n }", "title": "" }, { "docid": "61198a0e3d02ca7aebe3d65db3997997", "score": "0.5385932", "text": "get children() {\n return this._children();\n }", "title": "" }, { "docid": "8dc108873943775e5c67962e749c72e1", "score": "0.53828424", "text": "function concatenateFactory() {\n var queue = []\n\n concatenate.done = done\n\n return concatenate\n\n // Gather a parent if not already gathered.\n function concatenate(node, index, parent) {\n if (parent && parent.type !== 'WordNode' && queue.indexOf(parent) === -1) {\n queue.push(parent)\n }\n }\n\n // Patch all words in `parent`.\n function one(node) {\n var children = node.children\n var length = children.length\n var polarity = 0\n var index = -1\n var child\n var hasNegation\n\n while (++index < length) {\n child = children[index]\n\n if (child.data && child.data.polarity) {\n polarity += (hasNegation ? -1 : 1) * child.data.polarity\n }\n\n // If the value is a word, remove any present negation. Otherwise, add\n // negation if the node contains it.\n if (child.type === 'WordNode') {\n if (hasNegation) {\n hasNegation = false\n } else if (isNegation(child)) {\n hasNegation = true\n }\n }\n }\n\n patch(node, polarity)\n }\n\n // Patch all parents.\n function done() {\n var length = queue.length\n var index = -1\n\n queue.reverse()\n\n while (++index < length) {\n one(queue[index])\n }\n }\n}", "title": "" }, { "docid": "936875a4aaf476b73f6045e933247156", "score": "0.5368534", "text": "bringToFront() {\n let parent = this.parent;\n if (parent) {\n for (let i = 0; i < parent.children.length; i++) {\n if (parent.children[i] === this) {\n parent.children.splice(i, 1);\n break;\n }\n }\n parent.children.push(this);\n }\n }", "title": "" }, { "docid": "f53b871c058f35de08112186b9bb300b", "score": "0.53645986", "text": "GetChildren() {\n return this.children || [];\n }", "title": "" }, { "docid": "2919c87f5fd73c0c042a0e21903c7c4f", "score": "0.5352624", "text": "append(content) {\n this.each(ele=> {\n ele.appendChild(content[0]);\n });\n return this;\n }", "title": "" }, { "docid": "1e7fdd845f0c19f71a8aaa467a3138c0", "score": "0.5352122", "text": "function addChildren(){\n //firstly we want to get a parent, like the parent use an id\n //we use it when we look for it\n const parent = document.getElementById(\"parent-div\");\n //like we want to create a new children and to do it we need the name of the tag\n //that's why we use a div\n const newChildren = document.createElement(\"div\");\n //once I have this I need to put a style on it\n newChildren.classList.add(\"children\");\n //??\n parent.appendChild(newChildren);\n }", "title": "" }, { "docid": "5ca8c31706a15c9a4dd4cef29fbf839b", "score": "0.5347748", "text": "add(obj) {\n this.children.push(obj)\n obj.parent = this\n }", "title": "" }, { "docid": "0a0bbcc55470820f1eadf0f79b912543", "score": "0.53364015", "text": "function appendToScopeParent() {\n var parent = this.owner.getScopeParent();\n if (parent) parent.el.appendChild(this.owner.el);\n}", "title": "" }, { "docid": "bb80ac87ef7212f33adaa69668f2ddab", "score": "0.53320897", "text": "function appendChild(parent, childrens) {\n\n\t if (childrens.length === undefined) childrens = [childrens];\n\n\t var docFrag = document.createDocumentFragment();\n\n\t for (var i = 0, ln = childrens.length; i < ln; i++) {\n\t docFrag.appendChild(childrens[i]);\n\t }\n\n\t parent.appendChild(docFrag);\n\t}", "title": "" }, { "docid": "4a52d4d82c7c3d4a31f6ad936a943094", "score": "0.53057444", "text": "parent() {\n if (this.s.length > 0) {\n this.s = this.s[0].parentNode\n }\n\n return this\n }", "title": "" }, { "docid": "32c68cba18ea32660ea7bda7e097d694", "score": "0.5282677", "text": "_addAllChildren() {\n // to be overridden by plugins\n }", "title": "" }, { "docid": "b8776c01fcdd2536e8d9d865117216fa", "score": "0.52691936", "text": "getChildren() {\n return Elem.wrapElems(this.html.children);\n }", "title": "" }, { "docid": "8c525500a9acc8058a040e2f9226a5bb", "score": "0.52300704", "text": "addChild(child) {\n return this.addChildAt(child, this._children.length)\n }", "title": "" }, { "docid": "849f416f60d9c08b1243bfb40220037f", "score": "0.5220372", "text": "function findChildren(parent) {\n // go through all associations\n for (let i = 0; i < self.assocs.length; ++i) {\n let a = self.assocs[i];\n // note that a.origin.item and a.dest.item will be identifiers (guids)\n\n // if we find a child of the parent that matches the assocGroup\n if (\"isChildOf\" === a.type\n && true !== a.inverse\n && a.dest.item === parent.key\n && a.groupId == assocGroup // if the association is in the \"default group\", a.groupId will be undefined; we want to use == so that it matches null\n ) {\n let child = {\n \"title\": a.origin.item,\n \"key\": a.origin.item,\n \"children\": [],\n \"seq\": a.seq,\n \"childOfAssocId\": a.id, // stash the assocId for use elsewhere\n // we really shouldn't need to set a default ref like this, but just in case...\n \"ref\": {\n \"nodeType\": \"item\",\n \"item\": \"unknown\",\n \"doc\": self\n }\n };\n\n // look for the child in itemHash (we should always find it)\n let childItem = self.itemHash[a.origin.item];\n if (!empty(childItem)) {\n // set the title\n child.title = treeItemTitle(childItem);\n\n // and add the item's reference\n child.ref = childItem;\n\n // then link the ft node to the childItem if we're rendering the left side\n if (treeSide === 1) {\n childItem.ftNodeData = child;\n }\n }\n\n // push child onto children array\n parent.children.push(child);\n\n // recurse to find this child's children\n findChildren(child);\n\n // if the child has children...\n if (child.children.length > 0) {\n // make the child node a folder in fancytree\n child.folder = true;\n\n // expand the folder if it's the currentItem, or if it was expanded previously\n child.expanded = (childItem === self.currentItem || op(self.expandedFolders[treeSide], assocGroup, child.key) === true);\n }\n }\n }\n\n // sort children of parent\n parent.children.sort(function(a,b) {\n // try to sort by a.seq\n let seqA = a.seq * 1;\n let seqB = b.seq * 1;\n if (isNaN(seqA)) seqA = 100000;\n if (isNaN(seqB)) seqB = 100000;\n // if seqA != seqB, sort by seq\n if (seqA !== seqB) {\n return seqA - seqB;\n }\n\n // else try to sort by the item's listEnumeration field\n let leA = 100000;\n let leB = 100000;\n if (!empty(a.ref) && !empty(a.ref.le)) {\n leA = a.ref.le*1;\n }\n if (!empty(b.ref) && !empty(b.ref.le)) {\n leB = b.ref.le*1;\n }\n\n if (isNaN(leA)) leA = 100000;\n if (isNaN(leB)) leB = 100000;\n\n if (leA !== leB) {\n return leA - leB;\n }\n\n // else try to sort by the item's human coding scheme\n\n let hcsA = op(a, \"ref\", \"hcs\");\n let hcsB = op(b, \"ref\", \"hcs\");\n\n if (empty(hcsA) && empty(hcsB)) return 0;\n if (empty(hcsB)) return -1;\n if (empty(hcsA)) return 1;\n\n let lang = (document.documentElement.lang !== \"\") ? document.documentElement.lang : undefined;\n\n return hcsA.localeCompare(hcsB, lang, { numeric: true, sensitivity: 'base' });\n });\n }", "title": "" }, { "docid": "40ca8dc16a192a1236577f984ff86a63", "score": "0.5220016", "text": "appendChildrenView(container, tp, params) {\n return new Promise((resolve, reject) => {\n if (!container) container=this.childContainer; //Default value for container\n else this.childContainer=container; //Update default\n var innerAppend=tp=>{\n this.dispatchEvent(\"justBeforeAppendChildren\", container);\n if (this.children.length>0) {\n this.children=this.children.sort((a,b)=>a.sort_order-b.sort_order);\n var renderedChildren=document.createDocumentFragment();\n this.children.forEach((child)=>renderedChildren.appendChild(child.prerender(tp, params)))\n }\n if (renderedChildren) {\n container.appendChild(renderedChildren);\n }\n if (typeof theme.nodeOnAppend == 'function') {\n theme.nodeOnAppend(this);\n }\n resolve(this);\n this.dispatchEvent(\"appendChildrenView\");\n theme.dispatchEvent(\"setTp\", this); //This way we save the last node that has a view\n };\n var getTpAndInnerAppend=tpPath=>{\n Node.getTp(tpPath)\n .then(tp => innerAppend(tp))\n .catch(err=>{\n reject(err);\n console.error(err)\n });\n }\n if (typeof tp==\"string\") {\n getTpAndInnerAppend(tp);\n }\n else {\n innerAppend(tp);\n }\n });\n }", "title": "" }, { "docid": "2f1cc845b1d4d81e32a4c6132f5e6bd9", "score": "0.5204568", "text": "children(){return new List(map(this.node.children,function(node){return adopt(node)}))}", "title": "" }, { "docid": "c1b03513a1c5f1fc3125a835c20ba83e", "score": "0.52041906", "text": "append(child, openStart) {\n joinInlineInto(this, child, openStart);\n }", "title": "" }, { "docid": "60ca25286ab1361f3070fd2e9bab1795", "score": "0.52019143", "text": "_add(child) {\n this.children.push(child);\n }", "title": "" }, { "docid": "c1d91fe31cc64b32c32e7dae11c9a674", "score": "0.5188878", "text": "addAllChildren() {\n DKTools.Sprite.prototype.addAllChildren.call(this);\n this.addAllItems();\n }", "title": "" } ]
e22ae57db9419b9081efe83d7142e7d3
^ For and , remove the common leading path portion > fullyQualifiedFilename < shorter name
[ { "docid": "0f00ae73a58d94e5fdb932a686745be4", "score": "0.0", "text": "localPathOnly(fullyQualifiedFilename) {\n\t\texpect(fullyQualifiedFilename, 'String');\n\t\t\n\t\tvar pathAndFilename = this.shortDisplayFilename(fullyQualifiedFilename);\n\t\tvar pfile = new Pfile(pathAndFilename);\n\t\tvar pathOnly = pfile.getPath();\n\t\treturn pathOnly;\n\t}", "title": "" } ]
[ { "docid": "f05488dd9bdff56ebae6c934dcc228ee", "score": "0.63751364", "text": "function stripFilename(path) {\n\tif (!path) return \"\";\n\tconst index = path.lastIndexOf(\"/\");\n\treturn path.slice(0, index + 1);\n}", "title": "" }, { "docid": "9181013c9514be4439df69a794ac7ceb", "score": "0.6281277", "text": "function stripFilename(path) {\n if (!path)\n return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}", "title": "" }, { "docid": "2de729b9c61c1594fccc686d5e1d7207", "score": "0.62791544", "text": "function EZstripFileSlash(pathfilename)\n{\n\treturn pathfilename.replace(/file:\\/\\/\\//,'').replace(/\\|/,':')\n}", "title": "" }, { "docid": "f54904da66960a4e91110f1cd479112d", "score": "0.62433016", "text": "formatFilename(str) {\n return str.replace(/^\\w+-/, \"\");\n }", "title": "" }, { "docid": "725b372657ddf2a06efbb8fcf3284ed8", "score": "0.6231517", "text": "function stripPathFilename(path) {\n\tpath = normalizePath(path);\n\tconst index = path.lastIndexOf(\"/\");\n\treturn path.slice(0, index + 1);\n}", "title": "" }, { "docid": "399ea3e0288ec6956e7b6aab806642fc", "score": "0.6173541", "text": "function removeFileName(path){\n\tvar filename = /[^\\/]*$/;\n\tpath = path.replace(filename, '');\n\treturn path;\n}", "title": "" }, { "docid": "157dcd4693c3757f7112ce79be0a7c67", "score": "0.61669785", "text": "function baseName( path )\n{\n\treturn path.replace( /^.*[\\/\\\\]/g, \"\" );\n}", "title": "" }, { "docid": "7422aa3b7337e22653d80ee4afb9411e", "score": "0.61158955", "text": "function fileNameWash( name , preserve_wildcards = false){\n\n if( os.platform() == 'win32' ) {\n let n1, n2;\n if( !preserve_wildcards )\n n1 = name.replace(/\\*\\?/, '');\n else\n n1 = name; \n\n n2 = \n n1.replace(/[\\/<>\\\\:\\|\"]/g, '')\n .replace(/[\\x00-\\x1f\\x80-\\x9f]/g, '')\n .replace(/^\\.+$/, '')\n .replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\..*)?$/i, '')\n .replace(/[\\. ]+$/, '');\n \n return n2.substring(0,255)\n\n } else {\n return name\n .replace(/[\\/\\\\\\x00~]/g, '') // remove / \\ ~ zero\n .replace(/[.]{2,}/g, '') // Remove double\n }\n}", "title": "" }, { "docid": "366635904f35e4770e4ce3c46a341bd3", "score": "0.611271", "text": "function prependFileName(file) {\n\t\t\t\tif(!(file.match(/^.+?:\\/\\//))) {\n\t\t\t\t\t\tfile = \"http://\"+file;\n\t\t\t\t\t}\n\t\t\t\treturn file;\n\t\t\t}", "title": "" }, { "docid": "ee1ece08f662608c4739a13de261da21", "score": "0.607885", "text": "static fullpathToFilename(fullpath) {\n return fullpath.substring(fullpath.lastIndexOf('/') + 1);\n }", "title": "" }, { "docid": "b67af23bbe3d288d0e5a38020f12433e", "score": "0.6076635", "text": "function basename(path) { return path.replace(/.*\\//, \"\");}", "title": "" }, { "docid": "b67af23bbe3d288d0e5a38020f12433e", "score": "0.6076635", "text": "function basename(path) { return path.replace(/.*\\//, \"\");}", "title": "" }, { "docid": "daf73c8670b192475d2aef240158831c", "score": "0.6071935", "text": "function trimUpToFirstSlash(fileName) {\n return fileName && fileName.replace(/^[^/]+\\//, '');\n}", "title": "" }, { "docid": "168a6d24cf93d55ff50b56a3d37927e7", "score": "0.60382456", "text": "function fileName(s) {\n return s.substring(s.lastIndexOf(\"/\") + 1, s.length);\n }", "title": "" }, { "docid": "88f8a6317f34a9c2af5f72f373794d71", "score": "0.6002748", "text": "shortDisplayFilename(fullyQualifiedFilename) {\n\t\texpect(fullyQualifiedFilename, 'String');\n\t\t\n\t\tvar leadingPart = this.instructionPfile.getPath();\n\t\tif (fullyQualifiedFilename.indexOf(leadingPart) == 0)\n\t\t\treturn fullyQualifiedFilename.substr(leadingPart.length + 1);\n\t\t\n\t\twhile (leadingPart.indexOf('/') != -1) {\n\t\t\tvar pathParts = leadingPart.split('/');\n\t\t\tpathParts.pop();\n\t\t\tleadingPart = pathParts.join('/');\n\t\t\tif (fullyQualifiedFilename.indexOf(leadingPart) == 0) {\n\t\t\t\tvar shortName = fullyQualifiedFilename.substr(leadingPart.length);\n\t\t\t\tif (shortName.charAt(0) == '/')\n\t\t\t\t\treturn shortName.substr(1);\n\t\t\t\telse\n\t\t\t\t\treturn shortName;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn fullyQualifiedFilename;\n\t}", "title": "" }, { "docid": "852a78cd8aceb118706af1ba7d8df18e", "score": "0.59916943", "text": "function filterPath(string) {\n\t return string\n\t .replace(/^\\//,'') \n\t .replace(/(index|default).[a-zA-Z]{3,4}$/,'') \n\t .replace(/\\/$/,'');\n\t }", "title": "" }, { "docid": "e1a2250627853ab39eaa042dd781c5ec", "score": "0.5856574", "text": "function getFileName(fullName, full){\t\t\t\t\t\t\t\t\t\t//Source URL processing for filename\n\tvar i;\n\tfull=full || false;\n\tfullName=fullName.replace(/(#|\\?).*$/gim,'');\t\t\t\t\t\t\t//first remove url parameters\n\tif (fullName.indexOf('xuite')!=-1) {\t\t\t\t\t\t\t\t\t//This host names their images as \"(digit).jpg\" causing filename collisions\n\t\ti=fullName.lastIndexOf('/');\n\t\tfullName=fullName.substr(0,i)+'-'+fullName.substr(i+1);\t\t\t\t// add parent catalog name to the filename to ensure uniqueness\n\t}\n\telse if ((fullName.indexOf('amazonaws')!=-1)&&(!full)) \t\t\t\t//Older tumblr images are weirdly linked via some encrypted redirect to amazon services,\n\t\tfullName=fullName.substring(0,fullName.lastIndexOf('_')-2);\t\t\t// where links only have a part of the filename without a few last symbols and extension,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// have to match it here as well, but we need full filename for downloadify, thus the param\n\tif ((fullName.indexOf('tumblr_')!=-1)&&!full) \n\t\tfullName=fullName.replace(/(tumblr_)|(_\\d{2}\\d{0,2})(?=\\.)/gim,'');\n\tfullName=fullName.replace(/\\\\/g,'/');\t\t\t\t\t\t\t\t\t//Function is used both for URLs and folder paths which have opposite slashes\n\treturn fullName.split('/').pop();\n}", "title": "" }, { "docid": "852c76cd10c94ec8129b2afeb0b74e98", "score": "0.5852562", "text": "function parseFilenameFromPath(fullPath){\n var filename = \"\";\n if (fullPath != \"\"){\n var i=(fullPath.length -1);\n for (i; i>=0; i--){\n var charValue = fullPath[i];\n if (charValue == \"\\\\\" || charValue == \"/\"){\n return filename;\n }else {\n filename = charValue + filename;\n }\n }\n }\n}", "title": "" }, { "docid": "34c04c1fa178c78942a0be68e74fa48b", "score": "0.5845139", "text": "function getFileName(fileName){\n\t\t\treturn fileName.replace(/.*\\/(.+)\\..+$/, \"$1\") ;\n\t\t}", "title": "" }, { "docid": "1c035f54b3a703c28be91e75b5fa13b5", "score": "0.5835526", "text": "function fileToImportName(fPath) {\n\treturn (fPath.charAt(0).toUpperCase() + fPath.slice(1)).replace(\n\t\t/(-[a-z])/g,\n\t\t($1) => $1.toUpperCase().replace('-', '')\n\t);\n}", "title": "" }, { "docid": "4549af6694905c883f32d19edce15d12", "score": "0.5833079", "text": "function normalizeFileName(fileName) {\n return fileName.replace(/[\\<\\>\\:\"\\/\\\\\\|\\?*]/g, \"\");\n }", "title": "" }, { "docid": "9dd58060c10bbacae9815c8e0f381377", "score": "0.581575", "text": "function kn_include_canonicalName(aScript)\n{\n if (aScript.indexOf(\"/\") == -1)\n {\n // Allow Java-style \".\" notation for scripts in subdirectories.\n aScript = aScript.split(\".\").join(\"/\");\n }\n\n return aScript;\n}", "title": "" }, { "docid": "140ca059d04cd75bdb121e1d17451dcd", "score": "0.5808364", "text": "function filterPath(string) {\n return string\n .replace(/^\\//, '')\n .replace(/(index|default).[a-zA-Z]{3,4}$/, '')\n .replace(/\\/$/, '');\n }", "title": "" }, { "docid": "cf1362486dc07e5092eb1097b3d920ac", "score": "0.57872754", "text": "function removeFilePath(p) {\n return p.replace(config.filesDir.substring(0, config.filesDir.length - 1), \"\");\n}", "title": "" }, { "docid": "41e64cec4a166aa7c0abf3be53fb3539", "score": "0.574794", "text": "genName(p) {\n\t\tlet _p = p.replace(/\\\\/g, \"/\")\n\t\tlet lastIndex = _p.lastIndexOf(\"/\")\n\t\tlet name = _p.substring(lastIndex + 1)\n\t\tif (p.indexOf(\"mock\" !== -1)) {\n\t\t\treturn name.replace(\".js\", \"\")\n\t\t}\n\t\treturn name.replace(\".vue\", \"\")\n\t}", "title": "" }, { "docid": "795f2166df5942bcc64b230d8f3a1cab", "score": "0.57416576", "text": "_parseRelativePath(f) {\n return f.replace(this._projectDirectoryRegExp, '');\n }", "title": "" }, { "docid": "d51416de22cc1bea5f34a9951e7f9bd6", "score": "0.5707083", "text": "_normalizePath(mp, name){\n\t\t\n\t\tif (!name || !mp || mp.charAt(0) != '.' ) return mp;\n\t\t\n\t\tvar i = name.lastIndexOf('/');\n\t\tvar cp = i<0 ? \"\" : name.substring(0, i+1);\n\t\tvar ps = (cp + mp).split('/');\n\t\tvar mps = [];\n\t\tfor(var p; p = ps.shift();)\n\t\t{\n\t\t\tswitch (p){\n\t\t\tcase \".\" :\n\t\t\t\tcontinue;\n\t\t\tcase \"..\" :\n\t\t\t\tmps.pop();\n\t\t\t\tcontinue;\n\t\t\tdefault :\n\t\t\t\tmps.push(p);\n\t\t\t}\n\t\t}\n\t\t\n\t\tmp = mps.join(\"/\");\n\t\t\n\t\treturn mp;\n\t}", "title": "" }, { "docid": "bb27759edfee4d3312f09bb1fab11b78", "score": "0.5704859", "text": "name(file) { // 以源文件名字及格式输出\n if (isDev) {\n return '[name].[ext]';\n }\n return '[name].[hash:8].[ext]';\n }", "title": "" }, { "docid": "411b09eb03ddba09e7ebc72bbe1710aa", "score": "0.5702219", "text": "function toPath( name ) {\n\treturn name.replace( '-', '.' );\n}", "title": "" }, { "docid": "79da5dc3c7f89f6e24e02a4361d90807", "score": "0.5679786", "text": "cleanPath( path ) {\n\n\t\t\tif ( path.toLowerCase().indexOf( 'images' ) === 0 ) return './' + path;\n\t\t\treturn path.split( '/' ).pop().split( '\\\\' ).pop();\n\n\t\t}", "title": "" }, { "docid": "4325c4c6eb04aad4cc2e706efbbf5708", "score": "0.5668033", "text": "function Guidewire_FMSourceFileExtract(FullFileName)\n{\n var VarSplitURL= FullFileName.split(\".\");\n return VarSplitURL[0];\n}", "title": "" }, { "docid": "00353b8bc0151c810a9d51363c1f9c31", "score": "0.565378", "text": "function normalizeSourceName(sourceName) {\n return replaceBackslashes(path_1.default.normalize(sourceName));\n}", "title": "" }, { "docid": "5f7af38de98c37287d5d9e1a567d4e47", "score": "0.56452185", "text": "function shorterFilename(filename){\n\t\tfilenameExtension = filename.split('.').pop();\n\t\tfilename = filename.substring(0, (50-filenameExtension.length-6));\n\t\tfilename = filename+\"(...).\"+filenameExtension;\n\t\treturn filename;\n\t }", "title": "" }, { "docid": "8bafeec7eaf90e5f1ea3b6fca033546b", "score": "0.5633267", "text": "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n }", "title": "" }, { "docid": "5fed873404355cf5544f6a9e72383772", "score": "0.56155026", "text": "function basename(path){\n return path.replace(/\\\\/g,'/').replace( /.*\\//, '' );\n}", "title": "" }, { "docid": "bd42ab368fba3a713be5042b3a8328a9", "score": "0.56144166", "text": "_removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri)) return iri; // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n\n const length = iri.length;\n let result = '',\n i = -1,\n pathStart = -1,\n segmentStart = 0,\n next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/') // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/') i = pathStart;\n }\n\n break;\n // Don't modify a query string or fragment\n\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n\n case '.':\n next = iri[++i + 1];\n\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2); // Try to remove the parent path from result\n\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart) result = result.substr(0, segmentStart); // Remove a trailing '/..' segment\n\n if (next !== '/') return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n\n }\n }\n\n }\n\n next = iri[++i];\n }\n\n return result + iri.substring(segmentStart);\n }", "title": "" }, { "docid": "35be697e7e78961628665494f96ae028", "score": "0.560742", "text": "function EZstripDashName(filename)\n{\n\tvar text = filename\n\n\t//----- Strip Revize name(s) after first dash\n\tvar pos = text.indexOf('-beforerevize')\n\tif (pos >= 0) text = text.substring(0,pos)\n\n\tvar pos = text.indexOf('-editlist')\n\tif (pos >= 0) text = text.substring(0,pos)\n\n\tvar pos = text.indexOf('-editform')\n\tif (pos >= 0) text = text.substring(0,pos)\n\n\t//----- Check for dependent template appended filename qualifiers\n\tvar pos = text.indexOf('_T')\n\tif (pos >= 0) {\n\tvar str = text.substring(pos+2); // string after T up to next _\n\t\tposNext = str.indexOf('_')\n\tif (posNext > 0)\n\t\tif ( !isNaN(str.substring(0,posNext)) )\n\t \t\ttext = text.substring(0,pos)\n\t}\n\treturn text;\n}", "title": "" }, { "docid": "2891a85d2ee9c6aec16a391cdcf4cc01", "score": "0.560616", "text": "function normalize(filePath) {\n return filePath.replace(/[\\\\\\/]+/g, \"/\");\n}", "title": "" }, { "docid": "5dc981df44f98f1fd4f9b35507235d41", "score": "0.5594139", "text": "function removeUnderscore (filepath) {\n const parts = filepath.split(path.sep)\n const filename = parts.pop().replace(/^_/, '')\n return parts.concat([filename]).join(path.sep)\n}", "title": "" }, { "docid": "f64ce25c225f946835617535c66ca793", "score": "0.556352", "text": "_removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri)) return iri; // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n\n var result = '',\n length = iri.length,\n i = -1,\n pathStart = -1,\n segmentStart = 0,\n next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/') // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/') i = pathStart;\n }\n\n break;\n // Don't modify a query string or fragment\n\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n\n case '.':\n next = iri[++i + 1];\n\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2); // Try to remove the parent path from result\n\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart) result = result.substr(0, segmentStart); // Remove a trailing '/..' segment\n\n if (next !== '/') return result + '/' + iri.substr(i + 1);\n segmentStart = i + 1;\n }\n\n }\n }\n\n }\n\n next = iri[++i];\n }\n\n return result + iri.substring(segmentStart);\n }", "title": "" }, { "docid": "3734ef52fe04a6960d28331c570bff32", "score": "0.5543917", "text": "function basename() {\n return function(files) {\n Object.keys(files).forEach(file => {\n const parts = path.parse(file);\n files[file].basename = parts.name;\n });\n };\n}", "title": "" }, { "docid": "45ecaadcffa1271ea7722f3f8571cd73", "score": "0.5542919", "text": "function prettifyFilePath(path) {\n return path.split('/').slice(4).join('/');\n}", "title": "" }, { "docid": "b678227dd248c920d6563ab81800f8ff", "score": "0.55247915", "text": "function r$w(r){let e,t;return r.replace(/^(.*\\/)?([^/]*)$/,((r,a,i)=>(e=a||\"\",t=i||\"\",\"\"))),{dirPart:e,filePart:t}}", "title": "" }, { "docid": "b6c86812ab7824394539d0beeff31137", "score": "0.5514124", "text": "function parseFileName(path) {\n\tvar name = path;\n\t//for windows and linux\n\tvar pos1 = name.lastIndexOf(\"/\");\n\tvar pos2 = name.lastIndexOf(\"\\\\\");\n\tvar pos = Math.max(pos1, pos2);\n\tif (pos<0) {\n\t\treturn path;\n\t} else {\n\t\ttry {\n\t\t\treturn name.substr(pos+1);\n\t\t} catch (e) {\n\t\t\treturn name.substr(pos);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0101c389db27093220fe61a15449d823", "score": "0.5509355", "text": "sanitize(f) {\n\t\treturn path.normalize(f).replace(/^\\//, '');\n\t}", "title": "" }, { "docid": "61ec4790d56aa78e5dfff2fa51f6e602", "score": "0.5503523", "text": "function processPath(path) {\n if (path[0] === '.' && path[1] === '/') {\n path = path.substr(2);\n } else if (path[0] === '/') {\n path = path.substr(1);\n }\n return path;\n }", "title": "" }, { "docid": "c3022e6c94e3092624a53e646f1a4430", "score": "0.55034584", "text": "function removeWindowsDriveName(path,url,base){/*\n Matches paths for file protocol on windows,\n such as /C:/foo/bar, and captures only /foo/bar.\n */\nvar firstPathSegmentMatch,windowsFilePathExp=/^\\/[A-Z]:(\\/.*)/;\n// The input URL intentionally contains a first path segment that ends with a colon.\n//Get the relative path from the input URL.\n// The input URL intentionally contains a first path segment that ends with a colon.\nreturn 0===url.indexOf(base)&&(url=url.replace(base,\"\")),windowsFilePathExp.exec(url)?path:(firstPathSegmentMatch=windowsFilePathExp.exec(path),firstPathSegmentMatch?firstPathSegmentMatch[1]:path)}", "title": "" }, { "docid": "359c9c7c8023b9ab502fc5f68af61dda", "score": "0.55003697", "text": "function GetCleanFilename ( pathName, ext ) {\n\t\tvar clean = path.basename(pathName, ext).replace(/[^\\w\\s]/gi,'');\n\t\t\tclean = clean.replace(/\\s+/g,' ');\n\t\treturn clean;\n\t}", "title": "" }, { "docid": "55cbe28e7db835a1a877553cf6488f9b", "score": "0.5491634", "text": "_removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n var result = '', length = iri.length, i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return result + '/' + iri.substr(i + 1);\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }", "title": "" }, { "docid": "cd8b37abf06df220b5b749066b3e7997", "score": "0.5487756", "text": "function shortname(from, to) {\n var fromPath = from.fullName.split(\".\"),\n toPath = to.fullName.split(\".\"),\n i = 0,\n j = 0,\n k = toPath.length - 1;\n if (!(from instanceof Root) && to instanceof Namespace)\n while (i < fromPath.length && j < k && fromPath[i] === toPath[j]) {\n var other = to.lookup(fromPath[i++], true);\n if (other !== null && other !== to)\n break;\n ++j;\n }\n else\n for (; i < fromPath.length && j < k && fromPath[i] === toPath[j]; ++i, ++j);\n return toPath.slice(j).join(\".\");\n}", "title": "" }, { "docid": "6ecbd47f9056607c4f9191f55cbb8ba3", "score": "0.5475202", "text": "function fileNameToSectionName(fileName){if(fileName==null||fileName===\"\"||typeof fileName!==\"string\"){return null;}// remove 1-\nfileName=fileName.replace(/\\d+-/,\"\");// remove space\nfileName=fileName.trim();// uppercase first letter\nfileName=fileName.charAt(0).toUpperCase()+fileName.slice(1);// remove .xx (language key)\nfileName=fileName.replace(/\\.[a-z]+$/i,\"\");return fileName;}", "title": "" }, { "docid": "af143b4945c37bf766a647e589e11f42", "score": "0.5472187", "text": "function shortname(from, to) {\r\n var fromPath = from.fullName.split(\".\"),\r\n toPath = to.fullName.split(\".\"),\r\n i = 0,\r\n j = 0,\r\n k = toPath.length - 1;\r\n if (!(from instanceof Root) && to instanceof Namespace)\r\n while (i < fromPath.length && j < k && fromPath[i] === toPath[j]) {\r\n var other = to.lookup(fromPath[i++], true);\r\n if (other !== null && other !== to)\r\n break;\r\n ++j;\r\n }\r\n else\r\n for (; i < fromPath.length && j < k && fromPath[i] === toPath[j]; ++i, ++j);\r\n return toPath.slice(j).join(\".\");\r\n}", "title": "" }, { "docid": "b24d326102b5e6b7dd5ec878989cb9a1", "score": "0.5471511", "text": "function basename (path) {\n return path.replace (/\\\\/g, '/').replace (/.*\\//, '');\n} // basename", "title": "" }, { "docid": "f44bfbe22a36cbd6cf4783ee64efaaec", "score": "0.5469751", "text": "function name(name) {\n return name.substring(0, name.lastIndexOf('.')).substring(6);\n }", "title": "" }, { "docid": "411776c276f8129f31835aa060eafcd5", "score": "0.54690075", "text": "_removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n const length = iri.length;\n let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }", "title": "" }, { "docid": "2565c49e998328cfed17bcc3fbf4c359", "score": "0.54622936", "text": "function unpath(path) {\n return path.replace(/^\\//, '');\n}", "title": "" }, { "docid": "9cd41ed7465952da19e8e259c310d2ea", "score": "0.5461443", "text": "function sliceFileName(name, nchar) {\n 'use strict';\n if (name.length > nchar) {\n var toremove = name.length - nchar;\n if (toremove < 13) {\n return name;\n }\n name = name.substring(0, 10) + '...' + name.substring(13 + toremove);\n return name;\n }\n return name;\n}", "title": "" }, { "docid": "e360bba5942d9c9c2b80d2b933bcd989", "score": "0.5453463", "text": "function getFileName(path /*string*/) {\r\n\tif(path.lastIndexOf(\"/\")>-1)\r\n\t\treturn path.substring(path.lastIndexOf(\"/\")+1);\r\n\telse return path;\r\n}", "title": "" }, { "docid": "7ee33dc52140396439341b8bbd43d60d", "score": "0.54472935", "text": "function normalize(filepath) {\r\n return filepath.replace(/\\\\/g, '/');\r\n}", "title": "" }, { "docid": "1d5d2b9c3e526fec3db5856298081696", "score": "0.5434234", "text": "function file2moduleName(filePath) {\n return filePath.replace(/\\\\/g, '/')\n .replace(/^\\/base\\//, '')\n .replace(/\\.js/, '');\n}", "title": "" }, { "docid": "4dde701390250d5a94f5c9a578e23e9e", "score": "0.54311484", "text": "function cleanFileName(str) {\n var i,\n l,\n c,\n ch,\n strout = \"\",\n badchrs = '/\\\\?%*:|\"<> ';\n\n for (i = 0, l = str.length; i < l; i++) {\n c = str.charAt(i);\n ch = str.charCodeAt(i);\n if (between(ch, 32, 126) && badchrs.indexOf(c) == -1) strout += c;\n }\n if (!strout.length) strout = \"untitled\";\n return strout;\n }", "title": "" }, { "docid": "abbab658f7fde7a4eab0dc086fcc34d2", "score": "0.5428595", "text": "function originalFSPath(uri) {\n var value;\n var uriPath = uri.path;\n if (uri.authority && uriPath.length > 1 && uri.scheme === Schemas.file) {\n // unc path: file://shares/c$/far/boo\n value = \"//\" + uri.authority + uriPath;\n }\n else if (platform[\"g\" /* isWindows */]\n && uriPath.charCodeAt(0) === 47 /* Slash */\n && isWindowsDriveLetter(uriPath.charCodeAt(1))\n && uriPath.charCodeAt(2) === 58 /* Colon */) {\n value = uriPath.substr(1);\n }\n else {\n // other path\n value = uriPath;\n }\n if (platform[\"g\" /* isWindows */]) {\n value = value.replace(/\\//g, '\\\\');\n }\n return value;\n}", "title": "" }, { "docid": "8ab01407e18cce910c482514b22973bf", "score": "0.54277813", "text": "function sanitizeFilename(name) {\n const illegalRe = /[\\/\\?<>\\\\:\\*\\|\":]/g;\n const controlRe = /[\\x00-\\x1f\\x80-\\x9f]/g;\n const reservedRe = /^\\.+$/;\n const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\..*)?$/i;\n const windowsTrailingRe = /[\\. ]+$/;\n const replacement = \"_\";\n\n let sanitized = name\n .replace(illegalRe, replacement)\n .replace(controlRe, replacement)\n .replace(reservedRe, replacement)\n .replace(windowsReservedRe, replacement)\n .replace(windowsTrailingRe, replacement);\n return sanitized.substring(0, 100);\n}", "title": "" }, { "docid": "d49c047853dab0cf2d468001be9da9f5", "score": "0.5421979", "text": "function cleanKeyName(name) {\n var isMult = reusableSnippetList.indexOf(String(name).split('.')[0]);\n var cleanName;\n if (isMult == -1) {\n cleanName = name;\n } else {\n cleanName = String(name).split('.')[0];\n var object = String(name).split('.');\n for (var i = 2; i < object.length; i++) {\n cleanName += '.' + object[i];\n }\n }\n return cleanName;\n}", "title": "" }, { "docid": "a47ddafafa738a2efb1ac29f0006dbac", "score": "0.54143864", "text": "function whistle_short_path($p) {\n return strcat(substr($p, 9, 1),\n ((substr($p, 9, 1)!=='t') ? \"/\" : \"\"),\n yd_to_sdf(substr($p, 0, 8), 3),\n num_to_sxg(substr($p, 10, 3)));\n}", "title": "" }, { "docid": "552d736e564042c7cfe4dc918b12d88a", "score": "0.5411858", "text": "function removeWindowsDriveName(path,url,base){ /*\r\n Matches paths for file protocol on windows,\r\n such as /C:/foo/bar, and captures only /foo/bar.\r\n */var windowsFilePathExp=/^\\/[A-Z]:(\\/.*)/;var firstPathSegmentMatch; //Get the relative path from the input URL.\nif(url.indexOf(base) === 0){url = url.replace(base,'');} // The input URL intentionally contains a first path segment that ends with a colon.\nif(windowsFilePathExp.exec(url)){return path;}firstPathSegmentMatch = windowsFilePathExp.exec(path);return firstPathSegmentMatch?firstPathSegmentMatch[1]:path;}", "title": "" }, { "docid": "c564b683a0f36a3248d8ca4f3b71e880", "score": "0.54094315", "text": "if (removeFileExtension(filesListJSON[iFile].fileName) == removeFileExtension(String(unixName))) {\n\t\t\tresultName = filesListJSON[iFile].directory + '/' + filesListJSON[iFile].fileName\n\t\t}", "title": "" }, { "docid": "f4c0719588dc32eea99bf3d5bc37b44c", "score": "0.5408292", "text": "function toActualPath(segments) {\n const lastIndex = segments.length - 1;\n const last = basename(segments[lastIndex]);\n if (isOmittable(last)) {\n segments = segments.slice(0, -1);\n }\n else {\n segments = segments.slice(0, -1).concat(last);\n }\n return segments.map((s, i) => {\n if (s[0] === '_') {\n const suffix = lastIndex === i ? '?' : '';\n return ':' + s.slice(1) + suffix;\n }\n else {\n return s;\n }\n });\n}", "title": "" }, { "docid": "024eeae4dadc780a9e5c83ac177b762c", "score": "0.54067713", "text": "function makeBufferNameFromFile(filename){\n\n var lastSlash = filename.lastIndexOf('/');\n\n if(lastSlash >= 0)\n\treturn filename.substr(lastSlash+1);\n else\n\treturn filename;\n}", "title": "" }, { "docid": "adc7fa9b541e51923111c83ddc74fa6a", "score": "0.5402818", "text": "function replaceExtraPath(findStr, extraPath)\n {\n var reExtraPath = new RegExp(escapeFileName(extraPath),'g');\n var myStr = findStr; // to modify param\n var matchFunctionHeader = null;\n while((matchFunctionHeader = reExtraPath.exec(myStr)) != null)\n {\n myStr = myStr.replace(matchFunctionHeader, \"\");\n }\n return myStr;\n }", "title": "" }, { "docid": "93c1ae9ac56165df011967f5e6d8781c", "score": "0.53998965", "text": "function strip(path, strip)\n{\n return normalizePathSeperators(path).replace(strip, '');\n}", "title": "" }, { "docid": "eae2453b7bd1e0fce7923033fef39a41", "score": "0.53984386", "text": "function cleanPath(str) {\n if (str) {\n return str.replace(/\\.\\./g,'').replace(/\\/+/g,'').\n replace(/^\\/+/,'').replace(/\\/+$/,'');\n }\n }", "title": "" }, { "docid": "23df0473aa1e9fc6013a600d12771f1c", "score": "0.53886557", "text": "generateFileNameSeperation(newFileName) {\n const splitNameArray = newFileName.split('.')\n const ext = splitNameArray[1]\n const nameOnly = splitNameArray[0]\n const nameOnlyArray = nameOnly.split('-')\n\n let resizeKey = ''\n if (nameOnlyArray.length > 1) {\n resizeKey = nameOnlyArray[1]\n nameOnlyArray.pop(resizeKey)\n } else {\n resizeKey = null\n }\n const id = nameOnlyArray[0]\n\n return {\n id,\n resizeKey,\n ext,\n }\n }", "title": "" }, { "docid": "de848cf3f5f838c76cb76f0dd25571d9", "score": "0.5370787", "text": "function fnamePara(href) { //U: un path estandar para una url\n\tvar r= href.replace(/^https?:\\/\\//,'').replace(/:\\d+/,'');\n\treturn (QuieroPathsSinCaracteresRaros) ?\n\t\tr.replace(/([^a-z0-9\\.\\/])/gi,function (x,c) { return '_'+c.charCodeAt(0).toString(16) })\n\t\t: r;\n}", "title": "" }, { "docid": "a9ddd74ad7f4d2def515e6e1b3bda03a", "score": "0.53656566", "text": "function name(name) {\n\t\t\treturn name.substring(0, name.lastIndexOf(\".\")).substring(6);\n\t\t}", "title": "" }, { "docid": "a9ddd74ad7f4d2def515e6e1b3bda03a", "score": "0.53656566", "text": "function name(name) {\n\t\t\treturn name.substring(0, name.lastIndexOf(\".\")).substring(6);\n\t\t}", "title": "" }, { "docid": "c42d01c440293a9e9de4f9930c669125", "score": "0.53650033", "text": "function getNameFile(absolutePath){\n let temp = absolutePath.split(\"\\\\\");\n\n return temp[temp.length - 1].slice(0, -4);\n}", "title": "" }, { "docid": "27a40b90fae6dcdeb173878a02483c46", "score": "0.5360643", "text": "tempify(f,id) { return f.replace(/^(.*)\\.([^\\.]*)$/,\"$1-tmp\"+id+\".$2\") }", "title": "" }, { "docid": "b3c62fd3576a449578c44a6679e5561e", "score": "0.53570795", "text": "static namable(name) {\r\n if (!name.includes('.')) return name;\r\n\r\n let namesList = name.split('.'),\r\n mainName = namesList.shift();\r\n\r\n for (let name of namesList) {\r\n mainName += `[${name}]`;\r\n }\r\n\r\n return mainName;\r\n }", "title": "" }, { "docid": "3541b8e217e55f94430055f4e1adb9f2", "score": "0.53459585", "text": "get basename() {\n return typeof this.path === 'string' ? _minpath_js__WEBPACK_IMPORTED_MODULE_4__.path.basename(this.path) : undefined\n }", "title": "" }, { "docid": "9d1f5a37d2df6a4d43c894f8ffe7de11", "score": "0.5344883", "text": "function shortenName(name) {\n // [abc.def.ghi] -> abc.def.ghi\n if (name.startsWith(\"[\")) {\n return name.substring(1, name.length - 1);\n }\n\n // abc.def.ghi -> ghi\n var idx = name.lastIndexOf(\".\");\n if (idx >= 0) {\n name = name.substring(idx + 1);\n }\n return name;\n}", "title": "" }, { "docid": "fc66e3c0501343b39600be56d91731bd", "score": "0.534041", "text": "function replaceParentDirReferences(inputPath) {\n const pathParts = inputPath.split(path.sep);\n\n return pathParts.map(part => part === '..' ? '__..__' : part).join(path.sep);\n}", "title": "" }, { "docid": "a9263e05428db22f4ebc1b68b598c5d2", "score": "0.5337308", "text": "static filename(text) {\n return text\n .toLowerCase()\n // Replace plurals\n .replace(/ies\\b/g, 'y')\n // Remove common words\n .replace(/\\b(a|an|at|be|of|on|the|to|in|is|has|by|with)\\b/g, '')\n .trim()\n // Convert spaces to underscores\n .replace(/\\s+/g, '_')\n // Remove all non-alphanumericals\n .replace(/[^a-z0-9_]/g, '')\n // Limit to 100 chars; most systems support max. 255 bytes in filenames\n .substring(0, 100);\n }", "title": "" }, { "docid": "895040fda71866f1ac7c5879d302f53a", "score": "0.5336644", "text": "function _getPath(name) {\n var needAnalyse = name.indexOf('/') > -1 ? true : false;\n if (needAnalyse)\n return name;\n var path = name;\n for (var i in pathAndFileName) {\n if (name == pathAndFileName[i])\n path = i;\n }\n return path;\n }", "title": "" }, { "docid": "9ed41ea6a690e11cf068dede3fe5a5be", "score": "0.53350115", "text": "_removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n var result = '', length = iri.length, i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return result + '/' + iri.substr(i + 1);\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }", "title": "" }, { "docid": "6bfc5126cf5007bf1f0444b7d3ec3313", "score": "0.53312975", "text": "function sc_prefix(s) {\n var i = s.lastIndexOf(\".\");\n return i ? s.substring(0, i) : s;\n}", "title": "" }, { "docid": "7ce2bec06592a4e96675b154e3a7ed12", "score": "0.5329171", "text": "function getFileName(url) {\n // remove #anchor\n url = url.substring(0, (url.indexOf(\"#\") === -1) ? url.length : url.indexOf(\"#\"));\n // remove ?querystring\n url = url.substring(0, (url.indexOf(\"?\") === -1) ? url.length : url.indexOf(\"?\"));\n // remove everything before the last slash in the path\n url = url.substring(url.lastIndexOf(\"/\") + 1, url.length);\n // return\n return url;\n }", "title": "" }, { "docid": "449b44023fa63cfcbe45dccaeca78c50", "score": "0.53286034", "text": "function normalizeDriveLetter(path) {\n var regex = /^([A-Z])(\\:[\\\\\\/].*)$/;\n if (regex.test(path)) {\n path = path.replace(regex, function (s, s1, s2) { return s1.toLowerCase() + s2; });\n }\n return path;\n}", "title": "" }, { "docid": "f5d357f3ad8ad3b5035477e3e03975b8", "score": "0.5322414", "text": "get name() {\n return (0, _path.basenameNoExt)(this.filePath);\n }", "title": "" }, { "docid": "c5ba0b35137862343ebd9c3b18509ba6", "score": "0.53182125", "text": "function buildEntryName(filename) {\n return _path2.default.basename(filename).split('.')[0];\n}", "title": "" }, { "docid": "ec59ec1e58a898756a9dc112e7c18c6f", "score": "0.5311727", "text": "function safeFilename(name) {\n //4-16-2015 name = name.replace(/ /g, '-');// replace space with a dash\n\n // name = name.replace(/[^A-Za-z0-9-_\\.]/g, '');\n name = name.replace(/[^A-Za-z0-9-_\\.]/g, ' ');\n name = name.replace(/\\.+/g, '.');\n name = name.replace(/-+/g, '-');\n name = name.replace(/_+/g, '_');\n console.log('name ', name)\n return name;\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" }, { "docid": "628b470bb6191d9cdb231ab593bd09c9", "score": "0.5310726", "text": "function globUnescape (s) {\n return s.replace(/\\\\(.)/g, '$1')\n}", "title": "" } ]
8c6782ec9efc6ecccd8377b2765d0cdd
Tokenise an setextstyle heading.
[ { "docid": "42a24bc302f6317104e0bc5b1dbbe477", "score": "0.6473393", "text": "function setextHeading(eat, value, silent) {\n\t var self = this;\n\t var now = eat.now();\n\t var length = value.length;\n\t var index = -1;\n\t var subvalue = '';\n\t var content;\n\t var queue;\n\t var character;\n\t var marker;\n\t var depth;\n\n\t /* Eat initial indentation. */\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (character !== C_SPACE || index >= MAX_HEADING_INDENT) {\n\t index--;\n\t break;\n\t }\n\n\t subvalue += character;\n\t }\n\n\t /* Eat content. */\n\t content = '';\n\t queue = '';\n\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (character === C_NEWLINE) {\n\t index--;\n\t break;\n\t }\n\n\t if (character === C_SPACE || character === C_TAB) {\n\t queue += character;\n\t } else {\n\t content += queue + character;\n\t queue = '';\n\t }\n\t }\n\n\t now.column += subvalue.length;\n\t now.offset += subvalue.length;\n\t subvalue += content + queue;\n\n\t /* Ensure the content is followed by a newline and a\n\t * valid marker. */\n\t character = value.charAt(++index);\n\t marker = value.charAt(++index);\n\n\t if (character !== C_NEWLINE || !SETEXT_MARKERS[marker]) {\n\t return;\n\t }\n\n\t subvalue += character;\n\n\t /* Eat Setext-line. */\n\t queue = marker;\n\t depth = SETEXT_MARKERS[marker];\n\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (character !== marker) {\n\t if (character !== C_NEWLINE) {\n\t return;\n\t }\n\n\t index--;\n\t break;\n\t }\n\n\t queue += character;\n\t }\n\n\t if (silent) {\n\t return true;\n\t }\n\n\t return eat(subvalue + queue)({\n\t type: 'heading',\n\t depth: depth,\n\t children: self.tokenizeInline(content, now)\n\t });\n\t}", "title": "" } ]
[ { "docid": "80554b7f32d7fce6833e70db08324c9a", "score": "0.64758986", "text": "function setextHeading(eat, value, silent) {\n var self = this;\n var now = eat.now();\n var length = value.length;\n var index = -1;\n var subvalue = '';\n var content;\n var queue;\n var character;\n var marker;\n var depth;\n\n /* Eat initial indentation. */\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== C_SPACE || index >= MAX_HEADING_INDENT) {\n index--;\n break;\n }\n\n subvalue += character;\n }\n\n /* Eat content. */\n content = '';\n queue = '';\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (character === C_NEWLINE) {\n index--;\n break;\n }\n\n if (character === C_SPACE || character === C_TAB) {\n queue += character;\n } else {\n content += queue + character;\n queue = '';\n }\n }\n\n now.column += subvalue.length;\n now.offset += subvalue.length;\n subvalue += content + queue;\n\n /* Ensure the content is followed by a newline and a\n * valid marker. */\n character = value.charAt(++index);\n marker = value.charAt(++index);\n\n if (character !== C_NEWLINE || !SETEXT_MARKERS[marker]) {\n return;\n }\n\n subvalue += character;\n\n /* Eat Setext-line. */\n queue = marker;\n depth = SETEXT_MARKERS[marker];\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== marker) {\n if (character !== C_NEWLINE) {\n return;\n }\n\n index--;\n break;\n }\n\n queue += character;\n }\n\n if (silent) {\n return true;\n }\n\n return eat(subvalue + queue)({\n type: 'heading',\n depth: depth,\n children: self.tokenizeInline(content, now)\n });\n}", "title": "" }, { "docid": "51f599f14f441fb287d5b3e930f8eb86", "score": "0.6474563", "text": "function setextHeading(eat, value, silent) {\n var self = this;\n var now = eat.now();\n var length = value.length;\n var index = -1;\n var subvalue = '';\n var content;\n var queue;\n var character;\n var marker;\n var depth;\n\n /* Eat initial indentation. */\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== C_SPACE || index >= MAX_HEADING_INDENT) {\n index--;\n break;\n }\n\n subvalue += character;\n }\n\n /* Eat content. */\n content = queue = '';\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (character === C_NEWLINE) {\n index--;\n break;\n }\n\n if (character === C_SPACE || character === C_TAB) {\n queue += character;\n } else {\n content += queue + character;\n queue = '';\n }\n }\n\n now.column += subvalue.length;\n now.offset += subvalue.length;\n subvalue += content + queue;\n\n /* Ensure the content is followed by a newline and a\n * valid marker. */\n character = value.charAt(++index);\n marker = value.charAt(++index);\n\n if (character !== C_NEWLINE || !SETEXT_MARKERS[marker]) {\n return;\n }\n\n subvalue += character;\n\n /* Eat Setext-line. */\n queue = marker;\n depth = SETEXT_MARKERS[marker];\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== marker) {\n if (character !== C_NEWLINE) {\n return;\n }\n\n index--;\n break;\n }\n\n queue += character;\n }\n\n if (silent) {\n return true;\n }\n\n return eat(subvalue + queue)({\n type: 'heading',\n depth: depth,\n children: self.tokenizeInline(content, now)\n });\n}", "title": "" }, { "docid": "7263d03784399e4655875bd38e3e99d9", "score": "0.6416916", "text": "function heading(state, startLine, endLine, silent) {\n var ch, level, tmp,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos >= max) { return false; }\n\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x23/* # */ || pos >= max) { return false; }\n\n // count heading level\n level = 1;\n ch = state.src.charCodeAt(++pos);\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++;\n ch = state.src.charCodeAt(++pos);\n }\n\n if (level > 6 || (pos < max && ch !== 0x20/* space */)) { return false; }\n\n if (silent) { return true; }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipCharsBack(max, 0x20, pos); // space\n tmp = state.skipCharsBack(max, 0x23, pos); // #\n if (tmp > pos && state.src.charCodeAt(tmp - 1) === 0x20/* space */) {\n max = tmp;\n }\n\n state.line = startLine + 1;\n\n state.tokens.push({ type: 'heading_open',\n hLevel: level,\n lines: [ startLine, state.line ],\n level: state.level\n });\n\n // only if header is not empty\n if (pos < max) {\n state.tokens.push({\n type: 'inline',\n content: state.src.slice(pos, max).trim(),\n level: state.level + 1,\n lines: [ startLine, state.line ],\n children: []\n });\n }\n state.tokens.push({ type: 'heading_close', hLevel: level, level: state.level });\n\n return true;\n }", "title": "" }, { "docid": "cca74e7a1f52c182a3627f27fed9d2d1", "score": "0.61381", "text": "function heading(node) {\n var self = this\n var depth = node.depth\n var setext = self.options.setext\n var closeAtx = self.options.closeAtx\n var content = self.all(node).join('')\n var prefix\n\n if (setext && depth < 3) {\n return (\n content + lineFeed + repeat(depth === 1 ? equalsTo : dash, content.length)\n )\n }\n\n prefix = repeat(numberSign, node.depth)\n\n return prefix + space + content + (closeAtx ? space + prefix : '')\n}", "title": "" }, { "docid": "5562f0511811ce287d1bab43ce3bfb98", "score": "0.61311203", "text": "function findHeading(tokens) {\n const headings = [];\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i];\n if (token.type === 'heading') {\n if (token.depth === 1) {\n return token.text;\n }\n if (!headings[token.depth]) {\n headings[token.depth] = token.text;\n }\n }\n }\n\n return headings.reverse().pop();\n}", "title": "" }, { "docid": "af2f6b5d3bbf201a56ebe2be70b9ba7e", "score": "0.6084034", "text": "function heading(node) {\n var self = this;\n var depth = node.depth;\n var setext = self.options.setext;\n var closeAtx = self.options.closeAtx;\n var content = self.all(node).join('');\n var prefix;\n\n if (setext && depth < 3) {\n return (\n content + lineFeed$p + repeatString(depth === 1 ? equalsTo$2 : dash$6, content.length)\n )\n }\n\n prefix = repeatString(numberSign$3, node.depth);\n\n return prefix + space$j + content + (closeAtx ? space$j + prefix : '')\n}", "title": "" }, { "docid": "af1471db8856360a4cf3e7fd9f9b61c2", "score": "0.6024642", "text": "function HeadingTitle(txt) \n{\n var h = new Heading(txt, \"\", 18, ALIGN_CENTER );\n h.fBold = true;\n h.setTitle(true);\n return h;\n}", "title": "" }, { "docid": "a85b718909224840015d35301300096a", "score": "0.59718895", "text": "heading (...args) {\n const options = getAttribs(args)\n const level = options.level || 1\n delete options.level\n this.tag(`h${level}`, ...args)\n }", "title": "" }, { "docid": "8261fd0ea9b62f2fdda9d9872bca5fa0", "score": "0.5733648", "text": "set trueHeading(value) {}", "title": "" }, { "docid": "20c63bb2f2a1c28ca8ff495af97a2721", "score": "0.5697396", "text": "headers(m, p, s) {\n let id = s.replace(/\\s/g, \"-\").toLowerCase();\n let n = p.length;\n return `<h${n} id=\"${id}\">${s}</h${n}>`; \n }", "title": "" }, { "docid": "78401fa6f237e9cba57b906af58ab0ae", "score": "0.5659256", "text": "function tokenPart(token){\n var part = makePartSpan(token.value); \n part.className = token.style;\n return part;\n }", "title": "" }, { "docid": "4bea7f80edef53a464e965171ed572b9", "score": "0.5560543", "text": "function setH1HeadingStyle(doc) {\n doc.setFontSize(pdf.h1FontSize);\n doc.setTextColor(72, 72, 72);\n return doc;\n}", "title": "" }, { "docid": "54aef0039a8df540f114f9a0934e9f46", "score": "0.5558525", "text": "function getHeaderTag(text, size) {\n let fullTag = '<h' + size + '>' + text + '</h' + size + '>';\n return fullTag;\n }", "title": "" }, { "docid": "3437edd7a05dad088a6559bdcd8d802c", "score": "0.5541661", "text": "get trueHeading() {}", "title": "" }, { "docid": "b3f0e8500731bfa60e2af6b7431ef016", "score": "0.5489088", "text": "function HeaderTokenizer() {\n // Call the Stream.Transform constructor\n Stream.Transform.call(this);\n\n // Initialize state\n this.state = this.states.FIELD_NAME;\n this.currentToken = {type: 'field_name', value: \"\"};\n\n // If someone attaches a new event listener for the 'done' event after\n // we are already in the DONE state, then just re-fire the event.\n this.on('newListener', function(name, listener) {\n if (name === 'done' && this.state === this.states.DONE) {\n listener();\n }\n });\n}", "title": "" }, { "docid": "09a5c2b53014ad786d6b22bcddb98f7e", "score": "0.54346174", "text": "function GetHeading(node,tag) {\n // Create and populate the heading node\n var level = GetHeadingLevel(node);\n var id = BeginInitObj(node,\"heading\");\n AddToIndex(id,\"content\");\n document[\"nodes\"][id][\"level\"] = level;\n \n GetText(node,id,tag,'content');\n }", "title": "" }, { "docid": "8937a0102525ac929912d0f476dae3d9", "score": "0.54121774", "text": "function getHeaderTag(text, size) {\n if (text.constructor === String && size.constructor === String) {\n return '<h' + size + '>' + text + '</h' + size + '>';\n } else {\n return 'Try again';\n }\n}", "title": "" }, { "docid": "5bf22014bfdd40d3c4956e5c8d09f555", "score": "0.5392328", "text": "* Heading () {\n let text = yield\n debugger\n return `_${text.join('')}_`\n }", "title": "" }, { "docid": "5521dae1247e07a80d5816a9a5f0862a", "score": "0.53734124", "text": "function render_heading(text, level) {\n var prepend = ''\n\n if (level == 1) {\n h1_count += 1\n if (h1_count == 1) {\n debug('Remove first H1, the article title: %s', text)\n return ''\n } else {\n debug('Skip TOC tracking for H1 header: %s', text)\n }\n } else if (level > 3) {\n debug('Skip TOC tracking for minor header: H%s', level)\n } else {\n // Figure out the TOC link. The href is usually normalized text, except if that conflicts with a prior heading.\n var slug = text.toLowerCase().replace(/[^\\w]+/g, '-');\n if (! slugs[slug]) {\n // This is the first time this name was generated.\n slugs[slug] = 1\n } else {\n // The name collides with a previous one. Add the suffix and bump it for next time.\n slug = slug + '-' + slugs[slug]\n slugs[slug] += 1\n }\n\n var span = '<span class=\"header-link\"></span>'\n var anchor = '<a name=\"'+slug+'\">' + span + '</a>'\n prepend = anchor\n\n // Figure out where this goes on the TOC.\n if (level == 2)\n headings.push({text:text, href:slug, children:[]})\n else if (level == 3) {\n var parent = headings[headings.length - 1]\n parent.children.push({text:text, href:slug, children:[]})\n }\n }\n\n // The first section must have the TOC inserted above it. So, for the first H2, set a CSS\n // class \"first-section\" so that it can be found and have the TOC prepended.\n var css = ''\n if (level == 2 && headings.length == 1)\n css = ' class=\"first-section\"'\n\n var header = prepend + '<h'+level + css+'>' + text + '</h'+level+'>'\n debug('Render heading %s %j: %s', level, text, header)\n return header\n }", "title": "" }, { "docid": "4d5d6b35a1136f26a017b5e352c9f4a2", "score": "0.53661597", "text": "function setHeader3Style(paragraph) {\n paragraph.setHeading(DocumentApp.ParagraphHeading.HEADING3);\n}", "title": "" }, { "docid": "5379afcedc6c190d3148b2c539841bc5", "score": "0.52646875", "text": "function heading(ctx, node) {\n var depth = node.depth;\n\n var content = all_1(ctx, node);\n\n var headings = ctx.headings || defaultHeadings;\n var fn = headings[node.depth - 1];\n\n if (typeof fn !== 'function') {\n throw new Error(\"Cannot compile heading of depth \".concat(depth, \": not a function\"));\n }\n\n return fn(content);\n}", "title": "" }, { "docid": "6a3a205c9e8f177a7521737bed0d8605", "score": "0.5257198", "text": "function getHeading(feature) {\n let heading = 0.0\n if (feature.hasOwnProperty(\"properties\")) {\n let notdone = true\n HEADING_PROPERTIES.forEach(function(prop) {\n if (feature.properties.hasOwnProperty(prop) && notdone) { // has rotation\n let r = parseFloat(feature.properties[prop])\n if (!isNaN(r)) {\n heading = r\n notdone = false\n }\n }\n })\n } else {\n console.warn(\"Style::getHeading\", \"feature has no heading properties\", feature)\n }\n return heading\n}", "title": "" }, { "docid": "05bc4902b6d11d0c6c85b177b6461189", "score": "0.5230151", "text": "function textToken(content) {\n return new Token(0 /* Text */, content);\n}", "title": "" }, { "docid": "cc7b684809a620dd08d9821904e76f4b", "score": "0.5229653", "text": "getHeading() {\n return this.heading || 0;\n }", "title": "" }, { "docid": "083caedacb487625b8cf4016c9236aeb", "score": "0.5224858", "text": "function tokenizeHan(sentence){\n // console.log('Han Sentence:', sentence);\n const words = sentence.split('');\n // console.log('Han Words:', words);\n return words;\n}", "title": "" }, { "docid": "9d047d3f94056ed7404ad6f16679996c", "score": "0.51719683", "text": "function getSentenceToken(word) {\n const wordValue = flexUtils.getWordValue(word);\n\n let type = 'txt';\n if (isPunctuation(word)) {\n if (isStartPunctuation(wordValue)) {\n type = 'start';\n } else {\n type = 'end';\n }\n }\n\n return {'value': wordValue, 'type': type};\n}", "title": "" }, { "docid": "7f7de26c61beaae508bca44cf42ff78c", "score": "0.5169802", "text": "function atxHeading(eat, value, silent) {\n\t var self = this;\n\t var settings = self.options;\n\t var length = value.length + 1;\n\t var index = -1;\n\t var now = eat.now();\n\t var subvalue = '';\n\t var content = '';\n\t var character;\n\t var queue;\n\t var depth;\n\n\t /* Eat initial spacing. */\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (character !== C_SPACE && character !== C_TAB) {\n\t index--;\n\t break;\n\t }\n\n\t subvalue += character;\n\t }\n\n\t /* Eat hashes. */\n\t depth = 0;\n\n\t while (++index <= length) {\n\t character = value.charAt(index);\n\n\t if (character !== C_HASH) {\n\t index--;\n\t break;\n\t }\n\n\t subvalue += character;\n\t depth++;\n\t }\n\n\t if (depth > MAX_ATX_COUNT) {\n\t return;\n\t }\n\n\t if (\n\t !depth ||\n\t (!settings.pedantic && value.charAt(index + 1) === C_HASH)\n\t ) {\n\t return;\n\t }\n\n\t length = value.length + 1;\n\n\t /* Eat intermediate white-space. */\n\t queue = '';\n\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (character !== C_SPACE && character !== C_TAB) {\n\t index--;\n\t break;\n\t }\n\n\t queue += character;\n\t }\n\n\t /* Exit when not in pedantic mode without spacing. */\n\t if (\n\t !settings.pedantic &&\n\t queue.length === 0 &&\n\t character &&\n\t character !== C_NEWLINE\n\t ) {\n\t return;\n\t }\n\n\t if (silent) {\n\t return true;\n\t }\n\n\t /* Eat content. */\n\t subvalue += queue;\n\t queue = '';\n\t content = '';\n\n\t while (++index < length) {\n\t character = value.charAt(index);\n\n\t if (!character || character === C_NEWLINE) {\n\t break;\n\t }\n\n\t if (\n\t character !== C_SPACE &&\n\t character !== C_TAB &&\n\t character !== C_HASH\n\t ) {\n\t content += queue + character;\n\t queue = '';\n\t continue;\n\t }\n\n\t while (character === C_SPACE || character === C_TAB) {\n\t queue += character;\n\t character = value.charAt(++index);\n\t }\n\n\t while (character === C_HASH) {\n\t queue += character;\n\t character = value.charAt(++index);\n\t }\n\n\t while (character === C_SPACE || character === C_TAB) {\n\t queue += character;\n\t character = value.charAt(++index);\n\t }\n\n\t index--;\n\t }\n\n\t now.column += subvalue.length;\n\t now.offset += subvalue.length;\n\t subvalue += content + queue;\n\n\t return eat(subvalue)({\n\t type: 'heading',\n\t depth: depth,\n\t children: self.tokenizeInline(content, now)\n\t });\n\t}", "title": "" }, { "docid": "62554d5571a9729f56fef0ba36961afb", "score": "0.5165344", "text": "function HTMLH1HeadingElement() {}", "title": "" }, { "docid": "8af84bdf2b794eb19eaf64c1b1572c2d", "score": "0.51609117", "text": "function displayHeaders() {\n headerLines.forEach((headerLine) => {\n if (headerLine.length == 0) {\n insertBlankLine();\n return;\n }\n const newHeader = document.createElement(\"p\");\n newHeader.classList.add(\"header\");\n newHeader.insertAdjacentHTML(\n \"afterbegin\",\n `<span class=\"line\" spellcheck=\"false\">${headerLine}</span>`\n );\n myConsole.appendChild(newHeader);\n });\n insertBlankLine();\n}", "title": "" }, { "docid": "f040d37f8871961a88e622ed91ae5956", "score": "0.515913", "text": "function atxHeading(eat, value, silent) {\n var self = this;\n var settings = self.options;\n var length = value.length + 1;\n var index = -1;\n var now = eat.now();\n var subvalue = '';\n var content = '';\n var character;\n var queue;\n var depth;\n\n /* Eat initial spacing. */\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== C_SPACE && character !== C_TAB) {\n index--;\n break;\n }\n\n subvalue += character;\n }\n\n /* Eat hashes. */\n depth = 0;\n\n while (++index <= length) {\n character = value.charAt(index);\n\n if (character !== C_HASH) {\n index--;\n break;\n }\n\n subvalue += character;\n depth++;\n }\n\n if (depth > MAX_ATX_COUNT) {\n return;\n }\n\n if (\n !depth ||\n (!settings.pedantic && value.charAt(index + 1) === C_HASH)\n ) {\n return;\n }\n\n length = value.length + 1;\n\n /* Eat intermediate white-space. */\n queue = '';\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (character !== C_SPACE && character !== C_TAB) {\n index--;\n break;\n }\n\n queue += character;\n }\n\n /* Exit when not in pedantic mode without spacing. */\n if (\n !settings.pedantic &&\n queue.length === 0 &&\n character &&\n character !== C_NEWLINE\n ) {\n return;\n }\n\n if (silent) {\n return true;\n }\n\n /* Eat content. */\n subvalue += queue;\n queue = content = '';\n\n while (++index < length) {\n character = value.charAt(index);\n\n if (!character || character === C_NEWLINE) {\n break;\n }\n\n if (\n character !== C_SPACE &&\n character !== C_TAB &&\n character !== C_HASH\n ) {\n content += queue + character;\n queue = '';\n continue;\n }\n\n while (character === C_SPACE || character === C_TAB) {\n queue += character;\n character = value.charAt(++index);\n }\n\n while (character === C_HASH) {\n queue += character;\n character = value.charAt(++index);\n }\n\n while (character === C_SPACE || character === C_TAB) {\n queue += character;\n character = value.charAt(++index);\n }\n\n index--;\n }\n\n now.column += subvalue.length;\n now.offset += subvalue.length;\n subvalue += content + queue;\n\n return eat(subvalue)({\n type: 'heading',\n depth: depth,\n children: self.tokenizeInline(content, now)\n });\n}", "title": "" }, { "docid": "e606e86bb0f2d6cca4c5f08d5ad7cd77", "score": "0.5133125", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "e606e86bb0f2d6cca4c5f08d5ad7cd77", "score": "0.5133125", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "e606e86bb0f2d6cca4c5f08d5ad7cd77", "score": "0.5133125", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "7a30a733e185fd5d71737bd6b1aab03a", "score": "0.5131614", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"␍\" : \"␤\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "54c139b52230c17d69456fbbb2f8de6b", "score": "0.5130679", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND ||\n tn === $.COMMAND || tn === $.LINK || tn === $.META) {\n p._appendElement(token, NS.HTML);\n }\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "be8906fd6f8fcc6ed248b3bd66e7b3e2", "score": "0.51222825", "text": "function startTagInHead(p, token) {\n var tn = token.tagName;\n\n if (tn === $.HTML)\n startTagInBody(p, token);\n\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\n p._appendElement(token, NS.HTML);\n\n else if (tn === $.TITLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\n\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\n //<noscript> as a rawtext.\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\n\n else if (tn === $.SCRIPT)\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\n\n else if (tn === $.TEMPLATE) {\n p._insertTemplate(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n }\n\n else if (tn !== $.HEAD)\n tokenInHead(p, token);\n}", "title": "" }, { "docid": "05cb75ba951cbd0e74e6a9675106ea52", "score": "0.5120232", "text": "function renderHeading(text) {\n return `<h2>${text}</h2>`;\n}", "title": "" }, { "docid": "53f72eafbeb0a63bc0c1f26b2019ae7e", "score": "0.5117903", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (text) {\n var content, displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text, special = builder.cm.state.specialChars, mustWrap = !1;\n if (special.test(text)) {\n content = document.createDocumentFragment();\n for (var pos = 0; ;) {\n special.lastIndex = pos;\n var m = special.exec(text), skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n ie && ie_version < 9 ? content.appendChild(elt(\"span\", [ txt ])) : content.appendChild(txt), \n builder.map.push(builder.pos, builder.pos + skipped, txt), builder.col += skipped, \n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n var txt$1 = void 0;\n if (\"\\t\" == m[0]) {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\")), txt$1.setAttribute(\"role\", \"presentation\"), \n txt$1.setAttribute(\"cm-text\", \"\\t\"), builder.col += tabWidth;\n } else \"\\r\" == m[0] || \"\\n\" == m[0] ? (txt$1 = content.appendChild(elt(\"span\", \"\\r\" == m[0] ? \"␍\" : \"␤\", \"cm-invalidchar\")), \n txt$1.setAttribute(\"cm-text\", m[0]), builder.col += 1) : (txt$1 = builder.cm.options.specialCharPlaceholder(m[0]), \n txt$1.setAttribute(\"cm-text\", m[0]), ie && ie_version < 9 ? content.appendChild(elt(\"span\", [ txt$1 ])) : content.appendChild(txt$1), \n builder.col += 1);\n builder.map.push(builder.pos, builder.pos + 1, txt$1), builder.pos++;\n }\n } else builder.col += text.length, content = document.createTextNode(displayText), \n builder.map.push(builder.pos, builder.pos + text.length, content), ie && ie_version < 9 && (mustWrap = !0), \n builder.pos += text.length;\n if (builder.trailingSpace = 32 == displayText.charCodeAt(text.length - 1), style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n startStyle && (fullStyle += startStyle), endStyle && (fullStyle += endStyle);\n var token = elt(\"span\", [ content ], fullStyle, css);\n return title && (token.title = title), builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }\n }", "title": "" }, { "docid": "53f72eafbeb0a63bc0c1f26b2019ae7e", "score": "0.5117903", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (text) {\n var content, displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text, special = builder.cm.state.specialChars, mustWrap = !1;\n if (special.test(text)) {\n content = document.createDocumentFragment();\n for (var pos = 0; ;) {\n special.lastIndex = pos;\n var m = special.exec(text), skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n ie && ie_version < 9 ? content.appendChild(elt(\"span\", [ txt ])) : content.appendChild(txt), \n builder.map.push(builder.pos, builder.pos + skipped, txt), builder.col += skipped, \n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n var txt$1 = void 0;\n if (\"\\t\" == m[0]) {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\")), txt$1.setAttribute(\"role\", \"presentation\"), \n txt$1.setAttribute(\"cm-text\", \"\\t\"), builder.col += tabWidth;\n } else \"\\r\" == m[0] || \"\\n\" == m[0] ? (txt$1 = content.appendChild(elt(\"span\", \"\\r\" == m[0] ? \"␍\" : \"␤\", \"cm-invalidchar\")), \n txt$1.setAttribute(\"cm-text\", m[0]), builder.col += 1) : (txt$1 = builder.cm.options.specialCharPlaceholder(m[0]), \n txt$1.setAttribute(\"cm-text\", m[0]), ie && ie_version < 9 ? content.appendChild(elt(\"span\", [ txt$1 ])) : content.appendChild(txt$1), \n builder.col += 1);\n builder.map.push(builder.pos, builder.pos + 1, txt$1), builder.pos++;\n }\n } else builder.col += text.length, content = document.createTextNode(displayText), \n builder.map.push(builder.pos, builder.pos + text.length, content), ie && ie_version < 9 && (mustWrap = !0), \n builder.pos += text.length;\n if (builder.trailingSpace = 32 == displayText.charCodeAt(text.length - 1), style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n startStyle && (fullStyle += startStyle), endStyle && (fullStyle += endStyle);\n var token = elt(\"span\", [ content ], fullStyle, css);\n return title && (token.title = title), builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }\n }", "title": "" }, { "docid": "97bbc8e9169c26b7e0462e95e66b6786", "score": "0.5115574", "text": "function startTagInHead(p, token) {\r\n var tn = token.tagName;\r\n\r\n if (tn === $.HTML)\r\n startTagInBody(p, token);\r\n\r\n else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META)\r\n p._appendElement(token, NS.HTML);\r\n\r\n else if (tn === $.TITLE)\r\n p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);\r\n\r\n //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse\r\n //<noscript> as a rawtext.\r\n else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE)\r\n p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);\r\n\r\n else if (tn === $.SCRIPT)\r\n p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);\r\n\r\n else if (tn === $.TEMPLATE) {\r\n p._insertTemplate(token, NS.HTML);\r\n p.activeFormattingElements.insertMarker();\r\n p.framesetOk = false;\r\n p.insertionMode = IN_TEMPLATE_MODE;\r\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\r\n }\r\n\r\n else if (tn !== $.HEAD)\r\n tokenInHead(p, token);\r\n}", "title": "" }, { "docid": "5d98fc07c3e6da9b0bc2fef160abe9e3", "score": "0.5109104", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "title": "" }, { "docid": "eb9460ea8df5afb208e63644a1addde3", "score": "0.51070815", "text": "function white() {\n \n var c = walker.ch,\n token = '',\n conf = getConf();\n \n while (c === \" \" || c === \"\\t\") {\n token += c;\n c = walker.nextChar();\n }\n \n tokener(token, 'white', conf);\n \n }", "title": "" }, { "docid": "02a66bdde8c000a7d80150b061ab72b4", "score": "0.5104956", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "02a66bdde8c000a7d80150b061ab72b4", "score": "0.5104956", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "041f6a54498eb1ae00b2fbe5f8416651", "score": "0.5083342", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) {\n return;\n }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars,\n mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) {\n mustWrap = true;\n }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt]));\n } else {\n content.appendChild(txt);\n }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) {\n break;\n }\n pos += skipped + 1;\n var txt$1 = void 0;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize,\n tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? '\\u240D' : '\\u2424', \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt$1]));\n } else {\n content.appendChild(txt$1);\n }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) {\n fullStyle += startStyle;\n }\n if (endStyle) {\n fullStyle += endStyle;\n }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) {\n token.title = title;\n }\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "e70eb45dc6bf167e21d45c081273d204", "score": "0.5082877", "text": "function heading(ctx, node) {\n var depth = node.depth;\n\n var content = require('../all')(ctx, node);\n\n var headings = ctx.headings || defaultHeadings;\n var fn = headings[node.depth - 1];\n\n if (typeof fn !== 'function') {\n throw new Error(\"Cannot compile heading of depth \".concat(depth, \": not a function\"));\n }\n\n return fn(content);\n}", "title": "" }, { "docid": "e8484bdaa718985e1076cadf0c5401c6", "score": "0.5082728", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "title": "" }, { "docid": "e8484bdaa718985e1076cadf0c5401c6", "score": "0.5082728", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "title": "" }, { "docid": "345b76631f2ae5e9bdfcc85620b31ca4", "score": "0.50683284", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "9f7f707944d675cc22827fda44c705a6", "score": "0.5062663", "text": "function inferTitle (contents) {\n const marked = require('marked')\n var tokens = marked.lexer(contents.toString())\n\n for (let i in tokens) {\n const token = tokens[i]\n if (token.type === 'heading') return stripMarkdown(token.text)\n }\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "57d8c0bd009e2b607431fb6cca5c8009", "score": "0.50601435", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "title": "" }, { "docid": "829dcf1df59e59682aef26055867dd7f", "score": "0.5057181", "text": "function createHeadline( headline, cb ) {\n var words = headline.split( \" \" ),\n newWords = [],\n i = 0,\n hasName = false;\n\n async.whilst(\n function() { return i < words.length; },\n function( callback ) {\n if( /*!isNumeric( words[i] ) &&*/ isCapitalized( words[i] ) ) {\n // removepunctuation: converts \"stalin!?\" --> [\"stalin\", \"!\", \"?\"]\n var p = removePunctuation( words[i] );\n var word = p[0];\n var punctuationString = \"\";\n\n if( p.length > 1 ) {\n for( var j=1; j<p.length; j++) {\n punctuationString += p[j];\n }\n }\n\n wordType( word, function( result ) {\n var replace = \"\";\n switch( result ) {\n case \"DICTIONARY\":\n replace = word + punctuationString;\n break;\n case \"PLACE\":\n replace = \"PLACE\" + punctuationString;\n hasName = true;\n break;\n case \"NAME\":\n replace = \"NAME\" + punctuationString;\n hasName = true;\n break;\n default:\n replace = word + punctuationString;\n break;\n } \n newWords.push( replace );\n i++;\n callback();\n });\n\n } else {\n newWords.push( words[i] );\n i++;\n callback();\n }\n },\n function( err ) {\n var sentence = processSentence( newWords );\n\n console.log( headline ); // -- original\n console.log( sentence ); // -- new\n if( !hasName ) {\n return cb( null );\n } else {\n return cb( sentence );\n }\n }\n );\n}", "title": "" }, { "docid": "4b09674cb2e605fdf1f50b5c41183172", "score": "0.50493354", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "cc02daa1ff675ce4f7049088810f46ae", "score": "0.50390303", "text": "function startTagInHead(p, token) {\n const tn = token.tagName;\n\n if (tn === $$4.HTML) {\n startTagInBody(p, token);\n } else if (tn === $$4.BASE || tn === $$4.BASEFONT || tn === $$4.BGSOUND || tn === $$4.LINK || tn === $$4.META) {\n p._appendElement(token, NS$1.HTML);\n token.ackSelfClosing = true;\n } else if (tn === $$4.TITLE) {\n p._switchToTextParsing(token, tokenizer.MODE.RCDATA);\n } else if (tn === $$4.NOSCRIPT) {\n if (p.options.scriptingEnabled) {\n p._switchToTextParsing(token, tokenizer.MODE.RAWTEXT);\n } else {\n p._insertElement(token, NS$1.HTML);\n p.insertionMode = IN_HEAD_NO_SCRIPT_MODE;\n }\n } else if (tn === $$4.NOFRAMES || tn === $$4.STYLE) {\n p._switchToTextParsing(token, tokenizer.MODE.RAWTEXT);\n } else if (tn === $$4.SCRIPT) {\n p._switchToTextParsing(token, tokenizer.MODE.SCRIPT_DATA);\n } else if (tn === $$4.TEMPLATE) {\n p._insertTemplate(token, NS$1.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = IN_TEMPLATE_MODE;\n p._pushTmplInsertionMode(IN_TEMPLATE_MODE);\n } else if (tn === $$4.HEAD) {\n p._err(errorCodes.misplacedStartTagForHeadElement);\n } else {\n tokenInHead(p, token);\n }\n }", "title": "" }, { "docid": "eff6e8f5f97d76c14bbf9dcea2c79868", "score": "0.50357926", "text": "function createID(heading) {\n\theading.id = heading.textContent.replace(/\\W+/g, '-').toLowerCase();\n}", "title": "" }, { "docid": "738feab4e168edcab9cad2bb8e3abd6f", "score": "0.50357044", "text": "function token(text, type) { return ({text: text, type: type}); }", "title": "" }, { "docid": "e4ca7e451d07ea0417af2b48381a6e40", "score": "0.50242394", "text": "set heading(heading) {\n this.lookAtImpl({ heading });\n }", "title": "" }, { "docid": "e4ca7e451d07ea0417af2b48381a6e40", "score": "0.50242394", "text": "set heading(heading) {\n this.lookAtImpl({ heading });\n }", "title": "" }, { "docid": "ea6aec131477feb2e319408f4f229b81", "score": "0.5021883", "text": "getFormattedTokens(inputText, formattingOptions) {\n /**\n * Choose options in this order:\n * 1. The provided options\n * 2. The options from this instance property\n * 3. The default options\n */\n let options = FormattingOptions_1.normalizeOptions(Object.assign(Object.assign({}, this.formattingOptions), formattingOptions));\n let { tokens } = brighterscript_1.Lexer.scan(inputText, {\n includeWhitespace: true\n });\n let parser = brighterscript_1.Parser.parse(\n //strip out whitespace because the parser can't handle that\n tokens.filter(x => x.kind !== brighterscript_1.TokenKind.Whitespace));\n if (options.formatMultiLineObjectsAndArrays) {\n tokens = this.formatMultiLineObjectsAndArrays(tokens);\n }\n if (options.compositeKeywords) {\n tokens = this.formatCompositeKeywords(tokens, options);\n }\n tokens = this.formatKeywordCase(tokens, options);\n if (options.removeTrailingWhiteSpace) {\n tokens = this.formatTrailingWhiteSpace(tokens, options);\n }\n if (options.formatInteriorWhitespace) {\n tokens = this.formatInteriorWhitespace(tokens, parser, options);\n }\n //dedupe side-by-side Whitespace tokens\n this.dedupeWhitespace(tokens);\n if (options.formatIndent) {\n tokens = this.formatIndentation(tokens, options, parser);\n }\n return tokens;\n }", "title": "" }, { "docid": "2da1b6940c6a714975b35ba6aca191c9", "score": "0.5015402", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false\n var content\n if (!special.test(text)) {\n builder.col += text.length\n content = document.createTextNode(displayText)\n builder.map.push(builder.pos, builder.pos + text.length, content)\n if (ie && ie_version < 9) { mustWrap = true }\n builder.pos += text.length\n } else {\n content = document.createDocumentFragment()\n var pos = 0\n while (true) {\n special.lastIndex = pos\n var m = special.exec(text)\n var skipped = m ? m.index - pos : text.length - pos\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n else { content.appendChild(txt) }\n builder.map.push(builder.pos, builder.pos + skipped, txt)\n builder.col += skipped\n builder.pos += skipped\n }\n if (!m) { break }\n pos += skipped + 1\n var txt$1 = (void 0)\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n txt$1.setAttribute(\"role\", \"presentation\")\n txt$1.setAttribute(\"cm-text\", \"\\t\")\n builder.col += tabWidth\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n txt$1.setAttribute(\"cm-text\", m[0])\n builder.col += 1\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n txt$1.setAttribute(\"cm-text\", m[0])\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n else { content.appendChild(txt$1) }\n builder.col += 1\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1)\n builder.pos++\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\"\n if (startStyle) { fullStyle += startStyle }\n if (endStyle) { fullStyle += endStyle }\n var token = elt(\"span\", [content], fullStyle, css)\n if (title) { token.title = title }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content)\n}", "title": "" }, { "docid": "2da1b6940c6a714975b35ba6aca191c9", "score": "0.5015402", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false\n var content\n if (!special.test(text)) {\n builder.col += text.length\n content = document.createTextNode(displayText)\n builder.map.push(builder.pos, builder.pos + text.length, content)\n if (ie && ie_version < 9) { mustWrap = true }\n builder.pos += text.length\n } else {\n content = document.createDocumentFragment()\n var pos = 0\n while (true) {\n special.lastIndex = pos\n var m = special.exec(text)\n var skipped = m ? m.index - pos : text.length - pos\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n else { content.appendChild(txt) }\n builder.map.push(builder.pos, builder.pos + skipped, txt)\n builder.col += skipped\n builder.pos += skipped\n }\n if (!m) { break }\n pos += skipped + 1\n var txt$1 = (void 0)\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n txt$1.setAttribute(\"role\", \"presentation\")\n txt$1.setAttribute(\"cm-text\", \"\\t\")\n builder.col += tabWidth\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n txt$1.setAttribute(\"cm-text\", m[0])\n builder.col += 1\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n txt$1.setAttribute(\"cm-text\", m[0])\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n else { content.appendChild(txt$1) }\n builder.col += 1\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1)\n builder.pos++\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\"\n if (startStyle) { fullStyle += startStyle }\n if (endStyle) { fullStyle += endStyle }\n var token = elt(\"span\", [content], fullStyle, css)\n if (title) { token.title = title }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content)\n}", "title": "" }, { "docid": "40059d267ea34bb3e4dddde53fad68b8", "score": "0.501479", "text": "function parseToken(token) {\n if (token.type === 'paragraph_open') {\n return '<p>';\n } else if (token.type === 'paragraph_close') {\n return '</p>';\n } else if (token.type === 'softbreak') {\n return '\\n';\n } else if (token.type === 'text') {\n return `<span md-inline=\"plain\">${token.content}</span>`;\n } else if (token.type.indexOf('open') > -1) {\n return `<span md-inline=\"${token.type}\"><span class=\"md-meta md-before\">${token.markup}</span><${token.tag}>`;\n } else if (token.type.indexOf('close') > -1) {\n const closeMarkup =\n/* headTags.includes(token.tag)\n ? ''\n : token.markup;*/\n token.markup;\n return `</${token.tag}><span class=\"md-meta md-after\">${closeMarkup}</span></span>`;\n } else if (token.type === 'html_block') {\n return token.content;\n }\n return '';\n}", "title": "" }, { "docid": "186e682a5366e8de57d3e1adce2b0818", "score": "0.50094813", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "title": "" }, { "docid": "8a57a19b32dbb53ab2c5043eb52a185d", "score": "0.5003332", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false\n var content\n if (!special.test(text)) {\n builder.col += text.length\n content = document.createTextNode(displayText)\n builder.map.push(builder.pos, builder.pos + text.length, content)\n if (ie && ie_version < 9) { mustWrap = true }\n builder.pos += text.length\n } else {\n content = document.createDocumentFragment()\n var pos = 0\n while (true) {\n special.lastIndex = pos\n var m = special.exec(text)\n var skipped = m ? m.index - pos : text.length - pos\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n else { content.appendChild(txt) }\n builder.map.push(builder.pos, builder.pos + skipped, txt)\n builder.col += skipped\n builder.pos += skipped\n }\n if (!m) { break }\n pos += skipped + 1\n var txt$1 = void 0\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n txt$1.setAttribute(\"role\", \"presentation\")\n txt$1.setAttribute(\"cm-text\", \"\\t\")\n builder.col += tabWidth\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n txt$1.setAttribute(\"cm-text\", m[0])\n builder.col += 1\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n txt$1.setAttribute(\"cm-text\", m[0])\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n else { content.appendChild(txt$1) }\n builder.col += 1\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1)\n builder.pos++\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\"\n if (startStyle) { fullStyle += startStyle }\n if (endStyle) { fullStyle += endStyle }\n var token = elt(\"span\", [content], fullStyle, css)\n if (title) { token.title = title }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content)\n}", "title": "" }, { "docid": "52122ca240b7c7254c7e83b2d0f71e91", "score": "0.5000999", "text": "function FormatToken (token, type) {\nthis.token=token;\nthis.type=type;\n}", "title": "" }, { "docid": "fa9003e5feae65787d7f870eb261ca08", "score": "0.5000998", "text": "function tokenize() {\n\n var ch = walker.ch;\n \n if (ch === \" \" || ch === \"\\t\") {\n return white();\n }\n\n if (ch === '/') {\n return comment();\n } \n\n if (ch === '\"' || ch === \"'\") {\n return str();\n }\n \n if (ch === '(') {\n return brace();\n }\n \n if (ch === '-' || ch === '.' || isDigit(ch)) { // tricky - char: minus (-1px) or dash (-moz-stuff)\n return num();\n }\n \n if (isNameChar(ch)) {\n return identifier();\n }\n\n if (isOp(ch)) {\n return op();\n }\n \n if (ch === \"\\n\") {\n tokener(\"line\");\n walker.nextChar();\n return;\n }\n \n throw error(\"Unrecognized character\");\n }", "title": "" }, { "docid": "293ba089b93ea6e52fe1d0b1673fd53c", "score": "0.49898374", "text": "function FormatToken (token, type) {\n\tthis.token=token;\n\tthis.type=type;\n}", "title": "" }, { "docid": "c70416712ba521eda331e39980db6bd0", "score": "0.49807143", "text": "function white() {\n\t\n\t\tvar c = walker.ch,\n\t\t\ttoken = '',\n\t\t\tconf = getConf();\n\t\n\t\twhile (c === \" \" || c === \"\\t\") {\n\t\t\ttoken += c;\n\t\t\tc = walker.nextChar();\n\t\t}\n\t\n\t\ttokener(token, 'white', conf);\n\t\n\t}", "title": "" }, { "docid": "89ce8bec1ff9daaa913ab448677a830d", "score": "0.49800184", "text": "get headerTextStyle() {\n if (this.i.au == null) {\n return null;\n }\n return this.i.au.fontString;\n }", "title": "" }, { "docid": "ba12955b7dadb180db36b945ba2e00cd", "score": "0.49775857", "text": "function Heading() {\n\treturn React.createElement(\n\t\t'div',\n\t\t{ id: 'headingWrap' },\n\t\tReact.createElement('div', { id: 'heading1' }),\n\t\tReact.createElement('div', { id: 'heading2' })\n\t);\n}", "title": "" }, { "docid": "d95b954a4bc4bcefae240fd35d558a4d", "score": "0.49572122", "text": "static get tag(){return\"topic-heading\"}", "title": "" }, { "docid": "1a423d291ee8af1d643a3ceaa2b31e43", "score": "0.49540368", "text": "function Heading({ title }) {\n return (\n <Text style={{ fontSize: 18, fontWeight: '700', color: 'rgba(32,32,32,1.0)' }}>{title.toUpperCase()}</Text>\n );\n}", "title": "" }, { "docid": "cba57d40ddfe9ba22e28529e4e59b970", "score": "0.49494278", "text": "function BannerHeading({ children }) {\n const textToArr = children.split(\" \");\n const lastWord = textToArr.pop();\n const arrToText = textToArr.join(\" \");\n\n return (\n <h2 className={styles.heading}>\n {arrToText} <span>{lastWord}</span>\n </h2>\n );\n}", "title": "" }, { "docid": "c18265cd45bb7bda0441d5aa698c2418", "score": "0.49369487", "text": "function createHeader(text)\n {\n var elem = document.createElement(\"div\");\n elem.className = \"ytd-header\";\n elem.appendChild(document.createTextNode(text));\n return elem;\n }", "title": "" }, { "docid": "24c0d0105dc69b440cb364c5ff516e1a", "score": "0.4934129", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "title": "" }, { "docid": "ca96f78b3f0724e26a40bd836c54d905", "score": "0.49270576", "text": "function tokenize() {\n\n\t\tvar ch = walker.ch;\n\t\n\t\tif (ch === \" \" || ch === \"\\t\") {\n\t\t\treturn white();\n\t\t}\n\n\t\tif (ch === '/') {\n\t\t\treturn comment();\n\t\t} \n\n\t\tif (ch === '\"' || ch === \"'\") {\n\t\t\treturn str();\n\t\t}\n\t\t\n\t\tif (ch === '(') {\n\t\t\treturn brace();\n\t\t}\n\t\n\t\tif (ch === '-' || ch === '.' || isDigit(ch)) { // tricky - char: minus (-1px) or dash (-moz-stuff)\n\t\t\treturn num();\n\t\t}\n\t\n\t\tif (isNameChar(ch)) {\n\t\t\treturn identifier();\n\t\t}\n\n\t\tif (isOp(ch)) {\n\t\t\treturn op();\n\t\t}\n\t\t\n\t\tif (ch === \"\\n\") {\n\t\t\ttokener(\"line\");\n\t\t\twalker.nextChar();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tthrow error(\"Unrecognized character\");\n\t}", "title": "" }, { "docid": "08d3f35a90b2184f686e260b9bd77521", "score": "0.4921868", "text": "CreateH(headtype, text, className, id) {\n let h1 = this.CreateElement(headtype);\n h1.innerText = text;\n h1.className = className;\n h1.id = id;\n return h1;\n }", "title": "" }, { "docid": "d9b13aed28f86afd1944b5fc6bb551db", "score": "0.49162838", "text": "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) { return }\n\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n\t var special = builder.cm.state.specialChars, mustWrap = false\n\t var content\n\t if (!special.test(text)) {\n\t builder.col += text.length\n\t content = document.createTextNode(displayText)\n\t builder.map.push(builder.pos, builder.pos + text.length, content)\n\t if (ie && ie_version < 9) { mustWrap = true }\n\t builder.pos += text.length\n\t } else {\n\t content = document.createDocumentFragment()\n\t var pos = 0\n\t while (true) {\n\t special.lastIndex = pos\n\t var m = special.exec(text)\n\t var skipped = m ? m.index - pos : text.length - pos\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n\t if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n\t else { content.appendChild(txt) }\n\t builder.map.push(builder.pos, builder.pos + skipped, txt)\n\t builder.col += skipped\n\t builder.pos += skipped\n\t }\n\t if (!m) { break }\n\t pos += skipped + 1\n\t var txt$1 = (void 0)\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n\t txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n\t txt$1.setAttribute(\"role\", \"presentation\")\n\t txt$1.setAttribute(\"cm-text\", \"\\t\")\n\t builder.col += tabWidth\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n\t txt$1.setAttribute(\"cm-text\", m[0])\n\t builder.col += 1\n\t } else {\n\t txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n\t txt$1.setAttribute(\"cm-text\", m[0])\n\t if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n\t else { content.appendChild(txt$1) }\n\t builder.col += 1\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt$1)\n\t builder.pos++\n\t }\n\t }\n\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\"\n\t if (startStyle) { fullStyle += startStyle }\n\t if (endStyle) { fullStyle += endStyle }\n\t var token = elt(\"span\", [content], fullStyle, css)\n\t if (title) { token.title = title }\n\t return builder.content.appendChild(token)\n\t }\n\t builder.content.appendChild(content)\n\t}", "title": "" }, { "docid": "e28c157abccd1e7791eb5f41d22a1d46", "score": "0.49110022", "text": "execute(){\n\t \tif (this.editor.isTextSelected()){\n\t \t\tthis.editor.execCommand('heading', this.heading_num);\n\t \t}\n\t }", "title": "" } ]
e5c1f29390f9a9ea9ec921646c6d9149
Solido en el movimiento
[ { "docid": "b9d6ef8a2e968ba652d1f51befaff610", "score": "0.0", "text": "function constrainCandyMovement(event, candyDrag) {\n\tcandyDrag.position.top = Math.min(100, candyDrag.position.top);\n\tcandyDrag.position.bottom = Math.min(100, candyDrag.position.bottom);\n\tcandyDrag.position.left = Math.min(100, candyDrag.position.left);\n\tcandyDrag.position.right = Math.min(100, candyDrag.position.right);\n}", "title": "" } ]
[ { "docid": "33b8515ddc35c72849fbc0c9fba42fa8", "score": "0.7301709", "text": "function actualiza_ultima_coronacion(){\n\n cambiar_fen(ultimo_moviento_coronacion_fen);\n \n if(ulimo_moviento_coronacion)\n { \n moviento_interno(ulimo_moviento_coronacion.from,ulimo_moviento_coronacion.to);\n \n board.position(game.fen(),false);\n \n \n// console.info(\"actualiza_ultima_coronacion----->\");\n// console.info(ulimo_moviento_coronacion);\n// console.info(ultimo_moviento_coronacion_fen);\n }\n \n \n }", "title": "" }, { "docid": "5f7318bc417ed4055f07c7e9a8d1613f", "score": "0.6909611", "text": "function Movimiento() {\n\t//El error era aqui\n\tPelotita.x += Pelotita.velocidad_x;\n\tPelotita.y += Pelotita.velocidad_y;\n\t//Choco con la parte inferior o superior\n\tif (Pelotita.y - Pelotita.r === 0 || Pelotita.y + Pelotita.r === height) {\n\t\tPelotita.velocidad_y *= -1\n\n\t}\n\t//Choca con la paleta izquierda\n\tif (Pelotita.x - Pelotita.r == 100 &&\n\n\t\t(Pelotita.y > PaletaIzqY && Pelotita.y < PaletaIzqY + 100)\n\t) {\n\t\tPelotita.velocidad_x *= -1;\n\t}\n\t//Choca con la paleta derecha\n\n\tif (Pelotita.x + Pelotita.r == width - 100 &&\n\t\t(Pelotita.y > derechaY && Pelotita.y < derechaY + 100)\n\t) {\n\t\tPelotita.velocidad_x *= -1;\n\t}\n\t//Se supone que esta funcion la dibuja :(\n\t\t//Checar Anotaciones\n\tif (Pelotita.x == 0) {\n\t\tconsole.log(\"Punto Paleta Derecha\")\n marcadorDer++;\n\t\tPelotita.x=width/2;\n\t\tPelotita.y=width/2;\n\t} else if (Pelotita.x == width) {\n\t\tconsole.log(\"Punto Paleta Izquierda\")\n marcadorIzq++;\n\t\tPelotita.x=width/2\n\t\tPelotita.y=width/2\n\t\t//Dibujar una nueva pelota y y++\n\t}\n\tPelota(Pelotita.x, Pelotita.y, Pelotita.r);\n\n\n\n\n}", "title": "" }, { "docid": "e1b49dcfdb795dacfac6d2b922122c92", "score": "0.6751148", "text": "function comprobar(){\n if(jugando = true){\n \n if(objeto.x>puntaje.x) {\n \n if(objeto.x<(puntaje.x+puntaje.tamaño)){\n puntos += 1;\n }else{\n vidas -= 1;\n }\n \n }else{\n if((objeto.x+objeto.tamaño)<(puntaje.x+puntaje.tamaño)){\n \n if((objeto.x+objeto.tamaño)>puntaje.x){\n puntos += 1;\n }else{\n vidas -= 1;\n }\n \n }else{\n vidas -= 1;\n }\n }\n \n \n }\n}", "title": "" }, { "docid": "d90908493331e840b5f95cdabdc10d38", "score": "0.6543588", "text": "function mostrarSolucion(){\n\ttexto='';\n\n\tjuego.movimientos.forEach(function(mov){\n\t\ttexto+='\\t'+mov.toString()+'\\n';\n\t});\n\t\n\trespuesta=confirm('Los movimientos originales aplicados fueron:\\n'+texto+'\\n¿Desea ejecutar la solucion?');\n\t\n\tif(respuesta){\n\t\treiniciar();\n\t\tsolucion=juego.movimientos.reverse();\n\t\tinversas={'FilaDerecha': clickIzquierda,'FilaIzquierda': clickDerecha, 'ColumnaAbajo': clickArriba, 'ColumnaArriba': clickAbajo}\n\t\tsolucion.forEach(function(mov,index){\n\t\t\t\n\t\t\t\tsetTimeout(function(m){ \n\t\t\t\t\t//~ return function(){ m.revertir(juego);}\n\t\t\t\t\treturn function(){ (inversas[m.constructor.name])(m.numero,false);}\n\t\t\t\t}(mov)\n\t\t\t,2000*index);\n\t\t\t\n\t\t});\n\t}\n\n}", "title": "" }, { "docid": "1afae27ecebed8d80ff29068c1f4a258", "score": "0.652103", "text": "function movimientopajaros(){\n\t\n\tpajaros.forEachAlive(function(item) {\n\t\t\n\t\tif (item.y < 10 || item.body.velocity < 0) {\n\t\t\titem.animations.play('abajo');\n\t\t\titem.body.velocity.y = 100;\n\n\t\t}\n\n\t\tif (item.y > 185 || item.body.velocity > 0) {\n\t\t\titem.animations.play('arriba');\n\t\t\titem.body.velocity.y = -100;\n\t\t}\n\t}, this);\n\t\n}", "title": "" }, { "docid": "6ff6e96e894b67e073dfca9cea1e70ff", "score": "0.64825994", "text": "calcularMovimientos(numero) {\n\n this.actualizarPosicionActualHeroe();\n let limites = this.posicionEnLimites(this.posicionActualHeroe);\n\n let dcha = parseInt(this.posicionActualHeroe) + numero;\n let izq = parseInt(this.posicionActualHeroe) - numero;\n let up = parseInt(this.posicionActualHeroe) -(numero*10);\n let down = parseInt(this.posicionActualHeroe) + (numero * 10);\n\n let coordenadas = { izquierda: izq, derecha: dcha, arriba: up, abajo: down }\n\n return this.coordenadasEnLimites(coordenadas, limites);\n\n }", "title": "" }, { "docid": "22b62238d9f99cd4cd20c1d19805a8b6", "score": "0.6476784", "text": "function movimentacaoCarro() {\n keyboard.update();\n //rotaciona as rodas\n if (keyboard.pressed(\"left\") && anguloX > anguloEsquerdoMaximo) {\n rodaDianteiraDireita.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloPadrao))\n );\n rodaDianteiraEsquerda.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloPadrao))\n );\n anguloX = rodaDianteiraDireita.matrix.elements[0] + 0.1;\n flagVirandoparaEsquerda = 1;\n flagVirandoparaDireita = 0;\n }\n if (keyboard.pressed(\"right\") && anguloX < anguloDireitoMaximo) {\n rodaDianteiraDireita.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloPadrao))\n );\n rodaDianteiraEsquerda.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloPadrao))\n );\n anguloX = rodaDianteiraDireita.matrix.elements[0] - 0.1;\n flagVirandoparaDireita = 1;\n flagVirandoparaEsquerda = 0;\n }\n\n if (\n !keyboard.pressed(\"left\") &&\n flagVirandoparaEsquerda == 1 &&\n anguloX <= 0\n ) {\n rodaDianteiraDireita.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloPadrao))\n );\n rodaDianteiraEsquerda.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloPadrao))\n );\n anguloX = rodaDianteiraDireita.matrix.elements[0] - 0.1;\n }\n\n if (\n !keyboard.pressed(\"right\") &&\n flagVirandoparaDireita == 1 &&\n anguloX >= 0\n ) {\n rodaDianteiraDireita.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloPadrao))\n );\n rodaDianteiraEsquerda.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloPadrao))\n );\n anguloX = rodaDianteiraDireita.matrix.elements[0] + 0.1;\n }\n\n //altera o modo da câmera\n if (keyboard.down(\"space\")) changeCameraMode();\n\n //impede a movimentação do carro no modo inspeção.\n if (inspect === false) {\n //console.log(\"1\");\n\n var position = new THREE.Vector3();\n var quaternion = new THREE.Quaternion();\n var scale = new THREE.Vector3();\n camera.matrixAutoUpdate = true;\n\n chassi.matrixWorld.decompose(position, quaternion, scale);\n window.addEventListener(\"wheel\", onMouseWheel, true);\n // o carro move para direcao do angulo em relacao a X\n if (keyboard.pressed(\"up\")) {\n flagDesaceleracaoAutomatica = 1;\n if (speed > 0 && flagDesaceleracaoManual == 2) {\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(-anguloX), -speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloX * 3))\n );\n speed = speed - 0.01;\n }\n\n if (speed <= 0.1) {\n flagDesaceleracaoManual = 1;\n }\n\n if (flagDesaceleracaoManual == 1 && !keyboard.pressed(\"down\")) {\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(anguloX), speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloX * 3))\n );\n if (speed <= 1.4) {\n speed = speed + 0.01;\n }\n }\n }\n if (keyboard.pressed(\"down\")) {\n flagDesaceleracaoAutomatica = 2;\n if (speed > 0 && flagDesaceleracaoManual == 1) {\n console.log('entrei if 1 ');\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(anguloX), speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloX * 3))\n );\n speed = speed - 0.01;\n }\n\n if (speed <= 0.1) {\n console.log('entrei if 2 ');\n flagDesaceleracaoManual = 2;\n }\n\n if (flagDesaceleracaoManual == 2 && !keyboard.pressed(\"up\")) {\n console.log('entrei if 3');\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(-anguloX), -speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloX * 3))\n );\n if (speed <= 0.4) {\n speed = speed + 0.01;\n }\n }\n }\n\n //Desacelera o carro quando não estiver apertando o acelerador\n if (!keyboard.pressed(\"up\") && !keyboard.pressed(\"down\")) {\n if (speed >= 0.1 && flagDesaceleracaoAutomatica == 1) {\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(anguloX), speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(-anguloX * 3))\n );\n speed = speed - 0.007;\n }\n\n if (speed >= 0.1 && flagDesaceleracaoAutomatica == 2) {\n chassi.matrix.multiply(\n mat4.makeTranslation(degreesToRadians(-anguloX), -speed, 0)\n );\n chassi.matrix.multiply(\n mat4.makeRotationZ(degreesToRadians(anguloX * 3))\n );\n speed = speed - 0.007;\n }\n }\n\n if (modoCamera === 2) {\n camera.lookAt(position);\n }\n MatrixGlobal.copy(chassi.matrix);\n }\n }", "title": "" }, { "docid": "82171507bc6ba4f6716eee2eed41ad9e", "score": "0.6405758", "text": "function muestraDatosVacunaMadrid(dosis) {\n //poblacion total de la comunidad de madrid para calcular los porcentajes\n let poblacionMadrid = 6779888;\n //se formatea el numero para la cifra salga con punto\n let numeroFormateado = new Intl.NumberFormat().format(dosis[13].dosisEntregadas);\n //se calcula el porcentaje de dosis entregadas sobre la poblacion de madrid\n let porcentajeEntregadas = trunc((dosis[13].dosisEntregadas * 100) / poblacionMadrid, 3);\n //se formatea el numero para la cifra salga con punto\n let dosisAdministradas = new Intl.NumberFormat().format(dosis[13].dosisAdministradas);\n //se calcula el porcentaje de dosis administradas sobre la poblacion de madrid\n let porcentPoblacionMadridAdministradas = trunc((dosis[13].dosisAdministradas * 100) / poblacionMadrid, 3);\n //se calcula el porcentaje de adimistradas sobre las entregadas\n let porcentajeAdministradasSobreTotal = (dosis[13].dosisAdministradas * 100) / dosis[13].dosisEntregadas;\n porcentajeAdministradasSobreTotal = trunc(porcentajeAdministradasSobreTotal, 2);\n\n //se formatea el numero para la cifra salga con punto\n let dosDosis = new Intl.NumberFormat().format(dosis[13].dosisPautaCompletada);\n //porcentaje de dos dosis administradas sobre el total administradas (solo una dosis)\n let porcentajePautaCompletadas = trunc(((dosis[13].dosisPautaCompletada * 100) / dosis[13].dosisAdministradas), 2);\n //porcentaje de gente con la pauta completada sobre la poblacion de madrid\n let porcentajeCompletTotal = trunc(((dosis[13].dosisPautaCompletada * 100) / poblacionMadrid), 2);\n\n //se recogen los elementos html donde se van a mostrar los datos\n let dosisDistribuidas = document.getElementById(\"dosisDistribuidas\");\n let porcentajeDosisEntregadas = document.getElementById(\"porcentajeDosisEntregadas\");\n let dosisAdministradasTotal = document.getElementById(\"dosisAdministradas\");\n let porcentajeMadridAdministradas = document.getElementById(\"porcentajePoblacionAdministradas\");\n let porcentajeAdministradasTotal = document.getElementById(\"porcentajeAdministradasTotal\");\n let pautaCompleta = document.getElementById(\"pautaCompleta\");\n let porcentajeCompletas = document.getElementById(\"porcentajeCompletas\");\n let porcenSobreTotalCompletas = document.getElementById(\"porcenSobreTotalCompletas\");\n\n //se muestran los datos\n dosisDistribuidas.innerHTML = numeroFormateado;\n porcentajeDosisEntregadas.innerHTML = porcentajeEntregadas\n dosisAdministradasTotal.innerHTML = dosisAdministradas;\n porcentajeMadridAdministradas.innerHTML = porcentPoblacionMadridAdministradas;\n porcentajeAdministradasTotal.innerHTML = porcentajeAdministradasSobreTotal;\n pautaCompleta.innerHTML = dosDosis\n porcentajeCompletas.innerHTML = porcentajePautaCompletadas;\n porcenSobreTotalCompletas.innerHTML = porcentajeCompletTotal;\n\n}", "title": "" }, { "docid": "da964cbc8a781e366e84c1273435594d", "score": "0.63869286", "text": "function enviarPartida(){\t\t\n\t\t\n\t\t// Recupero la planilla entera\n\t\tvar tabla = $(\"#planilla\").text();\n\n\t\tvar movimiento = \"\";\n\t\tvar negras = \"\";\n\t\tvar blancasMove = \"\";\n\t\tvar negrasMove = \"\";\n\t\tvar jugadas1 = []; \n\t\tvar jugadas2 = []; \n\n\t\t// Corto \n\t\tvar jugadas = tabla.split(\" \");\n\n\t\t// Añado al array\n\t\tfor (var i = 5; i < (jugadas.length-1); i++) {\n\t\t\tjugadas1.push(jugadas[i]);\t\t\n\t\t}\n\n\t\t// Con este for lo que logro es que solo se guarden la posicion del arrya que tiene un guion.\n\t\tfor (var i = 0; i < jugadas1.length; i++) {\n\t\t\tvar descarteNegativos = jugadas1[i] , substring = \"-\";\n\t\t\tif(descarteNegativos.indexOf(substring) != -1){\n\t\t\t\tif (jugadas1[i] % 2 != 0) {\n\t\t\t\t\t// Guardo todas las jugadas en un string\n\t\t\t\t\tmovimiento = movimiento + \" \" + jugadas1[i];\n\t\t\t\t}\t\t\t\n\t\t\t}\n\t\t}\n\t\t// Corto por la separacion.\n\t\tvar jugadas = movimiento.split(\" \");\n\n\t\tfor (var i = 1; i < jugadas.length; i++) {\n\t\t\tif (i % 2 == 0) {\n\t\t\t\tnegrasMove = negrasMove + \" \" + jugadas[i];\n\t\t\t}else{\n\t\t\t\tblancasMove = blancasMove + \" \" + jugadas[i];\n\t\t\t}\n\t\t}\n\n\t\t// Añado jugadores.\n\t\tvar jugadores = $(\"#jugadores\")[0].innerText;\n\t\tvar jugador = jugadores.split(\"\t\");\n\t\tvar jBlancas = jugador[1];\n\t\tvar jNegras = jugador[2];\n\t\t\n\t\t$(\"#jBlancas\").attr(\"value\", jBlancas);\n\t\t$(\"#jNegras\").attr(\"value\", jNegras);\n\n\t\t// Añado movimientos.\n\t\t$(\"#aBlancas\").attr(\"value\", blancasMove);\n\t\t$(\"#aNegras\").attr(\"value\", negrasMove);\n\n\t\tconsole.log(jugadas1);\n\t\t// Añado resultado.\t\n\t\tvar result = $(\"#resultado\")[0].innerText;\n\t\t$(\"#aRes\").attr(\"value\", result);\n\t}", "title": "" }, { "docid": "258eeca1b0692b9ad8cf948c6c415ff4", "score": "0.6380207", "text": "function jugar(pulsacion) {\n\n if (aciertos_totales != aciertos) {\n // control de posicion de letras si hay una o mas\n var posicion = [];\n var letra_actual = 'nada';\n // miro si la letra esta en la palabra y si lo esta guardo su posicion en\n // un array y la letra que es AQUI MIRO SI ESTA LA LETRA O NO\n for (i = 0; i <= letras.length; i++) {\n if (letras[i] === pulsacion) {\n posicion.push(i + 1);\n letra_actual = letras[i];\n }\n }\n \n // miro si el for fue bien y acertamos la letra\n if (letra_actual != 'nada') {\n // si hay mas de una letra\n if (posicion.length > 1) {\n for (i = 0; i < posicion.length; i++) {\n // creo cadena del selector\n let posicion_letra = \".letra:nth-child(\" + posicion[i] + \")\";\n $(posicion_letra)[0].innerHTML = letra_actual;\n $(posicion_letra).addClass(\"adivinado\");\n }\n // sumo todos los aciertos\n aciertos_totales += posicion.length;\n // vacio las posiciones\n posicion = [];\n // elimino la letra actual\n letra_actual = '';\n \n } else {\n let posicion_letra = \".letra:nth-child(\" + posicion[0] + \")\";\n $(posicion_letra)[0].innerHTML = letra_actual;\n $(posicion_letra).addClass(\"adivinado\");\n aciertos_totales += 1;\n \n }\n // quito evento al cual hago click\n $(\".\" + pulsacion).addClass(\"correcto\").unbind(\"click\");\n \n // si no esta \n } else {\n // sumo un fallo\n fallos += 1;\n $(\".fallo\")[0].innerHTML = fallos;\n // creo la sentencia con la que trabajo\n let query = $(\".\" + pulsacion);\n query.addClass(\"error\").unbind(\"click\").css(\"cursor\", \"default\");\n \n // llamo la funcion pintar con los fallos \n pintar(fallos);\n }\n }\n\n // si he ganado o no\n if (aciertos_totales === aciertos) {\n resultado = \"¡Muy bien, has ganado!\";\n $(\".resultado\")[0].innerHTML = resultado;\n }\n\n\n\n }", "title": "" }, { "docid": "605921a97cf959f5e6a9ff7efd810755", "score": "0.6340754", "text": "function asignarPuntos(juego, player, seleccion){\n console.log('asignarPuntos');\n var operador1 = 0;\n var puntos = 0;\n//otorgo un valor al operador 1, segun el tipo de juego, \n//del 1 al 6 los ptjes son multiplos del dado que sale, puntaje sera igual a la cantidad de dados con mismo nro por el dado que sale\n//los otros tipos de juego ej escalera u otros son multiplos de 5, a cada juego le otrogo un numero de operador lo * 5 en caso de servido, \n//si fuera no servido a esa resultado de servido se le resta 5\n switch(juego){\n case 1: operador1 = 1; break;\n case 2: operador1 = 2; break;\n case 3: operador1 = 3; break;\n case 4: operador1 = 4; break;\n case 5: operador1 = 5; break;\n case 6: operador1 = 6; break;\n case 7: operador1 = 5; break;\n case 8: operador1 = 7; break;\n case 9: operador1 = 9; break;\n case 10: operador1 = 11; break;\n case 11: operador1 = 13; break;\n };\n\n switch(seleccion){\n case \"Servido\": puntos = operador1 * 5; break;\n case \"No Servido\": puntos = operador1 * 5 - 5; break;\n case \"Tachar\": puntos = 0; break;\n case \"Uno\": puntos = operador1 * 1; break;\n case \"Dos\": puntos = operador1 * 2; break;\n case \"Tres\": puntos = operador1 * 3; break;\n case \"Cuatro\": puntos = operador1 * 4; break;\n case \"Cinco\": puntos = operador1 * 5; break;\n case \"Seis\": puntos = operador1 * 6; break;\n };\n//los puntos que calcule recien, los asigno a una posicion en el array determinada por jugador y por juego ej: jugador 1 posee posicion 0\n\n arrayPuntos[player-1][juego-1] = puntos;\n\n var texto = \"\";//esto es para el caso en el que los puntos sean 0 se asigna\"x\" a la variable texto y sino se asiga los puntos\n if(seleccion==\"Tachar\"){texto = \"x\"}else{texto = puntos};\n $$(\"#anJ\" + juego + \"P\" + player).text(texto);\n//pone el puntaje del jdor 1 y 2 en los botones respectivos de cada columna\n calcularPuntaje();\n $$(\"#anTotP1\").text(puntajePlayer1);\n $$(\"#anTotP2\").text(puntajePlayer2);\n }", "title": "" }, { "docid": "bbd0a985f94254bc00cc9673e1d3166e", "score": "0.6319849", "text": "function posicionMensajeTurno(jugadorActivo, fichaActiva) {\n // Cambio valores\n jugador = jugadorActivo\n // si es la primera vez que se tira\n if (jugador.posicion == 1) { jugador.posicion = 1 + resultadoDado }\n else { jugador.posicion = jugador.posicion + resultadoDado }\n\n if (jugador.parar > 0) { pararj1 }\n // comprobamos en que casilla ha caido\n switch (jugador.posicion) {\n // si se llega hasta el final\n case (jugador.posicion > 63): $(mensaje).text(jugador.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n case 63: $(mensaje).text(jugador.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n break\n // caso de laberinto\n case 42: $(mensaje).text(jugador.nombre + \" ha muerto\"); mostrarmensaje(); setTimeout(muertej1, 2000);\n break;\n // caso de laberinto\n case 42: $(mensaje).text(jugador.nombre + \" ha caido en el laberinto\"); mostrarmensaje(); setTimeout(laberintoj1, 2000);\n break;\n // caso de carcel\n case 52: $(mensaje).text(jugador.nombre + \" ha sido detenid@\"); mostrarmensaje(); setTimeout(pararj1(2), 2000);\n break;\n // caso de posada\n case 19: $(mensaje).text(jugador.nombre + \" se ha tomado un descanso\"); mostrarmensaje(); setTimeout(pararj1(1), 2000);\n break;\n // caso de puente\n case 6: $(mensaje).text(jugador.nombre + \": De manifestación en manifestación hasta la liberación! \"); mostrarmensaje(); setTimeout(puentj1, 2000);\n break;\n // casos de oca a oca\n case 5: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 9: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 14: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 18: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 23: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 27: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 32: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 36: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 41: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 45: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 50: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 54: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 59: $(mensaje).text(jugador.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n }\n\n if (jugador.posicion < 63) { $('#area' + jugador.posicion).append($(fichaActiva)), 10000 }\n else { $('#area63').append($(fichaActiva)); }\n }", "title": "" }, { "docid": "27cb4e8852334ef50da62725d1a6a2d4", "score": "0.6319727", "text": "function calculoPosicion() {\n let costoTelaXMetro = parseInt(document.getElementById(\"costotela\").value);\n let costoCordonXMetro = parseInt(\n document.getElementById(\"costocordon\").value\n );\n let cantidadBolsas = parseInt(\n document.getElementById(\"cantidadbolsas\").value\n );\n let anchoBolsa = parseInt(document.getElementById(\"anchobolsa\").value);\n let largoBolsa = parseInt(document.getElementById(\"largobolsa\").value);\n let anchoTela = parseInt(document.getElementById(\"anchotela\").value);\n let largoTela = 1000;\n let anchoEnAncho = 0;\n for (let i = anchoBolsa; i <= anchoTela; i += anchoBolsa) {\n anchoEnAncho++;\n }\n console.log(anchoEnAncho);\n let largoEnAncho = 0;\n for (let k = largoBolsa; k <= anchoTela; k += largoBolsa) {\n largoEnAncho++;\n }\n let anchoEnLargo = 0;\n for (let m = anchoBolsa; m <= largoTela; m += anchoBolsa) {\n anchoEnLargo++;\n }\n let anchoEnLargoFinal = parseInt(anchoEnLargo / 10);\n let largoEnLargo = 0;\n for (let o = largoBolsa; o <= largoTela; o += largoBolsa) {\n largoEnLargo++;\n }\n let largoEnLargoFinal = parseInt(largoEnLargo / 10);\n //Obtiene la cantidad de bolsas en 1 metro de tela y calcula la mejor opcion de corte.\n let ancho = anchoEnAncho * largoEnLargoFinal;\n let anchoOLargo = \"\";\n let soloValor;\n if (largoBolsa > anchoTela) {\n let anchoIf = anchoEnAncho * largoEnLargoFinal;\n anchoOLargo = \"ancho. Salen: \" + anchoIf + \" bolsas.\";\n soloValor = ancho;\n cantidadTela(\n soloValor,\n anchoEnAncho,\n largoBolsa,\n cantidadBolsas,\n costoTelaXMetro,\n largoEnLargoFinal\n );\n } else {\n let largo = anchoEnLargoFinal * largoEnAncho;\n if (ancho > largo) {\n anchoOLargo = \"ancho. Salen: \" + ancho + \" bolsas.\";\n soloValor = ancho;\n console.log(ancho);\n cantidadTela(\n soloValor,\n anchoEnAncho,\n largoBolsa,\n cantidadBolsas,\n costoTelaXMetro,\n largoEnLargoFinal\n );\n } else {\n anchoOLargo = \"largo. Salen: \" + largo + \" bolsas.\";\n soloValor = largo;\n cantidadTela(\n soloValor,\n largoEnAncho,\n anchoBolsa,\n cantidadBolsas,\n costoTelaXMetro,\n anchoEnLargoFinal\n );\n }\n }\n let opcionCorte = document.getElementById(\"opcioncorte\");\n let mensajeCorte = document.getElementById(\"mejorcorte\");\n mensajeCorte.innerHTML = \"Mejor corte a lo \" + anchoOLargo;\n console.log(anchoBolsa, costoCordonXMetro);\n if (costoCordonXMetro > 0)\n costoCordonUtilizado(anchoBolsa, costoCordonXMetro, cantidadBolsas);\n console.log(costoCordonTotal);\n costoGrifasUtilizadas(cantidadBolsas);\n costoHiloUsado(cantidadBolsas);\n costoManoDeObra(anchoBolsa, largoBolsa, cantidadBolsas);\n costoTotalCotizacion(\n costoTelaUsadaF,\n costoHiloNecesario,\n costoCordonTotal,\n costoGrifasTotal,\n costoManoDeObraASumar\n );\n}", "title": "" }, { "docid": "8d7d7f2681d05517731b28fcfb1aaddc", "score": "0.63076514", "text": "function movimientoseta(){\n\t\t\n\tsetas.forEachAlive(function(item) {\n\t\t\n\t\tif(item.body.velocity.x >= 0){\n\t\t\titem.body.velocity.x = -35;\n\t\t\treturn;\n\t\t} \n\t\t\t\n\t\tif(item.body.velocity.x <= 0){\n\t\t\titem.body.velocity.x = 35;\n\t\t\treturn;\n\t\t}\n\t}, this);\n\t\n}", "title": "" }, { "docid": "51e6e1557282a2bb18ea3775083e723a", "score": "0.6283706", "text": "salirsedelarea() {\n\t\tlet cabeza = this.state.cuerpoSerpiente[this.state.cuerpoSerpiente.length - 1]; //almacenamos en una variable la cabeza de la serpiente\n\t\tif (cabeza[0] >= 100 || cabeza[1] >= 100 || cabeza[0] < 0 || cabeza[1] < 0) {\n\t\t\tthis.gameover();\n\t\t}\n\t}", "title": "" }, { "docid": "8d4ee3a87ba4e7b80eda91801383d1a2", "score": "0.6265403", "text": "function pararj1(turnos) { if (turnos > 0) { jugador1.turno = 0; jugador1.parar = turnos } }", "title": "" }, { "docid": "9244024fb7c832fe70b1d5d598baba16", "score": "0.626521", "text": "serpientegolpeada() {\n\t\tlet snake = [ ...this.state.cuerpoSerpiente ];\n\t\tlet cabeza = snake[snake.length - 1];\n\t\tsnake.pop();\n\t\tsnake.forEach((punto) => {\n\t\t//comprobamos si la serpiente se golpea a si misma en cada uno de sus puntos\n\t\t\tif (cabeza[0] === punto[0] && cabeza[1] === punto[1]) {\n\t\t\t\tthis.gameover();\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "032170cd9a87177283bf2fd8c8ebebbf", "score": "0.6243111", "text": "function alArrastrar(e)\n{\n if ($(\".btn-reinicio\").text() != \"Iniciar\") {\n //obtener origen del movimiento\n var src = e.dataTransfer.getData(\"text\");\n var sr = src.split(\"_\")[1]; //origen fila\n var sc = src.split(\"_\")[2]; //origen columna\n\n //obtener destino del movimiento\n var dst = e.target.id;\n var dr = dst.split(\"_\")[1]; //destino fila\n var dc = dst.split(\"_\")[2]; //destino columna\n\n // ver si la distancia entre origen y destino es mayor que 1: movimiento inválido\n var ddx = Math.abs(parseInt(sr)-parseInt(dr));\n var ddy = Math.abs(parseInt(sc)-parseInt(dc));\n if (ddx > 1 || ddy > 1)\n {\n alert(\"Movimiento invalido! (distancia mayor a 1)\");\n return;\n }\n\n // Si Ok el movimiento, incrementar contador de movimientos y actualizarlo\n cant_movimientos += 1;\n $(\"#movimientos-text\").text(cant_movimientos)\n\n // Intercambiar las golosinas para eso utilizo temporal para no sobreescribir posiciones\n var tmp = grilla[sr][sc].src;\n grilla[sr][sc].src = grilla[dr][dc].src;\n grilla[sr][sc].o.attr(\"src\",grilla[sr][sc].src);\n grilla[dr][dc].src = tmp;\n grilla[dr][dc].o.attr(\"src\",grilla[dr][dc].src);\n\n // Buscar combinaciones ganadoras de golosinas\n destruirTernas();\n } else { // Si el juego no arrancó, indicar error\n $(\"body\").append('<div id=\"dialog\" title=\"Error\"><p>El juego no ha comenzado, \\n\\nHaz click en Iniciar!</p></div>')\n $( \"#dialog\" ).dialog();\n }\n}", "title": "" }, { "docid": "4ae549512f3b632407424b93d5368f05", "score": "0.6202739", "text": "function mover() {\n\n // si el turno es del jugador 1\n if (jugador1.turno == 1) {\n comprobarTurno();\n if (jugador1.parar > 0) {\n jugador1.turno = 0;\n jugador2.turno = 1;\n jugador1.parar = jugador1.parar - 1;\n comprobarTurno();\n\n } else {\n // asignamos los turnos\n jugador1.turno = 0;\n jugador2.turno = 1;\n comprobarTurno();\n\n // si es la primera vez que se tira\n if (jugador1.posicion == 1) { jugador1.posicion = 1 + resultadoDado }\n else { jugador1.posicion = jugador1.posicion + resultadoDado }\n\n if (jugador1.parar > 0) { pararj1 }\n // comprobamos en que casilla ha caido\n switch (jugador1.posicion) {\n // si se llega hasta el final\n case (jugador1.posicion > 63): $(mensaje).text(jugador1.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n case 63: $(mensaje).text(jugador1.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n break\n // caso de laberinto\n case 42: $(mensaje).text(jugador1.nombre + \" ha muerto\"); mostrarmensaje(); setTimeout(muertej1, 2000);\n break;\n // caso de laberinto\n case 42: $(mensaje).text(jugador1.nombre + \" ha caido en el laberinto\"); mostrarmensaje(); setTimeout(laberintoj1, 2000);\n break;\n // caso de carcel\n case 52: $(mensaje).text(jugador1.nombre + \" ha sido detenid@\"); mostrarmensaje(); setTimeout(pararj1(2), 2000);\n break;\n // caso de posada\n case 19: $(mensaje).text(jugador1.nombre + \" se ha tomado un descanso\"); mostrarmensaje(); setTimeout(pararj1(1), 2000);\n break;\n // caso de puente\n case 6: $(mensaje).text(jugador1.nombre + \": De manifestación en manifestación hasta la liberación! \"); mostrarmensaje(); setTimeout(puentj1, 2000);\n break;\n // casos de oca a oca\n case 5: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 9: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 14: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 18: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 23: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 27: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 32: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 36: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 41: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 45: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 50: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n case 54: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j1, 2000);\n break;\n case 59: $(mensaje).text(jugador1.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j1, 2000);\n break;\n }\n\n if (jugador1.posicion < 63) { $('#area' + jugador1.posicion).append($(FJ1)), 10000 }\n else { $('#area63').append($(FJ1)); }\n\n }\n $('#posicionCasilla1').text('Casilla: ' + jugador1.posicion);\n }\n /*si el turno es del jugador 2*/\n else if (jugador2.turno == 1) {\n comprobarTurno();\n if (jugador2.parar > 0) {\n if (jugadores > 2) {\n jugador2.turno = 0;\n jugador3.turno = 1;\n comprobarTurno();\n }\n } else {\n if (jugadores == 4) {\n jugador2.turno = 0;\n jugador3.turno = 1;\n comprobarTurno();\n } else if (jugadores = 2 || jugadores == 1) {\n jugador2.turno = 0;\n jugador1.turno = 1;\n comprobarTurno();\n }\n\n if (jugador2.posicion == 1) { jugador2.posicion = 1 + resultadoDado }\n else { jugador2.posicion = jugador2.posicion + resultadoDado }\n\n switch (jugador2.posicion) {\n /*si se llega hasta el final */\n case (jugador2.posicion > 63): $(mensaje).text(jugador2.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n case 63: $(mensaje).text(jugador2.nombre + \" ha llegado al FINAL\"); mostrarmensaje();\n /*casos de muerte*/\n case 58: $(mensaje).text(jugador2.nombre + \" ha muerto\"); mostrarmensaje(); setTimeout(muertej2, 2000);\n break;\n /*casos de laberinto */\n case 42: $(mensaje).text(jugador2.nombre + \" ha caido en el laberinto\"); mostrarmensaje(); setTimeout(laberintoj2, 2000);\n break;\n /*casos de carcel */\n case 52: $(mensaje).text(jugador2.nombre + \" ha sido detenido\"); mostrarmensaje(); console.log(\"carcel\"); setTimeout(pararj2(2), 2000);\n break;\n /*casos de posada*/\n case 19: $(mensaje).text(jugador2.nombre + \" se ha tomado un descanso\"); mostrarmensaje(); setTimeout(pararj2(1), 1000);\n break;\n /*casos de puente */\n case 6: $(mensaje).text(jugador2.nombre + \": De manifestación en manifestación hasta la liberación!\"); mostrarmensaje(); setTimeout(puentj2, 2000);\n break;\n /*casos de oca a oca */\n case 5: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 9: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 14: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 18: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 23: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 27: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 32: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 36: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 41: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 45: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 50: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n case 54: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j2, 2000);\n break;\n case 59: $(mensaje).text(jugador2.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j2, 2000);\n break;\n }\n\n $('#area' + jugador2.posicion).append($(FJ2));\n\n }\n $('#posicionCasilla2').text('Casilla: ' + jugador2.posicion);\n\n }\n /*si el turno es del jugador 3*/\n else if (jugador3.turno == 1) {\n comprobarTurno();\n if (jugador2.parar > 0) {\n jugador2.turno = 0;\n jugador3.turno = 1;\n comprobarTurno();\n } else {\n\n jugador3.turno = 0;\n jugador4.turno = 1;\n comprobarTurno();\n if (jugador3.posicion == 1) { jugador3.posicion = 1 + resultadoDado }\n else { jugador3.posicion = jugador3.posicion + resultadoDado }\n\n switch (jugador3.posicion) {\n /*si se llega hasta el final */\n case (jugador3.posicion > 63): $(mensaje).text(jugador3.nombre + \" ha llegado al final\"); mostrarmensaje();\n case 63: $(mensaje).text(jugador3.nombre + \" ha llegado al final\"); mostrarmensaje();\n /*casos de muerte*/\n case 58: $(mensaje).text(jugador3.nombre + \" ha muerto\"); mostrarmensaje(); setTimeout(muertej3, 2000);\n break;\n /*casos de laberinto */\n case 42: $(mensaje).text(jugador3.nombre + \" ha caido en el laberinto\"); mostrarmensaje(); setTimeout(laberintoj3, 2000);\n break;\n /*casos de carcel */\n case 52: $(mensaje).text(jugador3.nombre + \" ha sido detenid@\"); mostrarmensaje(); setTimeout(pararj3(2), 2000);\n break;\n\n /*casos de posada*/\n case 19: $(mensaje).text(jugador3.nombre + \" se ha tomado un descanso\"); mostrarmensaje(); setTimeout(pararj3(1), 2000);\n break;\n /*casos de puente */\n case 6: $(mensaje).text(jugador3.nombre + \": De manifestación en manifestación hasta la liberación!\"); mostrarmensaje(); setTimeout(puentj3, 2000);\n break;\n /*casos de oca a oca */\n case 5: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 9: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 14: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 18: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 23: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 27: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 32: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 36: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 41: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 45: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 50: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n case 54: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j3, 2000);\n break;\n case 59: $(mensaje).text(jugador3.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j3, 2000);\n break;\n }\n\n $('#area' + jugador3.posicion).append($(FJ3));\n\n }\n $('#posicionCasilla3').text('Casilla: ' + jugador3.posicion);\n\n }\n /*si el turno es del jugador 4*/\n else if (jugador4.turno == 1) {\n comprobarTurno();\n if (jugador2.parar > 0) {\n jugador2.turno = 0;\n jugador3.turno = 1;\n comprobarTurno();\n } else {\n jugador4.turno = 0;\n jugador1.turno = 1;\n comprobarTurno();\n if (jugador4.posicion == 1) { jugador4.posicion = 1 + resultadoDado }\n else { jugador4.posicion = jugador4.posicion + resultadoDado }\n\n switch (jugador4.posicion) {\n /*si se llega hasta el final */\n case (jugador4.posicion > 63): $(mensaje).text(jugador4.nombre + \" ha llegado al final\"); mostrarmensaje();\n case 63: $(mensaje).text(jugador4.nombre + \" ha llegado al final\"); mostrarmensaje();\n /*casos de muerte*/\n case 58: $(mensaje).text(jugador4.nombre + \" ha muerto\"); mostrarmensaje(); setTimeout(muertej4, 2000);\n break;\n /*casos de laberinto */\n case 42: $(mensaje).text(jugador4.nombre + \" ha caido en el laberinto\"); mostrarmensaje(); setTimeout(laberintoj4, 2000);\n break;\n /*casos de carcel */\n case 52: $(mensaje).text(jugador4.nombre + \" ha sido detenid@\"); mostrarmensaje(); setTimeout(pararj4(2), 2000);\n break;\n /*casos de posada*/\n case 19: $(mensaje).text(jugador4.nombre + \" se ha tomado un descanso\"); mostrarmensaje(); setTimeout(pararj4(1), 2000);\n break;\n /*casos de puente */\n case 6: $(mensaje).text(jugador4.nombre + \": De manifestación en manifestación hasta la liberación!\"); mostrarmensaje(); setTimeout(puentj4, 2000);\n break;\n /*casos de oca a oca */\n case 5: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 9: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 14: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 18: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 23: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 27: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 32: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 36: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 41: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 45: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 50: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n case 54: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc2j4, 2000);\n break;\n case 59: $(mensaje).text(jugador4.nombre + \": ¡De desayuno a desayuno, y si la conozco, gano uno! \"); mostrarmensaje(); setTimeout(oc1j4, 2000);\n break;\n }\n\n $('#area' + jugador4.posicion).append($(FJ4));\n\n }\n $('#posicionCasilla4').text('Casilla: ' + jugador4.posicion);\n\n }\n\n }", "title": "" }, { "docid": "7b5ffbbfc435a754a31cd63920ae4714", "score": "0.61951196", "text": "function executarRelogio() {\n\n posicaoHor += (3 / 360);\n posicaoMin += (6 / 60);\n posicaoSeg += 6;\n\n PONTEIROHORA.style.transform = \"rotate(\" + posicaoHor + \"deg)\";\n PONTEIROMINUTO.style.transform = \"rotate(\" + posicaoMin + \"deg)\";\n PONTEIROSEGUNDO.style.transform = \"rotate(\" + posicaoSeg + \"deg)\";\n}", "title": "" }, { "docid": "b6d86460cc82ef95cba52a8355a5394e", "score": "0.61950904", "text": "function movimento() {\n // Itera per ogni tasto che può essere premuto\n for (let property in listaTasti)\n switch (property) {\n case 'w':\n if (listaTasti[property])\n pl1.muoviSopra();\n break;\n case 's':\n if (listaTasti[property])\n pl1.muoviSotto();\n break;\n case 'i':\n if (listaTasti[property])\n pl2.muoviSopra();\n break;\n case 'k':\n if (listaTasti[property])\n pl2.muoviSotto();\n\n }\n}", "title": "" }, { "docid": "61e6a8649eeb95ebbe76619d1990485f", "score": "0.617686", "text": "mover(){\n //comprobacion en el enemigo-->llamo a colision \n miavatar.colision(this.x, this.y);//Le paso las posiciones del enemigo\n\n //Hago que el movimiento de los enemigos sea independiente del FPS del bucle principal\n if(this.contador<this.retraso){\n this.contador++;\n }\n else{\n this.contador=0;\n \n //Genero un numero aleatorio del 0 al 3, cada numero va a ser una direccion (derecha, izquierda, arriba, abajo)\n let direccion = Math.floor(Math.random()*4);\n\n //derecha--0\n if(direccion==0){\n if(this.x+1<tamaj && !this.esbloque(this.x+1, this.y)){\n this.x++;\n }\n }\n \n //izquierda--1\n if(direccion==1){\n if(this.x-1>=0 && !this.esbloque(this.x-1, this.y)){\n this.x--;\n } \n }\n \n //abajo--2\n if(direccion==2){\n if(this.y+1<tamai && !this.esbloque(this.x, this.y+1)){\n this.y++;\n } \n }\n \n //arriba--3\n if(direccion==3){\n if(this.y-1>=0 && !this.esbloque(this.x, this.y-1)){\n this.y--;\n }\n }\n }//fin else\n }", "title": "" }, { "docid": "9840ca3664d2fab28d11d7b20a2c5055", "score": "0.6165801", "text": "function dibujarGraficoDosisPautaCompletaMadrid(datos) {\n\n let fechas = [];\n let indiceMadridDesdeElFinal = datos.length;\n //el primer dato de madrid aparece en la posicion 7 empezando desde el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 7;\n console.log = (\"longitud datos \" + indiceMadridDesdeElFinal);\n let i = 0;\n\n while (i < 7) {\n\n let formatFecha = datos[indiceMadridDesdeElFinal];\n //la fecha en el array resultante esta en la posicion 0\n fechas.push(formatFecha[0]);\n //en el array de arrays cada dato de madrid esta cada 20 posiciones empezando desde el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 20;\n i++;\n }\n //damos la vuelta al array de fechas para que salga en orden cronologico\n fechas = fechas.reverse();\n\n i = 0;\n let longitudDosisEntregadas = datos.length;\n //el primer dato de madrid aparece en la posicion 7 empezando desde el final\n longitudDosisEntregadas = longitudDosisEntregadas - 7;\n //el array esde personas con pauta completada, aunque en el nombre aparezca 'dosis entregadas'\n let dosisEntregadas = [];\n\n while (i < 7) {\n\n let dosis = datos[longitudDosisEntregadas];\n //el dato de personas con pauta completa aparece en la posicion 7 del array resultante\n dosisEntregadas.push(dosis[7].replace('.', \"\"));\n //en el array de arrays cada dato de madrid esta cada 20 posiciones empezando desde el final\n longitudDosisEntregadas = longitudDosisEntregadas - 20;\n i++;\n }\n //damos la vuelta al array de pauta completada para que salga en orden cronologico\n dosisEntregadas.reverse();\n\n var ctx = document.getElementById('myChartMadridCompletadas').getContext('2d');\n\n dibujarGraficaLinea(ctx, fechas, dosisEntregadas, 'rgb(83, 225, 162)', 'Vacunas pauta completa Madrid');\n}", "title": "" }, { "docid": "f0b4d3f2249508c3b2f9db633bc956e4", "score": "0.61583114", "text": "arrastandoSlide(posicao) {\n this.click.salvo = posicao;\n this.slide.style.transform = `translate3d(${posicao}px, 0, 0)`;\n }", "title": "" }, { "docid": "4c0db7b40809a9830a6cb97689d799d2", "score": "0.6153202", "text": "function castigaRundaUrm(tabla,cineCastiga){\n\n//PRIMA LINIE\nif(tabla[1]==cineCastiga && tabla[2]==cineCastiga && tabla[3]==-1) return 3;\nif(tabla[2]==cineCastiga && tabla[3]==cineCastiga && tabla[1]==-1) return 1;\nif(tabla[1]==cineCastiga && tabla[3]==cineCastiga && tabla[2]==-1) return 2;\n\n//A DOUA LINIE\nif(tabla[4]==cineCastiga && tabla[5]==cineCastiga && tabla[6]==-1) return 6;\nif(tabla[4]==cineCastiga && tabla[6]==cineCastiga && tabla[5]==-1) return 5;\nif(tabla[5]==cineCastiga && tabla[6]==cineCastiga && tabla[4]==-1) return 4;\n\n//A TREIA LINIE\nif(tabla[7]==cineCastiga && tabla[8]==cineCastiga && tabla[9]==-1) return 9;\nif(tabla[7]==cineCastiga && tabla[9]==cineCastiga && tabla[8]==-1) return 8;\nif(tabla[8]==cineCastiga && tabla[9]==cineCastiga && tabla[7]==-1) return 7;\n\n//DIAGONALA 1 5 9\nif(tabla[1]==cineCastiga && tabla[5]==cineCastiga && tabla[9]==-1) return 9;\nif(tabla[1]==cineCastiga && tabla[9]==cineCastiga && tabla[5]==-1) return 5;\nif(tabla[5]==cineCastiga && tabla[9]==cineCastiga && tabla[1]==-1) return 1;\n\n//DIAGONALA 3 5 7\nif(tabla[3]==cineCastiga && tabla[5]==cineCastiga && tabla[7]==-1) return 7;\nif(tabla[3]==cineCastiga && tabla[7]==cineCastiga && tabla[5]==-1) return 5;\nif(tabla[5]==cineCastiga && tabla[7]==cineCastiga && tabla[3]==-1) return 3;\n\n//COLOANA 1 4 7\nif(tabla[1]==cineCastiga && tabla[4]==cineCastiga && tabla[7]==-1) return 7;\nif(tabla[1]==cineCastiga && tabla[7]==cineCastiga && tabla[4]==-1) return 4;\nif(tabla[7]==cineCastiga && tabla[4]==cineCastiga && tabla[1]==-1) return 1;\n\n//COLOANA 2 5 8\nif(tabla[2]==cineCastiga && tabla[5]==cineCastiga && tabla[8]==-1) return 8;\nif(tabla[2]==cineCastiga && tabla[8]==cineCastiga && tabla[5]==-1) return 5;\nif(tabla[8]==cineCastiga && tabla[5]==cineCastiga && tabla[2]==-1) return 2;\n\n//COLOANA 3 6 9\nif(tabla[3]==cineCastiga && tabla[6]==cineCastiga && tabla[9]==-1) return 9;\nif(tabla[3]==cineCastiga && tabla[9]==cineCastiga && tabla[6]==-1) return 6;\nif(tabla[9]==cineCastiga && tabla[6]==cineCastiga && tabla[3]==-1) return 3;\n\n//INTOARCE -1 DACA NU CASTIGA RUNDA URMATOARE\nreturn -1;\n}", "title": "" }, { "docid": "02a74050af728bcf5764009a17e61d8f", "score": "0.6150147", "text": "function movtortuga2(){\n\t\t\n\t\tlocura = true;\n\t\tif (tortuga2.x < 785 || tortuga2.body.velocity < 0) {\n\t\t\ttortuga2.animations.play('revote');\n\t\t\ttortuga2.body.velocity.x = 200;\n\n\t\t}\n\n\t\tif (tortuga2.x > 879 || tortuga2.body.velocity > 0) {\n\t\t\ttortuga2.animations.play('revote');\n\t\t\ttortuga2.body.velocity.x = -200;\n\t\t}\n\t}", "title": "" }, { "docid": "18578e7b832b69b50fcf05ab1db68d22", "score": "0.6128883", "text": "function movimiento() {\r\n var nx = cabeza.x + xdir;\r\n var ny = cabeza.y + ydir;\r\n cabeza.setPos(nx, ny);\r\n}", "title": "" }, { "docid": "17ae3d3c7879104f9b06589526eefe87", "score": "0.61210024", "text": "function moveBalao(){\n let posicaoBalaoY = +balao.style.top.replace('px', '');\n balao.style.top = `${posicaoBalaoY-1}px`;\n if( balao.offsetTop === -dimensaoBalao){\n balao.parentElement.removeChild(balao);\n clearInterval(posicaoBalaoDinamica);\n if( vidas !== 0 ){\n alteraVidas();\n }\n }\n }", "title": "" }, { "docid": "c07835d19f406aecbcac80b35838138a", "score": "0.61065924", "text": "moveTo()\n {\n\n for(let index of positiveObj)\n {\n if(this.sumOfMovables()<=index.calculateSpace())\n {\n this.setMovMonth(index.getTime());\n let temp = index.getExp();\n for(let value of this.getValues())\n {\n temp.push(value);\n }\n\n index.setExp(temp);\n break;\n\n\n }\n else\n {\n continue;\n }\n }\n\n if(this.getMovMonth()==undefined)\n {\n this.setMovMonth(\"Values cannot be moved!\")\n }\n\n }", "title": "" }, { "docid": "e71b69491167e4b0781cfb1ca2b61207", "score": "0.6080174", "text": "function teclaPresionada(evento){\n\t\tvar codigo=evento.which;\n\t\tswitch(codigo){\n\t\t\tcase 79:\n\t\t\t\t// Arriba jugador 2;\n\t\t\t\tmovimientos.p2.arriba=true;\n\t\t\t\tbreak;\n\t\t\tcase 75:\n\t\t\t\t// Abajo jugador 2;\n\t\t\t\tmovimientos.p2.abajo=true;\n\t\t\t\tbreak;\n\t\t\tcase 87:\n\t\t\t\t// Arriba jugador 1;\n\t\t\t\tmovimientos.p1.arriba=true;\n\t\t\t\tbreak;\n\t\t\tcase 83:\n\t\t\t\t// Abajo jugador 1;\n\t\t\t\tmovimientos.p1.abajo=true;\n\t\t\t\tbreak;\n\t\t}\n\t}", "title": "" }, { "docid": "e3df486f7697dafa00564ff14070316c", "score": "0.6071922", "text": "moverderecha(){\n if(this.x+1<tamaj && !this.esbloque(this.x+1, this.y)){\n this.x++;\n //Compruebo la casilla donde se encuentra el avatar cada vez que lo muevo\n this.comprobarcasilla();\n }\n }", "title": "" }, { "docid": "3f532e033f2974768a868959dac22ece", "score": "0.6062778", "text": "caso4(valor,x,y){\n let pos_x=this.l_vertical.buscar(x);\n let pos_y=this.l_horizontal.buscar(y);\n let nodo= new Nodo(valor,x,y);\n let agregado=false;\n //POSICIONAR EN LA COLUMNA DESEADA BUSCANDO LA FILA CORRECTA\n let current=pos_y.abajo;\n while(current!=null){\n if(current.x<x){\n current=current.abajo;\n }else{\n nodo.abajo=current;\n current.arriba.abajo=nodo;\n nodo.arriba=current.arriba;\n current.arriba=nodo;\n agregado=true;\n break;\n }\n }\n //si la fila es un numero mayor al resto se colocara de ultimo por lo cual se debe obtener el ultimo nodo\n //antes de la inserción de este.\n if(agregado==false){\n current=pos_y.abajo;\n while (current.abajo!=null){\n current=current.abajo;\n }\n current.abajo=nodo;\n nodo.arriba=current;\n }\n //POSICIONAR EN LA FILA DESEADA BUSCANDO LA COLUMNA CORRECTA\n agregado=false\n current=pos_x.der\n while(current!=null){\n if(current.y<y){\n current=current.der;\n }else{\n nodo.der=current;\n current.izq.der=nodo;\n nodo.izq=current.izq;\n current.izq=nodo;\n agregado=true;\n break;\n }\n }\n //si la fila es un numero mayor al resto se colocara de ultimo por lo cual se debe obtener el ultimo nodo\n //antes de la inserción de este.\n if(agregado==false){\n current=pos_x.der;\n while (current.der!=null){\n current=current.der;\n }\n current.der=nodo;\n nodo.izq=current;\n }\n }", "title": "" }, { "docid": "8668d7fbb9a008b77a36444c3ed222e6", "score": "0.6059719", "text": "function carrilTactil() {\n if (movil == true) {\n if (nivel.muerte == false && final == false) {\n //Botón arriba\n if (Ry <= 300 && Ry >= 200 && Rx <= 200) {\n if (carril == 1) {\n carril = 0;\n sueloP = 200;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n } else if (carril == 2) {\n carril = 1;\n sueloP = 300;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n }\n }\n //Botón abajo\n else if (Ry <= 430 && Ry >= 320 && Rx <= 200) {\n if (carril == 0) {\n carril = 1;\n sueloP = 300;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n } else if (carril == 1) {\n carril = 2;\n sueloP = 400;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n }\n }\n }\n }\n}", "title": "" }, { "docid": "696edf56ef385d9732bbce9dfa9bf324", "score": "0.6055539", "text": "function arriba() {\n if (movil == false) {\n if (sueloP == 400 && carril == 2 && nivel.muerte == false && final == false) {\n carril = 1;\n sueloP = 300;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n } else if (sueloP == 300 && carril == 1 && nivel.muerte == false && final == false) {\n carril = 0;\n sueloP = 200;\n if (heroe.saltando == false) {\n heroe.y = sueloP;\n tablaR.y = sueloP + 15;\n }\n }\n }\n}", "title": "" }, { "docid": "2280155e416e31c10a933a19d2226f15", "score": "0.6041089", "text": "function mapaMovido() {\n\tif (Sesion.errordataprov == undefined) {\n\t\tif (Sesion.actualizandoMapa) {\n\t\t\tSesion.mapaMovido = true; // pendiente de actualizar el mapa...\n\t\t\tconsole.log(\"Mapa movido: actualización de mapa pendiente...\");\n\t\t}\n\t\telse {\n\t\t\t// obtengo zoom\n\t\t\tvar zoom = Map.getZoom();\n\t\t\t// obtengo nuevo modo\n\t\t\tvar nmodo = zoom < config.zParcela? 'NOPARC' : zoom < config.zArbol? 'PARC' : 'ARB';\n\t\t\tif (nmodo === 'NOPARC' && Sesion.mostrarprovs)\n\t\t\t\tnmodo = 'PROV';\n\t\t\t// detecto si cambió el modo\n\t\t\tvar cambiomodo = !(Sesion.modo === nmodo);\n\t\t\t// guardo nuevo modo\n\t\t\tSesion.modo = nmodo;\n\t\t\t// llamo a actualizar el mapa\n\t\t\tactualizarMapa(cambiomodo);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b1a7199ebcb2a6fcd973ec1e9072171b", "score": "0.6034448", "text": "function dibujarGraficoDosisEntregadasEspaña(datos) {\n\n let fechas = [];\n let indiceMadridDesdeElFinal = datos.length;\n //el primer dato de madrid empieza en el array de arrays en la posicion 7 empezando por el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 1;\n //console.log(\"longitud datos \" + indiceMadridDesdeElFinal);\n let i = 0;\n\n while (i < 7) {\n //agregamos las fechas cada 20 posiciones\n let formatFecha = datos[indiceMadridDesdeElFinal];\n //en el array resultante la fecha esta en la posicion 0\n fechas.push(formatFecha[0]);\n //el dato de madrid esta cada 20 posiciones empezando por el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 20;\n i++;\n }\n //se le da la vuelta al array para que salga en orden cronologico\n fechas = fechas.reverse();\n\n i = 0;\n let longitudDosisEntregadas = datos.length;\n //el primer dato de madrid empieza en el array de arrays en la posicion 7 empezando por el final\n\n longitudDosisEntregadas = longitudDosisEntregadas - 1;\n //el array es de dosis administradas, aunque en el nombre figure 'entregadas'\n let dosisEntregadas = [];\n\n while (i < 7) {\n\n let dosis = datos[longitudDosisEntregadas];\n //la cifra con las dosis administradas esta en la posicion 5 del array resultante\n dosisEntregadas.push(dosis[4].replace(/[$.]/g,''));\n //el dato de madrid esta cada 20 posiciones empezando por el final\n longitudDosisEntregadas = longitudDosisEntregadas - 20;\n i++;\n }\n //se le da la vuelta al array para que salga en orden cronologico\n dosisEntregadas.reverse();\n\n var ctx = document.getElementById('myChart').getContext('2d');\n\n dibujarGraficaLinea(ctx, fechas, dosisEntregadas, 'rgb(16, 26, 214)', 'Vacunas administradas Madrid');\n\n}", "title": "" }, { "docid": "b1a7199ebcb2a6fcd973ec1e9072171b", "score": "0.6034448", "text": "function dibujarGraficoDosisEntregadasEspaña(datos) {\n\n let fechas = [];\n let indiceMadridDesdeElFinal = datos.length;\n //el primer dato de madrid empieza en el array de arrays en la posicion 7 empezando por el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 1;\n //console.log(\"longitud datos \" + indiceMadridDesdeElFinal);\n let i = 0;\n\n while (i < 7) {\n //agregamos las fechas cada 20 posiciones\n let formatFecha = datos[indiceMadridDesdeElFinal];\n //en el array resultante la fecha esta en la posicion 0\n fechas.push(formatFecha[0]);\n //el dato de madrid esta cada 20 posiciones empezando por el final\n indiceMadridDesdeElFinal = indiceMadridDesdeElFinal - 20;\n i++;\n }\n //se le da la vuelta al array para que salga en orden cronologico\n fechas = fechas.reverse();\n\n i = 0;\n let longitudDosisEntregadas = datos.length;\n //el primer dato de madrid empieza en el array de arrays en la posicion 7 empezando por el final\n\n longitudDosisEntregadas = longitudDosisEntregadas - 1;\n //el array es de dosis administradas, aunque en el nombre figure 'entregadas'\n let dosisEntregadas = [];\n\n while (i < 7) {\n\n let dosis = datos[longitudDosisEntregadas];\n //la cifra con las dosis administradas esta en la posicion 5 del array resultante\n dosisEntregadas.push(dosis[4].replace(/[$.]/g,''));\n //el dato de madrid esta cada 20 posiciones empezando por el final\n longitudDosisEntregadas = longitudDosisEntregadas - 20;\n i++;\n }\n //se le da la vuelta al array para que salga en orden cronologico\n dosisEntregadas.reverse();\n\n var ctx = document.getElementById('myChart').getContext('2d');\n\n dibujarGraficaLinea(ctx, fechas, dosisEntregadas, 'rgb(16, 26, 214)', 'Vacunas administradas Madrid');\n\n}", "title": "" }, { "docid": "3dff02a40eec6c71e4db4097cf03ee05", "score": "0.6030772", "text": "async function EncontrarMovim(Val1){\r\n\treturn new Promise((resolve, reject)=>{\r\n\t\t// si tiene 2 valores se comprueba el actual con el anterior para determinar si se ha movido\r\n\tif(IngresoVez==0){\r\n\t\tVal1.horaInicio=getToday(Val1.time);\r\n\t}\r\n\t\tVal1.CompararPosicion.push(Val1.APname);\r\n\t\tVal1.CompararTiempos.push(Val1.time);\r\n console.log(\"valor de area permitida: \"+Val1.areaEmple+\" valor obtenido de posicion: \"+Val1.APname); \r\n\t\t//comparar si hubo movimiento\r\n\t\tif(Val1.areaEmple==Val1.CompararPosicion[1] ){\r\n\t\t\tconsole.log(\"dentro de area\");\r\n\t\t\tSwap(Val1);\r\n\t\t}\r\n\t\t//si se ha movido se resta las horas para determinar los minutos\r\n\t\telse{\r\n\t\t\tconsole.log(\"fuera de area\");\t\r\n\t\t\tobtenerySwap(Val1);\r\n\t\t}\r\n\t\tresolve(console.log(\"longitud de valores es 2\"));\t\t\r\n\t}\r\n\t);\r\n}", "title": "" }, { "docid": "4cc76420a0f3cf235c64267e16f527e8", "score": "0.6009129", "text": "function arriba()\n{\n\n up -= 10; \n console.log(\"para arriba\");\n estilow = player.style.marginTop = up+\"px\";\n cambiarMundo.escenaDos(estilow, mundo, player, señal);\n cambiarMundo.escenaUno(estilow, mundo, player);\n alerta.alertaNoPasar(estilow);\n return salir;\n\n}", "title": "" }, { "docid": "b617ffc1cf78b9badb34ddc3bd7fee97", "score": "0.60077107", "text": "actualizar(){\n //limpia el canvas\n ctx.clearRect(0, 0, 500, 500);\n let circulo1 = null;\n let circulo2 = null;\n //vuelve a dibujar los nuevos circulos\n for(let i = 0; i<this.tamanio; i++){\n circulo1 = circulo2;\n circulo2 = this.circulos[i];\n circulo2.dibujarCirculo();\n // traza las lineas\n if(circulo1!=null){\n this.trazarLineaMovida(circulo1, circulo2);\n }\n }\n //traza la ultima linea\n if(this.centro!=null){\n this.trazarLineaMovida(circulo2, this.circulos[0]);\n //dibuja el centro verde\n\n this.encontrarMedio();\n this.centro.dibujarCirculo();\n}\n}", "title": "" }, { "docid": "1c849bd258aab8719632f56e8f4993d0", "score": "0.59981775", "text": "function mover_datos_tabla_cuestionario() { \n \n //evento click para boton subir fila seleccionada\n $(\"#btnSubir\").on(\"click\", function () {\n //si no es la primera posicion ni la ultima\n // if (posicion.orden > 1)\n \n movimiento_fila(-1)\n });\n //evento click para boton bajar fila seleccionada\n $(\"#btnBajar\").on(\"click\", function () {\n // if (posicion.orden < (obtener_dato_tabla().length - 1))\n \n // console.log(posicion);\n movimiento_fila(1)\n \n }); \n \n \n\n \n\n}//fin", "title": "" }, { "docid": "d8c1e6d7a7305f4b234c365e88375374", "score": "0.5994666", "text": "function reiniciar(){\n var inicio=0;\n for (var c=0;c < 9;c++){\n if (panel [0] [c] !=0){\n inicio=1;\n }\n }\n if (inicio===1){\n if (puntos > record){\n record=puntos;\n }\n juegoNuevo(); //cortar aquí para que empiece el segundo jugador\n }else{\n nuevaPieza();\n }\n}", "title": "" }, { "docid": "50f4b7d674ddf86e520155c7486a5301", "score": "0.5975924", "text": "function movimientoBlancas(i,j){\r\n if(!movimiento){\r\n $('.posiblesMovimientos').remove();\r\n if(j<2 || j>7){\r\n MovimientoEzquinasBlancas(i,j);\r\n }else{\r\n proximosBlancas(i,j);\r\n }\r\n \r\n }\r\n \r\n}", "title": "" }, { "docid": "36506184d0370b93976d0c2f52e05ea3", "score": "0.5973945", "text": "moverPalabras(){\n\n //Encontrar todas las palabras\n let palabras = this.divPrincipal.querySelectorAll('.palabra');\n \n //Moverlas\n for(let palabra of palabras){\n let top = parseInt(palabra.style.top);\n if(top < parseInt(this.divPrincipal.clientHeight - 31)){\n top += 5;\n palabra.style.top = `${top}px`;\n }else this.borrarPalabra(palabra, false);\n }\n\n }", "title": "" }, { "docid": "89a5b5a4a42f85ab28443c64877617bd", "score": "0.59536713", "text": "busquedaExhaustiva(ubicacionInicial) {\n //Si el arreglo contiene elementos, los elimina.\n this.solucionesExhaustivo.splice(0, this.solucionesExhaustivo.length - 1);\n let auxUbicaciones = this.clonarUbicaciones(this.ubicaciones);\n //Ejectua las permutaciones\n this.permutaciones(auxUbicaciones.length, auxUbicaciones);\n let mejorRuta = { ubicaciones: [], distancia: Infinity };\n //Calcula las distancias\n for (let i = 0; i < this.solucionesExhaustivo.length; i++) {\n this.solucionesExhaustivo[i].ubicaciones.unshift(ubicacionInicial);\n this.solucionesExhaustivo[i].ubicaciones.push(ubicacionInicial);\n for (let j = this.solucionesExhaustivo[0].ubicaciones.length - 1; j > 0; j--) {\n this.solucionesExhaustivo[i].distancia += this.calcularDistanciaUbicaciones(this.solucionesExhaustivo[i].ubicaciones[j], this.solucionesExhaustivo[i].ubicaciones[j - 1]);\n }\n //Almacena la ruta mas corta\n if (this.solucionesExhaustivo[i].distancia < mejorRuta.distancia) {\n mejorRuta.ubicaciones = this.solucionesExhaustivo[i].ubicaciones;\n mejorRuta.distancia = this.solucionesExhaustivo[i].distancia;\n }\n }\n console.log(\"Mejor Ruta: \");\n console.log(mejorRuta);\n console.log(\"Posibles rutas: \");\n }", "title": "" }, { "docid": "36d36c989dfd58858b324df68e86ad98", "score": "0.59520286", "text": "function firstFitVble() {\n for (let i = 0; i < cola_nuevo.length; i++) {\n const proceso = cola_nuevo[i];\n var tamanoProceso=proceso.tamaño;\n if (tablaParticiones.length==0) { //no hay particiones\n if (tamanoLibre>=proceso.tamaño) {\n var idPart=tablaParticiones.length;\n var particion3 ={ //se crea el object\n \"idParticion\": (idPart+1),\n \"dirInicio\": direccionLibre,\n \"dirFin\": (direccionLibre+proceso.tamaño-1),\n \"tamaño\": proceso.tamaño,\n \"estado\": 1, //0 libre 1 ocupado\n \"idProceso\": proceso.idProceso,\n \"FI\": 0,\n };\n tablaParticiones.push(particion3);\n direccionLibre=direccionLibre+tamanoProceso;\n tamanoLibre=tamanoLibre-tamanoProceso;\n cola_listo.push(proceso);\n cola_nuevo.splice(i,1);\n }\n } else { //existen particiones. Busco si el proceso entra en alguna \n var j=0;\n var exito=false;\n do {\n const particion = tablaParticiones[j];\n var tamanoPart=particion.tamaño; \n if (particion.estado==0 && tamanoPart>=tamanoProceso) {\n exito=true;\n var diferencia = tamanoPart-tamanoProceso;\n switch (diferencia) {\n case 0:\n particion.idProceso=proceso.idProceso;\n particion.estado=1;\n break;\n case diferencia>0:\n particion.idProceso=proceso.idProceso;\n particion.estado=1;\n particion.tamaño=tamanoProceso; \n var dirFinActual=particion.dirFin; \n var direccionFin=(particion.dirInicio+tamanoProceso-1);\n particion.dirFin=direccionFin;\n var idPart=particion.idParticion;\n var k = tablaParticiones.length;\n do {// corro las particiones. Incremento su id\n const particion2 = tablaParticiones[(k-1)];\n particion2.idParticion=(particion2.idParticion+1);\n tablaParticiones.push(particion2);\n tablaParticiones.splice((k-1),1);\n k--;\n } while (k>idPart);\n var particion3 ={ //se crea el object\n \"idParticion\": (idPart+1),\n \"dirInicio\": (direccionFin+1),\n \"dirFin\": dirFinActual,\n \"tamaño\": diferencia,\n \"estado\": 0, //0 libre 1 ocupado\n \"idProceso\": null,\n \"FI\": 0,\n };\n tablaParticiones.push(particion3);\n break;\n }\n cola_listo.push(proceso);\n cola_nuevo.splice(i,1);\n } \n j++;\n } while (j < tablaParticiones.length && exito==false);\n if (exito==false) {\n if (tamanoLibre>=proceso.tamaño) {\n var idPart=tablaParticiones.length;\n var particion3 ={ //se crea el object\n \"idParticion\": (idPart+1),\n \"dirInicio\": direccionLibre,\n \"dirFin\": (direccionLibre+proceso.tamaño-1),\n \"tamaño\": proceso.tamaño,\n \"estado\": 1, //0 libre 1 ocupado\n \"idProceso\": proceso.idProceso,\n \"FI\": 0,\n };\n tablaParticiones.push(particion3);\n direccionLibre=direccionLibre+tamanoProceso;\n tamanoLibre=tamanoLibre-tamanoProceso;\n cola_listo.push(proceso);\n cola_nuevo.splice(i,1);\n \n } \n }\n }\n }\n}", "title": "" }, { "docid": "19c27d694a21c4d1d34308d681ec8a6c", "score": "0.59480524", "text": "changesValues(type, value) {\n let estadoPotreroEditable = this.state.estadoPotreroOrigen;\n let estadoPotreroReadOnly = this.state.estadoPotreroDestino;\n const recordEditable = estadoPotreroEditable.find(v => v.type === type);\n\n if (\n this.state.tipoMovimiento == \"INGRESO\" ||\n this.state.tipoMovimiento == \"EGRESO\"\n ) {\n const errormsj = this.validateSelectedPotreros();\n if (errormsj != \"\") {\n alert(errormsj);\n return;\n }\n }\n\n if (recordEditable) {\n if (value > recordEditable.qtty) {\n return;\n }\n if (value.trim() == \"\") {\n value = 0;\n }\n value = parseInt(value);\n // Modificando el origen\n recordEditable.total = recordEditable.qtty - value;\n recordEditable.cantMov = value;\n const indexPotrero = estadoPotreroEditable.findIndex(\n v => v.type === type\n );\n estadoPotreroEditable[indexPotrero] = recordEditable;\n\n if (estadoPotreroReadOnly != null) {\n // modificar el potrero en donde repercute los movimientos\n const recordRO = estadoPotreroReadOnly.find(v => v.type === type);\n if (recordRO) {\n // el tipo de hacienda existe en el destino\n const res = recordRO.qtty + parseInt(value);\n recordRO.total = isNaN(res) ? recordRO.qtty : res;\n recordRO.cantMov = isNaN(parseInt(value)) ? 0 : value;\n const indexPotreroD = estadoPotreroReadOnly.findIndex(\n v => v.type === type\n );\n\n estadoPotreroReadOnly[indexPotreroD] = recordRO;\n } else {\n // el tipo de hacienda no existe en el destino y tengo que agregarla\n const regNuevo = {\n type,\n qtty: 0,\n cantMov: parseInt(value),\n total: parseInt(value)\n };\n\n estadoPotreroReadOnly.push(regNuevo);\n }\n }\n this.setState({\n estadoPotreroOrigen: estadoPotreroEditable,\n estadoPotreroDestino: estadoPotreroReadOnly\n });\n }\n }", "title": "" }, { "docid": "c983d64a075b289d012d01cbbd5ba786", "score": "0.59428847", "text": "function confereVitoria(){\n\t//Lógica com muito copy-paste, não é uma boa solução, trocar\n\t//Vitoria horizontal\n\tif((quadrados[0].textContent === quadrados[1].textContent) && (quadrados[1].textContent === quadrados[2].textContent)){\n\t\tvitoriaJogo(quadrados[0],quadrados[1],quadrados[2]);\n\t}else if((quadrados[3].textContent === quadrados[4].textContent) && (quadrados[4].textContent === quadrados[5].textContent)){\n\t\tvitoriaJogo(quadrados[3],quadrados[4],quadrados[5]);\n\t}else if((quadrados[6].textContent === quadrados[7].textContent) && (quadrados[7].textContent === quadrados[8].textContent)){\n\t\tvitoriaJogo(quadrados[6],quadrados[7],quadrados[8]);\n\t}\n\t//Vitoria vertical\n\telse if((quadrados[0].textContent === quadrados[3].textContent) && (quadrados[3].textContent === quadrados[6].textContent)){\n\t\tvitoriaJogo(quadrados[0],quadrados[3],quadrados[6]);\n\t}else if((quadrados[1].textContent === quadrados[4].textContent) && (quadrados[4].textContent === quadrados[7].textContent)){\n\t\tvitoriaJogo(quadrados[1],quadrados[4],quadrados[7]);\n\t}else if((quadrados[2].textContent === quadrados[5].textContent) && (quadrados[5].textContent === quadrados[8].textContent)){\n\t\tvitoriaJogo(quadrados[2],quadrados[5],quadrados[8]);\n\t}\n\t//Vitoria diagonal\n\telse if((quadrados[0].textContent === quadrados[4].textContent) && (quadrados[4].textContent === quadrados[8].textContent)){\n\t\tvitoriaJogo(quadrados[0],quadrados[4],quadrados[8]);\n\t}else if((quadrados[2].textContent === quadrados[4].textContent) && (quadrados[4].textContent === quadrados[6].textContent)){\n\t\tvitoriaJogo(quadrados[2],quadrados[4],quadrados[6]);\n\t}else if(jogadaAtual === 9){\n\t\tfimDeJogo = true;\n\t\talert('Empate');\n\t}\n}", "title": "" }, { "docid": "936fbc370d2fa9c65077c51832ed99f5", "score": "0.59380203", "text": "function parar(){\n\tif(localStorage.getItem('Jugado')==0 || localStorage.getItem('Jugado')==null){\n\t\tclearInterval(ruleta);\n\t\tmarca = (i%360); //obtiene el numero en el que paro la ruleta de 0 a 360\n\t\tx.style.transitionDuration='5s'\n\t\tx.style.transform = `rotate(${marca+1800}deg)`;\n\t\tcupon(marca);\n\t}\n\t//En caso de que se haya redimido ya el cupón avisa que no se puede volver a jugar.\n\telse{\n\t\talert('El cupon ya se redimio');\n\t}\n}", "title": "" }, { "docid": "8ec58595660a83295f117afc744c1b4e", "score": "0.5890439", "text": "function movimientoNegras(i,j){\r\n if(movimiento){\r\n $('.posiblesMovimientos').remove();\r\n if(j<2 || j>7){\r\n MovimientoEzquinasNegras(i,j);\r\n }else{\r\n proximosNegras(i,j);\r\n }\r\n\r\n } \r\n}", "title": "" }, { "docid": "7a4ddf43ab704fd86d85155087ca1e71", "score": "0.587722", "text": "function movimiento_fila(m) {\n //checamos si hay una fila activa\n if ($(\".activa_mover\").length > 0) {\n //obtenemos el arreglo con el nuevo orden\n var resultado = obtener_dato_tabla(m);\n var posicion = parseInt($(\".activa_mover\").children(\":nth-child(1)\").text());\n //borramos la tabla existente\n $(\".classcuestionario\").remove();\n \n //recorremos el arreglo\n $.each(resultado, function (index, item) {\n // console.log(\"paso 3-\"+index);\n var clase_seleccion = \"\";\n if ((posicion + m) == item.orden)\n clase_seleccion = \"classcuestionario activa_mover\";\n else clase_seleccion = \"classcuestionario\";\n //creamos el objeto HTML\n var dat = \"<tr class='\" + clase_seleccion + \"' STYLE='width: 100%;' id='pregunta_cuestionario\" + (index + 1) + \"'>\" + \"<td STYLE='width: 61px;text-align:center' class='prierCelda'>\" + (index + 1) + \"</td>\" + \"<td class='IDPB' STYLE='width: 78%;'>\" + item.pregunta + \"</td>\" + \"<td STYLE='width: 105px;text-align:center'>\" + \"<input type='number' id='ponderacion\" + index + \"' class='ponderacionCues' min='1' max='10' step='1' value=\" + item.ponderacion + \" style='width:35Px'/>\" + \"</td>\" + \"<td>\" + item.area + \"</td>\" + \"</tr>\";\n //lo insertamos al documento\n $(\".tabla_preguntas_cuest\").append(dat);\n });//fin each\n filtrar_tabla_preguntas()\n }//fin if\n\n $(\".tabla_preguntas_cuest tr\").on(\"click\", function (e) {\n // console.log(e + \"\" + $(this));\n // quita seleccion a tabla activa\n $(\".tabla_preguntas_cuest tr\").each(function (i, t) { $(this).removeClass(\"activa_mover\"); });\n //activa nueva tabla\n $(this).toggleClass(\"activa_mover\");\n });\n}//fin metodo", "title": "" }, { "docid": "c6ffdb72031eb93f9918a2d1111a8169", "score": "0.5874364", "text": "function entregaVariacion(){\r\n\tvar moneda_variacionValor = [];\r\n\r\n\r\n\t// obtiene variacion (valor absoluto) entre monedas anteriores y actuales, \r\n\tfor(i=0; i<moneda_valorAnterior.length; i++){\r\n\t\tmoneda_variacionValor[i] = \tMath.abs(moneda_valorAnterior[i] - moneda_valorActual[i]) ;\r\n }\r\n\r\n\r\n\t//saca variacion moneda anterior y actual, valor absoluto\r\n\tfor(i=0; i < moneda_valorAnterior.lenght;\ti++){\r\n\t\t//RESTA MONEDAS Y ENTREGA VALOR ABSOLUTO\r\n//\t\tmoneda_variacionValor[i] = \tMath.abs(moneda_valorAnterior[i] - moneda_valorActual[i]) ;\r\n }\r\n\r\n\r\n\r\n\t// compara monedas y entrega valor mas alto\r\n\tvar counter = 1;//parte en 1 pues debe comtarar1 con el anterior q es 0\r\n\tvar indexDelMasAlto\t= 0;\r\n\tvar devuelve;\r\n\t\r\n\tfor(counter; counter<moneda_variacionValor.length; counter++){\r\n\t\tif(moneda_variacionValor[indexDelMasAlto] < moneda_variacionValor[counter]) {\r\n\t\t\tindexDelMasAlto = counter;\r\n\t\t} \r\n\t\tdevuelve = indexDelMasAlto;\r\n\t}\r\n\r\n\treturn devuelve;\r\n}", "title": "" }, { "docid": "6b6f16796ee38561682bfdc6f3bb5907", "score": "0.5860985", "text": "function fijarTurno() {\n if (elegirTurno == 1) { \n jugador1.turno = 1;\n comprobarTurno();\n }\n else if (elegirTurno == 2) { \n jugador2.turno = 1;\n comprobarTurno();\n }\n else if (elegirTurno == 3) { \n jugador3.turno = 1;\n comprobarTurno();\n }\n else { \n jugador4.turno = 1;\n comprobarTurno();\n }\n }", "title": "" }, { "docid": "b288d900d31b432278479bfa149f4bda", "score": "0.5859338", "text": "function verRepeticion(cadena) {\n reiniciarPartida(true);\n\n cambiarEstilos(document.getElementById(\"tablaMov\"));\n cambiarEstilos(document.getElementById(\"botonesMov\"));\n cambiarEstilos(document.getElementById(\"btnTodoAtras\"));\n cambiarEstilos(document.getElementById(\"btnAtras\"));\n cambiarEstilos(document.getElementById(\"btnPlayPause\"));\n cambiarEstilos(document.getElementById(\"btnAdelante\"));\n cambiarEstilos(document.getElementById(\"btnTodoAdelante\"));\n\n function cambiarEstilos(elemento) {\n elemento.classList.remove(\"enPartida\");\n elemento.classList.add(\"enRepeticion\");\n }\n\n cadena = modificarCadena(cadena);\n guardarTablero();\n miPartida.movAnteriorTableros.push({\n origenX: undefined,\n origenY: undefined,\n destinoX: undefined,\n destinoY: undefined\n });\n miPartida.jaquesTableros.push({esJaque: false, x: undefined, y: undefined});\n cargarCadenaMovimientos(cadena);\n // Muestro el primer movimiento de la partida\n crearEventosMovRepeticion();\n cargarTablero(1);\n estilosMovActualRep(0);\n}", "title": "" }, { "docid": "412d1ba76ac6ebb940b2ced430ebc27d", "score": "0.58579487", "text": "function mostrarFasePosiciones()\n {\n tbl.equipos = tbl.posiciones[tbl.faseActual.fas_id];\n }", "title": "" }, { "docid": "d4dc9d49aacb674f7770a5b1ee9dd5c6", "score": "0.5838017", "text": "function moverPieza(des){\n cpi=cpi+des;\n if (colisionaPieza()){\n cpi=cpi-des;\n }\n }", "title": "" }, { "docid": "6eb5540fcbdedf8d394fea1d0f8db4e6", "score": "0.58307827", "text": "function perdiste (){\r\n if((document.getElementById(\"Meteiorito\").offsetLeft > 630) ||\r\n (document.getElementById(\"Meteiorito2\").offsetLeft > 630)) {\r\n\r\n document.getElementById(\"Perdiste_sound\").play()\r\n alert(\"YA ES DEMASIADO TARDE LOS METIORITOS DESTRUYERON GRAN PARTE DEL CONTINENTE LO MEJOR ES ESPERAR LO PEOR\")\r\n document.getElementById(\"Meteiorito\").style.left = \"-70%\"\r\n document.getElementById(\"Meteiorito\").style.transition = \"0s\"\r\n\r\n document.getElementById(\"Meteiorito2\").style.left = \"-70%\"\r\n document.getElementById(\"Meteiorito2\").style.transition = \"0s\"\r\n \r\n Tiempo = 71\r\n Puntaje = 0 }\r\n \r\n else {\r\n document.getElementById(\"Meteiorito\").style.transition = \"2.4s\"\r\n document.getElementById(\"Meteiorito2\").style.transition = \"2.4s\"} }", "title": "" }, { "docid": "90113c20bb5f290013fb4e0e84ee0d02", "score": "0.579795", "text": "function valutaUltima () {\n var risp = document.getElementById('textfield').value; //Ritorna il valore digitato\n var minuscolo = risp.toLowerCase(); //Trasforma la risposta in tutto minuscolo\n var nospace = minuscolo.replace(' ', ''); //Rimuove gli spazi tra le parole\n var trim = nospace.trim(); //Rimuove gli spazi prima e dopo la risposta\n var giusto = trim.localeCompare(Soluzione[oldx]); //Compara risposta data e soluzione\n \n if (giusto == 0) { //se giusto è uguale a zero (quindi le due risposte sono uguali) \n esatte++;\n monte = esatte * 3000;\n document.getElementById(\"risultato\").innerHTML = \"DOMANDA N°\" + conta + \"/10\" + \"<br>RISPOSTA CORRETTA - Montepremi: \" + monte; //stampa risposta corretta nel div con id risultato \n document.getElementById(\"textfield\").value = \"\";\n conta++;\n clearInterval(id);\n move();\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n \n else {\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n}", "title": "" }, { "docid": "90113c20bb5f290013fb4e0e84ee0d02", "score": "0.579795", "text": "function valutaUltima () {\n var risp = document.getElementById('textfield').value; //Ritorna il valore digitato\n var minuscolo = risp.toLowerCase(); //Trasforma la risposta in tutto minuscolo\n var nospace = minuscolo.replace(' ', ''); //Rimuove gli spazi tra le parole\n var trim = nospace.trim(); //Rimuove gli spazi prima e dopo la risposta\n var giusto = trim.localeCompare(Soluzione[oldx]); //Compara risposta data e soluzione\n \n if (giusto == 0) { //se giusto è uguale a zero (quindi le due risposte sono uguali) \n esatte++;\n monte = esatte * 3000;\n document.getElementById(\"risultato\").innerHTML = \"DOMANDA N°\" + conta + \"/10\" + \"<br>RISPOSTA CORRETTA - Montepremi: \" + monte; //stampa risposta corretta nel div con id risultato \n document.getElementById(\"textfield\").value = \"\";\n conta++;\n clearInterval(id);\n move();\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n \n else {\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n}", "title": "" }, { "docid": "90113c20bb5f290013fb4e0e84ee0d02", "score": "0.579795", "text": "function valutaUltima () {\n var risp = document.getElementById('textfield').value; //Ritorna il valore digitato\n var minuscolo = risp.toLowerCase(); //Trasforma la risposta in tutto minuscolo\n var nospace = minuscolo.replace(' ', ''); //Rimuove gli spazi tra le parole\n var trim = nospace.trim(); //Rimuove gli spazi prima e dopo la risposta\n var giusto = trim.localeCompare(Soluzione[oldx]); //Compara risposta data e soluzione\n \n if (giusto == 0) { //se giusto è uguale a zero (quindi le due risposte sono uguali) \n esatte++;\n monte = esatte * 3000;\n document.getElementById(\"risultato\").innerHTML = \"DOMANDA N°\" + conta + \"/10\" + \"<br>RISPOSTA CORRETTA - Montepremi: \" + monte; //stampa risposta corretta nel div con id risultato \n document.getElementById(\"textfield\").value = \"\";\n conta++;\n clearInterval(id);\n move();\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n \n else {\n localStorage.setItem(\"rCorrette\", esatte); //Imposta il montepremi nello storage\n window.location.href=\"../riepilogo-prima-fase.html\"; //Redirect al riepilogo\n }\n}", "title": "" }, { "docid": "a56155a34c618e44ae45338c0fa7edc5", "score": "0.57968247", "text": "caso2(valor,x,y){\n this.l_vertical.appendO(x);\n let pos_x=this.l_vertical.buscar(x);\n let pos_y=this.l_horizontal.buscar(y);\n let nodo= new Nodo(valor,x,y);\n pos_x.der=nodo;\n nodo.izq=pos_x;\n //insertar en una columna;\n let current=pos_y.abajo\n while(current!=null){\n if(current.x<x){\n current=current.abajo;\n }else{\n nodo.abajo=current;\n nodo.arriba=current.arriba;\n current.arriba.abajo=nodo;\n current.arriba=nodo;\n return\n }\n }\n //si la fila es un numero mayor al resto se colocara de ultimo por lo cual se debe obtener el ultimo nodo\n //antes de la inserción de este.\n current=pos_y.abajo;\n while (current.abajo!=null){\n current=current.abajo;\n }\n current.abajo=nodo;\n nodo.arriba=current;\n }", "title": "" }, { "docid": "95daff8cc5962fe4b6880e8d97872817", "score": "0.57936853", "text": "static toMovimientoEntity(idPotrero, obs, motivo, movDetalle, potDetalle, potOrigen, potDestino, tipoMovimiento) {\n const mov = {\n IdPotrero: idPotrero,\n Fecha: new Date()\n .toJSON()\n .slice(0, 10)\n .split('-')\n .reverse()\n .join('/'),\n Observaciones: obs,\n Motivo: motivo,\n MovimientoDetalle: JSON.stringify(this.cleanList(movDetalle)),\n PotreroDetalle: JSON.stringify(this.cleanList(potDetalle)),\n PotreroOrigen: potOrigen,\n PotreroDestino: potDestino,\n TipoMovimiento: tipoMovimiento,\n };\n return mov;\n }", "title": "" }, { "docid": "bb2c613e735b4844b4cfeb8142fe1d63", "score": "0.5792484", "text": "soma(atributo) {\n atributo = atributo.replace(\"soma \", \"\");\n console.log(this.atributos[atributo])\n if (this.isElemental(atributo)) {\n if (this.elementos[atributo] < this.maxPoints) {\n this.gastaPonto(1)\n this.elementos[atributo] = this.elementos[atributo] + 1\n this.criaBolinha(atributo)\n } else {\n return\n }\n } else {\n if (this.atributos[atributo] < this.maxPoints) {\n this.gastaPonto(1)\n this.atributos[atributo] = this.atributos[atributo] + 1\n this.criaBolinha(atributo)\n } else {\n return\n }\n }\n\n }", "title": "" }, { "docid": "e1a5368e3350d02e840b9b19dea3f903", "score": "0.578989", "text": "function moverDerecha() {\n // mover imagen a -200%\n slider.animate({marginLeft:`-${200}%`}, 700,\n terminaTodo = () => {\n // mover primer a ultimo lugar\n $('#slider section:first').insertAfter('#slider section:last');\n slider.css('margin-left', `-${100}%`);\n });\n}", "title": "" }, { "docid": "a01f86389a2effe51b220ccd36d42053", "score": "0.57878566", "text": "function mueve() {\n if (!muerto){\n if (keys[37] || keys[65]) {\n if (!personaje.colisionaPorIzquierda(\"terreno\")) {\n if (ultimaDireccion != \"izquierda\" || (estatico)){\n $(\"#medico\").attr(\"src\", \"img/personajes/correr-izquierda.gif\");\n estatico = false;\n }\n personaje.moverIzquierda();\n ultimaDireccion = \"izquierda\";\n }\n }\n if (keys[38] || keys[87]) {\n if (!personaje.colisionaPorArriba(\"terreno\")) {\n if (ultimaDireccion != \"arriba\" || (estatico)){\n $(\"#medico\").attr(\"src\", \"img/personajes/correr-arriba.gif\");\n estatico = false;\n }\n personaje.moverArriba();\n ultimaDireccion = \"arriba\";\n }\n }\n if (keys[39] || keys[68]) {\n if (!personaje.colisionaPorDerecha(\"terreno\")) {\n if (ultimaDireccion != \"derecha\" || (estatico)){\n $(\"#medico\").attr(\"src\", \"img/personajes/correr-derecha.gif\");\n estatico = false;\n }\n personaje.moverDerecha();\n ultimaDireccion = \"derecha\";\n }\n }\n if (keys[40] || keys[83]) {\n if (!personaje.colisionaPorAbajo(\"terreno\")) {\n if (ultimaDireccion != \"abajo\" || (estatico)){\n $(\"#medico\").attr(\"src\", \"img/personajes/correr-abajo.gif\");\n estatico = false;\n }\n personaje.moverAbajo();\n ultimaDireccion = \"abajo\";\n }\n }\n\n if (keys[32]){\n if (disparable){\n disparar();\n }\n }\n setTimeout(mueve, 50);\n }\n }", "title": "" }, { "docid": "1bcf17466eed00c2357403fb4a850eaf", "score": "0.57877177", "text": "function mover_ficha(from, to,animar,mipromotion , moverTablero)\n {\n \n if(animar)\n animar=true;\n \n if(!mipromotion)\n mipromotion='p';\n \n// console.error(\"from:\"+from+\" to:\"+to+\" promotion:\"+mipromotion);\n \n \n game.move({from:from, to:to, promotion:mipromotion});\n \n var mifen=game.fen().split(\" \");\n \n if(moverTablero==null)\n { \n board.position(mifen[0],animar);\n }\n \n cambiaTurno();\n \n console.log(mifen);\n return mifen;\n }", "title": "" }, { "docid": "ab584a8cc4a53854bd732e97827fad38", "score": "0.57859737", "text": "function moverDisparos() {\n\n\tfor (var i in disparos) {\n\t\tvar disparo = disparos[i];\n\t\tif (disparo.direccion == \"abajo\") {\n\t\t\tdisparo.y += 2;\n\t\t} else if (disparo.direccion == \"izquierda\") {\n\t\t\tdisparo.x -= 2;\n\t\t} else if (disparo.direccion == \"derecha\") {\n\t\t\tdisparo.x += 2;\n\t\t} else if (disparo.direccion == \"arriba_iz\") {\n\t\t\tdisparo.y -= 2;\n\t\t\tdisparo.x--;\n\n\t\t} else if (disparo.direccion == \"arriba_dr\") {\n\t\t\tdisparo.y -= 2;\n\t\t\tdisparo.x++;\n\t\t} else\n\t\t\tdisparo.y -= 2;\n\t}\n\n\t// Funciones para limpiar los disparos cuando se acercan al limite\n\t// del canvas.\n\tdisparos = disparos.filter(function (disparo) {\n\t\treturn disparo.y > 0;\n\t});\n\n\tdisparos = disparos.filter(function (disparo) {\n\t\treturn disparo.x > 0;\n\t});\n\n\tdisparos = disparos.filter(function (disparo) {\n\t\treturn disparo.y < canvas.height - 10;\n\t});\n\n\tdisparos = disparos.filter(function (disparo) {\n\t\treturn disparo.x < canvas.width - 10;\n\t});\n\n\tif (juego.estado == 'perdido') {\n\t\tdisparos = disparos.filter(function (disparo) {\n\t\t\treturn false;\n\t\t});\n\t\tdisparosEnemigos = disparosEnemigos.filter(function (disparo) {\n\t\t\treturn false;\n\t\t});\n\t\tenemigos = enemigos.filter(function (disparo) {\n\t\t\treturn false;\n\t\t});\n\t}\n\n\n}", "title": "" }, { "docid": "60b9956ea4b191907d57dbf8634de2b9", "score": "0.5785266", "text": "function contadorMovimiento(){\n movimiento++;\n $('#parrafoDos').html(`MOVIMIENTOS ${movimiento}`);\n }", "title": "" }, { "docid": "caed781a338bf72cdece5fd79974df23", "score": "0.5784646", "text": "function segue(){\n\t\tcobra.style.transform = \"translate(\"+matriz[0]*10 + \"px\" + \",\" +matriz[1]*10 + \"px)\";\n\t\tif (matriz[0] == foodX && matriz[1] == foodY){\n\t\t\tpontos++;\n\t\t\tspanPtn.innerHTML = pontos;\n\t\t\tgeraFood();\n\t\t\traboPosX.push(0);\n\t\t\traboPosY.push(0);\n\t\t\tsecRabo.innerHTML = secRabo.innerHTML + \"<div class='rabo'></div>\";\t\n\t\t}\n\n\t\n\t\tfor(var i = 0;i<pontos;i++){\n\t\t\trabo[i].style.transform = \"translate(\"+raboPosX[i]*10 + \"px\" + \",\" +raboPosY[i]*10 + \"px)\";\n\t\t}\n\t}", "title": "" }, { "docid": "92442d0dc5af4589a6b98928ca1203c6", "score": "0.5784547", "text": "estasmuerto(){\n console.log(\"Estas muerto. Empieza de nuevo\");\n //Pongo el avatar en la posicion inicial\n this.x=0;\n this.y=0;\n //Coloco la llave en el tablero\n tablero[8][3]=3;\n //Si el avatar tiene la llave se la quito, no hace falta hacer un if\n this.llave=false;\n }", "title": "" }, { "docid": "00ea1f0b56da4cc34cddbe7f86f3db49", "score": "0.5774166", "text": "function vaciar () {\n jugada1 = \"\";\t\n jugada2 = \"\";\t\n identificadorJ1 = \"\";\n identificadorJ2 = \"\";\n}", "title": "" }, { "docid": "7332e948a862a8c19f2fb70c76150447", "score": "0.57736725", "text": "checkLLegoComercio(listPedidos, geoPositionActual) {\n let geoPositionComercio = new src_app_modelos_geoposition_model__WEBPACK_IMPORTED_MODULE_12__[\"GeoPositionModel\"]();\n let _newTimeLinePedido = new src_app_modelos_time_line_pedido__WEBPACK_IMPORTED_MODULE_14__[\"TimeLinePedido\"]();\n listPedidos.map((p) => {\n const comercioPedido = p.json_datos_delivery.p_header.arrDatosDelivery.establecimiento;\n _newTimeLinePedido = p.time_line || _newTimeLinePedido;\n geoPositionComercio.latitude = typeof comercioPedido.latitude === 'string' ? parseFloat(comercioPedido.latitude) : comercioPedido.latitude;\n geoPositionComercio.longitude = typeof comercioPedido.longitude === 'string' ? parseFloat(comercioPedido.longitude) : comercioPedido.longitude;\n if (!geoPositionComercio.latitude) {\n return;\n }\n const _distanciaMt = this.calcDistanciaService.calcDistanciaEnMetros(geoPositionActual, geoPositionComercio);\n // 100mtr a la redonda\n // const isLLego = geoPositionComercio.latitude ? \n // this.calcDistanciaService.calcDistancia(geoPositionComercio, geoPositionActual, 100)\n // : false\n const isLLego = this.calcDistanciaService.calcDistancia(geoPositionActual, geoPositionComercio, 100);\n // p.llego_comercio = isLLego;\n p.distanciaMtr = _distanciaMt;\n // _newTimeLinePedido.llego_al_comercio = isLLego;\n // _newTimeLinePedido.llego_al_comercio = !_newTimeLinePedido.llego_al_comercio ? isLLego : false;\n if (isLLego) { // envia mensaje\n // if (_newTimeLinePedido.paso === 0) {\n // _newTimeLinePedido.mensaje_enviado.llego_al_comercio = true;\n if (_newTimeLinePedido.llego_al_comercio !== true) {\n _newTimeLinePedido.llego_al_comercio = true;\n _newTimeLinePedido.paso = 1;\n p.msj_log += `paso 1 ${new Date().toLocaleTimeString()}`;\n this.sendMsjService.msjClienteTimeLine(p, _newTimeLinePedido);\n }\n // }\n }\n else {\n // si sale del comercio con el pedido camino al cliente\n if (_newTimeLinePedido.paso === 1) {\n // _newTimeLinePedido.mensaje_enviado.en_camino_al_cliente = true;\n _newTimeLinePedido.en_camino_al_cliente = true;\n _newTimeLinePedido.paso = 2;\n p.msj_log += `paso 2 ${new Date().toLocaleTimeString()}`;\n this.sendMsjService.msjClienteTimeLine(p, _newTimeLinePedido);\n }\n }\n p.time_line = _newTimeLinePedido;\n });\n }", "title": "" }, { "docid": "961bea6cae6a283190605095e62bd50e", "score": "0.5772023", "text": "function reiniciarPartida(repeticion) {\n // Elimino todas las imagenes y estilos del tablero\n eliminarEstiloJaque();\n eliminarEstiloMovAnterior();\n for (let i = 0, finI = miPartida.piezasBlancas.length; i < finI; i++)\n eliminarImgPieza(miPartida.piezasBlancas[i].x, miPartida.piezasBlancas[i].y);\n for (let i = 0, finI = miPartida.piezasNegras.length; i < finI; i++)\n eliminarImgPieza(miPartida.piezasNegras[i].x, miPartida.piezasNegras[i].y);\n if (!repeticion)\n document.getElementById(\"tablaMov\").innerHTML = \"\";\n\n if (miPartida.tableroGirado) {\n girarSpans(document.querySelectorAll(\"#numeros span\"));\n girarSpans(document.querySelectorAll(\"#letras span\"));\n }\n\n // Vuelvo a poner las variables globales en su valor inicial\n miPartida.hayPiezaSelec = false;\n miPartida.piezaSelec = {x: undefined, y: undefined};\n miPartida.peonAlPaso = {x: undefined, y: undefined};\n miPartida.piezasBlancas = [];\n miPartida.piezasNegras = [];\n miPartida.movPosibles = [];\n miPartida.turno = true;\n miPartida.tableroGirado = false;\n if (!repeticion) {\n miPartida.cadenaMovimientos = \"\";\n miPartida.resultado = \"\";\n }\n miPartida.cadenasTableros = [];\n miPartida.movAnteriorTableros = [];\n miPartida.jaquesTableros = [];\n miPartida.movActualRep = 0;\n if (miPartida.play)\n pararIntervalo();\n\n // Coloco el tablero, piezas e imagenes e inicio la partida\n colocarPiezasIniciales();\n inicializarArraysPiezas();\n annadirImgPiezasIniciales();\n}", "title": "" }, { "docid": "d43feb1320e0bdf1c8a179ebf9fa6df7", "score": "0.57614756", "text": "function Reiniciar() {\n\n\n document.getElementById(\"AnguloBeta\").value = null;\n document.getElementById(\"AnguloAlfa\").value = null;\n document.getElementById(\"LadoA\").value = null;\n document.getElementById(\"LadoC\").value = null;\n document.getElementById(\"LadoB\").value = null;\n document.getElementById(\"Area\").value = null;\n document.getElementById(\"Perimetro\").value = null;\n\n contador=0;\n\n\n chequeoB=0;\n chequeoA=0;\n mov=0;\n}", "title": "" }, { "docid": "a18390b8d7fc77914a673b418b32cf07", "score": "0.57593477", "text": "function moverDisparos(){\n\t\n\tfor(var i in disparos){\n\t\tvar disparo = disparos[i];\n/*\t\tif(disparo.direccion == \"abajo\"){\n\t\t\tdisparo.y += 2;\n\t\t}\n\t\telse if(disparo.direccion == \"izquierda\")\n\t\t{\n\t\t\tdisparo.x -= 2;\n\t\t}\n\t\telse if(disparo.direccion == \"derecha\")\n\t\t{\n\t\t\tdisparo.x += 2;\n\t\t}\n\t\telse if(disparo.direccion == \"arriba_iz\")\n\t\t{\n\t\t\tdisparo.y -= 2;\n\t\t\tdisparo.x--;\n\n\t\t}\n\t\telse if(disparo.direccion == \"arriba_dr\")\n\t\t{\n\t\t\tdisparo.y -= 2;\n\t\t\tdisparo.x++;\n\t\t}\n\t\telse\n*/\t\t\n\t\t\tdisparo.y -= 2;\n\t}\n\n\t// Funciones para limpiar los disparos cuando se acercan al limite\n\t// del canvas.\n\tdisparos = disparos.filter(function(disparo){\n\t\treturn disparo.y > 0;\n\t});\n\n\tdisparos = disparos.filter(function(disparo){\n\t\treturn disparo.x > 0;\n\t});\n\n\tdisparos = disparos.filter(function(disparo){\n\t\treturn disparo.y < canvas.height - 10;\n\t});\n\n\tdisparos = disparos.filter(function(disparo){\n\t\treturn disparo.x < canvas.width - 10;\n\t});\n\n\tif(juego.estado == 'perdido')\n\t{\n\t\tdisparos = disparos.filter(function(disparo){\n\t\treturn false;\n\t\t});\n\t\tdisparosEnemigos = disparosEnemigos.filter(function(disparo){\n\t\treturn false;\n\t\t});\n\t\tenemigos = enemigos.filter(function(disparo){\n\t\treturn false;\n\t\t});\n\t}\n\n\n}", "title": "" }, { "docid": "a3d6e750d02b87adfb09787576707e5f", "score": "0.5757386", "text": "function presion (id){\n\n if (id == \"punto\" && rep) { //presionar punto\n aux = 1;\n acum('.');\n rep = false;\n }\n else if (id == \"on\") { //presionar tecla on\n on();\n }\n else if (id != \"punto\" && id != \"on\" && id != \"sign\" && id != \"raiz\" && id != \"dividido\" && id != \"por\" && id != \"menos\" && id != \"igual\" && id != \"mas\") { // presionar tecla numerica\n if (document.getElementById(\"display\").innerHTML == '0') {// comprobación de cero en pantalla\n document.getElementById(\"display\").innerHTML = \"\";\n }\n var pres = document.getElementById(id).id;\n acum(pres);\n }\n else if (id == \"sign\"){ //presionar tecla cambio de signo\n if (segoper){\n num = num * -1;\n document.getElementById(\"display\").innerHTML = num;\n }\n else {\n numaux1 = numaux1 * -1;\n document.getElementById(\"display\").innerHTML = numaux1;\n }\n }\n else if (id != \"punto\") { //presionar tecla de operacion aritmetica\n operacion();\n if (!segoper && final) {\n oper2 (oper, numaux1, numaux2);\n }\n }\n\n resize(id);\n}", "title": "" }, { "docid": "2d9cf75e0a5a421f638afa0dead61e8d", "score": "0.5756288", "text": "initialStatus(){\n this.inicio.splice(0,this.inicio.length);\n this.auxiliar.splice(0,this.auxiliar.length);\n this.destino.splice(0,this.destino.length);\n this.inicio.push('1');\n this.inicio.push('2');\n this.inicio.push('3');\n this.inicio.push('4');\n this.pieceA.setPosition(225,185);\n this.pieceB.setPosition(225,235);\n this.pieceC.setPosition(225,285);\n this.pieceD.setPosition(225,335);\n }", "title": "" }, { "docid": "066ce59aac254903b83f91851f24217a", "score": "0.5756192", "text": "function movimentaBolinha(){\n xBolinha += velocidadeXBolinha; \n yBolinha += velocidadeYBolinha;\n \n}", "title": "" }, { "docid": "ea4f92cdd3bee14e82a952fae517661c", "score": "0.575449", "text": "function dividirTraslapes(Activity) {\n var eventbackup;\n var coincidence = false;\n var inicioA = moment(Activity.start.format(\"YYYY-MM-DD HH:mm\"), \"YYYY-MM-DD HH:mm\");\n var finA = moment(Activity.end.format(\"YYYY-MM-DD HH:mm\"), \"YYYY-MM-DD HH:mm\");\n\n if (!esfumigacion(Activity.idHabilidad)) {\n\n for (var i in oficiales) {\n //revisa que la Actividad y la fecha oficial pertenezcan al mismo invernadero\n if (oficiales[i].idInvernadero == Activity.idInvernadero && Activity.editable) {\n //si la actividad se repite semanalmente, la propiedad dow indica en un array los días de la semana que los eventos se repiten y a que hora\n if (oficiales[i].dow != undefined) {\n //revisa los días que se repiten los eventos. y separa la actividad programada para que no se traslapen\n for (var d in oficiales[i].dow) {\n //divide las actividades solo en los días que coincidan con fechas oficiales. se utiliza la funcion day() para obtener el día de la semana de la actividad, y se compara con el array del evento.\n if (oficiales[i].dow[d] == moment(Activity.start).day() || oficiales[i].dow[d] == moment(Activity.end).day()) {\n\n var inicioA = moment(getOnlyTime(inicioA), \"HH:mm\");\n var finA = moment(getOnlyTime(finA), \"HH:mm\");\n var iniciof = moment(oficiales[i].start, \"HH:mm\");\n var finf = moment(oficiales[i].end, \"HH:mm\");\n\n //si el día de la semana del dia festivo oficial coincide con la actividad programada, se comparan los horarios y se divide la actividad para que no se traslapen.\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n if ((inicioA >= iniciof && inicioA <= finf) &&\n (inicioA <= finf && finA > finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.start = moment(Activity.start, \"YYYY-MM-DD HH:mm\").set('hour', finf.get('hour')).set('minute', finf.get('minute')).add(1, 'm');\n //valida que no se vuelva a traslapar\n dividirTraslapes(Activity);\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n\n else if ((inicioA < iniciof && finA <= finf) &&\n (iniciof <= finA && finA <= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.end = moment(Activity.end, \"YYYY-MM-DD HH:mm\").set('hour', iniciof.get('hour')).set('minute', iniciof.get('minute')).subtract(1, 'm');\n\n //se valida que no se traslape\n dividirTraslapes(Activity);\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n\n else if ((inicioA <= iniciof && finA >= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n eventbackup = copyEvent(Activity);\n eventbackup.end = eventbackup.end = moment(Activity.end, \"YYYY-MM-DD HH:mm\").set('hour', iniciof.get('hour')).set('minute', iniciof.get('minute')).subtract(1, 'm');\n eventbackup.idPeriodo = undefined;\n dividirTraslapes(eventbackup);\n\n //se modifica la otra parte de la actividad. y \n\n Activity.start = moment(Activity.start, \"YYYY-MM-DD HH:mm\").set('hour', finf.get('hour')).set('minute', finf.get('minute'));\n // Activity.end = moment(Activity.end, \"YYYY-MM-DD HH:mm\").set('hour', iniciof.get('hour')).set('minute', iniciof.get('minute'));\n //se valida que no se solape.\n dividirTraslapes(Activity);\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [ Fecha Oficial ]\n // Inicio Fin\n\n else if ((inicioA >= iniciof && finA <= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.start = moment(Activity.start, \"YYYY-MM-DD HH:mm\").set('hour', finf.get('hour')).set('minute', finf.get('minute')).add(1, 'm');\n Activity.end = moment(Activity.end).add(moment(Activity.end).diff(moment(Activity.start), 'minutes'), 'minutes');\n\n //Se valida que no se traslape\n dividirTraslapes(Activity);\n return;\n }\n\n }\n }\n\n }\n //La fecha oficial no se repite semanalmente, se procede a comparar fechas específicas y dividir las actividades para que no se traslapen con fechas oficiales no laborables.\n else {\n\n\n var iniciof = moment(oficiales[i].start, \"YYYY-MM-DD HH:mm\");\n var finf = moment(oficiales[i].end, \"YYYY-MM-DD HH:mm\");\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n if ((inicioA >= iniciof && inicioA <= finf) &&\n (inicioA <= finf && finA > finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.start = finf.add(1, 'm');\n // se valida quen o se traslape\n dividirTraslapes(Activity);\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n\n else if ((inicioA <= iniciof && finA >= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n eventbackup = copyEvent(Activity);\n eventbackup.idPeriodo = undefined;\n eventbackup.end = iniciof.subtract(1, 'm');\n //dividedEvents.push(copyEvent(eventbackup));\n\n // se crea la segunda parte\n\n Activity.start = finf.add(1, 'm');\n\n //se valida que no se traslape\n dividirTraslapes(Activity);\n Activity = null;\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [Fecha Oficial]\n // Inicio Fin\n\n else if ((inicioA < iniciof && finA <= finf) &&\n (iniciof <= finA && finA <= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.end = iniciof.subtract(1, 'm');\n\n //se valida que no se traslape\n dividirTraslapes(Activity);\n return;\n }\n\n // Inicio Fin\n // [ActividadProgramada]\n // [ Fecha Oficial ]\n // Inicio Fin\n\n else if ((inicioA >= iniciof && finA <= finf)) {\n coincidence = true;\n //modifica la Actividad para que no se traslape\n Activity.start = finf.add(1, 'm');\n Activity.end = moment(Activity.end).add(moment(Activity.end).diff(moment(Activity.start), 'minutes'), 'minutes'); ;\n\n //se valida que no se traslape\n dividirTraslapes(Activity);\n return;\n }\n\n }\n }\n }\n\n }\n if (coincidence == false) {\n\n if (Activity.id == undefined) {\n Activity.id = Contador++;\n\n if (Activity.idTr != undefined) {\n dividedEvents.push(Activity);\n\n }\n\n\n agregarAtcividadHTML(Activity);\n\n\n } else {\n\n for (var c = 0; c < dividedEvents.length; c++) {\n if (dividedEvents[c].id == Activity.id && dividedEvents[c].idTr == Activity.idTr) {\n dividedEvents[c] = Activity;\n $('tr[idjson=\"' + Activity.id + '\"]').remove();\n\n\n agregarAtcividadHTML(Activity);\n }\n }\n }\n RevisaTiemposAsociados();\n revisaNivelInfestacion();\n }\n\n\n}", "title": "" }, { "docid": "e231eb9ceab5e9e2102f0c141af265b0", "score": "0.574957", "text": "ejecutar(entorno) {\n let leftVal = this.left.getValue(entorno);\n let rightVal = this.right.getValue(entorno);\n if (this.getCondicion(leftVal, rightVal)) {\n entorno.actual = entorno.label[this.label];\n }\n else {\n entorno.actual = this.linea;\n }\n }", "title": "" }, { "docid": "d65e26786ce269190b44ee837062a55d", "score": "0.5748733", "text": "function sortearTurno(){\r\n var jug1 = aleatorio(1,6);\r\n var jug2 = aleatorio(1,6);\r\n //cambia la imagen de los dados por la del numero que salio\r\n document.getElementById(\"dadoSorteo1\").src = imagenDados[jug1 - 1];\r\n document.getElementById(\"dadoSorteo2\").src = imagenDados[jug2 - 1]; \r\n //comprueva cual es el mayor\r\n if(jug1 > jug2) {\r\n mensaje(\"El jugador 1 empieza la partida. \")\r\n ocultaPanelSorteo()\r\n jugador1.setTurno(true);\r\n empezaJugador();\r\n\r\n }else if(jug1 < jug2) {\r\n if (cantidadTotalJugadores == 2) {\r\n mensaje(\"El jugador 2 empieza la partida. \");\r\n ocultaPanelSorteo();\r\n jugador2.setTurno(true);\r\n empezaJugador2();\r\n }else{\r\n mensaje(\"El jugador 2 empieza la partida. \");\r\n ocultaPanelSorteo();\r\n jugador2.setTurno(true);\r\n empezaJugador22();\r\n } \r\n }else{\r\n mensaje(\"Empate buelve a sortear los turnos \");\r\n }\r\n \r\n}", "title": "" }, { "docid": "f66585c362cd56180034b836981fe13a", "score": "0.5738919", "text": "function repos(objParaMover, objReferencia) {\n var atual = objParaMover.getBounds()[0];\n var ref = objReferencia.getBounds()[0]\n return objParaMover.translate([ref.x - atual.x, ref.y - atual.y, ref.z - atual.z])\n }", "title": "" }, { "docid": "268c5b94b2acee2a0a68a503ae3d00b7", "score": "0.5736971", "text": "function ordenamiento ()\r\n{\r\n for(i = 0; i < n.length; i++)\r\n for(j = 0; j< n.length ; j++)\r\n {\r\n if(n[j]>n[j+1])\r\n {\r\n let a = n[j] //guardo el valor de esa posicion en una variable\r\n n[j] = n[j + 1]; //puesto que se guardará la siguiente posición \r\n n[j + 1] = a //y en la siguiente posicion guardo el valor de la variable\r\n \r\n inversiones++;\r\n }\r\n }\r\n\r\n\r\n//Imprimir ordenado\r\n console.log(\"\\nArreglo ordenado : \")\r\n for(i = 0; i < n.length; i++)\r\n{\r\n console.log( \"posición [\",i,\"] =\",n[i] )\r\n}\r\n}", "title": "" }, { "docid": "e6c32ffdc550511726dbae7e16f5d271", "score": "0.5731548", "text": "guardarMovimiento() {\n if (!this.validacionOperaciones()) return false; //validaciones\n\n let idOrigen = null;\n let idDestino = null;\n let motivo = null;\n let estado = this.state.estadoPotreroOrigen;\n let segundoEstado = this.state.estadoPotreroDestino;\n\n\n const dobleMovimiento =\n this.state.tipoMovimiento == \"INGRESO\" ||\n (this.state.tipoMovimiento == \"EGRESO\" && this.state.potreroSelected.Nombre != \"OTRO\"); // en los casos de ingreso o egreso hay que hacer un doble movimiento.\n\n switch (this.props.tipoMovimiento) {\n case \"INGRESO\":\n idOrigen = this.state.potreroSelected.IdPotrero;\n idDestino = this.props.IdPotrero;\n estado = this.state.estadoPotreroDestino;\n segundoEstado = this.state.estadoPotreroOrigen;\n break;\n case \"EGRESO\":\n idOrigen = this.props.IdPotrero;\n idDestino = this.state.potreroSelected.IdPotrero;\n break;\n case \"BAJA\":\n motivo = this.state.motivoSelected.amount;\n break;\n case \"NACIMIENTO\":\n break;\n }\n\n // Guarda el movimiento principal\n this.GuardarMovimientoBD(\n this.state.tipoMovimiento,\n estado,\n idOrigen,\n idDestino,\n motivo,\n this.props.IdPotrero\n );\n\n if (dobleMovimiento) {\n // el segundo movimiento siempre es el opuesto del primero\n this.GuardarMovimientoBD(\n this.state.tipoMovimiento == \"INGRESO\" ? \"EGRESO\" : \"INGRESO\",\n segundoEstado,\n idOrigen,\n idDestino,\n motivo,\n this.state.potreroSelected.IdPotrero\n );\n }\n alert(\"Guardados correctamente\");\n // cerrar el modal\n this.props.toggle();\n }", "title": "" }, { "docid": "c9f92996f057240ab7f28a4822610455", "score": "0.57233447", "text": "function giro(x){\r\n if(x.id == \"bola1\"){\r\n pequenio(-66, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"olive\";\r\n barraBusca(360, 200, 2, 4);\r\n mensajes(660, 1, 1, 4);\r\n }\r\n else if(x.id == \"bola2\"){\r\n pequenio(-22, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"darkred\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(115, 10, 4, 1);\r\n document.querySelector(\"#triangulito\").style.clipPath = \"clip-path: polygon(0% 0%, 100% 0%, 0% 100%)\";\r\n }\r\n else if(x.id == \"bola3\"){\r\n pequenio(22, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"goldenrod\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(660, 1, 0, 4);\r\n }\r\n else if(x.id == \"bola4\"){\r\n pequenio(66, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"darkslateblue\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(660, 1, 0, 4);\r\n }\r\n if(x.id == \"bola5\"){\r\n pequenio(248, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"darkslateblue\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(660, 1, 0, 4);\r\n }\r\n else if(x.id == \"bola6\"){\r\n pequenio(202, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"goldenrod\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(660, 1, 0, 4);\r\n }\r\n else if(x.id == \"bola7\"){\r\n pequenio(158, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"darkred\";\r\n barraBusca(660, 35, 3, 0);\r\n mensajes(115, 10, 4, 1);\r\n document.querySelector(\"#triangulito\").style.clipPath = \"clip-path: polygon(0% 0%, 100% 0%, 0% 100%)\";\r\n }\r\n else if(x.id == \"bola8\"){\r\n pequenio(111, x);\r\n document.querySelector(\"#movil\").style.backgroundColor = \"olive\";\r\n barraBusca(360, 200, 2, 4);\r\n mensajes(660, 1, 0, 4);\r\n }\r\n}", "title": "" }, { "docid": "0f4f5d4eb2647b9b2fc39bbdfe58048d", "score": "0.57224566", "text": "function dibujarTeclado(evento){\n var movimiento = 10; //Moverse de 10 en 10 pixeles\n\n //Switch para los casos de las 4 flechas, comparar keyCode.\n switch(evento.keyCode){\n case teclas.UP:\n dibujarLinea(color, x, y, x, y-movimiento, papel);\n //Importante mantener el punto donde nos quedamos\n y = y - movimiento;\n break;\n case teclas.DOWN:\n dibujarLinea(color, x, y, x, y+movimiento, papel);\n y = y + movimiento;\n break;\n case teclas.LEFT:\n dibujarLinea(color, x, y, x-movimiento, y, papel);\n x = x - movimiento;\n break;\n case teclas.RIGHT:\n dibujarLinea(color, x, y, x+movimiento, y, papel);\n x = x + movimiento;\n break;\n default:\n console.log(\"Otra tecla\")\n }\n}", "title": "" }, { "docid": "804e24279a96909504f250218c886417", "score": "0.57215476", "text": "function estudiante(){\r\n\t//Los id de las imagenes del estudiante\r\n\tvar arregloImgsId = [\"img1F\",\"img2F\", \"img3F\", \"img1A\", \"img2A\", \"img3A\",\"img1I\", \"img2I\", \"img3I\", \"img1D\", \"img2D\", \"img3D\"];\t//Los id de las imagenes del estudiante\r\n\tvar imagen;\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Saber cual fue la ultima imagen utilizada, para dar continuidad a la animacion\r\n\tvar tamanoImagenXE = 86, tamanoImagenYE = 103; \t\t\t\t\t\t\t\t//Tamano de la imagen actual\r\n\tthis.inicio = function(){\r\n\t\tposX=450;\t\t//Inicializamos valores de posicion y vida\r\n\t\tposY=250;\r\n\t\tvidaEst=1000;\r\n\t\tpuntaje=0;\r\n\t};\r\n\t//Dibuja el estudiante en la nueva posicion\r\n\tthis.actualizar = function(ctx){\r\n\t\tctx.clearRect(0, 0, elCanvas.width, elCanvas.height);\r\n\t\tthis.imagen = document.getElementById(arregloImgsId[antImg]);\r\n\t\tctx.drawImage(this.imagen,posX,posY); \t\t\t\t\t\t\t\t\t\t//Dibuja la imagen\r\n\t\tctx.save();\r\n\t\tctx.fillStyle = \"#ffffff\";\r\n\t\tctx.font = \"12px sans-serif\";\r\n\t\tctx.fillText(\"puntos: \"+ puntaje, posX, (posY + 105));\r\n\t\tctx.fillText(\"vida: \"+ vidaEst, posX, posY);\r\n\t};\r\n\t//Valida cuando el estudiante se sale del canvas, si lo hace, reinicia la posicion, para hacer parecer que vuelve al inicio\r\n\tthis.validarColisionPared = function(direccionE){\t\r\n\t\tif(direccionE===\"derecha\"){\r\n\t\t\tif(posX-tamanoImagenXE>tamanoXLienzo){\r\n\t\t\t\tposX=-40;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(direccionE===\"izquierda\"){\r\n\t\t\tif(posX+tamanoImagenXE<0){\r\n\t\t\t\tposX=tamanoXLienzo;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(direccionE===\"arriba\"){\r\n\t\t\tif(posY+tamanoImagenYE<0){\r\n\t\t\t\tposY=tamanoYLienzo;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(direccionE===\"frente\"){\r\n\t\t\tif(posY-tamanoImagenYE>tamanoYLienzo){\r\n\t\t\t\tposY=-40;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t//Valida la colision con otros elementos\r\n\tthis.colision = function(x,y){\r\n\t\tvar distancia=Math.sqrt( Math.pow( (x-posX), 2)+Math.pow( (y-posY),2));\r\n\t\tif(distancia>this.imagen.width){\r\n\t\t\treturn false;\r\n\t\t} else if (distancia<=this.imagen.width){\r\n\t\t\treturn true;\t\r\n\t\t} \r\n\t};\r\n\t//Valida cual imagen se pondrá para simular la animacion de movimiento del estudiante\r\n\tthis.validarImg = function(tecla){\t\t\r\n\t\tvar imgFin;\r\n\t\tif(tecla===39 || tecla===68){\t\t//Si la tecla presionada es la flecha derecha\r\n\t\t\tif (antImg===9){\r\n\t\t\t\timgFin=10;\r\n\t\t\t}\r\n\t\t\tif(antImg===10){\r\n\t\t\t\timgFin=11;\r\n\t\t\t}\r\n\t\t\tif(antImg===11){\r\n\t\t\t\timgFin=9;\r\n\t\t\t}\r\n\t\t\tif (antImg < 9){\r\n\t\t\t\timgFin=11;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(tecla===37 || tecla===65){\t\t//Si la tecla presionada es la flecha izquierda\r\n\t\t\tif (antImg===6){\r\n\t\t\t\timgFin=7;\r\n\t\t\t}\r\n\t\t\tif(antImg===7){\r\n\t\t\t\timgFin=8;\r\n\t\t\t}\r\n\t\t\tif(antImg===8){\r\n\t\t\t\timgFin=6;\r\n\t\t\t}\r\n\t\t\tif(antImg<6 || antImg>8){\r\n\t\t\t\timgFin=7;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(tecla===38 || tecla===87){\t//Si la tecla presionada es la flecha arriba\r\n\t\t\tif (antImg===3){\r\n\t\t\t\timgFin=4;\r\n\t\t\t} \r\n\t\t\tif(antImg===4){\r\n\t\t\t\timgFin=5;\r\n\t\t\t}\r\n\t\t\tif(antImg===5){\r\n\t\t\t\timgFin=3;\r\n\t\t\t}\r\n\t\t\tif(antImg<3 || antImg>5) {\r\n\t\t\t\timgFin=5;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(tecla===40 || tecla===83){\t//Si la tecla presionada es la flecha abajo\r\n\t\t\tif (antImg===0){\r\n\t\t\t\timgFin=1;\r\n\t\t\t} \r\n\t\t\tif(antImg===1){\r\n\t\t\t\timgFin=2;\r\n\t\t\t}\r\n\t\t\tif(antImg===2){\r\n\t\t\t\timgFin=0;\r\n\t\t\t}\r\n\t\t\tif (antImg >2){\r\n\t\t\t\timgFin=1;\r\n\t\t\t}\t\r\n\t\t}\r\n\t\tantImg=imgFin;\r\n\t};\r\n}", "title": "" }, { "docid": "740ca603d5ffe8baa60a4f4b0ee25ff1", "score": "0.5718531", "text": "function actualizaEnemigos() {\n\tif (!modo_pruebas) {\n\t\tfunction agregarDisparos(enemigo, posicion_x, posicion_y) {\n\n\t\t\treturn {\n\t\t\t\tx: posicion_x,\n\t\t\t\ty: posicion_y,\n\t\t\t\twidth: 5,\n\t\t\t\theight: 20,\n\t\t\t\tcontador: 0\n\t\t\t}\n\t\t}\n\t}\n\n\tif (juego.estado == 'iniciando') {\n\n\t\tfor (var i = 0; i < num_enemigos; i++) {\n\t\t\tenemigos.push({\n\t\t\t\tx: 10 + (i * 50),\n\t\t\t\ty: 10,\n\t\t\t\theight: 40,\n\t\t\t\twidth: 40,\n\t\t\t\testado: 'vivo',\n\t\t\t\tcontador: 0,\n\t\t\t\tdireccion: 'abajo'\n\t\t\t});\n\t\t}\n\t\tjuego.estado = 'jugando';\n\t}\n\t//Mover los enemigos\n\tfor (var i in enemigos) {\n\t\tvar enemigo = enemigos[i];\n\t\tif (!enemigo) continue;\n\t\tif (enemigo && enemigo.estado == 'vivo') {\n\t\t\tenemigo.contador++;\n\n\t\t\t//Condiciones para los diferentes niveles\n\n\t\t\tif (enemigos.length == 1 && nivel != ultimo_nivel)\n\t\t\t\tenemigo.x += Math.sin(enemigo.contador * Math.PI / 90) * 2;\n\t\t\telse {\n\t\t\t\tif (aleatorio(0, enemigos.length * 20) == 4) {\n\t\t\t\t\tdisparosEnemigos.push(agregarDisparos(enemigo, enemigo.x, enemigo.y));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (enemigo && enemigo.estado == 'golpeado') {\n\t\t\tenemigo.contador++;\n\t\t\tif (enemigo.contador >= 20) {\n\t\t\t\tenemigo.estado = 'muerto';\n\t\t\t\tpuntos_totales += 100;\n\t\t\t\tenemigo.contador = 0;\n\t\t\t}\n\t\t}\n\t\tif ((enemigo.y > canvas.height - 10)) {\n\t\t\tjuego.estado = 'perdido';\n\t\t\tnave.estado = 'golpeado';\n\t\t}\n\t\t//console.log(enemigo.y + \" \" + enemigo.x+ \" nave: \"+ nave.y + \" \"+nave.x);\n\t\tif (enemigo.y >= nave.y) {\n\n\t\t\tjuego.estado = 'perdido';\n\t\t\tnave.estado = 'golpeado';\n\t\t}\n\n\t}\n\tenemigos = enemigos.filter(function (enemigo) {\n\t\tif (enemigo && enemigo.estado != 'muerto') return true;\n\t\treturn false;\n\t});\n\n}", "title": "" }, { "docid": "1f34149aeb14555fd7c328dfea5fe856", "score": "0.5718452", "text": "function quitarVariable(idProceso) {\n for (let i = 0; i < tablaParticiones.length; i++) {\n const particion = tablaParticiones[i];\n var exito=false;\n if (particion.idProceso==idProceso) {\n particion.estado=0;\n particion.idProceso=null;\n if ((i-1)>=0) {\n var exito2=false;\n const particion2 = tablaParticiones[i-1];\n if (particion2.estado==0) {//unir\n particion2.dirFin=particion.dirFin;\n particion2.tamaño=particion2.tamaño+particion.tamaño;\n exito2=true;\n }\n exito=true;\n if ((i+1)<tablaParticiones.length) {\n const particion3 = tablaParticiones[i+1];\n if (particion3.estado==0) {//unir\n particion2.dirFin=particion3.dirFin;\n particion2.tamaño=particion2.tamaño+particion3.tamaño;\n tablaParticiones.splice((i+1),1);\n }\n }\n if (exito2==true) {\n tablaParticiones.splice(i,1);\n }\n }\n if ((i+1)<=tablaParticiones.length && exito==false) {\n const particion2 = tablaParticiones[i+1];\n if (particion2.estado==0) {//unir\n particion.dirFin=particion2.dirFin;\n particion.tamaño=particion.tamaño+particion2.tamaño;\n tablaParticiones.splice((i+1),1);\n }\n }\n }\n \n }\n}", "title": "" }, { "docid": "c468584ec499a3114b411813ad8e393e", "score": "0.5706954", "text": "function attaqueMonstre (defenseJoueur, pvJoueur){\n\tif (defenseJoueur.innerHTML > 0) {\n\t\tdefenseJoueur.innerHTML = defenseJoueur.innerHTML - 1\n\t\tpvJoueur.innerHTML = pvJoueur.innerHTML - 2\n\t\tif (pvJoueur.innerHTML < 1){\n\t\t\tmort()\n\t\t}\n\t} else {\n\t\tpvJoueur.innerHTML = pvJoueur.innerHTML - 5\n\t\tif (pvJoueur.innerHTML < 1){\n\t\t\tmort()\n\t\t}\n\t}\n//Fonction pour réactiver les boutons \n}", "title": "" }, { "docid": "e40e9e105504a974b48337494a1a03e4", "score": "0.570478", "text": "trasladarDerecha(){\n //Comprueba si la posicion sumando el total de botones es menor que el total de paquetes en la tienda\n //Es decir si hay más sprites\n if((this.paquetesPosicion+this.paquetesButton.length)<this.paquetesTienda.length){\n //Incrementa la posicion\n this.paquetesPosicion++;\n //Cambia los sprites de los botones\n var i;\n for (i = 0; i < this.paquetesButton.length; i++) {\n if(espanol){\n this.paquetesButton[i].setTexture(paquetes[this.paquetesTienda[this.paquetesPosicion+i]].sprite);\n }else{\n this.paquetesButton[i].setTexture(paquetes[this.paquetesTienda[this.paquetesPosicion+i]].spritei);\n }\n }\n }\n \n }", "title": "" }, { "docid": "b1a6143b138df700e7ed45d11f818410", "score": "0.5702915", "text": "function carInicialPosition() {\n //frente do carro\n asaEsquerdafrontal.matrix.multiply(mat4.makeTranslation(-2.3, 4.5, 0.6));\n asaDireitoFrontal.matrix.multiply(mat4.makeTranslation(2.3, 4.5, 0.6));\n banco.matrix.multiply(mat4.makeTranslation(0, 0, 0.3));\n apoioBanco.matrix.multiply(mat4.makeTranslation(0, -0.3, 0.5));\n frenteDoCarro.matrix.multiply(mat4.makeTranslation(0, 4.5, 0));\n conexaoFrontal.matrix.multiply(mat4.makeTranslation(0, 3.25, 0.6));\n\n //meio do carro\n chassi.matrix.multiply(mat4.makeTranslation(0, 0, 1));\n cabine.matrix.multiply(mat4.makeTranslation(0, 0, 0.2));\n volante.matrix.multiply(mat4.makeTranslation(0, 1.2, 0.6));\n apoioVolante.matrix.multiply(mat4.makeTranslation(0, 1.7, 0.6));\n ponteCentral.matrix.multiply(mat4.makeTranslation(0, 0.2, 0));\n arcoEsquerdo.matrix.multiply(mat4.makeTranslation(-0.6, 0.2, 0));\n arcoDireito.matrix.multiply(mat4.makeTranslation(0.6, 0.2, 0));\n\n //traseira do carro\n wing.matrix.multiply(mat4.makeTranslation(0, -2, 1.5));\n rightWing.matrix.multiply(mat4.makeTranslation(2, -2, 1.5));\n leftWing.matrix.multiply(mat4.makeTranslation(-2, -2, 1.5));\n escapamentoEsquerdo.matrix.multiply(mat4.makeTranslation(-0.4, -1.9, 0));\n escapamentoDireito.matrix.multiply(mat4.makeTranslation(0.4, -1.9, 0));\n suporteEsquerdoWing.matrix.multiply(mat4.makeTranslation(-0.5, -2, 0.76));\n suporteDireitoWing.matrix.multiply(mat4.makeTranslation(0.5, -2, 0.76));\n\n //rodas e eixo\n eixoFrontal.matrix.multiply(mat4.makeTranslation(0, 3.2, 0));\n suporteEixoFrontalDireito.matrix.multiply(\n mat4.makeTranslation(1, 3.2, 0.2)\n );\n suporteeixoFrontalEsquerdo.matrix.multiply(\n mat4.makeTranslation(-1, 3.2, 0.2)\n );\n eixoTraseiro.matrix.multiply(mat4.makeTranslation(0, -2, 0));\n rodaDianteiraDireita.matrix.multiply(mat4.makeTranslation(-1.7, 3.2, 0));\n rodaTraseiraDireita.matrix.multiply(mat4.makeTranslation(1.7, -2, 0));\n rodaDianteiraEsquerda.matrix.multiply(mat4.makeTranslation(1.7, 3.2, 0));\n rodaTraseiraEsquerda.matrix.multiply(mat4.makeTranslation(-1.7, -2, 0));\n\n texturaConexaoFrontal.matrix.multiply(mat4.makeTranslation(0, 3.25, 0.955));\n texturaConexaoFrontalInferior.matrix.multiply(\n mat4.makeTranslation(0, 3.25, 0.23)\n );\n texturaConexaoFrontalEsquerda.matrix.multiply(mat4.makeTranslation(-0.41, 3.255, 0.6));\n texturaConexaoFrontalDireita.matrix.multiply(mat4.makeTranslation(0.41, 3.255, 0.6));\n texturaConexaoFrontalFrente.matrix.multiply(mat4.makeTranslation(0, 5, 0.605));\n\n texturaAsaCima.matrix.multiply(mat4.makeTranslation(0, -2, 1.61));\n texturaAsaLateral.matrix.multiply(mat4.makeTranslation(0, -1.69, 1.52));\n texturaAsaLateralTraseira.matrix.multiply(\n mat4.makeTranslation(0, -2.31, 1.52)\n );\n texturaAsaBaixo.matrix.multiply(mat4.makeTranslation(0, -2, 1.39));\n\n texturaConexaoFrontalVolante.matrix.multiply(mat4.makeTranslation(0, 1.504, 0.557));\n\n texturaChassi.matrix.multiply(mat4.makeTranslation(0, 0, 0.258));\n texturaChassiInferior.matrix.multiply(mat4.makeTranslation(0, 0, -0.257));\n texturaChassiFrontal.matrix.multiply(mat4.makeTranslation(0, 2.36, 0));\n texturaChassiTraseira.matrix.multiply(mat4.makeTranslation(0, -2.38, 0));\n texturaChassiLateralEsquerda.matrix.multiply(\n mat4.makeTranslation(-1.01, 0, 0)\n );\n texturaChassiLateralDireita.matrix.multiply(\n mat4.makeTranslation(1.01, 0, 0)\n );\n }", "title": "" }, { "docid": "50ffe9cf7a1ee7ae1f63702a21615a01", "score": "0.5698421", "text": "function empezarJuego() {\n palabraInput.value = palabraInput.value.toLowerCase();\n if (palabrasCorrectas()) {\n //tiempo = nivelActual;\n getPalabra(palabraActual);\n palabraInput.value = '';\n puntuacion++;\n }\n\n // Si no se logra escribir la palabra a tiempo\n if (puntuacion === -1) {\n puntuacionDisplay.innerHTML = 0;\n } else {\n puntuacionDisplay.innerHTML = puntuacion;\n puntuacionMaxima.innerHTML = puntuacion;\n\n if (puntuacion >= maxScore) {\n localStorage.setItem('maximaPuntuacion', puntuacion);\n }\n }\n maximaPuntuacion = localStorage.getItem('maximaPuntuacion');\n puntuacionDisplay.innerHTML = puntuacion;\n puntuacionMaxima.innerHTML = maximaPuntuacion;\n}", "title": "" }, { "docid": "a1c223cd4abd24c9458ad824ea5c37ab", "score": "0.56949276", "text": "function Reconocimiento_por_Impacto(Etiqueta,Palabras,Velocidad_Inicial,Indice_Inicial,Cantidad_Inicial){\n //this.Palabras=Palabras;\n Dom=Etiqueta;\n Velocidad_Interna=Velocidad_Inicial;\n Indice=Indice_Inicial;\n Velocidad_Externa=1;\n Cantidad=Cantidad_Inicial;\n velocidad_standard=Velocidad_Inicial; \n tiempo_de_percepcion=(60/velocidad_standard)*1000;\n //alert(tiempo_de_percepcion);\n //clearTimeout(Controlador);\n}", "title": "" }, { "docid": "d98f1cf70bca0fd951391079426c9c83", "score": "0.5694839", "text": "function mover() {\n\tlugar[0] += hormiga[0];\n\tlugar[1] += hormiga[1];\n\tif ((lugar[0] >= columnas)) lugar[0] = 0;\n\tif ((lugar[1] >= filas)) lugar[1] = 0;\n\tif ((lugar[0] < 0)) lugar[0] = columnas - 1;\n\tif ((lugar[1] < 0)) lugar[1] = filas - 1;\n\tif ((direccion[tablero[lugar[0]][lugar[1]]] === 'D')) { //Derecha\n\t\tif ((hormiga[0] < 0)) hormiga = [0,1];\n\t\telse if ((hormiga[0] > 0)) hormiga = [0,-1];\n\t\telse if ((hormiga[1] < 0)) hormiga = [-1,0];\n\t\telse hormiga = [1,0];\n\t} else { //Izquierda\n\t\tif ((hormiga[0] < 0)) hormiga = [0,-1];\n\t\telse if ((hormiga[0] > 0)) hormiga = [0,1];\n\t\telse if ((hormiga[1] < 0)) hormiga = [1,0];\n\t\telse hormiga = [-1,0];\n\t}\n\ttablero[lugar[0]][lugar[1]] += 1;\n\tif ((tablero[lugar[0]][lugar[1]] == tamdir)) tablero[lugar[0]][lugar[1]] = 0;\n}", "title": "" }, { "docid": "fd7daec21652d38b3b9cc4ee6cbf97b0", "score": "0.5694038", "text": "No_Existen(valor,pos_x,pos_y){\n this.l_horizontal.insertar(pos_x);\n this.l_Vertical.insertar(pos_y);\n let nodo_x = this.l_horizontal.busqueda(pos_x);\n let nodo_y = this.l_Vertical.busqueda(pos_y);\n let nodo_O = new Nodo(valor,pos_x,pos_y);\n //here I vinculate a new nodo_O with the l_horizontal / l_vertical nodo\n nodo_x.abajo = nodo_O;\n nodo_O.arriba = nodo_x;\n\n nodo_y.der = nodo_O;\n nodo_O.izq = nodo_y\n return;\n }", "title": "" }, { "docid": "03f0af159e7455b52682400795b5b143", "score": "0.56928414", "text": "validatehasMovement() {\n if (\n this.state.estadoPotreroOrigen != null &&\n this.getCantTotalMov(this.state.estadoPotreroOrigen) == 0\n ) {\n return \"No existen movimientos\";\n }\n return \"\";\n }", "title": "" }, { "docid": "26d0e218851adbbeb79034cf34206e49", "score": "0.5689891", "text": "function dibujarTeclado(evento) {\r\n var colorTrazo = \"blue\"\r\n var movimiento = 5;\r\n console.log(evento);\r\n direccion[evento.keyCode] = true;\r\n\r\n //Mover la linea diagonalmente\r\n if (direccion[teclas.LEFT]) {\r\n dibujarLinea(colorTrazo, x, y, x-movimiento, y, papel);\r\n x = x - movimiento;\r\n }\r\n if (direccion[teclas.UP]) {\r\n dibujarLinea(colorTrazo, x, y, x, y - movimiento, papel);\r\n y = y - movimiento;\r\n }\r\n if (direccion[teclas.RIGHT]) {\r\n dibujarLinea(colorTrazo, x, y, x+movimiento, y, papel);\r\n x = x + movimiento;\r\n }\r\n if (direccion[teclas.DOWN]) {\r\n dibujarLinea(colorTrazo, x, y, x, y+movimiento, papel);\r\n y = y + movimiento;\r\n }\r\n}", "title": "" }, { "docid": "83446817d4e732cc7af9f517adcfc24a", "score": "0.5685532", "text": "function to_move(){\n\t\t\t\t\tlet move_speed = parseFloat(our_speed);\n\t\t\t\t\tif (move_speed === 0) { //if speed is zero\n\t\t\t\t\t\tdiv2.style.margin = \"0px 0px 0px \" + position;\n\t\t\t\t\t}\n\t\t\t\t\telse { //if speed is not zero\n\t\t\t\t\t\tlet change = move_speed/10;\n\t\t\t\t\t\tlet new_position = parseFloat(position);\n\n\t\t\t\t\t\tif (new_position <= 0) { //if need to make box forward\n\t\t\t\t\t\t\tforward = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (new_position >= 85) { //if need to make box backward\n\t\t\t\t\t\t\tforward = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (forward === true) { //change position if forward\n\t\t\t\t\t\t\tnew_position = new_position + change;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse { //change position if backward\n\t\t\t\t\t\t\tnew_position = new_position - change;\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\tposition = new_position.toString() + \"%\";\n\t\t\t\t\t\tdiv2.style.margin = \"0px 0px 0px \" + position;\n\t\t\t\t\t}\n\n\t\t\t\t\tmove_call_back();\n\t\t\t\t}", "title": "" }, { "docid": "11a18e2ee62abf7d519bad2dd1d85055", "score": "0.56813663", "text": "draw() {\n\n this.cronometroDeMoeda--;\n\n // se inimigos em tela < 2\n if (this.cronometroDeMoeda <= 0 && this.filaDeMoedas.length < jogo.configuracoes.moedas.maximoDeMoedasNaTela) {\n this.cronometroDeMoeda = jogo.configuracoes.moedas.tempoParaProxima;\n let moeda = this.getMoedaAleatorio();\n if (moeda) {\n this.filaDeMoedas.push(moeda);\n }\n }\n\n // exibe e move os inimigos\n let moedaEmJogo;\n\n for (let i = 0, n = this.filaDeMoedas.length; i < n; ++i) {\n moedaEmJogo = this.filaDeMoedas[i];\n moedaEmJogo.draw();\n moedaEmJogo.move();\n }\n\n for (let i = this.filaDeMoedas.length - 1; i >= 0; i--) {\n moedaEmJogo = this.filaDeMoedas[i];\n\n if (moedaEmJogo.estaForaDaTela() || moedaEmJogo.isColetada()) {\n this.filaDeMoedas.splice(i, 1);\n moedaEmJogo.libera();\n }\n }\n }", "title": "" }, { "docid": "24e1376227ed23b33a0f46dbbeb1d2c9", "score": "0.5675189", "text": "function introducirDatos() {\n let continuar; // Bandera para controlar el ciclo\n do {\n let nombre = nombreCorrecto();\n let hora = horasCorrectas();\n let turno = turnoCorrecto();\n continuar = continuarCorrecto();\n grabarTrabajador(nombre, hora, turno);\n calcularSalario(hora, turno);\n } while (continuar != \"s\");\n}", "title": "" } ]
81187060d9ce253a1a8fbfd4a5b86ddc
counts the number of votes a republican state has (ex: cali has 55) and returns that number
[ { "docid": "c2fd94900b55825abf74ab09a5d72dc7", "score": "0.85233927", "text": "function countRepVotes(state){\n totalVotes = 0;\n var repLength = republicans.length;\n for(var j = 0; j < repLength; j++){\n if(republicans[j] == state){\n totalVotes = totalVotes + 1;\n }\n }\n return totalVotes;\n}", "title": "" } ]
[ { "docid": "be279cec3ebce6362dec9b4cc9ed9da2", "score": "0.7787436", "text": "function countDemVotes(state){\n totalVotes = 0;\n var demLength = democrats.length;\n for(var j = 0; j < demLength; j++){\n if(democrats[j] == state){\n totalVotes = totalVotes + 1;\n }\n }\n return totalVotes;\n}", "title": "" }, { "docid": "825122ba881fc76f88a8b10ff67f3481", "score": "0.70099175", "text": "function countVotes(votes) {\n var voteCount = {\n A: 0,\n B: 0,\n C: 0,\n D: 0\n };\n for (var vote in votes) {\n voteCount[votes[vote]]++\n }\n return voteCount;\n}", "title": "" }, { "docid": "a4e021976d83adbda5f39b927fef3aec", "score": "0.680605", "text": "countVotes(){\n // true means yea, false means nay\n let yeaCount = 0\n let nayCount = 0\n for (let player in this.gameState.votes){\n if(this.gameState.votes[player]){\n yeaCount++\n }\n else{\n nayCount++\n }\n }\n return yeaCount > nayCount\n }", "title": "" }, { "docid": "375ac651795b4d94992d1abcd1e797bc", "score": "0.66446424", "text": "function totalVotes(arr) {\n const voted = arr.reduce(function(final, voter) {\n if (voter.voted) {\n final++;\n }\n return final;\n }, 0);\n return voted;\n}", "title": "" }, { "docid": "e156cbfb0604005359fffdb622440cb1", "score": "0.64605457", "text": "function calculateRanking(votes) {\n const rank = instructors.filter((instructor) => {\n return instructor.votes > votes;\n }).length + 1;\n return rank;\n }", "title": "" }, { "docid": "71a0d78fda74deac7679d2495dbc9bb7", "score": "0.6356435", "text": "function voteTallyer() {\r\n for (var voter in votes) {\r\n for (var position in voteCount) {\r\n if (voteCount[position].hasOwnProperty(votes[voter][position])) {\r\n voteCount[position][votes[voter][position]] += 1;\r\n }\r\n else {\r\n voteCount[position][votes[voter][position]] = 1;\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "1b57ca293181219aa69dca0618670b52", "score": "0.6350686", "text": "function totalVotes(arr) {\n return arr.reduce((count, voter) => count + voter.voted, 0)\n\n }", "title": "" }, { "docid": "854fb86bf2358de73b9e187ebd61ec56", "score": "0.63238627", "text": "get_count(state) {\n let count = { \"Normal\": 0, \"Risk\": 0 };\n for (var i = 0; i < this.people.length; i++) {\n if (this.people[i].state == state) {\n if (this.people[i].group.name == \"Normal\") {\n count[\"Normal\"]++;\n }\n else if (this.people[i].group.name == \"Risk\") {\n count[\"Risk\"]++;\n }\n }\n }\n return count;\n }", "title": "" }, { "docid": "41692c9e9c55ea6e3e7924171a043756", "score": "0.6297661", "text": "function findNumberVotes(array) {\n for (let i = 0; i < array.length; i++) {\n if (array[i].party === \"R\") {\n statistics.numberOfRepublicans++;\n statistics.votesRepublicans += array[i].votes_with_party_pct;\n } else if (array[i].party === \"D\") {\n statistics.numberOfDemocrats++;\n statistics.votesDemocrats += array[i].votes_with_party_pct;\n }\n if (array[i].party === \"I\") {\n statistics.numberOfIndependents++;\n (statistics.votesIndependents += array[i].votes_with_party_pct) /\n statistics.numberOfIndependents;\n } else {\n statistics.votesIndependents = 0;\n statistics.numberOfIndependents = 0;\n }\n }\n statistics.votesRepublicans =\n statistics.votesRepublicans / statistics.numberOfRepublicans;\n statistics.votesDemocrats =\n statistics.votesDemocrats / statistics.numberOfDemocrats;\n\n statistics.totalVotesPolitics =\n statistics.numberOfDemocrats +\n statistics.numberOfRepublicans +\n statistics.numberOfIndependents;\n statistics.votesRepublicans = Math.round(statistics.votesRepublicans);\n statistics.votesDemocrats = Math.round(statistics.votesDemocrats);\n statistics.votesIndependents = Math.round(statistics.votesIndependents);\n // console.log(votesDemocrats, votesRepublicans, votesIndependents);\n}", "title": "" }, { "docid": "7752b6fab669ba82ba09ad84d3e5497c", "score": "0.6291533", "text": "getNumberOfRatings() {\n return this.state.numOfRatings\n }", "title": "" }, { "docid": "95f0c5d3feb1fa31667b32e42178c55e", "score": "0.62602615", "text": "function totalVoters(arr)\n{\n count = 0;\n arr.filter(function(voter)\n {\n if (voter.voted == true)\n {\n return(count += 1);\n }\n });\n return(count);\n}", "title": "" }, { "docid": "9580d14d800b9c65f35ac64208490f8d", "score": "0.62522763", "text": "getResults() {\n var amount = this.state.answersCount;\n return amount;\n }", "title": "" }, { "docid": "2b3c3353d9dd8ada6fc7c535df49c6fe", "score": "0.61908376", "text": "async vote() {\n this.totalVote++;\n }", "title": "" }, { "docid": "f4892e5d0f2f50908c480de2270f867b", "score": "0.6180857", "text": "upVote() {\n this.upvotes++;\n }", "title": "" }, { "docid": "8f51e86d891a9c7e0d6ce41bd2f674a3", "score": "0.6125834", "text": "function count() {\n return count;\n }", "title": "" }, { "docid": "ae97b1bb99b407e82513dff7fe062f8a", "score": "0.60667914", "text": "function voteCounter(votes) {\n let current = -1;\n let timer = setInterval(function() {\n current++;\n document.getElementById(\"vote-counter\").textContent = current\n if(current == votes) {\n clearInterval(timer);\n }\n }, 100);\n}", "title": "" }, { "docid": "ce7a72c4751d0d9d76c23111727e5791", "score": "0.5938808", "text": "function countSuits(){\n return suits;\n}", "title": "" }, { "docid": "1cb19c71448a4301844d18ec93994ccf", "score": "0.59284234", "text": "function getPeopleVoteNumber(matiere, name)\n \t{\n \t\tvar value = 0;\n \t\tfor(x in votes[name][matiere])\n \t\t{\n \t\t\tvalue += 1;\n \t\t}\n \t\treturn value;\n\n \t}", "title": "" }, { "docid": "9f29862db0f97ab069ccb9409ec9ac56", "score": "0.5925955", "text": "_tallyVotes() {\n\t\tthis._voteCounts = new Array(this.choiceValues.length);\n\t\tthis._voteCounts.fill(0);\n\t\tthis._verifiedVoteCounts = new Array(this.choiceValues.length);\n\t\tthis._verifiedVoteCounts.fill(0);\n\t\tconst votes = this._internal['votes'];\n\t\tif (votes) {\n\t\t\tfor (const voter of Object.keys(votes)) {\n\t\t\t\tconst isVerified = this._internal['uidUser'] && this._internal['uidUser'][voter];\n\t\t\t\tif (this.multiple) {\n\t\t\t\t\tfor (const choiceId of votes[voter]) {\n\t\t\t\t\t\tthis._incrementVote(choiceId, isVerified);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst choiceId = votes[voter];\n\t\t\t\t\tthis._incrementVote(choiceId, isVerified);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "e93c9747e98f45f43d875b7e62b764b2", "score": "0.5924859", "text": "function totalVotes(arr) {\n // your code here\n}", "title": "" }, { "docid": "7bc4c5c15f4cc21164931d0bc83e7d35", "score": "0.59106916", "text": "venueCount() {\n return (school, category) => {\n return school.venues.reduce((total, venue) => {\n if (category.indexOf(venue.venue_type) != -1) {\n total++;\n }\n return total;\n }, 0);\n }\n }", "title": "" }, { "docid": "8adb11a5bcf921d37aa274af811f0503", "score": "0.5907865", "text": "function soldierCount(state, region) {\n\tvar list = state.s[region.i];\n\treturn list ? list.length : 0;\n}", "title": "" }, { "docid": "d93d43312a438cc6f01ad754d4f5829b", "score": "0.5890714", "text": "function totalVotes(arr) {\n return arr.reduce((acc, cur) => \n acc + cur.voted, 0)\n}", "title": "" }, { "docid": "2c29c10e5e2c654224eaa56ae197b37b", "score": "0.58864564", "text": "get result() {\n return this.votes[0] > this.votes[1] ? 0 : 1;\n }", "title": "" }, { "docid": "591e7f2141eed128b0871192a4939d0e", "score": "0.58782464", "text": "function print_number_of_laureates(prize_winners) {\n prizes = iterate_prizes(prize_winners);\n number_of_laureates = 0;\n for (prize in prizes) {\n for (laureate in prizes[prize][\"laureates\"]) {\n number_of_laureates++;\n }\n }\n console.log(number_of_laureates);\n}", "title": "" }, { "docid": "d189c48ef70bba0e0610cf6987848a88", "score": "0.5870643", "text": "function totalVoters(arr) {\n return arr.reduce(function(x, y){\n\n return x + y.voted } , 0);\n }", "title": "" }, { "docid": "e0aa2b722f137e6909d750c1336eab6d", "score": "0.585155", "text": "count() {}", "title": "" }, { "docid": "045566f0fa31e8c121fdba0d3daaedcf", "score": "0.5844163", "text": "function countdict(votedict, randomExe) {\n const keys = Object.keys(votedict); // get all name\n let countlist = []; // list for max\n let curMax = 0;\n for (let i = 0; i < keys.length; i++) {\n\tconst key = keys[i];\n\tif (votedict[key] > curMax) {\n curMax = votedict[key];\n\t countlist = [key];\n\t} else if (votedict[key] === curMax) {\n\t countlist.push(key);\n\t}\n }\n if (countlist.length === 1) {\n return countlist[0];\n } else if (countlist.length > 1) { // most vote more than one\n if (randomExe === 0) { // no exe\n return \"\";\n } else if (randomExe === 1) { // random exe\n countlist = shuffle(countlist);\n return countlist[0];\n } else {\n // sanity check\n alert(\"Code broken.\");\n }\n } else {\n // sanity check\n alert(\"Code broken.\");\n }\n}", "title": "" }, { "docid": "60b68ebe44378ebe9397404fac615aa2", "score": "0.5834512", "text": "function Candidate({ name, year, votes, img_url }) {\n const [voteCount, setVoteCount] = React.useState(votes || 0);\n const handleClick = (event) => {\n setVoteCount(voteCount + 1);\n };\n\n return (\n <article>\n <h3>{name}</h3>\n <div className=\"year\">Released in {year}</div>\n <div>{voteCount} votes</div>\n <button onClick={handleClick}>+1 vote</button>\n <img alt={`${name} logo`} src={img_url} />\n </article>\n );\n}", "title": "" }, { "docid": "c44257d4509f1b9922b37fc1d35c73fb", "score": "0.58136284", "text": "get votes() {\n return this.voteResults[0] + this.voteResults[1];\n }", "title": "" }, { "docid": "2521e41beb5e6de78ba7e82ec6d59863", "score": "0.5810766", "text": "uncheckedCount() {\n const book = this;\n if (typeof book.chapters === 'undefined') {\n // no chapters in selected book\n return 0;\n }\n const count = book.chapters.length;\n const checked = Results.find({\n book_id: book._id,\n user_id: Meteor.userId(),\n checked: true,\n }).count();\n return count - checked;\n }", "title": "" }, { "docid": "cf0e40762aa18062995cc2ca98994d50", "score": "0.57962626", "text": "function CountPersonsInState(State)\n{\n let countByState = addressBook.reduce(((count,contact) => {if(contact.state == State) return count+1; return count;}),0);\n console.log(\"\\nNo of contacts in State \" +State+\" are : \"+countByState);\n}", "title": "" }, { "docid": "e443e4c8c819582fef7f561416f71340", "score": "0.57912594", "text": "function totalVotes(qi){\n\t\tlet totalvotes = 0;\n\n\t\tfor(let i = 0; i<data[qi].ques_options.length;i++){\n\t\t\ttotalvotes += parseInt(data[qi].ques_options[i].votes);\n\t\t}\n\n\t\treturn totalvotes;\n\t}", "title": "" }, { "docid": "62ac0870e2dd40b04a1d4c9938b907f7", "score": "0.578742", "text": "function counter(p) {\n\tvar output = pullAll();\n\treturn _.countBy(output, function(res) {\n\t\treturn res == p ? 'win': 'lose';\n\t});\n}", "title": "" }, { "docid": "551cc53a720c8d3b529a0ece40e0d279", "score": "0.57575834", "text": "function totalVoters(arr)\n{\n var result = arr.reduce(function(a, b)\n {\n return a + b.voted;\n }, 0)\n return result;\n}", "title": "" }, { "docid": "15c998abcbf9d532499876362ca249ff", "score": "0.572801", "text": "function print_number_of_categories() {\n prizes = iterate_prizes(nobel_prize_winners_2017);\n number_of_categories = 0;\n for (prize in prizes) {\n number_of_categories++;\n }\n console.log(number_of_categories);\n}", "title": "" }, { "docid": "5d6018b96d4bdde2a78db14aba1d334d", "score": "0.5726923", "text": "function showVotes () {\n var jsonFile = path.join(__dirname, 'dataFiles', 'vote' + req.body.selectTeacherroom + '.json');\n var dataLoad = fs.readFileSync(jsonFile, String);\n var dataLoadReady = JSON.parse(dataLoad);\n var room = req.body.selectTeacherroom;\n var votes = dataLoadReady.vote.length;\n voteCounts = 0;\n for (i = 0; i < votes; i++) { //only the countable votes for a specified room\n if (dataLoadReady.vote[i].vote == \"1\" && dataLoadReady.vote[i].room == room)\n {voteCounts++}\n }\n io.emit('voteUpdate', voteCounts);\n console.log (\"Votes in \", room, \": \", voteCounts);\n\n }", "title": "" }, { "docid": "30e0b573ae713b28012ddd6b11735338", "score": "0.572166", "text": "function getCount (){\n\t\t\t\treturn parseInt(get('count'));\n\t\t\t\t}", "title": "" }, { "docid": "3397b97a67326374de78f83b9c0e3bdc", "score": "0.5701374", "text": "tellCount(){\n const variable = this.state;\n if(variable.value === 0){\n return 'ZERO';\n }\n else{\n return variable.value;\n }\n }", "title": "" }, { "docid": "3b4cad5c18b1ba64484f64c9db47cbb6", "score": "0.56724864", "text": "function getResultsCount() {\n const resultsReturned = $('.facetwp-template .row').children().length;\n\n $('.archive-header__count span').text(resultsReturned);\n }", "title": "" }, { "docid": "84fdbfffd0544aa04f718a875082574f", "score": "0.5658556", "text": "function getEstimateRevisionCount(req, res) {\n EstimateItem.count({ \"estimateId\": req.body.estimateId }).exec(function (err, estimateddata) {\n if (err) {\n res.json({ code: Constant.ERROR_CODE, message: err });\n } else {\n res.json({ code: Constant.SUCCESS_CODE, count: estimateddata });\n }\n });\n}", "title": "" }, { "docid": "ae3ff3f0305f4bae816ce63b767c2ff2", "score": "0.5656923", "text": "function addCountAnswer() {\n answersTotal++;\n }", "title": "" }, { "docid": "cd934e3dc89e10d6b1d87ee8453801c3", "score": "0.56550515", "text": "function count() {\n punten.forEach(element => {\n if (element == 1) {\n een++;\n }\n if (element == 2) {\n twee++;\n }\n if (element == 3) {\n drie++;\n }\n if (element == 4) {\n vier++;\n }\n if (element == 5) {\n vijf++;\n }\n });\n}", "title": "" }, { "docid": "94d5b43073f2e2e7bc0b776cead7f56a", "score": "0.56274796", "text": "function countingValleys(n, s) {\n let alt = 0;\n let valleys = 0;\n for (let i = 0; i < n; i++) {\n s.charAt(i) === \"D\" ? alt-- : alt++;\n if (alt === 0 && s.charAt(i) === \"U\") {\n valleys++;\n }\n }\n return valleys;\n}", "title": "" }, { "docid": "449244c079e35b5bbb73afd5084d3822", "score": "0.56273395", "text": "function gameCount(unique) {\n\n var num = 0;\n jQuery.each(h5gf.gameData.get(), function(index, val) {\n var property = unique.split(\"-\")[0];\n if (property == \"markets\") property = \"market\";\n //determine if the property is array \n if (h5gf.gameData.get()[index][property].length > 0) {\n jQuery.each(h5gf.gameData.get()[index][property], function(index2, val2) {\n if (h5gf.gameData.get()[index][property][index2].slug == unique) {\n num++;\n }\n });\n } else {\n if (h5gf.gameData.get()[index][property].slug == unique) {\n num++;\n }\n }\n });\n return num;\n\n }", "title": "" }, { "docid": "322520eff9d5da40b9adff5aad030237", "score": "0.5622288", "text": "function electionsWinners2(votes, k) {\n let possibleWinners = 0\n const biggestVote = Math.max(...votes)\n for(let num of votes){\n if(num + k >biggestVote){\n possibleWinners ++\n }\n }\n if(k===0){\n if(votes.filter(x=>x===biggestVote).length>1){\n return 0\n }else{\n return 1\n }\n }else{\n return possibleWinners\n }\n}", "title": "" }, { "docid": "597d01975ab75f81929f1ae9041c260d", "score": "0.56204844", "text": "function update_vote(num, candidate_id) {\n $('#support_level_candidate_' + candidate_id).text(num);\n \n if (num > $('.election_baseline_slider').val()) {\n \n }\n}", "title": "" }, { "docid": "9382a12e2b82e6e0ebbc3d276766aa23", "score": "0.56163263", "text": "getNumberOfDVDProducts() {\n let numberOfDVDItems = 0;\n for (let i = 0; i < this.state.cartItems.length; i++) {\n if (this.state.cartItems[i].category === \"DVD\") {\n numberOfDVDItems++;\n }\n }\n return numberOfDVDItems;\n }", "title": "" }, { "docid": "3b3d7264b6ce9033f2f8e56ba30ba688", "score": "0.5612998", "text": "function getVotes(){\n if (isBeta) {\n getBetaVotes();\n } else {\n getClassicVotes();\n }\n }", "title": "" }, { "docid": "1a8758c318d20092cbaaea78bcc4ba99", "score": "0.5612512", "text": "#scoreUser(user){\n var bets = user.getBets(),\n tally = 0;\n \n for (var i = 0; i < this.results.length; i++) {\n if (this.results[i] == bets[i]){\n switch(i){\n case 20:\n tally += 2;\n break;\n case 21:\n tally += 3;\n break;\n case 22:\n tally += 4;\n break;\n default:\n tally += 1;\n break;\n }\n }\n }\n return tally;\n }", "title": "" }, { "docid": "add8ace333b78af09767098330ff3e0c", "score": "0.55999416", "text": "function count() {\n}", "title": "" }, { "docid": "8bace67fff446933504d9a4ecf8575cc", "score": "0.55997664", "text": "function clickVote() {\r\n var select = event.target.title;\r\n for(var i = 0; i <picArray.length; i++){\r\n if(select === picArray[i].title) {\r\n picArray[i].vote ++;\r\n }\r\n }\r\n console.table(picArray);\r\n generateImages();\r\n console.table(picArray);\r\n if(voteRounds === 0) {\r\n hide(picVote);\r\n makeAChart();\r\n }\r\n voteRounds --;\r\n console.log(voteRounds)\r\n}", "title": "" }, { "docid": "78f2abf3999d9c3d304a4ceb014e6275", "score": "0.5599227", "text": "function countingValleys(n, s) {\n\n // 1. Eliminate all steps that equalize to sea level e.g. UD ur UUDD\n return equalizeSeaLevel(n, s.trim());\n\n}", "title": "" }, { "docid": "d74f321f70f4a5a00cf77c666fb8b8b2", "score": "0.5594665", "text": "score(state, neighbors) {\n\t\tif ((state === 1 && neighbors === 2) || neighbors === 3) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "title": "" }, { "docid": "fbd4e1a9951ec2565c3dc7444df4b4e8", "score": "0.55869216", "text": "function counts() {\n confirmCount = 0;\n riddleCount = 0;\n noCount = 0;\n count = 0;\n attempt = 3;\n}", "title": "" }, { "docid": "3c73db0e235ed079bb94d4363bc2c7f7", "score": "0.558097", "text": "function numberOfViews(book) {\n return book.turn('pages') / 2 + 1;\n}", "title": "" }, { "docid": "870294779a7209a0c834d06b67fe9538", "score": "0.55787987", "text": "function updateCount(card){\n if(card[\"value\"] > 9 || card[\"value\"] === 1){\n count--;\n }else if(card[\"value\"] > 1 && card[\"value\"] < 7 ){\n count++;\n }\n console.log(count);\n}", "title": "" }, { "docid": "6da1e0d171d25fd9625620e86c72a5f4", "score": "0.5576717", "text": "function candies(stu) {\n var numOfCandies = stu.reduce(\n (p, c) => { return p += c['candies']; }, 0);\n console.log(numOfCandies);\n}", "title": "" }, { "docid": "8a705ba27f4d1735f3bd05248b157e83", "score": "0.55698276", "text": "function guessCount () {\n\t\tcount++;\n\t}", "title": "" }, { "docid": "a821f2dfee7cf410de494eda262a49f6", "score": "0.5560237", "text": "countEvens() {\n\n }", "title": "" }, { "docid": "79da41074a828bf15244f42d0635db0d", "score": "0.5557989", "text": "function countPoints() {\n compteur = document.querySelector(\"h2\");\n return compteur.innerHTML++;\n}", "title": "" }, { "docid": "1e3a05520e13287b72811b14e7724c32", "score": "0.5556882", "text": "getNumberOfLikes(){\n Axios.get('/users/'+this.state.user.id + '/posts/' + this.state.postId + '/likes')\n .then(res => {\n var data = res.data;\n var numLikes = data.length\n this.setState({numLikes: numLikes});\n })\n .catch(error => {\n //console.log(error)\n })\n}", "title": "" }, { "docid": "111fcf51d8af8abada4e9e026fac941b", "score": "0.5546875", "text": "function electionsWinners(votes = [], k) {\n // max of votes will win\n // if item + (1...k) is greater than to max\n let max = Math.max(...votes);\n let count = 1;\n votes.splice(votes.indexOf(max), 1);\n for (let i = 0; i < votes.length; i++) {\n let sum = 0;\n for (let j = 1; j <= k; j++) {\n sum = votes[i] + j;\n if (sum > max) {\n count++;\n break;\n }\n }\n }\n return count;\n}", "title": "" }, { "docid": "4a3d491869433ad2c1581332e51aa8d8", "score": "0.55428046", "text": "displayNbrOfComs(idPost) {\n const { comToCount } = this.state\n const tmp = comToCount.filter(element => idPost === element.idPost)\n\n return tmp.length\n }", "title": "" }, { "docid": "2d2ac398ea493f8e7100147e082e4500", "score": "0.5535598", "text": "function updateCounts() {\n const counts = knnClassifier.getCountByLabel();\n\n select('#exampleRock').html(counts['Rock'] || 0);\n select('#examplePaper').html(counts['Paper'] || 0);\n \n}", "title": "" }, { "docid": "2d2ac398ea493f8e7100147e082e4500", "score": "0.5535598", "text": "function updateCounts() {\n const counts = knnClassifier.getCountByLabel();\n\n select('#exampleRock').html(counts['Rock'] || 0);\n select('#examplePaper').html(counts['Paper'] || 0);\n \n}", "title": "" }, { "docid": "062415bab6efab4512713362e7b1ffc3", "score": "0.5529352", "text": "function countSalutes(hallway) {\n let s=0, r=0;\n for(let x of hallway){\n if(x =='>') r++;\n if(x =='<') s+=r;\n }\n return 2*s;\n}", "title": "" }, { "docid": "bfa0ae10bbe90e8f6ea0f2675caf2cc1", "score": "0.5527763", "text": "function electionsWinners(votes, k) {\n const max = Math.max(...votes);\n const numOfMax = votes.filter((el) => el === max).length;\n\n return votes.reduce(\n (acc, vote) =>\n acc + ((vote === max && numOfMax === 1) || vote + k > max ? 1 : 0),\n 0\n );\n}", "title": "" }, { "docid": "5e9ca4889ceac3937cd702508ff6b603", "score": "0.5521614", "text": "function numberOfViews(book) {\n\treturn book.turn('pages') / 2 + 1;\n}", "title": "" }, { "docid": "5e9ca4889ceac3937cd702508ff6b603", "score": "0.5521614", "text": "function numberOfViews(book) {\n\treturn book.turn('pages') / 2 + 1;\n}", "title": "" }, { "docid": "be1cc6a8ffb2b736b859526ec321a610", "score": "0.55103534", "text": "getOperationsCount(state, portfolioData) {\n let ops = portfolioData.portfolios.map(p => p.positions.length).reduce((a, b) => a + b, 0)\n state.operationsCount = ops\n }", "title": "" }, { "docid": "890ba1482fcaa1c4dcdfce04e7ead1ce", "score": "0.5503685", "text": "function getBooksBorrowedCount(books) {\n return books.reduce((borrowCount, { borrows }) => {\n if (!borrows[0].returned) borrowCount++;\n return borrowCount;\n }, 0);\n}", "title": "" }, { "docid": "d07fcc0d4432da914eda5f7430dfe9b5", "score": "0.5503193", "text": "function counting(){\n num++;\n return num;\n }", "title": "" }, { "docid": "e8450bb5338c28f09bb4784dc1b91323", "score": "0.54980195", "text": "function howManyPets() {\n console.log(`There are ${salon.pets.length} registered pets`);\n}", "title": "" }, { "docid": "0ee66b519a1a1bbd5104c41827b65f4a", "score": "0.54970956", "text": "function countingValleys(n, s) {\n\nlet valley=0;\nlet count =0;\n\nfor(let i=0;i<n;i++){\n \n if(s.charAt(i) == 'U'){\n\n valley++;\n if(valley ==0) {\n count++;\n }\n } else {\n valley--;\n }\n \n}\nreturn count;\n\n}", "title": "" }, { "docid": "c4b4a269c2cc7e1eba392d663c699768", "score": "0.54947376", "text": "function count(){\n var cnt = 0;\n return cnt++;\n\n}", "title": "" }, { "docid": "3ed2c46268541d527d82bc8307ae1890", "score": "0.54885757", "text": "function createTotalReviews() {\n return randomizer(50, 100)\n}", "title": "" }, { "docid": "d00b3e0bd2f8d0003d3746b71bcc6d44", "score": "0.54646593", "text": "findNumberofQuestions() {\n API.findTotalQuestions({\n unitId: this.state.units\n }).then(res => {\n this.setState({questions: res.data.length});\n this.getResults();\n })\n }", "title": "" }, { "docid": "32e84c36585ba178b4901db791b8d245", "score": "0.54548436", "text": "function countToRoundCounter() {\n let roundNum = gamePattern.length;\n document.getElementById(\"round\").innerHTML = roundNum;\n }", "title": "" }, { "docid": "60774deba011676f009efaf6db1273a3", "score": "0.5453813", "text": "numberTimesChosenThisTopping(topName) {\n let foundThisTopping = this.state.custToppingChoices.filter(\n this.findToppingByTopName(topName)\n );\n\n return foundThisTopping.length;\n }", "title": "" }, { "docid": "51e74cc62446c4b78205c9dd1995cd84", "score": "0.5453695", "text": "function calcSum(value) {\r\n totalVotes += value;\r\n}", "title": "" }, { "docid": "c04e3c94de5cae0efb7814a8ba2fc5e6", "score": "0.5452736", "text": "function calcSum(value) {\n totalVotes += value;\n}", "title": "" }, { "docid": "c04e3c94de5cae0efb7814a8ba2fc5e6", "score": "0.5452736", "text": "function calcSum(value) {\n totalVotes += value;\n}", "title": "" }, { "docid": "d7b55916b0d250306ef9a1c8dbeea92a", "score": "0.5434184", "text": "get voteResults() {\n var voteResults = [0,0];\n for (var i = 0; i < this.districts.length; i++) {\n voteResults[0] += this.districts[i].votes[0];\n voteResults[1] += this.districts[i].votes[1];\n };\n return voteResults;\n }", "title": "" }, { "docid": "e92b508ab07196a051c8a4e9f929977d", "score": "0.5431591", "text": "updateMajorityVotes({ state }) {\n const content = getResultContent(state.sections, state.userChoices);\n\n let updates = {};\n\n content.forEach(section => {\n const sectionName = section.name;\n const sectionContent = section.content;\n\n sectionContent.forEach(item => {\n const id = item.id.toString();\n const currentValue = dtbRecord.selections[sectionName][id];\n\n if (currentValue == null) {\n const newVal = 1; // if value isn't present (i.e. added later), then it has one selection now,\n updates['/selections/' + sectionName + '/' + id] = newVal;\n } else {\n const newVal = currentValue + 1;\n updates['/selections/' + sectionName + '/' + id] = newVal;\n }\n });\n });\n database.ref().update(updates);\n }", "title": "" }, { "docid": "09f147d7cd7f582461608630c4df8014", "score": "0.5427508", "text": "getNumberOfBlueRayProducts() {\n let numberOfBluRayItems = 0;\n for (let i = 0; i < this.state.cartItems.length; i++) {\n if (this.state.cartItems[i].category === \"Blu-ray\") {\n numberOfBluRayItems++;\n }\n }\n return numberOfBluRayItems;\n }", "title": "" }, { "docid": "ca882d48ded6b17888b1aa7ad2584703", "score": "0.5424506", "text": "[types.CHANGE_COUNT] (state) {\n state.count = Util.getLocal('count')\n }", "title": "" }, { "docid": "5cdc2367c6f672809789739835a14d9f", "score": "0.54119295", "text": "get numberOfVampiresFromOriginal() {\n let currentVamp = this;\n let numberOfVamp = 0;\n\n while(currentVamp.creator) {\n numberOfVamp += 1;\n currentVamp = currentVamp.creator;\n }\n\n return numberOfVamp;\n }", "title": "" }, { "docid": "bceab1efa8b915a69b71193ba8fae006", "score": "0.54108155", "text": "getNumberOfDVDs() {\n let numberOfDVDs = 0;\n for (let i = 0; i < this.state.cartItems.length; i++) {\n if (this.state.cartItems[i].category === \"DVD\") {\n numberOfDVDs += this.state.cartItems[i].quantity;\n }\n }\n return numberOfDVDs;\n }", "title": "" }, { "docid": "8ef7efb148b8ec082c1610be8b5d82d4", "score": "0.5406124", "text": "function lookupCount(state, bindings, key) {\n if(key in bindings) {\n var arr = bindings[key], r = 0\n for(var i=0, n=arr.length; i<n; ++i) {\n r += state[virtualKeyCode(arr[i])]\n }\n return r\n }\n var kc = virtualKeyCode(key)\n if(kc >= 0) {\n return state[kc]\n }\n return 0\n}", "title": "" }, { "docid": "e7d0a6428de950387399fa4151663aa3", "score": "0.54017943", "text": "function calcSum(value) {\r\n totalVotes += value;\r\n}", "title": "" }, { "docid": "e7d0a6428de950387399fa4151663aa3", "score": "0.54017943", "text": "function calcSum(value) {\r\n totalVotes += value;\r\n}", "title": "" }, { "docid": "f097a823eb8aed0ede43acc76ccb7c8e", "score": "0.53978306", "text": "get numberOfVampiresFromOriginal() {\n let numVamp = 0;\n let currVamp = this;\n\n while(currVamp.creator){\n numVamp++;\n currVamp = currVamp.creator;\n }\n return numVamp;\n }", "title": "" }, { "docid": "4acac40f132fa8bb168859ec5ec2c0e7", "score": "0.5394777", "text": "get votes() {\r\n return this.payload.votes;\r\n }", "title": "" }, { "docid": "6645247416f8996aa1da67788ad3fa4c", "score": "0.53887045", "text": "function howMuchFruitInBasket() {\n const fruitCount = basketOfFruit.length;\n return fruitCount;\n}", "title": "" }, { "docid": "15db4f82be7769c4b01168a3ba4ca89a", "score": "0.5387501", "text": "function hoevaak() {\n document.getElementById(\"teller\").innerHTML = \"Aantal keren geklikt \" + count++;\n// console.log(count);\n}", "title": "" }, { "docid": "1ab036526b9272f8d1ee80e67cef449c", "score": "0.5384326", "text": "get repostsCount() {\r\n var _a;\r\n return (_a = this.payload.reposts) === null || _a === void 0 ? void 0 : _a.count;\r\n }", "title": "" }, { "docid": "d78d0c8d125e48b8f4b3400cf9712301", "score": "0.53789043", "text": "function getEvidenceCount(evidence) {\n let count = 0;\n for (const [key, value] of Object.entries(evidence)) {\n if (value == 1) {\n count++;\n }\n }\n return count;\n}", "title": "" }, { "docid": "84e2eb77da01ce70ec22011efd292759", "score": "0.53760195", "text": "function calcSum(value) {\r\n totalVotes += value;\r\n }", "title": "" }, { "docid": "a51d878c415de70c70d6ce3a73320fa0", "score": "0.5374435", "text": "calculateNumberOfRocks () {\n\t\treturn BASE_NUMBER_OF_ROCKS + this.level * 3;\n\t}", "title": "" } ]
34f0803e702e0dda9b08980a1394ece6
A wrapper around `compileComponent` which depends on render2 global analysis data as its input instead of the `R3DirectiveMetadata`. `R3ComponentMetadata` is computed from `CompileDirectiveMetadata` and other statically reflected information.
[ { "docid": "0cfd7125fbe53207e0498810cc527c9f", "score": "0.7254392", "text": "function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) {\n var name = identifierName(component.type);\n name || error(\"Cannot resolver the name of \" + component.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */);\n var summary = component.toSummary();\n // Compute the R3ComponentMetadata from the CompileDirectiveMetadata\n var meta = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: { nodes: render3Ast.nodes }, directives: [], pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx), wrapDirectivesAndPipesInClosure: false, styles: (summary.template && summary.template.styles) || EMPTY_ARRAY, encapsulation: (summary.template && summary.template.encapsulation) || ViewEncapsulation.Emulated, interpolation: DEFAULT_INTERPOLATION_CONFIG, animations: null, viewProviders: component.viewProviders.length > 0 ? new WrappedNodeExpr(component.viewProviders) : null, relativeContextFilePath: '', i18nUseExternalIds: true });\n var res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" } ]
[ { "docid": "006836c8958a17ad747b90afd5105a05", "score": "0.7302153", "text": "function compileComponentFromRender2(outputCtx,component,render3Ast,reflector,bindingParser,directiveTypeBySel,pipeTypeByName){var name=identifierName(component.type);name||error(\"Cannot resolver the name of \"+component.type);var definitionField=outputCtx.constantPool.propertyNameOf(2/* Component */);var summary=component.toSummary();// Compute the R3ComponentMetadata from the CompileDirectiveMetadata\nvar meta=Object.assign({},directiveMetadataFromGlobalMetadata(component,outputCtx,reflector),{selector:component.selector,template:{nodes:render3Ast.nodes},directives:[],pipes:typeMapToExpressionMap(pipeTypeByName,outputCtx),viewQueries:queriesFromGlobalMetadata(component.viewQueries,outputCtx),wrapDirectivesAndPipesInClosure:false,styles:summary.template&&summary.template.styles||EMPTY_ARRAY,encapsulation:summary.template&&summary.template.encapsulation||ViewEncapsulation.Emulated,interpolation:DEFAULT_INTERPOLATION_CONFIG,animations:null,viewProviders:component.viewProviders.length>0?new WrappedNodeExpr(component.viewProviders):null,relativeContextFilePath:\"\",i18nUseExternalIds:true});var res=compileComponentFromMetadata(meta,outputCtx.constantPool,bindingParser);// Create the partial class to be merged with the actual class.\noutputCtx.statements.push(new ClassStmt(name,null,[new ClassField(definitionField,INFERRED_TYPE,[StmtModifier.Static],res.expression)],[],new ClassMethod(null,[],[]),[]))}", "title": "" }, { "docid": "7d78b15af42460b5fa728dc6ae970aae", "score": "0.72576416", "text": "function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) {\n var name = identifierName(component.type);\n name || error(\"Cannot resolver the name of \" + component.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */);\n var summary = component.toSummary();\n // Compute the R3ComponentMetadata from the CompileDirectiveMetadata\n var meta = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: {\n nodes: render3Ast.nodes,\n hasNgContent: render3Ast.hasNgContent,\n ngContentSelectors: render3Ast.ngContentSelectors,\n }, directives: typeMapToExpressionMap(directiveTypeBySel, outputCtx), pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx) });\n var res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "7d78b15af42460b5fa728dc6ae970aae", "score": "0.72576416", "text": "function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) {\n var name = identifierName(component.type);\n name || error(\"Cannot resolver the name of \" + component.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */);\n var summary = component.toSummary();\n // Compute the R3ComponentMetadata from the CompileDirectiveMetadata\n var meta = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"])({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: {\n nodes: render3Ast.nodes,\n hasNgContent: render3Ast.hasNgContent,\n ngContentSelectors: render3Ast.ngContentSelectors,\n }, directives: typeMapToExpressionMap(directiveTypeBySel, outputCtx), pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx) });\n var res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "aada1a764373b1a93db6958e2b5c6ed3", "score": "0.70999914", "text": "function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) {\n const name = identifierName(component.type);\n name || error(`Cannot resolver the name of ${component.type}`);\n const definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */);\n const summary = component.toSummary();\n // Compute the R3ComponentMetadata from the CompileDirectiveMetadata\n const meta = Object.assign({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: { nodes: render3Ast.nodes }, directives: [], pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx), wrapDirectivesAndPipesInClosure: false, styles: (summary.template && summary.template.styles) || EMPTY_ARRAY, encapsulation: (summary.template && summary.template.encapsulation) || ViewEncapsulation.Emulated, interpolation: DEFAULT_INTERPOLATION_CONFIG, animations: null, viewProviders: component.viewProviders.length > 0 ? new WrappedNodeExpr(component.viewProviders) : null, relativeContextFilePath: '', i18nUseExternalIds: true });\n const res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "6355892cbca019faf73f6ba64cf8b0fc", "score": "0.63955164", "text": "function compileComponentFromMetadata(meta,constantPool,bindingParser){var _baseDirectiveFields2=baseDirectiveFields(meta,constantPool,bindingParser),definitionMap=_baseDirectiveFields2.definitionMap,statements=_baseDirectiveFields2.statements;addFeatures(definitionMap,meta);var selector=meta.selector&&CssSelector.parse(meta.selector);var firstSelector=selector&&selector[0];// e.g. `attr: [\"class\", \".my.app\"]`\n// This is optional an only included if the first selector of a component specifies attributes.\nif(firstSelector){var selectorAttributes=firstSelector.getAttrs();if(selectorAttributes.length){definitionMap.set(\"attrs\",constantPool.getConstLiteral(literalArr(selectorAttributes.map(function(value){return value!=null?literal(value):literal(undefined)})),/* forceShared */true))}}// Generate the CSS matcher that recognize directive\nvar directiveMatcher=null;if(meta.directives.length>0){var matcher=new SelectorMatcher;for(var _iterator15=meta.directives,_isArray15=Array.isArray(_iterator15),_i31=0,_iterator15=_isArray15?_iterator15:_iterator15[Symbol.iterator]();;){var _ref40;if(_isArray15){if(_i31>=_iterator15.length)break;_ref40=_iterator15[_i31++]}else{_i31=_iterator15.next();if(_i31.done)break;_ref40=_i31.value}var _ref41=_ref40,_selector=_ref41.selector,_expression=_ref41.expression;matcher.addSelectables(CssSelector.parse(_selector),_expression)}directiveMatcher=matcher}// e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`\nvar templateTypeName=meta.name;var templateName=templateTypeName?templateTypeName+\"_Template\":null;var directivesUsed=new Set;var pipesUsed=new Set;var changeDetection=meta.changeDetection;var template=meta.template;var templateBuilder=new TemplateDefinitionBuilder(constantPool,BindingScope.ROOT_SCOPE,0,templateTypeName,null,null,templateName,directiveMatcher,directivesUsed,meta.pipes,pipesUsed,Identifiers$1.namespaceHTML,meta.relativeContextFilePath,meta.i18nUseExternalIds);var templateFunctionExpression=templateBuilder.buildTemplateFunction(template.nodes,[]);// We need to provide this so that dynamically generated components know what\n// projected content blocks to pass through to the component when it is instantiated.\nvar ngContentSelectors=templateBuilder.getNgContentSelectors();if(ngContentSelectors){definitionMap.set(\"ngContentSelectors\",ngContentSelectors)}// e.g. `consts: 2`\ndefinitionMap.set(\"consts\",literal(templateBuilder.getConstCount()));// e.g. `vars: 2`\ndefinitionMap.set(\"vars\",literal(templateBuilder.getVarCount()));definitionMap.set(\"template\",templateFunctionExpression);// e.g. `directives: [MyDirective]`\nif(directivesUsed.size){var directivesExpr=literalArr(Array.from(directivesUsed));if(meta.wrapDirectivesAndPipesInClosure){directivesExpr=fn([],[new ReturnStatement(directivesExpr)])}definitionMap.set(\"directives\",directivesExpr)}// e.g. `pipes: [MyPipe]`\nif(pipesUsed.size){var pipesExpr=literalArr(Array.from(pipesUsed));if(meta.wrapDirectivesAndPipesInClosure){pipesExpr=fn([],[new ReturnStatement(pipesExpr)])}definitionMap.set(\"pipes\",pipesExpr)}if(meta.encapsulation===null){meta.encapsulation=ViewEncapsulation.Emulated}// e.g. `styles: [str1, str2]`\nif(meta.styles&&meta.styles.length){var styleValues=meta.encapsulation==ViewEncapsulation.Emulated?compileStyles(meta.styles,CONTENT_ATTR,HOST_ATTR):meta.styles;var strings=styleValues.map(function(str){return literal(str)});definitionMap.set(\"styles\",literalArr(strings))}else if(meta.encapsulation===ViewEncapsulation.Emulated){// If there is no style, don't generate css selectors on elements\nmeta.encapsulation=ViewEncapsulation.None}// Only set view encapsulation if it's not the default value\nif(meta.encapsulation!==ViewEncapsulation.Emulated){definitionMap.set(\"encapsulation\",literal(meta.encapsulation))}// e.g. `animation: [trigger('123', [])]`\nif(meta.animations!==null){definitionMap.set(\"data\",literalMap([{key:\"animation\",value:meta.animations,quoted:false}]))}// Only set the change detection flag if it's defined and it's not the default.\nif(changeDetection!=null&&changeDetection!==ChangeDetectionStrategy.Default){definitionMap.set(\"changeDetection\",literal(changeDetection))}// On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n// string literal, which must be on one line.\nvar selectorForType=(meta.selector||\"\").replace(/\\n/g,\"\");var expression=importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);var type=createTypeForDef(meta,Identifiers$1.ComponentDefWithMeta);return{expression:expression,type:type,statements:statements}}", "title": "" }, { "docid": "1e2e5f2fa96c66e938922eb8611bd300", "score": "0.63586247", "text": "function compileComponentFromMetadata(meta, constantPool, bindingParser) {\n var e_1, _a;\n var _b = baseDirectiveFields(meta, constantPool, bindingParser), definitionMap = _b.definitionMap, statements = _b.statements;\n addFeatures(definitionMap, meta);\n var selector = meta.selector && CssSelector.parse(meta.selector);\n var firstSelector = selector && selector[0];\n // e.g. `attr: [\"class\", \".my.app\"]`\n // This is optional an only included if the first selector of a component specifies attributes.\n if (firstSelector) {\n var selectorAttributes = firstSelector.getAttrs();\n if (selectorAttributes.length) {\n definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(function (value) { return value != null ? literal(value) : literal(undefined); })), \n /* forceShared */ true));\n }\n }\n // Generate the CSS matcher that recognize directive\n var directiveMatcher = null;\n if (meta.directives.length > 0) {\n var matcher = new SelectorMatcher();\n try {\n for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(meta.directives), _d = _c.next(); !_d.done; _d = _c.next()) {\n var _e = _d.value, selector_1 = _e.selector, expression_1 = _e.expression;\n matcher.addSelectables(CssSelector.parse(selector_1), expression_1);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n directiveMatcher = matcher;\n }\n if (meta.viewQueries.length) {\n definitionMap.set('viewQuery', createViewQueriesFunction(meta, constantPool));\n }\n // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`\n var templateTypeName = meta.name;\n var templateName = templateTypeName ? templateTypeName + \"_Template\" : null;\n var directivesUsed = new Set();\n var pipesUsed = new Set();\n var changeDetection = meta.changeDetection;\n var template = meta.template;\n var templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.ROOT_SCOPE, 0, templateTypeName, null, null, templateName, meta.viewQueries, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);\n var templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);\n // e.g. `consts: 2`\n definitionMap.set('consts', literal(templateBuilder.getConstCount()));\n // e.g. `vars: 2`\n definitionMap.set('vars', literal(templateBuilder.getVarCount()));\n definitionMap.set('template', templateFunctionExpression);\n // e.g. `directives: [MyDirective]`\n if (directivesUsed.size) {\n var directivesExpr = literalArr(Array.from(directivesUsed));\n if (meta.wrapDirectivesAndPipesInClosure) {\n directivesExpr = fn([], [new ReturnStatement(directivesExpr)]);\n }\n definitionMap.set('directives', directivesExpr);\n }\n // e.g. `pipes: [MyPipe]`\n if (pipesUsed.size) {\n var pipesExpr = literalArr(Array.from(pipesUsed));\n if (meta.wrapDirectivesAndPipesInClosure) {\n pipesExpr = fn([], [new ReturnStatement(pipesExpr)]);\n }\n definitionMap.set('pipes', pipesExpr);\n }\n if (meta.encapsulation === null) {\n meta.encapsulation = ViewEncapsulation.Emulated;\n }\n // e.g. `styles: [str1, str2]`\n if (meta.styles && meta.styles.length) {\n var styleValues = meta.encapsulation == ViewEncapsulation.Emulated ?\n compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) :\n meta.styles;\n var strings = styleValues.map(function (str) { return literal(str); });\n definitionMap.set('styles', literalArr(strings));\n }\n else if (meta.encapsulation === ViewEncapsulation.Emulated) {\n // If there is no style, don't generate css selectors on elements\n meta.encapsulation = ViewEncapsulation.None;\n }\n // Only set view encapsulation if it's not the default value\n if (meta.encapsulation !== ViewEncapsulation.Emulated) {\n definitionMap.set('encapsulation', literal(meta.encapsulation));\n }\n // e.g. `animation: [trigger('123', [])]`\n if (meta.animations !== null) {\n definitionMap.set('data', literalMap([{ key: 'animation', value: meta.animations, quoted: false }]));\n }\n // Only set the change detection flag if it's defined and it's not the default.\n if (changeDetection != null && changeDetection !== ChangeDetectionStrategy.Default) {\n definitionMap.set('changeDetection', literal(changeDetection));\n }\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);\n var type = createTypeForDef(meta, Identifiers$1.ComponentDefWithMeta);\n return { expression: expression, type: type, statements: statements };\n}", "title": "" }, { "docid": "e98207f023a73bfda3d48674cd5022bb", "score": "0.633628", "text": "function compileComponentFromMetadata(meta, constantPool, bindingParser) {\n const { definitionMap, statements } = baseDirectiveFields(meta, constantPool, bindingParser);\n addFeatures(definitionMap, meta);\n const selector = meta.selector && CssSelector.parse(meta.selector);\n const firstSelector = selector && selector[0];\n // e.g. `attr: [\"class\", \".my.app\"]`\n // This is optional an only included if the first selector of a component specifies attributes.\n if (firstSelector) {\n const selectorAttributes = firstSelector.getAttrs();\n if (selectorAttributes.length) {\n definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(value => value != null ? literal(value) : literal(undefined))), \n /* forceShared */ true));\n }\n }\n // Generate the CSS matcher that recognize directive\n let directiveMatcher = null;\n if (meta.directives.length > 0) {\n const matcher = new SelectorMatcher();\n for (const { selector, expression } of meta.directives) {\n matcher.addSelectables(CssSelector.parse(selector), expression);\n }\n directiveMatcher = matcher;\n }\n // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`\n const templateTypeName = meta.name;\n const templateName = templateTypeName ? `${templateTypeName}_Template` : null;\n const directivesUsed = new Set();\n const pipesUsed = new Set();\n const changeDetection = meta.changeDetection;\n const template = meta.template;\n const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.ROOT_SCOPE, 0, templateTypeName, null, null, templateName, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);\n const templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);\n // We need to provide this so that dynamically generated components know what\n // projected content blocks to pass through to the component when it is instantiated.\n const ngContentSelectors = templateBuilder.getNgContentSelectors();\n if (ngContentSelectors) {\n definitionMap.set('ngContentSelectors', ngContentSelectors);\n }\n // e.g. `consts: 2`\n definitionMap.set('consts', literal(templateBuilder.getConstCount()));\n // e.g. `vars: 2`\n definitionMap.set('vars', literal(templateBuilder.getVarCount()));\n definitionMap.set('template', templateFunctionExpression);\n // e.g. `directives: [MyDirective]`\n if (directivesUsed.size) {\n let directivesExpr = literalArr(Array.from(directivesUsed));\n if (meta.wrapDirectivesAndPipesInClosure) {\n directivesExpr = fn([], [new ReturnStatement(directivesExpr)]);\n }\n definitionMap.set('directives', directivesExpr);\n }\n // e.g. `pipes: [MyPipe]`\n if (pipesUsed.size) {\n let pipesExpr = literalArr(Array.from(pipesUsed));\n if (meta.wrapDirectivesAndPipesInClosure) {\n pipesExpr = fn([], [new ReturnStatement(pipesExpr)]);\n }\n definitionMap.set('pipes', pipesExpr);\n }\n if (meta.encapsulation === null) {\n meta.encapsulation = ViewEncapsulation.Emulated;\n }\n // e.g. `styles: [str1, str2]`\n if (meta.styles && meta.styles.length) {\n const styleValues = meta.encapsulation == ViewEncapsulation.Emulated ?\n compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) :\n meta.styles;\n const strings = styleValues.map(str => literal(str));\n definitionMap.set('styles', literalArr(strings));\n }\n else if (meta.encapsulation === ViewEncapsulation.Emulated) {\n // If there is no style, don't generate css selectors on elements\n meta.encapsulation = ViewEncapsulation.None;\n }\n // Only set view encapsulation if it's not the default value\n if (meta.encapsulation !== ViewEncapsulation.Emulated) {\n definitionMap.set('encapsulation', literal(meta.encapsulation));\n }\n // e.g. `animation: [trigger('123', [])]`\n if (meta.animations !== null) {\n definitionMap.set('data', literalMap([{ key: 'animation', value: meta.animations, quoted: false }]));\n }\n // Only set the change detection flag if it's defined and it's not the default.\n if (changeDetection != null && changeDetection !== ChangeDetectionStrategy.Default) {\n definitionMap.set('changeDetection', literal(changeDetection));\n }\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n const selectorForType = (meta.selector || '').replace(/\\n/g, '');\n const expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);\n const type = createTypeForDef(meta, Identifiers$1.ComponentDefWithMeta);\n return { expression, type, statements };\n}", "title": "" }, { "docid": "673f3df6b900e3e7800a8fcbbf80a143", "score": "0.63245517", "text": "function compileComponentFromMetadata(meta, constantPool, bindingParser) {\n var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);\n var selector = meta.selector && CssSelector.parse(meta.selector);\n var firstSelector = selector && selector[0];\n // e.g. `attr: [\"class\", \".my.app\"]`\n // This is optional an only included if the first selector of a component specifies attributes.\n if (firstSelector) {\n var selectorAttributes = firstSelector.getAttrs();\n if (selectorAttributes.length) {\n definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(function (value) { return value != null ? literal(value) : literal(undefined); })), \n /* forceShared */ true));\n }\n }\n // Generate the CSS matcher that recognize directive\n var directiveMatcher = null;\n if (meta.directives.size) {\n var matcher_1 = new SelectorMatcher();\n meta.directives.forEach(function (expression, selector) {\n matcher_1.addSelectables(CssSelector.parse(selector), expression);\n });\n directiveMatcher = matcher_1;\n }\n if (meta.viewQueries.length) {\n definitionMap.set('viewQuery', createViewQueriesFunction(meta, constantPool));\n }\n // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`\n var templateTypeName = meta.name;\n var templateName = templateTypeName ? templateTypeName + \"_Template\" : null;\n var directivesUsed = new Set();\n var pipesUsed = new Set();\n var template = meta.template;\n var templateFunctionExpression = new TemplateDefinitionBuilder(constantPool, CONTEXT_NAME, BindingScope.ROOT_SCOPE, 0, templateTypeName, templateName, meta.viewQueries, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML)\n .buildTemplateFunction(template.nodes, [], template.hasNgContent, template.ngContentSelectors);\n definitionMap.set('template', templateFunctionExpression);\n // e.g. `directives: [MyDirective]`\n if (directivesUsed.size) {\n definitionMap.set('directives', literalArr(Array.from(directivesUsed)));\n }\n // e.g. `pipes: [MyPipe]`\n if (pipesUsed.size) {\n definitionMap.set('pipes', literalArr(Array.from(pipesUsed)));\n }\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);\n var type = new ExpressionType(importExpr(Identifiers$1.ComponentDef, [\n typeWithParameters(meta.type, meta.typeArgumentCount),\n new ExpressionType(literal(selectorForType))\n ]));\n return { expression: expression, type: type };\n}", "title": "" }, { "docid": "673f3df6b900e3e7800a8fcbbf80a143", "score": "0.63245517", "text": "function compileComponentFromMetadata(meta, constantPool, bindingParser) {\n var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);\n var selector = meta.selector && CssSelector.parse(meta.selector);\n var firstSelector = selector && selector[0];\n // e.g. `attr: [\"class\", \".my.app\"]`\n // This is optional an only included if the first selector of a component specifies attributes.\n if (firstSelector) {\n var selectorAttributes = firstSelector.getAttrs();\n if (selectorAttributes.length) {\n definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(function (value) { return value != null ? literal(value) : literal(undefined); })), \n /* forceShared */ true));\n }\n }\n // Generate the CSS matcher that recognize directive\n var directiveMatcher = null;\n if (meta.directives.size) {\n var matcher_1 = new SelectorMatcher();\n meta.directives.forEach(function (expression, selector) {\n matcher_1.addSelectables(CssSelector.parse(selector), expression);\n });\n directiveMatcher = matcher_1;\n }\n if (meta.viewQueries.length) {\n definitionMap.set('viewQuery', createViewQueriesFunction(meta, constantPool));\n }\n // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`\n var templateTypeName = meta.name;\n var templateName = templateTypeName ? templateTypeName + \"_Template\" : null;\n var directivesUsed = new Set();\n var pipesUsed = new Set();\n var template = meta.template;\n var templateFunctionExpression = new TemplateDefinitionBuilder(constantPool, CONTEXT_NAME, BindingScope.ROOT_SCOPE, 0, templateTypeName, templateName, meta.viewQueries, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML)\n .buildTemplateFunction(template.nodes, [], template.hasNgContent, template.ngContentSelectors);\n definitionMap.set('template', templateFunctionExpression);\n // e.g. `directives: [MyDirective]`\n if (directivesUsed.size) {\n definitionMap.set('directives', literalArr(Array.from(directivesUsed)));\n }\n // e.g. `pipes: [MyPipe]`\n if (pipesUsed.size) {\n definitionMap.set('pipes', literalArr(Array.from(pipesUsed)));\n }\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);\n var type = new ExpressionType(importExpr(Identifiers$1.ComponentDef, [\n typeWithParameters(meta.type, meta.typeArgumentCount),\n new ExpressionType(literal(selectorForType))\n ]));\n return { expression: expression, type: type };\n}", "title": "" }, { "docid": "5712d41967cb68d775f782ba7f08c01c", "score": "0.5942425", "text": "function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) {\n const name = identifierName(directive.type);\n name || error(`Cannot resolver the name of ${directive.type}`);\n const definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */);\n const meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector);\n const res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "bacc6b7124dbaa7aadb2131771c59a83", "score": "0.5929304", "text": "function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) {\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */);\n var meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector);\n var res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "bacc6b7124dbaa7aadb2131771c59a83", "score": "0.5929304", "text": "function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) {\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */);\n var meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector);\n var res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "bacc6b7124dbaa7aadb2131771c59a83", "score": "0.5929304", "text": "function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) {\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n var definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */);\n var meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector);\n var res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser);\n // Create the partial class to be merged with the actual class.\n outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));\n}", "title": "" }, { "docid": "f6e8d631547148b7b3ebf243b6087c29", "score": "0.57850647", "text": "function compilePipeFromRender2(outputCtx, pipe, reflector) {\n var name = identifierName(pipe.type);\n if (!name) {\n return error(\"Cannot resolve the name of \" + pipe.type);\n }\n var metadata = {\n name: name,\n pipeName: pipe.name,\n type: outputCtx.importExpr(pipe.type.reference),\n deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector),\n pure: pipe.pure,\n };\n var res = compilePipeFromMetadata(metadata);\n var definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */);\n outputCtx.statements.push(new ClassStmt(\n /* name */ name, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ definitionField, \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ res.expression)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "f6e8d631547148b7b3ebf243b6087c29", "score": "0.57850647", "text": "function compilePipeFromRender2(outputCtx, pipe, reflector) {\n var name = identifierName(pipe.type);\n if (!name) {\n return error(\"Cannot resolve the name of \" + pipe.type);\n }\n var metadata = {\n name: name,\n pipeName: pipe.name,\n type: outputCtx.importExpr(pipe.type.reference),\n deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector),\n pure: pipe.pure,\n };\n var res = compilePipeFromMetadata(metadata);\n var definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */);\n outputCtx.statements.push(new ClassStmt(\n /* name */ name, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ definitionField, \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ res.expression)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "f6e8d631547148b7b3ebf243b6087c29", "score": "0.57850647", "text": "function compilePipeFromRender2(outputCtx, pipe, reflector) {\n var name = identifierName(pipe.type);\n if (!name) {\n return error(\"Cannot resolve the name of \" + pipe.type);\n }\n var metadata = {\n name: name,\n pipeName: pipe.name,\n type: outputCtx.importExpr(pipe.type.reference),\n deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector),\n pure: pipe.pure,\n };\n var res = compilePipeFromMetadata(metadata);\n var definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */);\n outputCtx.statements.push(new ClassStmt(\n /* name */ name, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ definitionField, \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ res.expression)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "9f4219c43196c26ff6fbbb5abe1b98b8", "score": "0.5722169", "text": "function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) {\n var className = identifierName(ngModule.type);\n var rawImports = ngModule.rawImports ? [ngModule.rawImports] : [];\n var rawExports = ngModule.rawExports ? [ngModule.rawExports] : [];\n var injectorDefArg = mapLiteral({\n 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx),\n 'providers': convertMetaToOutput(ngModule.rawProviders, ctx),\n 'imports': convertMetaToOutput(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spread\"])(rawImports, rawExports), ctx),\n });\n var injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]);\n ctx.statements.push(new ClassStmt(\n /* name */ className, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ 'ngInjectorDef', \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ injectorDef)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "9f4219c43196c26ff6fbbb5abe1b98b8", "score": "0.5722169", "text": "function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) {\n var className = identifierName(ngModule.type);\n var rawImports = ngModule.rawImports ? [ngModule.rawImports] : [];\n var rawExports = ngModule.rawExports ? [ngModule.rawExports] : [];\n var injectorDefArg = mapLiteral({\n 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx),\n 'providers': convertMetaToOutput(ngModule.rawProviders, ctx),\n 'imports': convertMetaToOutput(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spread\"])(rawImports, rawExports), ctx),\n });\n var injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]);\n ctx.statements.push(new ClassStmt(\n /* name */ className, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ 'ngInjectorDef', \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ injectorDef)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "9f4219c43196c26ff6fbbb5abe1b98b8", "score": "0.5722169", "text": "function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) {\n var className = identifierName(ngModule.type);\n var rawImports = ngModule.rawImports ? [ngModule.rawImports] : [];\n var rawExports = ngModule.rawExports ? [ngModule.rawExports] : [];\n var injectorDefArg = mapLiteral({\n 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx),\n 'providers': convertMetaToOutput(ngModule.rawProviders, ctx),\n 'imports': convertMetaToOutput(Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__spread\"])(rawImports, rawExports), ctx),\n });\n var injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]);\n ctx.statements.push(new ClassStmt(\n /* name */ className, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ 'ngInjectorDef', \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ injectorDef)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "ece836b892a3cf592bcefaf9dfca3553", "score": "0.5677537", "text": "function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) {\n const className = identifierName(ngModule.type);\n const rawImports = ngModule.rawImports ? [ngModule.rawImports] : [];\n const rawExports = ngModule.rawExports ? [ngModule.rawExports] : [];\n const injectorDefArg = mapLiteral({\n 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx),\n 'providers': convertMetaToOutput(ngModule.rawProviders, ctx),\n 'imports': convertMetaToOutput([...rawImports, ...rawExports], ctx),\n });\n const injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]);\n ctx.statements.push(new ClassStmt(\n /* name */ className, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ 'ngInjectorDef', \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ injectorDef)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "ad8a1eed6dfc659d8c63d37d8c87be5c", "score": "0.56628716", "text": "function compilePipeFromRender2(outputCtx, pipe, reflector) {\n const definitionMapValues = [];\n const name = identifierName(pipe.type);\n if (!name) {\n return error(`Cannot resolve the name of ${pipe.type}`);\n }\n const metadata = {\n name,\n pipeName: pipe.name,\n type: outputCtx.importExpr(pipe.type.reference),\n typeArgumentCount: 0,\n deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector),\n pure: pipe.pure,\n };\n const res = compilePipeFromMetadata(metadata);\n const definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */);\n outputCtx.statements.push(new ClassStmt(\n /* name */ name, \n /* parent */ null, \n /* fields */ [new ClassField(\n /* name */ definitionField, \n /* type */ INFERRED_TYPE, \n /* modifiers */ [StmtModifier.Static], \n /* initializer */ res.expression)], \n /* getters */ [], \n /* constructorMethod */ new ClassMethod(null, [], []), \n /* methods */ []));\n}", "title": "" }, { "docid": "00297d38cfb0d1cf9eedfa99aed97ea7", "score": "0.56599754", "text": "function compilePipeFromRender2(outputCtx,pipe,reflector){var definitionMapValues=[];var name=identifierName(pipe.type);if(!name){return error(\"Cannot resolve the name of \"+pipe.type)}var metadata={name:name,pipeName:pipe.name,type:outputCtx.importExpr(pipe.type.reference),typeArgumentCount:0,deps:dependenciesFromGlobalMetadata(pipe.type,outputCtx,reflector),pure:pipe.pure};var res=compilePipeFromMetadata(metadata);var definitionField=outputCtx.constantPool.propertyNameOf(3/* Pipe */);outputCtx.statements.push(new ClassStmt(/* name */name,/* parent */null,/* fields */[new ClassField(/* name */definitionField,/* type */INFERRED_TYPE,/* modifiers */[StmtModifier.Static],/* initializer */res.expression)],/* getters */[],/* constructorMethod */new ClassMethod(null,[],[]),/* methods */[]))}", "title": "" }, { "docid": "f22860d6afa72f3413513489c75a44d3", "score": "0.5586839", "text": "function compileDirectiveFromRender2(outputCtx,directive,reflector,bindingParser){var name=identifierName(directive.type);name||error(\"Cannot resolver the name of \"+directive.type);var definitionField=outputCtx.constantPool.propertyNameOf(1/* Directive */);var meta=directiveMetadataFromGlobalMetadata(directive,outputCtx,reflector);var res=compileDirectiveFromMetadata(meta,outputCtx.constantPool,bindingParser);// Create the partial class to be merged with the actual class.\noutputCtx.statements.push(new ClassStmt(name,null,[new ClassField(definitionField,INFERRED_TYPE,[StmtModifier.Static],res.expression)],[],new ClassMethod(null,[],[]),[]))}", "title": "" }, { "docid": "af5976751eeba7824a23cc8fc6fe3ffd", "score": "0.51485986", "text": "compileComponent(componentId, component, template, usedPipes, externalReferenceVars, ctx) {\n const pipes = new Map();\n usedPipes.forEach(p => pipes.set(p.name, p.type.reference));\n let embeddedViewCount = 0;\n const viewBuilderFactory = (parent, guards) => {\n const embeddedViewIndex = embeddedViewCount++;\n return new ViewBuilder(this.options, this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory);\n };\n const visitor = viewBuilderFactory(null, []);\n visitor.visitAll([], template);\n return visitor.build(componentId);\n }", "title": "" }, { "docid": "66c9c94b26ba8547be3b604ff8477256", "score": "0.51151234", "text": "function dependenciesFromGlobalMetadata(type,outputCtx,reflector){// Use the `CompileReflector` to look up references to some well-known Angular types. These will\n// be compared with the token to statically determine whether the token has significance to\n// Angular, and set the correct `R3ResolvedDependencyType` as a result.\nvar injectorRef=reflector.resolveExternalReference(Identifiers.Injector);// Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\nvar deps=[];for(var _iterator8=type.diDeps,_isArray8=Array.isArray(_iterator8),_i22=0,_iterator8=_isArray8?_iterator8:_iterator8[Symbol.iterator]();;){var _ref29;if(_isArray8){if(_i22>=_iterator8.length)break;_ref29=_iterator8[_i22++]}else{_i22=_iterator8.next();if(_i22.done)break;_ref29=_i22.value}var dependency=_ref29;if(dependency.token){var tokenRef=tokenReference(dependency.token);var resolved=dependency.isAttribute?R3ResolvedDependencyType.Attribute:R3ResolvedDependencyType.Token;// In the case of most dependencies, the token will be a reference to a type. Sometimes,\n// however, it can be a string, in the case of older Angular code or @Attribute injection.\nvar token=tokenRef instanceof StaticSymbol?outputCtx.importExpr(tokenRef):literal(tokenRef);// Construct the dependency.\ndeps.push({token:token,resolved:resolved,host:!!dependency.isHost,optional:!!dependency.isOptional,self:!!dependency.isSelf,skipSelf:!!dependency.isSkipSelf})}else{unsupported(\"dependency without a token\")}}return deps}", "title": "" }, { "docid": "135cbf68c5538479321b2a3c9fcf963d", "score": "0.51010454", "text": "function compile() {\n var moduleMeta = this;\n // Evaluate module meta source and return module instance\n return new loader.Module({code: evaluate(moduleMeta)});\n }", "title": "" }, { "docid": "1bc6c1dbc67f3cc028c859dd0987f6fd", "score": "0.5085231", "text": "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n var e_1, _a;\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n var elementRef = reflector.resolveExternalReference(Identifiers.ElementRef);\n var templateRef = reflector.resolveExternalReference(Identifiers.TemplateRef);\n var viewContainerRef = reflector.resolveExternalReference(Identifiers.ViewContainerRef);\n var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n var deps = [];\n try {\n for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(type.diDeps), _c = _b.next(); !_c.done; _c = _b.next()) {\n var dependency = _c.value;\n if (dependency.token) {\n var tokenRef = tokenReference(dependency.token);\n var resolved = R3ResolvedDependencyType.Token;\n if (tokenRef === elementRef) {\n resolved = R3ResolvedDependencyType.ElementRef;\n }\n else if (tokenRef === templateRef) {\n resolved = R3ResolvedDependencyType.TemplateRef;\n }\n else if (tokenRef === viewContainerRef) {\n resolved = R3ResolvedDependencyType.ViewContainerRef;\n }\n else if (tokenRef === injectorRef) {\n resolved = R3ResolvedDependencyType.Injector;\n }\n else if (dependency.isAttribute) {\n resolved = R3ResolvedDependencyType.Attribute;\n }\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token: token,\n resolved: resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return deps;\n}", "title": "" }, { "docid": "62d5a728f941fe7ec6cae7ca220844a1", "score": "0.5008417", "text": "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n var elementRef = reflector.resolveExternalReference(Identifiers.ElementRef);\n var templateRef = reflector.resolveExternalReference(Identifiers.TemplateRef);\n var viewContainerRef = reflector.resolveExternalReference(Identifiers.ViewContainerRef);\n var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n var deps = [];\n try {\n for (var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(type.diDeps), _b = _a.next(); !_b.done; _b = _a.next()) {\n var dependency = _b.value;\n if (dependency.token) {\n var tokenRef = tokenReference(dependency.token);\n var resolved = R3ResolvedDependencyType.Token;\n if (tokenRef === elementRef) {\n resolved = R3ResolvedDependencyType.ElementRef;\n }\n else if (tokenRef === templateRef) {\n resolved = R3ResolvedDependencyType.TemplateRef;\n }\n else if (tokenRef === viewContainerRef) {\n resolved = R3ResolvedDependencyType.ViewContainerRef;\n }\n else if (tokenRef === injectorRef) {\n resolved = R3ResolvedDependencyType.Injector;\n }\n else if (dependency.isAttribute) {\n resolved = R3ResolvedDependencyType.Attribute;\n }\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token: token,\n resolved: resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_b && !_b.done && (_c = _a.return)) _c.call(_a);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return deps;\n var e_1, _c;\n}", "title": "" }, { "docid": "db1bb68a16d5355d0bb20ec43efc10af", "score": "0.49249616", "text": "function directiveMetadataFromGlobalMetadata(directive,outputCtx,reflector){// The global-analysis based Ivy mode in ngc is no longer utilized/supported.\nthrow new Error(\"unsupported\")}", "title": "" }, { "docid": "93fe13ad3bf871ea2fb2201ebd0e9389", "score": "0.48385105", "text": "function compileDirectiveFromMetadata(meta,constantPool,bindingParser){var _baseDirectiveFields=baseDirectiveFields(meta,constantPool,bindingParser),definitionMap=_baseDirectiveFields.definitionMap,statements=_baseDirectiveFields.statements;addFeatures(definitionMap,meta);var expression=importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);if(!meta.selector){throw new Error(\"Directive \"+meta.name+\" has no selector, please add it!\")}var type=createTypeForDef(meta,Identifiers$1.DirectiveDefWithMeta);return{expression:expression,type:type,statements:statements}}", "title": "" }, { "docid": "c21419a4d0b874cf19e9582b8c335f5f", "score": "0.482521", "text": "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n var e_1, _a;\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n var deps = [];\n try {\n for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__values\"])(type.diDeps), _c = _b.next(); !_c.done; _c = _b.next()) {\n var dependency = _c.value;\n if (dependency.token) {\n var tokenRef = tokenReference(dependency.token);\n var resolved = dependency.isAttribute ?\n R3ResolvedDependencyType.Attribute :\n R3ResolvedDependencyType.Token;\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token: token,\n resolved: resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return deps;\n}", "title": "" }, { "docid": "c3e7acf4b23ad80d689eaf89c0ebfec1", "score": "0.47939584", "text": "function Component(config) {\n\treturn function (componentDef) {\n\t\t/** create the class */\n\t\tvar component = function (_CustomElement2) {\n\t\t\t_inherits(component, _CustomElement2);\n\n\t\t\t_createClass(component, null, [{\n\t\t\t\tkey: 'observedAttributes',\n\n\t\t\t\t/** static array of observed attributes */\n\t\t\t\tget: function get() {\n\t\t\t\t\treturn config.attributes || [];\n\t\t\t\t}\n\n\t\t\t\t/** constructor */\n\n\t\t\t}]);\n\n\t\t\tfunction component() {\n\t\t\t\t_classCallCheck(this, component);\n\n\t\t\t\t/** attach the shadow dom */\n\t\t\t\tvar _this = _possibleConstructorReturn(this, (component.__proto__ || Object.getPrototypeOf(component)).call(this));\n\t\t\t\t/** initialize the base class */\n\n\n\t\t\t\t_this.attachShadow({ mode: 'open' });\n\n\t\t\t\t/** public properties */\n\t\t\t\t_this.selector = config.selector;\n\t\t\t\t_this.templateUrl = config.templateUrl || null;\n\t\t\t\t_this.template = config.template || null;\n\t\t\t\t_this.styleUrl = config.styleUrl || null;\n\n\t\t\t\t/** add a static reference to the component */\n\t\t\t\tcomponentDef.prototype.componentRef = _this;\n\t\t\t\tcomponentDef.prototype.template = config.template;\n\t\t\t\t_this.componentDef = new componentDef();\n\t\t\t\treturn _this;\n\t\t\t}\n\n\t\t\t/** respond to attribute changes */\n\n\n\t\t\t_createClass(component, [{\n\t\t\t\tkey: 'attributeChangedCallback',\n\t\t\t\tvalue: function attributeChangedCallback(attr, oldValue, newValue) {\n\t\t\t\t\t//console.log([attr, oldValue, newValue]);\n\t\t\t\t\tthis.componentDef.build();\n\t\t\t\t}\n\t\t\t}]);\n\n\t\t\treturn component;\n\t\t}(_CustomElement);\n\n\t\t/** add methods to the component definition */\n\t\tcomponentDef.prototype.template = null;\n\t\tcomponentDef.prototype.componentRef = null;\n\t\tcomponentDef.prototype.getAttribute = function (attr) {\n\t\t\treturn this.componentRef.attributes.getNamedItem(attr).value;\n\t\t};\n\t\tcomponentDef.prototype.shadowRoot = function () {\n\t\t\treturn this.componentRef.shadowRoot;\n\t\t};\n\t\tcomponentDef.prototype.build = function () {\n\t\t\tvar html = Object(__WEBPACK_IMPORTED_MODULE_0__parser__[\"a\" /* parse */])(this.componentRef.template, this);\n\t\t\tthis.shadowRoot().innerHTML = html;\n\t\t};\n\t\tcomponentDef.prototype.empty = function () {\n\t\t\twhile (this.shadowRoot().firstChild) {\n\t\t\t\tthis.shadowRoot().removeChild(this.shadowRoot().firstChild);\n\t\t\t}\n\t\t};\n\n\t\t/** register the custom component */\n\t\tcustomElements.define(config.selector, component);\n\t};\n}", "title": "" }, { "docid": "ddef08bf5ccaec6dfb285b0b561454f0", "score": "0.47539788", "text": "function toR3InjectableMeta(metaObj) {\n var typeExpr = metaObj.getValue('type');\n var typeName = typeExpr.getSymbolName();\n if (typeName === null) {\n throw new fatal_linker_error_1.FatalLinkerError(typeExpr.expression, 'Unsupported type, its name could not be determined');\n }\n var meta = {\n name: typeName,\n type: util_1.wrapReference(typeExpr.getOpaque()),\n internalType: typeExpr.getOpaque(),\n typeArgumentCount: 0,\n providedIn: metaObj.has('providedIn') ? util_1.extractForwardRef(metaObj.getValue('providedIn')) :\n compiler_1.createR3ProviderExpression(o.literal(null), false),\n };\n if (metaObj.has('useClass')) {\n meta.useClass = util_1.extractForwardRef(metaObj.getValue('useClass'));\n }\n if (metaObj.has('useFactory')) {\n meta.useFactory = metaObj.getOpaque('useFactory');\n }\n if (metaObj.has('useExisting')) {\n meta.useExisting = util_1.extractForwardRef(metaObj.getValue('useExisting'));\n }\n if (metaObj.has('useValue')) {\n meta.useValue = util_1.extractForwardRef(metaObj.getValue('useValue'));\n }\n if (metaObj.has('deps')) {\n meta.deps = metaObj.getArray('deps').map(function (dep) { return util_1.getDependency(dep.getObject()); });\n }\n return meta;\n }", "title": "" }, { "docid": "73841e86b6d4bcf75c576943848a4860", "score": "0.47490895", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = __webpack_require__(789)(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|' +\n '(' + self.re.host_fuzzy_test.source + ')|' +\n '@',\n 'i');\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "4fd7345aafd46424079542c3897292b6", "score": "0.47475892", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = assign({}, __webpack_require__(134));\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|' +\n '(' + self.re.host_fuzzy_test.source + ')|' +\n '@',\n 'i');\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "08e27a121a9f4b3191c20b324613b8cc", "score": "0.47103506", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = __webpack_require__(6066)(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "48ef1c2249a9bdfc76e0c07d3194d74e", "score": "0.46922305", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = __webpack_require__(107)(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) {\n return tpl.replace('%TLDS%', re.src_tlds);\n }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) {\n return;\n }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate = self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize = self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__).filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n }).map(escapeRE).join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uFF5C]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uFF5C]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp('(' + self.re.schema_test.source + ')|' + '(' + self.re.host_fuzzy_test.source + ')|' + '@', 'i');\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "f82a2d103bedef796d8a1540a2a390c8", "score": "0.46872908", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = __webpack_require__(986)(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|' +\n '(' + self.re.host_fuzzy_test.source + ')|' +\n '@',\n 'i');\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "bf5d678781251bd5a9745b63aabd986c", "score": "0.46682334", "text": "function injectRenderer2() {\n // We need the Renderer to be based on the component that it's being injected into, however since\n // DI happens before we've entered its view, `getLView` will return the parent view instead.\n var lView = getLView();\n var tNode = getCurrentTNode();\n var nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);\n return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);\n }", "title": "" }, { "docid": "bf5d678781251bd5a9745b63aabd986c", "score": "0.46682334", "text": "function injectRenderer2() {\n // We need the Renderer to be based on the component that it's being injected into, however since\n // DI happens before we've entered its view, `getLView` will return the parent view instead.\n var lView = getLView();\n var tNode = getCurrentTNode();\n var nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);\n return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);\n }", "title": "" }, { "docid": "2da6714d89a432ce6e59c95a9cd67e00", "score": "0.46104056", "text": "apply(compiler) {\n this._compiler = compiler;\n // Decorate inputFileSystem to serve contents of CompilerHost.\n // Use decorated inputFileSystem in watchFileSystem.\n compiler.plugin('environment', () => {\n compiler.inputFileSystem = new virtual_file_system_decorator_1.VirtualFileSystemDecorator(compiler.inputFileSystem, this._compilerHost);\n compiler.watchFileSystem = new NodeWatchFileSystem(compiler.inputFileSystem);\n });\n compiler.plugin('invalid', () => {\n // Turn this off as soon as a file becomes invalid and we're about to start a rebuild.\n this._firstRun = false;\n this._diagnoseFiles = {};\n });\n // Add lazy modules to the context module for @angular/core/src/linker\n compiler.plugin('context-module-factory', (cmf) => {\n const angularCorePackagePath = require.resolve('@angular/core/package.json');\n const angularCorePackageJson = require(angularCorePackagePath);\n const angularCoreModulePath = path.resolve(path.dirname(angularCorePackagePath), angularCorePackageJson['module']);\n // Pick the last part after the last node_modules instance. We do this to let people have\n // a linked @angular/core or cli which would not be under the same path as the project\n // being built.\n const angularCoreModuleDir = path.dirname(angularCoreModulePath).split(/node_modules/).pop();\n // Also support the es2015 in Angular versions that have it.\n let angularCoreEs2015Dir;\n if (angularCorePackageJson['es2015']) {\n const angularCoreEs2015Path = path.resolve(path.dirname(angularCorePackagePath), angularCorePackageJson['es2015']);\n angularCoreEs2015Dir = path.dirname(angularCoreEs2015Path).split(/node_modules/).pop();\n }\n cmf.plugin('after-resolve', (result, callback) => {\n if (!result) {\n return callback();\n }\n // Alter only request from Angular;\n // @angular/core/src/linker matches for 2.*.*,\n // The other logic is for flat modules and requires reading the package.json of angular\n // (see above).\n if (!result.resource.endsWith(path.join('@angular/core/src/linker'))\n && !(angularCoreModuleDir && result.resource.endsWith(angularCoreModuleDir))\n && !(angularCoreEs2015Dir && result.resource.endsWith(angularCoreEs2015Dir))) {\n return callback(null, result);\n }\n this.done.then(() => {\n result.resource = this.genDir;\n result.dependencies.forEach((d) => d.critical = false);\n result.resolveDependencies = (_fs, _resource, _recursive, _regExp, cb) => {\n const dependencies = Object.keys(this._lazyRoutes)\n .map((key) => {\n const value = this._lazyRoutes[key];\n if (value !== null) {\n return new ContextElementDependency(value, key);\n }\n else {\n return null;\n }\n })\n .filter(x => !!x);\n cb(null, dependencies);\n };\n return callback(null, result);\n }, () => callback(null))\n .catch(err => callback(err));\n });\n });\n compiler.plugin('make', (compilation, cb) => this._make(compilation, cb));\n compiler.plugin('after-emit', (compilation, cb) => {\n compilation._ngToolsWebpackPluginInstance = null;\n cb();\n });\n compiler.plugin('done', () => {\n this._donePromise = null;\n this._compilation = null;\n });\n compiler.plugin('after-resolvers', (compiler) => {\n // Virtual file system.\n // Wait for the plugin to be done when requesting `.ts` files directly (entry points), or\n // when the issuer is a `.ts` file.\n compiler.resolvers.normal.plugin('before-resolve', (request, cb) => {\n if (this.done && (request.request.endsWith('.ts')\n || (request.context.issuer && request.context.issuer.endsWith('.ts')))) {\n this.done.then(() => cb(), () => cb());\n }\n else {\n cb();\n }\n });\n });\n compiler.plugin('normal-module-factory', (nmf) => {\n compiler.resolvers.normal.apply(new paths_plugin_1.PathsPlugin({\n nmf,\n tsConfigPath: this._tsConfigPath,\n compilerOptions: this._compilerOptions,\n compilerHost: this._compilerHost\n }));\n });\n }", "title": "" }, { "docid": "1d50c94ffc406aed5580fc076b6d113f", "score": "0.46019366", "text": "function compile(template) {\n\t\t\t\t\t\t\tif(attrDebug) {\n\t\t\t\t\t\t\t\tconsole.log(attrRender + ':' + template);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.log(attrRender,'before compile');\n\t\t\t\t\t\t\tvar compiledFn;\n\t\t\t\t\t\t\t//compile the template html text to function like doT does\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconsole.time('compile:' + attrRender);\n\t\t\t\t\t\t\t\tcompiledFn = doTA.compile(template, attrs);\n\t\t\t\t\t\t\t\tconsole.timeEnd('compile:'\t+ attrRender);\n\t\t\t\t\t\t\t\tuniqueId = doTA.U[attrRender];\n\t\t\t\t\t\t\t\tconsole.log(attrRender,'after compile(no-cache)');\n\t\t\t\t\t\t\t} catch (x) {\n\t\t\t\t\t\t\t\t/**/console.log('compile error', attrs, template);\n\t\t\t\t\t\t\t\tthrow x;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//compiled func into cache for later use\n\t\t\t\t\t\t\tif (attrRender) {\n\t\t\t\t\t\t\t\tdoTA.C[attrRender] = compiledFn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn compiledFn;\n\t\t\t\t\t\t}", "title": "" }, { "docid": "b2955d566fb86c7b8e8df3fd16268477", "score": "0.4595034", "text": "function pureRenderDecorator(component) {\n\t if (component.prototype.shouldComponentUpdate !== undefined) {\n\t // We're not using the condition mecanism of warning()\n\t // here to avoid useless calls to getComponentName().\n\t warning(\n\t false,\n\t 'Cannot decorate `%s` with @pureRenderDecorator, '\n\t + 'because it already implements `shouldComponentUpdate().',\n\t getComponentName(component)\n\t )\n\t }\n\t\n\t component.prototype.shouldComponentUpdate = shouldComponentUpdate;\n\t return component;\n\t}", "title": "" }, { "docid": "110446403811d75fe751da8eaf5f3bf4", "score": "0.45894012", "text": "function injectRenderer2() {\n // We need the Renderer to be based on the component that it's being injected into, however since\n // DI happens before we've entered its view, `getLView` will return the parent view instead.\n const lView = getLView();\n const tNode = getCurrentTNode();\n const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);\n return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);\n}", "title": "" }, { "docid": "f41e880d610dfecc40747b9b708f822d", "score": "0.4583162", "text": "function pureRenderDecorator(component) {\n if (component.prototype.shouldComponentUpdate !== undefined) {\n // We're not using the condition mecanism of warning()\n // here to avoid useless calls to getComponentName().\n warning(\n false,\n 'Cannot decorate `%s` with @pureRenderDecorator, '\n + 'because it already implements `shouldComponentUpdate().',\n getComponentName(component)\n )\n }\n\n component.prototype.shouldComponentUpdate = shouldComponentUpdate;\n return component;\n}", "title": "" }, { "docid": "f41e880d610dfecc40747b9b708f822d", "score": "0.4583162", "text": "function pureRenderDecorator(component) {\n if (component.prototype.shouldComponentUpdate !== undefined) {\n // We're not using the condition mecanism of warning()\n // here to avoid useless calls to getComponentName().\n warning(\n false,\n 'Cannot decorate `%s` with @pureRenderDecorator, '\n + 'because it already implements `shouldComponentUpdate().',\n getComponentName(component)\n )\n }\n\n component.prototype.shouldComponentUpdate = shouldComponentUpdate;\n return component;\n}", "title": "" }, { "docid": "f41e880d610dfecc40747b9b708f822d", "score": "0.4583162", "text": "function pureRenderDecorator(component) {\n if (component.prototype.shouldComponentUpdate !== undefined) {\n // We're not using the condition mecanism of warning()\n // here to avoid useless calls to getComponentName().\n warning(\n false,\n 'Cannot decorate `%s` with @pureRenderDecorator, '\n + 'because it already implements `shouldComponentUpdate().',\n getComponentName(component)\n )\n }\n\n component.prototype.shouldComponentUpdate = shouldComponentUpdate;\n return component;\n}", "title": "" }, { "docid": "c34e64c4c298b0cfaed4f123d8f5001a", "score": "0.45702136", "text": "function getOrCreateRenderer2(view) {\n var renderer = view[RENDERER];\n\n if (isProceduralRenderer(renderer)) {\n return renderer;\n } else {\n throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');\n }\n }", "title": "" }, { "docid": "ab25daf905ba2b24a8e663f2a76d69a6", "score": "0.4568716", "text": "function compile(self) {\n\n\t // Load & clone RE patterns.\n\t var re = self.re = assign({}, __webpack_require__(119));\n\n\t // Define dynamic patterns\n\t var tlds = self.__tlds__.slice();\n\n\t if (!self.__tlds_replaced__) {\n\t tlds.push(tlds_2ch_src_re);\n\t }\n\t tlds.push(re.src_xn);\n\n\t re.src_tlds = tlds.join('|');\n\n\t function untpl(tpl) {\n\t return tpl.replace('%TLDS%', re.src_tlds);\n\t }\n\n\t re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n\t re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n\t re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n\t re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n\t //\n\t // Compile each schema\n\t //\n\n\t var aliases = [];\n\n\t self.__compiled__ = {}; // Reset compiled data\n\n\t function schemaError(name, val) {\n\t throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n\t }\n\n\t Object.keys(self.__schemas__).forEach(function (name) {\n\t var val = self.__schemas__[name];\n\n\t // skip disabled methods\n\t if (val === null) {\n\t return;\n\t }\n\n\t var compiled = { validate: null, link: null };\n\n\t self.__compiled__[name] = compiled;\n\n\t if (isObject(val)) {\n\t if (isRegExp(val.validate)) {\n\t compiled.validate = createValidator(val.validate);\n\t } else if (isFunction(val.validate)) {\n\t compiled.validate = val.validate;\n\t } else {\n\t schemaError(name, val);\n\t }\n\n\t if (isFunction(val.normalize)) {\n\t compiled.normalize = val.normalize;\n\t } else if (!val.normalize) {\n\t compiled.normalize = createNormalizer();\n\t } else {\n\t schemaError(name, val);\n\t }\n\n\t return;\n\t }\n\n\t if (isString(val)) {\n\t aliases.push(name);\n\t return;\n\t }\n\n\t schemaError(name, val);\n\t });\n\n\t //\n\t // Compile postponed aliases\n\t //\n\n\t aliases.forEach(function (alias) {\n\t if (!self.__compiled__[self.__schemas__[alias]]) {\n\t // Silently fail on missed schemas to avoid errons on disable.\n\t // schemaError(alias, self.__schemas__[alias]);\n\t return;\n\t }\n\n\t self.__compiled__[alias].validate = self.__compiled__[self.__schemas__[alias]].validate;\n\t self.__compiled__[alias].normalize = self.__compiled__[self.__schemas__[alias]].normalize;\n\t });\n\n\t //\n\t // Fake record for guessed links\n\t //\n\t self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n\t //\n\t // Build schema condition\n\t //\n\t var slist = Object.keys(self.__compiled__).filter(function (name) {\n\t // Filter disabled & fake schemas\n\t return name.length > 0 && self.__compiled__[name];\n\t }).map(escapeRE).join('|');\n\t // (?!_) cause 1.5x slowdown\n\t self.re.schema_test = RegExp('(^|(?!_)(?:>|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n\t self.re.schema_search = RegExp('(^|(?!_)(?:>|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n\t self.re.pretest = RegExp('(' + self.re.schema_test.source + ')|' + '(' + self.re.host_fuzzy_test.source + ')|' + '@', 'i');\n\n\t //\n\t // Cleanup\n\t //\n\n\t resetScanCache(self);\n\t}", "title": "" }, { "docid": "4030cab9eef95522c7ca42740b6951ab", "score": "0.45588034", "text": "function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) {\n // The global-analysis based Ivy mode in ngc is no longer utilized/supported.\n throw new Error('unsupported');\n}", "title": "" }, { "docid": "5fa70f57d662629a881e6031c6fe0e22", "score": "0.45343906", "text": "function getOrCreateRenderer2(lView) {\n var renderer = lView[RENDERER];\n\n if (ngDevMode && !isProceduralRenderer(renderer)) {\n throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');\n }\n\n return renderer;\n }", "title": "" }, { "docid": "ff2dcdf7eb352f316df29a4d1012ccbc", "score": "0.45104977", "text": "function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {\n var _a = baseDirectiveFields(meta, constantPool, bindingParser), definitionMap = _a.definitionMap, statements = _a.statements;\n addFeatures(definitionMap, meta);\n var expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var type = createTypeForDef(meta, Identifiers$1.DirectiveDefWithMeta);\n return { expression: expression, type: type, statements: statements };\n}", "title": "" }, { "docid": "607bf30712ae4b747acf75ceb7118629", "score": "0.44965935", "text": "function component({ mount, update, isStatic: isStaticCandidate, destroy: destroyCandidate }, shift= 0){\n\trecalculateDeep(shift);\n\tconst el_parent= getParentElement();\n\tels[all_els_counter]= mount(el_parent);\n\tif(el_parent instanceof DocumentFragment) ondestroy(destroyCandidate);\n\tif(!isStaticCandidate()){\n\t\tif(isStatic()) internal_storage= initStorage();\n\t\tinternal_storage.registerComponent(update);\n\t}\n\tall_els_counter+= 1;\n\treturn component_out;\n}", "title": "" }, { "docid": "2196d1a432c4acb44ccf73752e401763", "score": "0.44664475", "text": "function injectRenderer2() {\n return getOrCreateRenderer2(getLView());\n}", "title": "" }, { "docid": "17774040e339d0e0433ff8c4de93897d", "score": "0.44615188", "text": "function renderComponent(program, env, builder, main, name) {\n var args = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};\n var vm = VM.empty(program, env, builder, main);\n var resolver = vm.constants.resolver;\n var definition = resolveComponent(resolver, name, null);\n var manager = definition.manager,\n state = definition.state;\n var capabilities = capabilityFlagsFrom(manager.getCapabilities(state));\n var invocation;\n\n if (hasStaticLayoutCapability(capabilities, manager)) {\n invocation = manager.getLayout(state, resolver);\n } else {\n throw new Error('Cannot invoke components with dynamic layouts as a root component.');\n } // Get a list of tuples of argument names and references, like\n // [['title', reference], ['name', reference]]\n\n\n var argList = Object.keys(args).map(function (key) {\n return [key, args[key]];\n });\n var blockNames = ['main', 'else', 'attrs']; // Prefix argument names with `@` symbol\n\n var argNames = argList.map(function (_ref59) {\n var name = _ref59[0];\n return \"@\" + name;\n });\n vm.pushFrame(); // Push blocks on to the stack, three stack values per block\n\n for (var i = 0; i < 3 * blockNames.length; i++) {\n vm.stack.push(null);\n }\n\n vm.stack.push(null); // For each argument, push its backing reference on to the stack\n\n argList.forEach(function (_ref60) {\n var reference = _ref60[1];\n vm.stack.push(reference);\n }); // Configure VM based on blocks and args just pushed on to the stack.\n\n vm.args.setup(vm.stack, argNames, blockNames, 0, false); // Needed for the Op.Main opcode: arguments, component invocation object, and\n // component definition.\n\n vm.stack.push(vm.args);\n vm.stack.push(invocation);\n vm.stack.push(definition);\n return new TemplateIteratorImpl(vm);\n }", "title": "" }, { "docid": "c1f470d846e821d13a4f5e80aae353f9", "score": "0.4452838", "text": "compile(errorListener) {\n\n var loContext = new LoContext();\n\n loContext.setErrorListener(errorListener);\n\n // todo another compensating hack because of compiling tail-first\n // compile all the deps right here\n\n this.deps.forEach(function (dep) {\n\n // ignore the return value, which is just a no-op\n dep.compile(loContext);\n });\n\n var t = this;\n\n var firstStmt = new CFNode();\n var lastStmt = firstStmt;\n\n this.defs.forEach(def => {\n lastStmt = lastStmt.setNext(def.compile(loContext));\n });\n\n // bail if we had errors\n if (loContext.hasErrors()) {\n throw new Error(\"compilation failed\");\n }\n\n var exports = loContext.getConstants().map(c => {\n return [JS.string(c.name), JS.ID('$' + c.name)];\n });\n\n // try a return here, see if it works\n lastStmt = lastStmt.setNext(new CFNode(\n JS.return(\n JS.objLiteral(exports)\n )\n ));\n\n // all other compile()s return IR; this returns JS? NASTY\n return new JsWriter().generateJs(firstStmt);\n }", "title": "" }, { "docid": "f29ae4ba70c078b1abed26207218607f", "score": "0.44248664", "text": "function compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = __webpack_require__(/*! ./lib/re */ \"./node_modules/[email protected]@linkify-it/lib/re.js\")(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}", "title": "" }, { "docid": "6c9a45573e2c55545838609908881167", "score": "0.44113037", "text": "function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {\n // Use the `CompileReflector` to look up references to some well-known Angular types. These will\n // be compared with the token to statically determine whether the token has significance to\n // Angular, and set the correct `R3ResolvedDependencyType` as a result.\n const injectorRef = reflector.resolveExternalReference(Identifiers.Injector);\n // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.\n const deps = [];\n for (let dependency of type.diDeps) {\n if (dependency.token) {\n const tokenRef = tokenReference(dependency.token);\n let resolved = dependency.isAttribute ?\n R3ResolvedDependencyType.Attribute :\n R3ResolvedDependencyType.Token;\n // In the case of most dependencies, the token will be a reference to a type. Sometimes,\n // however, it can be a string, in the case of older Angular code or @Attribute injection.\n const token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);\n // Construct the dependency.\n deps.push({\n token,\n resolved,\n host: !!dependency.isHost,\n optional: !!dependency.isOptional,\n self: !!dependency.isSelf,\n skipSelf: !!dependency.isSkipSelf,\n });\n }\n else {\n unsupported('dependency without a token');\n }\n }\n return deps;\n}", "title": "" }, { "docid": "da1e008942ce04cb1f884824dd8caf11", "score": "0.44081324", "text": "function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {\n const { definitionMap, statements } = baseDirectiveFields(meta, constantPool, bindingParser);\n addFeatures(definitionMap, meta);\n const expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);\n if (!meta.selector) {\n throw new Error(`Directive ${meta.name} has no selector, please add it!`);\n }\n const type = createTypeForDef(meta, Identifiers$1.DirectiveDefWithMeta);\n return { expression, type, statements };\n}", "title": "" }, { "docid": "64b37c310cc36d8a1afd527cbf26edc1", "score": "0.44078937", "text": "static compileComponents() {\n return TestBedImpl.INSTANCE.compileComponents();\n }", "title": "" }, { "docid": "4f847d07df9d4b94d38a30743f1e1606", "score": "0.44057927", "text": "beforeRender(data) {\n // set compiler data for use inside layouts\n data.compiler = {\n hash: store.hash,\n publicPath: paths.public,\n isProduction\n };\n }", "title": "" }, { "docid": "0f86fc59b61ead58f9a009038083f11e", "score": "0.44026002", "text": "function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) {\n var summary = directive.toSummary();\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n return {\n name: name,\n type: outputCtx.importExpr(directive.type.reference),\n typeArgumentCount: 0,\n typeSourceSpan: typeSourceSpan(directive.isComponent ? 'Component' : 'Directive', directive.type),\n selector: directive.selector,\n deps: dependenciesFromGlobalMetadata(directive.type, outputCtx, reflector),\n queries: queriesFromGlobalMetadata(directive.queries, outputCtx),\n lifecycle: {\n usesOnChanges: directive.type.lifecycleHooks.some(function (lifecycle) { return lifecycle == LifecycleHooks.OnChanges; }),\n },\n host: {\n attributes: directive.hostAttributes,\n listeners: summary.hostListeners,\n properties: summary.hostProperties,\n },\n inputs: directive.inputs,\n outputs: directive.outputs,\n usesInheritance: false,\n exportAs: null,\n providers: directive.providers.length > 0 ? new WrappedNodeExpr(directive.providers) : null\n };\n}", "title": "" }, { "docid": "83bd97b5b2e292ae9a6e33d30771d7f0", "score": "0.4399578", "text": "apply(compiler) {\n // We will use a single ExtractTextPlugin to extract the css entries\n let extractTextPlugin = new _extractTextWebpackPlugin2.default({\n disable: this.options.disable,\n filename: this.options.output.filename\n });\n compiler.apply(extractTextPlugin);\n // Using 'this-compilation' (do not hook into child compilations)\n compiler.plugin(\"this-compilation\", (compilation, params) => {\n extractTextPlugin.options.disable = this.options.disable;\n if (this.options.disable === true) return;\n // Creating a CssEntryCompilation scoped to the new Compilation instance\n let cssEntryCompilation = new _CssEntryCompilation2.default(this.options, compiler, compilation, extractTextPlugin);\n (0, _models.getCssEntryPluginCompilation)(compilation).applyPlugins(\"css-entry-compilation\", cssEntryCompilation);\n params.normalModuleFactory.plugin(\"after-resolve\", (0, _tapable.toAsyncWaterfallHandler)(data => cssEntryCompilation.onNormalModuleFactoryAfterResolve(data)));\n compilation.plugin(\"after-seal\", (0, _tapable.toAsyncHandler)(() => cssEntryCompilation.onCompilationAfterSeal()));\n compilation.apply(new _HtmlWebpackPluginCssEntryFix2.default());\n });\n }", "title": "" }, { "docid": "49ef896081eb96d2eb423c75cbdf067f", "score": "0.43965587", "text": "function buildComponent(options, additionalFiles = {}) {\n return (host, context) => {\n const workspace = config_1.getWorkspace(host);\n const project = get_project_1.getProjectFromWorkspace(workspace, options.project);\n const defaultComponentOptions = schematic_options_1.getDefaultComponentOptions(project);\n // TODO(devversion): Remove if we drop support for older CLI versions.\n // This handles an unreported breaking change from the @angular-devkit/schematics. Previously\n // the description path resolved to the factory file, but starting from 6.2.0, it resolves\n // to the factory directory.\n const schematicPath = fs_1.statSync(context.schematic.description.path).isDirectory() ?\n context.schematic.description.path :\n path_1.dirname(context.schematic.description.path);\n const schematicFilesUrl = './files';\n const schematicFilesPath = path_1.resolve(schematicPath, schematicFilesUrl);\n // Add the default component option values to the options if an option is not explicitly\n // specified but a default component option is available.\n Object.keys(options)\n .filter(optionName => options[optionName] == null && defaultComponentOptions[optionName])\n .forEach(optionName => options[optionName] = defaultComponentOptions[optionName]);\n if (options.path === undefined) {\n // TODO(jelbourn): figure out if the need for this `as any` is a bug due to two different\n // incompatible `WorkspaceProject` classes in @angular-devkit\n options.path = project_1.buildDefaultPath(project);\n }\n options.module = find_module_1.findModuleFromOptions(host, options);\n const parsedPath = parse_name_1.parseName(options.path, options.name);\n options.name = parsedPath.name;\n options.path = parsedPath.path;\n options.selector = options.selector || buildSelector(options, project.prefix);\n validation_1.validateName(options.name);\n validation_1.validateHtmlSelector(options.selector);\n // In case the specified style extension is not part of the supported CSS supersets,\n // we generate the stylesheets with the \"css\" extension. This ensures that we don't\n // accidentally generate invalid stylesheets (e.g. drag-drop-comp.styl) which will\n // break the Angular CLI project. See: https://github.com/angular/material2/issues/15164\n if (!supportedCssExtensions.includes(options.styleext)) {\n options.styleext = 'css';\n }\n // Object that will be used as context for the EJS templates.\n const baseTemplateContext = Object.assign({}, core_1.strings, { 'if-flat': (s) => options.flat ? '' : s }, options);\n // Key-value object that includes the specified additional files with their loaded content.\n // The resolved contents can be used inside EJS templates.\n const resolvedFiles = {};\n for (let key in additionalFiles) {\n if (additionalFiles[key]) {\n const fileContent = fs_1.readFileSync(path_1.join(schematicFilesPath, additionalFiles[key]), 'utf-8');\n // Interpolate the additional files with the base EJS template context.\n resolvedFiles[key] = core_1.template(fileContent)(baseTemplateContext);\n }\n }\n const templateSource = schematics_1.apply(schematics_1.url(schematicFilesUrl), [\n options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),\n options.inlineStyle ? schematics_1.filter(path => !path.endsWith('.__styleext__')) : schematics_1.noop(),\n options.inlineTemplate ? schematics_1.filter(path => !path.endsWith('.html')) : schematics_1.noop(),\n // Treat the template options as any, because the type definition for the template options\n // is made unnecessarily explicit. Every type of object can be used in the EJS template.\n schematics_1.template(Object.assign({ indentTextContent, resolvedFiles }, baseTemplateContext)),\n // TODO(devversion): figure out why we cannot just remove the first parameter\n // See for example: angular-cli#schematics/angular/component/index.ts#L160\n schematics_1.move(null, parsedPath.path),\n ]);\n return schematics_1.chain([\n schematics_1.branchAndMerge(schematics_1.chain([\n addDeclarationToNgModule(options),\n schematics_1.mergeWith(templateSource),\n ])),\n ])(host, context);\n };\n}", "title": "" }, { "docid": "d2ebf248148456b0fc93fbc0fe92ee9d", "score": "0.4380544", "text": "function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {\n var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);\n var expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var type = new ExpressionType(importExpr(Identifiers$1.DirectiveDef, [\n typeWithParameters(meta.type, meta.typeArgumentCount),\n new ExpressionType(literal(selectorForType))\n ]));\n return { expression: expression, type: type };\n}", "title": "" }, { "docid": "d2ebf248148456b0fc93fbc0fe92ee9d", "score": "0.4380544", "text": "function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {\n var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);\n var expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);\n // On the type side, remove newlines from the selector as it will need to fit into a TypeScript\n // string literal, which must be on one line.\n var selectorForType = (meta.selector || '').replace(/\\n/g, '');\n var type = new ExpressionType(importExpr(Identifiers$1.DirectiveDef, [\n typeWithParameters(meta.type, meta.typeArgumentCount),\n new ExpressionType(literal(selectorForType))\n ]));\n return { expression: expression, type: type };\n}", "title": "" }, { "docid": "36b9316e268e4887945df99356a81c81", "score": "0.4371862", "text": "function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) {\n var summary = directive.toSummary();\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n return {\n name: name,\n type: outputCtx.importExpr(directive.type.reference),\n typeArgumentCount: 0,\n typeSourceSpan: typeSourceSpan(directive.isComponent ? 'Component' : 'Directive', directive.type),\n selector: directive.selector,\n deps: dependenciesFromGlobalMetadata(directive.type, outputCtx, reflector),\n queries: queriesFromGlobalMetadata(directive.queries, outputCtx),\n lifecycle: {\n usesOnChanges: directive.type.lifecycleHooks.some(function (lifecycle) { return lifecycle == LifecycleHooks.OnChanges; }),\n },\n host: {\n attributes: directive.hostAttributes,\n listeners: summary.hostListeners,\n properties: summary.hostProperties,\n },\n inputs: directive.inputs,\n outputs: directive.outputs,\n usesInheritance: false,\n };\n}", "title": "" }, { "docid": "36b9316e268e4887945df99356a81c81", "score": "0.4371862", "text": "function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) {\n var summary = directive.toSummary();\n var name = identifierName(directive.type);\n name || error(\"Cannot resolver the name of \" + directive.type);\n return {\n name: name,\n type: outputCtx.importExpr(directive.type.reference),\n typeArgumentCount: 0,\n typeSourceSpan: typeSourceSpan(directive.isComponent ? 'Component' : 'Directive', directive.type),\n selector: directive.selector,\n deps: dependenciesFromGlobalMetadata(directive.type, outputCtx, reflector),\n queries: queriesFromGlobalMetadata(directive.queries, outputCtx),\n lifecycle: {\n usesOnChanges: directive.type.lifecycleHooks.some(function (lifecycle) { return lifecycle == LifecycleHooks.OnChanges; }),\n },\n host: {\n attributes: directive.hostAttributes,\n listeners: summary.hostListeners,\n properties: summary.hostProperties,\n },\n inputs: directive.inputs,\n outputs: directive.outputs,\n usesInheritance: false,\n };\n}", "title": "" }, { "docid": "05ca7335896ee75e72fce556592b5089", "score": "0.43625715", "text": "function runpure2(window, data, directive) {\n\tPure2.setWindow(window)\n\tvar template = window.pure('div.template')\n\tvar rfn = window.pure(template).compile(directive)\n\tvar output = rfn(data)\n\tif (ShowOutput)\n\t\tconsole.log(output)\n}", "title": "" }, { "docid": "b74f2f0d844032a941f7d1ed43d5f1d0", "score": "0.435263", "text": "function Render(template) {\n return (target, key, descriptor) => {\n Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);\n return descriptor;\n };\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "3567ef1bb3c8f176eb901f659f44d20a", "score": "0.43522763", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n options.components = Object.assign(components, options.components || {})\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "c49dfc25858b4506d45518d8841ee85b", "score": "0.4347097", "text": "function getOrCreateRenderer2(lView) {\n const renderer = lView[RENDERER];\n if (ngDevMode && !isProceduralRenderer(renderer)) {\n throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');\n }\n return renderer;\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" }, { "docid": "baf5bdc999dc34f2524fb0ee65425519", "score": "0.43459797", "text": "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "title": "" } ]
b44142f3f7fb0b30f73fa2c01b548255
swipe to next page
[ { "docid": "15301d3cf00d2d1682cb855ebf0ff5b3", "score": "0.0", "text": "function swipeLoad() {\n console.log(\"swipeLoad\");\n var hammertime = new Hammer(document.querySelector('#page3'));\n hammertime.on('swipeup', function (ev) {\n $('#page3 .page3-get-icon').hide();\n moveToNext();\n });\n hammertime.get('swipe').set({direction: Hammer.DIRECTION_VERTICAL});\n }", "title": "" } ]
[ { "docid": "9ab448bd9e73701fa2e5213c302ca13a", "score": "0.7931267", "text": "turnToNextPage() {\n this.pages.showNext();\n }", "title": "" }, { "docid": "dcfeeddedc1d0a00efaa3b1a49169efd", "score": "0.7785451", "text": "goNext() {\n if (this.swiper) this.swiper.slideNext();\n }", "title": "" }, { "docid": "eb69cf64e90d0074f37697856a085e30", "score": "0.7743229", "text": "function moveToNext() {\n slideOut($page3);\n page4Load();\n }", "title": "" }, { "docid": "36c1253c654083823f55b2fbdbf57c5f", "score": "0.76642656", "text": "goNextPage() {\n this.goPage(this.page + 1);\n }", "title": "" }, { "docid": "f122efefc56cc5d84fc58adce0718ac3", "score": "0.7657556", "text": "goToNext () {\n\t\t\tif (this.canGoToNext) {\n\t\t\t\tthis.goTo(this.currentSlide + 1)\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "339009478b042ece253a1c103fee7f50", "score": "0.7584989", "text": "function scrollToNextPage() {\n card_scroller.scrollBy(card_item_size, 0);\n }", "title": "" }, { "docid": "687149ed28802b69026b7c952cc7db8c", "score": "0.7524089", "text": "function next(){\n setPage(getNextPage());\n }", "title": "" }, { "docid": "827dffa9580853bae64facd74f2a7e8c", "score": "0.7450905", "text": "nextPage () {\n this.goToPage(this.pagination.current + 1);\n }", "title": "" }, { "docid": "a0cd7815f7b1db717f7be7de45a546ee", "score": "0.74134284", "text": "function nextPage(){\n sta.log('Hiding current page: '+ page);\n //$('#'+ pages[page]).hide();\n pages[page].hide();\n jq('#page-'+ page +'-mark').removeClass('current');\n page = (page + 1) % pages.length;\n\n sta.log('Moving to next page: '+ page);\n\n //$('#'+ pages[page]).show();\n pages[page].show();\n jq('#page-'+ page +'-mark').addClass('current');\n reinitializeScrolling();\n resize();\n }", "title": "" }, { "docid": "d96e38f92259fda0721d8ed4b53f2c29", "score": "0.73772645", "text": "function nextPage () {\n if (!ctrl.canPageForward()) { return; }\n\n var newOffset = MdTabsPaginationService.increasePageOffset(getElements(), ctrl.offsetLeft);\n\n ctrl.offsetLeft = fixOffset(newOffset);\n }", "title": "" }, { "docid": "d96e38f92259fda0721d8ed4b53f2c29", "score": "0.73772645", "text": "function nextPage () {\n if (!ctrl.canPageForward()) { return; }\n\n var newOffset = MdTabsPaginationService.increasePageOffset(getElements(), ctrl.offsetLeft);\n\n ctrl.offsetLeft = fixOffset(newOffset);\n }", "title": "" }, { "docid": "ce10925394b8a19e90e93ea863435f8d", "score": "0.7373989", "text": "next() { this.goto(this.page + 1); }", "title": "" }, { "docid": "d35a12e6606fcb867bc61e9a8f09496b", "score": "0.72933924", "text": "function navigateNext() {\n\n\t\t// Prioritize revealing fragments\n\t\tif( nextFragment() === false ) {\n\t\t\tif( availableRoutes().down ) {\n\t\t\t\tnavigateDown();\n\t\t\t}\n\t\t\telse if( config.rtl ) {\n\t\t\t\tnavigateLeft();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnavigateRight();\n\t\t\t}\n\t\t}\n\n\t\t// If auto-sliding is enabled we need to cue up\n\t\t// another timeout\n\t\tcueAutoSlide();\n\n\t}", "title": "" }, { "docid": "eee09933f3ba42aad3ff2e05e8df87b4", "score": "0.7289065", "text": "navigateToNext() {\n this._updateProgressStructureOnDirection('next');\n }", "title": "" }, { "docid": "a55047a8d62388b2b64ca4193a04adf9", "score": "0.7279719", "text": "nextPage(e) {\n e.preventDefault();\n if (!this.changingPage) {\n if (this.page < this.pages) {\n this.changePage(e, this.page + this.numberPageShow);\n }\n }\n }", "title": "" }, { "docid": "37f42d669b376f8b3da1c67af8b1b61b", "score": "0.7277161", "text": "function nextPage() {\n\n var tempPage = _movies.getCurrentPage;\n var tempNumPages = _movies.getNumPages;\n\n if (tempPage < tempNumPages) {\n _movies.setCurrentPage(tempPage + 1);\n getPage();\n }\n}", "title": "" }, { "docid": "8176abc34d6778d7505a8de854d4028d", "score": "0.72737324", "text": "nextPage() {\n this.setPage(Math.min(this.state.page + 1, this.pages.length - 1));\n }", "title": "" }, { "docid": "4c9dcc3ef05bfe3b37ef9ad631faf569", "score": "0.7252724", "text": "function handleNextBtnClick() {\r\n slideTo(currentIndex + 1);\r\n}", "title": "" }, { "docid": "c029add05b472218a7c03a0b29f90502", "score": "0.7249029", "text": "function nextPage() {\n pageindex++;\n openPage();\n }", "title": "" }, { "docid": "96fbe8a21b9f7a13824c542a30351456", "score": "0.71503556", "text": "function nextSection(){\n $.fn.pagepiling.moveSectionDown();\n }", "title": "" }, { "docid": "28e86658a309860619e8c1fb006df3c7", "score": "0.7136491", "text": "function goToNextSlide() {\n\t\tif($currentSlide.next().length && $indexCurrentSlide != 0)\n\t\t\tgoToSlide($currentSlide.next());\n\t}", "title": "" }, { "docid": "00830b34c14d67646fa839d0043e7773", "score": "0.71247506", "text": "next() {\n this.slide();\n }", "title": "" }, { "docid": "0b7952951db9b7f03f19083d8a54ac2a", "score": "0.7120366", "text": "function goNext() {\n view.goForward();\n}", "title": "" }, { "docid": "58109344305f91998c0684f1f1f738cf", "score": "0.7100374", "text": "function moveNext() {\n if (currentSwipe === slidesCounter - 1) {\n console.log('Last slide');\n return;\n }\n // go to next slide\n currentSwipe++;\n translate(currentSwipe);\n }", "title": "" }, { "docid": "08190a0116b9d1fab401ee51d9bce447", "score": "0.70755476", "text": "nextPage()\n {\n if ((this.currentPage + 1) < this.pages)\n {\n this.changePage(1);\n }\n }", "title": "" }, { "docid": "5b436e9b8fe2ea7dc856ffd9470d8dbe", "score": "0.70677257", "text": "nextPage() {\n if (this.currentPage < this.totalPages) {\n this.currentPage = this.currentPage + 1;\n this.refresh();\n }\n }", "title": "" }, { "docid": "d7fcc0a9175b5861798c50db78c6785e", "score": "0.70540154", "text": "next() {\n const itemsPerPage = this.getItemsPerPage()\n const startLeft = this.container.scrollLeft()\n let distanceToScroll = (this.itemWidth * itemsPerPage) + (this.gutterWidth * itemsPerPage)\n if(startLeft % this.itemContainerWidth !== 0) {\n distanceToScroll = distanceToScroll - (startLeft % this.itemContainerWidth)\n }\n this.container.animate({\n scrollLeft: startLeft + distanceToScroll\n })\n }", "title": "" }, { "docid": "9180427aecf022c2f427c9e144096604", "score": "0.7037407", "text": "function nextPage() {\n if (pagination.currentPage < pagination.nums.length) {\n setPagination({\n ...pagination,\n currentPage: pagination.currentPage + 1\n });\n updateCurrentViews(pagination.currentPage + 1, champions.searchResults);\n }\n }", "title": "" }, { "docid": "bf941ac66227eed6e088e1e01395e8ee", "score": "0.7021011", "text": "function navnext( next ) {\n $( \":mobile-pagecontainer\" ).pagecontainer( \"change\", next + \".html\", {\n transition: \"slide\"\n });\n }", "title": "" }, { "docid": "938adb4ed9757469c14fed6cbbe75da5", "score": "0.70120394", "text": "function gotoNextPage() {\n setCurrentPageUrl(nextPage)\n }", "title": "" }, { "docid": "6a59a908180e432e8693ba34a1752d4c", "score": "0.6991814", "text": "function navigateNext() {\n\n\t\t\t// Prioritize revealing fragments\n\t\t\tif( nextFragment() === false ) {\n\t\t\t\tif( availableRoutes().down ) {\n\t\t\t\t\tnavigateDown();\n\t\t\t\t}\n\t\t\t\telse if( config.rtl ) {\n\t\t\t\t\tnavigateLeft();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnavigateRight();\n\t\t\t\t}\n\t\t\t}\n\n\t\t}", "title": "" }, { "docid": "921b277be76c660666f3c1b697808b3f", "score": "0.69721514", "text": "function navigateNext() {\n\n\t\t// Prioritize revealing fragments\n\t\tif( nextFragment() === false ) {\n\t\t\tif( availableRoutes().down ) {\n\t\t\t\tnavigateDown();\n\t\t\t}\n\t\t\telse if( config.rtl ) {\n\t\t\t\tnavigateLeft();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnavigateRight();\n\t\t\t}\n\t\t}\n\n\t}", "title": "" }, { "docid": "6f51ce13261db30859a05da912ce066d", "score": "0.6950919", "text": "function goNext(){\n currentlyActiveContentIndex++;\n if(currentlyActiveContentIndex >= contents.length){\n currentlyActiveContentIndex--;\n }else{\n document.getElementById(contents[currentlyActiveContentIndex]).scrollIntoView();\n window.scrollBy(0,scrollBackOffset);\n }\n}", "title": "" }, { "docid": "8be2c93f7c073b844634bb6e3b7d2c5d", "score": "0.6934665", "text": "function nextPage() {\n\t\t// go to new page\n\t\tdocument.location.hash = getNextPage();\n\t}", "title": "" }, { "docid": "0ecde938498d36d19d96ed20985dae71", "score": "0.68838066", "text": "function next() {\n let isClick = false;\n setCurrentPage((currentPage) => Math.max(currentPage + 4)); //variabel currentPage akan ditambahkan 4\n if(currentPage + 8 === 24) { //jika currentPage sama dengan 24 maka button next akan didisabled\n setNext(true);\n } \n\n if(isClick === false) { //jika pada 4 tampilan card pertama button next diklik maka saat berpindah button previous sudah tidak didisabled lagi\n setPrev(false);\n isClick = true;\n }\n }", "title": "" }, { "docid": "21ccd3cf8058752e7081592e8338843d", "score": "0.6870557", "text": "function _next() {\n _redirect({\n before: null,\n after: $scope.after,\n count: (_state.before ? _state.count - 1 : _state.count + conf.reddit.perPage)\n });\n }", "title": "" }, { "docid": "b75a55bde80774c5db714efb81bc9992", "score": "0.68679535", "text": "NextPage() {\n if (this.page >= this.maxpage) return;\n this.page++;\n this.ChangePage();\n }", "title": "" }, { "docid": "85a0b0276286e18707b3ebc97c32ba68", "score": "0.6858678", "text": "function nextSlide() {\n currentIndex++;\n if (currentIndex === slides.length) {\n currentIndex = 0;\n }\n showSlide();\n }", "title": "" }, { "docid": "5a59664e0b1e582da8d254e932e69c27", "score": "0.68383163", "text": "function next() {\n if (page === menu.length - 1) {\n page = 0;\n }\n else {\n page +=1;\n }\n display();\n}", "title": "" }, { "docid": "84a63b9cbc731b30ae283dd57a042e9c", "score": "0.6837213", "text": "function next()\n {\n if (page === menus.length-1){\n page = 0;\n }\n else {\n page = page + 1; \n }\n display();\n }", "title": "" }, { "docid": "38cce4a7b0585aba8afac875a75eab40", "score": "0.68228585", "text": "function nextPage() {\n // calculate new offset\n offset = offset + pageSize();\n $.bbq.pushState({offset:offset});\n displayPage();\n}", "title": "" }, { "docid": "800c1d35e220f753710cf84b40e56649", "score": "0.6822663", "text": "function goNext() {\n if (pageNum >= pdfDoc.numPages)\n return;\n pageNum++;\n renderPage(pageNum);\n }", "title": "" }, { "docid": "cd49fa104626d592e2a48950dc97441c", "score": "0.6813658", "text": "nextPage() {\n this.set(\"page\", this.page + 1);\n this.set(\"_pageIndex\", this._pageIndex + this.pageSize);\n this.fire('next-page', this._pageIndex);\n }", "title": "" }, { "docid": "0a643d47e238dd111a7eb30d921faf6a", "score": "0.68055916", "text": "_nextSlide() {\n const slideIndex = this._getSlideIndex();\n this.setState({\n lastSlideIndex: slideIndex,\n });\n const slideReference = this.state.slideReference;\n if (\n this._checkFragments(this.props.route.slide, true) ||\n this.props.route.params.indexOf('overview') !== -1\n ) {\n if (slideIndex === slideReference.length - 1) {\n // On last slide, loop to first slide\n if (this.props.autoplay && this.state.autoplaying) {\n this.resetShow();\n }\n } else if (slideIndex < slideReference.length - 1) {\n this.viewedIndexes.add(slideIndex);\n const offset = this._getOffset(slideIndex);\n this.context.history.replace(\n `/${this._getHash(slideIndex + offset) + this._getSuffix()}`\n );\n\n this.setLocalStorageSlide(slideIndex + offset, true);\n }\n } else if (slideIndex < slideReference.length) {\n\n this.setLocalStorageSlide(slideIndex, true);\n }\n }", "title": "" }, { "docid": "47e3b059d90765df11bed0a7a40fedc0", "score": "0.6798841", "text": "function nextSlide() {\n if (lx.activeIndex + 1 === lx.slidesCount) {\n lx.activeIndex = 0;\n } else {\n lx.activeIndex++;\n }\n\n if (angular.isFunction(lx.onNextClick)) {\n lx.onNextClick();\n }\n }", "title": "" }, { "docid": "0096b5bf2b876a0905e8a4e0b7f8ab94", "score": "0.6796442", "text": "function nextPage () {\r\n var viewportWidth = elements.canvas.clientWidth,\r\n totalWidth = viewportWidth + ctrl.offsetLeft,\r\n i, tab;\r\n for (i = 0; i < elements.tabs.length; i++) {\r\n tab = elements.tabs[ i ];\r\n if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;\r\n }\r\n ctrl.offsetLeft = fixOffset(tab.offsetLeft);\r\n }", "title": "" }, { "docid": "e7d29157f538bdc73ddd57cee8a1864b", "score": "0.6792625", "text": "function nextPage(){\n\tif(numPage<pageNumber){\n\t\tnumPage++;\n\t\tshowPage();\n\t}\n\tcheckNumPage();\n}", "title": "" }, { "docid": "07a88e4c224ce4f4c79d69a2ce784a45", "score": "0.67764187", "text": "function nextPage () {\n var viewportWidth = elements.canvas.clientWidth,\n totalWidth = viewportWidth + ctrl.offsetLeft,\n i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft);\n }", "title": "" }, { "docid": "684e4fe4ec336151de85bdc180521e99", "score": "0.6771761", "text": "function nextPage(){\n console.log(\"Next button clicked\");\n }", "title": "" }, { "docid": "d42666e3f934354106b19e87401c3669", "score": "0.6767463", "text": "function nextPage() {\n const data = document.querySelector(\"#next\");\n const shown = document.querySelector(\"#shown-select\");\n data.addEventListener(\"click\", (event) => {\n event.preventDefault();\n const newstart = document.querySelector(\"#current\").getAttribute(\"value\");\n const start = parseInt(newstart) * parseInt(shown.value);\n clearNavTable();\n listUsers(start, parseInt(shown.value) + start - 1);\n });\n}", "title": "" }, { "docid": "5b45f228520ed27e131162bace4e13f6", "score": "0.67634296", "text": "showNext() {\n\t\t\tthis.show(this.currentPage + 1);\n\t\t}", "title": "" }, { "docid": "2709b38fab758e405d327963426e0b0b", "score": "0.67575556", "text": "function nextPage () {\n var elements = getElements();\n var viewportWidth = elements.canvas.clientWidth,\n totalWidth = viewportWidth + ctrl.offsetLeft,\n i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft);\n }", "title": "" }, { "docid": "3eab899fe17e57680c42f12cde3724d7", "score": "0.6755605", "text": "function nextPage() {\n\t\t// show the next page\n\t\tvar next_page = page_index[page_counter];\t\n\t\t$(next_page).css(\"display\", \"block\");\n\t\tconsole.log(\"current Section: \" + next_page);\n\n\t\t// hide all other pages\n\t\tfor (let i = 0; i < index_length; i++) {\n\t\t\tif (page_index[i] == page_index[page_counter]) {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\t$(page_index[i]).css(\"display\", \"none\");\n\t\t\t}\n\t\t}\n\n\t\t// increment the page counter\n\t\tpage_counter += 1;\n\t}", "title": "" }, { "docid": "87fd2ce4aea1b247a3f827821d87a401", "score": "0.67516565", "text": "function nextPage(){\n\tif(phone)document.getElementsByClassName(\"a-last\")[0].outerHTML = document.getElementsByClassName(\"a-last\")[0].outerHTML;\n\tif(document.querySelector(\".a-disabled.a-last\")==null){\n\t\tgotopage(document.getElementsByClassName(\"a-last\")[0].childNodes[0].href);\n\t\t//document.getElementsByClassName(\"a-last\")[0].childNodes[0].click();\n\t}\n}", "title": "" }, { "docid": "32929b5d0210878924385af2509ba63c", "score": "0.6722056", "text": "onImgNextClick() {\n\n if (this.props.pager._pageIndex < this.getPageCount() - 1) {\n this.props.pager._pageIndex++;\n this.onPageChanged();\n }\n\n }", "title": "" }, { "docid": "d36a636690488bc0e1042d812473cb3a", "score": "0.6718168", "text": "function next(){\n currentPage++;\n\n disableButton();\n //console.log(currentPage);\n initializePlayer();\n PageRender(currentPage);\n stopPlay();\n}", "title": "" }, { "docid": "39d8cfdb4ea30a9d17a40932c862ac84", "score": "0.669533", "text": "function next_page() {\n if (state.has_next) {\n state.page++;\n state.images_loaded = false;\n load_images();\n }\n }", "title": "" }, { "docid": "cc8df02ebde1e5bac17c88d6905c74b4", "score": "0.669299", "text": "_handleNextPress(nextRoute) {\n // add nextRoute, and go to that page view\n this.props.navigator.push(nextRoute);\n }", "title": "" }, { "docid": "de53bfe886e7fb0dde0f8d0c863a3ea3", "score": "0.66872036", "text": "function next() {\n click(engine.next());\n }", "title": "" }, { "docid": "d550b210fd324781d077bf7692d27ed5", "score": "0.667761", "text": "function moveNext() {\n var lastPage = getLastPage();\n\n if (currentPage + 1 >= lastPage) {\n showFinalScore();\n return false;\n }\n\n currentPage += 1;\n\n document.getElementById(\"button-next\").className = \"test-button hidden\";\n document.getElementById(\"button-reveal\").className = \"test-button\";\n document.getElementById(\"test-header\").innerHTML = \"Page \" + (currentPage + 1) + \"/\" + lastPage;\n\n setQuestions(false);\n // this prevents page to reload\n return false;\n}", "title": "" }, { "docid": "e4425fd4c3a71cdab2dcab3e759f4a35", "score": "0.6670915", "text": "nextPage() {\n if (!this.hasNextPage()) {\n return;\n }\n const previousPageIndex = this.pageIndex;\n this.pageIndex++;\n this._emitPageEvent(previousPageIndex);\n }", "title": "" }, { "docid": "9cf7f36fe55d40677a38460a6c0ac06d", "score": "0.66703093", "text": "function goForwardToNextPanel() {\n if (validate(currentTab)) {\n // make sure the current tab isn't less than zero or greater than the section count \n if (currentTab >= 0 && currentTab < sectionCount - 1) {\n displayPageAsEdit(\"next\");\n return;\n }\n // if the current tab equals the section count we need to display page as preview\n if (currentTab === sectionCount - 1) {\n displayPageAsPreview();\n }\n }\n}", "title": "" }, { "docid": "22846c5d6a051d2df4fd0cc4e960f2ee", "score": "0.6661514", "text": "function navigatePage(e) {\n scrollDir = \"down\";\n sectionActive = e.target.dataset.page - 1; //trick sectionshandler\n liAddActiveClass(e.target.dataset.page);\n portToggleAllowScroll(true);\n portToggleAllowSlider(false);\n sectionsHandler();\n toggleBurgerMenu();\n}", "title": "" }, { "docid": "dbeb63a4ce159ea7b4ef595dad5d0f2a", "score": "0.6651323", "text": "function nextPage() {\n $(\"#next\").on(\"click\", function (e) {\n e.preventDefault();\n page++;\n loadRestaurantData();\n $(\"#page\").html(page);\n $(\"#previous\").removeClass(\"disabled\");\n });\n}", "title": "" }, { "docid": "37ba709fe867d1c86deb4259330f0ab0", "score": "0.66410226", "text": "function loadNextPage(event)\n {\n event.preventDefault();\n \n currentPage++;\n \n var newurl = window.location.protocol + \"//\" + window.location.host + window.location.pathname + '?page=' + currentPage;\n window.history.pushState({path:newurl},'',newurl);\n \n loadCurrentPage();\n }", "title": "" }, { "docid": "b2b8d260507b987e6abcec6b2c9e3235", "score": "0.6630094", "text": "function nextPage() {\n\tif (currPage + 1 < serverReturn.length) {\n\t\t//Remove left bar selection\n\t\t$(\".liSelected\").removeClass(\"liSelected\");\n\t\t\n\t\t//Hide top page\n\t\t$(\"#content\" + currPage).fadeOut(400);\n\t\t\n\t\t//Add new left bar selection\n\t\tcurrPage++;\n\t\t$(\"#li\" + currPage).css(\"display\", \"block\");\n\t\t$(\"#li\"+currPage).addClass(\"liSelected\");\n\t\t\n\t\t//Log and send\n\t\tsendRequest();\n\t}\n}", "title": "" }, { "docid": "ae0370d592c6e4af4cb24b967cab4657", "score": "0.66240376", "text": "nextPage() {\n console.log(\"forward\");\n if (this.page != 8) {\n this.page += 1;\n this.getData();\n }\n this.pageNumberText.innerHTML = this.page;\n }", "title": "" }, { "docid": "7e6c5c59ac8789cf63463594bf92cf45", "score": "0.66164243", "text": "function showNext(){\r\n\tif (CUR_PAGE == MAX_PAGES) {\r\n\t\tCUR_PAGE = 0;\r\n\t} else {\r\n\t\tCUR_PAGE += 1;\r\n\t}\r\n}", "title": "" }, { "docid": "53285343f2f7de8571ec5c77383b40d4", "score": "0.6604552", "text": "function nextPage() {\r\n\tif ( nextIndexPageUrl) document.location=nextIndexPageUrl;\r\n\ttakenAction = false;\r\n}", "title": "" }, { "docid": "1acb8be42542ad722db5210badd77513", "score": "0.6599105", "text": "nextPage() {\n this.service.nextPage()\n }", "title": "" }, { "docid": "5cf36fe0d9fec9539c0fc2c749b05aca", "score": "0.6595515", "text": "function getNextPage(nextPgTkn){\n $('nav').on('click', '#next', event => {\n getVidSearchFromYtAPI(nextPgToken, currentKeyword,displayYoutubeSearchData);\n });\n}", "title": "" }, { "docid": "10e0e54e74109078273396701bbf10ab", "score": "0.65950096", "text": "function showNextSlide() {\n showSlide(currentSlide + 1);\n }", "title": "" }, { "docid": "b192c94bc4c5815c178a55184433e50b", "score": "0.6589549", "text": "function nextPageLoad() {\n nextPage.onclick = function() {\n currentPage++;\n this.href=\"?page=\" + currentPage + \"#feed\";\n };\n }", "title": "" }, { "docid": "d21b58b6e5de8c379c0f4caf2dc57798", "score": "0.65828085", "text": "function nextPage(){\n parent.window.loadNextPage();\n }", "title": "" }, { "docid": "ef48083cff2cc9caf77cc82ff021b557", "score": "0.65742797", "text": "function goToNextSection() {\n let nextSection = navItems[0];\n if (currentSection) {\n const currentIndex = navItems.findIndex(\n (item) => item === currentSection\n );\n nextSection = navItems[currentIndex + 1];\n }\n if (nextSection) {\n gsap.to(window, {\n duration: 0.7,\n scrollTo: { y: `#${nextSection}`, offsetY: -10 },\n });\n }\n }", "title": "" }, { "docid": "1c2c51873f8953c3461b8316f070878f", "score": "0.6566859", "text": "function openNextPage() {\n const pageNum = getPageNumber(\"N\"); // next page to open\n openPage(pageNum); // open the next page\n // startingPage = parseInt(firstPage.textContent) + 1;\n if (activePage === lastPage) {\n startingPage = parseInt(firstPage.textContent) + 1;\n removeNavigators();\n createPagesNavigator(maxPagesToCreate);\n // if the very last of show pages is reached, remove the unnecessary page navigators\n shiftPages(\"L\"); // shift pages to the left\n }\n}", "title": "" }, { "docid": "7656377b750e9f2016bc5807617d9b82", "score": "0.65646684", "text": "function nextStep()\n {\n if ( isLastStep() )\n {\n return;\n }\n\n vm.selectedIndex++;\n }", "title": "" }, { "docid": "fb9d41909c708b6d6f8efe977c36ada0", "score": "0.6563611", "text": "async nextPage() {\n this.start = Math.min(this.getLastStart(), this.start + this.num);\n }", "title": "" }, { "docid": "17e3ec5825ebff23afb4d3d17f22727f", "score": "0.6548478", "text": "function nextSlide() {\n\n var length = slides.length,\n new_current = index + 1;\n\n if (new_current === length) {\n new_current = 0;\n }\n\n announceSlide = true;\n\n // If we advance to the next slide, the previous needs to be\n // visible to the user, so the third parameter is 'prev', not\n // next.\n setSlides(new_current, false, 'prev');\n\n // If the carousel is animated, advance to the next\n // slide after 5s\n if (settings.animate) {\n clearTimeout(timer);\n timer = setTimeout(nextSlide, settings.pause);\n }\n }", "title": "" }, { "docid": "32317db3cca5548f9421ef0ddbd1352f", "score": "0.65472764", "text": "function nextSlide() {\n currentSlide = currentSlide + 1;\n showSlide(currentSlide);\n}", "title": "" }, { "docid": "31cdba41c0fc3785e3a9da8862dc235a", "score": "0.6545653", "text": "function onNextPage() {\n if (pageNum >= pdfDoc.numPages) {\n pageNum = 1;\n }\n else{\n pageNum++;\n }\n queueRenderPage(pageNum);\n}", "title": "" }, { "docid": "b25d4f56d073403d2bae0d75d8532b7b", "score": "0.65452904", "text": "function gotoNextStep()\n {\n var stepNumber = vm.currentStepNumber + 1;\n\n // Test the following steps and make sure we\n // will land to the one that is not hidden\n for ( var s = stepNumber; s <= vm.steps.length; s++ )\n {\n if ( !isStepHidden(s) )\n {\n stepNumber = s;\n break;\n }\n }\n\n vm.setCurrentStep(stepNumber);\n }", "title": "" }, { "docid": "c8ea5df98bb8abd21fc42e91b3a57ce0", "score": "0.653555", "text": "function moveRight() {\n if (currentPage != lastPage) {\n document.getElementById(`${Number(currentPage) + 1}`).click();\n }\n}", "title": "" }, { "docid": "c79aeb4b50f3dc127623acfdafe36ed7", "score": "0.653124", "text": "function nextPage() {\n const goNextPage = (Number(page) + 1).toString();\n setPage(goNextPage);\n submitSearch();\n }", "title": "" }, { "docid": "5b61855d9bf1bd420778dc7de44f6250", "score": "0.6512137", "text": "function next() {\n currentSlide().removeClass(\"js-show\");\n resetSlide();\n slideNumber += 1;\n currentSlide().addClass(\"js-show\");\n console.log(\"slide # \" + slideNumber);\n captureSlide();\n selectInput();\n\n \n }", "title": "" }, { "docid": "a082b69935683c5d46b73e7d5630d756", "score": "0.65077037", "text": "nextpage(event) {\n this.setIndexToSliceArray(event.detail.firstUnitIndex, event.detail.lastUnitIndex);\n while (this.contentItemsContainer.hasChildNodes()) {\n this.contentItemsContainer.removeChild(this.contentItemsContainer.firstChild);\n }\n this.setContentItemGrid();\n }", "title": "" }, { "docid": "5f1717f90e3c8022a3d4699455aa571c", "score": "0.6503006", "text": "function showNextSlide(){\n _currentSlide++;\n showSlide()\n\n }", "title": "" }, { "docid": "d5cca01da4455de77fd3d87e067f1b5a", "score": "0.650093", "text": "goToNextPage() {\n\t\tlet screen = this.state.newUser\n\t\t\t? 'HermitHolesSetup'\n\t\t\t: 'Dashboard'\n\n\t\tthis.props.navigation.navigate(screen);\n\t}", "title": "" }, { "docid": "264d47687e4bcf5fdf0eb2bd69ff30f2", "score": "0.6496425", "text": "function autoAdvance()\n{\n var gonext = $('#go-next-item').attr('href');\n\n // stop after the last slide\n if (cSpot.presentation.max_seq_no == cSpot.presentation.seq_no)\n gonext = '#';\n\n if (gonext && gonext != '#') {\n console.log(\"now advancing to next item: \" + gonext);\n location.href = gonext + \"?advance=auto\";\n }\n else {\n gonext = $('#go-back').attr('href');\n if (gonext) {\n console.log(\"going back to plan details page: \" + gonext);\n location.href = gonext;\n }\n }\n}", "title": "" }, { "docid": "3627bd9c997eec591937a34302f25377", "score": "0.6491388", "text": "function nextPage() {\n\tconsole.log('Next Page function');\n\n\t$.ajax({\n\t\ttype : 'POST',\n\t\turl : 'next',\n\t\tdata : {\n\t\t\t'action' : 'next',\n\t\t},\n\t\tsuccess : function(data) {\n\t\t\tconsole.log('Done');\n\n\t\t}\n\t}\n\n\t);\n}", "title": "" }, { "docid": "6d1fe1d2e74344f9fd36201347d90a9a", "score": "0.64795315", "text": "nextHandler() {\n if((this.page<this.totalPage) && this.page !== this.totalPage){\n this.page = this.page + 1; //increase page by 1\n this.displayRecordPerPage(this.page); \n } \n }", "title": "" }, { "docid": "6d1fe1d2e74344f9fd36201347d90a9a", "score": "0.64795315", "text": "nextHandler() {\n if((this.page<this.totalPage) && this.page !== this.totalPage){\n this.page = this.page + 1; //increase page by 1\n this.displayRecordPerPage(this.page); \n } \n }", "title": "" }, { "docid": "0cec8bf886324d28dea24916b86c8be8", "score": "0.64765817", "text": "function nextPage(nextSceneObj,currentSceneObj,currentScene,firstPageOrLastPage,action)\n{\n\n var currentSceneIndex=getSceneIndex(currentScene);\n var nextStepSceneIndex=getNextStepSceneIndex(currentSceneIndex,1);\n if(currentSceneIndex==-1||nextStepSceneIndex==-2)\n return;\n\n if(firstPageOrLastPage==\"lastpage\"){ nextStepSceneIndex=0;}\n\n nextSceneObj = $(\"#\"+ j.Data[nextStepSceneIndex].Scene);\n if (firstPageOrLastPage == \"lastpage\") {//最后页\n //nextStepSceneIndex=0;\n nextSceneObj =$(\"#\"+ j.Data[nextStepSceneIndex].Scene);\n resetYranslate();\n\n\n }\n\n resetSceneAction(j.Data[nextStepSceneIndex].Scene);\n z_moveSceneAction(currentSceneObj);\n z_CurrentSceneAction(nextSceneObj);\n nextSceneObj.show();\n currentSceneObj.transition({y: -1 * wH}, ANIMATESPEED, 'linear', function () {\n //resetCurrentSceneId(action);\n z_defaultSceneAction(currentSceneObj);\n playNextScene(j.Data[nextStepSceneIndex].Scene);\n if (firstPageOrLastPage == \"lastpage\") {\n resetYranslate();\n }\n\n });\n}", "title": "" }, { "docid": "dd2956f779a9c014ecaa1906782795e6", "score": "0.6476382", "text": "onClickNext(){\n\n /**\n * from item we will go\n */\n fadeSlider.step(fadeSlider.currentItem);\n\n if (fadeSlider.currentItem == fadeSlider.itemsNumber){\n fadeSlider.currentItem = 1;\n fadeSlider.slideTo(fadeSlider.currentItem);\n }else{\n fadeSlider.currentItem++;\n fadeSlider.slideTo(fadeSlider.currentItem);\n }\n }", "title": "" }, { "docid": "181aac8365358ce70185f938baf1cd0c", "score": "0.6468765", "text": "selectNext () {\n if (this._isNavigable) {\n this.currentPanel += 1;\n }\n }", "title": "" }, { "docid": "b8b5e20f09b46d55502bac505587c059", "score": "0.6465649", "text": "pageFwd() {\n if (this.state.page < this.state.endPage) {\n this.setState({ page: this.state.page + 1 },\n () => {\n this.loadPokemonList();\n });\n }\n }", "title": "" }, { "docid": "9ca7a31aa5e23708c8cbe777efe4fed0", "score": "0.6451339", "text": "function nextPage() {\n $scope.page++;\n if ($scope.page > 100) {\n $scope.page = 1;\n }\n updateTableUser();\n }", "title": "" }, { "docid": "4c901a343376b2f32fca2d52ae69a10c", "score": "0.6451292", "text": "function loadNextPage(){\n\t\t$scope.bestiaryCreaturePager.loadNextPage(loadNextPage);\n\t}", "title": "" }, { "docid": "9298c8158553df0795c44be825edac2a", "score": "0.6445395", "text": "function onNextPage() {\n getNextPage();\n gCurrPage = getCurrentPage();\n renderBooks();\n renderPagination();\n}", "title": "" }, { "docid": "20ab7e20a077a2ca9385c61f6122d616", "score": "0.6441944", "text": "goNextPage() {\n this.params.offset = this.getNextPageOffset();\n if (!this.settings.steps) {\n this.params.page += 1;\n }\n \n return this.fetchData();\n }", "title": "" }, { "docid": "9e1e50e62d070c7aa125879a075dfb28", "score": "0.6435199", "text": "function next() {\n // check if locked\n if (isLocked) {\n console.info('Navigation is locked.');\n return false;\n }\n\n // check if gate is closed\n if (isGateClosed()) {\n return false;\n }\n\n // find next page\n targetPageId = findNextPage(currentPageId);\n\n if (!targetPageId) {\n return false;\n }\n\n // abort if `onNext` returns false\n if (\n V.Pages[currentPageId].onNext \n && V.Pages[currentPageId].onNext() === false\n ) {\n return false;\n }\n\n const parent = V.Pages[currentPageId].parent;\n // if leaving parent from its last child page, call `onNext` of parent\n if (\n parent\n && V.Pages[parent].children.indexOf(targetPageId) === -1\n && parent.onNext \n && parent.onNext() === false\n ) {\n return false;\n }\n\n // navigate to the new page\n go();\n }", "title": "" } ]
ebf2787fb07fffd865edc7149c1e7d98
get data that will be sent to the client
[ { "docid": "2a2c6abebab3f457345c5f40a75a4f43", "score": "0.0", "text": "getGameData(name) {\n let playerIndex = this.getPlayerIndexByName(name);\n\n let trickCards = {};\n \n for (let i = 0; i < this.players.length; i++) {\n trickCards[this.playerNames[i]] = this.currentTrick.getCardByPlayerIndex(i);\n }\n\n return {\n trickCards: trickCards,\n playerCards: this.players[playerIndex].getPlayerCards(),\n currentPlayerName: this.getCurrentPlayerName()\n };\n }", "title": "" } ]
[ { "docid": "e9ed52d779d0dd70e07822004812ce23", "score": "0.70201194", "text": "get data() {\n\t\treturn this.read();\n\t}", "title": "" }, { "docid": "9943fba6af301e8e8487230e53cfa518", "score": "0.6993211", "text": "function getData() {\n return this.data;\n }", "title": "" }, { "docid": "16cbb0b8f03986f577957f21968abbf3", "score": "0.6885668", "text": "function getDataToSend(){\r\n\tvar data = {};\r\n\tif (typeof prepareData == 'function'){\r\n\t\tdata = prepareData();\t// this function must be provided\r\n\t} \r\n\treturn data;\r\n}", "title": "" }, { "docid": "bde9f2f85122ad46e93a39db295cac34", "score": "0.6879248", "text": "function data() {\n return _data;\n }", "title": "" }, { "docid": "dac43833c96f42605ea7415cc83ae78a", "score": "0.6877131", "text": "function gotData(){\n \n }", "title": "" }, { "docid": "d7e71c861ec2760e86a42da2f3181360", "score": "0.6840675", "text": "getData() {\n\t\treturn this.data;\n\t}", "title": "" }, { "docid": "a92dec23cb508fb48cc661a27e4970b7", "score": "0.66595834", "text": "function _getData() {\n return _data;\n }", "title": "" }, { "docid": "0ec11a9a5f8f327d2ff1accfbe0c4fa2", "score": "0.6612108", "text": "function getData() {\n return _getData.apply(this, arguments);\n }", "title": "" }, { "docid": "b6a2bc360d0d258975dbb27ff95678e3", "score": "0.6576732", "text": "get data() {\n return this._data;\n }", "title": "" }, { "docid": "b6a2bc360d0d258975dbb27ff95678e3", "score": "0.6576732", "text": "get data() {\n return this._data;\n }", "title": "" }, { "docid": "b6a2bc360d0d258975dbb27ff95678e3", "score": "0.6576732", "text": "get data() {\n return this._data;\n }", "title": "" }, { "docid": "fc20061253b94f788d5fda412a1b3687", "score": "0.6527789", "text": "getData() {\r\n return this.data;\r\n }", "title": "" }, { "docid": "689d50788bb5c25346fa5e5b89023ad8", "score": "0.64751434", "text": "get data() {\n return this._rawData;\n }", "title": "" }, { "docid": "689d50788bb5c25346fa5e5b89023ad8", "score": "0.64751434", "text": "get data() {\n return this._rawData;\n }", "title": "" }, { "docid": "86047b4ace48419bab21ae4830540d34", "score": "0.6455485", "text": "getData() {\n return this._data;\n }", "title": "" }, { "docid": "a8d7f1bad8c5a9011a9307e69f7ea725", "score": "0.64309126", "text": "function getRequestData(request) {\n console.log(\"Inside getRequestData\");\n if (request.method == \"POST\") {\n // Read the data from the client request\n request.on(\"data\", function(data) {\n console.log(\"Inside data function\",data);\n rawReqData += data;\n console.log(\"Inside data function\",rawReqData);\n }); // end req.on()\n \n // Parse the data into JS object\n request.on(\"end\", function() {\n console.log(\"In end function\");\n requestDataJson = qs.parse(rawReqData,\"#\",\"=\");\n console.log(\"JSON Data:::::: \",requestDataJson);\n }); // end req.on()\n // TODO: Return the read data here\n } // end if\n return null;\n}", "title": "" }, { "docid": "93895805266d56033e8ff92e5a027146", "score": "0.63926816", "text": "async data() {\n const data = await this.contract.getData();\n return data;\n }", "title": "" }, { "docid": "a1ef07f117e175b69251ef1a4c729cb3", "score": "0.6333395", "text": "data () { return this._data }", "title": "" }, { "docid": "6c940702f9c195acf8d1315e725e004d", "score": "0.6311206", "text": "get data(){ \r\n\t\treturn (this.__data = this.__data || data.Data()) }", "title": "" }, { "docid": "02434df66f9cb886e09531aeb78577ab", "score": "0.630268", "text": "getData(message) {}", "title": "" }, { "docid": "24b8d606ca746edb7a10347c9c1d4b7c", "score": "0.630199", "text": "function gotData(data) {\nData = data }", "title": "" }, { "docid": "176d93b81b248cac71cad0de1c51a415", "score": "0.6265314", "text": "get data() { return this._data.value; }", "title": "" }, { "docid": "176d93b81b248cac71cad0de1c51a415", "score": "0.6265314", "text": "get data() { return this._data.value; }", "title": "" }, { "docid": "176d93b81b248cac71cad0de1c51a415", "score": "0.6265314", "text": "get data() { return this._data.value; }", "title": "" }, { "docid": "5fd34946003cc05365d104af6d3dc63a", "score": "0.6264456", "text": "getData() {\n return this.remoteMsg[RNRemoteMessage.DATA];\n }", "title": "" }, { "docid": "6648563bcd1a81077ee5aff3af3208bd", "score": "0.6231644", "text": "function gather (data) { // response 'data' callback function\n result += data;\n}", "title": "" }, { "docid": "8bdc940204ca23036d402a033c2fed75", "score": "0.62184787", "text": "get getData(){ return this.data;}", "title": "" }, { "docid": "6f7dd27e3456910f6281ab765bfebb1c", "score": "0.6204031", "text": "get userData() {}", "title": "" }, { "docid": "de1fd7aa30c04353cedcc4cf4488d9eb", "score": "0.6161763", "text": "function passOnData( response ) {\n return response.data;\n}", "title": "" }, { "docid": "73b04c78a6f40702e9a5487783adff0e", "score": "0.6157525", "text": "function recieved(data, response, master) {\n\tif(data.type == \"getHeadForBank\")\n\t\tgetHead(data.bank, response, master);\n\telse if(data.type == \"getTailForBank\")\n\t\tgetTail(data.bank, response, master);\n\telse if(data.type == \"getSucAndPred\")\n\t\tgetSucAndPred(data.bank, data.port, data.ip, response, master);\n}", "title": "" }, { "docid": "95900097c61221b65c3f2a58c79d15ff", "score": "0.6130548", "text": "function getData(response) {\n return response.data;\n }", "title": "" }, { "docid": "63e6de1458e666162f9eed5312ba570e", "score": "0.6130278", "text": "getData () {\n var output = {\n key: this.key,\n genesis: this.genesis,\n last: this.last,\n length: this.length\n }\n return output\n }", "title": "" }, { "docid": "ae846efeb92bc232e254eae8f873c88b", "score": "0.612564", "text": "request_data() {\r\n // if the text is coming from a sensor, retrieve the latest value\r\n if (\"sensor\" in this.widget) {\r\n var message = new Message(gui)\r\n message.recipient = \"controller/db\"\r\n message.command = \"GET\"\r\n message.args = this.widget[\"sensor\"]\r\n gui.sessions.register(message, {\r\n })\r\n this.send(message)\r\n }\r\n // if it is a static text, just add it to the widget\r\n else if (\"text\" in this.widget) {\r\n $(\"#\"+this.id+\"_text\").html(this.widget[\"text\"].replaceAll(\"\\n\", \"<br>\"))\r\n }\r\n }", "title": "" }, { "docid": "b4f54cd266084c48632cb372f80809cc", "score": "0.61172426", "text": "function getData() {\n source = audioCtx.createBufferSource();\n fetch(myRequest, myInit)\n .then(function (response) {\n return response.arrayBuffer();\n })\n .then(function (buffer) {\n audioCtx.decodeAudioData(buffer, function (decodedData) {\n source.buffer = decodedData;\n source.connect(audioCtx.destination);\n });\n });\n }", "title": "" }, { "docid": "fa6a1d3c0101a6e3358791fca8dddc53", "score": "0.6082275", "text": "getData(start, stop) {\n console.log(\"we are getting data\")\n this.buffer.stop();\n this.buffer.getData(start, stop);\n }", "title": "" }, { "docid": "9cf2aad08eb7d5ada1cdf780a41bf38f", "score": "0.60780984", "text": "async function recieveFromServer() {\n try {\n const result = await fetch('/api/');\n const data = await result.json();\n\n console.log(data, 'dataReceivedfromGetRoute');\n } catch (error) {\n console.error(error);\n }\n }", "title": "" }, { "docid": "fce4b06bb7e2a5576ce78995bcf18de2", "score": "0.6076467", "text": "async readWait() {\n this.notifyFromServer(\"onread\", { data: this.data });\n return this.data;\n }", "title": "" }, { "docid": "7fdc527da9cc046433f371785a8fe266", "score": "0.60628", "text": "async getWait() {\n const obj = {};\n obj[\"ad\" + this.id] = {\n stream: false,\n };\n const data = await this.sendAndReceiveJsonWait(obj, \"/response/ad/get\");\n return data;\n }", "title": "" }, { "docid": "f0530549e136b2e26ff55b3f9ff27bfc", "score": "0.60620886", "text": "async function getServerData(){\n const response = await fetch(\"/postData\");\n try{\n const jsonData = await response.json();\n return jsonData;\n }catch(error){\n console.error(error);\n }\n}", "title": "" }, { "docid": "1ab9ec7f8d39711add4624f6107cf3f7", "score": "0.6060935", "text": "getData(){\n return this.data;\n }", "title": "" }, { "docid": "72cc543823123e0dfabe77b466a6109a", "score": "0.6044212", "text": "function getData() {\n //now that we are getting data with a getter function we domt need \n //to specify as much info as we did above. to query data from the blockchain we\n //can\n contractInstance.methods.getPerson().call().then(function(res) {\n //now we call jQuery to convert our data into text and siaplay it\n $(\"#name_output\").text(res.name);\n $(\"#age_output\").text(res.age);\n $(\"#height_output\").text(res.height);\n })\n}", "title": "" }, { "docid": "5dfefd73a31b7045db954c1c8ff9c897", "score": "0.6041975", "text": "get_new_data() {\n return data\n }", "title": "" }, { "docid": "e3a950cb1a1254af1848d7cb4e608bf2", "score": "0.60405225", "text": "async getclientData(ctx,clientId) {\n \n let clientAsBytes = await ctx.stub.getState(clientId); \n if (!clientAsBytes || clientAsBytes.toString().length <= 0) {\n return({Error: \"Incorrect clientid..!\"});\n }\n else {\n let clientdata=JSON.parse(clientAsBytes.toString());\n console.log(clientdata.SignersData);\n return JSON.stringify(clientdata.SignersData);\n }\n }", "title": "" }, { "docid": "9fa7c5f195bc41489f58363443d527cb", "score": "0.6040292", "text": "getLocalData() {\n return this.data;\n }", "title": "" }, { "docid": "c469a24a353fa2888780b315bf0a2506", "score": "0.5994597", "text": "static requests(data) {\n console.log(\"dataAction\",data);\n return { \n type: this.REQUEST,\n data: data\n }\n }", "title": "" }, { "docid": "cd017998903df053a74439fdd05e2dc8", "score": "0.5993782", "text": "function data() {\n\t\treturn {\n\t\t\ttext: '',\n\t\t\tto: '/'\n\t\t};\n\t}", "title": "" }, { "docid": "ed7565aa3bf52c3f1278ff302fccfbe2", "score": "0.59864056", "text": "function requestProvinces() {\n let dataObj = {};\n socket.emit(\"getProvinces\");\n socket.on(\"receiveProvinces\", async(data) => {\n dataObj = await data;\n });\n return dataObj;\n}", "title": "" }, { "docid": "7e4f7d7366d9f817f7e20689e81bbc1b", "score": "0.5984225", "text": "function gotRawData(thedata) {\n console.log(\"gotRawData\" + thedata);\n}", "title": "" }, { "docid": "30651ddc843d509ac7b49248cc422aa6", "score": "0.59763026", "text": "function sendData (req, res){\n console.log(projectData);\n res.send(projectData);\n}", "title": "" }, { "docid": "37f41b39a1a6d5ed9dcde127de3f89ab", "score": "0.59709644", "text": "function extractData(request){\r\n\treturn request;\t\r\n}", "title": "" }, { "docid": "33eacc176a43f8ef81469d2d765ef0cc", "score": "0.5963385", "text": "function get_data() {\n var ret = {\n 'version': '2.0',\n };\n\n ['data', 'mission', 'presets', 'flight', 'package', 'loadout', 'profiles', 'deparr', 'waypoint', 'comms', 'threats', 'notes', 'download'].forEach(function(data) {\n debug(\"collecting: \" + data);\n ret[data] = window[data+\"_export\"]()\n });\n\n return ret\n}", "title": "" }, { "docid": "b849c067eaebe513db04f2e5fefd3fdc", "score": "0.59513664", "text": "get data() {\n return {\n id: this._id.toHexString(),\n username: this.username,\n email: this.email,\n }\n }", "title": "" }, { "docid": "221a2b8d0b6fb0c5feb03d5a547b03b6", "score": "0.59476167", "text": "function getDataFn(request,response) {\n if (!lightSystemDb)\n lightSystemDb = cloudantCtrl.getLightSystemDb();\n lightSystemDb.get(\"data\",function (err,res) {\n if (err){\n response.status(404).send({status:\"E\",message:\"Cannot retrieve data\"});\n return;\n }\n else{\n response.status(200).send({status:\"S\",control:res.control,streets:res.streets,lamps:res.lamps,warnings:res.warnings,\n rank:res.rank,city:res.city});\n return;\n }\n\n });\n}", "title": "" }, { "docid": "4a1cd882ec09d9c29ada88db29c14659", "score": "0.59383076", "text": "function gotData(data) {\nspaceData = data;\n}", "title": "" }, { "docid": "7743e2a34bbbdf79a23418523eb490ed", "score": "0.593232", "text": "getData(cb) {\n app.db.retrieve(`/getData`, data => {\n console.log('[DASH]: Fetch all data');\n\n // If recieving the cache data, is should be parsed first\n try {\n data = JSON.parse(data);\n } catch (err) {\n console.log('[DATA] Does not need parsing');\n }\n\n EventModel.processEventData(data.events);\n Organisation.processOrgData(data.organisations);\n Venue.processVenueData(data.venues);\n\n app.localStorageAPI.setObject('cache', data);\n\n cb();\n });\n }", "title": "" }, { "docid": "56c04d1db79cad0cefa34bb0e8c3115f", "score": "0.5915601", "text": "function getData (req) {\n let dataStart = req.url.indexOf('?') + 1\n let dataString = req.url.slice(dataStart)\n let dataArray = dataString.split('&')\n return dataArray\n}", "title": "" }, { "docid": "69546cda7b64930437732005b16a8deb", "score": "0.59147877", "text": "function getData(key) {\n return data[key]\n }", "title": "" }, { "docid": "9e9b7ea51f303b034d84f5d06911cbf7", "score": "0.5913645", "text": "async fetch() {\n return this.data;\n }", "title": "" }, { "docid": "b4711affacda7dfd1cdd6a396693cc24", "score": "0.59074974", "text": "function getData (url){\n\t\tlet request=$.get(url);\n\t\treturn request;\n\t}", "title": "" }, { "docid": "eaa149c700956fd3fe5044303e6c3c9a", "score": "0.58894676", "text": "function getdata(fid) {\n\tvar fidx = fid.pre('?');\n\tvar sh = getdata[fidx];\n\treturn getBody(sh);\n}", "title": "" }, { "docid": "1d6deb5d690ac0c786d94d65afdc9f89", "score": "0.58741796", "text": "async getclientData(ctx,notaryId) {\n \n let userAsBytes = await ctx.stub.getState(notaryId); \n if (!userAsBytes || userAsBytes.toString().length <= 0) {\n return({Error: \"Incorrect notaryId..!\"});\n }\nelse {\n let clientdata=JSON.parse(userAsBytes.toString());\n console.log(clientdata.clientdata);\n return JSON.stringify(clientdata.clientdata);\n }\n }", "title": "" }, { "docid": "e56e51b6d06e4821e1c368d8eee7fcc7", "score": "0.58614045", "text": "function clientResponse(data) {\n\t\tconsole.log(request.connection.remoteAddress + ': ' + data);\n\t\tbroadcast(request.connection.remoteAddress + ': ' + data);\n\t}", "title": "" }, { "docid": "fc885fa193c1539073c671f3f691798f", "score": "0.5853761", "text": "function getAllTravelDataFromServer() {\n\tconsole.log(\"get data finished.\");\n}", "title": "" }, { "docid": "13e25c98dfed12bfe9dc51feb868c628", "score": "0.58499897", "text": "function data(){\r\n\tfetch('http://localhost:9003/user/manager/tickets').then( \r\n\t\tfunction(response) {\r\n\t\t\t//The json() method of the Response interface takes a Response stream and reads it to completion. \r\n\t\t\t//It returns a promise which resolves with the result of parsing the body text as JSON.\r\n\t\t\treturn response.json();\r\n\t\t}, function() {\r\n\t\t\tconsole.log('Error');\r\n\t\t}\r\n\t).then(function(myJSON){\r\n\t\tconsole.log('its me here');\r\n\t\tconsole.log(myJSON);\r\n\t\tourDOMManipulation(myJSON);\r\n\t})\r\n}", "title": "" }, { "docid": "5c9a79acc3f7be03fae2e7031f39c76b", "score": "0.58469737", "text": "async inputWait() {\n const obj = {};\n obj[this.schemaBasePath()] = {\n direction: \"input\",\n stream: false,\n };\n const data = await this.sendAndReceiveJsonWait(obj, \"/response/io/get\");\n return data;\n }", "title": "" }, { "docid": "e3b639424274242dc5c257311a5e3684", "score": "0.5828301", "text": "function getDataJSON(){\n\treturn dataJSON;\n}", "title": "" }, { "docid": "dea46e953485164bf5eb73b1a4c40dcd", "score": "0.5823506", "text": "get_dataSent()\n {\n return this.liveFunc._dataSent;\n }", "title": "" }, { "docid": "752145831fda86769b4a98a00f6e1a08", "score": "0.5811111", "text": "getItem() {\n this.userService.postRequest('/api/report/get', {}, true).subscribe(res => {\n this.data = res['result'];\n console.log(this.data);\n }, err => {\n this.handleError(err);\n });\n }", "title": "" }, { "docid": "7e169266630c07ffe0bc465d8680ede3", "score": "0.58107513", "text": "get sessionData () {\n // Find the page which is our proxy for the session data; this\n // should already exist because the server immediately sends a\n // delta on this when the connection starts.\n let r = this.rawClient.transport.sessionData\n r = this.myBridge.reach(this.rawClient, this, r.id)\n this.debug('returning sessionData', r)\n return r\n }", "title": "" }, { "docid": "826f69930b07e84ba015ef8187dd9592", "score": "0.58077633", "text": "async function getToeData(){\n let toeData = [];\n\n await Axios.get(`${config.dev_server}/getToe`)\n .then((data) => {\n toeData = data.data;\n });\n \n return toeData;\n}", "title": "" }, { "docid": "a1017365989f4558e2d6858890d6f2d2", "score": "0.57871", "text": "function getData() {\n try\n {\n xhr.onerror = function(error){\n console.debug(\"<Quorator>[error] \" + error);\n };\n\n xhr.onreadystatechange = classify;\n xhr.open(\"GET\", _url);\n\n xhr.send(null);\n }\n catch(e)\n {\n console.error(\"Quorator Error: \" + e);\n }\n \n }", "title": "" }, { "docid": "740f71633545f7b4c8bd6f2b6fe34c45", "score": "0.5785776", "text": "function getData() {\r\n 'use strict';\r\n var i, len = endPoints.length;\r\n for(i = 0; i < len; i++) endPoints[i](writeData);\r\n}", "title": "" }, { "docid": "ccdbb031908d11ab6a7de4ed491fe3cf", "score": "0.5780904", "text": "getData(message) {\n return {'y': message.data };\n }", "title": "" }, { "docid": "11f53ba83cab4a09ce900d6ce61124e3", "score": "0.57624626", "text": "function getServerData() {\n // TODO\n return {\n peopleCount : 32,\n username : undefined,\n };\n}", "title": "" }, { "docid": "97ede64b4658ad7ec77e64e297e91c8c", "score": "0.5759572", "text": "function recieveData (type,value,msaId) {\n return {\n type: type,\n payload: [value,msaId]\n }\n}", "title": "" }, { "docid": "9dc0061393a1d9ec18cc5edf01c2e401", "score": "0.575787", "text": "function retrieveServerData(){\n const inlineData = document.querySelector('#inline-data').textContent;\n const parsingElement = document.createElement('textarea');\n parsingElement.innerHTML = inlineData;\n \n try {\n return JSON.parse(parsingElement.value);\n } catch (ex){\n console.log('Something went wrong parsing server data...');\n return {};\n }\n}", "title": "" }, { "docid": "538b63c7c5a2e6d381f82d609702deee", "score": "0.5751597", "text": "getRequestData () {\n\t\tif (this.useCommitHash) {\n\t\t\treturn { \n\t\t\t\tcommitHashes: [this.useCommitHash]\n\t\t\t};\n\t\t} else {\n\t\t\treturn super.getRequestData();\n\t\t}\n\t}", "title": "" }, { "docid": "68a5edd1adb4f8cbfb68ee3afe0cd66f", "score": "0.57484925", "text": "function getData () {\n\n // get sheet level data\n var values = getTidyValues ( \"sheetDetails\");\n Logger.log (\"------------slice of tidied API response from getByDataFilters-sheet\");\n Logger.log ( JSON.stringify (values).slice(0,200));\n \n // get column level data\n var values = getTidyValues ( \"municipalityColumn\");\n Logger.log (\"------------slice of tidied API response from getByDataFilters-column\");\n Logger.log ( JSON.stringify (values).slice(0,200));\n \n // get row level data\n var values = getTidyValues ( \"originalFirstAirport\")\n Logger.log (\"------------slice of tidied API response from getByDataFilters-row\");\n Logger.log ( JSON.stringify (values).slice(0,200));\n \n}", "title": "" }, { "docid": "c0e750a99db998675bf947740f3569d5", "score": "0.57469696", "text": "function getData(){\n\n\t\terror.remove();\n\n\t\tconst positionJSON = map.getBounds();\n\n\t\trequestJSON = {\n\t\t\tnorthBorder : positionJSON._northEast.lat,\n\t\t\teastBorder : positionJSON._northEast.lng,\n\t\t\tsouthBorder : positionJSON._southWest.lat,\n\t\t\twestBorder : positionJSON._southWest.lng\n\t\t}\n\n\t\tfetch('/api/foodTruckView',{\n\n\t\t\tmethod: \"POST\",\n\n\t\t\tbody:JSON.stringify(requestJSON),\n\n\t\t\theaders: {\n\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\n\t\t\t}\n\t\t})\n\t\t\t.then(function(response) { return response.json(); })\n\n\t\t\t.catch(function(e) {\n\t\t\t\tconsole.log(e.message);\n\t\t\t})\n\n\t\t\t.then(function(data) {\n\n\t\t\t\tmapLayer.clearLayers();\n\n\t\t\t\tif(data.status === 0){\n\n\t\t\t\t\tconst listOfFoodTrucks = data.listOfFoodTrucks;\n\n\t\t\t\t\tlistOfFoodTrucks.forEach(function(element){\n\n\t\t\t\t\t\tcreateMarker(element, mapLayer);\n\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if(data.status === 1) {\n\t\t\t\t\terror.setError(\"No food trucks here, please choose another location\");\n\n\t\t\t\t}\n\n\t\t\t\telse if(data.status === 2){\n\t\t\t\t\terror.setError(\"Too many food trucks please zoom in\");\n\n\t\t\t\t}\n\t\t\t\telse if(data.status === 100){\n\t\t\t\t\terror.setError(\"Something went wrong on the server, please try again\");\n\n\t\t\t\t}\n\n\t\t\t});\n\t}", "title": "" }, { "docid": "23618e3c4e9a4100eb658824ed55dcab", "score": "0.574285", "text": "getData(){\n\t \tlet nArray = {\n\t \t\t'userName': this.userName, \n\t \t\t'nombre': this.nombre, \n\t \t\t'rol': this.rol, \n\t \t\t'password': this.password\n\t \t};\n\t return nArray;\n\t}", "title": "" }, { "docid": "e7a12b91b60dfcc07483788aa5af9996", "score": "0.5738129", "text": "get data() {\n const component = this.component;\n if (component) return component.data;\n }", "title": "" }, { "docid": "8e7db62e2f3e0658634d89adc0539988", "score": "0.57377416", "text": "function responseData(response) {\n return response.data;\n }", "title": "" }, { "docid": "8e7db62e2f3e0658634d89adc0539988", "score": "0.57377416", "text": "function responseData(response) {\n return response.data;\n }", "title": "" }, { "docid": "58941b872322f9a1d3f1714efb9b7118", "score": "0.57365555", "text": "function getdata (req,res) {\n// if (projecdata!=undefined){\n\n fetch(baseUrl+`${process.env.API_KEY}&of=json&url=${projecdata.formText}&lang=en`).\n then(res=>{\n return res.json();\n \n }).then(result=>{ \n\n projecdata['data']= result\n // const r=5;\n // getdata(r,result)\n // console.log(result)\n }).then(rt=>{\n\n res.send(projecdata)\n\n }).catch(error=>{\n\n console.log('error',error) \n });\n \n\n \n\n \n\n\n\n// res.send(projecdata)\n\n \n\n// }\n\n console.log(projecdata.data)\n }", "title": "" }, { "docid": "4d79b21ddb1317c4cb29af3270250776", "score": "0.57289505", "text": "function senddata() {\t// this function sends data received from python programs to index.html via socketIO\n io.sockets.emit('current',current);\t\n io.sockets.emit('count1',count1);\n io.sockets.emit('count2',count2);\n io.sockets.emit('voltage',voltage); \n io.sockets.emit('degree1',degree1);\n io.sockets.emit('degree2',degree2);\n\t\tio.sockets.emit('charging',charging);\n\t}", "title": "" }, { "docid": "cd18ba99019e371d9b75d5c8157286eb", "score": "0.57253087", "text": "function extractData(request){\r\n\treturn request.responseText;\r\n}", "title": "" }, { "docid": "ffd5fe06b0e7662a1d7bb237fe8059be", "score": "0.57207566", "text": "function getdata() {\n if (db) {\n db.transaction(function(t) {\n t.executeSql(\"SELECT * FROM tododb\", [], data)\n });\n }\n}", "title": "" }, { "docid": "1824eaa09396f16725304c5f9557bb01", "score": "0.57171726", "text": "function requestFloorsData() {\n return {type: REQUEST_FLOOR_DATA, payload: {}};\n}", "title": "" }, { "docid": "0d3e6c85ca66d0f5a81e711ef80d51fd", "score": "0.5705668", "text": "async getData() {\n const data = await readFile(this.datafile, 'utf8');\n return JSON.parse(data).vestigingen;\n }", "title": "" }, { "docid": "7eab67448dcaaf2f8924874be5db0adb", "score": "0.57048535", "text": "function getdata(vital) {\n // perform operation e.g. GET request http.get() etc.\n var options = {\n host: 'localhost',\n port: '9000',\n path: '/' + vital,\n method: 'GET',\n };\n\n var fitbit_http = require('http');\n var get_req = fitbit_http.request(options, function(res) {\n res.setEncoding('utf8');\n var kar = \"\";\n res.on('data', function (chunk) {\n kar = kar + chunk;\n });\n res.on('end', function (chunk) {\n console.log(kar);\n //aditya\n //if (vital == heartrate)\n //logic\n //else if (vital == sleep)\n //logic\n //else if (vital == steps)\n //logic\n\n //parse the json to get the value required and then fetch threshold from db.\n //compare values and trigger appointment if needed\n if(vital == 'heartrate'){\n if(!kar.includes(\"error\")) {\n if (JSON.parse(kar)[\"activities-heart-intraday\"][\"dataset\"].length > 0) {\n notify(JSON.parse(kar)[\"activities-heart-intraday\"][\"dataset\"][0][\"value\"]);\n }\n }\n //notify(91);\n } //vital check if ends\n }\n );\n });\n get_req.end();\n}", "title": "" }, { "docid": "defd9970228671345fed2949712e3fd8", "score": "0.5699798", "text": "getdata (response) {\n let data = null;\n if (response != undefined) {\n if (response.data != undefined) {\n if (response.data.data != undefined) {\n data = response.data.data;\n }\n }\n }\n return data;\n }", "title": "" }, { "docid": "ecee9426f2b4095ab04a237850c77166", "score": "0.5695478", "text": "data(p) {\n return this._post('data', p);\n }", "title": "" }, { "docid": "645ce2141407eb15a44bb1504e961a45", "score": "0.56913155", "text": "function returnData(res){\n // selecting all elements in database\n mysql.pool.query(getALLQuery, (err, rows, fields) => {\n if (err) {\n next(err);\n return;\n }\n // sending the json \n res.json({\"rows\": rows}); \n });\n}", "title": "" }, { "docid": "1585a2ec20f682ba7d8b842f065d2b6b", "score": "0.56897575", "text": "static get data() {\n return data.cache\n }", "title": "" }, { "docid": "e2103a0c5a05243ab437f3a22b903d64", "score": "0.5687266", "text": "function getData() {\n\t\tvar pageParams = {\n\t\t\tpage: $scope.currentPage, \n\t\t\titemsPerPage: $scope.itemsPerPage,\n\t\t\taction: 'query'\n\t\t}\n\t\t\n\t\tsubmitQueryService.getPageResults(pageParams)\n\t\t.then(function(success) {\n\t\t\t$scope.endpointResult = success.result;\n\t\t} ,function (error) {\n\t\t $scope.message2 = 'There was a network error. Try again later.';\n\t\t\talert(\"failure message: \" + message2 + \"\\n\" + JSON.stringify({\n\t\t\t\tdata : error.data\n\t\t\t}));\n\t\t});\n\t}", "title": "" }, { "docid": "7417eda672d4c9696eec22abf51d75ce", "score": "0.5686379", "text": "function getRequestData(request,callback) {\n var body = \"\";\n request.on(\"data\",function(data) {\n body += String(data);\n });\n request.on(\"end\",function() {\n callback(body);\n });\n}", "title": "" }, { "docid": "b53e1f61b6f806091a9c4763f95f070f", "score": "0.5685573", "text": "getData()\n {\n return null;\n }", "title": "" }, { "docid": "d23bfd0702f04033233073637e09648b", "score": "0.5685295", "text": "getData() {\n return {\n name: this.name,\n path: this.path,\n hash: this.hash,\n };\n }", "title": "" }, { "docid": "eec22566a8190edee15704fb3cb6f420", "score": "0.56828207", "text": "static async getUserDistrokidData(username, data){\n let res = await this.request(`distrokid/${username}`, data);\n return res.response;\n }", "title": "" }, { "docid": "dad821cc6cd72f70c799f6d9a47ee041", "score": "0.56736964", "text": "request_data() {\r\n var sensor_id = this.widget[\"sensor\"]\r\n // customize the chart based on the selected timeframe\r\n var timeframe = \"last_4_hours\"\r\n if (\"group_by\" in this.widget) {\r\n if (this.widget[\"group_by\"] == \"hour\") timeframe = \"last_6_hours\"\r\n else if (this.widget[\"group_by\"] == \"day\") timeframe = \"last_6_days\"\r\n }\r\n if (\"timeframe\" in this.widget) timeframe = this.widget[\"timeframe\"]\r\n var message = new Message(gui)\r\n message.recipient = \"controller/db\"\r\n message.command = \"GET\"\r\n message.set(\"timeframe\", timeframe)\r\n // if it is the first sensor, request also range\r\n message.args = sensor_id+\"/\"+this.widget[\"group_by\"]+\"/\"+\"range\"\r\n gui.sessions.register(message, {\r\n \"sensor_id\": sensor_id,\r\n \"style\": \"columnrange\",\r\n \"label\": \"range\"\r\n })\r\n this.send(message)\r\n }", "title": "" }, { "docid": "8502a38e0629accc57b1870d5dc30975", "score": "0.56653523", "text": "getData (key) { return this.data[key] }", "title": "" } ]
1b1ca8205bcef2f33c58a73a2be21a00
function that updates the cart quantity
[ { "docid": "9fa794639de973fd05d4f4bf91aba9d5", "score": "0.0", "text": "function cartNumbers(item){\n\n let productNumb = localStorage.getItem('cartNumbers');\n\n productNumb = parseInt(productNumb);\n\n if(productNumb){\n localStorage.setItem('cartNumbers', productNumb + 1);\n document.querySelector('.cart span').textContent = productNumb + 1;\n }else {\n localStorage.setItem('cartNumbers', 1);\n document.querySelector('.cart span').textContent =1;\n }\n\n setCartItems(item);\n}", "title": "" } ]
[ { "docid": "744236f78c6512521ce1bbc39b17ade0", "score": "0.81458545", "text": "function cartIconQtyUpdate(){\n var totalQty = 0;\n if(cart.length) {\n for(var i=0; i<cart.length; i++) {\n var cartItem = cart[i];\n totalQty += cartItem.quantity;\n }\n $('.qty').html(totalQty);\n } else {\n $('.qty').html(totalQty);\n }\n}", "title": "" }, { "docid": "e9561ec6755f7cd83a37a704732e2824", "score": "0.80323344", "text": "function updateQuantity() {\n let prod = this.closest(\".cart-item\");\n let prod_cost = prod.children[2].innerText.slice(1);\n prod.children[4].innerText = `$${Number(prod_cost)*this.value}`\n\n let z = JSON.parse(localStorage.getItem(\"CartItem\"));\n arr = [];\n for (let k = 0; k < Object.keys(z).length; k++) {\n if (z[k].name == prod.children[1].innerText) {\n z[k].quantity = this.value;\n }\n arr.push(z[k]);\n }\n localStorage.setItem(\"CartItem\", JSON.stringify(arr));\n}", "title": "" }, { "docid": "7e81398df4b51cdfc4c59e9bd36dc9ea", "score": "0.7992398", "text": "function quantityChanged(event) {\n // var input = event.target;\n updateCartTotal();\n }", "title": "" }, { "docid": "89a8e9b01545d5da88a9a61394666de6", "score": "0.794521", "text": "_changeQuantity(productId) {\n const value = this.shadowRoot.querySelector('#chart_item_' + productId).value;\n\n const cartItem = this._findCartItem(productId);\n\n const index = this.cartItems.indexOf(cartItem);\n this.cartItems[index].quantity = value;\n this.cartItems = [...this.cartItems]; // this.cartItems[index] = cartItem['quantity'] + 1;\n // this.set('cartItems.' + index + '.quantity', cartItem['quantity'] + 1);\n\n localStorage.setItem('shop-cart', JSON.stringify(this.cartItems));\n this.dispatchEvent(new CustomEvent('change-cart-count', {\n bubbles: true,\n composed: true,\n detail: {}\n }));\n }", "title": "" }, { "docid": "4adb7f7b5ac6d0305a02f701caf57c3e", "score": "0.79082716", "text": "function updateShoppingCart(addQty) {\n\tvar totalItems = getTotalItemsCart() + addQty;\n\tdocument.getElementById('shopping-cart-text').innerHTML = totalItems + ' items';\n}", "title": "" }, { "docid": "dbf43076124d392f9b7b3d26ad295a9a", "score": "0.78633326", "text": "function quantityChanged(event) {\n var input = event.target\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1\n }\n var quantity = input.value\n var product_id = input.getAttribute('data-productid')\n ajaxUpdateItemCart(product_id,quantity)\n updateCartTotal()\n}", "title": "" }, { "docid": "e67e884f23dc2def4790d6aa929e70eb", "score": "0.7716817", "text": "function updateQuantity() {\n if (updating) {\n console.log(quant);\n console.log(\"Stock quantity: \" + stockQuantity);\n let newStockQuantity = stockQuantity - quant;\n console.log(\"Remaining stock: \" + quant);\n\n let updatedProduct = {\n id: productID,\n stock_quantity: newStockQuantity\n };\n console.log(updatedProduct);\n updateProducts(updatedProduct).then(function(res) {\n console.log(res);\n });\n }\n }", "title": "" }, { "docid": "cfb312066445880cf16312412bcfbb56", "score": "0.76717347", "text": "function quantityChangedMB(event) {\n var input = event.target\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1\n }\n var quantity = input.value\n var product_id = input.getAttribute('data-productid')\n ajaxUpdateItemCart(product_id,quantity)\n updateCartTotalMB()\n}", "title": "" }, { "docid": "068c3bb2028dd57346724e0eb41d928b", "score": "0.7668017", "text": "function WC_Adjust_Cart_Quantity() {\n\t \t$( 'body' ).on( 'click', '.quantity .plus', function( e ) {\n\t \t\tvar $input = $( this ).parent().parent().find( 'input' );\n\t \t\t$input.val( parseInt( $input.val() ) + 1 );\n\t \t\t$input.trigger( 'change' );\n\t \t} );\n\t \t$( 'body' ).on( 'click', '.quantity .minus', function( e ) {\n\t \t\tvar $input = $( this ).parent().parent().find( 'input' );\n\t \t\tvar value = parseInt( $input.val() ) - 1;\n\t \t\tif ( value < 1 ) {\n\t \t\t\tvalue = 1;\n\t \t\t}\n\t \t\t$input.val( value );\n\t \t\t$input.trigger( 'change' );\n\t \t} );\n\t }", "title": "" }, { "docid": "d2bdffd19e96e0a4508e9e61ab7cd68a", "score": "0.7648074", "text": "function updateCart(){\n\t\tstorage(['items', 'subtotal'], function(err, col){\n\t\t\t//console.log(\"Cart Collection - \" + JSON.stringify(col));\n\n\t\t\t//items = col[0];\n\t\t\t//subtotal = col[1];\n\n\t\t\tif(console) console.log(\"Items in Cart: \" + items);\n\t\t\tif(console) console.log(\"Subtotal of Cart: \" + subtotal);\n\t\t\t\n\t\t\t// update DOM Here\n\t\t\tdocument.getElementById( _options.itemsEleId ).innerHTML = items;\n\t\t\tdocument.getElementById( _options.subtotalEleId ).value = \"$\" + subtotal.toFixed(2);\n\n\t\t\t// reset default quantity input fields of products\n\t\t\tPRODUCTS.updateProducts();\n\t\t});\n\t}", "title": "" }, { "docid": "f7f16d805203bcca2522999be9e3e47a", "score": "0.7605625", "text": "function updateItemQuantity(itemId, itemQty){\n /* get items of cart in localStorage */\n let cartItem = JSON.parse(localStorage.getItem('cart'));\n /* update psc_item using Map */\n let newCartData = cartItem.map(item => {\n if(item.item_id == itemId){\n if(parseInt(item.item_available) < itemQty.value){\n item.pcs_item = parseInt(item.item_available);\n }else{\n item.pcs_item = parseInt(itemQty.value);\n }\n return item;\n }else{\n return item;\n }\n });\n\n /* convert newCartData to JSON string to be set in localStorage */\n localStorage.setItem('cart',JSON.stringify(newCartData));\n /* update cart Display */\n updateCartDisplay();\n}", "title": "" }, { "docid": "f5bf951bacc0e401d5abe612ce1ff5f0", "score": "0.7597133", "text": "function handleUpdate(e) {\n\tfor (let name in updatedQuantity) { // sample updatedQuantity: {usmc fitness book: \"20\", usmc pt shirt 1: \"9\"}\n\t\tcart.updateCart(name, +updatedQuantity[name])\n\t}\n\treRenderTableBody();\n\trenderCartTotal();\n}", "title": "" }, { "docid": "c32c1c7a552687becc91b06d5d2e189c", "score": "0.7590493", "text": "function currentQuantityCart() {\n\n}", "title": "" }, { "docid": "d86e3d979f7ee206649eab7c18a1bb6c", "score": "0.7536563", "text": "cartPlusOne(product) {\r\n product.quantity = product.quantity + 1;\r\n }", "title": "" }, { "docid": "bdd16a825173098fdaa8e36db2b79e45", "score": "0.7517929", "text": "function updateQuantity(item, type) {\n let indx = cart.findIndex((x) => x.name == item.name);\n let qty = qtyBtn.textContent;\n\n if (type == \"dec\") {\n if (qty > 0) {\n qty--;\n qtyBtn.textContent = qty;\n if (indx != -1) {\n cart[indx].quantity = qty;\n } else {\n let billObj = {\n name: item.name,\n price: item.price,\n quantity: qty,\n category: item.category\n };\n cart.push(billObj);\n }\n }\n if (qty == 0) {\n cart = cart.filter((item) => item.quantity != 0);\n }\n }\n\n if (type == \"inc\") {\n if (qty < 10) {\n qty++;\n qtyBtn.textContent = qty;\n if (indx != -1) {\n cart[indx].quantity = qty;\n } else {\n let billObj = {\n name: item.name,\n price: item.price,\n quantity: qty,\n category: item.category\n };\n cart.push(billObj);\n }\n }\n }\n\n updateBill();\n showCartItems();\n }", "title": "" }, { "docid": "8380788370718b9150ccc3b0cd5d9cd4", "score": "0.7486806", "text": "function updateQuantity(count, iid) {\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity - ? WHERE item_id = ?\", [count, iid], function (err, res, field) {\n promptUserEntry();\n\n });\n }", "title": "" }, { "docid": "ef1d4fa9cfb3c949bbce2b81589d8478", "score": "0.7477245", "text": "function updateQuantity(fn, variantId) {\r\n\t // var variant = product.variants.filter(function (variant) {\r\n\t // return (variant.id === variantId);\r\n\t // })[0];\r\n\t // var quantity;\r\n\t var cartLineItem = findCartItemByVariantId(variantId);\r\n\t if (cartLineItem) {\r\n\t cartLineItem.quantity = fn(cartLineItem.quantity);\r\n\t quantity = cartLineItem.quantity;\r\n\t updateVariantInCart(cartLineItem, quantity);\r\n\t }\r\n\t }", "title": "" }, { "docid": "232355b1016a4624ed6b05966d1834d0", "score": "0.7460439", "text": "updateQuantityInCart(lineItemId, quantity) {\n const state = store.getState().home.cart; // state from redux store\n const checkoutId = state.checkout.id\n const lineItemsToUpdate = [{ id: lineItemId, quantity: parseInt(quantity, 10) }]\n state.client.checkout.updateLineItems(checkoutId, lineItemsToUpdate).then(res => {\n store.dispatch({ type: 'UPDATE_QUANTITY_IN_CART', payload: { checkout: res } });\n });\n }", "title": "" }, { "docid": "8743cb39b6182140bf1cca709523f0a4", "score": "0.7455058", "text": "function increaseQuantity(id) {\n let products = getItemFromLocalStorage('productsCart');\n products.forEach((value) => {\n if (value.id == id) {\n value.quantity++;\n }\n });\n // location.reload();\n\n setItemToLocalStorage('productsCart', products);\n displayCartData();\n}", "title": "" }, { "docid": "b15bc53bd91ad1c27184131205394184", "score": "0.7453778", "text": "function UpdateCart() {\n\n // get current text displaying for cart\n\tvar cart_num = parseInt(document.getElementById('cart_number').innerText);\n\n\t// get value from quantity drop down menu\n\tvar qty1 = document.getElementById('qty1').value;\n\tqty1 = parseInt(qty1);\n\t//console.log(qty1);\n\n\t// Add quantity selected to the total & update total\n\titem_number += qty1;\n\tcart_num = item_number;\n\tdocument.getElementById('cart_number').innerText = cart_num;\n // console.log(cart_num);\n //console.log(cart_num);\n\n window.localStorage.setItem('cart_count', JSON.stringify(cart_num));\n\n}", "title": "" }, { "docid": "cb4b38e69db13cf792a8167167e0bbb4", "score": "0.74492306", "text": "function plusQtty(i) {\n\n cart[i].qtty++;\n document.getElementsByClassName(\"cart-quantity\")[i].innerHTML = cart[i].qtty;\n\n /* Update total items in the cart*/\n totalShoppingItems++;\n document.getElementById(\"total-qtty\").innerHTML = totalShoppingItems;\n}", "title": "" }, { "docid": "13856f58c4c24877cfc0341d7e7efa35", "score": "0.74351436", "text": "function quantityChanged(event){\n\tvar input = event.target;\n\tif (isNaN(input.value) || input.value <= 0) {\n\t\tinput.value = 1;\n\t}\n\tupdateCartTotal();\n}", "title": "" }, { "docid": "fc8e71f92a2c302e32bc9c36aa5bab78", "score": "0.7429111", "text": "function updateQuantity() {\n var query = connection.query(\n \"UPDATE products SET ? WHERE ?\",\n [\n {\n stock_quantity: updatedStock\n },\n {\n item_id: answer.userId\n }\n ],\n );\n }", "title": "" }, { "docid": "38b8f9bf7be2c787ce8e8db8dc91b357", "score": "0.7423985", "text": "function updateItemQuantity(productId, quantity) {\n $.ajax({\n url: updateUri,\n type: \"POST\",\n data: { ProductId: productId, Quantity: quantity }\n });\n }", "title": "" }, { "docid": "45d7f1147586a17edcba263dc7499ef2", "score": "0.7349235", "text": "function updateQuantity() {\n\n // Query to update the item's quantity based on the item ID\n var queryTerms = \"UPDATE products SET ? WHERE ?\";\n var newQuantityOnHand = quantityOnHand - purchaseQuantity;\n \n connection.query(queryTerms,\n [\n {stock_quantity: newQuantityOnHand},\n {item_id: itemID}\n ], function(err, result) {\n if (err) throw err;\n }); \n\n // After that update is done, we need to update the total sales column\n updateTotalSales();\n} // End updateQuantity function", "title": "" }, { "docid": "7e34e8d9e4f5a9dd8ae8fede173896c3", "score": "0.7336634", "text": "_incrementQuantity(evt) {\n console.log('_incrementQuantity');\n const productId = evt.currentTarget.dataset['product'];\n\n const cartItem = this._findCartItem(productId);\n\n const index = this.cartItems.indexOf(cartItem);\n this.cartItems[index].quantity = cartItem['quantity'] + 1;\n this.cartItems = [...this.cartItems]; // this.cartItems[index] = cartItem['quantity'] + 1;\n // this.set('cartItems.' + index + '.quantity', cartItem['quantity'] + 1);\n\n localStorage.setItem('shop-cart', JSON.stringify(this.cartItems));\n this.dispatchEvent(new CustomEvent('change-cart-count', {\n bubbles: true,\n composed: true,\n detail: {}\n }));\n }", "title": "" }, { "docid": "dc855c50578b9a70df2bb64f2159720d", "score": "0.73340034", "text": "function increaseCartNum() {\n setCartNum(cartNum+1);\n }", "title": "" }, { "docid": "bd4eb4428358c742b67ffad33d746fcc", "score": "0.73168546", "text": "function change_quantity_in_cart(itemid,mode){\n if(mode==1){\n cart_info[itemid].cart_item.quantity+=1;\n cart_info[itemid].cart_div.find(\".cart-item-quantity\")[0].value=cart_info[itemid].cart_item.quantity;\n }else if(mode==0){\n $(cart_info[itemid].cart_div).remove();\n delete cart_info[itemid]; \n }else if(mode==-1){\n if(cart_info[itemid].cart_item.quantity==1){\n return;\n }\n cart_info[itemid].cart_item.quantity-=1;\n cart_info[itemid].cart_div.find(\".cart-item-quantity\")[0].value=cart_info[itemid].cart_item.quantity;\n }\n \n}", "title": "" }, { "docid": "d903ac0c36d62d0839063dc685b2ff85", "score": "0.7312303", "text": "function updateCounter() {\n var itemCountEl = document.getElementById('itemCount');\n var add = 0;\n\n for (var i =0; i < cart.items.length; i++) {\n add += cart.items[i].quantity;\n }\n itemCountEl.textContent = add;\n}", "title": "" }, { "docid": "011213da36a6ea827f40b03a3a9ac2d5", "score": "0.7309197", "text": "function changeQuantity(element) {\n current_value = $(element).val();\n product_id = $(element).data('id');\n \n let total_price = 0;\n if (current_value <= 0) {\n current_value = $(element).val(1)\n alert('Invalid Quamtity value');\n }\n \n products[product_id] = current_value;\n localStorage.setItem('cart', JSON.stringify(products));\n \n for(var key in price_per_item) {\n total_price += getPricePerProductQuantity(key, price_per_item[key])\n }\n $('#total_price').text(total_price);\n }", "title": "" }, { "docid": "1d9a9b452666be8953e6753a1e98f72a", "score": "0.7302014", "text": "quantityChanged (product) {\n this.productQuantities[product.id] = product.quantity;\n this.cookieFactory.saveJSON(ShoppingCart.PRODUCTS_COOKIE, this.productQuantities);\n\n this.calculateTotals();\n }", "title": "" }, { "docid": "bbb537a1e200d900d875c7995f0bad0c", "score": "0.7293012", "text": "function updateQuantity(stock_qty, id, qty)\n {\n \n connection.query(\"UPDATE products SET stock_quantity = \"+ qty + \" WHERE item_id = \"+id,\n function(err, res2) \n {\n if (err) throw err;\n console.log(\"Updated stock inventory quantity: \" +qty);\n connection.end();\n });\n }", "title": "" }, { "docid": "d9f43a0fc77171b45c63770e83cae670", "score": "0.7268925", "text": "function quantityChanged(event) {\n var input = event.target;\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1;\n }\n updateCartTotals();\n}", "title": "" }, { "docid": "7ba34f562d257d13ee8985a3a26dc4b4", "score": "0.7266288", "text": "function quantityChanged(event) {\r\n var input = event.target;\r\n if (isNaN(input.value) || input.value <= 0) {\r\n input.value = 1;\r\n }\r\n updateCartTotal();\r\n }", "title": "" }, { "docid": "29f8f493ab2baa383265a4e12fd39f18", "score": "0.72653687", "text": "function changeQuantity(itemId, change) {\n let cartItem = localStorage.getItem('cartItems');\n if (cartItem) {\n let cartItemArray = JSON.parse(cartItem);\n let productIndex = cartItemArray.findIndex(item => {\n return item.id === itemId;\n });\n if (change === 'add') {\n cartItemArray[productIndex].quantity += 1;\n } else {\n if (cartItemArray[productIndex].quantity > 1) {\n cartItemArray[productIndex].quantity -= 1;\n }\n }\n cartItemArray[productIndex].discount = calculateDiscounts(cartItemArray[productIndex].quantity);\n let total = cartItemArray[productIndex].price * cartItemArray[productIndex].quantity;\n cartItemArray[productIndex].total = parseFloat(total.toFixed(2));\n let discountedTotal = total - cartItemArray[productIndex].discount;\n cartItemArray[productIndex].discountedTotal = parseFloat(discountedTotal.toFixed(2));\n localStorage.setItem('cartItems', JSON.stringify(cartItemArray));\n sendItemsToCartUI(cartItemArray);\n grandTotals(cartItemArray);\n }\n\n}", "title": "" }, { "docid": "3337405daa2ec3a3254a01cfd1af7045", "score": "0.72635084", "text": "function updateCartTotal() {\n var cartItemContainer = document.getElementsByClassName(\"cart-body\")[0];\n var cartRows = cartItemContainer.getElementsByClassName(\"cart-item\");\n var total = 0;\n for (var i = 0; i < cartRows.length; i++) {\n var cartRow = cartRows[i];\n var priceElement = cartRow.getElementsByClassName(\"cart-item-price\")[0];\n var quantityElement = cartRow.getElementsByClassName(\n \"ItemCounterCart2\"\n )[0];\n var price = parseFloat(priceElement.innerText.replace(\"$\", \"\"));\n var quantity = parseInt(quantityElement.value);\n var total1 = price * quantity;\n total = total + total1;\n total = Math.round(total * 100) / 100;\n }\n document.getElementsByClassName(\"subtotal3\")[0].innerText = \"$\" + total;\n }", "title": "" }, { "docid": "a081384c44ea1346e5a45b66c64dfe2c", "score": "0.7256597", "text": "function updateCart(e) {\n event.preventDefault();\n var selectedProduct = e.target.productToPurchase.value;\n var selectedQuantity = e.target.quantityInCart.value;\n\n console.log(selectedProduct);\n console.log(selectedQuantity);\n\n // ++ to the timesClicked property for image user click on\n for(var i in Product.allProducts){\n if(selectedProduct === Product.allProducts[i].name){\n Product.allProducts[i].quantityInCart = selectedQuantity;\n console.log(Product.allProducts[i]);\n }\n }\n localStorage.setItem('shoppingCart', JSON.stringify(Product.allProducts));\n}", "title": "" }, { "docid": "bfb4a9ff0d978138d6c94b4ffe80b27c", "score": "0.72550505", "text": "function updateQuantity(id, newQuantity) {\n\n var basket = JSON.parse(localStorage.BASKET);\n // loop through products in basket\n for (var i = 0; i < basket.length; i++) {\n\n var basketProduct = JSON.parse(basket[i]);\n\n // if the product is already in the basket, add the new quantity\n if (basketProduct.productID == id) {\n basketProduct.quantity = newQuantity;\n basket[i] = JSON.stringify(basketProduct);\n }\n }\n // updates the basket\n localStorage.BASKET = JSON.stringify(basket);\n ajaxGet('inc/basket.php', loadBasket);\n updateBasketCost();\n}", "title": "" }, { "docid": "2bb51aeeca2f13bd9d4e818f1c409fa2", "score": "0.7253897", "text": "function increment_qty( item_id )\n{\n\tvar qty = $('#item_' + item_id + '_qty').val();\n\t$.ajax({\n type: \"POST\",\n url: base_url + \"purchase/update_cart_item\",\n data: { qty: parseInt(qty)+1, item_id: item_id },\n success: function( data ){\n \tif ( data == 1 )\n \t{\n \t\t$('#item_' + item_id + '_qty').val( parseInt(qty)+1 );\n \t\tvar price = $( '#item_' + item_id + '_price' ).text();\n \t\tvar total = ( parseInt( qty ) + 1 ) * price;\n \t\t$( '#item_' + item_id + '_total' ).text( total );\n \t}\n }\n });\n}", "title": "" }, { "docid": "30b610f1b8dc0a5637efb66bbfbe9738", "score": "0.7242148", "text": "function updateItemQuantity(id) {\n\t$('#qty_'+id).val( function(i, oldval) {\n \treturn parseInt( oldval, 10) + 1;\n\t});\t\t\n}", "title": "" }, { "docid": "2cfc6c1216cf721fea738665312efe59", "score": "0.72369534", "text": "onUpdateCartItemQuantity() {\n let itemName = this.props.foodItem.food_name;\n\n store.dispatch(\n updateQuantity(\n this.props.foodItem.food_id,\n this.cartQuantity.current.value\n )\n );\n this.setState({\n cartQuantity: this.cartQuantity.current.value,\n });\n }", "title": "" }, { "docid": "81f721d07014a576d1322aecfd1855b9", "score": "0.72345656", "text": "function quantityChanged(event){\n const input = event.target;\n input.value <= 0 ? (input.value = 1) : null;\n\n //actualizamos precio//\n updateShoppingCartTotal();\n}", "title": "" }, { "docid": "cf9907f5664beadf68cbb9bf8d7ef83c", "score": "0.72336704", "text": "function updateCartTotal() {\n //Get all the items in the cart with the class name cart-item-row\n let cartItemRows = document.getElementsByClassName(\"cart-item-row\");\n\n let total = 0;\n // For each item in the cart, run a loop that gets the quantity input and price of the item. Add all of them to the total amount in the cart. \n for (let i = 0; i < cartItemRows.length;i++){\n let cartItemRow = cartItemRows[i];\n let priceItem = cartItemRow.getElementsByClassName('cart-item-price')[0];\n let quantityItem = cartItemRow.getElementsByClassName('cart-quantity-input')[0];\n let price= parseFloat(priceItem.innerText.replace('R',''));\n let quantity = quantityItem.value;\n //increment the total amount in the cart by the price and quantity of each item in the cart. \n total = total + (price * quantity)\n \n }\n document.getElementsByClassName('cart-total-amount')[0].innerText = \"Total Amount: R\"+ total;\n }", "title": "" }, { "docid": "f416dc8da8e259f15064b8b79b7d2d52", "score": "0.72336215", "text": "function updateQuantityToStorage(self) {\r\n\r\n // Create and get various elements\r\n var cartItem = self.parentElement.parentElement.parentElement.parentElement; // The clicked cart item\r\n var itemName = cartItem.querySelector('.cart-item-name').textContent; // The name of the item\r\n var itemQuantity = parseInt(self.value); // The new item quantity it should be\r\n var itemPrice, itemImgSrc, itemHref, itemDesc; // Declare other item details to be used when updating the new item\r\n\r\n // Get current session storage\r\n var cartContents = JSON.parse(sessionStorage.getItem('cart-contents'));\r\n cartContents.forEach(item => {\r\n var arr = Object.entries(item);\r\n arr.forEach(el => {\r\n // Find the item name inside session storage\r\n if (el[0] == 'name' && el[1] == itemName) {\r\n // Get position of item in cart list\r\n index = cartContents.indexOf(item);\r\n\r\n // Get other details of the same item\r\n arr.forEach(el2 => {\r\n if (el2[0] == 'price') { itemPrice = el2[1] }\r\n if (el2[0] == 'imgsrc') { itemImgSrc = el2[1] }\r\n if (el2[0] == 'href') { itemHref = el2[1] }\r\n if (el2[0] == 'desc') { itemDesc = el2[1] }\r\n });\r\n\r\n // Replace the original item with the new updated item\r\n cartContents[index] = { name: itemName, price: itemPrice, quantity: itemQuantity, imgsrc: itemImgSrc, href: itemHref, desc: itemDesc }\r\n\r\n // Update the new item to session storage\r\n sessionStorage.setItem('cart-contents', JSON.stringify(cartContents));\r\n }\r\n });\r\n });\r\n\r\n}", "title": "" }, { "docid": "6bb6f235a58039d4caab4f8c12874b5d", "score": "0.722973", "text": "function updateProductQuantity(quantity, item_id) {\n var query = \"UPDATE products SET stock_quantity = ? WHERE item_id = ?\";\n connection.query(query, [quantity, item_id], function(err, item) {\n if(err) throw err;\n });\n }", "title": "" }, { "docid": "267a91a91e3edbf9f1a4476f0426508f", "score": "0.7229327", "text": "function updatecart() {\r\n //initialize the total variable with 0 (if we don't initialize it our cart will show NaN since it has no value at all)\r\n var total = 0\r\n //we get the value from the quantity input box and we check if it the user gave an input <= than 0 or not given an input at all. If this happened then >>\r\n // we set the value to 1 (there is no point in having a negative or zero or undefined quantity... it will also cause trouble in calculating the total price)\r\n var input = event.target\r\n if (input.value <= 0 || input.value == NaN) {\r\n input.value = 1\r\n }\r\n //cartitem_all gets the element of our shopping cart containing all cart items\r\n var cartitem_all = document.getElementsByClassName('cart-items')[0]\r\n // rows11 gets a list of all the cart rows where each row is a package we have in our shopping cart with all its data \r\n var rows11 = cartitem_all.getElementsByClassName('cart-row')\r\n // we create a loop that goes through every package in our cart (if existing) and executes the commands in {}\r\n for (var i = 0; i < rows11.length; i++) {\r\n // in cartRow we save the package element that we are processing in each time the loop runs\r\n var cartRow = rows11[i]\r\n // we get the price of that package and save it into \"priceElement\"\r\n var priceElement = cartRow.getElementsByClassName('cart-price')[0]\r\n // we get the quantity of that package and save it into \"quantityElement\" NOTE: Here we use [1] since when creating the element we have used the class >>\r\n // \"cart-quantity-input\" 2 times one for styling. So we need to call the 2nd one which is having the actual value\r\n var quantityElement = cartRow.getElementsByClassName('cart-quantity-input')[1]\r\n // we change the type of \"price\" from string to float so we can use it in a math equation. HOWEVER >>\r\n // Before doing so we replace the euro sign with nothing (we remove it) from our variable since we want only the number that makes sense for math equations\r\n var price = parseFloat(priceElement.innerText.replace('€', ''))\r\n // we get the value part of the quantityElement since it is the one containing the number value and we save it in \"quantity\"\r\n var quantity = quantityElement.value\r\n // this is an obvious math equation to calculate the total price. Note that we +total at the beginning since this is in a loop running for each package in the cart\r\n total = total + (price * quantity)\r\n }\r\n // we use the Math.round to avoid having numbers with too many decimals coming from a multiplication. We set them to be with only 2 decimals rounded which >>\r\n // make sense when talking about money\r\n total = Math.round(total * 100) / 100\r\n // we get the \"cart-total-price\" element and we write inside it the euro sign and the number which is rounded to 2 decimals to be displayed in out total price section\r\n document.getElementsByClassName('cart-total-price')[0].innerText = '€' + total\r\n}", "title": "" }, { "docid": "8e82fb8764df384694e63c82c6bbd0fe", "score": "0.7221423", "text": "function handleQuantityChange (input) {\r\n // make sure the minimum value is 1\r\n if (input.value < 1) input.value = 1\r\n // make sure the maximum value is 10\r\n if (input.value > 10) input.value = 10\r\n\r\n // get the id(index of item with the modified quantity)\r\n const id = input.id[input.id.length - 1]\r\n // get price element using the id and retrive the price\r\n const priceEl = document.getElementById('price' + id)\r\n let price = priceEl.innerHTML\r\n price = price.substring(1).split(' ').join('') // remove any spaces from the text\r\n price = eval(price + '*' + input.value) // multiply the price by the new quantity value (input)\r\n price = price.toFixed(2) // fix it to 2 decimal places\r\n\r\n // get the price-tag element based on the id and update the price with the new price\r\n const priceTag = document.getElementById('pricetag' + id)\r\n priceTag.innerHTML = String(price)\r\n\r\n // re-calculate the cart total\r\n getCartTotal()\r\n}", "title": "" }, { "docid": "64e7bca0f261ace1eb20614d585338f2", "score": "0.7214532", "text": "function addQuantity(product, quantity) {\n connection.query(\n \"UPDATE products SET stock_quantity = ? WHERE item_id = ?\",\n [product.stock_quantity + quantity, product.item_id],\n function(err, res) {\n // Let the user know the purchase was successful, re-run loadProducts\n console.log(\"\\nSuccessfully added \" + quantity + \" \" + product.product_name + \"'s!\\n\");\n loadManagerMenu();\n }\n );\n}", "title": "" }, { "docid": "118913ba974aa9c85e0b79b7819c73ca", "score": "0.721062", "text": "function quantityChangedplus(event) {\r\n var purchaseClicked = event.target\r\n purchaseClicked.previousElementSibling.value = Number(purchaseClicked.previousElementSibling.value) + 1\r\n updateCartTotal()\r\n}", "title": "" }, { "docid": "f5fd8f27c700d97e2afdc4b6d813d17f", "score": "0.72024095", "text": "function cartQuantity(items, action) {\n\n let cartNumber = localStorage.getItem(\"cartQuantity\");\n cartNumber = parseInt(cartNumber);\n let cartProduct = localStorage.getItem(\"coffeeInCart\");\n cartProduct = JSON.parse(cartProduct);\n\n if (action == \"decrement\") {\n localStorage.setItem(\"cartQuantity\", cartNumber - 1);\n document.querySelector(\".cart-number\").textContent = cartNumber - 1;\n } else if (cartNumber) {\n localStorage.setItem(\"cartQuantity\", cartNumber + 1);\n document.querySelector(\".cart-number\").textContent = cartNumber + 1;\n } else {\n localStorage.setItem(\"cartQuantity\", 1);\n document.querySelector(\".cart-number\").textContent = 1;\n }\n setCoffeeProducts(items);\n}", "title": "" }, { "docid": "5921b82da09af66709fd3135acbe109d", "score": "0.7200417", "text": "function updateQuantityDisplay(item){\n var itemDiv = document.getElementById(\"cart-item-\"+item.name);\n var input = itemDiv.querySelector(\".quantity-input\");\n var totalPrice = itemDiv.querySelector(\".total-price\")\n input.value = item.quantity;\n totalPrice.innerHTML = (input.value*item.price).toFixed(2)\n}", "title": "" }, { "docid": "f2d3a1cfe933918e7cbd8d44996c8e20", "score": "0.71940863", "text": "function quantityChanged(event) {\n const input = event.target\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1\n }\n updateCartTotal()\n}", "title": "" }, { "docid": "83d8c51aa3ecd472e3ff0c83b8de20b2", "score": "0.7191905", "text": "function change_product_quantity(product_id, qty)\n{\n\t//Save new quantity into the product in order_list \n\tif (product_id in order_list)\n\t{\n\t\torder_list[product_id].quantity = qty;\n\t\trecalculate_moqioq_flag(product_id);\n\t\t//Redraw\n\t\tredraw_order_list();\n\t}\n}", "title": "" }, { "docid": "2812105d54d7c64c1794d88b2ede91f7", "score": "0.7183891", "text": "function updateCartCounter() {\n\tlet storedCart = JSON.parse(localStorage.getItem('cart'));\n\tlet counter = 0;\n\tif (storedCart === null) {\n\t\tcounter = 0;\n\t} else {\n\t\tstoredCart.forEach((item) => {\n\t\t\tcounter += item.qty;\n\t\t});\n\t\tcartCounter.innerText = counter;\n\t}\n}", "title": "" }, { "docid": "0cad485a732c3d0a388cc66e4370aa90", "score": "0.71834224", "text": "function updateCartTotal() {\n var cartItemContainer = document.getElementsByClassName('cart-items')[0]\n var cartRows = cartItemContainer.getElementsByClassName('cart-row')\n var total = 0\n var quantityN = 0\n for (var i = 0; i < cartRows.length; i++) {\n var cartRow = cartRows[i]\n var priceElement = cartRow.getElementsByClassName('cart-price')[0]\n var cartPriceItem = cartRow.getElementsByClassName('cart-price-item')[0]\n var quantityElement = cartRow.getElementsByClassName('cart-quantity-input')[0]\n\n var price = priceElement.innerText.replace(' đ', '')\n var replaceAllPrice = price.replaceAll('.','')\n\n var quantity = quantityElement.value\n total = total + (replaceAllPrice * quantity)\n quantityN = parseFloat(quantityN + Number(quantity))\n //Format price item\n cartPriceItemFormat = replaceAllPrice * Number(quantity)\n cartPriceItem.innerText = new Intl.NumberFormat('vi').format(cartPriceItemFormat)\n }\n total = Math.round(total)\n document.getElementsByClassName('cart-total-price')[0].innerText = new Intl.NumberFormat('vi').format(total)\n document.getElementsByClassName('cart-total-quantity')[0].innerText = quantityN\n}", "title": "" }, { "docid": "b64269bf2ab6edede17de6dcc2cf6f20", "score": "0.7165128", "text": "function updateCart(productID, quantity, price) {\n let cartFormInput = $(`#qty-${productID}`)\n let cartItemSubtotal = $(`#product${productID}-subtotal`)\n\n cartFormInput.val(quantity)\n\n let subtotal = quantity * price\n cartItemSubtotal.text(`${subtotal}`)\n\n changeTotalPayment()\n}", "title": "" }, { "docid": "915d4390bbb6009fc82d831c4c1e6053", "score": "0.71556556", "text": "function updateCountInCart() {\n cartCounterElm.textContent = cartMng.getCount();\n}", "title": "" }, { "docid": "0abc8808e79b59d33bde44fd8faff57f", "score": "0.7126143", "text": "function UpdateCart(quantityChanged, target, type, idx) {\n var cartContainer = document.getElementsByClassName('products')[0];\n var allproducts = cartContainer.getElementsByClassName('product');\n var totalprice = 0;\n for (var i = 0; i < allproducts.length; i++) {\n var CartProduct = allproducts[i];\n var price1kgProduct = CartProduct.getElementsByClassName('product-price-1kg')[0];\n var quantity1kgProduct = CartProduct.getElementsByClassName('product-quantity-1kg-input')[0];\n var price1kgNumber = parseFloat(price1kgProduct.innerText.replace('$ - 1KG', ''));\n var quantity1kg = quantity1kgProduct.value;\n var priceHalfkgProduct = CartProduct.getElementsByClassName('product-price-Halfkg')[0];\n var quantityHalfkgProduct = CartProduct.getElementsByClassName('product-quantity-Halfkg-input')[0];\n var priceHalfkgNumber = parseFloat(priceHalfkgProduct.innerText.replace('$ - 0.5KG', ''));\n var quantityHalfkg = quantityHalfkgProduct.value;\n totalprice = totalprice + (price1kgNumber * quantity1kg) + (priceHalfkgNumber * quantityHalfkg);\n }\n totalprice = Math.round(totalprice * 100) / 100\n document.getElementsByClassName('cartTotaPrice')[0].innerText = updateTotalPriceData() + '$';\n sessionStorage.setItem('CartTotalPrice', totalprice);\n if (quantityChanged) {\n console.log(target);\n QuantityFromIceCream[idx][type] = +target.value;\n updateShoppingCart();\n }\n //()\n\n}", "title": "" }, { "docid": "8ee870447d447b840bc6017ce7048ad3", "score": "0.71245444", "text": "function updateCartQuantity() {\n\tvar quantityChange = [];\n\tvar count = 0;\n\tfor (var item in product) {\n\t\tif (cart[item] > product[item].quantity) {\n\t\t\tquantityChange[count] = product[item].name + \":\" + space + product[item].quantity + \"\\n\";\n\t\t\tcart[item] = product[item].quantity;\n\t\t\tproduct[item].quantity = 0;\n\t\t\tcount++;\n\t\t\t\n\t\t}\n\t}\n\tvar msg = \"(If Some Items Are Out Of Stock, They Will Be Automatically Removed From Your Cart)\\n\";\n\tif(quantityChange.length != 0){\n\t\twindow.alert(\"Some Items In Your Cart Have Changed Stock:\\n\" + msg + \"\\n\" + quantityChange.join(\"\"));\n\t}\n\t\n}", "title": "" }, { "docid": "f815368e00906874cde28517f6dc162f", "score": "0.71203613", "text": "function update_cart_qty_in_sideCart_and_cart_plus(id) {\n\n var secPID = id;\n var qty = $('#cartQty'+id).val();\n var qty =parseFloat(qty) + parseInt(1);\n $('#cartQty'+id).val(qty);\n \n $.ajax({\n url: '/update_to_cart',\n method:\"GET\",\n data:{ \n secPID:secPID,\n qty: qty,\n },\n success: function (response) {\n var grndTotal = response['grandtotal'].toFixed(2);\n var setgtotal = $('#indGtotal'+id).text(grndTotal);\n TotalPriceCalc();\n leftCartSidebar();\n //console.log(grndTotal);\n Toastify({\n text: response['status'],\n backgroundColor: \"linear-gradient(to right, #00b09b, #96c93d)\",\n className: \"error\",\n }).showToast();\n }\n });\n\n}", "title": "" }, { "docid": "cbad0aac25127add674fcdae99a309e7", "score": "0.7110605", "text": "function updateCartDetails() {\n var numberOfCartItems = 0;\n totalCost = 0;\n\n for (var i = 0; i < cartItems.length; i++) {\n numberOfCartItems = numberOfCartItems + cartItems[i][3];\n totalCost = totalCost + cartItems[i][2] * cartItems[i][3];\n }\n $(\"#numberOfCartItems\").text(numberOfCartItems);\n $(\"#cartItemTotal\").text(totalCost);\n if (numberOfCartItems > 3) {\n $(\".cart-item-container\").addClass(\"scrollable-menu\");\n } else {\n $(\".cart-item-container\").removeClass(\"scrollable-menu\");\n }\n\n displayCartItems();\n}", "title": "" }, { "docid": "6266816f0762b30c725936a6ef3e9704", "score": "0.7110478", "text": "cartUpdate($target) {\n const itemId = $target.data('cart-itemid');\n const $el = $('#qty-' + itemId);\n const qty = parseInt($el.val(), 10);\n const oldQty = parseInt($el.data('orig-qty'), 10);\n\n // If quantity set to 0 (or otherwise falsey), confirm removal\n if (!qty) {\n const remove = confirm(Theme.messages.cart.remove_item);\n if (!remove) {\n $el.val(oldQty);\n return;\n }\n }\n\n // Disable the cart while updates are running...\n this.$cartContent.addClass('deactivated');\n this.$cartTotals.addClass('deactivated');\n\n utils.api.cart.itemUpdate(itemId, qty, (err, response) => {\n if (response.data.status === 'succeed') {\n // if the quantity is changed \"1\" from \"0\", we have to remove the row.\n const remove = (qty === 0);\n this.refreshContent(remove);\n } else {\n $el.val(oldQty);\n // TODO: Better error messages possible? 'out_of_stock' is a bit limiting.\n alert(response.data.errors.join('\\n'));\n this.$cartContent.removeClass('deactivated');\n this.$cartTotals.removeClass('deactivated');\n }\n });\n }", "title": "" }, { "docid": "487f7ef96994a3767d612be046bd9c95", "score": "0.71078855", "text": "function updateCartTotal(){\n\tvar cartItemContainer = document.getElementsByClassName(\"cart-items\")[0];\n\tvar cartRows = cartItemContainer.getElementsByClassName(\"first-cart-row\");\n\tvar total = 0;\n\tfor (var i = 0; i < cartRows.length; i++) {\n\t\tvar cartRow = cartRows[i];\n\t\tvar priceElement = cartRow.getElementsByClassName(\"cart-price\")[0];\n\t\tvar quantityElement = cartRow.getElementsByClassName(\"cart-quantity-input\")[0];\n\t\tvar price = parseFloat(priceElement.innerText.replace(\"$\",\"\"));\n\t\tvar quantity = quantityElement.value;\n\t\ttotal = total + (price * quantity);\n\t}\n\ttotal = Math.round(total * 100) / 100;\n\tdocument.getElementsByClassName(\"cart-total-price\")[0].innerText = \"$\" + total;\n}", "title": "" }, { "docid": "22fa0947994f90d4e497c61d5702c5d9", "score": "0.7097921", "text": "function cart_qty_change(e, itemId, isAdd) {\n\n let cartItems = localStorage.getItem('productsInCart');\n cartItems = JSON.parse(cartItems);\n\n if (cartItems) {\n\n let prd_qty;\n let prd_sum = $(e).parent().parent().next().children();\n\n if (isAdd) prd_qty = $(e).prev();\n else prd_qty = $(e).next();\n\n let qty = Number(prd_qty.val());\n\n if (qty > 1 && isAdd == false) {\n qty -= 1;\n prd_qty.attr('value', qty);\n total = Number(cartItems[itemId]['price']) * qty;\n prd_sum.html('&#8377; ' + total);\n cartItems[itemId]['qty'] -= 1;\n localStorage.setItem(\"productsInCart\", JSON.stringify(cartItems));\n alter_totalCost(cartItems[itemId]['price'], isAdd = false);\n }\n else if (qty >= 1 && isAdd == true) {\n qty += 1;\n prd_qty.attr('value', qty);\n total = Number(cartItems[itemId]['price']) * qty;\n prd_sum.html('&#8377; ' + total);\n cartItems[itemId]['qty'] += 1;\n localStorage.setItem(\"productsInCart\", JSON.stringify(cartItems));\n alter_totalCost(cartItems[itemId]['price'], isAdd = true);\n }\n\n }\n}", "title": "" }, { "docid": "93a94c7daf3ea3f961f728eb807f19a6", "score": "0.70941347", "text": "increment(itemData) {\n itemData.quantity += 1;\n this.props.setItemQuantity(itemData);\n }", "title": "" }, { "docid": "0df15d38e3eda7534a77e0229aa9a834", "score": "0.7080266", "text": "function cartUpdated() {\n $('.change-cart-item-quantity').on('click', function(evt){\n evt.preventDefault();\n var $button = $(this);\n var $item = $button.closest('.cart-item');\n var id = $item.data('id');\n var quantity = $(`#update-quantity-${id}`).val();\n updateItem(id, quantity);\n renderCart();\n });\n $('.remove-cart-item').on('click', function(evt){\n evt.preventDefault();\n var $button = $(this);\n var $item = $button.closest('.cart-item');\n var id = $item.data('id');\n removeItem(id);\n renderCart();\n });\n}", "title": "" }, { "docid": "babd536bc552dbf43cc4aaa3334d0f48", "score": "0.7078051", "text": "function updateCart() {\n\n}", "title": "" }, { "docid": "48b4df6f5d80a4c3676572dc6526a6d1", "score": "0.7076046", "text": "handleCartQtyChanges(qty, cart) {\n if (this.state.cartQty !== qty) {\n this.setState({cartQty: qty, cart: cart})\n localStorage.setItem(\"shoppingCart\", JSON.stringify(this.state.cart));\n }\n }", "title": "" }, { "docid": "8b53d2b00176a14ae6502225acf6e49c", "score": "0.7073557", "text": "function quantityAdjust() {\n\n\t\tvar arrQuantityInput = document.querySelectorAll('.adjust_number');\n\n\t\t// only define variables if this is a cart page\n\t\tif (isCartCheckout || isCartCSR) {\n\n\t\t\tvar elButtonUpdate = document.getElementById('button_update'),\n\t\t\t\telButtonFinalize = document.getElementById('button_finalize'),\n\t\t\t\tarrValuesOriginal = [],\n\t\t\t\tarrValuesNew = [];\n\n\t\t}\n\n\t\t// for each input[type=\"number\"] found on the cart page\n\t\tfor (var i = 0; i < arrQuantityInput.length; i++) {\n\t\t\tquantityIncrements(arrQuantityInput[i], i);\n\t\t}\n\n\t\tfunction quantityIncrements(thisQuantityInput, thisIndex) {\n\n\t\t\tvar thisID = thisQuantityInput.getAttribute('name'),\n\t\t\t\tthisMin = parseInt( thisQuantityInput.getAttribute('min') ),\n\t\t\t\tthisMax = parseInt( thisQuantityInput.getAttribute('max') ),\n\t\t\t\tthisValue = parseInt( thisQuantityInput.value ),\n\t\t\t\telQuantityDecrease = thisQuantityInput.nextElementSibling,\n\t\t\t\telQuantityIncrease = elQuantityDecrease.nextElementSibling,\n\t\t\t\tenteredValue;\n\n\t\t\t// if cart page, push captured quantity values to our arrays\n\t\t\tif (isCartCheckout || isCartCSR) {\n\t\t\t\tarrValuesOriginal.push(thisValue);\n\t\t\t\tarrValuesNew.push(thisValue);\n\t\t\t}\n\n\t\t\t// if clicking the 'minus' button\n\t\t\telQuantityDecrease.addEventListener('click', function(e) {\n\n\t\t\t\t// currently not allowed to be set to 0...\n\t\t\t\t// removing an item can only be achieved by using the 'remove' link...\n\t\t\t\t// if we want to allow for a 0 value, then updating the cart will remove that product\n\n\t\t\t\t// as long as thisQuantityInput value is greater than the allowed minimum, decrement value\n\t\t\t\tif (thisValue != thisMin) {\n\n\t\t\t\t\tthisValue--;\n\t\t\t\t\tthisQuantityInput.value = thisValue;\n\t\t\t\t\tthisQuantityInput.setAttribute('value', thisValue);\n\n\t\t\t\t\telQuantityIncrease.classList.remove('disabled');\n\n\t\t\t\t\tcompareValues();\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.classList.add('disabled');\n\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t}, false);\n\n\t\t\t// if clicking the 'plus' button\n\t\t\telQuantityIncrease.addEventListener('click', function(e) {\n\n\t\t\t\t// as long as the thisQuantityInput value is not equal to the allowed maximum, increment value\n\t\t\t\tif (thisValue != thisMax) {\n\n\t\t\t\t\tthisValue++;\n\t\t\t\t\tthisQuantityInput.value = thisValue;\n\t\t\t\t\tthisQuantityInput.setAttribute('value', thisValue);\n\n\t\t\t\t\telQuantityDecrease.classList.remove('disabled');\n\n\t\t\t\t\tcompareValues();\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.classList.add('disabled');\n\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t}, false);\n\n\t\t\t// if manually entering a value (using 'input' instead of 'change' to immediately prevent invalid input)\n\t\t\tthisQuantityInput.addEventListener('input', function() {\n\n\t\t\t\t// need to recapture the input value\n\t\t\t\tenteredValue = parseInt(this.value);\n\n\t\t\t\t// as long as the user has not entered a value less than or greater than the allowed limit\n\t\t\t\tif ( enteredValue < thisMin || enteredValue > thisMax || isNaN(enteredValue) ) {\n\n\t\t\t\t\tthisValue = thisValue;\n\t\t\t\t\tthisQuantityInput.value = thisValue;\n\t\t\t\t\tthisQuantityInput.setAttribute('value', thisValue);\n\n\t\t\t\t\tcompareValues();\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthisValue = enteredValue;\n\t\t\t\t\tthisQuantityInput.value = thisValue; // only to accomodate situations where a user has entered a floating point number\n\t\t\t\t\tthisQuantityInput.setAttribute('value', thisValue);\n\n\t\t\t\t\telQuantityDecrease.classList.remove('disabled');\n\t\t\t\t\telQuantityIncrease.classList.remove('disabled');\n\n\t\t\t\t\tcompareValues();\n\n\t\t\t\t}\n\n\t\t\t});\n\n\t\t\t// compare the updated values against the originals\n\t\t\tfunction compareValues() {\n\n\t\t\t\t// currently does not account for deleted rows...\n\t\t\t\t// but this may not matter - TW might require the cart to be updated after a removal anyways... will require their input\n\n\t\t\t\tif (isCartCheckout || isCartCSR) {\n\n\t\t\t\t\tarrValuesNew[thisIndex] = thisValue;\n\n\t\t\t\t\tvar isSame = arrValuesOriginal.length == arrValuesNew.length && arrValuesOriginal.every(function(element, index) {\n\t\t\t\t\t\treturn element === arrValuesNew[index];\n\t\t\t\t\t});\n\n\t\t\t\t\tif (isSame) {\n\n\t\t\t\t\t\telButtonUpdate.classList.add('disabled');\n\t\t\t\t\t\telButtonFinalize.classList.remove('disabled');\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\telButtonUpdate.classList.remove('disabled');\n\t\t\t\t\t\telButtonFinalize.classList.add('disabled');\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "edc04c14aa4403c3dd26153cfb7960a3", "score": "0.70644754", "text": "function updateQty(){\r\n\tqty += 1;\r\n\tdocument.getElementById(\"numItem\").innerText = qty;\r\n}", "title": "" }, { "docid": "70d85b07f47c997e89cb25894c76a6b2", "score": "0.7058252", "text": "function updateItemQTY(itemID, newQTY){\n\tvar query = 'UPDATE products SET stock_qty = '+ newQTY + ' WHERE item_id =' + itemID;\n\tconnection.query(query);\n}", "title": "" }, { "docid": "9636206206567066508ec7882c7a2911", "score": "0.7055579", "text": "function updateQuantity() {\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity - ? WHERE id = ?\",\n [\n quantityToBuy,\n itemToBuy\n ],\n function (err, res) {\n if (err) throw err;\n updateProductSale();\n })\n}", "title": "" }, { "docid": "4e451defcc89a7c844c407f09168064f", "score": "0.7055421", "text": "function updateModalQuantity(pc,sp){\n\tvar id;\n\tvar p;\n\t\n\t// if new stock for an item is 0, remove the item from the modal \n\tfor(var elem in sp){\n\t\tif(pc[elem] > sp[elem].quantity && sp[elem].quantity == 0){\n\t\t\tvar temp = document.getElementById(elem + \"row\");\n\t\t\tpBody.removeChild(temp);\n\t\t\tconsole.log(\"Removed\" + space + product[elem].name + \"\\n\");\n\t\t}\n\t}\n\t// otherwise, display updated quantity\n\tfor(var item in cart){\n\t\tp = product[item];\n\t\tid = p.name;\n\t\tif(cart[item] != 0){\n\t\t\tdocument.getElementById(id + \"stock\").innerHTML = cart[item];\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9376bcc9d4a74224462c1324492b27e7", "score": "0.70525545", "text": "function addToCart(value){\n var quantity;\n var oldValue = parseInt(document.querySelector('.cart_number').innerText);\n if(value !== undefined){\n quantity = 1; // Ajout depuis More Product // +1\n } else {\n quantity = parseInt(document.querySelector('.quantities').value); // Ajout depuis la selection principale // +Quantity\n }\n document.querySelector('.cart_number').innerText = oldValue + quantity;\n // Idée pour plus tard : Ajouter un affichage des articles dans le panier\n}", "title": "" }, { "docid": "c9e844221f2e309dbc853ffbe5ea9ed1", "score": "0.70525205", "text": "function getQty() {\n\t//create a loop to calculate the total number of items in a shopping cart\n\tlet qty = 0\n\tfor (let i=0; i <cart.length; i++) {\n\t\tqty += cart[i].qty\n\t}\n\treturn qty\n}", "title": "" }, { "docid": "a228622238676cd073c321a198007588", "score": "0.70452213", "text": "function updateQuantity(id, addUnits) {\n connection.query(\"SELECT * FROM products WHERE item_id=?\", [id], function (err, response) {\n if (err) throw err;\n var name = response[0].product_name;\n var currentQuantity = parseInt(response[0].stock_quantity);\n var newQuantity = currentQuantity + addUnits;\n connection.query(\"UPDATE products SET ? WHERE ?\",\n [\n {\n stock_quantity: newQuantity\n },\n {\n item_id: id\n }\n ], function (err, response) {\n if (err) throw err;\n clearConsole();\n consoleMessage(\"Number of \" + name + \" in stock raised from \" +\n currentQuantity + \" to \" + newQuantity);\n userOptions();\n })\n\n })\n}", "title": "" }, { "docid": "aa82c6bcc65bb562028c1fca0a86f61c", "score": "0.704117", "text": "function updateCartTotal() {\r\n var cartItemContainer = document.getElementsByClassName(\"cart-items\")[0];\r\n var cartRows = cartItemContainer.getElementsByClassName(\"cart-row\");\r\n var total = 0;\r\n for (var i = 0; i < cartRows.length; i++) {\r\n var cartRow = cartRows[i];\r\n var priceElement = cartRow.getElementsByClassName(\"cart-price\")[0];\r\n var quantityElement = cartRow.getElementsByClassName(\"cart-quantity-input\")[0];\r\n var price = parseFloat(priceElement.innerText.replace(\"€\", \"\"));\r\n var quantity = quantityElement.value;\r\n total = total + (price * quantity);\r\n }\r\n total = Math.round(total * 100) / 100;\r\n document.getElementsByClassName(\"cart-total-price\")[0].innerText = \"€\" + total;\r\n }", "title": "" }, { "docid": "fcf94e35444d475b6ee8a58d6c378a66", "score": "0.70397925", "text": "function updateQuantityField(el) {\r\n // Set minimum value to 1\r\n if (isNaN(el.value) || el.value <= 0) {\r\n el.value = 1;\r\n }\r\n // Set maximum value to 99\r\n else if (el.value >= 100) {\r\n el.value = 99;\r\n }\r\n // Update cart values\r\n updateCartSubtotal();\r\n updateCartTotal();\r\n updateQuantityToStorage(el);\r\n}", "title": "" }, { "docid": "b1a20c49a1f14fae72bc67151a32fd92", "score": "0.7028882", "text": "function updateCartTotal() {\n var cartItemContainer = document.getElementsByClassName(\"cart-items\")[0];\n var cartRows = cartItemContainer.getElementsByClassName(\"cart-row\");\n var total = 0;\n for (var i = 0; i < cartRows.length; i++) {\n var cartRow = cartRows[i];\n var priceElement = cartRow.getElementsByClassName(\"cart-price\")[0];\n var quantityElement = cartRow.getElementsByClassName(\n \"cart-quantity-input\"\n )[0];\n var price = parseFloat(priceElement.innerText.replace(\"$\", \"\"));\n var quantity = quantityElement.value;\n total = total + price * quantity;\n }\n document.getElementsByClassName(\"cart-total-price\")[0].innerText = total;\n}", "title": "" }, { "docid": "9ac188f43ac38423d1041ae23bb602f3", "score": "0.7022921", "text": "function updateCartBadge() {\n\tlet cartItemsQuantity = document.getElementById('cartItemQuantity');\n\tlet quantity = JSON.parse(localStorage.getItem('cartItems')).length;\n\t \n\tif(quantity === 0 || quantity === null) {\n\t\tcartItemsQuantity.innerText = \"\";\n\t\tcartItemsQuantity.style.display = \"none\";\n\t}else {\n\t\tcartItemsQuantity.innerText = quantity;\n\t}\n }", "title": "" }, { "docid": "0e73b652ef37a2f73aa14983abd9028c", "score": "0.7004873", "text": "function increase() {\n if (quantity >= 99) {\n return;\n }\n quantity += 1;\n\n if (quantity < 10) {\n counter.setAttribute('value', `0${quantity}`);\n } else {\n counter.setAttribute('value', quantity);\n }\n quantityPrice();\n}", "title": "" }, { "docid": "657de6eb2d3783fbe2ecc84435c9bbda", "score": "0.7002223", "text": "function buyUpdate(id, quantity) {\n var isDupicate = false;\n\n //checks to see if the item is already in the cart\n for (var i in cart) {\n\n if (cart[i].id == id) {\n //if the item is already in the cart, it adds the quantity of the purchase to the quantity already in the cart\n cart[i].quantity += parseInt(quantity);\n isDupicate = true;\n\n //removes the quantity from the amount in stock\n for (var j in stock) {\n if (cart[i].id == stock[j].ItemID) {\n stock[j].StockQuantity -= quantity;\n }\n }\n }\n }\n\n //if not already in the cart\n if (!isDupicate) {\n\n //find the id in the stock array\n for (var k in stock) {\n if (stock[k].ItemID == id) {\n //push the item to the cart\n cart.push({\n id: id,\n name: stock[k].ProductName,\n quantity: parseInt(quantity),\n price: stock[k].Price\n });\n //subtract the user quantity wanted from the quantity in stock\n stock[k].StockQuantity -= quantity;\n }\n }\n }\n\n //display the updated stock\n displayStock();\n //display the shopping cart\n shoppingCart();\n //prompt the user to continue shopping or checkout\n promptOptions();\n}", "title": "" }, { "docid": "d8edb8db9b9370291d8df4572dd5671f", "score": "0.6994064", "text": "calculateTotal(price, skuId, qty) {\n let cartListArr = this.props.elcStore.cartList.length ? JSON.parse(this.props.elcStore.cartList) : {};\n if (Object.keys(cartListArr).length && cartListArr[skuId] !== undefined) {\n for (let x in cartListArr) {\n if (x === skuId) {\n cartListArr[skuId] = {qty: cartListArr[skuId].qty + qty};\n }\n }\n } else {\n cartListArr[skuId] = {qty: qty};\n }\n const total = this.state.total + (price * qty);\n const cartList = cartListArr;\n this.props.elcStore.cartListUpdate(total, cartList);\n }", "title": "" }, { "docid": "2fe678d933e65f4122b02d1caa8f07c9", "score": "0.698791", "text": "function updateTotal(){\n\t\tvar sum = 0;\n\t\t$(\".cart_items>.item\").each(function(i,v){\n\t\t\tsum += $(v).data(\"price\") * $(v).find(\".cart_cloth_num\").text();\n\t\t});\n\t\t$(\".cart_total\").text(sum);\n\t}", "title": "" }, { "docid": "20d5ba1b5793bb8103aeb7db0daf8cd6", "score": "0.6983403", "text": "function fieldQuantityHandler(evt) {\r\n\t var variantId = parseInt($(this).closest('.cart-item').attr('data-variant-id'), 10);\r\n\t var variant = product.variants.filter(function (variant) {\r\n\t return (variant.id === variantId);\r\n\t })[0];\r\n\t var cartLineItem = findCartItemByVariantId(variant.id);\r\n\t var quantity = evt.target.value;\r\n\t if (cartLineItem) {\r\n\t updateVariantInCart(cartLineItem, quantity);\r\n\t }\r\n\t }", "title": "" }, { "docid": "d7e3c2454ac8679223061ac80369a3d6", "score": "0.6982117", "text": "function adjustQuantity() {\n let incrementButton = document.querySelectorAll(\".cartIncrement\");\n let decrementButton = document.querySelectorAll(\".cartDecrement\");\n let cartProduct = localStorage.getItem(\"coffeeInCart\");\n let currentQuantity = 0;\n let currentItem = \"\";\n cartProduct = JSON.parse(cartProduct);\n\n for (let i = 0; i < incrementButton.length; i++) {\n incrementButton[i].addEventListener(\"click\", () => {\n currentQuantity = incrementButton[i].parentElement.querySelector(\"span\").textContent;\n currentItem = incrementButton[i].parentElement.previousElementSibling.previousElementSibling.querySelector(\"span\").textContent;\n cartProduct[currentItem].insideCart += 1;\n cartQuantity(cartProduct[currentItem]);\n costTotal(cartProduct[currentItem]);\n localStorage.setItem(\"coffeeInCart\", JSON.stringify(cartProduct));\n cartDisplay();\n });\n }\n\n for (let i = 0; i < decrementButton.length; i++) {\n decrementButton[i].addEventListener(\"click\", () => {\n currentQuantity = decrementButton[i].parentElement.querySelector(\"span\").textContent;\n currentItem = decrementButton[i].parentElement.previousElementSibling.previousElementSibling.querySelector(\"span\").textContent;\n\n if (cartProduct[currentItem].insideCart > 1) {\n cartProduct[currentItem].insideCart -= 1;\n cartQuantity(cartProduct[currentItem], \"decrement\");\n costTotal(cartProduct[currentItem], \"decrement\");\n localStorage.setItem(\"coffeeInCart\", JSON.stringify(cartProduct));\n cartDisplay();\n }\n });\n }\n}", "title": "" }, { "docid": "e0dd9b14695b85a8670b1e8e807c4119", "score": "0.69571394", "text": "function getCartQuantity() {\n var count = 0;\n \n $.each($('input[name^=quantity]'), function(index, item) {\n count = count + parseInt(item.value);\n });\n \n return count;\n }", "title": "" }, { "docid": "a0d5c0a7359bce4cd3401286249caa97", "score": "0.6955294", "text": "_decrementQuantity(evt) {\n console.log('_decrementQuantity');\n const productId = evt.currentTarget.dataset['product'];\n\n const cartItem = this._findCartItem(productId);\n\n const index = this.cartItems.indexOf(cartItem);\n\n if (cartItem['quantity'] > 1) {\n this.cartItems[index].quantity = cartItem['quantity'] - 1;\n this.cartItems = [...this.cartItems];\n localStorage.setItem('shop-cart', JSON.stringify(this.cartItems));\n }\n\n this.dispatchEvent(new CustomEvent('change-cart-count', {\n bubbles: true,\n composed: true,\n detail: {}\n }));\n }", "title": "" }, { "docid": "b317c3c6fe47d43a9e147f2981a8e435", "score": "0.6943297", "text": "function addquatity(){\n updateQuantity(quantity + 1);\n }", "title": "" }, { "docid": "2ce475029162f4eb988ad4a88663e5d2", "score": "0.6940619", "text": "function updateCartTab(value) {\n if (sessionStorage.getItem(\"itemTotal\") != null) {\n sessionStorage.setItem(\n \"itemTotal\",\n parseInt(sessionStorage.getItem(\"itemTotal\")) + parseInt(value)\n );\n } else {\n sessionStorage.setItem(\"itemTotal\", value);\n }\n showShowCartTab();\n }", "title": "" }, { "docid": "48486d988f43d99877ec17aaa0e8a5cb", "score": "0.69322765", "text": "function updateShoppingCart(){\n\t\"use strict\";\n\n\t\t$j('body').bind('added_to_cart', add_to_cart);\n\t\tfunction add_to_cart(event, parts, hash) {\n\t\t\tvar miniCart = $j('.shopping_cart_header');\n\t\t\tif ( parts['div.widget_shopping_cart_content'] ) {\n\t\t\t\tvar $cartContent = jQuery(parts['div.widget_shopping_cart_content']),\n\t\t\t\t$itemsList = $cartContent .find('.cart_list'),\n\t\t\t\t$total = $cartContent.find('.total').contents(':not(strong)').text();\n\t\t\tminiCart.find('.shopping_cart_dropdown_inner').html('').append($itemsList);\n\t\t\tminiCart.find('.total span').html('').append($total);\n\t\t\t}\n\t\t}\n}", "title": "" }, { "docid": "5c623c55819e70e55ab87e68a2ce04e5", "score": "0.69246584", "text": "updateProductInCart(product) {\n \n //1. fetch value of local storage's cartData. \n var cart = JSON.parse(localStorage.getItem(\"cartData\"));\n console.log(\"Cart BEFORE update: \" + cart);\n\n //2. Find the product in cart\n for(var i = 0; i < cart.length; i++) { \n if(cart[i].productId === product.productId) {\n //update count field\n cart[i].productCurrentCount = product.productCurrentCount;\n }\n }\n\n //store this updated cart in local storage\n localStorage.setItem('cartData', JSON.stringify(cart));\n console.log(\"Cart with updated count of product : \" + JSON.stringify(cart));\n }", "title": "" }, { "docid": "1bbc3faef6b158287e9d6da952ae590f", "score": "0.692323", "text": "function update(){\n newInventory = currentQuantity + updateQuantity;\n\n connection.query(\n \"UPDATE products SET ? WHERE ?\",\n [\n {\n stock_quantity: newInventory\n },\n {\n item_id: itemNum\n }\n ],\n function(err, res) {\n\n if (err) throw err;\n \n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"doAgain\",\n message: \"Your inventory has been successfully updated. Would you like to do something else?\",\n \n }\n ]).then(function(response){\n if (response.doAgain){\n promptManager();\n } else {\n connection.end();\n };\n \n });\n });\n }", "title": "" }, { "docid": "f7fa6f667ee282088b78458776aa9532", "score": "0.69228655", "text": "function updateCurrentQuantity (err, results) {\n if (err) {\n console.log(err)\n }\n console.log('Updated!')\n mainMenu()\n}", "title": "" }, { "docid": "e5f13059ba2c9ccada3b61bb7f1e49f5", "score": "0.69203156", "text": "function getQuantity() {\n let quantity = 0;\n for (let i = 0; i < cart.length; i++) {\n quantity += cart[i].quantity;\n }\n\n return quantity;\n}", "title": "" }, { "docid": "488712bc7c9e51b5daee1e44ad677791", "score": "0.6903918", "text": "function setCart(){\n\t\tstorage.set({ \n\t\t\titems: 0, \n\t\t\tsubtotal: 0\n\t\t}, function(){\n\t\t\tupdateCart();\n\t\t});\n\t}", "title": "" }, { "docid": "7ea720de1330cffce0376fc1554c566c", "score": "0.69037575", "text": "function updateVariantInCart(cartLineItem, quantity) {\r\n\t var variantId = cartLineItem.variant_id;\r\n\t var cartLength = cart.lineItemCount;\r\n\t cart.updateLineItem(cartLineItem.variant_id, quantity).then(function(updatedCart) {\r\n\t var $cartItem = $('.cart').find('.cart-item[data-variant-id=\"' + variantId + '\"]');\r\n\t if (cartLineItem.quantity >= 1) {\r\n\t $cartItem.find('.cart-item__quantity').val(cartLineItem.quantity);\r\n\t $cartItem.find('.cart-item__price').text(formatAsMoney(cartLineItem.line_price));\r\n\t } else {\r\n\t $cartItem.addClass('js-hidden').bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() {\r\n\t $cartItem.remove();\r\n\t });\r\n\t }\r\n\r\n\t updateCartTabButton();\r\n\t updateTotalCartPricing();\r\n\t if (updatedCart.lineItems.length < 1) {\r\n\t closeCart();\r\n\t }\r\n\t }).catch(function (errors) {\r\n\t console.log('Fail');\r\n\t console.error(errors);\r\n\t });\r\n\t }", "title": "" }, { "docid": "ca0f4cfa287d91dfa6e27d71d1f64985", "score": "0.6901597", "text": "function addToCart(productID, qty) {\n // Cek \n if(!databaseProduct[productID]) return `Tidak ada barang dengan ID tersebut`\n if(qty <= 0) return 'Invalid quantity' \n if(qty > databaseProduct[productID].stokProduk) return alert('Stok habis!')\n\n // Kalau aman\n databaseProduct[productID].stokProduk -= qty // database di update\n\n if(!productInCart[productID]) { // productInCart di update\n productInCart[productID] = qty\n } else {\n productInCart[productID] += qty\n }\n\n renderCart() // update tampilan cart\n renderProductList() // update product list => stok berubah atau produk hilang\n updateTotal() // update tampilan total\n return productInCart\n}", "title": "" }, { "docid": "b43033301380ef703f7a35863cd69ad9", "score": "0.6885647", "text": "function updateCartTotal(){\n let cartItemContainer = document.querySelectorAll(\"#shoppingReminder\")[0];\n let cartRows = cartItemContainer.querySelectorAll(\"#shoppingRow\");\n let subTotal = 0 ;\n for (let i = 0 ; i<cartRows.length; i++){\n let cartRow = cartRows[i];\n let productPrice = cartRow.querySelectorAll(\".productPrice\")[0];\n let price = parseFloat(productPrice.innerText.replace('€',\"\"));\n let subTotalCount = document.querySelector(\"#subtotalcount\");\n subTotal += price;\n subTotalCount.innerHTML = subTotal +\"€\";\n }\n let totalCount = document.querySelector(\"#totalcount\");\n let delivery = document.querySelector(\"#deliverycost\")\n let deliveryCost =0 ;\n if(deliveryCost == 0 || null){\n delivery.innerHTML = \"Offerte\";\n }else{\n delivery.innerHTML = deliveryCost + \"€\";\n }\n totalCount.innerHTML = (subTotal + deliveryCost) + \"€\"; \n}", "title": "" }, { "docid": "4a9a0a283ce53e27d23dde24e7c9bfef", "score": "0.68831724", "text": "function updateCartTotal() {\n var cartItemContainer = document.getElementsByClassName('cart-items')[0];\n var cartRows = cartItemContainer.getElementsByClassName('cart-row');\n var total = 0;\n for (var i = 0; i < cartRows.length; i++) {\n var cartRow = cartRows[i];\n var priceElement = cartRow.getElementsByClassName('cart-price')[0];\n console.log(priceElement);\n var quantityElement = cartRow.getElementsByClassName('cart-quantity-input')[0];\n var price = parseFloat(priceElement.innerText.replace('$', ''));\n console.log(price);\n var quantity = quantityElement.value;\n console.log(quantity);\n total = total + (price * quantity);\n }\n total = Math.round(total * 100) / 100;\n document.getElementsByClassName('cart-total-price')[0].innerText = '$' + total;\n}", "title": "" }, { "docid": "523152fc6c70e5435c3fae82f83f13e9", "score": "0.6881156", "text": "function updateStock() {\n\t\t\t\t\t\tupdatedStock = selectedProductDetails.stock_quantity - answer.quantity;\n\t\t\t\t\t}", "title": "" } ]
b6de38c7c27ede9acef77bb9e72370e6
Event hander for calling the SoundCloud API using the user's search query
[ { "docid": "d89145509ed53f6f85522d17b94b684f", "score": "0.708355", "text": "function callAPI(query) {\n $.get(\"https://api.soundcloud.com/tracks?client_id=b3179c0738764e846066975c2571aebb\",\n {'q': query,\n 'limit': '200'},\n function(data) {\n // PUT IN YOUR CODE HERE TO PROCESS THE SOUNDCLOUD API'S RESPONSE OBJECT\n // HINT: CREATE A SEPARATE FUNCTION AND CALL IT HERE\n display_20(data)\n },'json'\n );\n}", "title": "" } ]
[ { "docid": "9d6b6ae993f0d4a5a538553b23359c96", "score": "0.72021246", "text": "function search() {\r\n let track = inputField.value;\r\n\r\n let track_url = \"https://soundcloud.com/\" + user + \"/\" + track;\r\n\r\n SC.oEmbed(track_url, { auto_play: true })\r\n .then(function(oEmbed) {\r\n soundcloudElement.innerHTML = oEmbed.html;\r\n });\r\n}", "title": "" }, { "docid": "28b0a3c799a17a43f2bd11f7fc547a89", "score": "0.67030156", "text": "function searchTracks() {\n SC.initialize({\n client_id: 'f665fc458615b821cdf1a26b6d1657f6'\n });\n SC.get(\"/tracks\", {\n q: document.getElementById(\"searchText\").value\n }).then(function (response) {\n songs = response;\n console.log(response);\n });\n playNext();\n songInfo();\n }", "title": "" }, { "docid": "ea5288db890fed391174f365b258d692", "score": "0.66501594", "text": "function spotifySearch(userInput) {\n\tvar spotify = new Spotify({\n\tid: importKeys.spotifyKeys.id,\n\tsecret: importKeys.spotifyKeys.secret\n\t});\n\n\tspotify.search({ type: 'track', query: userInput }, function(err, data) {\n\t \tif (err) {\n\t return console.log('Error occurred: ' + err);\n\t \t}\n\t \n\t \tfor(var i = 0; i < data.tracks.items.length && i < 20; i++) {\n\t \t\tconsole.log(\"\");\n\t \t\tconsole.log(data.tracks.items[i].artists[0].name);\n\t \t\tconsole.log(data.tracks.items[i].name);\n\t \t\tconsole.log(data.tracks.items[i].preview_url);\n\t \t\tconsole.log(data.tracks.items[i].album.name);\n\t \t}\n\n\t \tconsole.log(\"\");\n\t \tliriStart();\n\t\t \n\t});\n\n}", "title": "" }, { "docid": "3018c150fdee87708a73eb0d673783ec", "score": "0.65101033", "text": "async function onSearch () {\n const query = $searchInput.value\n\n // Update the URL with the search parameters in the query string\n // UNLESS this is the GraphQL Explorer page, where a query in the URL is a GraphQL query\n const pushUrl = new URL(location)\n pushUrl.search = query && !isExplorerPage ? new URLSearchParams({ query }) : ''\n history.pushState({}, '', pushUrl)\n\n // If there's a query, call the endpoint\n // Otherwise, there's no results by default\n let results = []\n if (query.trim()) {\n const endpointUrl = new URL(location.origin)\n endpointUrl.pathname = '/search'\n endpointUrl.search = new URLSearchParams({ language, version, query })\n\n const response = await fetch(endpointUrl, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n results = response.ok ? await response.json() : []\n }\n\n // Either way, update the display\n $searchResultsContainer.querySelectorAll('*').forEach(el => el.remove())\n $searchResultsContainer.append(\n tmplSearchResults(results)\n )\n toggleStandaloneSearch()\n\n // Analytics tracking\n if (query.trim()) {\n sendEvent({\n type: 'search',\n search_query: query\n // search_context\n })\n }\n}", "title": "" }, { "docid": "d60601e4d29d32e5981a4bb01bcf2a64", "score": "0.65035176", "text": "async search(e) {\n //NOTE You dont need to change this method\n e.preventDefault();\n try {\n await SongService.getMusicByQuery(e.target.query.value);\n _drawResults();\n } catch (error) {\n console.error(error);\n }\n }", "title": "" }, { "docid": "a954d50b6c08894df4913dbb2a3fb99e", "score": "0.65013784", "text": "function handleSearch(event) {\n if (location.pathname !== \"/search\") history.push(\"/search\");\n dispatch({\n type: \"SET_SEARCH_TERM\",\n searchTerm: event.target.value,\n });\n spotify\n .search(event.target.value, [\"album\", \"artist\", \"track\", \"playlist\"], {\n limit: 4,\n })\n .then((response) => {\n dispatch({\n type: \"SET_SEARCH_RESULTS\",\n searchResults: response,\n });\n })\n .catch((error) => console.log(error));\n }", "title": "" }, { "docid": "904c41130a8e384680903f961040786f", "score": "0.64551544", "text": "function search(query)\n {\n urlsearch = \"https://www.googleapis.com/customsearch/v1?key=\"+googleKey+\"&cx=\"+googleID+\"&q=\" + query;\n var callback=function(data)\n {\n\n }\n HTTPS.get(urlsearch, function(res){\n body='';\n res.on('data', function(data){\n body+=data;\n });\n res.on('end', function(){\n result=JSON.parse(body);\n callback(result);\n var searchLink = result.items[0].link;\n var searchSnippet = result.items[0].snippet;\n var botResponse = searchSnippet + \" The link is \" + searchLink;\n postMessage(botResponse);\n });\n }).on('error', function(e){\n console.log('Error: ' +e);\n });\n }", "title": "" }, { "docid": "ed7284337dbf60852d524688a7ba39f4", "score": "0.6438695", "text": "function search() {\n spotify\n .search({\n type: \"track\",\n query: userInput,\n limit: 2\n })\n .then(function(response) {\n // var data = response;\n var data = response.tracks.items[0];\n let albumName = data.album.name;\n let nameSong = data.name;\n let bandName = data.album.artists[0].name;\n let previewName = data.preview_url;\n if (previewName === null){\n previewName = \"---No Preview Available---\";\n }\n\n //logIt RESULTS OF API\n logIt(\"\\n+++=======Artist Name===============+++\\n\");\n logIt(\"+++ \" + bandName);\n logIt(\"\\n+++=======Song Name=================+++\\n\");\n logIt(\"+++ \" + nameSong);\n logIt(\"\\n+++=======Album Name================+++\\n\");\n logIt(\"+++ \" + albumName);\n logIt(\"\\n+++=======Preview URL===============+++\\n\");\n logIt(\"+++ \" + previewName);\n logIt(\"\\n+++=================================+++\\n\");\n })\n .catch(function(err) {\n logIt(err);\n });\n }", "title": "" }, { "docid": "19158268660f6e3f6b7473421428e914", "score": "0.6427918", "text": "function spotifySearch() {\n if (input == false){\n var spotifyParameter = { type: \"track\", query: \"The Sign Ace of Base\", limit: 1 }\n }\n else {\n input = input.join(\" \");\n var spotifyParameter = { type: \"track\", query: input, limit: 1 }\n }\n spotifyClient.search(spotifyParameter, function(\n err,\n data\n ) {\n if (err) {\n return console.log(\"Error occurred: \" + err);\n }\n var spotifyData = data.tracks.items[0];\n var artistName = spotifyData.album.artists[0].name;\n var songName = spotifyData.name;\n var albumName = spotifyData.album.name;\n var previewURL = spotifyData.preview_url;\n // console.log(spotifyData.album.name)\n // console.log (spotifyData.name)\n // console.log(spotifyData);\n // console.log(artistName);\n // console.log(spotifyData.preview_url)\n console.log(\n \"Artist Name: \" +\n artistName +\n \"\\nSong Name: \" +\n songName +\n \"\\nAlbum Name: \" +\n albumName +\n \"\\nPreview URL: \" +\n previewURL\n );\n });\n}", "title": "" }, { "docid": "bff1876d5549f667dd3556b24cd29043", "score": "0.64106137", "text": "function search () {\n\tvar query = $('#subject-input').val();\n\tif ($('#subject-input').val().length > 0) {\n\t\tjQuery.get(\n\t\t\t\"https://ws.audioscrobbler.com/2.0/\",\n\t\t\t{\n\t\t\t\t'method' : \"track.search\",\n\t\t\t\t'track' : query,\n\t\t\t\t'api_key' : \"b392916683d0336a30882ff34ff114f7\",\n\t\t\t\t'format' : \"json\",\n\t\t\t\t'limit' : 2\n\t\t\t},\n\t\t\tdata => {\n\t\t\t\tresults.songs = [];\n\t\t\t\tdata.results.trackmatches.track.forEach(track => {\n\t\t\t\t\tresults.songs.push({\n \"name\" : track.name,\n \"artist_name\" : track.artist,\n \"image\" : track.image[2][\"#text\"]\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tupdateResultsBoxContents();\n\t\t\t}\n\t\t);\n\t\tjQuery.get(\n\t\t\t\"https://ws.audioscrobbler.com/2.0/\",\n\t\t\t{\n\t\t\t\t'method' : \"album.search\",\n\t\t\t\t'album' : query,\n\t\t\t\t'api_key' : \"b392916683d0336a30882ff34ff114f7\",\n\t\t\t\t'format' : \"json\",\n\t\t\t\t'limit' : 2\n\t\t\t},\n\t\t\tdata => {\n\t\t\t\tresults.albums = [];\n\t\t\t\tdata.results.albummatches.album.forEach(album => {\n\t\t\t\t\tresults.albums.push({\n \"name\" : album.name,\n \"artist_name\" : album.artist,\n \"image\" : album.image[2][\"#text\"]\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tupdateResultsBoxContents();\n\t\t\t}\n\t\t);\n\t}\n}", "title": "" }, { "docid": "be50687ed6a020630aeb3fafc276460f", "score": "0.64077765", "text": "function spotifyIt(userQuery) {\n\tspotify.search({ type: 'track', query: userQuery }, function(err, data) {\n\t if (err) {\n\t console.log('Error occurred: ' + err);\n\t return;\n\t }\n\n\t // Establish easy access to main data object\n\t var obj = data.tracks.items[0];\n\n\t // Return artist(s) list\n\t var artists = \"\";\n\t for(var i=0; i<obj.artists.length; i++) {\n\t \tif(i == (obj.artists.length - 1)) {\n\t \t\tartists += obj.artists[i].name;\n\t \t} else {\n\t \t\tartists += obj.artists[i].name + \", \";\n\t \t}\n\t }\n\n\t // Establish remaining message items\n\t var songTitle = obj.name;\n\t var prevLink = obj.preview_url;\n\t var albumName = obj.album.name;\n\n\t // Create the console message string\n\t var msg = \"********************\\n\";\n\t msg += \"User searched for: \" + userQuery + \"\\n\";\n\t msg += \"Results: \\n\";\n\t msg += \"Artist(s): \" + artists + \"\\nSong Title: \" + songTitle + \"\\nPreview Link: \" + prevLink + \"\\nAlbum: \" + albumName + \"\\n\";\n\t msg += \"********************\\n\\n\";\n\t console.log(userRequestMsg + msg);\n\t recordEntry(userRequestMsg + msg);\n\t});\n}", "title": "" }, { "docid": "d27dd3cc079f02386ba3dbd08bcb3889", "score": "0.6394655", "text": "function spotifyRequest() {\n if (!userInput) {\n userInput = \"paul simon\";\n }\n spotify\n .search({type: \"track\", query: userInput})\n .then(function(response) {\n console.log(\" \");\n console.log(\"********** SEARCHING FOR \" + userInput + \" *********\" );\n console.log(\" \");\n // limit search results to 3 songs\n for (var i = 0; i < 3; i++) {\n var results = \n \"********************\" +\n \"\\nArtists: \" + response.tracks.items[i].artists[0].name +\n \"\\nSong Name: \" + response.tracks.items[i].name +\n \"\\nAlbum Name: \" + response.tracks.items[i].album.name +\n \"\\nLink To Preview: \" + response.tracks.items[i].preview_url;\n\n console.log(results);\n }\n })\n}", "title": "" }, { "docid": "65b8c1fb4e54faa44bf3ca855a9cba39", "score": "0.6392329", "text": "function spotifyThis() {\n if (userInput === \"\"){\n userInput = \"The Sign\"\n }\n spotify.search({ type: `track`, query: `${userInput}` }, function (error, data) {\n if (error) {\n console.log(error)\n } \n else{\n console.log(\"========================================\")\n console.log(`Artist: ${data.tracks.items[0].artists[0].name}`);\n console.log(`Title: ${data.tracks.items[0].name}`);\n console.log(`Preview: ${data.tracks.items[0].preview_url}`);\n console.log(`Album: ${data.tracks.items[0].album.name}`);\n console.log(\"========================================\")\n }\n })\n}", "title": "" }, { "docid": "95d69992941b294163af6911b187ab77", "score": "0.63896686", "text": "function spotifyCall() {\n spotify.search({ type: 'track', query: searchTerm }, function(err, data) {\n if (err) {\n console.log('Error occurred: ' + err);\n return;\n }\n console.log('Artist: ' + data.tracks.items[0].artists[0].name)\n console.log('Track Title: ' + data.tracks.items[0].name)\n console.log('Preview URL: ' + data.tracks.items[0].preview_url)\n console.log('Album: ' + data.tracks.items[0].album.name)\n });\n\n}", "title": "" }, { "docid": "7d8245d03721a45014884b8d29000316", "score": "0.63449395", "text": "onSearch(e) {\n \n // Start Here\n // ...\n \n\n }", "title": "" }, { "docid": "919f8e89197a3b67fa4dc5369131b832", "score": "0.6312643", "text": "function getSoundData(searchWord) {\n\tconsole.log(\"Getting sound data\");\n\n\tclientID = \"98f18f7088398973c9090d2309d08568\";\n\tvar clientUrl = \"?client_id=\" + clientID;\n\n\tSC.initialize({\n \tclient_id: clientID,\n });\n\n\tSC.get('/tracks', {\n q: searchWord, \n\n }).then(function(tracks) {\n\n \t\tif (tracks && tracks.length !== 0) {\n\n\t\t\tif (trackNum > tracks.length-1) {\n\t\t\t\ttrackNum = 0;\n\t\t\t}\n\n\t\t\tconsole.log(\"track being played: \" + trackNum);\n\n\t\t\tvar requestUrl = tracks[trackNum].stream_url + clientUrl;\n\t\t\tconsole.log(requestUrl);\n\n\t\t\tmakeAudioRequest(requestUrl);\n\n\t\t\ttrackTitle = tracks[trackNum].title;\n\t\t\ttrackNum ++;\n\n \t\t}else {\n \t\t\talert(\"No search results. Please try another track.\");\n \t\t}\n\n\t});\n}", "title": "" }, { "docid": "c019a55539ec7bf37c019159f3796338", "score": "0.6267993", "text": "function reqSongs(song) {\n if (userSearch) {\n spotify.search({ type: 'track', query: userSearch }, function(err, data) {\n \t// console.log(data)\n if (err) {\n console.log('Error occurred: ' + err);\n return;\n } else {\n console.log(\"---------------------------------\");\n console.log(\"ARTIST NAME: \" + data.tracks.items[0].album.artists[0].name);\n console.log(\"SONG NAME: \" + data.tracks.items[0].name);\n console.log(\"SONG PREVIEW URL: \" + data.tracks.items[0].preview_url);\n console.log(\"ALBUM NAME: \" + data.tracks.items[0].album.name);\n }\n });\n }\n\n // If the user doesn't type a song in, \"The Sign by Ace of Base\" is returned to console\n else {\n\n spotify.lookup({ type: 'track', id: \"0hrBpAOgrt8RXigk83LLNE\" }, function(err, data) {\n if (err) {\n console.log('Error occurred: ' + err);\n return;\n } else {\n console.log(\"\\nSONG NAME: \" + data.name);\n console.log(\"ALBUM: \" + data.album.name);\n console.log(\"ARTIST: \" + data.artists[0].name);\n console.log(\"SONG PREVIEW URL: \" + data.preview_url);\n }\n });\n }\n if (userSearch) {\n appendLog(userInput, userSearch);\n } else {\n appendLog(userInput, \"The Sign by Ace of Base\");\n }\n\n}", "title": "" }, { "docid": "53ec1fa216727434e7d9834fec9046a9", "score": "0.62521654", "text": "function getDataFromApi(query) {\n //is this the right callback function?\n $.getJSON(\"https://api.mixcloud.com/search?callback=?\", {\n //are these the right parameters for the object?\n type: 'user',\n q: query,\n\n\n })\n .done(function(data) {\n var username = data.data[0].username;\n $.getJSON(\"https://api.mixcloud.com/\" + username + \"?callback=?\", {\n metadata: \"1\"\n })\n .done(function(response) {\n var url = response.metadata.connections.cloudcasts;\n $.getJSON(url + \"?callback=?\", {\n limit: 1\n\n })\n .done(function(response) {\n displayAPIResults(response.data);\n });\n })\n\n })\n\n}", "title": "" }, { "docid": "6977e2086c2786b9aa1e43ff2f5bbabb", "score": "0.6251377", "text": "handleChange(event, value){\n\n //updating input box\n this.setState({ autoCompleteValue: event.target.value });\n let _this = this;\n\n //Searching for the song with the entered value in soundcloud\n Axios.get(`https://api.soundcloud.com/tracks?client_id=${this.client_id}&q=${value}`)\n .then (function (response){\n\n //updating with the tracks with what it sends back\n _this.setState({ tracks: response.data });\n })\n .catch(function(err){\n console.log(err);\n });\n }", "title": "" }, { "docid": "9abae172a7a04b4bf19e8ef6ae227e19", "score": "0.6238421", "text": "function spotifyThis(inputs) {\n if (!inputs) {\n inputs = 'The Sign ace of ace';\n }\n // console.log(inputs);\n spotifyKey.search({ type: 'track', query: inputs }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n console.log(\"Artist(s): \" + data.tracks.items[0].album.artists[0].name);\n console.log(\"Album: \" + data.tracks.items[0].album.name);\n console.log(\"Preview Link: \" + data.tracks.items[0].preview_url);\n console.log(\"Song Name: \" + inputs);\n });\n\n}", "title": "" }, { "docid": "bad09e2e41aa4507ce32572a6be52bff", "score": "0.6233088", "text": "function onSearch()\n\t{\n\t\tstore.dispatch({\n\t\t\ttype: 'SEARCH',\n\t\t\ttext: 'some search text'\n\t\t});\n\t}", "title": "" }, { "docid": "a28e38b51825b2256c2b891025ab6f42", "score": "0.62146354", "text": "function findSong(inputValue) {\n\n var searchTrack;\n if (inputValue === undefined) {\n searchTrack = \"Hello Kitty\";\n } else {\n searchTrack = inputValue;\n }\n\n spotify.search({\n type: 'track',\n query: searchTrack\n }, function (error, data) {\n if (error) {\n textLog('Error occurred: ' + error);\n return;\n }\n // log response data to the log.txt file \n else {\n textLog(\"\\n---------------------------------------------------\");\n textLog(\"********** Songs Information **********\");\n textLog(\"Artist: \" + data.tracks.items[0].artists[0].name);\n textLog(\"Song: \" + data.tracks.items[0].name);\n textLog(\"Preview: \" + data.tracks.items[0].preview_url);\n textLog(\"Album: \" + data.tracks.items[0].album.name);\n textLog(\"\\n---------------------------------------------------\");\n }\n });\n}", "title": "" }, { "docid": "caa444df28392a160ef3d39d1c29fc70", "score": "0.62107444", "text": "function runApiQueryFromInput (event) {\n event.preventDefault();\n var inputSearchFieldText = $('#titleSearch').val();\n /* Set the URL, then use it as an argument to make API call */\n massUrl = setUrl(inputSearchFieldText)\n queryAPIForResults(massUrl);\n}", "title": "" }, { "docid": "c4ee7d8a84fd8d78a0deca1660224a93", "score": "0.62042856", "text": "function getValue1(){\r\ndocument.querySelector(\".js-search\").addEventListener('keyup',function(e){\r\n\tvar input = document.querySelector('input').value;\r\n\t\r\n\tif(e.which==13){\r\n\t\tconsole.log(input);\r\n\t\tSoundCloudApi.gettrack(input);\r\n\t}\r\n\t}\t)\r\n}", "title": "" }, { "docid": "54bd5eeca15aae1755fc0a0bc5fb7cd9", "score": "0.61588484", "text": "onSearch(term){\n console.log(\"search on term:\" + term);\n }", "title": "" }, { "docid": "16f0e7f6f876f357dcd3d107cf9749bb", "score": "0.6154716", "text": "function spotifyProc(entryVar) {\r\n var spotify = new Spotify(keys.spotify);\r\n //console.log(\"Spotify!\");\r\n \r\n if (!entryVar) {\r\n entryVar = \"The Sign Ace of Base\";\r\n }\r\n //console.log(entryVar);\r\n spotify.search({\r\n type: 'track',\r\n query: entryVar\r\n }, function(error, data) {\r\n if (error) {\r\n console.log('Error occurred: ' + error);\r\n var entryVAR = \"\";\r\n return;\r\n } \r\n //console.log(data.tracks.items);\r\n console.log(\"\\n---------------------------------------------------\\n\");\r\n console.log(\"Artist: \" + data.tracks.items[0].artists[0].name);\r\n console.log(\"Song: \" + data.tracks.items[0].name);\r\n console.log(\"Preview: \" + data.tracks.items[0].preview_url);\r\n console.log(\"Album: \" + data.tracks.items[0].album.name);\r\n console.log(\"\\n---------------------------------------------------\\n\");\r\n var entryVAR = \"\";\r\n \r\n \r\n });\r\n \r\n \r\n \r\n }", "title": "" }, { "docid": "7c7337d6387470583e6abb6e8f373537", "score": "0.6145825", "text": "function searchMusicAPI_1(searchTag, mSinger, cb){\r\n\t var url = \"http://mp3.baidu.com/dev/api/?tn=getinfo&ct=0&word=\"+ searchTag +\"&ie=utf-8&format=json\";\r\n\t http.get(url, function(res) {\r\n\t var info = '';\r\n\t res.on('data', function (chunk) {\r\n\t info += chunk;\r\n\t }).on('end', function() {\r\n\t var data = JSON.parse(info);\r\n\t console.log(data);\r\n\t cb(data);\r\n\t }).on('error', function(e) {\r\n\t console.log(\"Got error: \" + e.message);\r\n\t cb(e.message);\r\n\t });\r\n\t }).on('error', function(e) {\r\n\t console.log(\"Got error: \" + e.message);\r\n\t cb(e.message);\r\n\t });\r\n\t}", "title": "" }, { "docid": "0521561a49012013d7b47a0c64622e85", "score": "0.61331743", "text": "function handlerButtonSearch(event) {\n const userSearch = search.value;\n fetch(`http://api.tvmaze.com/search/shows?q=${userSearch}`)\n .then((response) => response.json())\n .then((data) => {\n searchResult = data;\n introElementsByDom();\n renderFav();\n });\n}", "title": "" }, { "docid": "173d1b75363da57a03ad953513b68e8b", "score": "0.6096656", "text": "function searchEvents(event) {\n event.preventDefault();\n let query = txtSearch.value;\n // fill array with artists\n getArtistNameList(query);\n}", "title": "" }, { "docid": "c31a8949cadda682f9be8795b1c04940", "score": "0.6090219", "text": "function findSong(search){\n if(search == undefined)\n search = \"The Sign\";\n\n spotify.search({ type: 'track', query: song, limit: 20 }, function(error, data) {\n if (!error) {\n for(var i = 0; i < data.tracks.items.length; i++) {\n var songInfo = data.tracks.items[i]; \n console.log(\"Artist: \" + songInfo.artists[0].name);\n console.log(\"Song: \" + songInfo.name)\n console.log(\"URL: \" + songInfo.preview_url);\n console.log(\"Album: \" + songInfo.album.name);\n console.log(\"--------------------------\")\n }\n }\n else {\n console.log(\"Error occurred\")\n }\n \n });\n}", "title": "" }, { "docid": "5a9414e12078c7ac18ba91278a27f85c", "score": "0.6062098", "text": "function runSpotify(){ \n var spotify = new Spotify(keys._spotify);\n \n var playSong; if(userCommand === '') {\n userCommand = (\"Thunder Road\");\n }\n \n spotify.search({ type: 'track', query: userCommand }, function(err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n\n \n console.log('Artists: ' + data.tracks.items[0].artists[0].name); \n console.log('Song Title: ' + data.tracks.items[0].name);\n console.log('Preview Link: ' + data.tracks.items[0].preview_url);\n console.log('Album: ' + data.tracks.items[0].album.name);\n console.log('--------------------');\n });\n \n}//end of runSpotify function", "title": "" }, { "docid": "51eacba638ec145bdc72e03e7ebc0bc4", "score": "0.6054981", "text": "function songLookup(search) {\n if (search === \"\") {\n search = 'The Sign';\n }\n spotify.search({ type: 'track', query: search, limit: 1 }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n var songResult = data.tracks.items[0];\n console.log(\"Artist Name: \" + songResult.artists[0].name);\n console.log(\"Song Name: \" + songResult.name);\n console.log(\"Preview Link: \" + songResult.preview_url);\n console.log(\"Album: \" + songResult.album.name);\n });\n}", "title": "" }, { "docid": "9a264207a62752cb19a30e9d11ae64a1", "score": "0.60487014", "text": "function searchSong(input) {\n var Spotify = require(\"node-spotify-api\");\n var spotify = new Spotify(keys.spotify);\n var song = input;\n\n spotify.search({ type: \"track\", query: song, limit: 1}, function(err, data) {\n if(err) {\n return console.log(\"Error occured: \" + err);\n }\n\n var artist_name = data.tracks.items[0].album.artists[0].name;\n var song_name = data.tracks.items[0].name;\n var preview_link = data.tracks.items[0].preview_url;\n var album_name = data.tracks.items[0].album.name;\n\n console.log(\n \"\\n\" +\n \"Artist(s): \" + artist_name + \"\\n\",\n \"Song: \" + song_name + \"\\n\",\n \"Preview URL: \" + preview_link + \"\\n\",\n \"Album: \" + album_name + \"\\n\"\n );\n });\n}", "title": "" }, { "docid": "04b4f4f9c7f4f5a279f13feaf3828f16", "score": "0.6042162", "text": "function songSearch(data, randomTextDataVerify) {\t\n\t//if no song is entered for search, the result will default to \"The Sign\"\n\tif (input2 === undefined) {\n\t\tinput2 = \"The Sign Ace of Base\";\n\t}\n\t//if randomTextDataVerify has been changed from fale to true from our randomText funtion, it will use that data for the song search\n\tif (randomTextDataVerify === true) {\n\t\tinput2 = data;\n\t}\n\t//gets our spotify keys\n\tvar spotify = new Spotify(keys.spotify);\n\tspotify.search({ type: 'track', query: input2, limit: 1}, function(error, data) {\n\t\t//if no error occurs we are looping through the returned data and logging it to our command line\n\t\tif (!error){\n\t\t\tfor (var i = 0; i < data.tracks.items.length; i++){\n\t\t\t\tconsole.log(data.tracks.items[i].artists[0].name);\n\t\t\t\tconsole.log(data.tracks.items[i].album.name);\n\t\t\t\tconsole.log(data.tracks.items[i].name);\n\t\t\t\tconsole.log(data.tracks.items[i].preview_url);\n\t\t\t}\n\t\t}\n\t\tif (error) {\n\t\t\treturn console.log('Error occurred: ' + error);\n \t\t} \n\t});\n}", "title": "" }, { "docid": "5f4f3bc3421cb565038af93fa3f9cfdd", "score": "0.60343355", "text": "function sendquery() {\n console.log(\"Sending query...\")\n $.ajax({\n url: 'https://api.spotify.com/v1/' + query.value,\n headers: {\n 'Authorization': 'Bearer ' + access_token\n },\n success: function(response) {\n console.log(\"Response received\")\n console.log(response)\n },\n error: function(response) {\n console.log(response.responseText)\n }\n });\n }", "title": "" }, { "docid": "39461602e8fc8163921600d93fe07bfd", "score": "0.60217834", "text": "function spotifySong() {\n //If user has not specified a song , default to \"Bye Bye Bye\" by NSYNC\n if (userInput === \"\") {\n userInput = \"Bye Bye Bye\";\n }\n\n spotify.search({ type: \"track\", query: userInput }, function (err, data) {\n if (err) {\n return console.log(\"Error occurred: \" + err);\n } else {\n console.log(\n \"\\n\" + \"Artist: \" + data.tracks.items[0].artists[0].name + \"\\n\"\n ); //Artist(s)\n console.log(\"Song name: \" + data.tracks.items[0].name + \"\\n\"); // The song's name\n console.log(\n \"Preview link: \" + data.tracks.items[0].external_urls.spotify + \"\\n\"\n ); // A preview link of the song from Spotify\n console.log(\"Album: \" + data.tracks.items[0].album.name + \"\\n\"); // The album that the song is from\n }\n\n // console.log(data.tracks.items[0]);\n });\n}", "title": "" }, { "docid": "ff594a976eb075fc990b3148ee408946", "score": "0.6006838", "text": "function incomingSongs(){\n\n\tvar spotify = new Spotify(keys.spotify);\n\n\tvar music = \"\"\n\n\tif(userInput[3] === \"\" || userInput[3] === undefined){\n\t\tconsole.log(\"\\nLearn to request a song\")\n\t\tmusic = \"In the End\"\n\t}\n\telse{\n\t\tfor(i=3; i<userInput.length; i++){\n\t\t\tif(i===userInput.length-1){\n\t\t\t\tmusic = music + userInput[i];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tmusic = music + userInput[i] + \" \";\n\t\t\t}\n\t\t}\n\n\t}\n\n\tspotify.search({ type: 'track', query: music })\n\t\t.then(function(response) {\n\t\t\tfor(var i = 0; i < 20; i++){\n\t\t\tconsole.log(\"\\n============================================\")\n\t\t\t//artist name\n\t\t\tconsole.log(\"Artist: \" + response.tracks.items[0].album.artists[0].name);\n\t\t\t// The Songs Name\n\t\t\tconsole.log(\"Song name: \" + response.tracks.items[0].name);\n\t\t\t// A preview link of the song from Spotify\n\t\t\tconsole.log(\"Spotify Link: \" + response.tracks.items[0].preview_url)\n\t\t\t// The album that the song is from\n\t\t\tconsole.log(\"Album: \" + response.tracks.items[0].album.name)\n\t\t\tconsole.log(\"===========================================\")\n\t\t\t}\n\t\t})\n\t\t.catch(function(err) {\n\t\tconsole.log(err);\n\t});\n\t\n}", "title": "" }, { "docid": "b9cd7e28ea057b6b3ba3cfc18bfa2271", "score": "0.60067993", "text": "function searchConcert(searchValue) {\r\n\r\n // Default search value if no artist/band is given --> I went with Coldplay because reasons. Heh.\r\n if (searchValue == \"\") {\r\n searchValue = \"Coldplay\";\r\n }\r\n\r\n var queryUrl = \"https://rest.bandsintown.com/artists/\" + searchValue + \"/events?app_id=codingbootcamp\";\r\n\r\n\r\n console.log(queryUrl);\r\n \r\n axios.get(queryUrl).then(\r\n function(response) {\r\n console.log(response.data[0]);\r\n console.log(\"\\n++++ BandsInTown Search Results ++++\\n\");\r\n console.log(\"Name of Venue: \" + response.data[0].venue.name);\r\n console.log(\"Venue Location: \" + response.data[0].venue.city);\r\n console.log(\"Date of Event: \" + response.data[0].datetime);\r\n }\r\n );\r\n\r\n// request(queryUrl, function (respError, response, body) {\r\n\r\n// errorFunction();\r\n// function errorFunction(respError) {\r\n// if (respError) {\r\n// return console.log(\"An error occured: \", respError);\r\n// }\r\n}", "title": "" }, { "docid": "38efae9857d34017be9d04b8fb643984", "score": "0.60004735", "text": "function doThis() {\n spotify.search({ type: \"track\", query: \"I Want it That Way\" })\n .then(function(response) {\n // Artist\n console.log(\"Artist: \" + response.tracks.items[0].artists[0].name);\n // Song name\n console.log(\"Track: \" + response.tracks.items[0].name);\n // Album name\n console.log(\"Album: \" + response.tracks.items[0].album.name);\n // Track URL\n console.log(\"URL: \" + response.tracks.items[0].preview_url);\n })\n .catch(function(err) {\n console.log(err);\n });\n }", "title": "" }, { "docid": "17891fd3e146198030586f0d5fc185fd", "score": "0.5997081", "text": "function instaSearch(q) {\n SC.get('/tracks', { q: q, limit: 10 }, function(tracks) {\n if (tracks.length == 0) {\n cleanUpSpace();\n $('#error').append('No tracks found');\n } else {\n all_tracks = tracks;\n var track = all_tracks.splice(0, 1)[0];\n playTrack(track);\n }\n });\n }", "title": "" }, { "docid": "cc284d793b9b8f9ed6dc6dcab2a69166", "score": "0.59875923", "text": "searchSubmit(event) {\n\n\t\t\tevent.preventDefault(); // Avoid page reload\n\t\t\n\t\t\tlet userInput = event.target.elements['spotify-search-input'].value; // Get user input\n\n\t\t\tif(userInput && userInput !== TEMP.lastSearch) {\n\n\t\t\t\tTEMP.lastSearch = userInput;\n\n\t\t\t\tlet options = DATA.spotifyAPI.options;\n\n\t\t\t\tlet uri;\n\n\t\t\t\tfor(let type of ['track', 'artist', 'album']) {\n\n\t\t\t\t\turi = DATA.spotifyAPI.searchURI + `&type=${type}&q=${type}:${userInput}`;\n\n\t\t\t\t\tHELPERS.fetchURI(uri, options).then(results => displayResults(results));\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}", "title": "" }, { "docid": "bf4623abfd003105cff5cc84961b3670", "score": "0.5985389", "text": "function spotifySearch(parameter) {\n\t// Spotify API call with user-specified song name as parameter\n\tspotify.search({ type: 'track', query: parameter}, function(err, data) {\n\t\t if ( err ) {\n\t\t console.log('Error occurred: ' + err);\n\t\t return;\n\t\t }\n\t\t // Storing required data in array\n\t\t \tvar songDetailArray = data.tracks.items;\n\t\t \t// Filtered array having just the data with song name specified\n\t\t \t// This is done due to the inconsistent and disparaging data provided by this package\n\t\t \tvar newArray = songDetailArray.filter(item => item.name.trim().toLowerCase() === (parameter.trim().toLowerCase()));\n\t\t \t\n\t\t \t// Printing out details to console\n\t\t \tconsole.log(`\n------------------------------\nSong: ${newArray[0].name}\nArtist(s): ${newArray[0].artists[0].name}\nPreview link: ${newArray[0].preview_url}\nAlbum: ${newArray[0].album.name}\n------------------------------`);\n\t\t \t// Logging data\n\t\t \tfs.appendFile(\"logInquirer.txt\", `\n------------------------------\n${newArray[0].name}\n${newArray[0].artists[0].name}\n${newArray[0].preview_url}\n${newArray[0].album.name}\n------------------------------\n`, function(error) {\n\t\t\t\tif(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t}\n\t\t\t})\n\t\t\tdoAnother();\n\t});\n}", "title": "" }, { "docid": "9b095e7bb1c8794eae734ebe49482ad6", "score": "0.59837663", "text": "handleBQSSearch(event) {\r\n apexSearchBQS(event.detail)\r\n .then(results => {\r\n let el = this.getRightLookup('lkp_bqs');\r\n el.setSearchResults(results);\r\n })\r\n .catch(error => {\r\n this.notifyUser('Lookup Error', 'An error occured while searching with the lookup field', 'error');\r\n // eslint-disable-next-line no-console\r\n console.error('Lookup error', JSON.stringify(error));\r\n this.errors = [error];\r\n });\r\n }", "title": "" }, { "docid": "b5a043a0aecbc9bcee75178319509e20", "score": "0.5968471", "text": "function setupSearch() {\n\n\t\t$('form[name=search] button').click(function(event) {\n\t\t\tvar thisEvent = $(event.currentTarget),\n\t\t\t\tform = thisEvent.closest('form'),\n\t\t\t\targs = {},\n\t\t\t\tartistID;\n\t\t\t\tartist = form.find('input[name=q]').val();\n\t\t\t\t$('.artist').html(artist);\n\t\t\targs['name'] = artist;\n\t\t\targs['api_key'] = 'GAKRGEMKMM72Y5A5AGA6RQVD'; //original f7m72ksthddcp3gf85b44qz4\n\n\t\t\t$.getJSON( 'http://api.jambase.com/artists?', args,\n\t\t\tfunction(response) {\n\t\t\t\tartistID = response.Artists[0].Id;\n\t\t\t\teventList(artistID);\n\t\t\t\tLatLngList = [];\n\t\t\t\t\n\t\t\t});\n\n\t\t\treturn false;\n\t\t});\n\t}", "title": "" }, { "docid": "0d93214a48119a64269b0e9d29d9553b", "score": "0.59656537", "text": "function spotifyThisSong() {\n\n // No data, so we're going with \"THe Sign\" by \"Ace of Base\"\n if (!name) { name = \"the Sign Ace of Base\"; }\n\n // Run a search through Spotify based on the name of a song...\n spotify_key.search({ type: \"track\", query: name, limit: 1 }, function (error, data) {\n if (error) { return console.log(\"Error occurred: \" + error); }\n else {\n // Reference the items needed for our search, and declare a variable to concat all artists\n let info = data.tracks.items[0];\n let artists = \"\";\n\n // Concat all the artists returned in our search...\n for (let i = 0; i < info.artists.length; i++) {\n if (artists != \"\") { artists += \", \"; }\n artists += info.artists[i].name;\n }\n \n // Pass the formatted output info\n let output = \"\\n+++++++++++++++++++++++++++++LIRI found this for you!+++++++++++++++++++++++++++++++\\n\" +\n \"Song name: \" + info.name + \".\\n\" +\n \"Album name: \" + info.album.name + \".\\n\" +\n \"Artist name(s): \" + artists + \".\\n\" +\n \"Preview: \" + info.external_urls.spotify + \".\\n\" + \n \"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\\n\";\n\n // Display our results for the user, and log it.\n outputLog(output);\n }\n })\n}", "title": "" }, { "docid": "9996fb3d9908f976ec255ca798bb0d6f", "score": "0.5963491", "text": "function apiCall(search){\n //construct full API query\n let theQuery = baseUrl + search + quoteTag + apiKey;\n fetch(theQuery)\n .then(function(response) { return response.json();})\n .then(function(data){\n initListing(data);}\n )}", "title": "" }, { "docid": "682851ba4b126eced0713528cde2a9b2", "score": "0.59482586", "text": "function spotifySearch() {\n if (argv[3] === undefined) {\n songTitle = \"The Sign, Ace of Base\";\n } else {\n for (var i = 3; i < argv.length; i++) {\n if (i === argv.length - 1) {\n songTitle += argv[i];\n } else {\n songTitle += argv[i] + \" \";\n }\n }\n }\n spotify.search({ \n type: 'track', \n query: songTitle \n }).then(function(response) {\n \n console.log(\"Artist: \" + JSON.stringify(response.tracks.items[0].album.artists[0].name, null, 2) +\n \"\\nSong Name: \" + JSON.stringify(response.tracks.items[0].name, null, 2) +\n \"\\nPreview Link: \" + JSON.stringify(response.tracks.items[0].album.artists[0].external_urls.spotify, null, 2) +\n \"\\nAlbum: \" + JSON.stringify(response.tracks.items[0].album.name, null, 2));\n })\n .catch(function(err){\n console.log(err);\n });\n \n }", "title": "" }, { "docid": "ecb08fa45c16d8bb34423ff825b5cfea", "score": "0.5945904", "text": "function search(query, callback) {\n request.get({\n uri: \"https://\" + config.HUMMINGBIRD_HOST_V1 + \n config.HUMMINGBIRD_SEARCH + \"?query=\" + query,\n headers: {\n 'X-Mashape-Key': creds.HUMMINGBIRD_API_KEY,\n 'Content-Type': \"application/x-www-form-urlencoded\"\n }\n }, function(err, res, body) {\n if(err) {\n if(res) {\n callback(\"Request error: \" + err + \", \" + res.statusCode, body);\n }\n else {\n callback(\"Connection error: not connected to internet\", body);\n }\n }\n else {\n callback(null, JSON.parse(body));\n }\n });\n}", "title": "" }, { "docid": "8645b87612821dc5792ad917fd7567fc", "score": "0.59438276", "text": "function song() {\n let songName = userInput;\n if (!songName) { songName = \"the sign ace of base\" }; //short circuit conditional for if user does not input a song\n spotify\n .search({ type: 'track', query: songName })\n .then(function (response) {\n for (let i = 0; i < 1; i++) {\n console.log(\"Artist: \", response.tracks.items[i].album.artists[0].name);\n console.log(\"Song: \", response.tracks.items[i].name);\n console.log(\"Album: \", response.tracks.items[i].album.name);\n console.log(\"Preview: \", response.tracks.items[i].preview_url);\n }\n })\n .catch(function (err) {\n console.log(err);\n });\n}", "title": "" }, { "docid": "27d4f003dde359ba44f0ebc4834f044c", "score": "0.59436363", "text": "function songLookup() {\n let song = wordInput[3];\n //Check if Search Song is not empty\n if (song != undefined) {\n //Loop thru and build query if more than one word search\n for (let i = 3; i < wordInput.length; i++) {\n if (i > 3 && i < wordInput.length) {\n song = song + \" \" + wordInput[i];\n } else {\n song = wordInput[3];\n }\n }\n //Replacing the song query by \"The Sign\" if empty \n } else {\n song = \"The Sign\";\n }\n\n spotify.search({ type: 'track', query: song, limit: 10 }, function(err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n\n //If no results are found\n if (data.tracks.total == 0) {\n console.log(\"Sorry, no results found!..Try another song\");\n }\n\n let TrackSearchResult = data.tracks.items\n for (let i = 0; i < TrackSearchResult.length; i++) {\n console.log(\"--------------------\");\n console.log(\"Artist: \" + JSON.stringify(TrackSearchResult[i].artists[0].name));\n console.log(\"Song: \" + JSON.stringify(TrackSearchResult[i].name));\n console.log(\"Preview Link: \" + JSON.stringify(TrackSearchResult[i].preview_url));\n console.log(\"Album: \" + JSON.stringify(TrackSearchResult[i].album.name));\n }\n });\n}", "title": "" }, { "docid": "3b196b1ebd5b2c3d31e19975ec7f84eb", "score": "0.59369075", "text": "function playerSearchListener() {\n $('.ui.search')\n .search({\n onSelect: function(result){\n // Set player info from search result\n var player_id = result.player_id;\n var player_text = result.full_name;\n var event_type = $('.filters .button.active').attr('data-value');\n var batOrPit = $('.bat-pit-switch').children('.active').attr('data-value');\n // Clear the diamond board first and then make the diamond request\n clearDiamondBoard(function(){\n requestDiamonds(player_id, player_text, event_type, batOrPit);\n });\n // Disable batting or pitching button while request is being made\n $('.bat-pit-switch').children().addClass('disabled');\n // Disable search while request is being made\n $('.ui.search .input').addClass('disabled');\n // Disable filter buttons while request is being made\n $('.filters').children().addClass('disabled');\n },\n apiSettings: {\n url: 'https://mlb-event-api.herokuapp.com/v1/players/search/{query}'\n },\n fields: {\n results : 'players',\n title : 'full_name',\n description: 'debut_year'\n },\n minCharacters: 4\n })\n ;\n }", "title": "" }, { "docid": "f2f133199cf3872c51828795a2b6188e", "score": "0.5932111", "text": "search(user, callback) {\n\t\tlet url = this.cmlURL + '?type=search&player=' + user\n\n\t\trequest(url, (error, response, body) => {\n\t\t\tlet errorValue = errorHandling(body)\n\t\t\tbody = body.split(' ')\n\t\t\tbody[0] = parseInt(body[0])\n\n\t\t\tcallback(errorValue, body)\n\t\t})\n\t}", "title": "" }, { "docid": "e30f0fbb660b1bd054784cbc8d1125c7", "score": "0.5931656", "text": "handleSearch(event){\n //trigger the Spotify object's seach method, passing the SearchBar's term state, and the App components access token state value\n this.props.searchSpotify(this.state.term, this.props.accessToken);\n //prevent default link behaviour\n event.preventDefault();\n }", "title": "" }, { "docid": "08b9d43a5cb4fb6125036196c1b517ed", "score": "0.59303117", "text": "function eventsCallback(request, response) {\n let city = request.query.searchQuery;\n const url = `http://api.eventful.com/json/events/search?app_key=${process.env.EVENTFUL_API_KEY}&location=${city}&date=Future`;\n \n superagent.get(url)\n .then(data => {\n let responseJson = JSON.parse(data.text);\n \n\n const events = responseJson.events.event.map(data => {\n return new Event(data);\n });\n response.status(200).json(events);\n })\n .catch(() => {\n errorHandler('You are SUPER WRONG!', request, response);\n });\n}", "title": "" }, { "docid": "f1605187f5b6a5e463eabf02ba769007", "score": "0.59233004", "text": "function handleSearch(event) {\n event.preventDefault();\n event.stopPropagation();\n\n // validate the search string, then clear it\n let searchStr = $('#search').val();\n if (searchStr === \"\") {\n return;\n }\n $('#search').val(\"\");\n\n // make the ajax request and handle the return states\n var $xhr = $.getJSON('https://omdb-api.now.sh/?t=' + searchStr);\n\n $xhr.done(function(data) {\n if ($xhr.status !== 200) {\n // The served an unsuccessful status code.\n alert(\"Done, but status not 200!\");\n return; // little change again\n }\n\n // call was successful, so parse the movie data and update the UI\n parseData(data);\n });\n\n $xhr.fail(function(err) {\n // The request was unsuccessful for some reason (ie. the server couldn't even respond).\n alert(\"Request failed!\")\n console.log(err);\n });\n }", "title": "" }, { "docid": "b348dfab7272421c1512e180c6aa80b1", "score": "0.59178853", "text": "function songs(songTitle) {\n songTitle = \"seasick yet still docked\";\n if (userInput2 !== undefined) {\n songTitle = userInput2;\n }\n console.log(\"Loading...\");\n spotify.search({ type: 'track', query: songTitle, count: 1 }, function(error, data) {\n if (error) {\n console.log(\"Oh no! An error has occured: \" + error);\n } else {\n console.log(\"----------------------------------------------------------------\");\n console.log(\"Artist: \" + data.tracks.items[0].artists[0].name);\n console.log(\"Song Name: \" + data.tracks.items[0].name);\n console.log(\"Spotify Link: \" + data.tracks.items[0].external_urls.spotify);\n console.log(\"Album Name: \" + data.tracks.items[0].album.name);\n console.log(\"----------------------------------------------------------------\");\n }\n });\n}", "title": "" }, { "docid": "71624d6f34c4ea280a65c3f29a53121b", "score": "0.5916525", "text": "function searchSpotify(search) {\n spotify.search({\n type: \"track\",\n query: search\n }, function (err, data) {\n if (err) {\n return console.log(\"Error occurred: \" + err);\n }\n let response = data.tracks.items[0];\n console.log(\"Artist: \" + response.artists[0].name);\n console.log(\"Song Name: \" + response.name);\n console.log(\"URL: \" + response.preview_url);\n console.log(\"Album: \" + response.album.name);\n });\n}", "title": "" }, { "docid": "82892b1612157eca68b5f78b3ab51bdf", "score": "0.5914401", "text": "function search () {\n // $(\".online, .offline, .unavailable\").empty();\n //showAll(); \n var searchTerm = $(\"#searchTerm\").val();\n var user = searchQuery.replace(/[^A-Z0-9_]/ig, \"\");\n console.log(\"This is the user: \", user);\n $.ajax({\n url: \"https://api.twitch.tv/kraken/streams/\" + user,\n dataType: \"jsonp\",\n data: {\n format: \"json\"\n },\n success: function (data) {\n fetchData(data); \n }\n });\n }", "title": "" }, { "docid": "bc661be407b9be3696e5eb0e344d049f", "score": "0.59090346", "text": "function getSong(trackName) { \n// search: function({ type: 'artist OR album OR track', query: 'My search query', limit: 20 }, callback);\nspotify.search({ type: 'track', query: trackName, limit: 1, popularity: 80 }, function(err, data) {\n if (!err) {\n var spot = data.tracks.items[0]; \n\n console.log(\"\\n=============\\n\");\n console.log(\"Artist: \" + spot.album.artists[0].name); \n console.log(\"Release Date: \" + spot.album.release_date);\n console.log(\"Album Name: \" + spot.name); \n console.log(\"External URL: \" + spot.album.artists[0].href);\n console.log(\"\\n=============\\n\");\n var spotifyInfo = \" || \" + spot.album.artists[0].name + \" \" + spot.album.release_date + \" \" + spot.name + \" \" + spot.album.artists[0].href + \" || \";\n writeToLog(spotifyInfo); \n } else { \n console.log(\"error occured: \" + err); \n }\n }); //spotify.search close bracket\n}// end of getSong function; ", "title": "" }, { "docid": "72cbb849aac7e7c7825b1e98a392836d", "score": "0.59026545", "text": "function search(query,callback){\n\n var req = unirest(\"GET\", \"https://deezerdevs-deezer.p.rapidapi.com/search\");\n\n req.query({\n \"q\": query\n });\n\n req.headers({\n \"x-rapidapi-host\": \"deezerdevs-deezer.p.rapidapi.com\",\n \"x-rapidapi-key\": process.env.API_KEY,\n \"useQueryString\": true\n });\n\n req.end(function (res) {\n if (res.error) throw new Error(res.error);\n else{\n // console.log(res.body);\n callback(res.body);\n }\n });\n}", "title": "" }, { "docid": "a0c7e614ce91db210b265e1fef67cc8e", "score": "0.58925456", "text": "function spotifyResp() {\n\tif (input !== \"%5B%5D\"){\n\t\tconsole.log(input)\n\t\tspotify.search({type: 'track', query: \"'\" + input + \"'\"}, function(err,data) {\n\t\t\tif (err) {\n \treturn console.log('Error occurred: ' + err);\n \t}\n \tvar track = data.tracks.items[0];\n \tconsole.log(\"----------------------\")\n \tconsole.log(\"Artists: \" + track.artists[0].name)\n \tconsole.log(\"Album: \" + track.album.name)\n \tconsole.log(\"Track Name: \" + track.name);\n \tconsole.log(\"Preview: \" + track.href);\n \tconsole.log(\"----------------------\")\n });\n } else {\n \tinput = \"The Sign\";\n \tconsole.log(input)\n\tspotify.search({type: 'track', query: \"the+sign\"}, function(err,data) {\n\t\tif (err) {\n\treturn console.log('Error occurred: ' + err);\n\t}\n \tvar track = data.tracks.items[0];\n \tconsole.log(\"----------------------\")\n \tconsole.log(\"Artists: \" + track.artists[0].name)\n \tconsole.log(\"Album: \" + track.album.name)\n \tconsole.log(\"Track Name: \" + track.name);\n \tconsole.log(\"Preview: \" + track.href);\n \tconsole.log(\"----------------------\")\n });\n};\n}", "title": "" }, { "docid": "b5a6873b5f5954e28dce625426385ab6", "score": "0.58734316", "text": "function search() {\n hideMessage();\n searching = true;\n q = $('#query').val();\n requestVideos(q);\n}", "title": "" }, { "docid": "469db26c90aa981df44d452f19dfaf14", "score": "0.5871621", "text": "function searchResults(request, response) {\n console.log('in search results function');\n let url = 'https://www.googleapis.com/books/v1/volumes?q=';\n console.log(request.body);\n console.log(request.body.search);\n if (request.body.search[1] === 'title') { url += `+intitle:${request.body.search[0]}`; }\n if (request.body.search[1] === 'author') { url += `+inauthors:${request.body.search[0]}`; }\n console.log(url);\n try{\n superagent.get(url)\n .then(apiResponse => apiResponse.body.items.map(bookResult => new Book(bookResult.volumeInfo)))\n .then(results => response.render('pages/searches/show', { searchResults: results }));\n } catch(err) {\n response.render('pages/error', {err: err});\n }\n}", "title": "" }, { "docid": "9ffc830fea829c0b49dc774e22050bfa", "score": "0.5851938", "text": "function callApi(searchTerm, callback){\n const query = {\n q: searchTerm,\n _app_key: X-Yummly-App-Key,\n _app_id: X-Yummly-App-ID\n };\n searchedTerm = searchTerm;\n $.getJSON(URL, query, callback)\n}", "title": "" }, { "docid": "90e897f9a452bc0fa21b53e90766c64f", "score": "0.5847956", "text": "function getSong(song) {\n console.log(\"Spotify function\");\n\n //Search terms\n var searchTrack;\n if(argTwo === undefined){\n searchTrack = \"The Sign\";\n }else {\n searchTrack = argTwo;\n }\n //Spotify search\n spotify.search({type:\"track\", query:searchTrack}, function(err, data){\n if (err){\n console.log(\"Error occured \" + err);\n return;\n }else {\n console.log(\"Artist: \" + data.tracks.items[0].artists[0].name);\n\t console.log(\"Song: \" + data.tracks.items[0].name);\n\t console.log(\"Album: \" + data.tracks.items[0].album.name);\n\t console.log(\"Preview Here: \" + data.tracks.items[0].preview_url);\n }\n });\n}", "title": "" }, { "docid": "fe1bded4e8ce1d0b3592a90e10d4529a", "score": "0.58471656", "text": "function searchSubmit(e) {\n var formData = myApp.formToJSON('#search');\n e.preventDefault();\n if (!formData.term) {\n myApp.alert('Please enter a search term', 'Search Error');\n return;\n }\n\n if (formData.filter === 'all') {\n formData.term = formData.term.trim();\n } else {\n formData.term = formData.filter + ':' + formData.term.trim();\n }\n delete formData.filter;\n formData.media = 'music';\n $$('input').blur();\n myApp.showPreloader('Searching');\n $$.ajax({\n dataType: 'json',\n data: formData,\n processData: true,\n url: 'https://itunes.apple.com/search',\n success: function searchSuccess(resp) {\n var results = { count: 0 };\n results.count = resp.resultCount === 25 ? \"25 (max)\" : resp.resultCount;\n results.items = resp.results;\n myApp.hidePreloader();\n mainView.router.load({\n template: myApp.templates.results,\n context: {\n tracks: results,\n },\n });\n },\n error: function searchError(xhr, err) {\n myApp.hidePreloader();\n myApp.alert('An error has occurred', 'Search Error');\n console.error(\"Error on ajax call: \" + err);\n console.log(JSON.stringify(xhr));\n }\n });\n}", "title": "" }, { "docid": "5d47403e03c67b3203a402bf90fa240b", "score": "0.58407766", "text": "function search() {\n document.querySelector('#searchResults').innerHTML = ''\n var searchTerm = document.querySelector('#search_input').value\n getEtsyData(searchTerm)\n\n // fetch('https://thinksaydo.com/tiyproxy.php?url=' + encodeURIComponent('https://openapi.etsy.com/v2/listings/active?api_key=h9oq2yf3twf4ziejn10b717i&keywords=' + encodeURIComponent(searchTerm) + '&includes=Images,Shop'))\n // .then(response => response.json())\n // .then(response => createResultCard(response.results))\n}", "title": "" }, { "docid": "06c7b4e433162cfcf5eeefea44cc2991", "score": "0.5840417", "text": "function onSearchResponse(response) {\n showResponse(response);\n\n}", "title": "" }, { "docid": "06c7b4e433162cfcf5eeefea44cc2991", "score": "0.5840417", "text": "function onSearchResponse(response) {\n showResponse(response);\n\n}", "title": "" }, { "docid": "e2a746252bdda06f9bffd678c474d3a9", "score": "0.5840375", "text": "function searchSong(){ \n var name= $(\"#songName\").val();\n \n var url=\"http://ws.spotify.com/search/1/track.json?q=\"+name;\n url=encodeURI(url);\n $.ajax({\n url: url,\n dataType: \"json\",\n success: function(data, textStatus, jqXHR){\n \n fillResults(data);\n },\n error: function(jqXHR, textStatus, errorThrown){\n alert('login error: ' + textStatus);\n }\n });\n \n}", "title": "" }, { "docid": "9abbe425f5eaead1f1ab2457650b5d9e", "score": "0.5837108", "text": "function spotifyAPI() {\n\n\n spotify.search({ type: 'track', query: inputSpotify }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n\n var mainData = data.tracks.items\n // console.log(mainData[1].external_urls);\n\n for (var i = 0; i < mainData.length; i++) {\n\n // Song URL\n console.log(`Song URL: ${mainData[i].external_urls.spotify}`);\n // Album Name\n console.log(`Album Name: ${mainData[i].album.name}`);\n\n // Song Name\n var upcaseSong = inputSpotify.toUpperCase();\n console.log(`Song Name: ${upcaseSong}`);\n\n for (var j = 0; j < mainData[i].artists.length; j++) {\n\n // Artist Name(s)\n console.log(`Artist Name: ${mainData[i].artists[j].name}`);\n }\n console.log(\"\\n\");\n }\n });\n\n}", "title": "" }, { "docid": "d680c33b80cfd61d0ff31a1d00cde300", "score": "0.582747", "text": "function search(query) {\n $.ajax({\n url: \"https://api.spotify.com/v1/search?type=track,artist&q=\" + query,\n type: \"GET\",\n beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'Bearer ' + _token );},\n success: function(data) {\n $('.js-search-results').html('');\n\n if(data.tracks.items.length < 1) {\n $('.js-no-results').show();\n } else {\n $('.js-no-results').hide();\n }\n\n $.each(data.tracks.items, function(key, track) {\n\n $('.js-search-results').append('' +\n '<li>' +\n '<a href=\"#\" data-id=\"' + track.uri + '\">' +\n '<div class=\"album-art\">' +\n '<img src=\"' + track.album.images[0].url + '\" alt=\"\">' +\n '</div>' +\n '<div class=\"track-details\">' +\n '<div>' +\n '<span class=\"title\">' + track.name + '</span>' +\n '<span class=\"artist\">' + track.artists[0].name + '</span>' +\n '</div>' +\n '</div>' +\n '</a>' +\n '</li>' +\n '');\n });\n }\n });\n}", "title": "" }, { "docid": "d6bcb76e62f2a39640e8a58c8a04b9bf", "score": "0.5825302", "text": "function search(query) {\n $.post('/rest/search', {query: query}, function(results) {\n /* pass results to method that visualises them on a result page */\n listSearchResults(results, query);\n });\n}", "title": "" }, { "docid": "9d74680f83cacbba88d18efba58c10b6", "score": "0.5824824", "text": "function _doSongSearch(song) {\n if (!_isValidArtistInfo(song)) {\n return;\n }\n $.get( \"https://api.spotify.com/v1/search?q=\"+song+\"&type=track&limit=1\", function( data ) {\n window.location.href = data[\"tracks\"][\"items\"][0][\"external_urls\"][\"spotify\"];\n });\n}", "title": "" }, { "docid": "9d74680f83cacbba88d18efba58c10b6", "score": "0.5824824", "text": "function _doSongSearch(song) {\n if (!_isValidArtistInfo(song)) {\n return;\n }\n $.get( \"https://api.spotify.com/v1/search?q=\"+song+\"&type=track&limit=1\", function( data ) {\n window.location.href = data[\"tracks\"][\"items\"][0][\"external_urls\"][\"spotify\"];\n });\n}", "title": "" }, { "docid": "59217219a13ab2d0de5ab3a99c7507a6", "score": "0.58247876", "text": "function useSpotify() {\n if (!searchTerm) {\n searchTerm = \"The Sign Ace of Base\"};\n// If no song is provided then your program will default to \"The Sign\" by Ace of Base.\n spotify\n .search({type: \"track\", query: searchTerm })\n .then(function(response) {\n console.log(\"\\n---------------------------------\")\n console.log(\"Title: \" + response.tracks.items[0].name)\n console.log(\"Performed by: \" + response.tracks.items[0].artists[0].name)\n console.log(\"Found on Album: \" + response.tracks.items[0].album.name)\n console.log(\"30-second sample at: \" + response.tracks.items[0].preview_url)\n console.log(\"---------------------------------\\n\")\n })\n}", "title": "" }, { "docid": "29153a0d83860dd9c1bbf9dd7e8241f7", "score": "0.5821524", "text": "function getSearchResults(queryStr) {\n //debugger;\n //query the SeatGeek API first\n $.ajax({\n url: queryStr,\n method: \"GET\"\n }).then(function (response) {\n //debugger;\n console.log(response);\n //check if you got any matching results\n if (response.events.length > 0) {\n //create an object to add the records to the Firebase DB\n var resultSet = response.events;\n writeRecords(resultSet, \"SeatGeek\");\n displayEventCards();\n displayGraph();\n } else {\n $(\"#events\").append('<p>' + \"No matching events found.\" + '</p>');\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //write message in user communication box that no matching events were found\n ///////////////////////////////////////////////////////////////////////////////////////////////////\n }\n })\n //then query others to add records to the DB\n\n}", "title": "" }, { "docid": "4bd4edd02aa4d15e43a780313807c077", "score": "0.5813775", "text": "function searchAlbumsForThisArtist(event) {\n\n\tlet artistStringInput = document.querySelector(\".artist-to-search-input\").value\n\tlet mutatedArtistString = artistStringInput.replace(/\\s+/g, '');\n\n\tfetch(`http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=${mutatedArtistString}&api_key=56db8dc89ddf7721c47c718da7786420&format=json&limit=15\"`)\n\t.then(res => res.json())\n\t.then(albumData => putAlbumsInDropDown(albumData[\"topalbums\"].album))\n\n}", "title": "" }, { "docid": "82b6f4f3cdcea422e5f1c5c29e3525e1", "score": "0.581371", "text": "function handleSearch(e) {\n e.preventDefault()\n\n // reset default values\n setShowResults(false);\n setHideSpinner(false);\n setPageNum(1);\n\n axios\n .get(\"http://localhost:8000/api/docs/?q=\"+query)\n .then(res => {\n let data = res.data;\n // extract time and results\n let time = data[0];\n let results = data[1];\n\n // set appropriate values from request\n setResults(results);\n setTimeTaken(time);\n \n // set appropriate flags\n setHideSpinner(true);\n setShowResults(true);\n\n }\n )\n .catch(err => {\n // if error found, hide the spinner \n console.log(err);\n setHideSpinner(true); \n })\n }", "title": "" }, { "docid": "c3cda2d99a309f6e67b47070f3d8180b", "score": "0.581104", "text": "function getDataFromApi (query, displayGPartySearchData) {\n const url ='https://api.guitarparty.com/v2/songs/?query=' + query;\n\n $.ajax({\n url: url,\n headers: {\"Guitarparty-Api-Key\": \"eeba69898254c9808d08202bc78e91b944bef5d0\"},\n type: 'GET',\n success: displayGPartySearchData\n });\n}", "title": "" }, { "docid": "6a81d0ea55077f28e530b3467c74f2b4", "score": "0.58098596", "text": "@action\n async onSearch() {\n this.loading = 'Searching agencies'\n const { data: fetchedAgencies, error, message } = await api.search({\n location: this.location, services: this.services\n })\n this.loading = false\n this.error = error\n this.notification = message\n if (!error) {\n fetchedAgencies.forEach(json => this.updateFromServer(json))\n }\n }", "title": "" }, { "docid": "96bef8d060e0acd7235cc52cc5a57b49", "score": "0.5808616", "text": "function spotifySearch(mediaTitle) {\n\n ////////// START OF REQUEST ///////////\n\n var Spotify = require('node-spotify-api');\n\n var spotify = new Spotify({\n\n id: keysToTwit.spotifyKeys.client_id,\n secret: keysToTwit.spotifyKeys.client_secret\n\n });\n\n if (mediaTitle === undefined) { // Returns Ace of Base's 'The Sign', if no song entered\n\n\n spotify.search({\n type: 'track',\n query: '\"the sign\"',\n limit: 1\n }, function(err, data) { \n\n if (!err) {\n\n var strungSpot = JSON.stringify(data, null, 2);\n // console.log(strungSpot); \n\n console.log(\"==============\");\n console.log(\"CONGRATULATIONS! You found the secret song!\");\n console.log(\" \");\n console.log(\"Artist: \" + data.tracks.items[0].artists[0].name);\n console.log(\"Album: \" + data.tracks.items[0].album.name);\n console.log(\"Song: \" + data.tracks.items[0].name);\n console.log(\"Preview Link:\");\n console.log(data.tracks.items[0].preview_url);\n console.log(\"==============\");\n\n }\n });\n\n } else { // Returns track info for song entered\n\n spotify.search({\n type: 'track',\n query: mediaTitle,\n limit: 1\n }, function(err, data) {\n\n if (!err) {\n\n var strungSpot = JSON.stringify(data, null, 2);\n\n console.log(\"==============\");\n console.log(\"Artist: \" + data.tracks.items[0].artists[0].name);\n console.log(\"Album: \" + data.tracks.items[0].album.name);\n console.log(\"Song: \" + data.tracks.items[0].name);\n console.log(\"Preview Link:\");\n console.log(data.tracks.items[0].preview_url);\n console.log(\"==============\");\n\n }\n });\n\n }\n}", "title": "" }, { "docid": "afbcfbae403a523a76d8b5e9c30665ed", "score": "0.5802542", "text": "_search(value) {\n this.send('searchIncident', value);\n }", "title": "" }, { "docid": "cd8eb4ea793ea03fbdf404bb9c4ec365", "score": "0.5799937", "text": "function doStuff(processName, query){\n\tif(processName === 'spotify-this-song'){\n\t\tif(query === undefined){\n\t\t\tquery = 'The Sign Ace';\n\t\t}\n\t\tvar spotify = new Spotify({\n\t\t\tid: apiKeys.spotifyKeys.clientID,\n\t\t\tsecret: apiKeys.spotifyKeys.clientSecret\n\t\t});\n\t\tspotify.search({type: 'track', query: query}, function(err, data){\n\t\t\tif(err){\n\t\t\t\treturn console.log('Error ' + err);\n\t\t\t}\n\t\t\trequestData.artists = [];\n\t\t\trequestData.songName = data.tracks.items[0].name;\n\t\t\trequestData.url = data.tracks.items[0].external_urls.spotify;\n\t\t\trequestData.album = data.tracks.items[0].album.name;\n\t\t\tfor (var i = 0; i < data.tracks.items[0].artists.length; i++){\n\t\t\t\trequestData.artists.push(data.tracks.items[0].artists[i].name);\n\t\t\t\tconsole.log(\"Artist: \" + requestData.artists[i]);\n\t\t\t}\n\t\t\tconsole.log(\"Song: \" + requestData.songName + \"\\nPreview Link: \" + requestData.url + \"\\nAlbum: \" + requestData.album);\n\t\t\tlogData();\n\t\t})\n\t}\n\telse if(processName === 'my-tweets'){\n\t\tvar userName = {screen_name: 'umerjrathore'};\n\t\tvar twitter = new Twitter({\n\t\t\tconsumer_key: apiKeys.twitterKeys.consumer_key,\n\t\t\tconsumer_secret: apiKeys.twitterKeys.consumer_secret,\n\t\t\taccess_token_key: apiKeys.twitterKeys.access_token_key,\n\t\t\taccess_token_secret: apiKeys.twitterKeys.access_token_secret\n\t\t});\n\t\ttwitter.get('statuses/user_timeline', userName, function(error, tweets, response){\n\t\t\tif(!error){\n\t\t\t\tvar requestedTweets = parseInt(query);\n\t\t\t\tvar numTweets = 0;\n\t\t\t\t/*The logic for the user defined number of Tweets checks if the user actually entered a query and, if they did, that it is actually a number. If the user did not enter a number, then the default return number of tweets is 20, unless the number of tweets in the returned request is less than 20, then the number of tweets to return is the length of the tweets array returned from the request. \n\n\t\t\t\tIf the user did input a number greater than 0, then it is checked against the length of the returned tweets array. If the tweets array's length is greater than the user requested number of tweets, then we know that we have enough tweets to show the user. Another additional check limits the total number of tweets shown to the user to be 20 or less. If the user inputs a number greater than the length of the tweets array, then, if the tweets array length is 20 or more, then the number of returned tweets is 20. If the tweets array length is less than 20, then the number of returned tweets is the length of the tweets array.*/\n\t\t\t\tif(query != undefined && requestedTweets != 'NaN' && requestedTweets > 0){\n\t\t\t\t\tif(tweets.length >= requestedTweets){\n\t\t\t\t\t\tif(requestedTweets < 20){\n\t\t\t\t\t\t\tnumTweets = requestedTweets;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tnumTweets = 20;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if(tweets.length >= 20){\n\t\t\t\t\t\tnumTweets = 20;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tnumTweets = tweets.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(tweets.length < 20){\n\t\t\t\t\t\tnumTweets = tweets.length;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tnumTweets = 20;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trequestData.tweets = [];\n\t\t\t\tfor (var i = 0; i < numTweets; i++){\n\t\t\t\t\trequestData.tweets.push(tweets[i].text)\n\t\t\t\t\tconsole.log(\"Tweet number \" + (i+1) + \": \" + requestData.tweets[i]);\n\t\t\t\t}\n\t\t\t\tlogData();\n\t\t\t}\n\t\t})\n\t}\n\telse if(processName === 'movie-this'){\n\t\tif(query === undefined){\n\t\t\tquery = \"Mr. Nobody\";\n\t\t}\n\t\tvar movieName = query.split(\" \").join(\"+\");\n\t\tvar omdbURL = \"http://www.omdbapi.com/?t=\" + movieName + \"&y=&plot=short&apikey=40e9cece\"\n\t\tomdb(omdbURL, function(error, response, body){\n\t\t\tif (!error && response.statusCode === 200) {\n\t\t\t\trequestData.title = JSON.parse(body).Title;\n\t\t\t\trequestData.year = JSON.parse(body).Year;\n\t\t\t\trequestData.imdb = JSON.parse(body).Ratings[0].Value;\n\t\t\t\trequestData.rt = JSON.parse(body).Ratings[1].Value;\n\t\t\t\trequestData.country = JSON.parse(body).Country;\n\t\t\t\trequestData.language = JSON.parse(body).Language;\n\t\t\t\trequestData.plot = JSON.parse(body).Plot;\n\t\t\t\trequestData.actors = JSON.parse(body).Actors;\n\t\t\t\tconsole.log(\"Title: \" + requestData.title + \"\\nRelease Year: \" + requestData.year + \"\\nIMDB Rating: \" + requestData.imdb + \"\\nRotten Tomato Score: \" + requestData.rt + \"\\nProduction Country: \" + requestData.country + \"\\nMovie Language: \" + requestData.language + \"\\nActors: \" + requestData.actors + \"\\nMovie Plot: \" + requestData.plot);\n\t\t\t\tlogData();\n\t\t\t}\n\t\t})\n\t}\n\telse{\n\t\tconsole.log(\"Please enter a valid command.\");\n\t}\n}", "title": "" }, { "docid": "e9ae2749265daef7d6cd56faa75351b6", "score": "0.5798704", "text": "function searchSpotify() {\n //Set up a variable to capture the track the user wants to search for\n var titleTrack = \"\";\n\n //Put arguments in an array\n var inputs = process.argv;\n\n //This will be an array of album objects\n var albumList = [];\n\n //Capture the track we're looking for\n for (var i = 3; i < inputs.length; i++) {\n titleTrack += inputs[i] + \" \";\n };\n\n //Trim the space off the end of the title so the quotation marks don't look stupid\n titleTrack = titleTrack.trim();\n\n //Add inputs to the log file\n fs.appendFile(\"log.txt\", [\"\\n\", process.argv[2], titleTrack], function(err) {\n if (err) throw err;\n })\n\n //If no selection was made (i.e. inputs[3]), run the aceOfBase fx and stop this fx.\n if (!inputs[3]) {\n console.log(colors.blue(\"\\n************************************************************************************************************\\n\"));\n console.log(colors.red(\"You didn't select a song! Try this one instead!\")); \n aceOfBase();\n return;\n }\n\n //Add the song to the array so it doesn't just give you Ace of Base\n albumList[0] = titleTrack;\n\n //Search Spotify using the keys (S)\n S.search({type: 'track', query: titleTrack, limit: 2}, function(err, data) {\n \n //Check for errors\n if (err) {\n console.log(colors.blue(\"\\n************************************************************************************************************\\n\"));\n console.log(colors.red(\"That's not a real song! Try this one instead!\")); \n aceOfBase();\n return;\n };\n\n //Set up a variable to navigate through the docs more easily\n var band = data.tracks.items;\n\n //Check to make sure a song came back. If not, run the fx to throw in Ace of Base\n if (albumList.length == 0) {\n checkDefault(albumList);\n }\n\n else {\n\n //Change first letter of each word to uppercase\n var splitStr = titleTrack.toLowerCase().split(' ');\n for (var i = 0; i < splitStr.length; i++) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); \n }\n // Directly return the joined string\n titleTrack = splitStr.join(' '); \n\n //Display the first return song\n console.log(colors.blue(\"\\n************************************************************************************************************\\n\"));\n console.log(\"------------MOST POPULAR------------\".america);\n console.log(\"\\n\" + '\"'.blue + (titleTrack + '\"').blue + \" by: \" + colors.blue(band[0].album.artists[0].name)); \n console.log(\"\\nOff the album: \" + colors.blue(band[0].album.name));\n //Check to see if there's a preview URL. If not, offer the full album\n if (band[0].preview_url != null) {\n console.log(\"\\nCheck out a clip here!\");\n console.log(colors.blue(band[0].preview_url));\n }\n else {\n console.log(\"\\nNo preview available, but check out the full album w/ your Spotify account here!\");\n console.log(colors.blue(band[0].external_urls.spotify));\n console.log(colors.blue.bold(\"\\n****************************************************************************************************************\"));\n }\n\n //Display the second return song, assuming there is one. If not, just throw some lines out there.\n if (band[1] != null) {\n console.log(\"\\n------------RUNNER UP------------\".america);\n console.log(\"\\n\" + '\"'.yellow.bold + (titleTrack + '\"').yellow.bold + \" by: \" + colors.yellow.bold(band[1].album.artists[0].name)); \n console.log(\"\\nOff the album: \" + colors.yellow.bold(band[1].album.name));\n //Check to see if there's a preview URL. If not, offer the full album\n if (band[1].preview_url != null) { \n console.log(\"\\nCheck out a clip here!\");\n console.log(colors.yellow.bold(band[1].preview_url));\n console.log(colors.yellow.bold(\"\\n****************************************************************************************************************\"));\n }\n else {\n console.log(\"\\nNo preview available, but check out the full album w/ your Spotify account here!\");\n console.log(colors.yellow(band[1].external_urls.spotify));\n console.log(colors.yellow.bold(\"\\n****************************************************************************************************************\"));\n } \n }\n else {\n console.log(colors.blue(\"\\n*************************************************************************************************************\\n\"));\n } \n }\n }); //End Spotify Search\n}", "title": "" }, { "docid": "f194eebf655f45d28dfa53d4a03449ea", "score": "0.5790421", "text": "function findTracks() {\n\tvar inputValue = $(\"#js-input-value\").val();\n\n\t$.ajax({\n\t\turl: `https://api.spotify.com/v1/search?q=${inputValue}&type=track`,\n\t\tsuccess: function(data) {\n\t\t\t// console.log(data);\n\t\t\t$(\".js-search-form\").trigger(\"reset\");\n\t\t\tdisplayTracks(data.tracks.items[0]);\n\t\t\t\n\t\t\tvar allTracks = data.tracks.items;\n\t\t\tdisplayAllTracks(allTracks);\n\t\t\t\n\t\t},\n\t\terror: function(error) {\n\t\t\tconsole.log(\"ERROR\");\n\t\t},\n\t});\n}", "title": "" }, { "docid": "819cafa5f761dfcb4ecfbda13a596f13", "score": "0.57877606", "text": "function doSearch(title) {\n var options = {\n type: 'track',\n query: title,\n limit: 5\n }\n query = \"track:\" + title;\n\n if (!title) {\n // console.log(\"empty !\");\n options.query = \"artist:Ace%20Of%20Base\";\n options.query += \"%20track:The%20Sign\";\n options.query += \"%20album:The%20Sign\";\n options.limit = 1;\n };\n\n spotify.search(options, function (err, data) {\n // handle the error\n if (err) {\n return console.log('Error occurred: ' + err);\n\n }\n //if no error continue to log the results\n // console.log(data);\n var trackArray = data.tracks.items;\n console.log(\"\");\n console.log(\"\");\n console.log(\"\");\n console.log(\"********************Song Information Here:****************************\")\n console.log(\"\");\n console.log(\"-----------------------------------------------------\");\n //loop through the results of the search\n for (i = 0; i < trackArray.length; i++) {\n for (x = 0; x < trackArray[i].artists.length; x++) {\n console.log(\" Artist : \" + \" \" + trackArray[i].artists[x].name);\n };\n console.log(\" Song Name: \" + trackArray[i].name);\n // console.log(\" Link: \" + trackArray[i].href);\n console.log(\" Url \" + trackArray[i].external_urls.spotify);\n console.log(\" Album: \" + trackArray[i].album.name);\n\n console.log(\"\");\n console.log(\"-----------------------------------------------------\");\n // objects.items.artist\n }\n\n });\n\n}", "title": "" }, { "docid": "eaac1ea9d981bd37e943b734a90b28c7", "score": "0.5785324", "text": "function getTracks(){\n\tvar value = $(\"#textInput\").val();\n\n\t$.get(('https://api.soundcloud.com/resolve?url=' + value + '&client_id=58479d90aaeccef837849be331f895ca'), function (result) {\n\t\tgetEmbeddedPlayer(result.id, value, \"#soundcloudContainer\");\n\t\tinit(result.stream_url);\n\t}, \"json\");\n}", "title": "" }, { "docid": "d087645dfb1632007bfde2748f92246a", "score": "0.57852495", "text": "function Song(a, limit, val){\n console.log(action+ \" \"+ a)\n clientSpotify.search({type: 'track', query: a, limit: limit}, function(err, data){\n if(err){\n console.log(\"error occurred: \"+ err);\n return;\n }\n if(!err){\n //var song = JSON.stringify(data.tracks.items[0].name)\n //console.log(song)\n //console.log(JSON.stringify(data))\n\n console.log(\"Artists: \"+JSON.stringify(data.tracks.items[val].artists[0].name));\n console.log(\"Song Name: \"+JSON.stringify(data.tracks.items[val].name));\n console.log(\"Song Link: \"+JSON.stringify(data.tracks.items[val].external_urls.spotify));\n console.log(\"Album: \"+ JSON.stringify(data.tracks.items[val].album.name));\n //TODO check object response and formate output\n }\n })\n }", "title": "" }, { "docid": "3d65a252819118722a85409586940ec7", "score": "0.57847023", "text": "function spotifyThis(query) {\n\n\t// variables to search for either userinput or default of \"ace of base\"\n\tvar song = query || \"Ace of Base\";\n\tvar spotify = new Spotify({\n\t\tid: \"27c69fd7ec7f4b8fb718ba9e2fa1cb3b\",\n\t\tsecret: \"eea3068a82be4215ab0334e97ed4eb38\"\n\n\t});\n\n\t// getting the info from spotify and specifically pulling the requested info\n\tspotify\n\t.search({ type: 'track', limit: 5, query: song})\n\t.then(function(response) {\n\n\t\tvar responseBody = {};\n\n\t\t//looping through spotify info to pull specific JSON items\n\t\tfor (var i=0; i < response.tracks.items.length; i++) {\n\n\t\t\tconsole.log(\"Song Name: \" + response.tracks.items[i].name);\n\t\t\tconsole.log(\"Album Name: \" + response.tracks.items[i].album.name);\n\n\t\t\tfor (var j=0; j < response.tracks.items[i].album.artists.length; j++) {\n\n\t\t\t\tconsole.log(\"Artist: \" + response.tracks.items[i].album.artists[j].name);\n\t\t\t\tconsole.log(\"Link: \" + response.tracks.items[i].album.artists[j].href);\n\t\t\t\tconsole.log(\"********************\");\n\n\n\t\t//logging all information on log.txt\n\t\tresponseBody.name = response.tracks.items[i].name;\n\t\tresponseBody.albumName = response.tracks.items[i].album.name;\n\t\tresponseBody.artistName = response.tracks.items[i].album.artists[j].name;\n\t\tresponseBody.link = response.tracks.items[i].album.artists[j].href;\n\n\t\tvar songData = JSON.stringify(responseBody) + \"\\n\";\n\n\t\tfs.appendFile('log.txt', `${songData}\\n`, function(error){\n\t\t\tif (error){\n\t\t\t\treturn console.log(\"ERROR\", error);\n\t\t\t}\n\t\t});\n\n\t\t\t}\n\t\t}\n\t})\n\t.catch(function(error) {\n\t\tconsole.log(error);\n\n\t});\n\n}", "title": "" }, { "docid": "282506c783a36a03f9e12ba09be0f2a7", "score": "0.57817495", "text": "function spotifyThisSong() {\n spotify.search({ type: 'track', query: searchTerm }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n console.log(data.tracks.items[0].artists[0].name);\n console.log(data.tracks.items[0].name);\n console.log(data.tracks.items[0].external_urls.spotify);\n console.log(data.tracks.items[0].album.name);\n });\n}", "title": "" }, { "docid": "8083ed89a5898d2e9d45aa124fa52a07", "score": "0.577609", "text": "function spot(input2){\n spotify.search({type: 'track', query: input2}, function(err, data){\n if (err) {\n console.log('Error occurred: ' + err);\n return;\n }\n\n else if (input2 == \"\" && !err && input === \"spotify-this-song\"){\n spotify.search({type: 'track', query: \"The Sign\"}, function(err, data){\n if (err) {\n console.log('Error occurred: ' + err);\n return;\n }\n console.log(\"-----------\")\n console.log(\"results\")\n console.log(\"-----------\")\n // console.log(JSON.stringify(data, null, 2));\n console.log(\"Album: \" + data.tracks.items[4].album.name);\n console.log(\"Artist: \" + data.tracks.items[4].album.artists[0].name);\n console.log(\"Song name: \" + data.tracks.items[4].name);\n console.log(\"Preview URL: \" + data.tracks.items[4].preview_url)\n console.log(\"\");\n })\n }\n\n else if (!err && input == \"spotify-this-song\") {\n for (var i = 0; i < data.tracks.items.length; i++){\n console.log(\"-----------\")\n console.log(\"results\")\n console.log(\"-----------\")\n console.log(\"Album: \" + data.tracks.items[i].album.name);\n console.log(\"Artist: \" + data.tracks.items[i].album.artists[0].name);\n console.log(\"song name: \" + data.tracks.items[i].name);\n console.log(\"Preview URL: \" + data.tracks.items[i].preview_url);\n console.log(\"\");\n }\n } \n })\n}", "title": "" }, { "docid": "e7e2f6e59ca8a7c53d87b360b8384907", "score": "0.57745063", "text": "function getInfo(event){\nfetch(`http://api.soundcloud.com/users/${token}${event}`) //API address used to grab info\n .then( function(response) {\n return response.json() //returns API in Json format\n }).then(function(data){\n\n let userID = data[0].id;\n\n TrackInfo(userID);\n\n });\n}", "title": "" }, { "docid": "b3e9ccb8715622f6b454e3a0024f9d0e", "score": "0.57742435", "text": "function spotifyThisSong() {\n action = process.argv[2];\n value = process.argv[3];\n\n if (value === undefined || value === \"\") {\n value = \"Ace of Base\"\n }\n console.log(\"Spotify's value sent is \" + value);\n\n spotify\n .search({\n type: 'track',\n query: value,\n limit: 1\n })\n .then(function (response) {\n\n let song = response.tracks.items[0]\n console.log(\"artist(s): \", song.album.artists[0].name);\n\n console.log(\"song name: \", song.name);\n console.log(\"The link for the Album is \" + song.preview_url);\n console.log(\"album: \", song.album.name);\n logger.write(\"Spotify This retrieved \" + song.name + \" \\n\");\n logger.write(\" \" + song.album.name + \" \\n \");\n logger.write(\" \" + song.preview_url + \" \\n \");\n console.log(\"===================================================================\");\n\n\n })\n .catch(function (err) {\n console.log(err)\n })\n\n}", "title": "" }, { "docid": "d6c3e0bda2209cba880f38d80bbce453", "score": "0.57678413", "text": "function searchSpotify(value) {\n $.ajax({\n url: \"/search?q=\" + value,\n success: function(response) {\n if (response.tracks.items.length > 0) {\n paintTracks(response);\n }\n else if (response.tracks.items.length == 0) {\n console.log('Bad Search: Try Again');\n }\n $('html,body').animate({\n scrollTop: $(\"#playlistsTracks\").offset().top\n },\n 'slow');\n }\n });\n }", "title": "" }, { "docid": "961983a349045fcad84fbb5cd55c7474", "score": "0.576506", "text": "function sendSearch() {\n var searchString = window.location.search;\n var userSearch = searchString.slice(14);\n\n var resultDisplayDiv = document.getElementById(\"searchResultDisplay\");\n resultDisplayDiv.innerHTML = '<h2 id=\"searchTerm\"> Search for: \"' + userSearch + '\"</h2>';\n\n var searchURL = \"https://www.cheapshark.com/api/1.0/games?title=\" + userSearch + '&limit=24';\n\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function() { \n if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {\n handleSearchResult(xmlHttp.responseText);\n }\n }\n xmlHttp.open(\"GET\", searchURL, false); // true for asynchronous, false for synchronous\n xmlHttp.send(null);\n}", "title": "" }, { "docid": "abb75212409dd3c9b033fc868c60760e", "score": "0.5760912", "text": "function handleSearchUser(event) {\r\n\r\n\tif(DEBUG) {\r\n\t\tconsole.log(\"Triggered handleSearchUser.\")\r\n\t}\r\n}", "title": "" }, { "docid": "9a2ae1d00cfd7804db976524e53c2bd8", "score": "0.5758426", "text": "function onSearchResponse(response) {\n showResponse(response);\n}", "title": "" }, { "docid": "9a2ae1d00cfd7804db976524e53c2bd8", "score": "0.5758426", "text": "function onSearchResponse(response) {\n showResponse(response);\n}", "title": "" }, { "docid": "9a2ae1d00cfd7804db976524e53c2bd8", "score": "0.5758426", "text": "function onSearchResponse(response) {\n showResponse(response);\n}", "title": "" } ]
280353ef73599b9e31cdcda58714d8f8
console.log(uniqueAges); 19.Received the distinct numbers from my array.
[ { "docid": "dbe97065ff08746b91666d396d6ce784", "score": "0.0", "text": "function words(count) { \n return count.split(\" \").length;\n}", "title": "" } ]
[ { "docid": "20603e0730749f83149f3ce3aeedaeb0", "score": "0.6975245", "text": "function uniqueValues(array) {\n console.log(uniqueValues([1, 2, 3, 4, 4, 4, 4, 5, 2, 2, 2]));\n}", "title": "" }, { "docid": "39f1189a3d7962a81b213fea6eb93b2c", "score": "0.68355", "text": "function getUniqueValues(inputArr) {\n\n }", "title": "" }, { "docid": "814539f1090adf56f932eb5a92bcd0ca", "score": "0.6743135", "text": "function uniqes(arr) {\n console.log(\"====== uniques ======\");\n console.log(arr);\n return arr.reduce((total, amount, index) => {\n if(total.indexOf(amount) < 0){ total.push(amount); }\n return total;\n }, [])\n}", "title": "" }, { "docid": "29bb488ae0b62ecf66efde151317dc93", "score": "0.64928657", "text": "function makeUnique(arr) {\r\n // Replace this comment and the next line with your code\r\n // console.log(arr);\r\n return arr.filter((v, i) => arr.indexOf(v) === i);\r\n}", "title": "" }, { "docid": "06fb8474e4af5c917671ed604a2c6c0b", "score": "0.6379836", "text": "function uniqueYears(){\n\tvar unq_Years_arr = [];\n\tvar checker = 0;\n\tconsole.log(unq_Years_arr.length);\n\tunq_Years_arr.push(data_Data[0].Year);\n\tconsole.log(unq_Years_arr);\n\tfor (var i = 0; i < data_Data.length; i++){\n\t\tchecker = 0;\n\t\tfor (var j = 0; j < unq_Years_arr.length; j++){\n\t\t\tif (data_Data[i].Year == unq_Years_arr[j]){\n\t\t\t\tchecker = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (checker == 0){\n\t\t\tunq_Years_arr.push(data_Data[i].Year);\n\t\t}\n\t}\n\tconsole.log(unq_Years_arr); // Display all the unique years\n\tupdateDropDown(\"YearDrop\",unq_Years_arr); // Updates drop down menu of Years\n}", "title": "" }, { "docid": "00968fb89a8458194446679beab95978", "score": "0.6323509", "text": "function generateNumbers(){ \n for(var i=0; i<9; i++){\n randomNum = Math.floor((Math.random() * 100)+1);\n numArray[i] = randomNum;\n }\n uniqueArray = [...new Set(numArray)];\n\n while(uniqueArray.length<9){\n uniqueArray[uniqueArray.length++] = Math.floor((Math.random() * 100)+1);\n uniqueArray = [...new Set(uniqueArray)];\n \n }\n console.log(numArray);\n console.log(uniqueArray);\n for(var i=0 ; i<9; i++){\n document.getElementById(i).textContent = uniqueArray[i];\n }\n compNum = numArray[Math.floor(Math.random() * numArray.length)-1];\n}", "title": "" }, { "docid": "40ac77637260d4926d9ac1779c6efb7c", "score": "0.6292795", "text": "function uniqueEl(inputArr){\n\tconst outputArr = [];\n\tconst mySet = new Set(inputArr);\n\tfor (var el of mySet){\n\t\tconsole.log(el);\n\t\toutputArr.push(el);\n\t}\n\t\treturn outputArr;\n}", "title": "" }, { "docid": "6712446bcfbec0b54c212524980d2dd9", "score": "0.62523025", "text": "function unique(a) {\n return a.filter((v, i, a) => a.indexOf(v) === i);\n }", "title": "" }, { "docid": "c43d8f54a014135a9db533915816d965", "score": "0.62216395", "text": "function countUniqueValues(arr){\n if(arr.length === 0){\n return 0\n } else if(arr.length===1) {\n return 1\n } else {\n let point1 = 0\n let point2 = 1\n while(point2 < arr.length){\n if(arr[point2] === arr[point1]){\n point2++ \n } else {\n ++point1\n arr[point1] = arr[point2]\n }\n }\n return arr.slice(0, point1)\n }\n}", "title": "" }, { "docid": "d7eee1f0467412eff9e7923bfa0e4f87", "score": "0.621601", "text": "function uniteUnique(arr) {\n \n let caught_numbers = [],\n length_of_args = arguments.length,\n intake = [],\n result = [];\n\n for(let i=0; i < length_of_args; i++){\n intake = intake.concat(arguments[i])\n }\n\n for(let i=0; i < intake.length; i++){\n if(!caught_numbers.includes(intake[i])){\n result.push(intake[i])\n caught_numbers.push(intake[i])\n }\n }\n // arr.forEach(element => {\n // console.log(element)\n // if(caught_numbers.includes(element) === -1){\n // caught_numbers.push(element)\n // }\n // })\n console.log(result)\n\n }", "title": "" }, { "docid": "845625fe36af760f103a276b0c6c0e2e", "score": "0.620868", "text": "function filter(arr)\n {\n const uniqueset = new Set (arr);\n console.log(uniqueset);\n const uniquearr = Array.from(uniqueset);\n console.log(uniquearr);\n return uniquearr\n }", "title": "" }, { "docid": "f95fbd893d7f6727958815d960e64409", "score": "0.6208493", "text": "function unique(arr) {\n\t\t\t\t\t\t var comparer = function compareObject(a, b) {\n\t\t\t\t\t\t\t\t if (a.suburb == b.suburb) {\n\t\t\t\t\t\t\t\t\t\t if (a.postcode < b.postcode) {\n\t\t\t\t\t\t\t\t\t\t\t\t return -1;\n\t\t\t\t\t\t\t\t\t\t } else if (a.postcode > b.postcode) {\n\t\t\t\t\t\t\t\t\t\t\t\t return 1;\n\t\t\t\t\t\t\t\t\t\t } else {\n\t\t\t\t\t\t\t\t\t\t\t\t return 0;\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t } else {\n\t\t\t\t\t\t\t\t\t\t if (a.suburb < b.suburb) {\n\t\t\t\t\t\t\t\t\t\t\t\t return -1;\n\t\t\t\t\t\t\t\t\t\t } else {\n\t\t\t\t\t\t\t\t\t\t\t\t return 1;\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\n\t\t\t\t\t\t arr.sort(comparer);\n\t\t\t\t\t\t console.log(\"Sorted: \" + JSON.stringify(arr));\n\t\t\t\t\t\t for (var i = 0; i < arr.length - 1; ++i) {\n\t\t\t\t\t\t\t\t if (comparer(arr[i], arr[i+1]) === 0) {\n\t\t\t\t\t\t\t\t\t\t arr.splice(i, 1);\n\t\t\t\t\t\t\t\t\t\t console.log(\"Splicing: \" + JSON.stringify(arr));\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t return arr;\n\t\t\t\t }", "title": "" }, { "docid": "0463ae69b78c6a8663b025e456f72a0a", "score": "0.61969334", "text": "function getUniqueValuesInArray(array)\n{\n var uniqueArray = [];\n var count = 0;\n \n for (var i = 0; i < array.length; i++)\n {\n count = 0;\n for (var j = 0; j < array.length; j++)\n {\n if (array[j] === array[i])\n count++;\n }\n if (count === 1)\n uniqueArray.push(array[i]);\n }\n //console.log(\"Array of unique values: \" + uniqueArray);\n return uniqueArray;\n}", "title": "" }, { "docid": "b744a5f2a6441f9dbcd35965ec5660c8", "score": "0.61788857", "text": "function getAdNumByAge(age) {\n var ageNum = 0;\n for (var dataItem in data) {\n if (data[dataItem].ad_target_user.age_range.max_age >= age + 5\n && data[dataItem].ad_target_user.age_range.min_age <= age) {\n ageNum++;\n }\n }\n ageArray.push([age, ageNum])\n }", "title": "" }, { "docid": "61d4c46c34406841c8db7e9631917189", "score": "0.61557454", "text": "function unique(arr) {\n return Object.keys(arr.reduce(function(o, x) {o[x]=1; return o;}, {})).map(Number);\n}", "title": "" }, { "docid": "6d4a4462673f5ce64225e54b9c2b573a", "score": "0.6146658", "text": "function unique4(arr){\n arr.sort();\n var re=[arr[0]];\n for(var i = 1; i < arr.length; i++)\n {\n if( arr[i] !== re[re.length-1])\n {\n re.push(arr[i]);\n }\n }\n return re;\n}", "title": "" }, { "docid": "363e2d45954c0267545764917263afc7", "score": "0.6110337", "text": "function missingNumbers(arr, brr) {\r\n\r\n arr.sort(function(a,b){\r\n return a-b;\r\n })\r\n brr.sort(function(a,b){\r\n return a-b;\r\n })\r\n\r\n var newar=[];\r\n var brk;\r\n for(var i=0;i<brr.length;i++){\r\n brk=0;\r\n for(var j=0;j<1;j++){\r\n if(brr[i]==arr[j]){\r\n brr.splice(i,1);\r\n arr.splice(j,1);\r\n i=i-1;\r\n \r\n \r\n }else{\r\n brk=1;\r\n \r\n }\r\n \r\n }\r\n if(brk==1){\r\n newar.push(brr[i]);\r\n console.log(newar);\r\n }\r\n \r\n } \r\n var unique = [...new Set(newar)];\r\n return unique;\r\n\r\n}", "title": "" }, { "docid": "d8e05a136ff4338b932155c111bc7d7a", "score": "0.6104746", "text": "function unique(arr) {\n var uniques = [];\n arr.forEach(function (value) {\n if (value instanceof _ParseObject2.default) {\n if (!(0, _arrayContainsObject2.default)(uniques, value)) {\n uniques.push(value);\n }\n } else {\n if (uniques.indexOf(value) < 0) {\n uniques.push(value);\n }\n }\n });\n return uniques;\n}", "title": "" }, { "docid": "10f027d309fd970280dfda4bf086640d", "score": "0.60978264", "text": "function uniqueArray(num_elements,min,max) {\n\n var temp, nums = new Array;\n\n for (var i=0; i<num_elements; i++) {\n\n while((temp=number_found(randomInt(min,max),nums))==-1);\n nums[i] = temp;\n }\n\n return (nums);\n}", "title": "" }, { "docid": "5b2a1ba53108efb693e51ac741d60091", "score": "0.6074718", "text": "function findUniq(arr) {\n let finalArr = [];\n let i = 0;\n\n while(finalArr.length !== 1 && i < arr.length){\n finalArr = arr.filter(number => number === arr[i]); \n i++;\n }\n\n if (finalArr.length === 1){\n return finalArr[0];\n } else {\n return 'There are no unique values';\n }\n}", "title": "" }, { "docid": "4ee622405b586b150832802fa85b256a", "score": "0.60571676", "text": "function uniqueElements(arg) {\n var count = arg.slice(0);\n for(var i = 0; i < arg.length; i++) {\n for(var j =0; j < arg.length; j++) {\n if(i != j && arg[i] == arg[j]) {\n count.splice(arg[j],1);\n\t\t\t\t\n }else if(i == j && arg[i] != arg[j]){\n\t\t\t\tcount.push(arg[i]);\n }\n }\n\n}\n return `old arry ${arg} \\n new array ${count}`;\n}", "title": "" }, { "docid": "607592c89879589b26318118dd526706", "score": "0.6047792", "text": "function uniqueResidences(){\n\tvar copy_RefbyYear = d3.nest() // Summarizing filtered array based on Residence Country\n\t\t\t\t.key(function(d){return d.Residence;})\n\t\t\t\t.rollup(function (v) { return d3.sum(v, function(d){return d.Refugees;});})\n\t\t\t\t.entries(data_Data);\n\tconsole.log(copy_RefbyYear);\n\tvar Resids = []; // Array containing unique residences\n\tfor (var i = 0; i < copy_RefbyYear.length; i++){\n\t\tResids.push(copy_RefbyYear[i].key);\n\t}\n\tconsole.log(Resids);\n\tupdateDropDown(\"Res1Drop\",Resids);\n\tupdateDropDown(\"Res2Drop\",Resids);\n\tupdateDropDown(\"Res3Drop\",Resids);\n\tupdateDropDown(\"Res4Drop\",Resids);\n\tupdateDropDown(\"Res5Drop\",Resids);\n}", "title": "" }, { "docid": "6e7d784a9e67c2758e67d58292d5f7eb", "score": "0.60429394", "text": "function unique(arr) {\n return [...new Set(arr)];\n }", "title": "" }, { "docid": "d520f059263418eb6ec3ee1de340f32e", "score": "0.60298973", "text": "function unique(array) {\n\tvar result = [];\n\tfor (var i=0; i<array.length; i++){\n\t\tif (result.indexOf(array[i]) === -1) {\n\t\t\tresult.push(array[i]);\n\t\t}\n\t}return result;\n}", "title": "" }, { "docid": "026092db7e9dc0968b0f772b5b4d7a26", "score": "0.60216534", "text": "function uniqueValues(arr){\n\n return new Set(arr).size\n}", "title": "" }, { "docid": "8a01ee6081ecef19d844cc7abc6d7fb5", "score": "0.60134864", "text": "function unique(arr){\n/// unique([1,2,1,1,1,2,3,4]) === { 1:4, 2:2, 3:1, 4:1 }\n\n var value, counts = {};\n var i, l = arr.length;\n for( i=0; i<l; i+=1) {\n value = arr[i];\n if( counts[value] ){\n counts[value] += 1;\n }else{\n counts[value] = 1;\n }\n }\n\n return counts;\n}", "title": "" }, { "docid": "ffd315456ed2190597c179ccc4dbbc43", "score": "0.6005567", "text": "function uniqueValues(arr) {\n\tconst s = new Set(arr);\n\treturn s.size;\n}", "title": "" }, { "docid": "f482e2374baa7ef76408c659bb77b9bf", "score": "0.5997746", "text": "_getUniqueRatingValues(array2D) {\n let mergedArray = [];\n array2D.forEach(arr => mergedArray = mergedArray.concat(arr));\n let result = [... new Set(mergedArray)];\n result = result.filter(val => !this._isEmptyItemValue(val));\n return result.sort();\n }", "title": "" }, { "docid": "5548a112dcf1f1afe3e333a0d722f630", "score": "0.5975757", "text": "function uniqueArr(a) {\n var temp = [];\n for(i=0;i<a.length;i++){\n if(!contains(temp, a[i])){\n //temp.length+=1;\n temp.push(a[i]);\n }\n }\n return temp;\n}", "title": "" }, { "docid": "75756b5a8fb73c71067a31d866020478", "score": "0.59729266", "text": "function uniq(array) {\n var result = array.slice();\n\n for (var i = 0; i < result.length; i++) {\n if (result.indexOf(result[i], i + 1) !== -1) {\n result.splice(i--, 1);\n }\n }\n return result;\n }", "title": "" }, { "docid": "0620e24516ccb11eb5d9f0ccb12e30da", "score": "0.5968171", "text": "function MC_unique(a) {\r\n var r = new Array();\r\n o:for(var i = 0, n = a.length; i < n; i++) {\r\n for(var x = 0, y = r.length; x < y; x++)\r\n if(r[x]==a[i]) continue o;\r\n r[r.length] = a[i];\r\n }\r\n return r;\r\n}", "title": "" }, { "docid": "b14eea2d1e1222090b5add77d9a0bc59", "score": "0.59677356", "text": "function uniqueCount(array) {\r\n\tnewArray = [];\r\n\tuniqueArray = [];\r\n\tcountArray = [];\r\n\r\n\tfor (var ar = 0; ar < array.length; ar++) {\r\n\t\tif ($.inArray(array[ar], uniqueArray) == -1) {\r\n\t\t\tuniqueArray.push(array[ar]);\r\n\t\t\tcountArray.push(1);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcountArray[$.inArray(array[ar], uniqueArray)]++;\r\n\t\t}\r\n\t};\r\n\r\n\tfor (var ar = 0; ar < uniqueArray.length; ar++) {\r\n\t\tnewArray[ar] = [uniqueArray[ar], countArray[ar]];\r\n\t};\r\n\r\n\treturn newArray;\r\n}", "title": "" }, { "docid": "55278f3cf5b7d5c89cd0c8227f9d5e33", "score": "0.59670895", "text": "function uniteUnique(...arr) {\n // // simplet solution with a result container\n // let arrays = [...arr];\n\n // let result = [];\n\n // arrays.forEach(array => {\n // for (let i = 0; i < array.length; i++) {\n // let num = array[i];\n\n // if (!result.includes(num)) {\n // result.push(num);\n // console.log(result)\n // }\n // }\n // })\n\n\n // return result;\n\n\n\n\n // let use a set\n let arrays = [...arr];\n\n let result = new Set();\n\n arrays.forEach(array => {\n for (let i = 0; i < array.length; i++) {\n let num = array[i];\n result.add(num);\n\n }\n })\n\n\n return [...result];\n}", "title": "" }, { "docid": "10b07703c53d84c05a1c5af028b531ca", "score": "0.5966632", "text": "function uniqueValues(arr){\n return new Set(arr).size;\n}", "title": "" }, { "docid": "ba94fe3d7797189e2aebf90b86fd164c", "score": "0.5947949", "text": "function uniqueValues(array) {\n return [...new Set(array)]; // use spread to return an array, because Set is an object\n}", "title": "" }, { "docid": "dfa8144f9d75768190c22a62a0f4638c", "score": "0.5945221", "text": "function uniteUnique(arr) {\n // the spread operator ... to create an array out of the Arguments object and to flatten it at the same time\n const newArr = [].concat(...arguments);\n // console.log(newArr) // [1,3,2,5,2,1,4,2,1]\n\n // use the new ES2015 Set object to store only unique values\n // console.log ([ ...new Set(newArr)])\n return [...new Set(newArr)]; // [1,3,2,5,4]\n}", "title": "" }, { "docid": "98d7bc5e4e877ae9ba46f87ed1f102e9", "score": "0.59424436", "text": "function uniteUnique(arr) {\n const newArrObj = arguments;\n const answer = [];\n for (let arrArg in newArrObj) {\n newArrObj[arrArg].map( i =>{\n if (answer.indexOf(i) === -1) {\n answer.push(i)\n }\n })\n }\n\n return answer;\n}", "title": "" }, { "docid": "a4686037054a5b2bb9c91271df373f1a", "score": "0.5929132", "text": "function uniqNoSet(arr) {\n var ret = [];\n\n for (var i = 0; i < arr.length; i++) {\n if (ret.indexOf(arr[i]) === -1) {\n ret.push(arr[i]);\n }\n }\n\n return ret;\n }", "title": "" }, { "docid": "c6cc48d107d34a11c6a889cc44115e23", "score": "0.5927232", "text": "function unique(array) {\n var output = [];\n for (var c = 0; c < array.length; c++) {\n output.push(array[c]);\n }\n for (var i = 0; i < output.length; i++) {\n for (var d = output.length - 1; d >= 0; d--) {\n if (output[d] === output[i] && d !== i) {\n output.splice(d, 1);\n }\n }\n }\n return output;\n}", "title": "" }, { "docid": "117777ab7260670b82c9c29725bddc76", "score": "0.59182495", "text": "function unique(arr)\n {\n return arr.slice() // slice makes copy of array before sorting it\n .sort(function(a,b){ return a > b ? 1 : a < b ? -1 : 0; })\n .reduce(function(a,b)\n {\n if (a.slice(-1)[0] !== b) // slice(-1)[0] means last item in array without removing it (like .pop())\n a.push(b);\n return a;\n },[]); // this empty array becomes the starting value for a\n }", "title": "" }, { "docid": "dd2292a28d8e7c0a9c25f87c52432d26", "score": "0.5905937", "text": "function array_unique(inpArray) {\r\n var arr = [],\r\n i,\r\n j,\r\n contains = function (cArr, v) {\r\n for (j = 0; j < cArr.length; j++) {\r\n if (cArr[j] === v) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n for (i = 0; i < inpArray.length; i++) {\r\n if(!contains(arr, inpArray[i])) {\r\n arr.push(inpArray[i]);\r\n }\r\n }\r\n return arr;\r\n }", "title": "" }, { "docid": "9e6cc1f0378eb76ae6086dc44e9c8615", "score": "0.5892351", "text": "function getUnique(arr){\r\n var u = {}, a = [];\r\n if(arr==null)return arr;\r\n for(var i = 0, l = arr.length; i < l; ++i){\r\n if(u.hasOwnProperty(arr[i])) {\r\n continue;\r\n }\r\n a.push(arr[i]);\r\n u[arr[i]] = 1;\r\n }\r\n return a;\r\n}", "title": "" }, { "docid": "dde47bfda01be85728d1f225a66ab6f5", "score": "0.5887235", "text": "function uniteUnique(...arr) {\n let retArr = [];\n for (let i = 0; i < arr.length; i++)\n {\n let subArray = arr[i];\n for (let j = 0; j < subArray.length; j++)\n {\n let value = subArray[j];\n if (!retArr.includes(value))\n {\n retArr.push(value);\n }\n }\n }\n console.log(retArr);\n return retArr;\n}", "title": "" }, { "docid": "a70b1daf14b45106668f555fea2d0780", "score": "0.5883679", "text": "function unique(arr){\n return arr.filter(function(value, index, self){ return self.indexOf(value) === index; });\n}", "title": "" }, { "docid": "4b1f715d169d5f374d5dc2b894e64e9e", "score": "0.5883025", "text": "function unique(A) {\n\t\t\tvar n = A.length, k = 0, B = [];\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tvar j = 0;\n\t\t\t\twhile (j < k && B[j] !== A[i]) j++;\n\t\t\t\tif (j == k) B[k++] = A[i];\n\t\t\t}\n\t\t\treturn B;\n\t\t}", "title": "" }, { "docid": "6e8d77f6481e775aa7cc09ab134b4cd6", "score": "0.5875194", "text": "uniqueTitles(bookArr) {\n const newArr = [];\n for (let x = 0; x < bookArr.length; x++) {\n let found = false;\n for (let y = 0; y < newArr.length; y++) {\n if (bookArr[x] === newArr[y]) {\n found = true;\n break;\n }\n }\n if (!found) {\n newArr.push(bookArr[x]);\n }\n }\n return newArr;\n }", "title": "" }, { "docid": "4d3622b45471ea9acc176dd5e8165563", "score": "0.5869582", "text": "function getUnique(array){\n var uniqueArray = [];\n for(var value of array){\n if(uniqueArray.indexOf(value) === -1){\n uniqueArray.push(value);\n }\n }\n return uniqueArray;\n}", "title": "" }, { "docid": "779fa02ec1d703a44c8570609ef4040b", "score": "0.58610046", "text": "function countUniqueValues(arr) {\n // create variable to keep track of 1st count\n let i = 0;\n // iterate over the arr length at j starting at 1\n for (let j = 1; j < arr.length; j++) {\n // if arr at i isnt the same as arr j\n if (arr[i] !== arr[j]) {\n // increase i\n i++;\n // set arr i to be arr j\n arr[i] = arr[j]\n }\n }\n // return i + 1\n return i+1\n }", "title": "" }, { "docid": "ead4f60883ca6cecf741dd2a1fa6cc83", "score": "0.5860136", "text": "function unique(arr) {\n let hash = {};\n let singles = [];\n for (let i = 0; i < arr.length; i++) {\n hash[arr[i]] = ++hash[arr[i]] || 1;\n }\n for (let key in hash) {\n singles.push(Number(key));\n }\n return singles;\n}", "title": "" }, { "docid": "3f27b2eb9837aa2c344cf2ea2c0476ec", "score": "0.5860129", "text": "function uniteUnique(arr) {\n console.log(arr);\n console.log([].concat(...arguments));\n let myArray = [].concat(...arguments);\n console.log( [...new Set(myArray)]);\n return [...new Set(myArray)];\n}", "title": "" }, { "docid": "fb451416abbe82803982412c88a6546b", "score": "0.5858727", "text": "function uniqueArray(array) {\n return [...new Set(array)];\n}", "title": "" }, { "docid": "5962b0749a821f2c7c3e1a00f8f706b9", "score": "0.5856127", "text": "function countUniqueValues(arr) {\n if(arr.length === 0) {\n return 0;\n }\n let i = 0;\n for(let j = 1; j < arr.length; j++) {\n if(arr[i] !== arr[j]) {\n i++;\n arr[i] = arr[j]\n }\n console.log(i,j);\n }\n return i + 1;\n }", "title": "" }, { "docid": "3dc2d8a58d0365202bd6492ff8359525", "score": "0.58452547", "text": "function unique(array) {\n var finalOutput = [];\n for (var i = 0; i < array.length; i++) {\n if (!includes(finalOutput, array[i])) {\n finalOutput.push(array[i]);\n }\n }\n return finalOutput;\n}", "title": "" }, { "docid": "3ef48ea109497b6e8cb3f93bdbf0ab13", "score": "0.5845059", "text": "function users() {\n let numberArrays = [];\n\n for(const classes in capTableData) {\n let __class = capTableData[classes]\n for(const series in __class) {\n let __series = __class[series];\n console.log(__series);\n\n for(const users in __series){\n let __users = __series[users];\n numberArrays.push(users);\n console.log(__users); \n }\n }\n const totalUsers = [...new Set(numberArrays)];\n console.log(numberArrays, totalUsers);\n return totalUsers;\n }\n }", "title": "" }, { "docid": "27735210b9570e2a389637c3873b9895", "score": "0.5844423", "text": "function unique(a)\n{\n\tvar r = new Array();\n\to:for(var i = 0, n = a.length; i < n; i++)\n\t{\n\t\tfor(var x = 0, y = r.length; x < y; x++)\n\t\t{\n\t\t\tif(r[x]==a[i]) continue o;\n\t\t}\n\t\tr[r.length] = a[i];\n\t}\n\treturn r;\n}", "title": "" }, { "docid": "fadfc1946648e45a5d153bb898819734", "score": "0.5842586", "text": "function uniteUnique(...arrays) {\n //console.log(\"you have passed \" + arrays.length + \" arrays\");\n let uniqueArr = [];\n for (let i = 0; i < arrays.length; i++) {\n for (let j = 0; j < arrays[i].length; j++) {\n if (uniqueArr.indexOf(arrays[i][j]) == -1) {\n //so this is a new number, lets push it to our array\n uniqueArr.push(arrays[i][j]);\n }\n }\n }\n return uniqueArr;\n}", "title": "" }, { "docid": "812206031d63477e29131c0bca0400d5", "score": "0.58353317", "text": "function countUniqueNumbers(numArray) {\n if (numArray.length > 0) {\n let i = 0;\n\n for (let j = 1; j < numArray.length; j++) {\n if (numArray[i] !== numArray[j]) {\n i++;\n numArray[i] = numArray[j];\n }\n }\n\n return i + 1;\n } else {\n return 0;\n }\n}", "title": "" }, { "docid": "07e0c8f8d3f52f7551c57ce0d65c0e6a", "score": "0.58331734", "text": "function uniqNoSet(arr) {\n\t\tvar ret = [];\n\t\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\t\tret.push(arr[i]);\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret;\n\t}", "title": "" }, { "docid": "07e0c8f8d3f52f7551c57ce0d65c0e6a", "score": "0.58331734", "text": "function uniqNoSet(arr) {\n\t\tvar ret = [];\n\t\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\t\tret.push(arr[i]);\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret;\n\t}", "title": "" }, { "docid": "0efea275093e9e4dbfada204113902f9", "score": "0.5824754", "text": "function countUniqueValues(arr){\n if(arr.length === 0) return 0;\n var i = 0;\n for(var j = 1; j < arr.length; j++){\n if (arr[i] !== arr[j]) {\n i++;\n arr[i] = arr[j]\n }\n }\n return i + 1;\n}", "title": "" }, { "docid": "bcc08e7a6f4ba6f260ccfcb6d065cfbc", "score": "0.5824572", "text": "function unique() {\n var uniqueArray = [];\n for (var i = 0; i < arguments.length; ++i) {\n var array = arguments[i];\n for (var j = 0; j < array.length; ++j) {\n if (uniqueArray.indexOf(array[j]) < 0)\n uniqueArray.push(array[j]);\n }\n }\n return uniqueArray;\n }", "title": "" }, { "docid": "07c1c48f07dcf1b03edb20caa4f70dad", "score": "0.58239466", "text": "function getUnique(array){\n var uniqueArray = [];\n \n // Loop through array values\n for(i=0; i < array.length; i++){\n if(uniqueArray.indexOf(array[i]) === -1) {\n uniqueArray.push(array[i]);\n }\n }\n return uniqueArray;\n}", "title": "" }, { "docid": "2643440ce175e5ef125842215a610dc3", "score": "0.58189493", "text": "function unique(array) {\r\n\tnewArray = [];\r\n\r\n\tfor (var ar = 0; ar < array.length; ar++) {\r\n\t\tif ($.inArray(array[ar], newArray) == -1) {\r\n\t\t\tnewArray.push(array[ar]);\r\n\t\t};\r\n\t};\r\n\r\n\treturn newArray;\r\n}", "title": "" }, { "docid": "f5ca6ac489721d2c0964f0f6318246c6", "score": "0.5812679", "text": "function uniqueSum(arry)\n{\n var uniqueValues = arry.filter(function(elem,pos,self){\n return self.indexOf(elem) == pos;\n });\n\n var sum = uniqueValues.reduce(function(prev,curr){\n return prev + curr;\n });\n writeToDom(sum,'challenge-3')\n}", "title": "" }, { "docid": "b888ce7d9e36b5f7aee44c43dcfddc0c", "score": "0.5810833", "text": "function unique(arr) {\n let output = [];\n for (let i = 0; i < arr.length; i++) { // --> for(let element of arr)\n let element = arr[i] // \n if (!elementInArr(output, element)) {\n \n output.push(arr[i]);\n }\n\n }return output;\n}", "title": "" }, { "docid": "ba128ee41374d76cabbc8b40e404a3ec", "score": "0.5806397", "text": "function numUniqueEmails(arr) {\r\n let result = []\r\n for (let i = 0; i < arr.length; i++) {\r\n let x = arr[i].split(\"@\")\r\n //console.log(x,\"x\")\r\n let y = \"\"\r\n for (let i = 0; i < x[0].length; i++) {\r\n if (x[0][i] != \".\" && x[0][i] != \"+\") {\r\n y += x[0][i]\r\n }\r\n if (x[0][i] == \"+\") {\r\n break\r\n }\r\n }\r\n y = y + \"@\" + x[1]\r\n result.push(y)\r\n }\r\n return [...new Set(result)]\r\n}", "title": "" }, { "docid": "af8667c73e9a77cf4b4f95efb2f2a5de", "score": "0.58042634", "text": "function uniteUnique() {\r\n var output = [];\r\n \r\n Array.prototype.forEach.call(arguments, function(e) {\r\n e.forEach(function(n) {\r\n if (output.indexOf(n) === -1) {\r\n output.push(n);\r\n }\r\n });\r\n });\r\n return output;\r\n}", "title": "" }, { "docid": "c8b75b96f79cfba16f3de01ab503e907", "score": "0.5801743", "text": "function unique(a) {\r\n\tvar r = new Array();\r\n\to: for ( var i = 0, n = a.length; i < n; i++) {\r\n\t\tfor ( var x = 0, y = r.length; x < y; x++)\r\n\t\t\tif (r[x] == a[i])\r\n\t\t\t\tcontinue o;\r\n\t\tr[r.length] = a[i];\r\n\t}\r\n\treturn r;\r\n}", "title": "" }, { "docid": "0f89a5ad8925453cb10fb83575d41151", "score": "0.58016515", "text": "function listUnique(dataArray) {\n // code to find the unique values\n let uniqueArray = [];\n dataArray.map(item => {\n if (uniqueArray.indexOf == -1) // If items does not excist yet in the array, then add it to the array.\n {\n uniqueArray.push(item);\n }\n })\n return uniqueArray;\n}", "title": "" }, { "docid": "d65fcd45771c03bc13f42b3e86845759", "score": "0.57981926", "text": "function uniqueElements(arr) {\n var newArr = []\n for (var i = 0; i < arr.length; i++) {\n if (newArr.indexOf(arr[i]) === -1) {\n newArr.push(arr[i]);\n }\n }\n return newArr;\n}", "title": "" }, { "docid": "81bc194e04649cb94c97227582f7bcb1", "score": "0.5798139", "text": "function unique(A) {\n\t\tvar n = A.length, k = 0, B = [];\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\tvar j = 0;\n\t\t\twhile (j < k && B[j] !== A[i]) j++;\n\t\t\tif (j == k) B[k++] = A[i];\n\t\t}\n\t\treturn B;\n\t}", "title": "" }, { "docid": "81bc194e04649cb94c97227582f7bcb1", "score": "0.5798139", "text": "function unique(A) {\n\t\tvar n = A.length, k = 0, B = [];\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\tvar j = 0;\n\t\t\twhile (j < k && B[j] !== A[i]) j++;\n\t\t\tif (j == k) B[k++] = A[i];\n\t\t}\n\t\treturn B;\n\t}", "title": "" }, { "docid": "81bc194e04649cb94c97227582f7bcb1", "score": "0.5798139", "text": "function unique(A) {\n\t\tvar n = A.length, k = 0, B = [];\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\tvar j = 0;\n\t\t\twhile (j < k && B[j] !== A[i]) j++;\n\t\t\tif (j == k) B[k++] = A[i];\n\t\t}\n\t\treturn B;\n\t}", "title": "" }, { "docid": "81bc194e04649cb94c97227582f7bcb1", "score": "0.5798139", "text": "function unique(A) {\n\t\tvar n = A.length, k = 0, B = [];\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\tvar j = 0;\n\t\t\twhile (j < k && B[j] !== A[i]) j++;\n\t\t\tif (j == k) B[k++] = A[i];\n\t\t}\n\t\treturn B;\n\t}", "title": "" }, { "docid": "b53e3f61c57ec0a81401195211cf9347", "score": "0.57908154", "text": "function uniteUnique(arr) {\n let args = [...arguments];\n let filteredArr = [];\n for (i in args){\n for (j in args[i]){\n if(filteredArr.indexOf(args[i][j]) < 0){\n filteredArr.push(args[i][j]);\n }\n }\n }\n console.log(filteredArr);\n return filteredArr;\n}", "title": "" }, { "docid": "1b8fa3b6437419c68de90f835b34d867", "score": "0.5786624", "text": "function countUniqueValues(array) {\n if (array.length === 0) {\n return `There's no number in the array`;\n }\n\n let i = 0;\n\n for (let j = 1; j < array.length; j++) {\n if (array[i] !== array[j]) {\n i ++;\n array[i] = array[j];\n console.log(`---- array index i is --> ${array[i]}-----`)\n console.log(`---- i is --> ${array[i]}-----`)\n }\n\n //console.log(i, j);\n }\n\n return i + 1;\n}", "title": "" }, { "docid": "27de0be4539abce6e68ebbeba9a8f1ac", "score": "0.5784384", "text": "function unique ( array ) {\r\n\t\treturn array.filter(function(a){\r\n\t\t\treturn !this[a] ? this[a] = true : false;\r\n\t\t}, {});\r\n\t}", "title": "" }, { "docid": "628b920885afbdacbd0439130a9d3f15", "score": "0.57754934", "text": "function removeDuplicates(rawBookedTimes) {\n let cleanBookedTimes = Array.from(new Set(rawBookedTimes));\n return cleanBookedTimes;\n console.log(cleanBookedTimes);\n}", "title": "" }, { "docid": "34396445d07a41fadb32ddc0dfbd2c2b", "score": "0.5772608", "text": "function uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}", "title": "" }, { "docid": "34396445d07a41fadb32ddc0dfbd2c2b", "score": "0.5772608", "text": "function uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}", "title": "" }, { "docid": "34396445d07a41fadb32ddc0dfbd2c2b", "score": "0.5772608", "text": "function uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}", "title": "" }, { "docid": "34396445d07a41fadb32ddc0dfbd2c2b", "score": "0.5772608", "text": "function uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}", "title": "" }, { "docid": "a8f91a49dc74065d4ae90d1c7cade329", "score": "0.57708", "text": "function countUniqueValues (arr) {\n let i = 0;\n for (let j = 1; j < arr.length; j++) {\n if (arr[i] !== arr[j]) {\n i++;\n arr[i] = arr[j];\n }\n console.log(i, j)\n }\n return i + 1;\n}", "title": "" }, { "docid": "cc90f6b48b623391c86f23ac0e39aebb", "score": "0.57697356", "text": "uniqArr(arr) {\n\t\t\tlet mySet = new Set(arr);\n\t\t\treturn Array.from(mySet);\n\t\t}", "title": "" }, { "docid": "c7516c684da21a8589d5fe41dd0364a6", "score": "0.5768235", "text": "function countUniqueValues(array) {\n if (array.length === 0) {\n return 0;\n }\n\n let i = 0;\n\n for (let j = 1; j < array.length; j++) {\n if (array[i] !== array[j]) {\n i++;\n array[i] = array[j];\n }\n }\n return i + 1;\n}", "title": "" }, { "docid": "9d4ab5d0722e3fd6507fe96870c8c434", "score": "0.5759197", "text": "function findUniq(arr) {\n var sortedArr = arr.sort(function (a, b) {\n return a - b;\n });\n\n for (var i = 0; i < sortedArr.length; i++) {\n if (sortedArr[i] !== sortedArr[i + 1] && sortedArr[i] !== sortedArr[i - 1]) {\n console.log(sortedArr[i]);\n }\n\n ;\n }\n\n ;\n}", "title": "" }, { "docid": "d143b81325999d3eca6d4c9ae123aeda", "score": "0.57580835", "text": "clean(arr) {\n //return [...new Set(arr)];\n let exists = {};\n let uniques = [];\n\n // use for loop because it's faster than .forEach\n for (var i = 0; i < arr.length; i++) {\n if (!exists[arr[i]]) {\n uniques.push(arr[i]);\n exists[arr[i]] = true;\n }\n }\n return uniques;\n }", "title": "" }, { "docid": "3707f317a7b520d572e9f1c147752f41", "score": "0.57571554", "text": "function uniteUnique(...arrs) {\n let s = new Set(arrs[0])\n for(let array of arrs.slice(1)){\n for(let num of array){\n s.add(num)\n }\n }\n return [...s]\n}", "title": "" }, { "docid": "10e476533dcdf030b0cd6e75c72af92c", "score": "0.5740886", "text": "function countUniqueValues(arr) {\n\tif (!arr.length) return 0;\n\n\tlet i = 0;\n\tlet j = i + 1;\n\n\twhile(j < arr.length) {\n\t\tif (arr[i] === arr[j]) {\n\t\t\tj++;\n\t\t} else {\n\t\t\ti++;\n\t\t\tarr[i] = arr[j];\n\t\t}\n\t}\n\n\treturn i + 1;\n}", "title": "" }, { "docid": "80f3d8dac3b6d19d6390ed40844de7b6", "score": "0.5735791", "text": "rmdupli(a) {\n\t return Array.from(new Set(a));\n\t}", "title": "" }, { "docid": "04b5f3d0c4f18ace73e0e82ead12fa3c", "score": "0.5729769", "text": "function distinct(a) {\n arr = [];\n for(let i=0; i<a.length; i++){\n if (!arr.includes(a[i])){\n arr.push(a[i]);\n }\n\n }\n return arr;\n}", "title": "" }, { "docid": "66222a0cf1d2ea9bf508df2f99ae3bc3", "score": "0.5729718", "text": "function unique(array) {\n return array.filter(function(value, index) {\n return array.indexOf(value) === index;\n });\n}", "title": "" }, { "docid": "a60978c1e1cf9cafc096989fe5aa676b", "score": "0.5725616", "text": "function arrUnique1(arr) {\r\n var cleaned = [];\r\n $scope.Member.forEach(function(itm) {\r\n var unique = true;\r\n cleaned.forEach(function(itm2) {\r\n if (_.isEqual(itm, itm2)) unique = false;\r\n });\r\n if (unique) cleaned.push(itm);\r\n });\r\n return cleaned;\r\n}", "title": "" }, { "docid": "3ff506621a582a7c267efcd71950a44d", "score": "0.57224953", "text": "function countUniqueValues(arr) {\n if (arr.length === 0) return 0;\n let i = 0;\n for (let j = 1; j < arr.length; j++) {\n if (arr[i] !== arr[j]) {\n i++;\n arr[i] = arr[j];\n }\n }\n return i + 1;\n}", "title": "" }, { "docid": "c07f1db1ba338c37b63a6325001284c8", "score": "0.5722264", "text": "function uniq(arr) {\n\t var theSet = new ExportedSet(arr);\n\t var result = new Array(theSet.size);\n\t var index = -1;\n\t theSet.forEach(function (value) {\n\t result[++index] = value;\n\t });\n\t return result;\n\t}", "title": "" }, { "docid": "ac91251ea3db814f1e5fcccc19d739b3", "score": "0.5719285", "text": "function countUniqueValues(arr){\n if(arr.length === 0) return 0;\n var i = 0;\n for(var j = 1; j < arr.length; j++){\n if(arr[i] !== arr[j]){\n i++;\n arr[i] = arr[j]\n }\n }\n return i + 1;\n}", "title": "" }, { "docid": "e8aa955df8402cf57d3d069ef29aec09", "score": "0.5712881", "text": "function getUniques(myArray) {\n\tvar cleaned = [];\n\tmyArray.forEach(function(itm) {\n\t\tvar unique = true;\n\t\tcleaned.forEach(function(itm2) {\n\t\t\tif (itm == itm2) unique = false;\n\t\t});\n\t\tif (unique) cleaned.push(itm);\n\t});\n\treturn cleaned;\n}", "title": "" }, { "docid": "e8aa955df8402cf57d3d069ef29aec09", "score": "0.5712881", "text": "function getUniques(myArray) {\n\tvar cleaned = [];\n\tmyArray.forEach(function(itm) {\n\t\tvar unique = true;\n\t\tcleaned.forEach(function(itm2) {\n\t\t\tif (itm == itm2) unique = false;\n\t\t});\n\t\tif (unique) cleaned.push(itm);\n\t});\n\treturn cleaned;\n}", "title": "" }, { "docid": "bed8526548d34141b07318ed0e95a480", "score": "0.5710788", "text": "function uniq (arr) {\n var result = [];\n arr.forEach(function(item) {\n if(result.indexOf(item) === -1) {\n result.push(item);\n }\n });\n return result;\n }", "title": "" }, { "docid": "1b145f75a4ee426577bd474f81f05015", "score": "0.57059956", "text": "function countUniqueValues(arr) {\n let j = 0;\n\n if (!arr.length) return (0);\n\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] !== arr[j]) {\n j++;\n arr[j] = arr[i];\n }\n }\n return (j + 1);\n}", "title": "" }, { "docid": "e223f8924e3dd2a782a97668983c2304", "score": "0.57049763", "text": "function uniqueArray() {\n for (var a = [], i = 0; i < 4000000; ++i) a[i] = i;\n return a\n}", "title": "" } ]
3ce9c1ad25442b560d0f1b210c60b1fc
A rail is used to show accompanying content outside the boundaries of the main view of a site.
[ { "docid": "4398f22978c733794b4181d37e899681", "score": "0.5068946", "text": "function Rail(props) {\n\t var attached = props.attached,\n\t children = props.children,\n\t className = props.className,\n\t close = props.close,\n\t content = props.content,\n\t dividing = props.dividing,\n\t internal = props.internal,\n\t position = props.position,\n\t size$$1 = props.size;\n\t var classes = classNames('ui', position, size$$1, useKeyOnly(attached, 'attached'), useKeyOnly(dividing, 'dividing'), useKeyOnly(internal, 'internal'), useKeyOrValueAndKey(close, 'close'), 'rail', className);\n\t var rest$$1 = getUnhandledProps(Rail, props);\n\t var ElementType = getElementType(Rail, props);\n\t return React__default.createElement(ElementType, _extends_1({}, rest$$1, {\n\t className: classes\n\t }), isNil$1(children) ? content : children);\n\t}", "title": "" } ]
[ { "docid": "f6e49350204da83a3aea9504e25f2cca", "score": "0.5152897", "text": "function rightSideView(root) {\n \n}", "title": "" }, { "docid": "60965bf2ef3385c8550947d3accc002f", "score": "0.514687", "text": "Compatible(rail){\n let offset = 10;\n let railType = rail.ReturnRailType();\n\n switch(this.direction){\n\n case directionEnum.UP:\n if((railType === 2 || railType === 3 || railType === 5) && this.y > rail.ReturnPos().y + offset) return false;\n else if(railType !== 4 && this.y<rail.ReturnPos().y){\n if(railType === 1) this.ChangeDirection(directionEnum.LEFT);\n else if(railType === 0)this.ChangeDirection(directionEnum.RIGHT);\n } \n break;\n case directionEnum.DOWN:\n if((railType === 1 || railType === 0 || railType === 5) && this.y < rail.ReturnPos().y - offset)return false;\n else if(railType !== 4 && this.y > rail.ReturnPos().y){\n if(railType === 2) this.ChangeDirection(directionEnum.LEFT);\n else if(railType === 3) this.ChangeDirection(directionEnum.RIGHT);\n } \n break;\n case directionEnum.LEFT:\n if((railType === 2 || railType === 1 || railType === 4) && this.x > rail.ReturnPos().x + offset)return false;\n else if(railType !== 5 && this.x < rail.ReturnPos().x){\n if(railType === 3)this.ChangeDirection(directionEnum.UP);\n else if(railType === 0)this.ChangeDirection(directionEnum.DOWN);\n } \n break;\n case directionEnum.RIGHT:\n if((railType === 3 || railType === 0 || railType === 4) && this.x < rail.ReturnPos().x - offset)return false;\n else if(railType !== 5 && this.x > rail.ReturnPos().x){\n if(railType === 2)this.ChangeDirection(directionEnum.UP);\n else if(railType === 1)this.ChangeDirection(directionEnum.DOWN);\n } \n break;\n }\n return true;\n\n }", "title": "" }, { "docid": "8a9a2998f91b81bd0781f9800a2d996e", "score": "0.5127203", "text": "function Rail(props) {\n var attached = props.attached,\n children = props.children,\n className = props.className,\n close = props.close,\n content = props.content,\n dividing = props.dividing,\n internal = props.internal,\n position = props.position,\n size = props.size;\n var classes = (0, _classnames2.default)('ui', position, size, (0, _lib.useKeyOnly)(attached, 'attached'), (0, _lib.useKeyOnly)(dividing, 'dividing'), (0, _lib.useKeyOnly)(internal, 'internal'), (0, _lib.useKeyOrValueAndKey)(close, 'close'), 'rail', className);\n var rest = (0, _lib.getUnhandledProps)(Rail, props);\n var ElementType = (0, _lib.getElementType)(Rail, props);\n return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, {\n className: classes\n }), _lib.childrenUtils.isNil(children) ? content : children);\n}", "title": "" }, { "docid": "c51692907b58c7028f950c4e89aad600", "score": "0.5098609", "text": "function createRailRoadSide(col, len, height, dep, map){\n var outerRailGeom = new THREE.BoxGeometry(len, height, dep);\n var outerRailMat = new THREE.MeshPhongMaterial({color: col, \n ambient: col,\n specular: col,\n shininess: 50});\n if(map == true){\n outerRailMat.map = innerRailTexture;\n }\n var outerRailMesh = new THREE.Mesh(outerRailGeom, outerRailMat);\n return outerRailMesh;\n}", "title": "" }, { "docid": "323b9101e2ad6495f4df81c0f3aa8915", "score": "0.5081911", "text": "function createRightOutside(){\n\t//creates outside building wall\n\tvar geometryRightWall = new THREE.PlaneGeometry( sceneParams.planeHeight*.75, sceneParams.planeHeight*2, sceneParams.planeSegments);\n\tvar materialRightWall = new THREE.MeshBasicMaterial( {color: sceneParams.buildingColor, side: THREE.DoubleSide} );\n\tvar windowRightWall = new THREE.Mesh( geometryRightWall, materialRightWall );\n\n\twindowRightWall.position.x = (sceneParams.planeHeight*.75)*.5 + sceneParams.planeWidth*.5;\n\n\treturn windowRightWall;\n\t}", "title": "" }, { "docid": "811a3d0809086517979a5f5cfd1e4e99", "score": "0.5066776", "text": "function Rail(props) {\n var attached = props.attached,\n children = props.children,\n className = props.className,\n close = props.close,\n content = props.content,\n dividing = props.dividing,\n internal = props.internal,\n position = props.position,\n size = props.size;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()('ui', position, size, Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"C\" /* useKeyOnly */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"C\" /* useKeyOnly */])(dividing, 'dividing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"C\" /* useKeyOnly */])(internal, 'internal'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"D\" /* useKeyOrValueAndKey */])(close, 'close'), 'rail', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"s\" /* getUnhandledProps */])(Rail, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"r\" /* getElementType */])(Rail, props);\n\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n __WEBPACK_IMPORTED_MODULE_5__lib__[\"d\" /* childrenUtils */].isNil(children) ? content : children\n );\n}", "title": "" }, { "docid": "53dbb983026dd01ff639e9529dd34e61", "score": "0.50442964", "text": "function Rail(props) {\n const {\n attached,\n children,\n className,\n close,\n dividing,\n internal,\n position,\n size,\n } = props\n\n const classes = cx(\n 'ui',\n position,\n size,\n useKeyOnly(attached, 'attached'),\n useKeyOnly(dividing, 'dividing'),\n useKeyOnly(internal, 'internal'),\n useKeyOrValueAndKey(close, 'close'),\n 'rail',\n className,\n )\n const rest = getUnhandledProps(Rail, props)\n const ElementType = getElementType(Rail, props)\n\n return <ElementType {...rest} className={classes}>{children}</ElementType>\n}", "title": "" }, { "docid": "019c1876de8c7d44fb09a85cdae43aea", "score": "0.5033595", "text": "function Rail(props) {\n var attached = props.attached,\n children = props.children,\n className = props.className,\n close = props.close,\n content = props.content,\n dividing = props.dividing,\n internal = props.internal,\n position = props.position,\n size = props.size;\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()('ui', position, size, Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(attached, 'attached'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(dividing, 'dividing'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"A\" /* useKeyOnly */])(internal, 'internal'), Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"B\" /* useKeyOrValueAndKey */])(close, 'close'), 'rail', className);\n var rest = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"r\" /* getUnhandledProps */])(Rail, props);\n var ElementType = Object(__WEBPACK_IMPORTED_MODULE_5__lib__[\"q\" /* getElementType */])(Rail, props);\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(ElementType, __WEBPACK_IMPORTED_MODULE_0__babel_runtime_helpers_extends___default()({}, rest, {\n className: classes\n }), __WEBPACK_IMPORTED_MODULE_5__lib__[\"c\" /* childrenUtils */].isNil(children) ? content : children);\n}", "title": "" }, { "docid": "f9e377b143fc20039158abf96b8cfd3c", "score": "0.50025874", "text": "function createTopOutside(){\n\t//creates outside building wall\n\tvar geometryTopWall = new THREE.PlaneGeometry( sceneParams.planeWidth + sceneParams.planeHeight*1.5, sceneParams.planeHeight*.75, sceneParams.planeSegments);\n\tvar materialTopWall = new THREE.MeshBasicMaterial( {color: sceneParams.buildingColor, side: THREE.DoubleSide} );\n\tvar windowTopWall = new THREE.Mesh( geometryTopWall, materialTopWall );\n\n\twindowTopWall.position.y = sceneParams.planeHeight - (sceneParams.planeHeight - sceneParams.planeHeight*.75)/2;\n\n\treturn windowTopWall;\n\t}", "title": "" }, { "docid": "58dfd7e513d51427ecf7466ec7da8139", "score": "0.49871182", "text": "function Rail(props) {\n var attached = props.attached,\n children = props.children,\n className = props.className,\n close = props.close,\n content = props.content,\n dividing = props.dividing,\n internal = props.internal,\n position = props.position,\n size = props.size;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()('ui', position, size, Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(attached, 'attached'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(dividing, 'dividing'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOnly\"])(internal, 'internal'), Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"useKeyOrValueAndKey\"])(close, 'close'), 'rail', className);\n var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getUnhandledProps\"])(Rail, props);\n var ElementType = Object(_lib__WEBPACK_IMPORTED_MODULE_5__[\"getElementType\"])(Rail, props);\n return react__WEBPACK_IMPORTED_MODULE_4___default.a.createElement(ElementType, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, rest, {\n className: classes\n }), _lib__WEBPACK_IMPORTED_MODULE_5__[\"childrenUtils\"].isNil(children) ? content : children);\n}", "title": "" }, { "docid": "9ed5f4fd71a9b56ff3499c403b0c370c", "score": "0.48547688", "text": "showCrawlView() {\n // reset content\n document.body.innerHTML = '';\n\n // render crawler view\n render(this.render(), document.body);\n }", "title": "" }, { "docid": "b91b65d13bdb7ecea137c963af2eb84b", "score": "0.48443612", "text": "function Rail(props) {\n var attached = props.attached,\n children = props.children,\n className = props.className,\n close = props.close,\n dividing = props.dividing,\n internal = props.internal,\n position = props.position,\n size = props.size;\n\n\n var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()('ui', position, size, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"a\" /* useKeyOnly */])(attached, 'attached'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"a\" /* useKeyOnly */])(dividing, 'dividing'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"a\" /* useKeyOnly */])(internal, 'internal'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"j\" /* useKeyOrValueAndKey */])(close, 'close'), 'rail', className);\n var rest = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"b\" /* getUnhandledProps */])(Rail, props);\n var ElementType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib__[\"c\" /* getElementType */])(Rail, props);\n\n return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(\n ElementType,\n __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, rest, { className: classes }),\n children\n );\n}", "title": "" }, { "docid": "2d11b82d2e28ad243f553d7bd077a0ba", "score": "0.48321736", "text": "outside(){\n\t\t\n\t\t//get current node\n\t\tvar cnode = this.get('head'); if(!cnode) return;\n\n\t\t//has parent node?\n\t\tif(!cnode.parent) return;\n\n\t\t//get parent node\n\t\tvar tnode = cnode.parent;\n\n\t\t//go to child node using known swap type and passing recived params\n\t\treturn this.go(tnode,{ 'swap_type':'outside' });\n\t\t\n\t}", "title": "" }, { "docid": "14f6a76a8418bb8cae1504ea0acec87b", "score": "0.48193258", "text": "function side() {\n var width = $(window).width();\n\n if (width < 900) {\n document.getElementById(\"sidebar\").style.left = \"-290px\";\n document.getElementById(\"tasks\").style.padding = \"80px 40px 80px calc(10%)\";\n setShowSide(false);\n }\n }", "title": "" }, { "docid": "bb14287f452b973f263ccbc1228f7126", "score": "0.4798993", "text": "static get tag(){return\"site-outline-block\"}", "title": "" }, { "docid": "e3a326fcf05c01f9b7cc16be8bb53a3d", "score": "0.4788995", "text": "function createBottomOutside(){\n\t//creates outside building wall\n\tvar geometryBottomWall = new THREE.PlaneGeometry( sceneParams.planeWidth + sceneParams.planeHeight*1.5, sceneParams.planeHeight*.75, sceneParams.planeSegments);\n\tvar materialBottomWall = new THREE.MeshBasicMaterial( {color: sceneParams.buildingColor, side: THREE.DoubleSide} );\n\tvar windowBottomWall = new THREE.Mesh( geometryBottomWall, materialBottomWall );\n\n\twindowBottomWall.position.y = -sceneParams.planeHeight + (sceneParams.planeHeight - sceneParams.planeHeight*.75)/2;\n\n\treturn windowBottomWall;\n\t}", "title": "" }, { "docid": "95dfa5f4438cf4bb661460d84dc7960d", "score": "0.47860312", "text": "function refitSidebar() {\n height('#sidebar', height(body) - height('#header'));\n }", "title": "" }, { "docid": "1fdee6951ae02bac0c1c8706f32d2c0c", "score": "0.47632894", "text": "function main() {\n // build the nav\n createNavig()\n //capture scrolling and highlight active section and corresponding nav element\n partInView();\n\n}", "title": "" }, { "docid": "d9dcbf1dc5dfcfc8173e687b4c441fce", "score": "0.47534898", "text": "function createRailroad(regexTree){\n var snippet = Regex2RailRoadDiagramCopy(regexTree);\n return '<div class=\"RR\">'+ snippet + '</dvi>';\n }", "title": "" }, { "docid": "98ca56f8baba5d1e3b74580d8d48e283", "score": "0.47527465", "text": "function write_user_sidebar() {\n write_doc_frame(\n //-- TITLE\n 'Tangerine: A Reference Implementation of Analysis Exchange Concepts',\n //-- Sub-title\n [['', null]],\n // CHAPTERS\n [\n ['Tangerine', ['./TangerineDemo.htm', 'home']],\n // Ch. 1,\n ['Test Client', ['./test-client.htm', 'tester']],\n ['Demonstration', ['./demonstration-fwa.htm', 'FWA']], \n // Ch. 2 \n ['Transfer Services', ['./transfer-services.htm', 'services']],\n // Ch. 3\n ['Tangerine Installation', ['./install.htm', 'install']]\n \n //--- end CHAPTERS--- \n ]\n );\n}", "title": "" }, { "docid": "b309dc38d52c0e226d560276b8b4617b", "score": "0.47383618", "text": "function mbgm_viewBauerInDetailView(bauerId) {\n\t if ( !document.getElementById(\"bauerDetail\") ) return;\t// only if this element is present\n\n\t $('#bauerDetail').hide();\n\t if(bauerId) {\n\t\t $.get(gmapsBackendURL, {bauerDetail : bauerId}, function(data) {\n\t\t\t $(\"#bauerDetail\").html(data);\n\t\t\t $('#bauerDetail').show();\n\t\t\t mbgm_adaptIframeHeight();\n\t\t });\n\n\t } else {\t// if no bauer is selected we have to adapt height to avoid empty space at page-bottom\n\t\t mbgm_adaptIframeHeight();\n\t }\n\n }", "title": "" }, { "docid": "34aa8b3c7ab01ebab1e631c873df5da5", "score": "0.47362462", "text": "function LView() { }", "title": "" }, { "docid": "34aa8b3c7ab01ebab1e631c873df5da5", "score": "0.47362462", "text": "function LView() { }", "title": "" }, { "docid": "34aa8b3c7ab01ebab1e631c873df5da5", "score": "0.47362462", "text": "function LView() { }", "title": "" }, { "docid": "34aa8b3c7ab01ebab1e631c873df5da5", "score": "0.47362462", "text": "function LView() { }", "title": "" }, { "docid": "388ab4b324df8c5fc0b81fa0be48d4cc", "score": "0.4736015", "text": "function headermobileAside() {\n var navbarTrigger = $('.mobile-aside-button'),\n endTrigger = $('.mobile-aside-close'),\n container = $('.mobile-off-canvas-active'),\n wrapper = $('.main-wrapper-2');\n wrapper.prepend('<div class=\"body-overlay-2\"></div>');\n navbarTrigger.on('click', function(e) {\n e.preventDefault();\n container.addClass('inside');\n wrapper.addClass('overlay-active-2');\n });\n endTrigger.on('click', function() {\n container.removeClass('inside');\n wrapper.removeClass('overlay-active-2');\n });\n $('.body-overlay-2').on('click', function() {\n container.removeClass('inside');\n wrapper.removeClass('overlay-active-2');\n });\n }", "title": "" }, { "docid": "d9001db28c2f1376243170ce89117a09", "score": "0.46971014", "text": "function createLeftOutside(){\n\t//creates outside building wall\n\tvar geometryLeftWall = new THREE.PlaneGeometry( sceneParams.planeHeight*.75, sceneParams.planeHeight*2, sceneParams.planeSegments);\n\tvar materialLeftWall = new THREE.MeshBasicMaterial( {color: sceneParams.buildingColor, side: THREE.DoubleSide} );\n\tvar windowLeftWall = new THREE.Mesh( geometryLeftWall, materialLeftWall );\n\twindowLeftWall.position.x = -sceneParams.planeHeight*.375 - sceneParams.planeWidth*.5;\n\n\treturn windowLeftWall;\n\t}", "title": "" }, { "docid": "13ee7392b3280c2f60fea9a6e7aeef24", "score": "0.46846586", "text": "function refitContent() {\n height('#content', height(body) - height('#header'));\n width('#content', width(body) - width('#sidebar'));\n }", "title": "" }, { "docid": "e65c1edf9d08aabe0bd7cbd1abddda69", "score": "0.46803123", "text": "mainFrame() {\n throw new Error('Not implemented');\n }", "title": "" }, { "docid": "2bd0411903cea172cfc2ee08f82562c9", "score": "0.46254462", "text": "function LView() {}", "title": "" }, { "docid": "2bd0411903cea172cfc2ee08f82562c9", "score": "0.46254462", "text": "function LView() {}", "title": "" }, { "docid": "2bd0411903cea172cfc2ee08f82562c9", "score": "0.46254462", "text": "function LView() {}", "title": "" }, { "docid": "2bd0411903cea172cfc2ee08f82562c9", "score": "0.46254462", "text": "function LView() {}", "title": "" }, { "docid": "4be58818bfb34623bc3a1e892420c01a", "score": "0.46141484", "text": "function getChildren(rail){\n var children=[];\n var rails=config.airport.rails;\n var lastPoint=rail.points[rail.points.length-1];\n for (var i in rails){\n if (lastPoint==rails[i].points[0]){\n children.push(rails[i]);\n }\n }\n return children;\n}", "title": "" }, { "docid": "5ca489dd1b7cedc04c48f27bca69b9df", "score": "0.46105513", "text": "function o() {\n var o = $(window).height();\n $(\"#sidebar\").css(\"height\", o - 120)\n }", "title": "" }, { "docid": "eab300f004dd9687135e56e6fcdc5ca1", "score": "0.4601261", "text": "function RWall(req, res, item, posts){\n\tres.render(\"Tabs/wall\", {\n\t\ttitle: \"Twittcher\",\n\t\tusername: req.session.username,\n\t\t_id: req.session.Pid,\n\t\tlogError: 0,\n\t\tregError: 0,\n\t\titem: item,\n\t\tposts: posts\n\t});\n}", "title": "" }, { "docid": "f7666d34cfa97569c893ac2eac24e813", "score": "0.45966807", "text": "function hideLandingPage() {\n landingBlock.addClass(\"hide\");\n }", "title": "" }, { "docid": "12f5323312402af41c2033445ef0e0e8", "score": "0.45809963", "text": "function snoozeLogic() {\n $(iframe_parent).hide();\n $('body').css('padding', '0');\n\n // Resize any downsized elements to full viewport\n resizeHeight(resized_height, viewport_height);\n}", "title": "" }, { "docid": "aa50309e570ea66efff7a0f0f7303a28", "score": "0.4574981", "text": "function showBody() {\n $QS(\"main\").classList.remove(\"hidden\");\n $QS('.loader').classList.add('hidden');\n }", "title": "" }, { "docid": "84cd905c61dbb3e3944a433a7fad48de", "score": "0.4566636", "text": "function RailFence() {}", "title": "" }, { "docid": "d4ab43bd1f7542a1978c26294dbec9c6", "score": "0.45489046", "text": "function createWalls(){\r\n endWall = hiddenWalls(800, 0, \"endWall\");\r\n backWall = hiddenWalls(-20, 0, \"backWall\");\r\n \r\n world.addChild(endWall);\r\n world.addChild(backWall);\r\n}", "title": "" }, { "docid": "6ee9223322f4260c314cd1b644020aa7", "score": "0.45355496", "text": "function whatIsThis() {\n var EXTRA_DELAY_BETWEEN_VIEWS = 800;\n\n function showTips() {\n events.off('bp/did-open-subpanel', showTips);\n require(['bp-secondary/bp-secondary'], function (bpSecondary) {\n nativeGlobal.setTimeout(function() {\n bpSecondary.toggleFeature('tips');\n }, EXTRA_DELAY_BETWEEN_VIEWS);\n });\n }\n\n function showSecondaryPanel() {\n events.off('bp/did-expand', showSecondaryPanel);\n require(['bp-expanded/view/more-button'], function(moreButton) {\n moreButton.init();\n moreButton.show(function() {\n nativeGlobal.setTimeout(moreButton.activate, EXTRA_DELAY_BETWEEN_VIEWS);\n });\n events.on('bp/did-open-subpanel', showTips);\n });\n }\n\n function beginTipsTour() {\n events.on('bp/did-expand', showSecondaryPanel);\n expandPanel();\n }\n\n function expandPanel() {\n hideMenu();\n require(['run/bp/controller/expand-controller'],\n function (expandController) {\n expandController.init();\n expandController.expandPanel();\n });\n }\n\n bpToolbarView.showBlurb('what-is');\n enableBlurbItem('scp-blurb-tour-tips', beginTipsTour);\n enableBlurbItem('scp-blurb-slider-bar', expandPanel);\n }", "title": "" }, { "docid": "c69447a9d4a8e5a96c29a2d1cb0ae667", "score": "0.45150524", "text": "function LView(){}", "title": "" }, { "docid": "bd403327cb4d46099edf27a37dc083e9", "score": "0.45108578", "text": "wallThrough() {\r\n\t\tif (this.location.x > width) {\r\n\t\t\tthis.location.x = 0;\r\n\t\t}\r\n\t\tif (this.location.x < 0) {\r\n\t\t\tthis.location.x = width;\r\n\t\t}\r\n\t\tif (this.location.y > height) {\r\n\t\t\tthis.location.y = 0;\r\n\t\t}\r\n\t\tif (this.location.y < 0) {\r\n\t\t\tthis.location.y = height;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "4190e98749d930e34e8866807f084691", "score": "0.45081294", "text": "function ruulOpenLostBlueVertical() {\n\t\t// get position of ruul\n\t\tvar ruulPosition = $(targetBlue);\n\t\tvar position = ruulPosition.position();\n\t\tvar newPosition;\n\t\t//check that position + width is not more than browser area\n\t\tif ( position.left + ruulOpen > ruulBrowserWidth ) {\n\t\t\tnewPosition = ruulBrowserWidth - ruulOpen;\n\t\t\t$(targetBlue).css('left', newPosition + 'px');\n\t\t\truulDataSaveBlue();\n\t\t};\n\t}", "title": "" }, { "docid": "14112de428fc05bc8e864bc7a25b617c", "score": "0.4498899", "text": "function addBoundary() {\n if(boundary) boundary.remove();\n boundary = new Boundary(playfieldWidth, playfieldHeight, iconSize*2);\n boundary.add();\n}", "title": "" }, { "docid": "6ebfe193927239bd44eb5591f62f632f", "score": "0.44898847", "text": "function placeWalls(){\n\n\t\tgrid.set(WALLS, COLS-1, ROWS-5);\n\t\tgrid.set(WALLS, COLS-18, ROWS-4);\n\t}", "title": "" }, { "docid": "d0ad5cee90bbf971c92d1744405a10b5", "score": "0.44744387", "text": "function setup() { \n $('body').layout()\n var $layout = $('body').data('lte.layout') \n $layout.activate();\n}", "title": "" }, { "docid": "3bd058af39480db6e4d9a19497edd258", "score": "0.4473101", "text": "function overBody(event) {\n\tif (loser !== null) {\n\t\tloser = \"loser\";\n\t\tvar walls = $$(\".boundary\");\n\t\tfor (var i = 0; i < walls.length; i++) {\n\t\t\twalls[i].addClassName(\"youlose\");\n\t\t}\n\t}\n}", "title": "" }, { "docid": "343ac5a6e7a029a47652eaeda46ce611", "score": "0.44640946", "text": "_outsideLink(url){if(0!=url.indexOf(\"http\"))return!1;var loc=location.href,path=location.pathname,root=loc.substring(0,loc.indexOf(path));return 0!=url.indexOf(root)}", "title": "" }, { "docid": "d7728ecfbc2b6f8d65e9ac469a13457b", "score": "0.44620693", "text": "function mkdSideAreaScroll(){\n\n var sideMenu = $('.mkd-side-menu');\n\n if(sideMenu.length){\n sideMenu.niceScroll({\n scrollspeed: 60,\n mousescrollstep: 40,\n cursorwidth: 0,\n cursorborder: 0,\n cursorborderradius: 0,\n cursorcolor: \"transparent\",\n autohidemode: false,\n horizrailenabled: false\n });\n }\n }", "title": "" }, { "docid": "f1c2b8c27c6fc7f26541730bc9f2c44f", "score": "0.44573608", "text": "viewport() {\n throw new Error('Not implemented');\n }", "title": "" }, { "docid": "1d59320dae912ecd57e88f76d5ef5642", "score": "0.44432878", "text": "collapseRightBarBreakPoint() {\n const { collapseRightBar, rightbarCollapsed } = this.props;\n if(window.innerWidth < PHONE_SCREENS_BREAKPOINT && !rightbarCollapsed) {\n collapseRightBar();\n }\n }", "title": "" }, { "docid": "2a808533313c01d561ced10d61add104", "score": "0.44368002", "text": "function showSidebar() {\n var app = HtmlService.createHtmlOutputFromFile(\"sidebar\").setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL).setTitle(\"DocuTube Watch\");\n DocumentApp.getUi().showSidebar(app);\n}", "title": "" }, { "docid": "4ca18184b291710d1c446f4e38aeef13", "score": "0.44338426", "text": "_toggleMobileAside() {\n if (this.mobileAsideRef) {\n const mAside = this.mobileAsideRef\n const currentTopY = window.scrollY\n\n // Calculate scrolling distance to determine whether to display aside\n const lastY = this.scrollPosition.y\n const distance = currentTopY - lastY\n if (distance > 30) {\n this.scrollPosition.y = currentTopY\n mAside.current.toShow = false\n } else {\n if (Math.abs(distance) > 150) {\n this.scrollPosition.y = currentTopY\n mAside.current.toShow = true\n }\n }\n }\n }", "title": "" }, { "docid": "c5897e5bfd2d41d5b3ebc37a21d5a8e4", "score": "0.44286793", "text": "function edgtfSideAreaScroll(){\n\n var sideMenu = $('.edgtf-side-menu');\n\n if(sideMenu.length){ \n sideMenu.niceScroll({ \n scrollspeed: 60,\n mousescrollstep: 40,\n cursorwidth: 0, \n cursorborder: 0,\n cursorborderradius: 0,\n cursorcolor: \"transparent\",\n autohidemode: false, \n horizrailenabled: false \n });\n }\n }", "title": "" }, { "docid": "c5897e5bfd2d41d5b3ebc37a21d5a8e4", "score": "0.44286793", "text": "function edgtfSideAreaScroll(){\n\n var sideMenu = $('.edgtf-side-menu');\n\n if(sideMenu.length){ \n sideMenu.niceScroll({ \n scrollspeed: 60,\n mousescrollstep: 40,\n cursorwidth: 0, \n cursorborder: 0,\n cursorborderradius: 0,\n cursorcolor: \"transparent\",\n autohidemode: false, \n horizrailenabled: false \n });\n }\n }", "title": "" }, { "docid": "c5897e5bfd2d41d5b3ebc37a21d5a8e4", "score": "0.44286793", "text": "function edgtfSideAreaScroll(){\n\n var sideMenu = $('.edgtf-side-menu');\n\n if(sideMenu.length){ \n sideMenu.niceScroll({ \n scrollspeed: 60,\n mousescrollstep: 40,\n cursorwidth: 0, \n cursorborder: 0,\n cursorborderradius: 0,\n cursorcolor: \"transparent\",\n autohidemode: false, \n horizrailenabled: false \n });\n }\n }", "title": "" }, { "docid": "3d54095ea0f8f62cfedc6442f09920f0", "score": "0.44181526", "text": "function renderRealEstatePage(req, res)\n{\n res.render('real_estate/estate', {\n data : {\n real_estate: req.real_estate,\n local : {stylesheets: ['section_padding.css', 'calc_layout.css']}\n },\n title: 'View Real Estate Estate: ' + req.real_estate.header\n });\n}", "title": "" }, { "docid": "4c264bf530b49f693076569121378d74", "score": "0.44014257", "text": "function hideShowUR(cy, ur, viewUtilities) {\n function urShow(eles) {\n return viewUtilities.show(eles);\n }\n\n function urHide(eles) {\n return viewUtilities.hide(eles);\n }\n\n function urShowHiddenNeighbors(eles) {\n return viewUtilities.showHiddenNeighbors(eles);\n }\n\n ur.action(\"show\", urShow, urHide);\n ur.action(\"hide\", urHide, urShow);\n ur.action(\"showHiddenNeighbors\",urShowHiddenNeighbors, urHide);\n}", "title": "" }, { "docid": "413171991e849f6abef2e2dff3ecfcdb", "score": "0.44011182", "text": "CreateBackScren() \n {\n var $body = $(\"body\");\n var hW = window.innerHeight;\n var hD = $body.outerHeight();\n var W = hD > hW ? hD : hW;\n\n var html = '<div style=\"position:absolute; z-index:1000; top:0px; left:0px; width:100%; height:' + W + 'px;\"> </div>';\n this.$back = $(html);\n\n $body.append(this.$back);\n\n var self = this;\n this.$back.on('click', function (ev) { self.Hide(); });\n }", "title": "" }, { "docid": "9db4faa755601e97e070133cef15ccc2", "score": "0.4391884", "text": "function render_static_page_with_sidebar(req, res, page_key, news=null){\n StaticPages.findOne({key: 'Sidebar'}, function(err,sidebar) {\n if (err) { res.redirect('/'); }\n render_static_page(req, res, page_key, sidebar, news)\n });\n}", "title": "" }, { "docid": "1e14f7e25ef6c767003832caf8f80355", "score": "0.43914276", "text": "appendView() {\n document.body.appendChild(this.view);\n }", "title": "" }, { "docid": "4ffe43f2f23f9fe890c414188667dbb5", "score": "0.43910012", "text": "elementMidViewport() {\n const y = this.activeNode.getBoundingClientRect().y;\n return y < 0 && y > -1 * this.activeNode.offsetHeight + 140;\n }", "title": "" }, { "docid": "0d51681c10d6f390b92fea209116eb7b", "score": "0.4384681", "text": "avoidWalls() {\n\n var buffer = mobile ? 5 : 15;\n\n if ( this.distanceFromHorWall() < this.radius * buffer || this.distanceFromVertWall() < this.radius * buffer ) {\n return this.seek(center);\n } else { return false; }\n\n }", "title": "" }, { "docid": "5594adfdc6cb9546af1332eea4017e42", "score": "0.43843022", "text": "render() {\n return (\n <BrowserRouter>\n <div className=\"row main-container\">\n <div className=\"col-sm-4 sidebar\">\n <Sidebar />\n </div>\n <div className=\"col-sm-8 main-content\">\n <MainContent />\n </div>\n </div>\n </BrowserRouter>\n );\n }", "title": "" }, { "docid": "8a92c84aa03b871c79d7892d2cca3609", "score": "0.43841863", "text": "function edges(){\n if(body[0].xPos < 0)\n body[0].xPos = width - 20;\n else if(body[0].xPos > width -20)\n body[0].xPos = 0;\n else if(body[0].yPos < 0)\n body[0].yPos = height - 20;\n else if(body[0].yPos > height -20)\n body[0].yPos = 0;\n}", "title": "" }, { "docid": "42cbe748eed9b0b5cfdeba955ed91b2a", "score": "0.4380766", "text": "function PortalOutlet() {}", "title": "" }, { "docid": "54f03f2fd48eba802b61b987a9c470fc", "score": "0.43784407", "text": "function createLivingRoomWalls()\n\t\t{\n\n\t\t // Right wall\n\t\t var rightWallGeometry = new THREE.BoxGeometry(500, 10, 200);\n\t\t var rightWall = new THREE.Mesh(rightWallGeometry, isnsideWallMaterial);\n\t\t rightWall.rotation.x = Math.PI / 180 * 90;\n\t\t rightWall.rotation.z = Math.PI / 180 * 90;\n\t\t rightWall.position.set(200, 100, -355);\n\n\t\t scene.add(rightWall);\n\n\t\t // Left wall\n\t\t var leftWallGeometry = new THREE.BoxGeometry(500, 10, 200);\n\t\t var leftWall = new THREE.Mesh(leftWallGeometry, isnsideWallMaterial);\n\t\t leftWall.rotation.x = Math.PI / 180 * 90;\n\t\t leftWall.rotation.z = Math.PI / 180 * 90;\n\t\t leftWall.position.set(-800, 100, -350);\n\n\t\t scene.add(leftWall);\n\n\t\t // Back wall\n\t\t var backWallGeometry = new THREE.BoxGeometry(1000, 10, 200);\n\t\t var backWall = new THREE.Mesh(backWallGeometry, openWallMaterial);\n\t\t backWall.rotation.x = Math.PI / 180 * 90;\n\t\t backWall.position.set(-300, 100, -700);\n\n\t\t scene.add(backWall);\n\n\t\t // front wall\n\t\t var frontWallGeometry = new THREE.BoxGeometry(500, 10, 200);\n\t\t var FrontWall = new THREE.Mesh(frontWallGeometry, openWallMaterial);\n\t\t FrontWall.rotation.x = Math.PI / 180 * 90;\n\t\t FrontWall.position.set(-550, 100, -100);\n\n\t\t scene.add(FrontWall);\n\t\t}", "title": "" }, { "docid": "087fddb83b5801162ac1677b97f99c50", "score": "0.437553", "text": "function overBoundary(event) {\n if(loser === false) {\n var divs = $$(\".boundary\");\n for (var i = 0;i < divs.length; ++i) {\n divs[i].addClassName(\"youlose\");\n }\n loser = true;\n overEnd();\n }\n}", "title": "" }, { "docid": "858c3e8a93f051678cb0d7029f281254", "score": "0.4370519", "text": "function overBody(event) {\n if (loser === false) {\n if (event.target.getAttribute(\"id\") === null) {\n overBoundary();\n }\n }\n}", "title": "" }, { "docid": "ba8995e396488515ab351d0a85c82068", "score": "0.4369198", "text": "function checkHiddenSidebar(){\n if ($(window).width() > 1040) {\n $('.sidebar').removeClass(\"hidden\")\n } else {\n $('.sidebar').addClass(\"hidden\")\n }\n $(contentContainer).css({\n filter: 'none'\n })\n}", "title": "" }, { "docid": "6a0a94a8b032a16ff8f6181999dfc579", "score": "0.43653518", "text": "function showWorld(boundaries) {\n \n Physicsb2.initializeView();\n $(\"#physicsMenu\").css(\"display\",\"inline-block\");\n $(\"#physicsContainer\").css(\"display\",\"inline-block\");\n $(\".physics-controls\").css(\"display\",\"inline-block\");\n updatePhysics(\"physicsOn\");\n $(\"#physicsContainer\").css(\"display\",\"inline-block\");\n console.log(\"change pointer events to auto\");\n $(\".netlogo-view-container\").css(\"pointer-events\",\"auto\");\n $(\".netlogo-view-container\").css(\"cursor\",\"pointer\");\n Physicsb2.bindElements();\n }", "title": "" }, { "docid": "e10df9e6c01d92196fb57960adcc3677", "score": "0.43633816", "text": "function overBoundary(event) {\n var divs = $$(\".boundary\");\n for (var i = 0; i < divs.length; i++) {\n divs[i].addClassName(\"youlose\");\n }\n loser = true;\n overEnd();\n}", "title": "" }, { "docid": "524219abce1d84030623234234d349b4", "score": "0.43598127", "text": "function showSidebar() {\n var ui = HtmlService\n .createHtmlOutputFromFile('sidebar')\n .setTitle('SlideTemplate');\n SlidesApp.getUi().showSidebar(ui);\n}", "title": "" }, { "docid": "45a1cdce57e207a901cc46e51a533952", "score": "0.43576303", "text": "function settingApplandingScroolDots() {\n if ($(\".home-app-landing\").length) {\n var dots = $(\".home-app-landing #navbar > ul\");\n var pageWrapper = $(\".home-app-landing\");\n var currentItem = dots.find(\".current a\");\n var allitem = dots.find(\"a\");\n\n allitem.each(function() {\n var $this = $(this);\n var $text = $this.text();\n $this.append(\"<span class='t-tips'>\" + $text +\"</span>\");\n });\n\n dots.clone().appendTo(pageWrapper).wrap( \"<div class='scroll-pointer'></div>\" );\n }\n }", "title": "" }, { "docid": "b9b7b297cab8a94d7d1f66577bd789b8", "score": "0.4351847", "text": "function overBody(event) {\n if (loser === false) {\n if (event.target.getAttribute(\"id\") === null) {\n overBoundary();\n }\n }\n}", "title": "" }, { "docid": "eda9dc88bc3230ff8a0a371fb80b178c", "score": "0.43500334", "text": "function rovoko_touched_side(){\n 'use strict';\n var $menu = $('.ef5-header-menu');\n if($(window).width() > 1200 ){\n $('#ef5-navigation').attr('style','');\n $menu.find('li').each(function(){\n var $submenu = $(this).find('> .ef5-dropdown');\n if($submenu.length > 0){\n if($submenu.offset().left + $submenu.outerWidth() > $(window).innerWidth()){\n $submenu.addClass('touched');\n } else if($submenu.offset().left < 0){\n $submenu.addClass('touched');\n }\n /* remove css style display from mobile to desktop menu */\n $submenu.css('display','');\n }\n });\n }\n }", "title": "" }, { "docid": "386714be8dbe3ab61a5036936fde69ae", "score": "0.43496975", "text": "get bodySite() {\n\t\treturn this.__bodySite;\n\t}", "title": "" }, { "docid": "ce383097df0f72177a924071be72d0fc", "score": "0.4347438", "text": "function appendVerticalWall (roomId, roomOptions, boxElement, rackRow, rackColumn, wallId, wallLength, wallDirection, wallPosition, isWallLong, baseWallLeft, baseWallTop) {\n\n let wallLeft = baseWallLeft;\n let wallTop = baseWallTop;\n\n if (wallPosition === \"right\") wallLeft += BOXWIDTH;\n let wallHeight = wallLength * boxElement.outerHeight();\n\n // If the beginning of the wall is in a edge of the room, we will avoid the room padding to increase UX\n if ((roomOptions.roomType === SDXROOMTYPE && rackRow == 1) || (roomOptions.roomType === USA15ROOMTYPE && rackRow == roomOptions.rows)) {\n wallHeight += parseFloat($(\".racksContainer\", \"#\" + roomId).css(\"padding-top\"));\n wallTop += -parseFloat($(\".racksContainer\", \"#\" + roomId).css(\"padding-top\"));\n }\n\n // If the end of the wall is in a edge of the room, we will avoid the room padding to increase UX\n if ((roomOptions.roomType === SDXROOMTYPE && rackRow + wallLength > roomOptions.rows) || (roomOptions.roomType === USA15ROOMTYPE && rackRow - wallLength < 1)) {\n wallHeight += parseFloat($(\".racksContainer\", \"#\" + roomId).css(\"padding-bottom\"));\n }\n\n $(\"#\" + roomId).append( \"<svg id='\" + wallId + \"' class='wall-container' height='\" + wallHeight + \"' width='4' style='left:\" + wallLeft + \"px; top:\" + wallTop + \"px'>\" +\n \"<line class='wall' x1='0' y1='0' x2='0' y2='\" + (wallHeight - 1) + \"'/>\" +\n \"</svg>\");\n}", "title": "" }, { "docid": "4e6343945c11f535a2a72ca7012525e1", "score": "0.43448448", "text": "configure(R,Events){\n\t\tEvents.register({\n\t\t\t'before:middleware':function(){\n\t\t\t\tR.app.get('/raptor/home',function(req,res,next){\n\t\t\t\t\treq.viewPlugin.set('raptorpanel_sidebar_main','<li class=\"nav-item\"><a class=\"nav-link ngPortal-embedded\" target=\"_blank\" href=\"/public/'+R.bundles['apidoc'].vendor+'/apidoc/base.html\"> Documentación v'+R.bundles['apidoc'].manifest.version+'</a></li>')\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}", "title": "" }, { "docid": "b82aa146d05d52e0daeafd264b5ce5d9", "score": "0.43408498", "text": "function PortalOutlet() { }", "title": "" }, { "docid": "b82aa146d05d52e0daeafd264b5ce5d9", "score": "0.43408498", "text": "function PortalOutlet() { }", "title": "" }, { "docid": "3d8ba90aaa14ae39bda9be098cf76a39", "score": "0.43404335", "text": "function launchRailgun() {\n\trailgunMode = railgunDefaultMode;\n\t//var contentWidth = $('#WikiaMainContent').width();\n\t//var catlinksWidth = $('#catlinks').width();\n\tvar railgunModeButton = \"\";\n \n\tif (railgunMode == 0) {\n\t\trailgunModeButton = '<li><ul id=\"railgunModeButton\" class=\"wikia-menu-button\"><a onclick=\"setRailgunMode1();\" data-id=\"railgunModeButton\" style=\"color:#fff; width: 15px; text-align:center\" title=\"go to -\">+</a></ul></li>';\n\t\t$(railgunModeButton).appendTo('.tools');\n \n\t\t// Initialization for mode 0\n\t\tif (!window.hasRailgunModule) {\n\t\t\taddRailgunModule();\n\t\t}\n\t} else if (railgunMode == 1) {\n\t\trailgunModeButton = '<li><ul id=\"railgunModeButton\" class=\"wikia-menu-button\"><a onclick=\"setRailgunMode2();\" data-id=\"railgunModeButton\" style=\"color:#fff; width: 15px; text-align:center\" title=\"go to W\">-</a></ul></li>';\n\t\t$(railgunModeButton).appendTo('.tools');\n \n\t\t// Initialization for mode 1\n\t\tdocument.getElementById('WikiaRail').style.display = 'none';\n\t\tdocument.getElementById('WikiaMainContent').style.width = '1000px';\n\t\tdocument.getElementById('catlinks').style.width = '1000px';\n\t} else {\n\t\trailgunButton = '<li><ul id=\"railgunModeButton\" class=\"wikia-menu-button\"><a onclick=\"setRailgunMode0();\" data-id=\"railgunModeButton\" style=\"color:#fff; width: 15px; text-align:center\" title=\"go to +\">W</a></ul></li>';\n\t\t$(railgunModeButton).appendTo('.tools');\n \n\t\t// Initialization for mode 2\n\t\tdocument.getElementById('WikiaRail').style.display = 'block';\n\t\tdocument.getElementById('WikiaMainContent').style.width = '680px';\n\t\tdocument.getElementById('catlinks').style.width = '638px';\n\t}\n}", "title": "" }, { "docid": "36804a3fbd8ccdd508ab8e2c865bd643", "score": "0.4337616", "text": "function setRailgunMode2() {\n\t$('#railgunModeButton a').replaceWith('<a onclick=\"setRailgunMode0();\" style=\"color:#fff; width: 15px; text-align:center\" title=\"go to +\">W</a>');\n\tdocument.getElementById('WikiaRail').style.display = 'block';\n\tdocument.getElementById('WikiaMainContent').style.width = '680px';\n\tdocument.getElementById('catlinks').style.width = '638px';\n\trailgunMode = 2;\n}", "title": "" }, { "docid": "0eb1f7e9217dcc36fa2b14b74cf8d64e", "score": "0.43366462", "text": "function hideAreas(color) {\n // Walkthrough areas\n if (!color) color = '#dddddd';\n _.each($scope.map.dataProvider.areas, function(area) {\n if (area.id !== 'divider1') {\n area.colorReal = area.originalColor = color;\n area.mouseEnabled = true;\n area.balloonText = '[[title]]';\n }\n });\n } //hideAreas(color)", "title": "" }, { "docid": "9b2ea6f205cda8afd0313ce31ceeed65", "score": "0.43295202", "text": "function App() {\n return (\n <main>\n <section class=\"dashboard\">\n \n <Sidebar />\n \n \n <Router>\n\n <div class=\"content\">\n <NavBar />\n <Switch>\n <Route component={Projects} path='/projects' />\n <Route component={About} path='/about' />\n <Route component={Blog} path='/blog' />\n </Switch>\n </div>\n\n </Router>\n </section>\n <img class=\"pb\" src={'https://assets.stickpng.com/images/5a059a909cf05203c4b6045b.png'} alt={'power button'}/>\n </main>\n );\n}", "title": "" }, { "docid": "e14bcc5ab022f260dc02f4d678a9272b", "score": "0.4328403", "text": "function moveVeryFarRight() {\n if (validRegion()) {\n var newStart = viewRegStart + (viewRegEnd-viewRegStart);\n var newEnd = viewRegEnd + (viewRegEnd-viewRegStart);\n render(viewRefName, newStart, newEnd);\n }\n}", "title": "" }, { "docid": "93c83e143000d4e4986b69c41e8ce8d1", "score": "0.43269908", "text": "function responsiveAside() {\n var aside = jQuery('.region-sidebar-second');\n var side = jQuery('.region-sidebar-first');\n}", "title": "" }, { "docid": "98901475b0488e16b40c162f5b7d7779", "score": "0.43250588", "text": "edges() {\n\t\tif (this.pos.x <= 0 || this.pos.x >= width || this.pos.y <= 0 || this.pos.y >= height) {\n\t\t\tw = new Walker();\n\t\t}\n\t}", "title": "" }, { "docid": "d98c372ec081a33cdf80adde17f28515", "score": "0.43246776", "text": "function _default(ecModel, api) {\n ecModel.eachSeriesByType('themeRiver', function (seriesModel) {\n var data = seriesModel.getData();\n var single = seriesModel.coordinateSystem;\n var layoutInfo = {}; // use the axis boundingRect for view\n\n var rect = single.getRect();\n layoutInfo.rect = rect;\n var boundaryGap = seriesModel.get('boundaryGap');\n var axis = single.getAxis();\n layoutInfo.boundaryGap = boundaryGap;\n\n if (axis.orient === 'horizontal') {\n boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.height);\n boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.height);\n var height = rect.height - boundaryGap[0] - boundaryGap[1];\n themeRiverLayout(data, seriesModel, height);\n } else {\n boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.width);\n boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.width);\n var width = rect.width - boundaryGap[0] - boundaryGap[1];\n themeRiverLayout(data, seriesModel, width);\n }\n\n data.setLayout('layoutInfo', layoutInfo);\n });\n}", "title": "" }, { "docid": "34d7e763348aff7f722f431730d013f6", "score": "0.43240014", "text": "function portalSmallBreakPoint() { return 800; }", "title": "" }, { "docid": "4694abde0ca507e08d1f5954aa7ea045", "score": "0.43231165", "text": "function setRailgunMode1() {\n\t$('.RailgunModule').replaceWith('');\n\thasRailgunModule = false;\n\t$('#railgunModeButton a').replaceWith('<a onclick=\"setRailgunMode2();\" style=\"color:#fff; width: 15px; text-align:center\" title=\"go to W\">-</a>');\n\tdocument.getElementById('WikiaRail').style.display = 'none';\n\tdocument.getElementById('WikiaMainContent').style.width = '1000px';\n\tdocument.getElementById('catlinks').style.width = '1000px';\n\trailgunMode = 1;\n}", "title": "" }, { "docid": "12e28436edfaf74d4d856acc2b05376d", "score": "0.43194443", "text": "function serveLandingPage(req, res) {\n var location = req.protocol + '://' + req.get('host') + req.originalUrl;\n res.render('index.ejs', {\n location: location\n });\n} //end serveLandingPage", "title": "" }, { "docid": "1c8107b26df017b7f5f2826ec4448ddd", "score": "0.43187964", "text": "function init_view() {\n\n var sticked = false;\n\n //corremos sticky si no es mobile < 770px\n if(!isMobile())\n {\n $(\"#sticker-sidebar\").sticky({topSpacing:71});\n sticked = true;\n\n }\n\n //paramos sticky si colapsa a los 770px\n $( window ).resize(function() {\n if(isMobile() && sticked) {\n $(\"#sticker-sidebar\").unstick();\n }\n });\n}", "title": "" }, { "docid": "ddb41f609d249ad18b2ce36091663213", "score": "0.43165043", "text": "function breadcumb_trail(aaid) {\n // load current AA trail pointer\n GeoAdminArea.load({ aa : aaid }, function (err, aa_trail) {\n // error handling\n if (err) return res.render('500')\n\n // query criteria\n var options = {\n criteria: { parent_id: aa_trail.parent_id },\n fields: { aaid: 1, name: 1, breadcrumb : 1 }\n }\n\n // get the list of requested elements\n GeoAdminArea.list(options, function(err, sibling_aa) {\n // error handling\n if (err) return res.render('500')\n\n // execute!\n GeoAdminArea.count().exec(function (err, count) {\n\n breadcrumbs.unshift({\n select: aa_trail,\n list : sibling_aa,\n });\n\n // ok, trail is completed, now we will provide children selection and render\n if (aa_trail.parent_id == 0) {\n // query criteria\n var options = {\n criteria: { parent_id: req.params.aaid },\n fields: { aaid: 1, name: 1, breadcrumb : 1 }\n }\n\n // get the list of requested elements\n GeoAdminArea.list(options, function(err, children_aa) {\n // error handling\n if (err) return res.render('500')\n\n // execute!\n GeoAdminArea.count().exec(function (err, count) {\n breadcrumbs.push({\n select: {\n type: req.geoadminarea.type + 1\n },\n list: children_aa,\n })\n\n // also load stats data\n StatsAdminArea.load(req.params.aaid, function (err, statsadminarea) {\n if (err) { statsadminarea = null; }\n\n // do\n var info = {\n aaid : req.geoadminarea.aaid,\n aa_name : req.geoadminarea.name,\n geoadmindivision_name_raw : req.geoadmindivisions[req.geoadminarea.type],\n }\n\n if (statsadminarea != null && statsadminarea.top.incendio.date != 0) {\n // Render the statistics verbose.\n\n moment.lang(i18n.getLocale());\n\n var stats = {\n occurrences : statsadminarea.total,\n top : {\n year : {\n year : statsadminarea.top.year,\n },\n fire : {\n date : moment(statsadminarea.top.incendio.date, \"YYYY-MM-DD\").format('LL'),\n ha : statsadminarea.top.incendio.aa_total\n }\n }\n };\n\n // Get area for top incêndio.\n // Loop through data array to get correct year.\n for (var i = 0; i < statsadminarea.data.length; i++) {\n var data_year = statsadminarea.data[i];\n if (data_year.year == statsadminarea.top.year) {\n stats['top_year_ha'] = Math.round(data_year.aa_total);\n stats.top.year.ha = Math.round(data_year.aa_total);\n break;\n }\n }\n\n }\n\n // render!\n res.render('geoadminarea', {\n title: info.aa_name,\n info: info,\n breadcrumbs: breadcrumbs,\n show_charts: statsadminarea == null ? false : true,\n stats: stats,\n menus: req.menus,\n page_meta : {\n type: 'geoadminarea',\n url : req.url,\n full_url : get_current_url(req),\n lang : i18n.getLocale(),\n _translations : GeoAdminArea.get_translations(req),\n },\n admin_divisions: req.geoadmindivisions\n });\n // send JSON\n // res.send(breadcrumbs)\n\n })\n })\n })\n\n }\n else {\n breadcumb_trail(aa_trail.parent_id)\n }\n\n })\n })\n })\n }", "title": "" }, { "docid": "534d3c7031b8162409f4c39d6a895400", "score": "0.431135", "text": "function anchorBodyContent($id){\n var anchor = \"\";\n // scrollbar = window.scrollbar\n var to = $id + \"-anchor\";\n var $to = \"#\" + $id + \"-anchor\";\n anchor = document.getElementById(to);\n\n if (ifwidth >= 744) {\n $(window).scrollTo(0);\n scrollbar.scrollIntoView(document.getElementById(to), {\n offsetTop: 0,\n alignToTop: true,\n onlyScrollIfNeeded: true\n });\n } else {\n $(window).scrollTo($to, {\n offset: -56,\n duration:800\n });\n }\n}", "title": "" }, { "docid": "dfb46d1e7074e188f26ef238c4c8aa61", "score": "0.43090454", "text": "function grid() {\n\n\t\t$( '#primary' ).removeAttr( 'style' );\n\n\t\tif( $( window ).width() > 959 ) {\n\n\t\t\tvar $right = $( '#primary' ).height(),\n\t\t\t $left = $( '#masthead' ).height() + $( '#secondary' ).height();\n\n\t\t} else {\n\n\t\t\tvar $right = $( '#primary' ).height(),\n\t\t\t $left = $( '#secondary' ).height() - $( '#masthead' ).height();\n\n\t\t}\n\n\t\tif( $left >= $right ) {\n\n\t\t\t$( '#primary' ).css( 'min-height', $left );\n\n\t\t} else {\n\n\t\t\t$( '#content' ).removeAttr( 'class' );\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "49df8d0d8e3049cb3c339b1a6125b42d", "score": "0.4306754", "text": "function showMain() {\n var headerEle = document.querySelector('header');\n var searchBarEle = document.getElementById('search-container');\n var discoveryEle = document.getElementById('explore');\n var aboutEle = document.getElementById('about');\n var footerEle = document.querySelector('footer');\n var bodyEle = document.getElementsByTagName('body');\n\n bodyEle[0].classList.remove('no-scroll');\n headerEle.classList.remove('hide');\n searchBarEle.classList.remove('hide');\n discoveryEle.classList.remove('hide');\n aboutEle.classList.remove('hide');\n footerEle.classList.remove('hide');\n\n // Hide Photos and Map Section\n hideResults();\n window.location.hash = '#';\n}", "title": "" }, { "docid": "60545ef3c47e1ef34dd7d64f83f58c89", "score": "0.43040314", "text": "function hideContent() {\n $(\"#blogs\").hide();\n // $(\"#whitepapers\").hide();\n $(\".menu-item-3\").hide();\n $(\"#wow .blog-daphne\").hide();\n $(\"#wow #whitepapersblogs\").hide();\n $(\"#wow .mobile-menu-2\").hide();\n $(\"#nav-bar.wow .menu-item-5\").hide();\n $(\".roadmap-page .section .stage .btn-primary-invert\").hide();\n}", "title": "" } ]
c9c16ce5c35ea181062c23fcbeedd620
checks to see if the place has a phone
[ { "docid": "ebf68c3b613e66ea4af1e2c0b81e9b50", "score": "0.73335046", "text": "function checkPhone() {\n let phone = place.formatted_phone_number;\n\n if (typeof phone !== typeof undefined && phone !== false) {\n //if phone number is present, add phone to the content\n return `<br> ${phone} <br>`;\n\n } else {\n //else just had a space\n return `<br>`;\n }\n\n }", "title": "" } ]
[ { "docid": "1470d85eac9de678661c66574b0cd558", "score": "0.7153267", "text": "function checkPhone(input){\n\tconst numRegex = /(?<!\\+\\d+)(?<=\\d) +(?=\\d)/g;\n\n\tif(numRegex.test(input)){\t\t\t\n\t\tinput = input.replace(numRegex, \"\");\t\n\t\tknwlInstance.init(input);\n\t}\n\tvar phone = knwlInstance.get('phones')\n\n\tif(phone != \"undefined\" && phone.length > 0 && !phones.includes(phone[0].phone))\n\t{\n\t\tphones.push(phone[0].phone);\n\t}\n}", "title": "" }, { "docid": "4e86559b6946e0357f6087a15a79c727", "score": "0.6994438", "text": "phone() {\n this._value = this._value.replace( /[^\\d]+/g, '' );\n return this._test( /^[\\d]{10,11}$/, 'must be a valid phone number' );\n }", "title": "" }, { "docid": "0c454962fbbb00eac7b61934a39312fb", "score": "0.6957808", "text": "function checkPhoneNum(num) {\n return (/\\+380-\\d{2}-\\d{3}-\\d{2}-\\d{2}/).test(num);\n}", "title": "" }, { "docid": "91c4f03244e6d76e8286482f2b061209", "score": "0.69101673", "text": "function possuiPhone(phone){\r\n\tvar re = /\\d\\d ? \\)?[\\d ]{8,9}/;\r\n\treturn re.test(phone);\r\n}", "title": "" }, { "docid": "7af3fbccad38427756bc424e69739173", "score": "0.68518764", "text": "function isValidPhone(phone) {\n\t\tvar isValid=true;\n\t\tif(phone.length > 0)\n\t\t{\n\t\t\tvar ph = phone.toString().replace(/\\+/g, '').replace(/-/g, '');\n\t\t\tisValid = !isNaN(ph);\n\t\t}\n \n return isValid;\n }", "title": "" }, { "docid": "3fc90dfd1e10824049f23322b05bfe72", "score": "0.67210966", "text": "function validatePhone() {\n var p = /^[0-9]+[0-9]+[0-9]+[_.-]+[0-9]+[0-9]+[0-9]+[_.-]+[0-9]+[0-9]+[0-9]+[0-9]$/; //This is a regular expression for a phone\n if (p.test(userPhoneVal)) {\n return true;\n } else {\n userPhoneError.show();\n return false;\n }\n }", "title": "" }, { "docid": "6939f18f48f678f91231a6a1f8b1a388", "score": "0.6719496", "text": "checkPhone(phone) {\n\n const regex = /\\+?[7,8][0-9]{10}/,\n result = phone.match(regex);\n\n return result;\n\n }", "title": "" }, { "docid": "039943daea2de828c8a8aaba3262da00", "score": "0.66828114", "text": "isLandPhone(value, message=''){\r\n value = this.removeSpace(value);\r\n if(/^0\\d{2,3}-?\\d{6,8}$/.test(value)){\r\n return true;\r\n }else{\r\n if(message!=''){\r\n Message.error(message);\r\n }\r\n return false;\r\n }\r\n }", "title": "" }, { "docid": "5603aee2c1db107416b3a9221f8ec4a7", "score": "0.6668364", "text": "function checkPhone(id) {\n\tvar phone = document.getElementById(id).value;\n\tif (!phone) {\n\t\treturn false;\n\t}\n\tvar rv_phone = /^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$/im;\n\tif(phone != '' && rv_phone.test(phone)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "title": "" }, { "docid": "b74c8926dca923dbdf77a862c8169f65", "score": "0.6648982", "text": "function isPhoneNumber(value) {\n return isString(value) && value.match(/^\\d{11}$/);\n }", "title": "" }, { "docid": "c47404a4cb283548c7f9c110f7631e8d", "score": "0.66235137", "text": "function validatePhone(phone) {\n var vast_nummer = /^(((0)[1-9]{2}[0-9][-]?[1-9][0-9]{5})|((\\\\+31|0|0031)[1-9][0-9][-]?[1-9][0-9]{6}))$/;\n var mobiel_nummer = /^(((\\\\+31|0|0031)6){1}[1-9]{1}[0-9]{7})$/i;\n return (vast_nummer.test(phone) || mobiel_nummer.test(phone));\n }", "title": "" }, { "docid": "a9a91328c42cfe4a3422957eccf7edbe", "score": "0.6603913", "text": "function validatePhone(value) {\n if (!value || value === \"/\") {\n return true\n } else {\n var regExp = /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/\n\n return regExp.test(value)\n }\n\t}", "title": "" }, { "docid": "76d48df4b758cac1ee0be8ee5f5287fb", "score": "0.6592286", "text": "function phoneValid(phone) {\n if (!phone) {\n return false;\n }\n if (phone[0] !== '+') {\n phone = '+'.concat(phone);\n }\n return intlTelInputUtils.isValidNumber(phone);\n }", "title": "" }, { "docid": "ae752717cb21ba067a90d851366426d0", "score": "0.6581101", "text": "function validatePhone(phone){\n\n var phoneRegex = /^\\D*(\\d{3})\\D*(\\d{3})\\D*(\\d{4})\\D*(\\d*)$/xi/;\n return phone.match(phoneRegex) !== null;\n}", "title": "" }, { "docid": "7dcb5eb11da64179e366d441cc080b1d", "score": "0.6528821", "text": "function validatePhone(p) {\n const phoneRe = /^[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{3}$/\n const digits = p.replace(/\\D/g, '')\n return phoneRe.test(digits);\n}", "title": "" }, { "docid": "d9a7f542c61cf9a48a9b78052c46cafe", "score": "0.6510282", "text": "function isPhoneNumberValid() {\r\n var pattern = /^\\+[0-9\\s\\-\\(\\)]+$/;\r\n var phoneNumber = getPhoneNumberFromUserInput();\r\n return phoneNumber.search(pattern) !== -1;\r\n}", "title": "" }, { "docid": "7f75b7e4c4cbb90b992e5e7a3a3d4d3d", "score": "0.64531535", "text": "function isValidPhone(phone) {\n var re = /^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$/;\n return re.test(phone);\n}", "title": "" }, { "docid": "225f43addcc8d88177f0ec8321640954", "score": "0.64475393", "text": "function validatePhone(txtPhone) {\n var a = txtPhone;\n var getlength = a.length;\n if (getlength > 10)\n {\n var filter = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;\n\n if (filter.test(a)) {\n return \"1\";\n }\n else {\n return \"2\";\n }\n }\n else\n {\n return \"3\";\n }\n }", "title": "" }, { "docid": "db02dbd8e4a35e6dcc91cf492b12c84d", "score": "0.6438981", "text": "function telephoneCheck(str) {\n // Good luck!\n return true;\n}", "title": "" }, { "docid": "f015222c179b847186ff4145924a901d", "score": "0.6404359", "text": "static checkPhone(phone) {\n return catchValidation(() => PhoneNumber.validate(phone, PHONE_CONSTRAINTS), \"The shelters phone number is not given or nor in given Format!\");\n }", "title": "" }, { "docid": "0b5fca25b0d02abc4a4132dd537cfde5", "score": "0.6403251", "text": "function isPhone(obj,text)\n{\n\tvar phoneExp = /^[\\d]+[-]*[\\d]+$/;\n\tvar chkString = obj.value;\n\tvar chkLength = chkString.length;\n\t\n\t if( chkLength > 0 )\n\t {\t\n\t\tif (isValid(phoneExp,chkString))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\talert(\"Please enter proper phone number in \"+text+\" field\");\n\t\t\tobj.select();\n\t\t\treturn false;\n\t\t}\t\n\t}\n\telse\n {\n\t\treturn true;\n }\t\n}", "title": "" }, { "docid": "f6fc61d2ab40250fc427fffc684b4f85", "score": "0.63868064", "text": "function validatePhone(phone) {\n const expression = /^[+]*[(]{0,1}[0-9]{1,3}[)]{0,1}[-\\s\\./0-9]*$/g;\n return expression.test(phone);\n}", "title": "" }, { "docid": "b87554539e4653485190d2f2baf90ec4", "score": "0.6381846", "text": "function phone(input)\n{\n\tif ( input.val().search(/^((\\+)?[1-9]{1,2})?([-\\s\\.])?((\\(\\d{1,4}\\))|\\d{1,4})(([-\\s\\.])?[0-9]{1,12}){1,2}(\\s*(ext|x)\\s*\\.?:?\\s*([0-9]+))?$/) < 0 )\n\t{\n\t\tdisplayValidateFailMessage( input, input.data('message') );\n\t\treturn false;\n\t}\n\treturn true;\n}", "title": "" }, { "docid": "2e10f74bfb0e91b3dd4b647d731f332a", "score": "0.63793916", "text": "function checkPhone (strng) {\r\nvar error = \"\";\r\nif (strng == \"\") {\r\n error = \"You didn't enter a phone number.\\n\";\r\n}\r\nvar stripped = strng.replace(/[\\(\\)\\.\\-\\ ]/g, ''); //strip out acceptable non-numeric characters\r\n if (isNaN(parseInt(stripped))) {\r\n error = \"The phone number contains illegal characters.\";\r\n\r\n }\r\n if (!(stripped.length == 10)) {\r\nerror = \"The phone number is the wrong length. Make sure you included an area code.\\n\";\r\n } \r\nreturn error;\r\n}", "title": "" }, { "docid": "7f137514fe014818d77e907de242b9ef", "score": "0.63646543", "text": "function validate_phone_number (phone) {\n\n\t// North American Regex\n\tvar regex_NA = /^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;\n\n\t// International Regex\n\tvar regex_int = /^\\+(?:[0-9] ?){6,14}[0-9]$/;\n\n\tvar valid = ((regex_NA.test(phone) || regex_int.test(phone)) ? true : false);\n\treturn valid;\n}", "title": "" }, { "docid": "5d2208f38116cc8a98ec4dbbe1d5f271", "score": "0.63153154", "text": "function checkPhone (strng) \r\n{\r\n\tvar error = \"\";\r\n\tif (strng == \"\") \r\n\t{\r\n\t\terror = \"You didn't enter a phone number.\\n\";\r\n\t}\r\n\tvar stripped = strng.replace(/[\\(\\)\\.\\-\\ ]/g, ''); //strip out acceptable non-numeric characters\r\n\tif (isNaN(parseInt(stripped))) \r\n\t{\r\n\t\terror = \"The phone number contains illegal characters.\";\r\n\t}\r\n\t if ((stripped.length < 10)) \r\n\t{\r\n\t\terror = \"The phone number is the wrong length. Make sure you included an area code.\\n\";\r\n\t} \r\n\treturn error;\r\n}", "title": "" }, { "docid": "10b8e92001f634296891aa0873a64733", "score": "0.6310282", "text": "function verify_phone (strng) {\nvar error = \"\";\nif (strng == \"\") {\n error = \"You didn't enter a phone number.\\n\";\n}\n//strip out acceptable non-numeric characters\nvar stripped = strng.replace(/[\\(\\)\\.\\-\\ ]/g, '');\n if (isNaN(parseInt(stripped))) {\n error = \"The phone number contains illegal characters.\";\n\n }\n if (!(stripped.length == 10)) {\n error = \"The phone number is the wrong length. Make sure you included an area code.\\n\";\n }\nreturn error;\n}", "title": "" }, { "docid": "ed317059fec4a4f8e2f7e4db3fb5e9ce", "score": "0.62912965", "text": "validatePhoneNumber(){\n let reg = /^([\\d]{2})(\\-)([789])([\\d]{9})$/\n if(reg.test(user_object.phoneNumber)){\n console.log(\"Phone Number\\t\\t\\t\\t\\t:\\t\" +\"Valid\");\n }else{\n console.log(\"Phone Number\\t\\t\\t\\t\\t:\\t\" +\"Invalid\");\n }\n }", "title": "" }, { "docid": "c0581e1745893990db34efcdf8f0ba8f", "score": "0.62814635", "text": "function isPhoneWellFormed() {\r\n\tvar rg = new RegExp(\"^([0-9]{2}[ -]?){4}[0-9]{2}$\");\r\n\tif (!rg.test($(this).val())) {\r\n\t\t$(this).closest(\"div\").removeClass(\"has-success\").addClass(\"has-error\");\r\n\t\t$(this).next().removeClass(\"glyphicon-ok\").addClass(\"glyphicon-remove\");\r\n\t\treturn false;\r\n\t}\r\n\t$(this).closest(\"div\").removeClass(\"has-error\").addClass(\"has-success\");\r\n\t$(this).next().removeClass(\"glyphicon-remove\").addClass(\"glyphicon-ok\");\r\n\treturn true;\r\n}", "title": "" }, { "docid": "0d7883e1ded5fe6f50217c5268c29af5", "score": "0.62717533", "text": "function checkPhone(str)\n{ \nreturn (s.toString().search(/^[0-9]+$/) == 0);\n}", "title": "" }, { "docid": "dcdc2dd2af25daf94fccd1dbab855b8b", "score": "0.6237358", "text": "function doPhoneCheck(pNum) {\n\t var validOrNot = false,\n\t\tre = /^\\d{3}-\\d{3}-\\d{4}|^\\d{1,2}-\\d{3}-\\d{3}-\\d{4}\\b/gi;\n\t \n\t if (re.test(pNum)) {\n\t\tvalidOrNot = true;\n\t };\n\t \n\t return validOrNot;\n\t}", "title": "" }, { "docid": "6f34a4c4b8b0eb26999999848b0822d4", "score": "0.62271464", "text": "function verifyPhone(valueGiven){\n\tvar isphone = /^(1\\s|1|)?((\\(\\d{3}\\))|\\d{3})(\\-|\\s)?(\\d{3})(\\-|\\s)?(\\d{4})$/.test(valueGiven);\n\tif(!isphone){\n\t\terrorMessage=errorMessage+\"The field Phone Number must be in the form 555-555-5555,(555) 555-5555 or 1 555 555 5555. \";\n\t}\n\treturn isphone;\n\n}", "title": "" }, { "docid": "5941463c0256fce9a8f9462437d57eea", "score": "0.61536956", "text": "function fsPhoneNumber() {\n\tvar self = this;\n\n\tcallFoursquare(this.name, function(places) {\n\t\tif(!places.contact.formattedPhone) {\n self.phoneMsg(\"No phone number on foursquare available!\");\n } else {\n if(self.international_phone_number === places.contact.formattedPhone) {\n self.phoneMsg(\"Phone numbers match!\");\n } else {\n self.phoneMsg(\"Phone numbers don't match, try both!</br>\"+\n self.international_phone_number+\"</br>\"+\n places.contact.formattedPhone);\n }\n }\n\t});\n}", "title": "" }, { "docid": "9bcca3861a8bc18dc595082083d6fdf8", "score": "0.6107489", "text": "function is_viable_phone_number(number) {\n \treturn number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n }", "title": "" }, { "docid": "2cc3d36c2a333ad28a53877168870b4a", "score": "0.6085066", "text": "function isPhoneNum(input) {\n\t\treturn input.match(/^((03|04|06|07|09)\\d{7})|((021|022|025|027|028|029)\\d{6,8})|((0508|0800|0900)\\d{5,8})$/);\n\t}", "title": "" }, { "docid": "3012938ed94d3c20de02a42214f39a7b", "score": "0.60741204", "text": "function validPhone (num) {\n if (!num){\n return false;\n }\n return (num.length === 9 && /^\\d+$/.test(num));\n}", "title": "" }, { "docid": "da70166b293b3fa89c00f3d208ed06ff", "score": "0.6061083", "text": "function validatePhoneCode(code) {\n return phonecodes[code] ? true : false;\n}", "title": "" }, { "docid": "c302051ada65210a1b35676f1b71df16", "score": "0.6058422", "text": "function checkphoneNumber(number){\n var regex_phone = /^\\(?([0-9]{3})\\)?[-]?([0-9]{3})[-]?([0-9]{4})$/ ;\n if(number.value.match(regex_phone)){\n return true;\n }else{\n return false;\n }\n}", "title": "" }, { "docid": "dae10241e34e45249698b17706a9e873", "score": "0.60514855", "text": "function checkPhone() {\n console.log('checkPhone triggered');\n}", "title": "" }, { "docid": "bcd6a7aa9fe3e5cdd35fb9c04f497a72", "score": "0.6050404", "text": "function isValidPhones(telNumber, mobileTelNumber)\n{\n\treturn (isValidTelNumber(telNumber) == true) || (isValidMobileTelNumber(mobileTelNumber) == true);\n}", "title": "" }, { "docid": "f75815765f16136288629de83098e284", "score": "0.60458535", "text": "function isPhoneNumber (s)\n{ var modString;\n if (isEmpty(s)) \n if (isPhoneNumber.arguments.length == 1) return defaultEmptyOK;\n else return (isPhoneNumber.arguments[1] == true);\n modString = stripCharsInBag( s, phoneChars );\n return (isInteger(modString))\n}", "title": "" }, { "docid": "54cdb49f7f8567de1e3bb8f33c880e17", "score": "0.6038114", "text": "function isUSPhoneNumber (s)\n{\n if (isEmpty(s))\n if (isUSPhoneNumber.arguments.length == 1) return defaultEmptyOK;\n else return (isUSPhoneNumber.arguments[1] == true);\n return (isInteger(s) && s.length == digitsInUSPhoneNumber)\n}", "title": "" }, { "docid": "7b32484e5f2d9616c99d592354889126", "score": "0.60346776", "text": "function validatePhone(data) {\n\tvar regex = /^[\\s(\\.)+-]*([0-9][\\s(\\.)+-]*){6,20}(?:[\\-\\.\\ \\\\\\/]?(?:#|ext\\.?|extension|x)[\\-\\.\\ \\\\\\/]?(\\d+))?$/i;\n\n\treturn regex.test(data);\n} // END: validatePhone", "title": "" }, { "docid": "9d4ffeaab663f9fcd2cd210546bb0520", "score": "0.6014654", "text": "function isPhoneNumber(input)\n{\n input= $.trim(input);\n var regExp = new RegExp(\"^[0-9]{3}-[0-9]{3}-[0-9]{4}|[0-9]{3}-[0-9]{4}-[0-9]{4}|[0-9]{10}|[0-9]{11}|[0-9]{2}-[0-9]{4}-[0-9]{4}$\");\n\n console.log('phone number:'+regExp.test(input));\n return regExp.test(input);\n}", "title": "" }, { "docid": "15d2e53d2b8b7686ad367f86c43f71f6", "score": "0.60052043", "text": "isNationalLocation() {\n return this.locationPhone === \"national\"\n }", "title": "" }, { "docid": "2b38318ccacdf233a137092ffadb3b1c", "score": "0.60036314", "text": "function validatePhone() {\n var value = $phoneInput.value;\n if (/\\D/.test(value)) {\n showErrorMessage($phoneInput, 'Enter a valid Phone number: 123-123-1234');\n return false;\n }\n showErrorMessage($phoneInput, null);\n return true;\n }", "title": "" }, { "docid": "61358b03ab7a0ac7184cdb2b0122fb72", "score": "0.5994199", "text": "function validatphone() {\n const phonere = /^[0-9]{10}$/;\n\n if (!phonere.test(phoneInput.value)) {\n phoneInput.classList.add(\"is-invalid\");\n phoneInput.classList.remove(\"is-valid\");\n } else {\n phoneInput.classList.remove(\"is-invalid\");\n phoneInput.classList.add(\"is-valid\");\n }\n}", "title": "" }, { "docid": "8ea41c77141dc8bdaaec169401d8cf3c", "score": "0.5991814", "text": "function is_viable_phone_number(number) {\n\treturn number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n}", "title": "" }, { "docid": "fbfec6d7d2ac92f4c08823cb4ac8cee7", "score": "0.5974867", "text": "function check_phone(){\n\tvar phone = $(\"#input-phone\").val();\n\tif (phone.length!=10) {\n\t\t$('#input-phone').removeClass('green_bcolor');\n\t\t$('.label-phone').removeClass('green_label_val');\n\t\t$('#input-phone').addClass('bcolor');\n\t\t$('.label-phone').addClass('label_val');\n\t\t// $('.label-phone').html('Enter valid phone number');\n\t\treturn false;\n\t}\n\telse{\n\t\t$('#input-phone').removeClass('bcolor');\n\t\t$('.label-phone').removeClass('label_val');\n\t\t$('#input-phone').addClass('green_bcolor');\n\t\t$('.label-phone').addClass('green_label_val');\n\t\t$('.label-phone').html('Phone');\n\t\treturn true;\n\t}\n}", "title": "" }, { "docid": "3d891be3f223a67f24640486ca504efe", "score": "0.59528357", "text": "function isPhoneNumber(input_str) \n{\n // adapted from JavaScriptcoder.com for validating phone number \n var re = /^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$/im;\n return re.test(input_str);\n}", "title": "" }, { "docid": "6a3bc38d2790a98675c9185d0ee693cc", "score": "0.5952709", "text": "function validatePhone(phone){\n if (!phone.match(/^\\d{3}-\\d{3}-\\d{4}$/)) { \n $userPhoneError.show(); \n $userPhoneSuccess.hide(); \n return false;\n } \n $userPhoneError.hide();\n $userPhoneSuccess.show();\n return true; \n}", "title": "" }, { "docid": "ce9bc96a765f55ce90f5eb783ec310fa", "score": "0.59356624", "text": "function telephoneCheck(str) {\n var regex = /^(1\\s?)?(\\(\\d{3}\\)|\\d{3})[\\s\\-]?\\d{3}[\\s\\-]?\\d{4}$/;\n return regex.test(str);\n}", "title": "" }, { "docid": "868e18a069c05ce9a0fe11bdd2186952", "score": "0.59322333", "text": "function telephoneCheck(str) {\n return /^(1\\s?)?(\\(\\d{3}\\)|\\d{3})[\\s\\-]?\\d{3}[\\s\\-]?\\d{4}$/.test(str);\n}", "title": "" }, { "docid": "dbbc3a931eea9dad71f5d03c5423e064", "score": "0.5903868", "text": "function telephoneCheck(str) {\n let areaCode = /(-?\\d)?\\b/y.exec(str);\n console.log(areaCode);\n if (areaCode != null) {\n if (areaCode[1] != 1) return false;\n }\n return true;\n}", "title": "" }, { "docid": "a30b329d696fa23b77d2a74d73dff996", "score": "0.5903474", "text": "validatePhoneInput() {\n let result = true;\n\n // make sure input is not empty\n if (!this.state.phone) {\n ErrorHandler.errorHandler(\"Please enter a phone number\", 3000, \".error-message\");\n result = false;\n }\n\n else if (!/^[0-9]+$/gm.test(this.state.phone)) {\n ErrorHandler.errorHandler(\"Only numeric characters are allowed\", 3000, \".error-message\");\n result = false;\n }\n\n else if (this.state.phone.length !== 10) {\n ErrorHandler.errorHandler(\"10 digits US phone number allowed\", 3000, \".error-message\");\n result = false;\n }\n\n else {\n ErrorHandler.errorHandler(\"\", 0, \".error-message\");\n }\n\n return result;\n }", "title": "" }, { "docid": "e5eb84567d7eda4f54082c5f37639f7a", "score": "0.59002584", "text": "function validatePhoneNumber (number) {\n return validator.isMobilePhone(number)\n}", "title": "" }, { "docid": "6e27e29bc54c192c23de854c82e668e4", "score": "0.58994436", "text": "function checkUSPhone (phoneNoObj, emptyOK)\n{\n if (checkUSPhone.arguments.length == 1) emptyOK = defaultEmptyOK;\n var phoneNoVal=phoneNoObj.value;\n if (isEmpty(phoneNoVal)) return true;\n if (emptyOK == true) return true;\n else\n {\n var normalizedPhone =\"\";\n //Strip all the characters except the numbers\n for (i = 0; i < phoneNoVal.length; i++)\n {\n // Check that current character is number.\n var c =phoneNoVal.charAt(i);\n if (isDigit(c)) normalizedPhone += c;\n }\n\t\n if ( ( normalizedPhone.length > 3 )\t&& ( normalizedPhone.length <= 6 ) )\n {\n var len=normalizedPhone.length - 3;\n phoneNoObj.value=reformat (normalizedPhone, \"(\", 3, \") \",len)\n return true;\n }\n else if ( normalizedPhone.length > 6 )\n {\n var len=normalizedPhone.length - 6;\n phoneNoObj.value=reformat (normalizedPhone, \"(\", 3, \") \", 3, \"-\", len )\n return true;\n }\n else\n {\n phoneNoObj.value=normalizedPhone;\n return true;\n }\n }\n}", "title": "" }, { "docid": "3d486f51cbb71cbf9e64c89cfb538a99", "score": "0.58652383", "text": "function isPhoneNumber(elem, helperMsg){\r\n\tvar alphaExp = /^[9,2][0-9]{8}$/;\r\n\tif(elem.value.match(alphaExp)){\r\n\t\treturn true;\r\n\t}else{\r\n\t\tmensagem(helperMsg);\r\n\t\telem.focus();\r\n\t\treturn false;\r\n\t}\r\n}", "title": "" }, { "docid": "4804fdee955bd1ef3260b83883dc773b", "score": "0.58643365", "text": "function Condition_8d7957887c8365e8d6d59f7ec3297381() {\r\n var mobile = appoUser.mobile[0].text___ || \"\";\r\n var home = appoUser.home[0].text___ || \"\";\r\n\r\n var tmp = appsFilled_get_name.split('@');\r\n if (tmp.length > 1) {\r\n if (\"mobile\" == tmp[1] && 0 == mobile.length) {\r\n // fall thru - invalid phone pre selected\r\n } else if (\"home\" == tmp[1] && 0 == home.length) {\r\n // fall thru - invalid phone pre selected\r\n } else {\r\n appsTransferDestination = \"tel:\" + appoUser[tmp[1]][0].text___;\r\n appsFilled_select_phone = tmp[1];\r\n return false; // skip selection since a valid phone has already been chosen\r\n }\r\n }\r\n\r\n if (mobile.length > 0 && home.length > 0) {\r\n appsPhoneGrammar = \"wmh\";\r\n }\r\n else if (mobile.length > 0) {\r\n appsPhoneGrammar = \"wm\";\r\n }\r\n else if (home.length > 0) {\r\n appsPhoneGrammar = \"wh\";\r\n }\r\n\r\n if (mobile.length > 0 || home.length > 0) {\r\n return true;\r\n }\r\n\r\n appsTransferDestination = \"tel:\" + appoUser.work[0].text___;\r\n return false;\r\n}", "title": "" }, { "docid": "ee1776bffecbdf5c3a5095c24dbe65cf", "score": "0.5862451", "text": "function IsPhoneNumber(pstrValue){\n\tvar strRegEx = /^[ ]*[(]{0,1}[ ]*[0-9]{3,3}[ ]*[)]{0,1}[-]{0,1}[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/\n\treturn strRegEx.test(pstrValue);\n}", "title": "" }, { "docid": "7c8889da0f6289b6a6c3ff96e710d479", "score": "0.5857184", "text": "function ValidatePhone(inputtxt) \r\n { \r\n\t var phoneno = /^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/; \r\n if((inputtxt.value.match(phoneno))) { \r\n return true; \r\n } \r\n else { \r\n alert(\"Please enter a valid mobile number\"); \r\n return false; \r\n } \r\n }", "title": "" }, { "docid": "8c0ba6ee476bc44e5ab01f33c01fe413", "score": "0.58513665", "text": "function Phone(){\n var phone = document.survey.phone.value;\n if(phone == \"\"){\n alert(\"Phone must be filled out\");\n return false;\n } else if (isNaN(phone)){\n alert(\"Phone must be all numbers\");\n return false;\n } else if(phone.length < 10){\n alert(\"Please check your number, it is too short.\");\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "c497382d79824eb484be7c6850d0ba48", "score": "0.5829185", "text": "function checkPhone(){\n if(event.shiftKey){\n \tif(event.keyCode==187)\n \t\tevent.returnValue = true;\n \telse\n \t\tevent.returnValue = false;\t\n }\n else if( (event.keyCode==32 || event.keyCode==107 || event.keyCode==109 || event.keyCode==189 || event.keyCode==45 || event.keyCode==46 || event.keyCode==8 || event.keyCode==9) ||\n \t (event.keyCode>=33 && event.keyCode<=40) ||\n (event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) ) {\n\t event.returnValue = true; \n }\n else{\n event.returnValue = false;\n }\n}", "title": "" }, { "docid": "c241506f71da0a87544c1323eea270f7", "score": "0.5827929", "text": "function isValidLandLineNumber(input_num) {\n var phoneno = /^\\+?([0-9]{2})\\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/;\n return (input_num.match(phoneno)) ? true : false;\n }", "title": "" }, { "docid": "40687ae7cd75df276639f2886db6d97a", "score": "0.5821225", "text": "function validatePhoneNumber(wNumber){\n\tvar clean_number = wNumber.replace(aceito['phone'], '');\n\tif (validateNumber(clean_number)==false) return 0;\n\tif (clean_number.lenght>15) return -1;\n\tif (clean_number.lenght<10) return -2;\n\treturn 1;\n}", "title": "" }, { "docid": "881be1bf00f12c671fe54574c5d9e7a5", "score": "0.581707", "text": "function CheckPhone(number)\n{\n\tif(number.length < 5 || number.length > 16)\n\t{\n\t\treturn false;\n\t}\n\telse\n\t{\n\t\tvar str=\"0123456789.()\";\n\t\tfor(var i=0;i<number.length;i++)\n\t\t{\n\t\t\tif(str.indexOf(number.charAt(i)) == -1)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;//Dung so dien thoai\n}", "title": "" }, { "docid": "657f78e607673fbc8a5fb19bfef7c9b0", "score": "0.58052766", "text": "function isPhoneNumber(phone) {\n var check1 = true;\n var check2 = true;\n //first check checks if the phone number is in the format ###-###-####\n for (var i = 0; i < 3; i++) {\n if (check1 == true) {\n if (isNaN(phone[i])) {\n check1 = false;\n }\n else {\n check1 = true;\n }\n }\n }\n if (check1 == true && phone[3] == \"-\") {\n check1 = true;\n }\n else {\n check1 = false;\n }\n for (var i = 4; i < 7; i++) {\n if (check1 == true) {\n if (isNaN(phone[i])) {\n check1 = false;\n }\n else {\n check1 = true;\n }\n }\n }\n if (check1 == true && phone[7] == \"-\") {\n check1 = true;\n }\n else {\n check1 = false;\n }\n for (var i = 8; i < 12; i++) {\n if (check1 == true) {\n if (isNaN(phone[i])) {\n check1 = false;\n }\n else {\n check1 = true;\n }\n }\n }\n \n //second check if the user enters in just ten numbers with no \"-\" symbols, it will still allow it.\n for (var i = 0; i < 10; i++) {\n if (check2 == true) {\n if (isNaN(phone[i])) {\n check2 = false;\n }\n else {\n check2 = true;\n }\n }\n }\n if (check1 == true || check2 == true) {\n return true;\n }\n else {\n return false;\n }\n }", "title": "" }, { "docid": "c0d50d1c67cb7e0cc0c85d0e9266934d", "score": "0.5788141", "text": "function telephoneCheck(str) {\n \n //Regular expressions to check for the possible correct formats\n if(/^(1?\\s?\\(?[0-9]{3}\\)?\\s?[0-9]{3}\\s?[0-9]{4})$/.test(str)){\n return true;\n }else if(/^(1?\\s?\\({1}[0-9]{3}\\){1}\\s?[0-9]{3}\\-?\\s?[0-9]{4})$/.test(str)){\n return true;\n }else if(/^(1?\\s?[0-9]{3}\\-?\\s?[0-9]{3}\\-?\\s?[0-9]{4})$/.test(str)){\n return true;\n }\n else {\n return false;\n }\n }", "title": "" }, { "docid": "36fd708bf3d8fa8b347d4126663e3f4f", "score": "0.57820106", "text": "function checkPhoneLength(eID){\n var value = document.getElementById(eID).value;\n\n if ((/^\\d{10,11}$/g).test(value))\n return true;\n else\n return false;\n}", "title": "" }, { "docid": "36fd708bf3d8fa8b347d4126663e3f4f", "score": "0.57820106", "text": "function checkPhoneLength(eID){\n var value = document.getElementById(eID).value;\n\n if ((/^\\d{10,11}$/g).test(value))\n return true;\n else\n return false;\n}", "title": "" }, { "docid": "73879334ff7ffc8384961630d6c991c9", "score": "0.5774584", "text": "function ValidatePhone(inputtxt) \r\n { \r\n\t var phoneno = /^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/; \r\n if((inputtxt.value.match(phoneno))) { \r\n return true; \r\n } \r\n else { \r\n alert(\"Please enter a valid phone number\"); \r\n return false; \r\n } \r\n }", "title": "" }, { "docid": "bd250c8a69e13000dcb21ad94ecf7426", "score": "0.5773708", "text": "function telephoneCheck(str) {\n var valid = false;\n var regEx = /(.?\\d{1}\\s?)?([(]?\\d{3}[)]?)-?\\s?(\\d{3})-?\\s?(\\d{4})(\\d+)?/g; //g1(country code), g2(area code), g3(3 numbers), g4(4numbers), g5(leftover numbers)\n str.replace(regEx, function (match, g1, g2, g3, g4, g5) {\n if (g1 && Number(g1) !== 1) {\n valid = false;\n return;\n }\n if (g2 && g3 && g4 && g4.length === 4 && !g5) {\n var open = g2.charAt(0) === '(';\n var closed = g2.charAt(4) === ')';\n valid = open ? closed : g2.length === 3;\n }\n });\n return valid;\n}", "title": "" }, { "docid": "24c19934d6bb538f944642464c66e303", "score": "0.57688785", "text": "function checkPhone(inputtxt){\r\n\r\n var phoneno = /^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;\r\n if($.trim($(\"#phone\").val())==\"\"){ \r\n $(\"#errorphone\").html(\"<p>You missed your phone number</p>\");\r\n $(\"#errorphone\").addClass(\"showerror\");\r\n }\r\n else if((inputtxt.match(phoneno))==false || inputtxt.length < 12){ \r\n $(\"#errorphone\").html(\"<p>Please enter your number in the format 000-000-0000</p>\");\r\n $(\"#errorphone\").addClass(\"showerror\");\r\n }\r\n else{ \r\n $(\"#errorphone\").html(\"\");\r\n $(\"#errorphone\").removeClass(\"showerror\");\r\n }\r\n }", "title": "" }, { "docid": "79120186f5f722f3b706ed8321c42a68", "score": "0.5754989", "text": "hasAddress() {\n return this.address != null;\n }", "title": "" }, { "docid": "547cbe7d7350c4f4604cbcf49015b01b", "score": "0.5733339", "text": "function homePhoneNumber(){\n\tif (homePhone.value.match(phoneNumberFormat)) {\n\tchangeBorderColor(homePhone, \"green\");\n\t} else {\n\tchangeBorderColor(homePhone, \"red\");;\n\tupdateError(error3, \"Please enter a valid phone number\");\n\t}\n}", "title": "" }, { "docid": "6d966115b7c9c45b962fafc72d74e669", "score": "0.5727412", "text": "function isValidTelephone(telephone) {\n return /^\\D*\\d{3}\\D*\\d{3}\\D*\\d{4}\\D*$/.test(telephone);\n // \\D matches any non-numerial, * matches more than one. this code allows various formats including space and -\n // previous one /^\\(\\d{3}\\)\\s\\d{3}-\\d{4}$/ does not allow various types of phone number\n // If you want to match a literal parenthesis you can escape it with a \\ \n}", "title": "" }, { "docid": "cc58197347b71ae8022df7da98af91f3", "score": "0.5723835", "text": "function telephoneCheck(str) {\n // Good luck!\n let regex = /^(1\\s?)?(\\(\\d{3}\\)|\\d{3})[\\-\\s]?\\d{3}[\\-\\s]?\\d{4}$/;\n let res = regex.test(str);\n return res;\n}", "title": "" }, { "docid": "86ae5a493f449c8b0b82513d5844f09f", "score": "0.5720703", "text": "function checkPlaces(input){\n\tconst addressRegex = /(([A-Z][a-zA-Z]*\\s*)+,\\s?)*(\\d+\\s)?(([A-Z][a-zA-Z]*\\s?)+)\\s(Street|Ave|Lane|Road|Hill|Close|Avenue|Boulevard|Course|Drive|Way|Alley|St|Square|Mews),?\\s*([A-Z][a-zA-Z]*\\s?)+,?(\\s*([A-Z][a-zA-Z]*)+)?,?\\s*\\w{2,4}\\s?\\w{3}/g;\n\tif(addressRegex.test(input) && !places.includes(input.match(addressRegex)[0]))\n\t{\n\t\tplaces.push(input.match(addressRegex)[0]);\n\t}\n}", "title": "" }, { "docid": "3a5573d433b6794ab4843bf11821a2aa", "score": "0.5707346", "text": "function validatePhoneNumber () {\n const phone = document.getElementById('phoneNumber');\n const re = /^\\(?\\d{3}\\)?[-. ]?\\d{3}[-. ]?\\d{4}$/;\n\n if(!re.test(phone.value)){\n phone.classList.add('is-invalid');\n isValid.phone = false;\n } else {\n phone.classList.remove('is-invalid');\n isValid.phone = true;\n }\n}", "title": "" }, { "docid": "f08534de702ec2bc47d60ba388da70a7", "score": "0.57000756", "text": "function telephoneCheck(str) {\n let result = true;\n\n // first the cheat for this case telephoneCheck(\"(555)5(55?)-5555\")\n // if i have to do this i will use an external library\n if (/\\?/.test(str)) { return false; }\n\n // test Open closed parenthesis and only 3 digits between parenthesis\n if ((/\\)/.test(str) || /\\(/.test(str)) == false) {\n result = true;\n } else if ((/\\)/.test(str) && /\\(/.test(str)) == false) {\n result = false;\n } else if (/\\(\\d{3}\\)/.test(str) == false) {\n result = false;\n }\n\n // filter by amount of digits, 10 or 11 pass.\n let test = str.match(/[0-9]/gi).length\n if (test < 10) { return false; }\n if (test > 11) {\n return false;\n }\n // filter us country code == 1\n if (test == 11 && str[0] != 1) {\n return false;\n }\n return result;\n}", "title": "" }, { "docid": "c3d0dc4dbaf70fc57cbb7068b53dbf71", "score": "0.5699226", "text": "function checkUSPhone (theField, emptyOK)\n{\n if (checkUSPhone.arguments.length == 1) emptyOK = defaultEmptyOK;\n if ((emptyOK == true) && (isEmpty(document.getElementById(theField).value))) return true;\n else\n { \n \n var normalizedPhone = stripCharsInBag(document.getElementById(theField).value, phoneNumberDelimiters);\n if (!isUSPhoneNumber(normalizedPhone, false)) {\n return warnInvalid (theField, iUSPhone);\n }\n else\n { // if you don't want to reformat as (123) 456-789, comment next line out\n \tdocument.getElementById(theField).value = reformatUSPhone(normalizedPhone);\n return true;\n }\n }\n}", "title": "" }, { "docid": "c8111227a091d243165a596777b4c455", "score": "0.5691063", "text": "function PhoneValidate(input) {\n var regEx = /^\\[0-9]\\\\d{9}$/;\n if (regEx.test(input))\n return true;\n else return false;\n\n}", "title": "" }, { "docid": "b6a510946b561a82ae33c2815a582be1", "score": "0.5679569", "text": "function Validatephonenumber(phonenumber) {\n if (phonenumber == \"\") {\n $(\".error-log-block\").css(\"display\", \"block\");\n $(\".error-log-block\").html(\"Please Enter Your Mobile Number\");\n return false;\n }\n else {\n var phoneno = /^\\d{10}$/;\n if (phonenumber.match(phoneno)) {\n return true;\n }\n else {\n $(\".error-log-block\").css(\"display\", \"block\");\n $(\".error-log-block\").html(\"Please Enter Correct Mobile Number\");\n return false;\n }\n }\n \n}", "title": "" }, { "docid": "132379c2863cfcdecab02bea4ccec539", "score": "0.5677268", "text": "function isAPhoneNumber(entry) {\n if (entry) {\n // Set openParen = to the first character of entry.\n var openParen = entry.substring(0, 1)\n // Set areaCode = to the next 3 characters.\n var areaCode = entry.substring(1, 4)\n // Set closeParen = to the 5th character.\n var closeParen = entry.substring(4, 5)\n // Set exchange = to characters 6, 7, and 8.\n var exchange = entry.substring(5, 8)\n // Set dash = to the 9th character.\n var dash = entry.substring(8, 9)\n // Set line = to the 10th through 13th characters.\n var line = entry.substring(9, 13)\n // The following if statement checks all the pieces\n if (\n (openParen != '(') ||\n (!isANumber(areaCode)) ||\n (closeParen != ')') ||\n (!isANumber(exchange)) ||\n (dash != '-') ||\n (!isANumber(line))\n ) {\n alert(\"Incorrect phone number. Please re-enter in the following format: (123)456-7890\")\n } else { alert(\"sucessful 'thank you'\") }\n }\n}", "title": "" }, { "docid": "7baafdf889a61eb7a0e7ef69dd178af9", "score": "0.5661972", "text": "function checkInternationalPhone(tips, field, fieldDesc) {\n field.removeClass(\"ui-state-error\").off('.validation');\n field.val($.trim(field.val()));\n\n var phone_number = field.val();\n phone_number = phone_number.replace(/\\s+/g, \"\");\n\n var valid = phone_number.length > 9 && phone_number.match(/^\\+\\d{1,3}[-. ]?\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/);\n if (!valid) {\n field.addClass(\"ui-state-error\");\n tips.text(fieldDesc + \" is invalid. [e.g. +999 (999)999-9999]\").addClass(\"ui-state-highlight\");\n field.on('blur.validation', function () {\n if (checkPhoneUS(tips, field, fieldDesc)) {\n tips.text(\"\").removeClass(\"ui-state-highlight\");\n field.removeClass(\"ui-state-error\");\n field.off('.validation');\n }\n });\n\n return false;\n } else {\n return true;\n }\n}", "title": "" }, { "docid": "d7d68802bfb2ac07d831588dec72dec3", "score": "0.56613964", "text": "function check_phoneno() {\n var phonenumber = $(\"#phoneno\").val();\n if (phonenumber.length < 10) {\n $(\"#phonenoerr\").html(\"*enter correct number\");\n $(\"#phonenoerr\").show();\n error_phoneno = true;\n } else if (!phonenumber.match(/^[0-9]/)) {\n $(\"#phonenoerr\").html(\"only numbers are allowed and only upto 10 digits\");\n $(\"#phonenoerr\").show();\n error_phoneno = true;\n\n } else { $(\"#phonenoerr\").hide() }\n }", "title": "" }, { "docid": "a8ab9395ea88f14b34fe3ff323a27a6d", "score": "0.566107", "text": "function validatePhone(field) {\n validateNumeric(field);\n var v = field.value;\n v=v.replace(/^(\\d\\d)(\\d\\d)(\\d)/g,\"($1 $2) $3\");\n field.value = v;\n}", "title": "" }, { "docid": "e21616fd1896570c13c96e205d56ca0a", "score": "0.5660472", "text": "function checkValidPhoneNumber(phoneNumber) {\n let flag = false;\n if(phoneNumber){\n let filter = /^[0-9-+]+$/;\n if (filter.test(phoneNumber)) {\n let phone = phoneNumber.trim();\n let firstNumber = phone.substring(0, 2);\n if(firstNumber == '84')\n phone = phone.replace('84', '0');\n if (phone != '') {\n firstNumber = phone.substring(0, 2);\n //Đầu số 09 và 08 => 10 Sô\n if ((firstNumber == '09' || firstNumber == '08') && phone.length == 10) {\n if (phone.match(/^\\d{10}/)) {\n flag = true;\n }\n //Đầu số 01 => 11 Số\n } else if (firstNumber == '01' && phone.length == 11) {\n if (phone.match(/^\\d{11}/)) {\n flag = true;\n }\n }\n }\n }\n}\nreturn flag;\n}", "title": "" }, { "docid": "ba4ceed36fe26879058760565a0031ba", "score": "0.5655147", "text": "function isValidationPhoneNumber(nameZipCode) {\n let pattern = new RegExp(/^(?:(?:\\+)33|0)\\s*[1-9](?:[\\s.-]*\\d{2}){4}$/);\n if (pattern.test($('input[name=\"' + nameZipCode + '\"]').val())) {\n return false;\n } else {\n return true;\n }\n}", "title": "" }, { "docid": "ba4ceed36fe26879058760565a0031ba", "score": "0.5655147", "text": "function isValidationPhoneNumber(nameZipCode) {\n let pattern = new RegExp(/^(?:(?:\\+)33|0)\\s*[1-9](?:[\\s.-]*\\d{2}){4}$/);\n if (pattern.test($('input[name=\"' + nameZipCode + '\"]').val())) {\n return false;\n } else {\n return true;\n }\n}", "title": "" }, { "docid": "6eded294b6522a7930b8cd7c2d7cbebe", "score": "0.565427", "text": "function telephone_verify(){\n if(telePhone.value != '' && telePhone.value.match(phoneExp) && telePhone.value.length == 13){\n telePhone.style.border = '1px solid green';\n phoneNumError('');\n return true;\n }\n else{\n telePhone.style.border = '2px solid red';\n phoneNumError('Phone number should start with +256 and have atleast 13 characters');\n telePhone.focus();\n return false;\n }\n}", "title": "" }, { "docid": "0d0e8f0c5d275d63e3ff5eddc78f5c5a", "score": "0.5648138", "text": "function ValidatePhone(number) {\n // remove non-digits\n var re=new RegExp('[^0-9]','g');\n var tempNum = (number+'').replace(re,'');\n\n // remove if the whole number is same digit repeated\n re=new RegExp('^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$','');\n tempNum=tempNum.replace(re,'');\n \n if (tempNum.length == 10 )\n return true;\n else\n return false;\n}", "title": "" }, { "docid": "86d6f3ea916331d8babd14d56827c36d", "score": "0.56476045", "text": "function isAddress(input)\n{\n input= $.trim(input);\n\n var regExp = new RegExp(\".+to.+ku.+[0-9]{1,2}-[0-9]{1,2}\");\n console.log('address:'+regExp.test(input));\n return regExp.test(input);\n}", "title": "" }, { "docid": "b6c166a94fed17036870015a88cfdfc0", "score": "0.56222737", "text": "function isAddress(value) {\n try {\n getAddress(value);\n return true;\n }\n catch (error) { }\n return false;\n}", "title": "" }, { "docid": "7489c4db72e730246f8675e330bad896", "score": "0.56168133", "text": "function check_pin(pin)\n{\n if (check_text_blank(pin)) {\n return false;\n }\n if (!check_digit(pin)) {\n return false;\n }\n if (!check_length(pin, 4, 8)) {\n return false;\n }\n return true;\n}", "title": "" }, { "docid": "a07077dd9ebd304c9fcbe33a5b5b538b", "score": "0.5602092", "text": "function validatePhone(phone, isMandatory, minLength, maxLength) {\n if (phone) {\n if (!isNaN(phone)) {\n if (minLength && (phone.toString().length < minLength)) {\n return ({ status: 'Failure', message: ERRORS.phone.invalid });\n } else if (maxLength && (phone.toString().length > maxLength)) {\n return ({ status: 'Failure', message: ERRORS.phone.invalid });\n }\n return ({ status: 'Success', message: null });\n } else {\n return ({ status: 'Failure', message: ERRORS.phone.invalid });\n }\n } else {\n if (isMandatory) {\n return ({ status: 'Failure', message: ERRORS.phone.required });\n }\n else {\n return ({ status: 'Success', message: null });\n }\n }\n}", "title": "" }, { "docid": "33f0ed94642e4ba70c63f3e2aeada7ba", "score": "0.559563", "text": "function validateMobilenumber(mobilenumber)\n{\n /* mobilenumber should be 10 digits (beginning 9/8/7) long (at most 11 if beginning 0) */\n var result = (mobilenumber != null) && (mobilenumber.length > 0) &&\n (((mobilenumber.length == 10) && (mobilenumber.match(\"^[7-9][0-9]*$\") != null)) ||\n ((mobilenumber.length == 11) && (mobilenumber.match(\"^[0][7-9][0-9]*$\") != null)));\n return result;\n}", "title": "" }, { "docid": "603a2491833b742897ace3731acabc48", "score": "0.55789155", "text": "function customPhoneValidation(value){\r\n if(!checkRegex(value, phoneRegex)){\r\n throw new Error('Phone should be in the format xxx-xxx-xxxx');\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "5d2c723cc14148c8ac75bf835d4bb5be", "score": "0.55774564", "text": "function check_phone(inputname,msg)\n{\n return regex_match(inputname,msg,\"[ 0-9-///+]*$\");\n}", "title": "" }, { "docid": "052b1653221ae5b982b16b4009499662", "score": "0.5567576", "text": "function checkInternationalPhone (theField, emptyOK)\n{\n if (checkInternationalPhone.arguments.length == 1) emptyOK = defaultEmptyOK;\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\n else\n {\n if (!isInternationalPhoneNumber(theField.value, false))\n return warnInvalid (theField, iWorldPhone);\n else return true;\n }\n}", "title": "" } ]
b6ab60c8e363cfedd250cf9e0298bdf6
Standard/simple iteration through an event's collected dispatches.
[ { "docid": "a6f8a03b38fc063a822b02ac42b4954a", "score": "0.0", "text": "function executeDispatchesInOrder(event, simulated) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchInstances = event._dispatchInstances;\n\t if (process.env.NODE_ENV !== 'production') {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and Instances are two parallel arrays that are always in sync.\n\t executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t executeDispatch(event, simulated, dispatchListeners, dispatchInstances);\n\t }\n\t event._dispatchListeners = null;\n\t event._dispatchInstances = null;\n\t}", "title": "" } ]
[ { "docid": "49a2019d7acc48b7de2fdd5e8ea81808", "score": "0.6216154", "text": "function forEach(event, each, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n }", "title": "" }, { "docid": "3e95f7c3c643a02130fd163d5152c5e1", "score": "0.6165674", "text": "proc(event) {\n for (let obj of this[OBJECTS]) {\n obj.proc(event);\n }\n }", "title": "" }, { "docid": "e6b58637e5249a051942c078a7e67386", "score": "0.6126574", "text": "[__WEBPACK_IMPORTED_MODULE_7__const__[\"i\" /* PROC */]](event) {\n for (let obj of this[__WEBPACK_IMPORTED_MODULE_7__const__[\"f\" /* OBJECTS */]][0]) {\n obj.proc(event);\n }\n this[__WEBPACK_IMPORTED_MODULE_7__const__[\"k\" /* ROOMS */]][0] && this[__WEBPACK_IMPORTED_MODULE_7__const__[\"k\" /* ROOMS */]][0].proc(event);\n }", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "de2d3d1c2eebb20fc5ebf9d6d003c55b", "score": "0.6122544", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== \"development\") {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "b56f1eb279975304e6c1bc64fe53eb78", "score": "0.61139715", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (true) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "b56f1eb279975304e6c1bc64fe53eb78", "score": "0.61139715", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (true) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "2cf4f2158436fa85c8632dfc82f10514", "score": "0.60784554", "text": "function forEachEventDispatch(event, cb) {\n\t var dispatchListeners = event._dispatchListeners;\n\t var dispatchIDs = event._dispatchIDs;\n\t if (\"production\" !== process.env.NODE_ENV) {\n\t validateEventDispatches(event);\n\t }\n\t if (Array.isArray(dispatchListeners)) {\n\t for (var i = 0; i < dispatchListeners.length; i++) {\n\t if (event.isPropagationStopped()) {\n\t break;\n\t }\n\t // Listeners and IDs are two parallel arrays that are always in sync.\n\t cb(event, dispatchListeners[i], dispatchIDs[i]);\n\t }\n\t } else if (dispatchListeners) {\n\t cb(event, dispatchListeners, dispatchIDs);\n\t }\n\t}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "d523a9474c60ae454818c505e4b8617a", "score": "0.6072781", "text": "function forEachEventDispatch(event, cb) {\n var dispatchListeners = event._dispatchListeners;\n var dispatchIDs = event._dispatchIDs;\n if (\"production\" !== process.env.NODE_ENV) {\n validateEventDispatches(event);\n }\n if (Array.isArray(dispatchListeners)) {\n for (var i = 0; i < dispatchListeners.length; i++) {\n if (event.isPropagationStopped()) {\n break;\n }\n // Listeners and IDs are two parallel arrays that are always in sync.\n cb(event, dispatchListeners[i], dispatchIDs[i]);\n }\n } else if (dispatchListeners) {\n cb(event, dispatchListeners, dispatchIDs);\n }\n}", "title": "" }, { "docid": "50c4b1c8d8567f5e0b57b965d0130bf8", "score": "0.5923956", "text": "function dispatch (e) {\n\tvar types = e.types || [e.type]\n\treturn invokeList(\n\t\t// Test the format of the event directive...\n\t\ttypeof types[0] === 'string' ?\n\t\t\t// ...['mouse', 'up']\n\t\t\tcollect(subjects.get(this), types) :\n\t\t\t// ...[['mouse', ['up']]]\n\t\t\tbranchingCollect(subjects.get(this), types),\n\t\te)\n}", "title": "" }, { "docid": "a760751ae9ca470fd19f625a233ac99c", "score": "0.57696885", "text": "function processGameEvents() {\n\tfor (channel in gameEvents) {\n\t\twhile (\n\t\t\tgameEvents[channel].list.length > 0 && \n\t\t\t!gameEvents[channel].isBlocked && \n\t\t\t!(gameEvents[channel].currentlyProcessing > 0 && gameEvents[channel].list[0].isBlocking)) \n\t\t{\n\t\t\tvar ge = gameEvents[channel].list[0];\n\t\t\t\n\t\t\tif (ge.isBlocking) gameEvents[channel].isBlocked = true;\n\t\n\t\t\tgameEvents[channel].list.shift();\n\t\t\tgameEvents[channel].currentlyProcessing++;\n\t\n\t\t\tgameEventHandlers[ge.type](ge.data);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7c9e16f64c9356a33c8312d67ecc1880", "score": "0.5766144", "text": "function patchViaCapturingAllTheEvents() {\n var _loop_1 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = wrapWithCurrentZone(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n}", "title": "" }, { "docid": "4763025877fd51208c099f5eef7f53ec", "score": "0.5623957", "text": "function patchViaCapturingAllTheEvents() {\n var _loop_1 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = Zone.current.wrap(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n}", "title": "" }, { "docid": "4763025877fd51208c099f5eef7f53ec", "score": "0.5623957", "text": "function patchViaCapturingAllTheEvents() {\n var _loop_1 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = Zone.current.wrap(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n}", "title": "" }, { "docid": "4763025877fd51208c099f5eef7f53ec", "score": "0.5623957", "text": "function patchViaCapturingAllTheEvents() {\n var _loop_1 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = Zone.current.wrap(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n}", "title": "" }, { "docid": "4a5f2a8c4715f77fe3c0bcdc390c6158", "score": "0.5616939", "text": "_sendEvents() {\n const updated = new Set()\n for (let event of this.queue.events.values()) {\n if (!this.eventListeners[event]) continue;\n this.eventListeners[event].forEach(fn => {\n if (updated.has(fn)) return\n updated.add(fn)\n fn()\n })\n }\n this.queue.events = null\n }", "title": "" }, { "docid": "2cad682f3f23965476702162c753133b", "score": "0.5551804", "text": "emit(key, ...args) {\n const event = this.events[key];\n if (event) {\n for (let cb of event) {\n cb(...args);\n }\n }\n }", "title": "" }, { "docid": "9e6f2b6679ddb42959b53cd6579f1036", "score": "0.55399406", "text": "function accumulateDispatches(inst,ignoredDirection,event){if(inst && event && event.dispatchConfig.registrationName){var registrationName=event.dispatchConfig.registrationName;var listener=getListener(inst,registrationName);if(listener){event._dispatchListeners = accumulateInto(event._dispatchListeners,listener);event._dispatchInstances = accumulateInto(event._dispatchInstances,inst);}}}", "title": "" }, { "docid": "b1839ed8534ab6c9c9d039afee9d9e18", "score": "0.55030125", "text": "function patchViaCapturingAllTheEvents() {\n var _loop_1 = function(i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = Zone.current.wrap(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n \n}", "title": "" }, { "docid": "32d3cad908a658a5f8e0f3928720bf9d", "score": "0.54940194", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t\t\t if (event && event.dispatchConfig.registrationName) {\n\t\t\t var registrationName = event.dispatchConfig.registrationName;\n\t\t\t var listener = getListener(inst, registrationName);\n\t\t\t if (listener) {\n\t\t\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t\t\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t\t\t }\n\t\t\t }\n\t\t\t}", "title": "" }, { "docid": "9eddddbb6b7c292afa1df844e0319db6", "score": "0.5490577", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (inst && event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "9eddddbb6b7c292afa1df844e0319db6", "score": "0.5490577", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (inst && event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "9eddddbb6b7c292afa1df844e0319db6", "score": "0.5490577", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (inst && event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "9eddddbb6b7c292afa1df844e0319db6", "score": "0.5490577", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (inst && event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "a49eff5a7191bc44b2343d7fd67334f8", "score": "0.548289", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t\t if (event && event.dispatchConfig.registrationName) {\n\t\t var registrationName = event.dispatchConfig.registrationName;\n\t\t var listener = getListener(inst, registrationName);\n\t\t if (listener) {\n\t\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t\t }\n\t\t }\n\t\t}", "title": "" }, { "docid": "a49eff5a7191bc44b2343d7fd67334f8", "score": "0.548289", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t\t if (event && event.dispatchConfig.registrationName) {\n\t\t var registrationName = event.dispatchConfig.registrationName;\n\t\t var listener = getListener(inst, registrationName);\n\t\t if (listener) {\n\t\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t\t }\n\t\t }\n\t\t}", "title": "" }, { "docid": "b5d6d6efffc8695567634d203a15e750", "score": "0.5469118", "text": "function accumulateDispatches(inst,ignoredDirection,event){if(inst&&event&&event.dispatchConfig.registrationName){var registrationName=event.dispatchConfig.registrationName;var listener=getListener(inst,registrationName);if(listener){event._dispatchListeners=accumulateInto_1(event._dispatchListeners,listener);event._dispatchInstances=accumulateInto_1(event._dispatchInstances,inst);}}}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" }, { "docid": "321f39326c3da1074e18387d56f8772b", "score": "0.54687405", "text": "function accumulateDispatches(inst, ignoredDirection, event) {\n\t if (event && event.dispatchConfig.registrationName) {\n\t var registrationName = event.dispatchConfig.registrationName;\n\t var listener = getListener(inst, registrationName);\n\t if (listener) {\n\t event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);\n\t event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);\n\t }\n\t }\n\t}", "title": "" } ]
00e92a4278550a17d9398ea0030cf699
Evaluate the value of the watcher. This only gets called for lazy watchers.
[ { "docid": "2a5abeaf4e15044e9dc1582556409e22", "score": "0.6770237", "text": "evaluate() {\n\t\t\t\t// console.log('computed attr changed');\n\t\t\t\tthis.value = this.get();\n\t\t\t\tthis.dirty = false;\n\t\t\t}", "title": "" } ]
[ { "docid": "716ba09a242d29baa73ca0af32a85d42", "score": "0.74730617", "text": "run() {\n if (this.active) {\n const value = this.get();\n if (value !== this.value ||\n // Deep watchers and watchers on Object/Arrays should fire even\n // when the value is the same, because the value may\n // have mutated.\n Object(_util_index__WEBPACK_IMPORTED_MODULE_0__[\"isObject\"])(value) || this.deep) {\n // set new value\n const oldValue = this.value;\n this.value = value;\n if (this.user) {\n try {\n this.cb.call(this.vm, value, oldValue);\n } catch (e) {\n Object(_util_index__WEBPACK_IMPORTED_MODULE_0__[\"handleError\"])(e, this.vm, `callback for watcher \"${this.expression}\"`);\n }\n } else {\n this.cb.call(this.vm, value, oldValue);\n }\n }\n }\n }", "title": "" }, { "docid": "a129329ff666bb680be6aae5fd961d64", "score": "0.69069713", "text": "evaluate() {\n this.value = this.get();\n this.dirty = false;\n }", "title": "" }, { "docid": "8908a934f51d7355fa30ee6990711ca1", "score": "0.6559478", "text": "function watch (vm, calc, callback) {\n if (vm._static) {\n return calc.call(vm, vm)\n }\n var watcher = new Watcher(vm, calc, function (value, oldValue) {\n /* istanbul ignore if */\n if (typeof value !== 'object' && value === oldValue) {\n return\n }\n callback(value);\n });\n\n return watcher.value\n}", "title": "" }, { "docid": "c6573b9ee94e008eb9c629e63ad75ec1", "score": "0.6391113", "text": "function _watch(calc, callback) {\n\t\t var watcher = new _watcher2.default(this, calc, function (value, oldValue) {\n\t\t /* istanbul ignore if */\n\t\t if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object' && value === oldValue) {\n\t\t return;\n\t\t }\n\t\t callback(value);\n\t\t });\n\t\t\n\t\t return watcher.value;\n\t\t}", "title": "" }, { "docid": "1fc83490872cfc373431bc1e22f4985e", "score": "0.6104843", "text": "function fireWatch(expr, value) {\n mockScope.$watch.calls.forEach(function (call) {\n if (call.args[0] === expr) {\n call.args[1](value);\n }\n });\n }", "title": "" }, { "docid": "a27b3dbf94850651e22968ed3cf35c0b", "score": "0.6034183", "text": "value(value, oldValue) {\n this.watchValue(value);\n }", "title": "" }, { "docid": "98560fc66440fc6d88f953ad8b6cccb0", "score": "0.6024891", "text": "getValue() {\n return this._executeAfterInitialWait(() => this.currently.getValue());\n }", "title": "" }, { "docid": "3d516b40d5c5e4a599290c082e0c6aa2", "score": "0.60239947", "text": "_onChange() {\n const oldValue = this._currentValue;\n const newValue = this._settings.get(this._keyPath);\n\n try {\n assert.deepEqual(newValue, oldValue);\n } catch (err) {\n this._currentValue = newValue;\n\n // Call the watch handler and pass in the new and old values.\n this._handler.call(this, newValue, oldValue);\n }\n }", "title": "" }, { "docid": "d0afaa54537f332598f6498005dc303d", "score": "0.59854406", "text": "get() {\n Object(_dep__WEBPACK_IMPORTED_MODULE_3__[\"pushTarget\"])(this);\n let value;\n const vm = this.vm;\n try {\n value = this.getter.call(vm, vm);\n } catch (e) {\n if (this.user) {\n Object(_util_index__WEBPACK_IMPORTED_MODULE_0__[\"handleError\"])(e, vm, `getter for watcher \"${this.expression}\"`);\n } else {\n throw e;\n }\n } finally {\n // \"touch\" every property so they are all tracked as\n // dependencies for deep watching\n if (this.deep) {\n Object(_traverse__WEBPACK_IMPORTED_MODULE_1__[\"traverse\"])(value);\n }\n Object(_dep__WEBPACK_IMPORTED_MODULE_3__[\"popTarget\"])();\n this.cleanupDeps();\n }\n return value;\n }", "title": "" }, { "docid": "c8845d11ae8d87975cafab0bbc3337fe", "score": "0.59326625", "text": "value() {\n return this.#val;\n }", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "6a36f369660080c9584a7fb682a72116", "score": "0.58386606", "text": "function initWatchVal() {}", "title": "" }, { "docid": "f59269c34aed068f7913592218c01791", "score": "0.5774326", "text": "get value() {\n return this.m_currentValue;\n }", "title": "" }, { "docid": "f073d9e7f292f9610618fbef94f4f352", "score": "0.5762751", "text": "function value () {\n var _val, listeners = []\n return function (val) {\n return (\n isGet(val) ? _val\n : isSet(val) ? all(listeners, _val = val)\n : (listeners.push(val), val(_val), function () {\n remove(listeners, val)\n })\n )}}", "title": "" }, { "docid": "fd1b47cd73e704259b65fb698e822d47", "score": "0.5750915", "text": "getChangedValue() {\n if (this.state.isChanged) {\n return this._getValue();\n }\n }", "title": "" }, { "docid": "e6ceceb9d5647758c0a10f097b92fb19", "score": "0.5726198", "text": "function initWatchVal(){}", "title": "" }, { "docid": "e6ceceb9d5647758c0a10f097b92fb19", "score": "0.5726198", "text": "function initWatchVal(){}", "title": "" }, { "docid": "0e041bb817ca3cbdc03793abaaae70c1", "score": "0.57129806", "text": "get_calibratedValue()\n {\n return this.liveFunc._calibratedValue;\n }", "title": "" }, { "docid": "45782c98acc5eadc2edc962362642f7b", "score": "0.5653899", "text": "get valueChanged() {\n return this._valueChanged;\n }", "title": "" }, { "docid": "3d2eeddc63f2a8251e5e112a7fde05e8", "score": "0.56239533", "text": "get value() {\n\t\treturn this.__value;\n\t}", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "0ad8adfa53b20234863bebda08e1c1bf", "score": "0.55694497", "text": "get value() { return this._value; }", "title": "" }, { "docid": "333b69af1ee00748d849cb35a93f89f5", "score": "0.5556302", "text": "function initWatchVal() {\n }", "title": "" }, { "docid": "2291deeed6d3f398689f84a370b9bfdd", "score": "0.5553817", "text": "get value() {\r\n return this._value;\r\n }", "title": "" }, { "docid": "2291deeed6d3f398689f84a370b9bfdd", "score": "0.5553817", "text": "get value() {\r\n return this._value;\r\n }", "title": "" }, { "docid": "58da4a4c4986c80a96c8956fab5aa32c", "score": "0.5550326", "text": "getValue() {\r\n return this.value_;\r\n }", "title": "" }, { "docid": "b0c9802774438f98721e7ab6370177d2", "score": "0.5548235", "text": "function startWatchingForValueChange(target,targetInst){activeElement=target;activeElementInst=targetInst;activeElementValue=target.value;activeElementValueProp=Object.getOwnPropertyDescriptor(target.constructor.prototype,'value');// Not guarded in a canDefineProperty check: IE8 supports defineProperty only\n\t// on DOM elements\n\tObject.defineProperty(activeElement,'value',newValueProp);if(activeElement.attachEvent){activeElement.attachEvent('onpropertychange',handlePropertyChange);}else{activeElement.addEventListener('propertychange',handlePropertyChange,false);}}", "title": "" }, { "docid": "06c8008250985ba9f7a65892cf19fe46", "score": "0.5546271", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" }, { "docid": "60ddad4a6942e29ca73f6eb0f647202d", "score": "0.5544127", "text": "get value() {\n return this._value;\n }", "title": "" } ]
962083d9ed6d5059a1e060dccde707be
polls a service from this host for host details
[ { "docid": "c44f669698714a5bde7fb85c8f04fc32", "score": "0.5593725", "text": "function updateHostDetails() {\n var s = getAvailableService();\n if (s) {\n app.sendTo(\"HostInfo\", {}, s.entityId, function(result) {\n if (!result.isError()) {\n self.cores(result.numCores);\n }\n });\n app.sendAny(\"NagiosStatus\", {\n hostname : hostname,\n toggle : false\n }, function(result) {\n if (!result.isError()) {\n self.nagios(result.enabled);\n }\n });\n } else {\n setTimeout(updateHostDetails, 1000);\n }\n }", "title": "" } ]
[ { "docid": "c3528ed2fa9b84605b9a6413b46c2c74", "score": "0.5713117", "text": "function getHelpService() {\n\n\tvar SERVICE_GET_HELP_DETAIL = Alloy.Globals.Constants.SERVICE_GET_HELP_DETAIL;\n\n\tif (Ti.Network.online) {\n\t\tAlloy.Globals.LoadingScreen.open();\n\t\tCommunicator.get(DOMAIN_URL + SERVICE_GET_HELP_DETAIL, getHelpServiceServiceCallback);\n\t\tTi.API.info(\"URL : \" + DOMAIN_URL + SERVICE_GET_HELP_DETAIL);\n\t} else {\n\t\t//Alloy.Globals.Alert(\"Please check your internet connection and try again\");\n\t}\n}", "title": "" }, { "docid": "e3375dd2cdbac7a178f979d004b9d92c", "score": "0.5669456", "text": "function poll() {\n var interval = cfg.pollinterval || 10000; // ms\n var stime = Date.now();\n console.log(\"Starting ... Now: \"+ stime + \", Interval: \"+interval+\" ms. Action: \"+cfg.polltestact);\n var status = \"done\"; // pend, done\n var prevstatus = \"ok\";\n var cmd = cfg.polltestact;\n // if (axopt.httptout ) { axopt.timeout = cfg.httptout; } // || 10000;\n // setInterval(function () { console.log(\"Hi !\"); }, interval);\n setInterval(function () {\n if (status == \"pend\") { console.log(\"Status 'pend', pass ...\"); return; }\n\n probeservice( (err, d) => {\n //if (err) {}\n console.log(\"Checked service: err: \"+err+\" (s: \"+status+\"), dt: \"+ deltat());\n });\n }, interval);\n /** Ping coverity service */\n function probeservice(cb) {\n // NOTE: Keep pend logic exlusively either on polling (setInterval) side OR here.\n // (Otherwise we never get out of \"pend\").\n // if (status == \"pend\") { cb(\"Status pend. Cannot make another HTTP probe.\", null); } // Guard against pending\n status = \"pend\";\n var info = { istrans: null, msg: null, ss: null}; // cb(null, rep); // to caller of probeservice (evinfo, pollinfo,probeinfo)\n var url = cfg.url + \"api/views/v1/\";\n axios.get(url, axopt).then((resp) => {\n var d = resp.data;\n // console.log(d); // DEBUG DUMP\n status = \"done\"; // done vs succ ?\n // istrans enabled will get to \"Status pending, pass\" (even if above status = \"done\";)\n var istrans = info.istrans = prevstatus != \"ok\";\n info.ss = \"ok\";\n console.log(\" - Service OK.\\n - Is transition: \"+istrans);\n prevstatus = \"ok\";\n if (d.views && Array.isArray(d.views)) { cb(null, d); } // Fully ok\n else { cb(\"Response not in expected format\", null); } // Faulty format\n //else { cb(null, d); }\n }) // Service failure (by HTTP status). Set status = \"done\" only (but always) after fully resolving.\n // Keep status 'pend' as we are going to pursue async action\n // NOTE: Sometimes triggers: Status 'pend', pass ... NO Action executed, making it look like bug.\n // This seems to be if http request started running, but did not complete. Request times out in\n // approx 75 secs (3s. intvl, 25 polls) and error handler triggers\n .catch((ex) => {\n // status = \"done\";\n // console.log(\"Error polling: \"+ex);\n var msg = \" - Service FAIL on Coverity server\"; // (Sample API URL: '\"+cfg.url+\"')\n console.log(msg);\n var istrans = info.istrans = prevstatus != \"err\";\n info.ss = \"fail\";\n prevstatus = \"err\";\n console.log(\" - Is transition: \"+ istrans);\n // NOTE: we should trigger only on transition\n if (!istrans) { status = \"done\"; return cb(\"Not a transition !\", null); }\n // TODO: Plan to focus on error detection and delegate action running to probeservice callback\n // if (prevstatus == \"err\") { status = \"done\"; return cb(\"Prev status err, not re-triggering action\"); }\n ////////////// Action /////////////\n if (!cmd) { status = \"done\"; return cb(\"Failed test, but no action conf'd !\", null); }\n var env = {COVSRV_URL: url + \"\", COVSRV_EV_TRANSTO: 'DOWN', }; // COVSRV_EV_DESC: ...\n // status = \"pend\"; // Set pending to avoid overlapping polls\n Object.keys(env).forEach((k) => { process.env[k] = env[k]; });\n\n console.log(\" - Trigger: \"+cmd);\n cproc.exec(cmd, (err, stdout, stderr) => { // {env: env},\n //prevstatus = \"err\"; // Redundant when set above\n if (err) { status = \"done\"; return cb(\"Error launching action (\"+cfg.polltestact+\"): \"+ err); }\n\tconsole.log(\"stdout: \"+stdout+\"\\n stderr: \"+stderr+\"\\n\");\n\tstatus = \"done\";\n\t// prevstatus = \"err\"; // Earlier\n\treturn cb(null, ex); // \n });\n // cb(ex, null); // Async exec would leak here\n });\n }\n function deltat() { return (Date.now() - stime) / 1000; }\n}", "title": "" }, { "docid": "fe3007f6365078b185eaf8ecf1a5ec26", "score": "0.56630486", "text": "function pollWrapper_ () {\n \n return ifvisible.now() ? \n Provoke.run ('ServerWatcher' , 'poll' , {\n checksums:current_.checksums,\n domains:Object.keys(self.settings.on),\n properties:self.settings.properties,\n scope:self.settings.scope\n }) : Promise.resolve (null);\n \n }", "title": "" }, { "docid": "283eab468f9b3edb12604a9419382b2f", "score": "0.55597085", "text": "heartbeat(host) {\n let port = this.getPort();\n return this._$http.get('http://' + host + ':' + port + '/heartbeat')\n .then(\n (res) => {\n return res.data;\n }\n );\n }", "title": "" }, { "docid": "6efc5bdfc14760232906e40e0b3040fd", "score": "0.54705626", "text": "byService(req, res) {\n HealthService.byService(req.params.id).then(r => {\n if (r) res.json(r);\n else res.status(404).end();\n });\n }", "title": "" }, { "docid": "d3b04d62421497313a359e0b31a84eaa", "score": "0.5445369", "text": "ListAvailableServices() {\n let url = `/overTheBox`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "34008d99070cebd82ee21a3a1b1489d5", "score": "0.53811413", "text": "ping(timeout, path = \"/ping\") {\n const todo = [];\n setToArray(this.hostsAvailable)\n .concat(setToArray(this.hostsDisabled))\n .forEach(host => {\n const start = Date.now();\n const url = host.url;\n const once = doOnce();\n return todo.push(new Promise(resolve => {\n const req = request(Object.assign({\n hostname: url.hostname,\n method: \"GET\",\n path,\n port: Number(url.port),\n protocol: url.protocol,\n timeout\n }, host.options), once((res) => {\n resolve({\n url,\n res,\n online: res.statusCode < 300,\n rtt: Date.now() - start,\n version: res.headers[\"x-influxdb-version\"]\n });\n }));\n const fail = once(() => {\n resolve({\n online: false,\n res: null,\n rtt: Infinity,\n url,\n version: null\n });\n });\n // Support older Nodes and polyfills which don't allow .timeout() in\n // the request options, wrapped in a conditional for even worse\n // polyfills. See: https://github.com/node-influx/node-influx/issues/221\n if (typeof req.setTimeout === \"function\") {\n req.setTimeout(timeout, fail); // tslint:disable-line\n }\n req.on(\"timeout\", fail);\n req.on(\"error\", fail);\n req.end();\n }));\n });\n return Promise.all(todo);\n }", "title": "" }, { "docid": "963357ff267bad4d2e3d36716396f45d", "score": "0.5341241", "text": "queryService(service,isPermanent=false){\n const { exec } = require('child_process');\n let thisObj=this;\n return new Promise(function(resolve, reject) {\n let cmd='firewall-cmd --info-service='+service+(isPermanent?\" --permanent\":\"\");\n exec(cmd, (err, stdout, stderr) => {\n if (err) {\n resolve(null);\n return;\n }\n if(stderr&&stderr.length){\n resolve(null);\n return;\n }\n let res=parseService(stdout);\n resolve(res);\n });\n });\n }", "title": "" }, { "docid": "0f73de70f1b9d3d576b33bc6c15331d8", "score": "0.5333413", "text": "function pollServer(){\n\n\t\t$.getJSON('guests/poll',{ last: LAST})\n\t\t\t.success(function(response) {\n\t\t\t\tif (response.gcount > 0){\n\t\t\t\t\tLAST = now();\n\t\t\t\t\tresponse.guests.forEach(function(guest){\n\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.fail(function(response){\n\t\t\t\tconsole.log(response);\n\t\t\t});\n\t}", "title": "" }, { "docid": "dab6523ab532e6e760a83592b80be992", "score": "0.5282592", "text": "async pull() {\n const {ctx}=this\n const servicer = app.sessions.get(ctx.handshake.query.sessionId);\n const services = [];\n if (servicer.entity.privilege.canAssignService) {\n const group = await this.ctx.model.NewService.findOne().exec();\n for (let newService of group.content)\n services.push([\n newService.service,\n newService.date,\n \"新服务\",\n newService._id\n ]);\n }\n let end = servicer.servicing.pointer;\n let counter = 0;\n while (counter < 20 && end > -1) {\n const service = servicer.entity.services[end];\n const chat = await this.ctx.model.Chat.findById(service.chatId).exec();\n services.push([\n chat.service,\n chat.createdAt,\n service.status,\n service.chatId\n ]);\n end--;\n counter++;\n }\n servicer.servicing.pointer = end;\n ctx.args[0](services);\n }", "title": "" }, { "docid": "f9a3d3db0b53e6b3b64a531a6caed4c1", "score": "0.52807605", "text": "async callService(endpoint, question, top) {\n return this.queryQnaService(endpoint, question, { top });\n }", "title": "" }, { "docid": "b83b7fe68ede370f4eec04b835edb891", "score": "0.52611613", "text": "getServices() {\n log(`⌛️ get services (linked applications and addons)`)\n return new Promise((resolve, reject) => {\n let services = {}\n cmd({\n script: `\n cd ${this.path}\n clever service\n `,\n failure: error => reject(error),\n success: res_service => {\n let raw_services = res_service.split('\\n').filter(line => line.length > 0)\n let addons = raw_services !== null \n ? raw_services.filter(item => raw_services.indexOf(item) > raw_services.indexOf(\"Addons:\"))\n .map(item => {\n return {\n name: item.trim().split(\" \")[0],\n id: item.trim().split(\"(\")[1].split(\")\")[0]\n }\n })\n : null \n \n let applications = raw_services !== null \n ? raw_services.filter(item => raw_services.indexOf(item) < raw_services.indexOf(\"Addons:\") && raw_services.indexOf(item) > raw_services.indexOf(\"Applications:\"))\n .map(item => {\n return {\n name: item.trim().split(\" \")[0],\n id: item.trim().split(\"(\")[1].split(\")\")[0]\n }\n })\n : null \n \n services = {addons, applications}\n log(`🙂 services are fetched`)\n resolve(services)\n }\n })\n })\n }", "title": "" }, { "docid": "dd8573b5470dd84629474569ff4117f9", "score": "0.5235143", "text": "function updateHostStats() {\n var s = getAvailableService();\n if (s) {\n app.sendTo(\"HostStats\", {}, s.entityId, function(result) {\n if (!result.isError()) {\n // TODO: update model & charts\n self.load(result.load.toFixed(1));\n self.disk(result.disk);\n }\n setTimeout(updateHostStats, 5000);\n self.loadChart.updatePlot(60000, self.load());\n self.diskChart.updatePlot(60000, self.disk());\n });\n } else {\n setTimeout(updateHostStats, 1000);\n }\n }", "title": "" }, { "docid": "8151fdf4adb2c20338c9839495c6115c", "score": "0.5189604", "text": "ListOfRemoteAccessesForTheService(serviceName) {\n let url = `/overTheBox/${serviceName}/remoteAccesses`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "54162ed090bc070058f60ed75a5e6973", "score": "0.5182032", "text": "function _getService() {\n\n function _callback(data) {\n var dataJson;\n\n if (typeof data === 'string') {\n dataJson = JSON.parse(data);\n } else {\n dataJson = data;\n }\n\n _position.service = dataJson;\n _updateSearch();\n }\n\n $.get(\n 'http://freegeoip.net/json/',\n _callback\n );\n }", "title": "" }, { "docid": "d130b3beafa4b008da5a355455b8b3b0", "score": "0.51564866", "text": "function getAvailableService() {\n var arr = self.services();\n for (var i = 0; i < arr.length; i++) {\n var s = arr[(i + iter++) % arr.length];\n if (!s.isGone()) {\n return s;\n }\n }\n return null;\n }", "title": "" }, { "docid": "c94f26b761b010f00dd04e0f1195af69", "score": "0.5107681", "text": "function performPoll() {\n\t\t\tvar coapreq = new CoAPRequest();\n\t\t\tcoapreq.open(\"GET\", THISPerformTask.deviceres.getInfo());\n\t\t\tcoapreq.onload = handleValue\n\t\t\tcoapreq.send();\n\t\t\t\n\t\t\ttimeout = app.setTimeout(performPoll, THISPerformTask.pollres.getInfo());\n\t\t}", "title": "" }, { "docid": "e673d48a86895bbf1ec4b50c43780472", "score": "0.5098294", "text": "async query(longPoll) {\n const _this = this;\n if (longPoll) {\n try {\n // Run query only one at a time\n logger.info('VehicleSecurity long poll');\n\n await lock.acquire('query', function() {\n return _this.queryVehicle(longPoll);\n });\n } catch (err) {\n logger.error('Error while querying vehicle: %s', err.message);\n }\n } else {\n logger.info('VehicleSecurity SKIPPING POLL TO LET THE VEHICLE SLEEP');\n }\n\n }", "title": "" }, { "docid": "ed22b766b826ea9882561a9c5c715b08", "score": "0.5071974", "text": "access_to_service(){\n var epalink = element(by.css('[href=\"/centre-services/epa-register\"]')); \n epalink.click();\n browser.wait(EC.urlContains('/centre-services/epa-register/#'), 5000); // needs lots of explicit waits for service to load\n expect(browser.getCurrentUrl()).toEqual('https://uat-web.aws.aat.org.uk/centre-services/epa-register/#/');\n var start = element(by.buttonText('Start'));\n start.click();\n browser.wait(EC.urlContains('/students'), 15000); // takes ages to load - api calls... \n expect(browser.getCurrentUrl()).toEqual('https://uat-web.aws.aat.org.uk/centre-services/epa-register/#/students'); \n\n }", "title": "" }, { "docid": "859cbfad07c338a61520764aacb09185", "score": "0.5069968", "text": "loopPoll() {\n const randomTimeout = Math.floor(Math.random() * 4000) + 1000;\n return Ember.run.later(this, function() {\n return this.getDockerStats(this.get('observedServices'))\n .then(stats => {\n if (this.get('isPolling') === true) {\n this.set('cpuStatsArray', stats);\n return this.loopPoll();\n }\n })\n .catch(err => this.set('cpuStatsArray', null));\n }, randomTimeout);\n }", "title": "" }, { "docid": "97ef64e18f51ebed389bcec4a053b6ae", "score": "0.5062062", "text": "pollCallings() {\n if (this.props.url) {\n setTimeout(() => {\n axios\n .get(this.props.url)\n .then((response) => {\n if (response.data && response.data.service) {\n store.dispatch({\n type: 'SET_CALLINGS',\n callings: response.data.service,\n url: this.props.url,\n });\n } else {\n setError('No callings received');\n }\n })\n .catch((error) => {\n setError(error.toString());\n });\n }, config.refresh);\n }\n }", "title": "" }, { "docid": "7d8d579d24c06ec482566b26ff198794", "score": "0.50508493", "text": "getPrimaryService(service) {\n return new Promise((resolve, reject) => {\n if (!this.connected)\n return reject(\"getPrimaryService error: device not connected\");\n if (!service)\n return reject(\"getPrimaryService error: no service specified\");\n this.getPrimaryServices(service)\n .then(services => {\n if (services.length !== 1)\n return reject(\"getPrimaryService error: service not found\");\n resolve(services[0]);\n })\n .catch(error => {\n reject(`getPrimaryService error: ${error}`);\n });\n });\n }", "title": "" }, { "docid": "d932348def6bfe889984bfcaf877275a", "score": "0.50295895", "text": "async getTrackInfo(service_id) { // warning: do not use with normal track player, only to et infos to track!\n return new Promise(resolve => {\n this.player.load('https://soundcloud.com/' + service_id, {callback: () => {\n //setTimeout(() => this.play(), 2000); // if somehow still loading\n this.player.getCurrentSound(sound => resolve(sound));\n }});\n });\n }", "title": "" }, { "docid": "6a5dece29fe9ce7313a6185a1c1c8fe4", "score": "0.50084376", "text": "function init() {\n console.log('');\n console.log('check-ping-state');\n console.log(moment().format('MMMM Do YYYY, h:mm:ss a'));\n console.log('Inicia la consulta de todos los servidores:');\n console.log('');\n // Consulta el estado de todos los sitios web\n for(let i = 0; i < targetServers.length; i++) {\n // Procesos asincronos\n checkState(targetServers[i]);\n }\n}", "title": "" }, { "docid": "36eb4d7f09a8160deed4d9f3f8ac1eea", "score": "0.49949652", "text": "getPrimaryServices(service) {\n return new Promise((resolve, reject) => {\n if (!this.connected)\n return reject(\"getPrimaryServices error: device not connected\");\n function complete() {\n if (!service)\n return resolve(this.services);\n const filtered = this.services.filter(serviceObject => {\n return (serviceObject.uuid === helpers_1.getServiceUUID(service));\n });\n if (filtered.length !== 1)\n return reject(\"getPrimaryServices error: service not found\");\n resolve(filtered);\n }\n if (this.services)\n return complete.call(this);\n adapter_1.adapter.discoverServices(this.handle, this.device._allowedServices, services => {\n this.services = services.map(serviceInfo => {\n Object.assign(serviceInfo, {\n device: this.device\n });\n return new service_1.BluetoothRemoteGATTService(serviceInfo);\n });\n complete.call(this);\n }, error => {\n reject(`getPrimaryServices error: ${error}`);\n });\n });\n }", "title": "" }, { "docid": "8d7656a1088313cc931babbd605aa3df", "score": "0.49898162", "text": "function ServicesGet (sensor_id) {\nif (this.SenseApiCall(\"GET\", \"/sensors/\"+sensor_id+\"/services.json\", {}, []))\nreturn true;\nelse\nreturn false;\n}", "title": "" }, { "docid": "f1c1d1b4f10e751d2a42373e4062f6fc", "score": "0.49762478", "text": "getServices() {\n var accessory = this;\n var Characteristic = this.Characteristic;\n var command;\n accessory.log.debug(accessory.name + ': Invoked getServices');\n\n // Initialise the plugin ahead of any function call with static configured IP address\n // we need to update HomeKit that this device can report temperatures below zero degrees:\n this.temperatureService.getCharacteristic(Characteristic.CurrentTemperature).props.minValue = -50;\n // ... and collect the data from the device...\n accessory.pollTH10State();\n\n // and retrun the services to HomeBridge\n return [\n accessory.informationService,\n accessory.contactSensor,\n accessory.temperatureService,\n ];\n }", "title": "" }, { "docid": "19ad60f7eb53cfe2641ca7d993af68ef", "score": "0.49470118", "text": "async pingFunction() {\n if (this.webhookIsOutdated()) {\n let currentTarget = false;\n if (/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(this.target)) {\n // Target is MAC address - get IP first from arp\n const devices = await find();\n for (const device of devices) {\n if (device.mac.toLowerCase() === this.target.toLowerCase()) {\n currentTarget = device.ip;\n break;\n }\n }\n } else currentTarget = this.target;\n\n if (currentTarget === false) return; // Couldn't look up MAC address\n\n if (this.customDns !== false) {\n try {\n dns.setServers(this.customDns);\n const records = await util.promisify(dns.resolve)(currentTarget, 'A');\n [currentTarget] = records;\n } catch (e) {\n this.log(`Error during DNS resolve using custom DNS server: ${e.getMessage()}`);\n return;\n }\n }\n if (this.pingUseArp) {\n arp.getMAC(currentTarget, (err, mac) => {\n let state = false;\n if (!err && /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(mac)) state = true;\n\n if (this.webhookIsOutdated()) {\n if (state) {\n this.platform.storage.setItemSync(`lastSuccessfulPing_${this.target}`, Date.now());\n }\n if (this.successfulPingOccurredAfterWebhook()) {\n const newState = this.isActive();\n this.setNewState(newState);\n }\n }\n setTimeout(this.pingFunction.bind(this), this.pingInterval);\n });\n } else {\n ping.sys.probe(currentTarget, (state) => {\n if (this.webhookIsOutdated()) {\n if (state) {\n this.platform.storage.setItemSync(`lastSuccessfulPing_${this.target}`, Date.now());\n }\n if (this.successfulPingOccurredAfterWebhook()) {\n const newState = this.isActive();\n this.setNewState(newState);\n }\n }\n setTimeout(this.pingFunction.bind(this), this.pingInterval);\n });\n }\n } else {\n setTimeout(this.pingFunction.bind(this), this.pingInterval);\n }\n }", "title": "" }, { "docid": "802a4eab90df11b7197cf877aa403e66", "score": "0.49451497", "text": "async function startLanIPIntervalService() {\n if (lanIPManagementInterval !== {}) {\n lanIPManagementInterval = setInterval(lanIPManagement, constants.TIME.FIVE_MINUTES_IN_MILLIS);\n }\n}", "title": "" }, { "docid": "7b9425d14c5270e3c8aaba1a6081d6d5", "score": "0.49419305", "text": "function updateInfo(service){\n\t\tgetInfo(service);\n function checkPendingRequest() {\n if ($.active > 0) { \n window.setTimeout(checkPendingRequest, 1000);\n }\n else { \n fillInfo(service);\n }\n };\n\n window.setTimeout(checkPendingRequest, 1000);\t\t\n\t}", "title": "" }, { "docid": "db69b9f86b43ce1693f4ad50394853e6", "score": "0.49359277", "text": "function requestFromHana() {\n // request an adapter for the system (returns a promise)\n // TODO adapter cache (either here or even in Container)\n oContainerInterface.createAdapter(new sap.ushell.System({\n alias: oRawData.systemId,\n platform: 'hana',\n baseUrl: oRawData.baseUrl\n })).fail(fnFailure).done(function (oRemoteAdapter) {\n oRemoteAdapter.getPageBuildingService().readCatalog(oRawData.remoteId,\n onLoadRemote, fnFailure);\n });\n }", "title": "" }, { "docid": "2610035a770a914142db0ac617c954db", "score": "0.49262986", "text": "function poller() {\n\tmakeRec(\"GET\", \"/cat\", 200);\n\tmakeRec(\"GET\", \"/purchases\", 200);\n\t\n}", "title": "" }, { "docid": "500a675d7d98742f7fe03bd83caf19d8", "score": "0.49174473", "text": "startPolling() {\n // Start the polling process. The method call below is the initial check, which will then call itself (with delay) until the \n // auth occurs or hits the timeout duration.\n console.log(\"[INFO] Request to start polling sent.\");\n this.checkCondition();\n }", "title": "" }, { "docid": "e799f89f3654630d5175dd7467b1aa8d", "score": "0.49125648", "text": "ListAvailableServices() {\n let url = `/dedicated/nasha`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "a0bb779f6518979911ccba398098f77d", "score": "0.49110416", "text": "async poll() {\n debug('polling', this.urls);\n this.urls.forEach((url) => {\n try {\n this.readBallot(url);\n } catch (error) {\n errors('cannot poll', url, error.message);\n }\n });\n }", "title": "" }, { "docid": "eb57567db7ea45b14720c3e22d1f72d8", "score": "0.4900254", "text": "function lookup(mac) {\n $.getJSON('/clients/' + mac, function (response) {\n track(response);\n });\n }", "title": "" }, { "docid": "0207b03c976460f7f7d4e661108b3e8a", "score": "0.48933125", "text": "listHTTPServers() {\n this.socket && this.socket.emit('http:discover');\n }", "title": "" }, { "docid": "c572a91f876507eaa875b0354c1aea97", "score": "0.48902565", "text": "function callThingService(params) {\n return new Promise((resolve, reject) => {\n iotData.callThingService(params, (err, data) => {\n err ? reject(err) : resolve(data);\n });\n });\n}", "title": "" }, { "docid": "f2ebdde0ae3338aa84223dae747cb7dd", "score": "0.4888892", "text": "ListAvailableServices() {\n let url = `/ssl`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "3d9a25b1e971a677c74c7d7ae7445022", "score": "0.48835495", "text": "_startPings() {\n if (!this._pingIntervalId) {\n this._pingIntervalId = setInterval(() => {\n this.send(config.MESSAGE_TYPES.CLIENT.PING.key);\n }, config.pingInterval);\n }\n }", "title": "" }, { "docid": "398061f7f48bb8fd0f9bafd37b97a637", "score": "0.48750603", "text": "function wrapPingHost(target, cb) {\n\t\tlet hadCB = false\n\t\tsession.pingHost(target, (e,t) => {\n\t\t\tif(!hadCB) cb(e,t)\n\t\t\thadCB = true\n\t\t})\n\t}", "title": "" }, { "docid": "35a79404bb7ae09bcd6c5dc86ec1a41e", "score": "0.4859884", "text": "function qlping_getHostPing(hostname, port, location_id) {\n //load plugin if it is not loaded\n var qlping = qlping_loadPlugin();\n var client = qlping.createUdpClient(hostname, port);\n client.addEventListener('data', function(event) {\n var server = client.getHost() + \":\" + client.getPort();\n var rtt = client.getRoundTripTime();\n var message = event.readBytes();\n var loc = locdb.locations[location_id];\n if (rtt != -1) {\n var loc_server = loc.qlping_servers[client.getHost()];\n loc_server.ping_arr.push(parseInt(rtt));\n var pings = loc_server.ping_arr;\n var sum = pings.reduce(function(a, b) { return a + b });\n var avg = Math.round(sum / pings.length);\n loc_server.ping = avg;\n loc.qlping_avg = qlping_pingavg(loc.qlping_servers);\n }\n client.close();\n });\n var challenge = \"getchallenge\";\n var bytes = [];\n for (var i = 0, len = challenge.length; i < len; ++i)\n bytes.push(challenge.charCodeAt(i));\n client.sendBytes([0xFF, 0xFF, 0xFF, 0xFF].concat(bytes));\n }", "title": "" }, { "docid": "9b11ce6e03ae007771f6594fa797a755", "score": "0.48570392", "text": "ListAvailableServices() {\n let url = `/dbaas/timeseries`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "edcfaf3ae466aed4e14fa8a34833079e", "score": "0.48363507", "text": "function start(server_targets){\ntargets=server_targets;\n if(targets.length<=0&&timepingid!=undefined){ \n clearInterval(timepingid);\n}\npollsever()\ntimepingid=setInterval(()=>{ \n pollsever() \n},timeouttcp); \n}", "title": "" }, { "docid": "aa9b933dba198b5f3edac850becc759e", "score": "0.48324493", "text": "registerServiceCheck() {\n this.events.request(\"services:register\", 'Ethereum', this._doCheck.bind(this), 5000, 'off');\n }", "title": "" }, { "docid": "e1df1d75ada22c7eace7d5821c8ce102", "score": "0.482947", "text": "static getServiceByName(name) {\n\t\treturn services[name];\n\t}", "title": "" }, { "docid": "58140b154bbb7ec32fa807fe00139dc4", "score": "0.4824267", "text": "function startPolling(){\n debugPrint(\"beginning polling\");\n _intervalRef = $interval(function(){\n $http.get(API_PATH + 'appdata/' + _appName).then(function(data){\n data = data.data;\n updateIfChanged(data);\n }, errorPrint);\n }, _pollInterval);\n }", "title": "" }, { "docid": "28e07fac536076d034144770fc2e0f25", "score": "0.48230356", "text": "metricFindQuery(query) {\n query = this.templateSrv.replace(query, null, 'glob')\n console.log(query)\n// --- fetch all services\n if (query == \"services.*\") {\n return this.doRequest({\n url: this.url + '/containers/all',\n method: 'GET',\n }).then(response => {\n const res = [];\n const data = response.data.result;\n for (var i = 0; i < data.length; i++) {\n var label;\n if (data[i].name == undefined || data[i].name == null) {\n continue\n } else {\n var svc_name = data[i].name.split('|')\n label = svc_name[0];\n }\n res.push({value: label, text: label})\n }\n return res;\n });\n }\n// --- fetch parameters for services\n if (query.indexOf(\".params.*\") !== -1) {\n var svc_name = query.split('.')[0]\n console.log(\"++++++++++++ \" + svc_name)\n return this.doRequest({\n url: this.url + '/containers/name=' + svc_name + '*?fields=parameters',\n method: 'GET',\n }).then(response => {\n const res = [];\n const data = response.data.result;\n\n for (let i = 0; i < data.length; i++) {\n var parameters = data[i].parameters;\n for (let j = 0; j < parameters.length; j++) {\n res.push({value: parameters[j], text: parameters[j]});\n }\n }\n return res;\n });\n }\n// --- unknown metric query\n return this.doRequest({\n url: this.url + '/containers/all',\n method: 'GET',\n }).then(metrics => {\n return { status: \"success\", message: \"Only `services` and `params` queries are supported\", title: \"Choose query\" };\n });\n }", "title": "" }, { "docid": "342e88522381b80858a0759064794d7d", "score": "0.48223293", "text": "function listService(id){\n let category = '';\n const listOptions = {\n method:'GET',\n\n };\n fetch(`https://thefoth.herokuapp.com/api/v1/services/single?id=${id}`, listOptions)\n .then((res) => res.json())\n .then((datas) => {\n category = datas.service.category;\n document.getElementById('service-name').textContent = datas.service.name;\n document.getElementById('service-image').src = datas.service.cover;\n document.getElementById('product-summary').textContent = datas.service.details;\n document.getElementById('service-category').textContent = datas.service.category;\n document.getElementById('phone-number').textContent = datas.service.mobile;\n // document.getElementById('fill-category').innerHTML = layout;\n DoWork.listServices(category);\n })\n }", "title": "" }, { "docid": "f9d5e0f594d6454dbdc61f54290002a4", "score": "0.4817335", "text": "async started() {\n\t\t// let time = new Date().getTime();\n\t\t// this.broker.waitForServices(this.name).then(async () => {\n\t\t\tprocess.env.PORT = this.settings.port;\n\t\t\tprocess.env.ROOT_URL = this.settings.rootUrl;\n\n\t\t\tawait this.startSteedos();\n\n\t\t\t// this.startAPIService();\n\t\t\tawait this.setMasterSpaceId();\n\n\t\t\t// console.log('耗时:', new Date().getTime() - time);\n\t\t\t// **已经移除了waitForServices, 此事件可以作废了, 可使用 dependencies: ['steedos-server']** ; 此处有异步函数,当前服务started后,实际上还未初始化完成。所以此服务初始化完成后,发出一个事件;\n\t\t\t\n\t\t\t// 此处需要延时处理,否则监听此事件的函数中如果调用了此服务中的aciton, 可能会出现action未注册的情况.\n\t\t\tsetTimeout(()=>{\n\t\t\t\tthis.broker.emit(\"steedos-server.started\");\n\t\t\t}, 1000)\n\t\t\n\t\t\t// });\n\n\t}", "title": "" }, { "docid": "e2ab22d4c5b1da9e61f9c86f2c89c526", "score": "0.48075616", "text": "startPing() {\n this.pinging = true;\n this.nextPing();\n }", "title": "" }, { "docid": "31a4bd2eb4bd84fcece2ca7d94cd4c85", "score": "0.48069096", "text": "function getSelectedService(id){\n var url = servicesUrl+id;\n var request = new XMLHttpRequest();\n request.open(\"GET\", url);\n request.onload = function() {\n if (request.status == 200) {\n parseSelectedServiceResult(request.responseText);\n }\n };\n request.send(null);\n \n}", "title": "" }, { "docid": "ac6193e780e78cb75ef8fd8a5637164b", "score": "0.48055735", "text": "TasksAssociatedToThisSsl(serviceName) {\n let url = `/ssl/${serviceName}/tasks`;\n return this.client.request('GET', url);\n }", "title": "" }, { "docid": "e90fbc954ffee3940dbc73b0c39a1b88", "score": "0.48037547", "text": "function probe (mdns, service, cb) {\n var sent = false\n var retries = 0\n var timer\n\n mdns.on('response', onresponse)\n setTimeout(send, Math.random() * 250)\n\n function send () {\n // abort if the service have or is being stopped in the meantime\n if (!service._activated || service._destroyed) return\n\n mdns.query(service.fqdn, 'ANY', function () {\n // This function will optionally be called with an error object. We'll\n // just silently ignore it and retry as we normally would\n sent = true\n timer = setTimeout(++retries < 3 ? send : done, 250)\n timer.unref()\n })\n }\n\n function onresponse (packet) {\n // Apparently conflicting Multicast DNS responses received *before*\n // the first probe packet is sent MUST be silently ignored (see\n // discussion of stale probe packets in RFC 6762 Section 8.2,\n // \"Simultaneous Probe Tiebreaking\" at\n // https://tools.ietf.org/html/rfc6762#section-8.2\n if (!sent) return\n\n if (packet.answers.some(matchRR) || packet.additionals.some(matchRR)) done(true)\n }\n\n function matchRR (rr) {\n return dnsEqual(rr.name, service.fqdn)\n }\n\n function done (exists) {\n mdns.removeListener('response', onresponse)\n clearTimeout(timer)\n cb(!!exists)\n }\n}", "title": "" }, { "docid": "b6bb72b309df6afe4a454b743ea89c6e", "score": "0.4803241", "text": "serviceIsHealthy(options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.client.healthApi.getHealthStatus({});\n return true;\n }\n catch (_a) {\n return false;\n }\n finally {\n }\n });\n }", "title": "" }, { "docid": "40576419028bf6b19ec33bcdface29e4", "score": "0.48010355", "text": "function hostnameAvailability(cb) {\n\t\t//loading witness\n\t\tloadingWitness.start();\n\n\t\t//init loading\n\t\thostnameLoadingWitness('start');\n\t\t//it will end at the end of the request\n\n\t\t//checking if there is a timeout active and killing it\n\t\tif ( hostnameRequesterTimeout ) {\n\t\t\t//clearing timeout\n\t\t\tclearTimeout( hostnameRequesterTimeout );\n\t\t\thostnameRequesterTimeout = null;\n\t\t}\n\t\t//(re)starting it\n\t\thostnameRequesterTimeout = setTimeout(function() {\n\t\t\t//setting status to active\n\t\t\thostnameRequestStatus = 'querying';\n\n\t\t\t//loading witness\n\t\t\tloadingWitness.start();\n\n\t\t\t//asking the server\n\t\t\t//hostnameRequester.setMethod....\n\n\t\t\t//temporal timeout. modify when MUG actually checks hostname availability\n\t\t\tsetTimeout(function() {\n\t\t\t\t//loading witness\n\t\t\t\tloadingWitness.stop();\n\t\t\t\tif ( !hostnameRequesterTimeout ) {\n\t\t\t\t\t//if there is another query on the way\n\t\t\t\t\t//DO NOT EXECUTE THE CALLBACK\n\t\t\t\t\t//a most updated result is on its way!\n\t\t\t\t\t//exec cb, parameter is true when it's available, false if not.\n\t\t\t\t\tcb($hostnameInput.val().toLowerCase() != 'minebox');\n\t\t\t\t}\n\t\t\t\t//updating status\n\t\t\t\thostnameRequestStatus = null;\n\t\t\t\t//ending loading\n\t\t\t\thostnameLoadingWitness('stop');\n\t\t\t\t//loading witness\n\t\t\t\tloadingWitness.stop();\n\t\t\t}, 1000);\n\t\t\t//end of temporal fake function\n\n\t\t\t//clearing timeout\n\t\t\tclearTimeout( hostnameRequesterTimeout );\n\t\t\thostnameRequesterTimeout = null;\n\n\t\t}, hostnameRequesterTimeoutDuration);\n\t}", "title": "" }, { "docid": "62ca03ff2833823bc02d441c8513e066", "score": "0.47962034", "text": "start() {\n this.set('timer', this.schedule(this.get('onPoll')));\n }", "title": "" }, { "docid": "6ca86583445747a1c502e07ef368c855", "score": "0.47954577", "text": "startPolling () {\r\n if(this.device.interfaces[0].endpoints[0].pollActive){\r\n console.log('[RMT] Polling already active...');\r\n return;\r\n }\r\n try {\r\n console.log('[RMT] Setting endpoint to polling mode...');\r\n this.device.interfaces[0].endpoints[0].startPoll(1,8);\r\n } catch (e) {\r\n console.log('[RMT] Cannot set endpoint to polling mode: ', e);\r\n try {\r\n this.device.close();\r\n } catch (e) {\r\n console.log('[RMT] Cannot close device: ', e); \r\n }\r\n } \r\n \r\n // Wait for event : read\r\n this.device.interfaces[0].endpoints[0].on(\"data\", (dataBuf) => {\r\n this.handleEvent(this,dataBuf, this.device.interfaces[0].endpoints[0]);\r\n })\r\n }", "title": "" }, { "docid": "29e0485f7e6ee7607667aed7103c59db", "score": "0.47932446", "text": "function start()\r\n{\r\n\trest.get(rancherApiProjectEndpoint + '/hosts', {headers: {'Accept': 'application/json'}}).on('complete', function(res)\r\n\t{\r\n\t\tif(res instanceof Error)\r\n\t\t{\r\n\t\t\tconsole.log('Error:', res.message);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// How many hosts?\r\n\t\t\t//console.log('RANCHER_API: ', res);\r\n\r\n\t\t\tfor(var i = 0; i < res.data.length; i++)\r\n\t\t\t\thosts.push({rancherId: res.data[i].id, token: uuid.v4(), done: false});\r\n\r\n\t\t\tsplit();\r\n\t\t}\r\n\t});\r\n}", "title": "" }, { "docid": "e0dfb3c55a987e01e70e1f302bc8d23e", "score": "0.47921216", "text": "findFdsnAvailability(name, repoName) {\n if (name && name.length > 0) {\n this.name(name);\n }\n this.services(SERVICE_NAME);\n return this.queryJson().then((json) => {\n const out = this.extractCompatibleServices(\n json,\n SERVICE_NAME,\n repoName\n );\n return out.map((service) => {\n const url = new URL(service.url);\n const q = new AvailabilityQuery(url.hostname);\n if (url.port && url.port.length > 0) {\n q.port(Number.parseInt(url.port));\n }\n return q;\n });\n });\n }", "title": "" }, { "docid": "83d5eabaf7275d808d49f2abf3a0b2a5", "score": "0.47890425", "text": "function triggerPing()\n{\n\tvm.pingTheServer = true;\n}", "title": "" }, { "docid": "07dd978833bc90a6dc7e1cfbe7912927", "score": "0.47857475", "text": "onFetchHostInfo (isRefresh) {\n if (!isRefresh) {\n this.loadingHostInfo = true\n this.hostInfo = null\n }\n this.hostInfoError = null\n }", "title": "" }, { "docid": "68a201726581de0c29fd8b7882cbd14e", "score": "0.4781125", "text": "async created() { \n \n this.services = {\n context: this.settings?.services?.context ?? \"flow.context\",\n query: this.settings?.services?.query ?? \"flow.query\",\n acl: this.settings?.services?.acl ?? \"acl\",\n rules: this.settings?.services?.rules ?? \"rules\",\n agents: this.settings?.services?.agents ?? \"agents\",\n queue: this.settings?.services?.queue ?? \"queue\"\n };\n\n this.broker.waitForServices(Object.values(this.services));\n \n }", "title": "" }, { "docid": "3ed8fc4656f3a35f848cb49f23885dba", "score": "0.4779765", "text": "async start () {\n this._setUpConfig()\n setInterval(this._pollTravis.bind(this), this.config.pollInterval || 2000)\n }", "title": "" }, { "docid": "eed93a0da73f901305342d93f4ff93cb", "score": "0.47716257", "text": "_startPolling() {\n this.intervalHandle = setInterval(this._poll.bind(this), this.POLL_INTERVAL);\n }", "title": "" }, { "docid": "ed6374abaaad4367e900d6d26ba23739", "score": "0.47672504", "text": "async function startDiscovery(serviceType) {\n return new Promise((res, rej) => {\n let services = []\n sd.startDiscovery(\n serviceType,\n makeMDNSListener((eventName, data) => {\n if (eventName == \"onServiceFound\") {\n // TODO: Why are some properties of the serviceinfo not initialized?\n services.push({\n domainName: data.domainName,\n serviceName: data.serviceName,\n serviceType: data.serviceType\n })\n } else if (eventName == \"onDiscoveryStopped\") {\n res(services)\n }\n })\n )\n })\n}", "title": "" }, { "docid": "0d9ba01d1fbb12fd7f257ee74ea36118", "score": "0.47497585", "text": "static async poll() {\n const token = (await browser.storage.sync.get(['token'])).token\n if (!token) {\n return\n }\n\n console.log('Starting poll...')\n await this.storageSet('lastStart', Date.now())\n\n const data = await this.siloGet(this.feedPath())\n if (data) {\n if (await this.postIA('/feed/store', data)) {\n await this.storageSet('lastSuccess', Date.now())\n await this.storageSet('lastError', null)\n }\n }\n\n console.log('Done!')\n }", "title": "" }, { "docid": "172956def5b91e41eb3a5d76c483b95f", "score": "0.4749368", "text": "startPolling() {\n if (this.timer) {\n clearTimeout(this.timer);\n } \n this.issueCommands();\n this.timer = setInterval(this.issueCommands.bind(this), this.poll_frequency_seconds);\n }", "title": "" }, { "docid": "1a8309727d9997418dc89fbef50853a3", "score": "0.4747373", "text": "function getServices(){\n\tfetch(`${base_url}services/trackee`,{\n\t\t\tmethod: 'GET',\n\t\t\theaders: {\n\t \t\t'Content-Type': 'application/json',\n\t \t\t'id':myId,\n\t \t\t'token':myToken\n\t \t\t},\n\t \t}\n\t\t).then(response => {\n\t\t\tresponse.json().then(data => {\n\t\t\tif (!response.ok){\n\t\t\t\t\treturn { data :data, state :false}\n\t\t\t\t}\n\t\t\telse{\n\t\t\t\t\treturn { data :data, state :true}\n\t\t\t\t}\n\t\t\t}).then((apifeedback) => {\n\t\t\t\tif ( ! apifeedback.state){\n\t\t\t\t\t$(`#errorLogs`).html(`${apifeedback.data.message}, ${apifeedback.data.Reason}`);\n\t\t\t\t} else {\n\t\t\t\t\t$(`#addTrackerList`).empty();\n\t\t\t\t\tfor (const tracker of apifeedback.data.message){\n\t\t\t\t\t\t$(`#addTrackerList`).append(`<option value=\"${tracker.phone}\">${tracker.alias}:${tracker.phone}</option>`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t});\n\t\t});\n\n\n}", "title": "" }, { "docid": "56f698363a9e80b96de94d560cd7aac8", "score": "0.47429198", "text": "async _startPoller (circuit) {\n while (circuit.isValid()) {\n // if restarting/changing, wait and check every second until done\n if (this.isCurrentlyChanging || this.isCurrentlyRestarting) {\n await new Promise((resolve, reject) => setTimeout(resolve, 1000));\n continue; // using this instead of while loop to ensure isValid is continually checked\n }\n\n let extIp = await this._getExternalIP(circuit);\n\n if (extIp != circuit.activeExitNodeIP) {\n await this._onUnrequestedIPChange(circuit, extIp); // External IP changed, fire event to ensure we can use it\n }\n\n circuit.lastIPPollTime = new Date().getTime(); // also set by _onChangedIP\n\n // enforce a wait until next IP query\n await new Promise((resolve, reject) => setTimeout(resolve, circuit.poll_wait_interval));\n }\n }", "title": "" }, { "docid": "5262db836d7dcd916b7a39202936ce1d", "score": "0.47340542", "text": "isServiceOnline (delay) {\n return pc.utilities.pcCheck(delay);\n }", "title": "" }, { "docid": "10dd374117f0d05f16038c75f5365d2a", "score": "0.47331232", "text": "async start () {\n this._setUpConfig()\n setInterval(this._pollSentry.bind(this), this.config.pollInterval || 2000)\n }", "title": "" }, { "docid": "f1e864ec9afe357baeee61aaa8ad93ee", "score": "0.4729971", "text": "isServiceOnline (delay) {\n return pathwayCommons.utilities.pcCheck(delay);\n }", "title": "" }, { "docid": "54e5255f81229cc89f65144a3aeb51f4", "score": "0.47263277", "text": "async function getServiceList() {\n console.log('Fetching service list');\n // public listNamespacedServiceAccount (namespace: string, pretty?: string, _continue?: string, fieldSelector?: string, includeUninitialized?: boolean, labelSelector?: string, limit?: number, resourceVersion?: string, timeoutSeconds?: number, watch?: boolean) : Promise<{ response: http.IncomingMessage; body: V1ServiceAccountList; }>\n let res = await k8sApi.listNamespacedService(K8S_NAMESPACE, undefined, undefined, undefined, false, K8S_LABEL_SELECTOR);\n let resourceVersion = res.body.metadata.resourceVersion;\n let items = res.body.items;\n console.log(`Fetched service list (count: ${items.length}) (resourceVersion: ${resourceVersion})`);\n items.forEach((obj) => {\n addInstance(obj);\n });\n return resourceVersion;\n}", "title": "" }, { "docid": "6cee4333f9891b0a734786c5c50b4e15", "score": "0.47245795", "text": "async function startIntervalServices() {\n await startLanIPIntervalService();\n await updatingArtifactsService();\n}", "title": "" }, { "docid": "336d6654c2fd784d44b40afcdcb8d1dc", "score": "0.47238144", "text": "function viewServiceDetails(host_id) {\n if (!$(\"table#device_data_table tr\").hasClass(\"listing-color\")) {\n $.colorbox(\n {\n href: \"view_service_details_example.py?host_id=\" + host_id,\n //iframe:true,\n title: \"service details\",\n opacity: 0.4,\n maxWidth: \"90%\",\n width: \"1100px\",\n height: \"300px\",\n overlayClose: false\n });\n }\n}", "title": "" }, { "docid": "3717f812092b64e9eb251117c116cbd6", "score": "0.47188216", "text": "startPolling() {\n // Run first poll\n this.fetchData().then(()=>{\n // Start interval\n this.pollerInterval = setInterval(this.fetchData.bind(this), this.opts.pollRate * 60000)\n })\n }", "title": "" }, { "docid": "f2866bf16ba9a6469adde45714349525", "score": "0.47120976", "text": "function doPoll() {\n for (let i = 1; i <= NUM_TERMS; i++) {\n $.getJSON('/api/' + i + '/part', function (data) {\n if (data.status === 'ON') {\n unsetPartitionGui(data.rep);\n } else if (data.status === 'OFF') {\n setPartitionGui(data.rep);\n }\n });\n }\n if (POLLING_INTERVAL > 0)\n setTimeout(doPoll, POLLING_INTERVAL);\n }", "title": "" }, { "docid": "45a63bd5c367308eaa41b03bccc26295", "score": "0.4710191", "text": "async pollingOperation(operationId) {\n let pollingResponse;\n try {\n do {\n await sleep(2000);\n pollingResponse = await rp({\n url: `https://${this.endpoint}/qnamaker/v4.0/operations/${operationId}`,\n method: \"get\",\n json: true,\n headers: {\n \"Ocp-Apim-Subscription-Key\": this.subscriptionKey\n }\n });\n if (pollingResponse.operationState === \"Running\") {\n process.stdout.write(chalk.cyan(\".\"));\n }\n else {\n process.stdout.write(chalk.cyan(\"\\n\"));\n }\n } while (!pollingResponse || pollingResponse.operationState === \"Running\" || pollingResponse.operationState === \"NotStarted\");\n }\n catch (e) {\n console.error(\"Failed polling operation - \" + e.message);\n }\n return pollingResponse;\n }", "title": "" }, { "docid": "25f924405dacb45bd391e71127d3418c", "score": "0.46903464", "text": "_livenessInterval() {\n setTimeout(async () => {\n try {\n const { queueId, algorithms } = this._getDiscoveryData();\n if (algorithms.length === 0) {\n const idleTime = Date.now() - this._lastActive;\n const isIdle = idleTime > this._options.algorithmQueueBalancer.minIdleTimeMS;\n if (isIdle && this._active) {\n this._active = false;\n log.info(`queue ${queueId} is idle for ${(idleTime / 1000).toFixed(0)} sec, preparing for shutdown`, { component });\n await etcd.unWatchQueueActions({ queueId });\n }\n }\n else {\n await this._checkIdleAlgorithms();\n this._lastActive = Date.now();\n }\n await this._discoveryUpdate();\n }\n catch (e) {\n log.throttle.error(`fail on discovery interval ${e}`, { component }, e);\n }\n finally {\n if (this._active) {\n this._livenessInterval();\n }\n }\n }, this._options.algorithmQueueBalancer.livenessInterval);\n }", "title": "" }, { "docid": "b9daa68a68e95a9b9bf8e5826a70472c", "score": "0.46896815", "text": "function getService(v){\n\t\t\treturn factory[v];\n\t\t}", "title": "" }, { "docid": "ad5229a6e3b7d89d13a6400674cb1202", "score": "0.46878523", "text": "function mpCheckConnection()\n{\n if (!connected) {\n if (!mpClient) {\n // Search for the Mooltipass Client\n chrome.management.getAll(getAll);\n } else {\n chrome.runtime.sendMessage(mpClient.id, { ping: [] });\n setTimeout(mpCheckConnection,500);\n }\n }\n}", "title": "" }, { "docid": "69d11e5c4ff518d438a6c9e39cb45484", "score": "0.46838892", "text": "async connect() {\n let actualRoot = this.mam.getRoot();\n while (!this.stop) {\n console.log('Searching for ' + actualRoot);\n const result = await this.mam.fetchFrom(actualRoot);\n if (\n typeof result.messages !== 'undefined' &&\n result.messages.length > 0\n ) {\n result.messages.forEach(message => this.processNegotiationMsg(message));\n actualRoot = result.nextRoot;\n }\n if (!this.offered) {\n this.sendOffer();\n }\n await new Promise(resolve => setTimeout(resolve, 2000));\n }\n }", "title": "" }, { "docid": "40a55429e1e711f677dd1316eb38f0e4", "score": "0.46823248", "text": "async function getHosts() {\n\t\n\thostsList = await browser.storage.local.get(\"hosts\");\n}", "title": "" }, { "docid": "ebca54d6ad6d0d931a209959cbf7e074", "score": "0.4682141", "text": "function hitMonitorService() {\n // Send data using API\n readFileFromSDCard('Request: ' + BASE_URL + MONITOR_API);\n fetch(BASE_URL + MONITOR_API, {\n method: 'GET',\n headers: {\n 'apikey': CONST_API_KEY_VALUE\n }\n }).then((res) => res.json())\n .then((data) => {\n readFileFromSDCard('Response: OK');\n setTimeout(function() { hitDirectMatchImagesService(); }, 100);\n console.log(data);\n })\n .catch((err) => {\n $('.loader').remove();\n readFileFromSDCard('Response: ' + CONST_SERVER_DOWN);\n alertMethod(CONST_SERVER_DOWN);\n console.log(\"Error in hitMonitorService\");\n })\n}", "title": "" }, { "docid": "5c67a7e2927217aee5cec78e9f7bd8ab", "score": "0.467788", "text": "_startServices () {\n for (let service in this.services) {\n this.startService(service)\n }\n }", "title": "" }, { "docid": "f032eb89e579c0f3df53c3b1a59692ac", "score": "0.46763182", "text": "get(service_id) {\n return this.container.get(service_id);\n }", "title": "" }, { "docid": "d5339b25483263b80f6b5c1250b7b19a", "score": "0.4671813", "text": "function hostingservice(title, text){\n\tthis.title = title;\n\tthis.text = text;\n\n}", "title": "" }, { "docid": "654286389483a5e48791eccd65c75f84", "score": "0.4658575", "text": "function pollServer() {\n $.ajax({\n //url: 'http://localhost:3000/api/players/',\n url: 'http://mc.philipjagielski.com/api/players/',\n type: \"GET\",\n success: function(data) {\n console.log('Successfully pinged node server');\n START_BUTTON.html(\"Server Online\");\n START_BUTTON.addClass('server-online');\n },\n error: function() {\n setTimeout(pollServer, 1000);\n }\n });\n }", "title": "" }, { "docid": "e136865eab55218a454f158d0541b350", "score": "0.46530488", "text": "function poll() {\n\t\t\t\t\t\tcheckActivity();\n\t\t\t\t\t\tdirtyEventHandler();\n\t\t\t\t\t\tpollingTimeout = setTimeout(poll, POLL_INTERVAL);\n\t\t\t\t\t}", "title": "" }, { "docid": "e21caa74208ae291c54e95fe2090eaa3", "score": "0.4651132", "text": "ping() {\n return this.get('/');\n }", "title": "" }, { "docid": "2bc43a761cf781a71b543d3c0a55e1e7", "score": "0.46488634", "text": "getStationInformation() {\n console.log('Fetching stations list');\n\n this.$http.get('/json/stations').then(response => {\n if (!response.body.success) {\n this.setErrorState(response.body.message);\n return;\n }\n\n // Set station data\n this.stations = response.body.data.stations;\n\n console.log('> Got '+this.stations.length+' stations');\n\n // Update station status\n this.updateStationStatus();\n\n // Start timer (Could possibly be based on returned ttl value.)\n this.updateTimer = setInterval(() => {\n this.updateStationStatus();\n }, 15000);\n\n }, error => {\n console.error(error);\n this.setErrorState(error.statusText);\n });\n }", "title": "" }, { "docid": "8b8835c27b3507a7a7cfb74fb8f6d2ad", "score": "0.46449065", "text": "get host() {\r\n return this._host;\r\n }", "title": "" }, { "docid": "089dc2633259d027f964cd2015360e2e", "score": "0.46434334", "text": "function select() {\n console.log('lstServices select');\n\n var lst = Object.keys(self.services).filter((key) => {\n return self.services[key].state == 0 && key != except.socketAddress && (!sender || key != sender.socketAddress);\n });\n\n var rnd = Math.floor(Math.random() * lst.length) + 0;\n if (self.services[lst[rnd]])\n lstServices.push(self.services[lst[rnd]]);\n\n count--;\n if (count > 0) {\n select();\n }\n }", "title": "" }, { "docid": "85b7ac4685f7a8370194fc3e5d33af2f", "score": "0.46391398", "text": "function pollRouter() {\n var statusURL = \"http://testwifi.here/api/v1/status\";\n var xhr = new XMLHttpRequest();\n xhr.timeout = 5000; // OnHub is slow...\n xhr.onreadystatechange = function() {\n if (this.readyState == 4) {\n if (this.status == 200) {\n localStorage.routerFound = true;\n chrome.browserAction.setTitle({title: `Last updated at ${new Date().toLocaleTimeString()}`});\n routerStatus = JSON.parse(this.responseText)\n updateState(routerStatus);\n } else {\n localStorage.routerFound = false;\n chrome.browserAction.setTitle({title: `Errror: Unable to reach Google Wifi/OnHub at: ${statusURL}`});\n console.warn(this.statusText);\n }\n }\n };\n console.log('Background: Polling router.');\n xhr.open(\"GET\", statusURL, true);\n xhr.send();\n}", "title": "" }, { "docid": "a5e27b7dd9f85fbd1822db1090fc42a8", "score": "0.4635666", "text": "async function main() {\n let c = await pancloud_nodejs_1.autoCredentials();\n let ls = await pancloud_nodejs_1.LoggingService.factory(c, { fetchTimeout: 45000 });\n await ls.query(query); // Schedule query 1 and register the receiver\n console.log(\"Logging Service stats\");\n console.log(JSON.stringify(ls.getLsStats(), undefined, \" \"));\n console.log(`DNS Decoding Errorr: ${decodingErrors}`);\n}", "title": "" }, { "docid": "f9f508957b8bdb6360c1cc5f34ad6240", "score": "0.46275246", "text": "ping() {\n return this.request('/ping')\n }", "title": "" }, { "docid": "b909587a3206ce656792de33c97f466e", "score": "0.46232447", "text": "getService(uuid) {\n uuid = bleHelper_1.default.uuidFilter(uuid);\n const result = this._services\n .filter((element) => {\n return bleHelper_1.default.uuidFilter(element.uuid) === uuid;\n })\n .shift();\n if (!result) {\n return null;\n }\n return result;\n }", "title": "" }, { "docid": "7ee62d23a71c127a68f493554d8eea24", "score": "0.46167287", "text": "async pauseUntilReady() {\n if (this.state === SERVICE_STATE.READY) {\n return;\n }\n // State isn't ready, so set up polling\n const readyPromise = new Promise((resolve, reject) => {\n const totalTimeoutMS = 70000;\n const intervalMS = 100;\n let iterations = totalTimeoutMS / intervalMS;\n // Check service state every `intervalMS` milliseconds\n const intervalID = global.setInterval(() => {\n if (iterations < 1) {\n clearInterval(intervalID);\n reject(`State did not become ready in ${totalTimeoutMS / 1000} seconds`);\n }\n else if (this.state === SERVICE_STATE.READY) {\n clearInterval(intervalID);\n resolve();\n }\n iterations -= 1;\n }, intervalMS);\n });\n return readyPromise;\n }", "title": "" }, { "docid": "889e3f59d19a1e874b3c654edbde2a55", "score": "0.4613784", "text": "GetThisObjectProperties(serviceName) {\n let url = `/overTheBox/${serviceName}`;\n return this.client.request('GET', url);\n }", "title": "" } ]
8065685fac1cd9d3397fe7435f9cd247
supports only 2.0style add(1, 's') or add(duration)
[ { "docid": "87d63a5f61525bcedc1bceb97fb2211b", "score": "0.0", "text": "function add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n }", "title": "" } ]
[ { "docid": "a9dcf2f17cfd05d5a9728f7df0cea2df", "score": "0.6844272", "text": "addTime(x){\n this.duration += x; \n }", "title": "" }, { "docid": "d073cb06b83a1b452c9f1836ab51a70d", "score": "0.66218877", "text": "function durationValue(value)\n{\n return value + 's';\n}", "title": "" }, { "docid": "d073cb06b83a1b452c9f1836ab51a70d", "score": "0.66218877", "text": "function durationValue(value)\n{\n return value + 's';\n}", "title": "" }, { "docid": "cc27be90539fadc547d8fcb122d2579e", "score": "0.661811", "text": "function addToTime(time, addSeconds) {\n\n}", "title": "" }, { "docid": "fa77c5484f2d7ac2c46be0722feea4d0", "score": "0.64031774", "text": "function duration_add_subtract__add(input,value){\nreturn duration_add_subtract__addSubtract(this,input,value,1);}", "title": "" }, { "docid": "041ea1708d5d9fd9d1d76338fd6899be", "score": "0.6344622", "text": "function c(t,e){return\"string\"!=typeof t||t.match(/^[\\-0-9\\.]+$/)?\"\"+t+e:t}// ### toMS(duration)", "title": "" }, { "docid": "0dd1d5f78ce197a555e2c067d4135083", "score": "0.62855816", "text": "function durationValue( value ) {\n return value + 's';\n }", "title": "" }, { "docid": "7d902ca1cd9a66356301bf290a376a89", "score": "0.6224369", "text": "add(duration) {\n return (0, $735220c2d4774dd3$export$96b1d28349274637)(this, duration);\n }", "title": "" }, { "docid": "5fce61131c6652f3015bd383706eaa09", "score": "0.6196108", "text": "add(duration) {\n return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);\n }", "title": "" }, { "docid": "5fce61131c6652f3015bd383706eaa09", "score": "0.6196108", "text": "add(duration) {\n return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);\n }", "title": "" }, { "docid": "a315f639e0f334ff83f7c78b085a937a", "score": "0.6169626", "text": "add(duration) {\n return (0, $735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);\n }", "title": "" }, { "docid": "903e0b935fd6eef5b40d3bd18825e1c5", "score": "0.6108706", "text": "function duration_add_subtract__add (input, value) {\n\t\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "0cc5d0000bfc9d5735aeeb18d172896c", "score": "0.6108279", "text": "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "ce1da06de7cd4e42a62676f2da867119", "score": "0.608478", "text": "function duration_add_subtract__add(input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "title": "" }, { "docid": "fdaec6a27e432690ab0c41f797008aea", "score": "0.60785997", "text": "function animatev2(\n type = \"something\",\n duration = 300,//you can add a trailing comma\n) {\n console.log(type + \", \" + duration);\n}", "title": "" }, { "docid": "319982968a71baab4c02de6ac1ae6ca0", "score": "0.6057909", "text": "function d(e){var i=e;// Allow string durations like 'fast' and 'slow', without overriding numeric values.\nreturn\"string\"!=typeof i||i.match(/^[\\-0-9\\.]+/)||(i=t.fx.speeds[i]||t.fx.speeds._default),c(i,\"ms\")}", "title": "" }, { "docid": "f3d9ab773f4c9c479b8d4f079fa409d5", "score": "0.6048248", "text": "setDuration(value) { this._behavior('set duration(value)'); }", "title": "" }, { "docid": "48e2ce2d88f7c97f4e81bed978186daa", "score": "0.60130054", "text": "static seconds(quantity) {\n return new Duration(quantity, Duration.Unit.SECONDS);\n }", "title": "" }, { "docid": "419c5c8f59155ba4cac152f560c37533", "score": "0.5998106", "text": "initDuration() {\n let n = TRANSITION_DURATION;\n switch (typeof this.props.duration) {\n case 'string':\n n = parseFloat(this.props.duration) * 1000;\n break;\n case 'number':\n n = this.props.duration;\n break;\n }\n this.duration = n;\n return this.duration / 1000 + 's';\n }", "title": "" }, { "docid": "80e046f6e60ddb8c61c9bf5161542276", "score": "0.5977768", "text": "function duration_add_subtract__add(input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "8b93b6fdf80824320d311f7b395cbdb8", "score": "0.59499264", "text": "durationchange(e) { update({duration: Math.trunc(e.target.duration * 1e6)}); }", "title": "" }, { "docid": "9d54264c2477910fb726493958078573", "score": "0.5922357", "text": "function addZeroToSingleSeconds() {\n if (seconds >= 0 && seconds < 10) {\n seconds = \"0\" + seconds;\n }\n }", "title": "" }, { "docid": "846c47fce7c297ef9b8d924a8079b0df", "score": "0.59033614", "text": "function second_counter() {\n\tduration_in_sec += 1;\n}", "title": "" }, { "docid": "4512c1321d80f0b7c530dd334e63f42d", "score": "0.5900194", "text": "function setDuration(d){\n duration = d * 60 * 1000;\n}", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "7527074d3ec9c1aca96052fed9c9987a", "score": "0.5894448", "text": "function duration_add_subtract__add (input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "1697176aec033339014f30141019f83a", "score": "0.58881646", "text": "function duration_add_subtract__add (input, value) {\r\n return duration_add_subtract__addSubtract(this, input, value, 1);\r\n }", "title": "" }, { "docid": "d0031503897e2e7c7a3cd38a08b47a8e", "score": "0.5848596", "text": "function add(a,b){\n return a + b + new Date().getSeconds();\n}", "title": "" }, { "docid": "2eef7ef44edeca39e704f3fb05377054", "score": "0.5845467", "text": "function duration_add_subtract__add(input, value) {\n return duration_add_subtract__addSubtract(this, input, value, 1);\n }", "title": "" }, { "docid": "06dd42e688ca923b31f52562d4d671e5", "score": "0.5814135", "text": "function formatDuration(duration) {\n if (duration < 1000) {\n duration += 'ms';\n } else if (duration > 1000) {\n duration /= 1000;\n duration += 's';\n }\n return duration;\n}", "title": "" }, { "docid": "39c178dba724a801e049d8e4edf3b5c2", "score": "0.5787265", "text": "set duration(s) {\n this.attributeChangedCallback('duration', this.duration, s);\n }", "title": "" }, { "docid": "b394952d09bb98650265c09de08e5677", "score": "0.5785403", "text": "constructor(duration) {\n this[$duration] = duration;\n this[$time] = 0;\n }", "title": "" }, { "docid": "febc809cc3fc55e5caa0b1266695056e", "score": "0.57616514", "text": "function add(a, b) {\n return a + b + new Date().getSeconds();\n}", "title": "" }, { "docid": "648e8a4454fc045166e1ef166caa56a8", "score": "0.574056", "text": "function newDuration(movieDuration) { \n\n \n var duration = movieDuration.split(\" \")\n \n \n if(duration[1] != undefined){\n\n return durationTotal = parseInt(duration[1]) + parseInt(duration[0])*60;\n\n } else if (duration[0].includes(\"h\")){\n return durationTotal = parseInt(duration[0])*60\n } else {\n return parseInt(duration[0])\n }\n \n}", "title": "" }, { "docid": "8bfda034c286cf5b9136a618b4e6c80d", "score": "0.5735059", "text": "setDurationTime() {\n const { ss, to } = this.conf;\n if (ss && to) {\n let duration = 0;\n forEach(this.list, () => {\n const start = DateUtil.hmsToSeconds(ss);\n const end = DateUtil.hmsToSeconds(to);\n duration += end - start;\n });\n\n this.setDuration(0, duration);\n }\n }", "title": "" }, { "docid": "c0e2f4861b0dceb3b1b25103d16df1f0", "score": "0.571939", "text": "get duration() { return 1000 }", "title": "" }, { "docid": "975c8bfb88f1fe564e0ca2131ebf8120", "score": "0.5710424", "text": "function setDuration1(i, x)\n{\n\tdur[i] = x;\n\tvar label = 'd'+format2(i);\n\toutlet(0, label, x);\n}", "title": "" }, { "docid": "90454bcc822bd06f2385f49130b9c49d", "score": "0.56843925", "text": "function Duration(p1, p2) {\n if (typeof p1 == 'number') {\n this.days = p1 || 0;\n this.seconds = p2 || 0;\n }\n else if (typeof p1 != 'undefined') {\n this.days = p1.days || 0;\n this.seconds = p1.seconds || 0;\n } // if..else\n} // Duration", "title": "" }, { "docid": "978203499f5882255d07f601fca89ef8", "score": "0.563004", "text": "function setDuration(elem, session) {\n let duration = elem.declarations[\"duration\"];\n if (!duration.value)\n duration.value = [];\n duration.value.push(session);\n}", "title": "" }, { "docid": "0aeaa673838f701719b30fde0d1118ae", "score": "0.5626049", "text": "function increase_time(amount) {\n\n}", "title": "" } ]
c2284e7ce57cca285ffb52f3e0c3ce38
Helper function to find the min/max vertex projections along the given axis relative to the specified origin.
[ { "docid": "064bbd4eb0fd5cb4e37ff8426477c7ac", "score": "0.67205715", "text": "function ProjectOntoAxis(rb, origin, axis)\n\t{\n\t\tif(!rb.collider || !rb.collider.vertices)\n\t\t\treturn;\n\n\t\tvar result = {\n\t\t\tmin: \tnull, \n\t\t\tmax: \tnull,\n\t\t\tminP: \tnull,\n\t\t\tmaxP: \tnull\n\t\t};\n\n\t\tfor(var i = 0; i < rb.collider.vertices.length; i++)\n\t\t{\n\t\t\tvar p = origin ? rb.collider.vertices[i].add(rb.transform.position).subtract(origin) : rb.collider.vertices[i];\n\t\t\tvar dist = p.dot(axis);\n\n\t\t\tif(result.min === null || dist <= result.min)\n\t\t\t{\n\t\t\t\t// if(result.min && Math.abs(result.min - dist) < multiPointThreshold)\n\t\t\t\t// \tconsole.log(\"Hit!\", result.min, dist);\n\t\t\t\t// else\n\t\t\t\t// \tconsole.log(\"Miss...\", result.min, dist, result.minP);\n\n\t\t\t\tvar p = rb.collider.vertices[i].add(rb.transform.position);\n\t\t\t\t//(result.min && Math.abs(result.min - dist) < multiPointThreshold) ? result.minP.push(p) : result.minP = [p];\n\t\t\t\tresult.minP = [p];\n\t\t\t\tresult.min = dist;\n\t\t\t}\n\n\t\t\tif(result.max === null || dist >= result.max)\n\t\t\t{\n\t\t\t\t// if(result.max && Math.abs(result.max - dist) < multiPointThreshold)\n\t\t\t\t// \tconsole.log(\"Hit!\", result.max, dist);\n\t\t\t\t// else\n\t\t\t\t// \tconsole.log(\"Miss...\", result.max, dist, result.maxP);\n\n\t\t\t\tvar p = rb.collider.vertices[i].add(rb.transform.position);\n\t\t\t\t//(result.max && Math.abs(dist - result.max) < multiPointThreshold) ? result.maxP.push(p) : result.maxP = [p];\n\t\t\t\tresult.maxP = [p];\n\t\t\t\tresult.max = dist;\n\t\t\t}\n\t\t}\n\n\t\t//console.log(\">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\", result);\n\t\treturn result;\n\t}", "title": "" } ]
[ { "docid": "90ef94cb092a345fa11a1762b0c90cce", "score": "0.7716678", "text": "getMinMaxProjectionsOntoAxis(axis) {}", "title": "" }, { "docid": "d070be9dd59abbbd77c533d9b4092ffb", "score": "0.67439246", "text": "function projectMinMaxOnAxis(points, axis, offset) {\n let min = Infinity;\n let max = -Infinity;\n\n for (let i = 0; i < points.length; i += 1) {\n const dotProd = points[i].dot(axis);\n if (dotProd < min) min = dotProd;\n if (dotProd > max) max = dotProd;\n }\n\n return { min: min + offset, max: max + offset };\n}", "title": "" }, { "docid": "1b9c44aaab9c503f707b970417d133dc", "score": "0.63763624", "text": "function calcRelativeAxisConstraints(axis, min, max) {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max: max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n };\n}", "title": "" }, { "docid": "1b9c44aaab9c503f707b970417d133dc", "score": "0.63763624", "text": "function calcRelativeAxisConstraints(axis, min, max) {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max: max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n };\n}", "title": "" }, { "docid": "ad5c2a294a3d5ede6536ce95967121d3", "score": "0.6312812", "text": "function getCartesianRange(props, axis) {\n // determine how to lay the axis and what direction positive and negative are\n var vertical = axis !== \"x\";\n var padding = getPadding(props);\n\n if (vertical) {\n return [props.height - padding.bottom, padding.top];\n }\n\n return [padding.left, props.width - padding.right];\n}", "title": "" }, { "docid": "ad5c2a294a3d5ede6536ce95967121d3", "score": "0.6312812", "text": "function getCartesianRange(props, axis) {\n // determine how to lay the axis and what direction positive and negative are\n var vertical = axis !== \"x\";\n var padding = getPadding(props);\n\n if (vertical) {\n return [props.height - padding.bottom, padding.top];\n }\n\n return [padding.left, props.width - padding.right];\n}", "title": "" }, { "docid": "b7092d19e515f21c2da2bcf14176aebc", "score": "0.6266758", "text": "project(axis) {\n const scalars = [];\n const point = this.center;\n const dotProduct = point.dot(axis);\n scalars.push(dotProduct);\n scalars.push(dotProduct + this.radius);\n scalars.push(dotProduct - this.radius);\n return new Projection(Math.min.apply(Math, scalars), Math.max.apply(Math, scalars));\n }", "title": "" }, { "docid": "b4ca9d0f1576f67bede9cf3f7e794563", "score": "0.6249111", "text": "function projShapeOntoAxis(axis, obj){\r\n setBallVerticesAlongAxis(obj, axis);\r\n let min = Vector.dot(axis, obj.vertex[0]);\r\n let max = min;\r\n let collVertex = obj.vertex[0];\r\n for(let i=0; i<obj.vertex.length; i++){\r\n let p = Vector.dot(axis, obj.vertex[i]);\r\n if(p<min){\r\n min = p;\r\n collVertex = obj.vertex[i];\r\n } \r\n if(p>max){\r\n max = p;\r\n }\r\n }\r\n return {\r\n min: min,\r\n max: max, \r\n collVertex: collVertex\r\n }\r\n}", "title": "" }, { "docid": "d3a260694863b13aa763eea620e17f8b", "score": "0.62450105", "text": "static project(shape, axis, pos, quat, result) {\n const n = shape.vertices.length;\n const localAxis = project_localAxis;\n let max = 0;\n let min = 0;\n const localOrigin = project_localOrigin;\n const vs = shape.vertices;\n localOrigin.setZero(); // Transform the axis to local\n\n Transform.vectorToLocalFrame(pos, quat, axis, localAxis);\n Transform.pointToLocalFrame(pos, quat, localOrigin, localOrigin);\n const add = localOrigin.dot(localAxis);\n min = max = vs[0].dot(localAxis);\n\n for (let i = 1; i < n; i++) {\n const val = vs[i].dot(localAxis);\n\n if (val > max) {\n max = val;\n }\n\n if (val < min) {\n min = val;\n }\n }\n\n min -= add;\n max -= add;\n\n if (min > max) {\n // Inconsistent - swap\n const temp = min;\n min = max;\n max = temp;\n } // Output\n\n\n result[0] = max;\n result[1] = min;\n }", "title": "" }, { "docid": "11df34ac7952b42f86d1b40d475e43b1", "score": "0.5907601", "text": "function GetMinMaxPointsXY(rb)\n\t{\n\t\tif(!rb.collider || !rb.collider.vertices)\n\t\t\treturn;\n\n\t\tvar result = {\n\t\t\tminX: \tnull, \n\t\t\tmaxX: \tnull, \n\t\t\tminY: \tnull, \n\t\t\tmaxY: \tnull,\n\t\t\tminPX: \tnull,\n\t\t\tmaxPX: \tnull,\n\t\t\tminPY: \tnull,\n\t\t\tminPX: \tnull\n\t\t};\n\n\t\tfor(var i = 0; i < rb.collider.vertices.length; i++)\n\t\t{\n\t\t\tvar v = rb.collider.vertices[i].add(rb.transform.position);\n\n\t\t\tif(result.minX === null || v.x <= result.minX)\n\t\t\t{\n\t\t\t\tresult.minPX = [v];\n\t\t\t\tresult.minX = v.x;\n\t\t\t}\n\t\t\tif(result.maxX === null || v.x >= result.maxX)\n\t\t\t{\n\t\t\t\tresult.maxPX = [v];\n\t\t\t\tresult.maxX = v.x;\n\t\t\t}\n\t\t\tif(result.minY === null || v.y <= result.minY)\n\t\t\t{\n\t\t\t\tresult.minPY = [v];\n\t\t\t\tresult.minY = v.y;\n\t\t\t}\n\t\t\tif(result.maxY === null || v.y >= result.maxY)\n\t\t\t{\n\t\t\t\tresult.maxPY = [v];\n\t\t\t\tresult.maxY = v.y;\n\t\t\t}\n\t\t}\n\n\t\t//console.log(\">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\", result);\n\t\treturn result;\n\t}", "title": "" }, { "docid": "fa854ff5d01fb32e16054bdd51e1fbe4", "score": "0.58333033", "text": "function getMinBox() {\n let minX = 0;\n let minY = 0;\n let maxX = 300;\n let maxY = 300;\n\n var coorX = coords.map(function(p) {\n return p.x;\n });\n var coorY = coords.map(function(p) {\n return p.y;\n });\n\n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n };\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n };\n return {\n min: min_coords,\n max: max_coords\n };\n }", "title": "" }, { "docid": "6f7904bb04a04a0178b41d19b1543086", "score": "0.5800361", "text": "static getMinMax(boundary, norm) {\n let probeA = boundary.topRight.dot(norm);\n let probeB = boundary.bottomRight.dot(norm);\n let probeC = boundary.bottomLeft.dot(norm);\n let probeD = boundary.topLeft.dot(norm);\n\n return {\n max: Math.max(probeA, probeB, probeC, probeD),\n min: Math.min(probeA, probeB, probeC, probeD)\n };\n }", "title": "" }, { "docid": "7e594f795bb5a10d7a1d579417aafd9c", "score": "0.5700063", "text": "function getMinBox() {\n //get coordinates \n var coorX = coords.map(function(p) {\n return p.x\n });\n var coorY = coords.map(function(p) {\n return p.y\n });\n\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //return as strucut \n return {\n min: min_coords,\n max: max_coords\n }\n}", "title": "" }, { "docid": "ccfe07863784c491b7ea9dd5ee61fb4d", "score": "0.5637329", "text": "translatedExtremes() {\n let extremes = this.getExtremes();\n let translatedPosition = this.translatedPosition();\n let offset = -1; // offset one to each of the above coords\n\n return {\n max: [\n extremes.max[this.ROW] + translatedPosition[this.ROW] + offset,\n extremes.max[this.COL] + translatedPosition[this.COL] + offset,\n ],\n min: [\n extremes.min[this.ROW] + translatedPosition[this.ROW] + offset,\n extremes.min[this.COL] + translatedPosition[this.COL] + offset,\n ],\n };\n }", "title": "" }, { "docid": "5d94ff28c02814e85faab0295abcbb34", "score": "0.56356394", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = -10;\n let xMax = 180;\n\n // get min/max y values\n let yMin = 150;\n let yMax = 800;\n\n // return formatted min/max data as an object\n return {\n xMin: xMin,\n xMax: xMax,\n yMin: yMin,\n yMax: yMax\n }\n}", "title": "" }, { "docid": "d084ce9f6a553c33d9c67825306e8030", "score": "0.5455436", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = d3.min(x);\n let xMax = d3.max(x);\n\n // get min/max y values\n let yMin = d3.min(y);\n let yMax = d3.max(y);\n\n // return formatted min/max data as an object\n return {\n xMin : xMin,\n xMax : xMax,\n yMin : yMin,\n yMax : yMax\n }\n }", "title": "" }, { "docid": "d084ce9f6a553c33d9c67825306e8030", "score": "0.5455436", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = d3.min(x);\n let xMax = d3.max(x);\n\n // get min/max y values\n let yMin = d3.min(y);\n let yMax = d3.max(y);\n\n // return formatted min/max data as an object\n return {\n xMin : xMin,\n xMax : xMax,\n yMin : yMin,\n yMax : yMax\n }\n }", "title": "" }, { "docid": "d084ce9f6a553c33d9c67825306e8030", "score": "0.5455436", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = d3.min(x);\n let xMax = d3.max(x);\n\n // get min/max y values\n let yMin = d3.min(y);\n let yMax = d3.max(y);\n\n // return formatted min/max data as an object\n return {\n xMin : xMin,\n xMax : xMax,\n yMin : yMin,\n yMax : yMax\n }\n }", "title": "" }, { "docid": "d084ce9f6a553c33d9c67825306e8030", "score": "0.5455436", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = d3.min(x);\n let xMax = d3.max(x);\n\n // get min/max y values\n let yMin = d3.min(y);\n let yMax = d3.max(y);\n\n // return formatted min/max data as an object\n return {\n xMin : xMin,\n xMax : xMax,\n yMin : yMin,\n yMax : yMax\n }\n }", "title": "" }, { "docid": "d084ce9f6a553c33d9c67825306e8030", "score": "0.5455436", "text": "function findMinMax(x, y) {\n\n // get min/max x values\n let xMin = d3.min(x);\n let xMax = d3.max(x);\n\n // get min/max y values\n let yMin = d3.min(y);\n let yMax = d3.max(y);\n\n // return formatted min/max data as an object\n return {\n xMin : xMin,\n xMax : xMax,\n yMin : yMin,\n yMax : yMax\n }\n }", "title": "" }, { "docid": "70f7dc1be3e2847580c5dbc1a2aef083", "score": "0.5445731", "text": "function ProjectAxes(a, b)\n\t{\n\t\tvar result = {pen: null, normal: null};\n\n\t\tfor(var i = 0; i < b.collider.worldAxes.length; i++)\n\t\t{\n\t\t\tvar axis = b.collider.worldAxes[i];\n\t\t\tvar projA = ProjectOntoAxis(a, b.transform.position, axis);\n\t\t\tvar projB = ProjectOntoAxis(b, null, axis);\n\n\t\t\tif(projB.min > projA.max || projA.min > projB.max)\n\t\t\t{\n\t\t\t\t// No overlap? No collision!\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar baoverlap = projB.max - projA.min;\n\t\t\t\tvar aboverlap = projA.max - projB.min;\n\t\t\t\tif(baoverlap < aboverlap)\n\t\t\t\t{\n\t\t\t\t\t// Use amin vertex as contact point\n\t\t\t\t\tvar pen = baoverlap;\n\t\t\t\t\tif(result.pen === null || pen < result.pen)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult.pen = pen;\n\t\t\t\t\t\tresult.normal = axis;\n\t\t\t\t\t\tresult.contactPoint = projA.minP;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use amax vertex as contact point\n\t\t\t\t\tvar pen = aboverlap;\n\t\t\t\t\tif(result.pen === null || pen < result.pen)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult.pen = pen;\n\t\t\t\t\t\tresult.normal = axis.multiply(-1);\n\t\t\t\t\t\tresult.contactPoint = projA.maxP;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}", "title": "" }, { "docid": "7575ae7c2a12e73d5212054c942e4dbf", "score": "0.54377985", "text": "function findMinMax(x, y) {\r\n\r\n // get min/max x values\r\n let xMin = d3.min(x);\r\n let xMax = d3.max(x);\r\n\r\n // get min/max y values\r\n let yMin = d3.min(y);\r\n let yMax = d3.max(y);\r\n\r\n // return formatted min/max data as an object\r\n return {\r\n xMin : xMin,\r\n xMax : xMax,\r\n yMin : yMin,\r\n yMax : yMax\r\n }\r\n }", "title": "" }, { "docid": "7ec9c0b92d66ed8d918c0f89eccefc43", "score": "0.53130424", "text": "function getScales(xyMinMaxCurr, xyMinMaxOrigin) {\n var sizeCurr = getSize(xyMinMaxCurr);\n var sizeOrigin = getSize(xyMinMaxOrigin);\n var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]];\n isNaN(scales[0]) && (scales[0] = 1);\n isNaN(scales[1]) && (scales[1] = 1);\n return scales;\n}", "title": "" }, { "docid": "7ec9c0b92d66ed8d918c0f89eccefc43", "score": "0.53130424", "text": "function getScales(xyMinMaxCurr, xyMinMaxOrigin) {\n var sizeCurr = getSize(xyMinMaxCurr);\n var sizeOrigin = getSize(xyMinMaxOrigin);\n var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]];\n isNaN(scales[0]) && (scales[0] = 1);\n isNaN(scales[1]) && (scales[1] = 1);\n return scales;\n}", "title": "" }, { "docid": "d3cbdbea387f62f5832efe45185ab5c4", "score": "0.53015935", "text": "function transform(xx, yy) {\r\n\tvar XX = (xx - xmin) / (xmax - xmin) * (XMAX - XMIN)\r\n\t\t+ XMIN;\r\n\tvar YY = (yy - ymin) / (ymax - ymin) * (YMAX - YMIN)\r\n\t\t+ YMIN;\r\n\treturn {x: XX, y: YY};\r\n}", "title": "" }, { "docid": "ae6e44ba319cd584932c684a5f4e6396", "score": "0.5298113", "text": "function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {\n var _a;\n var min = constraintsAxis.min - layoutAxis.min;\n var max = constraintsAxis.max - layoutAxis.max;\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min) {\n _a = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__read)([max, min], 2), min = _a[0], max = _a[1];\n }\n return {\n min: layoutAxis.min + min,\n max: layoutAxis.min + max,\n };\n}", "title": "" }, { "docid": "e2076d088aa5283319dc3728037c8c23", "score": "0.52912545", "text": "getMinBox() {\n let coorX = this.state.coords.map(p => p.x);\n let coorY = this.state.coords.map(p => p.y);\n // find top let corner\n var minCoords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n };\n // find the right bottom corner\n var maxCoords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n };\n\n return {\n min: minCoords,\n max: maxCoords\n };\n }", "title": "" }, { "docid": "db4d4f3a0df27bae5e5bca6391afd81e", "score": "0.5274755", "text": "function getSourceCoords(aShape, axis) {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('int(getIndices(resRC.x, resRC.z))');\n }\n else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}", "title": "" }, { "docid": "db4d4f3a0df27bae5e5bca6391afd81e", "score": "0.5274755", "text": "function getSourceCoords(aShape, axis) {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('int(getIndices(resRC.x, resRC.z))');\n }\n else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}", "title": "" }, { "docid": "50f27a715ceb5522ef62457215a9990c", "score": "0.5266008", "text": "function transform(xx, yy) {\n\t\tvar XX = (xx - xmin) / (xmax - xmin) * (XMAX - XMIN)\n\t\t\t+ XMIN;\n\t\tvar YY = (yy - ymin) / (ymax - ymin) * (YMAX - YMIN)\n\t\t\t+ YMIN;\n\t\treturn {X: XX, Y: YY};\n\t}", "title": "" }, { "docid": "f377f268f0b7af0bcaba20366be808d1", "score": "0.52609897", "text": "function calcPositionFromProgress(axis, constraints, progress) {\n var axisLength = axis.max - axis.min;\n var min = Object(popmotion__WEBPACK_IMPORTED_MODULE_2__[\"mix\"])(constraints.min, constraints.max - axisLength, progress);\n return { min: min, max: min + axisLength };\n}", "title": "" }, { "docid": "e3d7cc05a7f5e693b1cca293fb13869b", "score": "0.5257759", "text": "function calcPositionFromProgress(axis, constraints, progress) {\n var axisLength = axis.max - axis.min;\n var min = (0,popmotion__WEBPACK_IMPORTED_MODULE_0__.mix)(constraints.min, constraints.max - axisLength, progress);\n return { min: min, max: min + axisLength };\n}", "title": "" }, { "docid": "d45e913b4dd5b68a54986bc5cb7c18ff", "score": "0.5249358", "text": "function findMinAndMax(dataColumnX) {\n xMin = d3.min(worldData, function(data) {\n return +data[dataColumnX] * 0.8;\n });\n\n xMax = d3.max(worldData, function(data) {\n return +data[dataColumnX] * 1.1;\n });\n\n yMax = d3.max(worldData, function(data) {\n return +data.HomicidePer100k * 1.1;\n });\n }", "title": "" }, { "docid": "f91a62e4e4def1f56bc9e3736ca4c8b3", "score": "0.52440554", "text": "function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {\n var _a;\n var min = constraintsAxis.min - layoutAxis.min;\n var max = constraintsAxis.max - layoutAxis.max;\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min) {\n _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([max, min], 2), min = _a[0], max = _a[1];\n }\n return {\n min: layoutAxis.min + min,\n max: layoutAxis.min + max,\n };\n}", "title": "" }, { "docid": "25e186a1fc19a8742ee0bba55c03b556", "score": "0.5229989", "text": "function findMinMax(x, y) {\r\n // get min/max x values\r\n let xMin = Math.min.apply(null, x.filter(function(n) { return !isNaN(n); }));\r\n let xMax = Math.max.apply(null, x.filter(function(n) { return !isNaN(n); }));\r\n // get min/max y values\r\n let yMin = Math.min.apply(null, y.filter(function(n) { return !isNaN(n); }));\r\n let yMax = Math.max.apply(null, y.filter(function(n) { return !isNaN(n); }));\r\n // return formatted min/max data as an object\r\n return {\r\n xMin : xMin,\r\n xMax : xMax,\r\n yMin : yMin,\r\n yMax : yMax\r\n }\r\n }", "title": "" }, { "docid": "a5c586cae603193b9d9a9355fff6dc01", "score": "0.5227631", "text": "function getScales(xyMinMaxCurr, xyMinMaxOrigin) {\n\t var sizeCurr = getSize(xyMinMaxCurr);\n\t var sizeOrigin = getSize(xyMinMaxOrigin);\n\t var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]];\n\t isNaN(scales[0]) && (scales[0] = 1);\n\t isNaN(scales[1]) && (scales[1] = 1);\n\t return scales;\n\t }", "title": "" }, { "docid": "7d8bf099609156688256afa5086d4d44", "score": "0.51968217", "text": "function TransformCoordinates(x,y) {\n\t//Check min & max\n\tif(x < rawXMin){\n\t\trawXMin = x;\n\t\t//-364.348\n\t}\n\tif(y < rawYMin){\n\t\trawYMin = y;\n\t\t//-631.54\n\t}\n\tif(x > rawXMax){\n\t\trawXMax = x;\n\t\t//217.779\n\t}\n\tif(y > rawYMax){\n\t\trawYMax = y;\n\t\t//59.44879999999999\n\t}\n\n\tx = ((x-rawXMin)*(window.innerWidth-0))/(rawXMax-rawXMin);\n\ty = ((y-rawYMin)*(window.innerHeight-0))/(rawYMax-rawYMin);\n\treturn [x,y];\n}", "title": "" }, { "docid": "d3e13e728a9b867d17d41d35ec237482", "score": "0.51813275", "text": "function returnBiggerviewWindow(axis_min, axis_max) {\n axis_hour_min = axis_min[0];\n axis_min_min = axis_min[1];\n axis_hour_max = axis_max[0];\n axis_min_max = axis_max[1];\n gap = 5;\n if (axis_min_min - gap < 0) {\n axis_min_min = axis_min_min + 60 - gap;\n axis_hour_min = axis_hour_min - 1;\n } else {\n axis_min_min = axis_min_min - gap;\n }\n\n if (axis_min_max + gap > 60) {\n axis_hour_max = axis_hour_max + 1;\n axis_min_max = axis_min_max - 60 + gap;\n } else {\n axis_min_max = axis_min_max + gap;\n }\n\n return axis_hour_min, axis_min_min, axis_hour_max, axis_min_max;\n}", "title": "" }, { "docid": "68e03f7a5902e5140a9ebb963ec231d8", "score": "0.5151896", "text": "function getXs(minx, maxx, m) {\n return linspace(minx, maxx, Math.pow(4,m)*(maxx - minx) + 1.0);\n}", "title": "" }, { "docid": "5a23dc0df2ac90b43d620defba2f70cf", "score": "0.5146766", "text": "function ProjectAxesAABB(a, b)\n\t{\n\t\tvar projA = GetMinMaxPointsXY(a);\n\t\tvar projB = GetMinMaxPointsXY(b);\n\n\t\tvar result = {pen: null, normal: null};\n\t\t\n\t\t// Check for overlap in the x-axis\n\t\tif(projB.minX > projA.maxX || projA.minX > projB.maxX)\n\t\t{\n\t\t\t// No overlap? No collision!\n\t\t\treturn null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar baoverlap = projB.maxX - projA.minX;\n\t\t\tvar aboverlap = projA.maxX - projB.minX;\n\t\t\tif(baoverlap < aboverlap)\n\t\t\t{\n\t\t\t\tresult.pen = baoverlap;\n\t\t\t\tresult.normal = vec2(1, 0);\n\t\t\t\tresult.contactPoint = projA.minPX;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// use amaxx\n\t\t\t\tresult.pen = aboverlap;\n\t\t\t\tresult.normal = vec2(-1, 0);\n\t\t\t\tresult.contactPoint = projA.maxPX;\n\t\t\t}\n\t\t}\n\n\t\t// Check for overlap in the y-axis\n\t\tif(projB.minY > projA.maxY || projA.minY > projB.maxY)\n\t\t{\n\t\t\t// No overlap? No collision!\n\t\t\treturn null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar baoverlap = projB.maxY - projA.minY;\n\t\t\tvar aboverlap = projA.maxY - projB.minY;\n\t\t\tif(baoverlap < aboverlap)\n\t\t\t{\n\t\t\t\tvar pen = baoverlap;\n\t\t\t\tif(pen < result.pen)\n\t\t\t\t{\n\t\t\t\t\tresult.pen = pen;\n\t\t\t\t\tresult.normal = vec2(0, 1);\n\t\t\t\t\tresult.contactPoint = projA.minPY;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar pen = aboverlap;\n\t\t\t\tif(pen < result.pen)\n\t\t\t\t{\n\t\t\t\t\tresult.pen = pen;\n\t\t\t\t\tresult.normal = vec2(0, -1);\n\t\t\t\t\tresult.contactPoint = projA.maxPY;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}", "title": "" }, { "docid": "d5ee449efe8958caef899cb0a4b3577b", "score": "0.5131878", "text": "function maxmin(xpm,ypm){xmax=xmin=xpm[0];ymax=ymin=ypm[0];for(i=1;i<nn;i++){\n if(xpm[i]>xmax){xmax=xpm[i];};if(xpm[i]<xmin){xmin=xpm[i];};\n if(ypm[i]>ymax){ymax=ypm[i];};if(ypm[i]<ymin){ymin=ypm[i];}; }; }", "title": "" }, { "docid": "f35096510a6d75495860a5266630810f", "score": "0.5120006", "text": "function getXDomain(activeInfo) {\n let min = d3.min(activeInfo.data, (d) => d[activeInfo.currentX]);\n let max = d3.max(activeInfo.data, (d) => d[activeInfo.currentX]);\n return [min * 0.8, max * 1.2];\n}", "title": "" }, { "docid": "0a6dd3269c9a2c83e4c598da4d823d14", "score": "0.50972134", "text": "function get_projection(angle, a, zMin, zMax) {\n\tvar ang = Math.tan((angle * .5) * Math.PI / 180);//angle*.5\n\treturn [\n\t\t0.5 / ang, 0, 0, 0,\n\t\t0, 0.5 * a / ang, 0, 0,\n\t\t0, 0, -(zMax + zMin) / (zMax - zMin), -1,\n\t\t0, 0, (-2 * zMax * zMin) / (zMax - zMin), 0];\n}", "title": "" }, { "docid": "109da426c894ef69397cb0809d5d75b9", "score": "0.5060892", "text": "function calculateMinMax(func, domain) {\n var min = func(domain[0]);\n var max = func(domain[0]);\n\n for (var x = domain[0]; x<=domain[1]; x+=settings.delta) {\n var y = func(x);\n\n if (y < min) {\n min = y;\n }\n\n if (y > max) {\n max = y;\n }\n }\n\n return [min, max];\n}", "title": "" }, { "docid": "18e9ede2d018f12f12014fbf894c754d", "score": "0.50369716", "text": "function getMinMax(data) {\n var minY, maxY, minX, maxX;\n minX = minY = Number.POSITIVE_INFINITY, maxX = maxY = Number.NEGATIVE_INFINITY;\n data.forEach(function (d) {\n if (d.values.length) {\n d.values.forEach(function (s) {\n minX = Math.min(minX, s.x);\n maxX = Math.max(maxX, s.x);\n minY = Math.min(minY, s.y);\n maxY = Math.max(maxY, s.y);\n });\n }\n });\n return { minX: minX, minY: minY, maxX: maxX, maxY: maxY}\n}", "title": "" }, { "docid": "306ec6e04b278882517263ce3fdc3227", "score": "0.50180733", "text": "mercatorBounds(projection, maxlat) {\n var yaw = this.projection.rotate()[0];\n var xymax = projection([-yaw + 180 - 1e-6, -maxlat]);\n var xymin = projection([-yaw - 180 + 1e-6, maxlat]);\n\n return [xymin, xymax];\n }", "title": "" }, { "docid": "9fe2c9d162094774434d384d78337191", "score": "0.50017405", "text": "function mercatorBounds(projection, maxlat) {\n let yaw = projection.rotate()[0],\n xymin = projection([-yaw-180+1e-6,-maxlat]),\n xymax = projection([-yaw+180-1e-6,maxlat])\n return [xymin,xymax];\n }", "title": "" }, { "docid": "5d54840709085f710f945f181ba7b6c2", "score": "0.49988645", "text": "function xMinMax() {\n // Select smallest data from column\n xMin = d3.min(theData, function(d) {\n return parseFloat(d[curX]) * 0.90;\n });\n // Select largest data from the column\n xMax = d3.max(theData, function(d) {\n return parseFloat(d[curX]) * 1.10;\n });\n }", "title": "" }, { "docid": "b9cc710008e150b703e6b7d7167cbfa0", "score": "0.49919185", "text": "function xMinMax() {\n\n // min will grab the smallest datum from the selected column.\n xMin = d3.min(theData, function(d) {\n return parseFloat(d[curX]) * 0.90;\n });\n\n // .max will grab the largest datum from the selected column.\n xMax = d3.max(theData, function(d) {\n return parseFloat(d[curX]) * 1.10;\n });\n }", "title": "" }, { "docid": "39a4253af55aa75f3c966762b766258c", "score": "0.49577212", "text": "function xMinMax() {\n xMin = d3.min(theData, function(d) {\n return parseFloat(d[curX]) * 0.98;\n });\n xMax = d3.max(theData, function(d) {\n return parseFloat(d[curX]) * 1.02;\n });\n }", "title": "" }, { "docid": "65a443d6da482fc7edfa0ba57f9d78f2", "score": "0.49436086", "text": "getMidPoint()\n {\n const mx = this.from.x + (this.to.x - this.from.x) / 2;\n const my = this.from.y + (this.to.y - this.from.y) / 2;\n return [mx, my];\n }", "title": "" }, { "docid": "b73ce45d65197b75c8382171879ccfc9", "score": "0.4930746", "text": "function calculateExtent(dataPoints) {\n const xs = []\n const ys = []\n dataPoints.forEach(e => {\n xs.push(e.position[0])\n ys.push(e.position[1])\n })\n if (xs.length && ys.length) {\n let minX = Math.min(...xs)\n let maxX = Math.max(...xs)\n let minY = Math.min(...ys)\n let maxY = Math.max(...ys)\n return { minX, maxX, minY, maxY }\n }\n return undefined\n}", "title": "" }, { "docid": "3013d8242386163f753650efb7f225fe", "score": "0.49267054", "text": "_getWorldCoordVecs () {\n let min = vec3.clone(this.vecMin);\n let max = vec3.clone(this.vecMax);\n\n vec3.transformMat4(min, min, this._body.getModelMatrix());\n vec3.transformMat4(max, max, this._body.getModelMatrix());\n\n return [min, max];\n }", "title": "" }, { "docid": "5b23529e7975fb3bcb61f74976aaf3b4", "score": "0.4924819", "text": "_axisProjections(d) {\n const _this = this;\n const TIMEDIM = this.TIMEDIM;\n const KEY = this.KEY;\n\n if (d != null) {\n\n this.model.marker.getFrame(d[TIMEDIM], values => {\n const valueY = values.axis_y[d[KEY]];\n const valueX = values.axis_x[d[KEY]];\n const valueS = values.size[d[KEY]];\n const radius = utils.areaToRadius(_this.sScale(valueS));\n\n if (!valueY && valueY !== 0 || !valueX && valueX !== 0 || !valueS && valueS !== 0) return;\n\n if (_this.model.ui.chart.whenHovering.showProjectionLineX\n && _this.xScale(valueX) > 0 && _this.xScale(valueX) < _this.width\n && (_this.yScale(valueY) + radius) < _this.height) {\n _this.projectionX\n .style(\"opacity\", 1)\n .attr(\"y2\", _this.yScale(valueY) + radius)\n .attr(\"x1\", _this.xScale(valueX))\n .attr(\"x2\", _this.xScale(valueX));\n }\n\n if (_this.model.ui.chart.whenHovering.showProjectionLineY\n && _this.yScale(valueY) > 0 && _this.yScale(valueY) < _this.height\n && (_this.xScale(valueX) - radius) > 0) {\n _this.projectionY\n .style(\"opacity\", 1)\n .attr(\"y1\", _this.yScale(valueY))\n .attr(\"y2\", _this.yScale(valueY))\n .attr(\"x1\", _this.xScale(valueX) - radius);\n }\n\n if (_this.model.ui.chart.whenHovering.higlightValueX) _this.xAxisEl.call(\n _this.xAxis.highlightValue(valueX)\n );\n\n if (_this.model.ui.chart.whenHovering.higlightValueY) _this.yAxisEl.call(\n _this.yAxis.highlightValue(valueY)\n );\n });\n\n } else {\n\n this.projectionX.style(\"opacity\", 0);\n this.projectionY.style(\"opacity\", 0);\n this.xAxisEl.call(this.xAxis.highlightValue(\"none\"));\n this.yAxisEl.call(this.yAxis.highlightValue(\"none\"));\n\n }\n\n }", "title": "" }, { "docid": "cb0b4360d5aa3612d8b30db9bac7a36c", "score": "0.48982155", "text": "function extent(arr){\n return [min(arr), max(arr)];\n }", "title": "" }, { "docid": "cc0178a08e720d1be5e8d9dbeb840ee2", "score": "0.4890988", "text": "function findYaxisMinMax(series, from, to, currentYaxisMinMax) {\n if (!$.isArray(series)) {\n series = [series];\n }\n // Calculate yaxis min/max between from and to xaxis values\n var yaxisMin;\n var yaxisMax;\n if (currentYaxisMinMax !== undefined) {\n yaxisMin = currentYaxisMinMax.min;\n yaxisMax = currentYaxisMinMax.max;\n }\n\n $.each(series, function (index, serie) {\n $.each(serie.data, function (index, value) {\n // Check for min and max only if value xaxis is between from and to\n if (value[0] > from && value[0] < to && value[1] !== null) {\n // Set initial min/max values\n if (yaxisMin === undefined) {\n yaxisMin = value[1];\n yaxisMax = value[1];\n }\n // Update min and max if current value is a new min or max\n if (value[1] < yaxisMin) {\n yaxisMin = value[1];\n } else if (value[1] > yaxisMax) {\n yaxisMax = value[1];\n }\n }\n });\n });\n\n return {min: yaxisMin, max: yaxisMax};\n}", "title": "" }, { "docid": "a245b50deebd3862feb900e9c2ef6df6", "score": "0.48902038", "text": "getChartDataDomain() {\n const networthData = this.getSelectedNetworthData();\n\n const domain = networthData.reduce(\n (acc, pos) => {\n if (pos.value < acc.min) {\n acc.min = pos.value;\n }\n\n if (pos.value > acc.max) {\n acc.max = pos.value;\n }\n\n return acc;\n },\n {\n min: networthData[0].value,\n max: networthData[0].value\n }\n );\n\n return [Math.floor(domain.min), Math.ceil(domain.max)];\n }", "title": "" }, { "docid": "085a66dfaab0e4cf284501d558d1791f", "score": "0.48735994", "text": "getExtremes() {\n let filledCellCoords = this.getFilledCellCoords();\n\n let rowValues = new Array(filledCellCoords.length);\n let colValues = new Array(filledCellCoords.length);\n\n //let extremes;\n\n // separate row and column values\n for (let i = 0; i < filledCellCoords.length; i++) {\n rowValues[i] = filledCellCoords[i][this.ROW];\n colValues[i] = filledCellCoords[i][this.COL];\n }\n\n return {\n min: [rowValues.min(), colValues.min()],\n max: [rowValues.max(), colValues.max()],\n };\n }", "title": "" }, { "docid": "40885238a983ee34d5bfe38b919519b5", "score": "0.48711252", "text": "function mercatorBounds(projection, maxlat) {\n\t var yaw = projection.rotate()[0],\n\t xymax = projection([-yaw+180-1e-6,-maxlat]),\n\t xymin = projection([-yaw-180+1e-6, maxlat]);\n\t \n\t return [xymin,xymax];\n\t}", "title": "" }, { "docid": "36e777771a4e69ce1cf1b0b07aa26a76", "score": "0.48669216", "text": "function extent(arr){\n return [min(arr), max(arr)];\n}", "title": "" }, { "docid": "7c40fd22500424f55f4c45799cbc458d", "score": "0.4858227", "text": "function _getBoxCenter(box) {\n // eslint-disable-next-line\n switch(box) {\n case 0: return [1,1];\n case 1: return [1,4];\n case 2: return [1,7];\n case 3: return [4,1];\n case 4: return [4,4];\n case 5: return [4,7];\n case 6: return [7,1];\n case 7: return [7,4];\n case 8: return [7,7];\n }\n }", "title": "" }, { "docid": "ca372896ac651d10915cf2dbf2b9e558", "score": "0.4853077", "text": "function findMinAndMax(dataColumnX) {\n xMin = d3.min(jrnlsmData, function(data) {\n return +data[dataColumnX] * 0.8;\n });\n\n xMax = d3.max(jrnlsmData, function(data) {\n return +data[dataColumnX] * 1.1;\n });\n\n yMax = d3.max(jrnlsmData, function(data) {\n return +data.healthcare * 1.1;\n });\n }", "title": "" }, { "docid": "7f4634b5d1d698ff9b5dc5ded33ffbcc", "score": "0.48491815", "text": "getCoordinate(v, rb, or, p) {\n let k = (0,_common__WEBPACK_IMPORTED_MODULE_2__.vTo01)(v, p.min, p.max);\n let result;\n if (or == 'vertical') {\n result = rb.y2 - k * rb.height;\n if (result < rb.y)\n return rb.y;\n if (result > rb.y2)\n return rb.y2;\n }\n else if (or == 'horizontal') {\n result = rb.x + k * rb.width;\n if (result > rb.x2)\n return rb.x2;\n if (result < rb.x)\n return rb.x;\n }\n return result;\n }", "title": "" }, { "docid": "b6c5e64284740d260f96131cd4533b16", "score": "0.48433077", "text": "function extractRange(ranges, coord) {\n var axis, from, to, key, axes = plot.getAxes();\n\n for (var k in axes) {\n axis = axes[k];\n if (axis.direction == coord) {\n key = coord + axis.n + \"axis\";\n if (!ranges[key] && axis.n == 1)\n key = coord + \"axis\"; // support x1axis as xaxis\n if (ranges[key]) {\n from = ranges[key].from;\n to = ranges[key].to;\n break;\n }\n }\n }\n\n // backwards-compat stuff - to be removed in future\n if (!ranges[key]) {\n axis = coord == \"x\" ? plot.getXAxes()[0] : plot.getYAxes()[0];\n from = ranges[coord + \"1\"];\n to = ranges[coord + \"2\"];\n }\n\n // auto-reverse as an added bonus\n if (from != null && to != null && from > to) {\n var tmp = from;\n from = to;\n to = tmp;\n }\n\n return { from: from, to: to, axis: axis };\n }", "title": "" }, { "docid": "d41cd19116828bd83d8e617765bc76b9", "score": "0.48423365", "text": "function getImgCoords(x, y) {\n let coords = {\n x: (x - containerPosTopLeft.left) / scaleX,\n y: (y - containerPosTopLeft.top) / scaleY,\n };\n\n // For debugging and easy collider point creation\n console.log(\"Inside viewport / x: \" + coords.x + \"p y: \" + coords.y);\n\n return coords;\n}", "title": "" }, { "docid": "68f099667b471507b95c631470c1d2eb", "score": "0.48394012", "text": "function extractRange(ranges, coord) {\n var axis, from, to, key, axes = plot.getAxes();\n\n for (var k in axes) {\n axis = axes[k];\n if (axis.direction == coord) {\n key = coord + axis.n + 'axis';\n if (!ranges[key] && axis.n == 1)\n key = coord + 'axis'; // support x1axis as xaxis\n if (ranges[key]) {\n from = ranges[key].from;\n to = ranges[key].to;\n break;\n }\n }\n }\n\n // backwards-compat stuff - to be removed in future\n if (!ranges[key]) {\n axis = coord == 'x' ? plot.getXAxes()[0] : plot.getYAxes()[0];\n from = ranges[coord + '1'];\n to = ranges[coord + '2'];\n }\n\n // auto-reverse as an added bonus\n if (from !== null && to !== null && from > to) {\n var tmp = from;\n from = to;\n to = tmp;\n }\n\n return {from: from, to: to, axis: axis};\n }", "title": "" }, { "docid": "8542f9305636d02a021fa85b9bd6f5f5", "score": "0.48319587", "text": "function project(value, fromMin, fromSize, toMin, toSize) {\n if (fromSize === 0 || toSize === 0) {\n if (fromMin <= value && value <= fromMin + fromSize) {\n return toMin;\n }\n else {\n return NaN;\n }\n }\n var relativeX = (value - fromMin) / fromSize;\n var projectedX = toMin + relativeX * toSize;\n return projectedX;\n }", "title": "" }, { "docid": "8542f9305636d02a021fa85b9bd6f5f5", "score": "0.48319587", "text": "function project(value, fromMin, fromSize, toMin, toSize) {\n if (fromSize === 0 || toSize === 0) {\n if (fromMin <= value && value <= fromMin + fromSize) {\n return toMin;\n }\n else {\n return NaN;\n }\n }\n var relativeX = (value - fromMin) / fromSize;\n var projectedX = toMin + relativeX * toSize;\n return projectedX;\n }", "title": "" }, { "docid": "8542f9305636d02a021fa85b9bd6f5f5", "score": "0.48319587", "text": "function project(value, fromMin, fromSize, toMin, toSize) {\n if (fromSize === 0 || toSize === 0) {\n if (fromMin <= value && value <= fromMin + fromSize) {\n return toMin;\n }\n else {\n return NaN;\n }\n }\n var relativeX = (value - fromMin) / fromSize;\n var projectedX = toMin + relativeX * toSize;\n return projectedX;\n }", "title": "" }, { "docid": "ed1866d19b0522a464fd4182f61887b1", "score": "0.48294243", "text": "function viewBoxCoords(x, y){\n var viewPortWidth = service.paper.node.width.baseVal.value, viewPortHeight = service.paper.node.height.baseVal.value,\n viewBox = service.paper.attr('viewBox');\n if(viewPortWidth<viewBox.width){\n service.drawing.ratio = viewBox.width / viewPortWidth;\n }\n if(viewPortHeight<viewBox.height){\n service.drawing.vratio = viewBox.height / viewPortHeight;\n }\n var ratio = service.drawing.ratio, vratio = service.drawing.vratio;\n var vy = y*ratio-(viewPortHeight- viewBox.height/ratio)*2, vx = x*ratio;\n return {\n ratio: ratio, vx: Math.round(vx), vy: Math.round(vy), fsize: viewPortWidth/20,\n inside: vy>=0&&vy<=viewBox.height && vx>=0&&vx<=viewBox.width\n };\n }", "title": "" }, { "docid": "1b6ebb7cbbe3c4e2ca67b24b366a99e4", "score": "0.48255607", "text": "_getDomainFromData(props, axis) {\n // if a sensible string map exists, return the minimum and maximum values\n // offset by the bar offset value\n if (this.stringMap[axis] !== null) {\n const mapValues = _.values(this.stringMap[axis]);\n return [_.min(mapValues), _.max(mapValues)];\n } else {\n // find the global min and max\n const allData = _.flatten(_.pluck(this.datasets, \"data\"));\n const min = _.min(_.pluck(allData, axis));\n const max = _.max(_.pluck(allData, axis));\n // find the cumulative max for stacked chart types\n // this is only sensible for the y domain\n // TODO check assumption\n const cumulativeMax = (props.stacked && axis === \"y\" && this.datasets.length > 1) ?\n _.reduce(this.datasets, (memo, dataset) => {\n const localMax = (_.max(_.pluck(dataset.data, \"y\")));\n return localMax > 0 ? memo + localMax : memo;\n }, 0) : -Infinity;\n const cumulativeMin = (props.stacked && axis === \"y\" && this.datasets.length > 1) ?\n _.reduce(this.datasets, (memo, dataset) => {\n const localMin = (_.min(_.pluck(dataset.data, \"y\")));\n return localMin < 0 ? memo + localMin : memo;\n }, 0) : Infinity;\n return [_.min([min, cumulativeMin]), _.max([max, cumulativeMax])];\n }\n }", "title": "" }, { "docid": "9e70e04b0e05ee22cf2242e8e105ac70", "score": "0.482358", "text": "function extractRange(ranges, coord) {\n var axis, from, to, key, axes = plot.getAxes();\n\n for (var k in axes) {\n axis = axes[k];\n if (axis.direction == coord) {\n key = coord + axis.n + \"axis\";\n if (!ranges[key] && axis.n == 1)\n key = coord + \"axis\"; // support x1axis as xaxis\n if (ranges[key]) {\n from = ranges[key].from;\n to = ranges[key].to;\n break;\n }\n }\n }\n\n // backwards-compat stuff - to be removed in future\n if (!ranges[key]) {\n axis = coord == \"x\" ? plot.getXAxes()[0] : plot.getYAxes()[0];\n from = ranges[coord + \"1\"];\n to = ranges[coord + \"2\"];\n }\n\n // auto-reverse as an added bonus\n if (from != null && to != null && from > to) {\n var tmp = from;\n from = to;\n to = tmp;\n }\n \n return { from: from, to: to, axis: axis };\n }", "title": "" }, { "docid": "58c85570a89ade2cf67743a74237791f", "score": "0.48174262", "text": "function mapminmax_apply(x,settings){\n\t\ty = [];\n\t\tfor(var i=0;i<x.length;i++){\n\t\t\ty.push([])\n\t\t\tfor(var j=0;j<settings.xoffset.length;j++){\n\t\t\t\ty[i].push((x[i][j]-settings.xoffset[j])*settings.gain[j]+settings.ymin);\n\t\t\t}\n\t\t}\n\t\treturn y;\n\t}", "title": "" }, { "docid": "1dfb4454ab63789dd13b5c85d8581428", "score": "0.48137814", "text": "_calculateIdealDomain() {\n const metricMin = this.roundToPretty(this._selectedDatasetSum / nTileDomain[0])\n const metricMax = this.roundToPretty(this._selectedDatasetSum / nTileDomain[1])\n return [metricMax, metricMin]\n }", "title": "" }, { "docid": "96ea88c311f83bfb908bcd43f46f6470", "score": "0.4810843", "text": "function getDomain(data, field) {\n return [d3.min(data, function(d) { return d[field] }),\n d3.max(data, function(d) { return d[field] })];\n}", "title": "" }, { "docid": "170e80a61ddfd512dd9ad3a71d296834", "score": "0.4807873", "text": "get_points_axis(axis, direction) {\n\t\tlet func;\n\n\t\tif (!axis && !direction)\n\t\t\tfunc = p => p.x > 0;\n\t\telse if (!axis && direction)\n\t\t\tfunc = p => p.x < 0;\n\t\telse if (!direction)\n\t\t\tfunc = p => p.y > 0;\n\t\telse\n\t\t\tfunc = p => p.y < 0;\n\n\t\treturn this.arr.filter(func);\n\t}", "title": "" }, { "docid": "98419fa1a4cd8c0b7c9be0013a025c16", "score": "0.47998515", "text": "function rebaseAxisConstraints(layout, constraints) {\n var relativeConstraints = {};\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min;\n }\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min;\n }\n return relativeConstraints;\n}", "title": "" }, { "docid": "98419fa1a4cd8c0b7c9be0013a025c16", "score": "0.47998515", "text": "function rebaseAxisConstraints(layout, constraints) {\n var relativeConstraints = {};\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min;\n }\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min;\n }\n return relativeConstraints;\n}", "title": "" }, { "docid": "1c42d4e5be0bd5a265154d4918697b48", "score": "0.4798259", "text": "function getXScaleForAxis(data, currentXAxis) {\n\n var xmin = d3.min(data, d => d[currentXAxis]);\n var xmax = d3.max(data, d => d[currentXAxis]);\n\n // Adjust the min and max\n if (currentXAxis == 'income') {\n xmin = xmin - 4000;\n xmax = xmax + 5000;\n } else {\n xmin = xmin - 2;\n xmax = xmax + 2;\n }\n\n // create scales\n var xScale = d3.scaleLinear()\n //.domain(d3.extent(data, d => d[currentXAxis]))\n .domain([xmin, xmax])\n .range([0, chartWidth]);\n \n return xScale;\n}", "title": "" }, { "docid": "1ad83c51223ca9f4e4ce1d62b496d646", "score": "0.4796402", "text": "function findMinMaxXY(dataColumnX, dataColumnY) {\n xMin = d3.min(eruptions, function(d) {\n return(+d[dataColumnX])\n });\n xMax = d3.max(eruptions, function(d) {\n return(+d[dataColumnX])\n });\n\n yMin = d3.min(eruptions, function(d) {\n return (+d[dataColumnY]) \n });\n yMax = d3.max(eruptions, function(d) {\n return (+d[dataColumnY])\n });\n }", "title": "" }, { "docid": "4e4852a838ad5f2f3471b6f365ee1d35", "score": "0.4782521", "text": "function svgCoordsToLogicalCoords([ x, y ]) {\n return [ x / 100, -y / 100 ];\n}", "title": "" }, { "docid": "a63bd1d192aa65516fb26d7cd73ee51b", "score": "0.47737473", "text": "function minPositionAllOperators() {\n var nodes = $('#editorContent').find('.operator, .dataset');\n\n var xValues = nodes.map(function () {\n var position = $(this).position();\n return position.left;\n });\n\n var yValues = nodes.map(function () {\n var position = $(this).position();\n return position.top;\n });\n\n xValues.push(0);\n yValues.push(0);\n var minX = Math.min.apply(null, xValues);\n var minY = Math.min.apply(null, yValues);\n console.log(minX + ', ' + minY);\n return [minX, minY];\n}", "title": "" }, { "docid": "8f973fb7618167901935ed3ad4624767", "score": "0.47583446", "text": "function xMinMax() {\n xMin = d3.min(theData, function(d) {\n return parseFloat(d[currentX]) * 0.90;\n });\n\n xMax = d3.max(theData, function(d) {\n return parseFloat(d[currentX]) * 1.10;\n });\n }", "title": "" }, { "docid": "642e8703847c46774ff05aac67b05ace", "score": "0.4752813", "text": "function getYDomain(activeInfo) {\n let min = 0; //d3.min(activeInfo.data, d => d[activeInfo.currentY])\n let max = d3.max(activeInfo.data, (d) => d[activeInfo.currentY]);\n return [min, max];\n}", "title": "" }, { "docid": "31c43f0889969f17c1c844c511e05105", "score": "0.47500408", "text": "function bounds() {\n var minX = 1000000;\n var maxX = -1000000;\n var minY = 1000000;\n var maxY = -1000000;\n nodes.forEach(function(thisnode) {\n if ((thisnode.x-thisnode.r)<minX) {minX=(thisnode.x-thisnode.r); minXnode=thisnode.index;}\n if ((thisnode.x+thisnode.r)>maxX) {maxX=(thisnode.x+thisnode.r); maxXnode=thisnode.index;}\n if ((thisnode.y-thisnode.r)<minY) {minY=(thisnode.y-thisnode.r); minYnode=thisnode.index;}\n if ((thisnode.y+thisnode.r)>maxY) {maxY=(thisnode.y+thisnode.r); maxYnode=thisnode.index;}\n });\n minX=Math.floor(minX);\n maxX=Math.ceil(maxX);\n minY=Math.floor(minY);\n maxY=Math.ceil(maxY);\n return {minX, maxX, minY, maxY, minXnode, maxXnode, minYnode, maxYnode};\n}", "title": "" }, { "docid": "78fa9d1def18f0f94fe3f2130d8af0ec", "score": "0.47493902", "text": "function chain(axis) {\r\n\t// Minor values to the original coordinates\r\n\tlet chain = [];\r\n\tfor(i = axis + 1; i <= 8; i++) {\r\n\t\tchain.push(i);\r\n\t}\r\n\t// Mayor values to the original coordinates\r\n\tfor(j = axis - 1; j > 0; j--) {\r\n\t\tchain.unshift(j);\r\n\t}\r\n\t// Retur an array with the possible values along the axis\r\n\treturn chain;\r\n}", "title": "" }, { "docid": "95834c688999ea81902a8fff5aa44f1e", "score": "0.47363812", "text": "get_min_max(voronoi_viz) {\n //finds min/max from the *selected* setting \n //(can be speed deviation, current speed, normal speed)\n let findMax = (ma, v) => Math.max(ma, v.selected)\n let findMin = (mi, v) => Math.min(mi, v.selected)\n\n let max = voronoi_viz.site_db.all.reduce(findMax, -Infinity)\n let min = voronoi_viz.site_db.all.reduce(findMin, Infinity)\n\n //we used placeholder value during development\n //to privide higher color differences\n\n return {\n \"min\": min, //-5\n \"max\": max //10\n };\n }", "title": "" }, { "docid": "9a783d9679853902cf09bf324ed6ea2c", "score": "0.4734841", "text": "checkBoundaries(axis){\n switch(axis){\n case 'x':\n if (this[axis] < limits.left)\n this[axis] = limits.left;\n else if (this[axis] > limits.right)\n this[axis] = limits.right;\n break;\n case 'y':\n if (this[axis] < limits.top)\n this[axis] = limits.top;\n else if(this[axis] > limits.bottom)\n this[axis] = limits.bottom;\n break;\n }\n }", "title": "" }, { "docid": "5679d6e206e3098c8d6bee09df52e06b", "score": "0.4733398", "text": "function calcSVGTransformOrigin(dimensions, originX, originY) {\n var pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);\n var pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);\n return pxOriginX + \" \" + pxOriginY;\n}", "title": "" }, { "docid": "7256fdaa0c23af0f578498d2bc4fed68", "score": "0.47316232", "text": "function retrVals() {\n var coOrds = {};\n coOrds.x = Number(document.getElementById(\"x\").value);\n coOrds.y = Number(document.getElementById(\"y\").value);\n coOrds.z = Number(document.getElementById(\"z\").value);\n var check = document.getElementById(\"zAxis\").checked;\n if (check) {\n var min = Math.min(coOrds.x,coOrds.y,coOrds.z);\n var temp = coOrds.z;\n if (min !== coOrds.z) {\n if (min === coOrds.x) {\n coOrds.z = coOrds.x\n coOrds.x = temp\n return [coOrds.x,coOrds.y,coOrds.z]\n }\n else {\n coOrds.z = coOrds.y\n coOrds.y = temp\n return [coOrds.x,coOrds.y,coOrds.z]\n }\n }\n else {\n return [coOrds.x,coOrds.y,coOrds.z]\n }\n return [coOrds.x,coOrds.y,coOrds.z]\n }\n else {\n return [coOrds.x,coOrds.y,coOrds.z]\n }\n}", "title": "" }, { "docid": "e48fa09647e4336ce423e0c2bc92ccf6", "score": "0.47246665", "text": "function setupBounds() {\n\t\tif (this._mesh) {\n\t\t\tvar material = this._mesh.material,\n\t\t\t\tboxes = this._boxes,\n\t\t\t\tminParam = material.uniforms.minXYZ,\n\t\t\t\tmaxParam = material.uniforms.maxXYZ;\n\n\t\t\tminParam._array = new Float32Array(3 * boxes.length);\n\t\t\tmaxParam._array = new Float32Array(3 * boxes.length);\n\n\t\t\tfor (var i = 0, il = boxes.length; i < il; ++i) {\n\t\t\t\tvar box = boxes[i];\n\n\t\t\t\tminParam.value[i] = box.min;\n\t\t\t\tmaxParam.value[i] = box.max;\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "6b609cbefe542f8b999fac89fe6c92b2", "score": "0.4722021", "text": "getMinBox() {\n //get coordinates \n var coorX = this.coords.map(function (p) {\n return p.x\n });\n var coorY = this.coords.map(function (p) {\n return p.y\n });\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //get the longest side of box\n var length = Math.max((max_coords.x - min_coords.x), (max_coords.y - min_coords.y))\n\n //get the center\n var min_coords_square = {\n x: min_coords.x + ((max_coords.x - min_coords.x) / 2.0) - (length / 2.0) - 5,\n y: min_coords.y + ((max_coords.y - min_coords.y) / 2.0) - (length / 2.0) - 5\n }\n\n var max_coords_square = {\n x: min_coords.x + ((max_coords.x - min_coords.x) / 2.0) + (length / 2.0) + 5,\n y: min_coords.y + ((max_coords.y - min_coords.y) / 2.0) + (length / 2.0) + 5\n }\n\n //return as struct \n return {\n min: min_coords_square,\n max: max_coords_square\n }\n }", "title": "" }, { "docid": "cd1a45508e6c39c2815969438e86e5d3", "score": "0.47166896", "text": "function x_coord(x){\r\n\tif (x > x_max())\r\n\t\treturn x_max();\r\n\telse\r\n\t\treturn x_origin()+x;\r\n}", "title": "" }, { "docid": "aa92248762efb82a8198c75d3d442216", "score": "0.47143102", "text": "function calcSVGTransformOrigin(dimensions, originX, originY) {\n var pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);\n var pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);\n return pxOriginX + \" \" + pxOriginY;\n}", "title": "" }, { "docid": "76946989cf50ec75a704ea5c1be992f7", "score": "0.4711475", "text": "function convertToRelativeProjection(visualElement, isLayoutDrag) {\n if (isLayoutDrag === void 0) { isLayoutDrag = true; }\n var projectionParent = visualElement.getProjectionParent();\n if (!projectionParent)\n return false;\n var offset;\n if (isLayoutDrag) {\n offset = calcRelativeOffset(projectionParent.projection.target, visualElement.projection.target);\n removeBoxTransforms(offset, projectionParent.getLatestValues());\n }\n else {\n offset = calcRelativeOffset(projectionParent.getLayoutState().layout, visualElement.getLayoutState().layout);\n }\n eachAxis(function (axis) {\n return visualElement.setProjectionTargetAxis(axis, offset[axis].min, offset[axis].max, true);\n });\n return true;\n}", "title": "" }, { "docid": "bb204dfede50e54970fbaa7cb3074ebb", "score": "0.47064692", "text": "getMaxScaleToFit(limit, origin = this.center) {\n const rect = Rectangle.clone(limit);\n const ox = origin.x;\n const oy = origin.y;\n // Find the maximal possible scale for all corners, so when the scale\n // is applied the point is still inside the rectangle.\n let sx1 = Infinity;\n let sx2 = Infinity;\n let sx3 = Infinity;\n let sx4 = Infinity;\n let sy1 = Infinity;\n let sy2 = Infinity;\n let sy3 = Infinity;\n let sy4 = Infinity;\n // Top Left\n const p1 = rect.topLeft;\n if (p1.x < ox) {\n sx1 = (this.x - ox) / (p1.x - ox);\n }\n if (p1.y < oy) {\n sy1 = (this.y - oy) / (p1.y - oy);\n }\n // Bottom Right\n const p2 = rect.bottomRight;\n if (p2.x > ox) {\n sx2 = (this.x + this.width - ox) / (p2.x - ox);\n }\n if (p2.y > oy) {\n sy2 = (this.y + this.height - oy) / (p2.y - oy);\n }\n // Top Right\n const p3 = rect.topRight;\n if (p3.x > ox) {\n sx3 = (this.x + this.width - ox) / (p3.x - ox);\n }\n if (p3.y < oy) {\n sy3 = (this.y - oy) / (p3.y - oy);\n }\n // Bottom Left\n const p4 = rect.bottomLeft;\n if (p4.x < ox) {\n sx4 = (this.x - ox) / (p4.x - ox);\n }\n if (p4.y > oy) {\n sy4 = (this.y + this.height - oy) / (p4.y - oy);\n }\n return {\n sx: Math.min(sx1, sx2, sx3, sx4),\n sy: Math.min(sy1, sy2, sy3, sy4),\n };\n }", "title": "" }, { "docid": "be1c9459f3952c3b98932c1860abaa4b", "score": "0.46995187", "text": "function extractRange(ranges, coord) {\n var axis, from, to, axes, key;\n\n axes = plot.getUsedAxes();\n for (i = 0; i < axes.length; ++i) {\n axis = axes[i];\n if (axis.direction == coord) {\n key = coord + axis.n + \"axis\";\n if (!ranges[key] && axis.n == 1)\n key = coord + \"axis\"; // support x1axis as xaxis\n if (ranges[key]) {\n from = ranges[key].from;\n to = ranges[key].to;\n break;\n }\n }\n }\n\n // backwards-compat stuff - to be removed in future\n if (!ranges[key]) {\n axis = coord == \"x\" ? plot.getXAxes()[0] : plot.getYAxes()[0];\n from = ranges[coord + \"1\"];\n to = ranges[coord + \"2\"];\n }\n\n // auto-reverse as an added bonus\n if (from != null && to != null && from > to) {\n var tmp = from;\n from = to;\n to = tmp;\n }\n \n return { from: from, to: to, axis: axis };\n }", "title": "" }, { "docid": "56ff7467b6ec8af9c1bc42688624f4c7", "score": "0.46952832", "text": "findCoord(x, y) {\n var xEst = Math.floor(x * 10 / this.boxsize) / 10; var yEst = Math.floor(y * 10 / this.boxsize) / 10;\n var xPred = this.boxsize * Math.round(xEst); var yPred = this.boxsize * Math.round(yEst);\n var xDist = x - xPred; var yDist = y - yPred;\n var distance = Math.sqrt(xDist * xDist + yDist * yDist);\n \n if (distance <= this.boxsize/2) {\n console.log(xPred, yPred);\n return [xPred, yPred]; \n }\n else { return null }\n }", "title": "" }, { "docid": "b68dbe5bf7dea4e2e18fb1766ceea2e0", "score": "0.4664129", "text": "function getMinMaxValues(vertices, planetSize) {\r\n var maxValue = Number.MIN_VALUE;\r\n var minValue = Number.MAX_VALUE;\r\n for (var i = 0; i < vertices.length; i++) {\r\n var vertex = vertices[i];\r\n var value = getNoiseValue(vertex, planetSize/2);\r\n maxValue = Math.max(maxValue, value);\r\n minValue = Math.min(minValue, value);\r\n }\r\n return { minValue, maxValue };\r\n}", "title": "" }, { "docid": "d0f0664be7ec7ada2c798959e1c0ab75", "score": "0.46561706", "text": "GetLocalField(a,b) {\n let i = a - 1 > 0 ? a - 1 : 0;\n let j = b - 1 > 0 ? b - 1 : 0;\n let bottom = a + 1 < this.field.length ? a + 1 : this.field.length - 1;\n let right = b + 1 < this.field[a].length ? b + 1 : this.field[a].length - 1;\n let fieldAxis = {\n i: i,\n j: j,\n bottom: bottom,\n right: right\n };\n return fieldAxis;\n }", "title": "" } ]
1c83051672999eb1716f0e16a9d9cb5d
Get nearest anchors for a vector
[ { "docid": "41809b5971a9b33673ea5ee7534aff74", "score": "0.78924227", "text": "function nearestAnchorVec(vec) {\n return nearestAnchor({_x : vec[0], _y : vec[1]});\n }", "title": "" } ]
[ { "docid": "da93a6e8818ac1d17a43bf5f4776fb85", "score": "0.66218716", "text": "function nearestAnchor(ev) { \n var evvec = [ev._x, ev._y],\n tool = this.tool;\n\n if(!tool.started) this.render();\n var closest = this.grid.getClosest(evvec),\n cl = closest ? closest.length : 0,\n dists = [];\n \n while(cl--) {\n if(closest[cl][3] != 'anchor') continue;\n var dist = Vector.distSqrt(closest[cl], evvec);\n dists.push([dist, closest[cl]]);\n }\n \n var nearest = dists.sort(function(a,b){ return a[0] -b[0];})[0];\n \n return nearest;\n }", "title": "" }, { "docid": "665c615a99cc0489d828e8cd529c69d7", "score": "0.62212825", "text": "function bisectVectors(v1, v2) {\n lv1 = vector2Length(v1);\n lv2 = vector2Length(v2);\n return Math.atan2(lv2*v1.y + lv1*v2.y, lv2*v1.x + lv1*v2.x);\n}", "title": "" }, { "docid": "7ac7854cd14797ff095de14b5b6c3564", "score": "0.6096649", "text": "function closest (a, b, p) {\n const ap = { x: p.x - a.x, y: p.y - a.y }\n const ab = { x: b.x - a.x, y: b.y - a.y }\n let t = (ap.x * ab.x + ap.y * ab.y) / (ab.x * ab.x + ab.y * ab.y)\n t = t < 0.0 ? 0.0 : t > 1.0 ? 1.0 : t\n return { x: a.x + t * ab.x, y: a.y + t * ab.y }\n }", "title": "" }, { "docid": "32a5d88bef184bdb877e592d2303a9b7", "score": "0.601498", "text": "function closest(a, b, p) {\n const ap = {x: p.x - a.x, y: p.y - a.y};\n const ab = {x: b.x - a.x, y: b.y - a.y};\n let t = (ap.x * ab.x + ap.y * ab.y) / (ab.x * ab.x + ab.y * ab.y);\n t = t < 0.0 ? 0.0 : t > 1.0 ? 1.0 : t;\n return {x: a.x + t * ab.x, y: a.y + t * ab.y};\n}", "title": "" }, { "docid": "a5e2565dbe0308c1a48a9d543bf3fc61", "score": "0.5971144", "text": "getAnchor(x, y) {\r\n for (let v in this.nodi) {\r\n for(let u in this.nodi[v].vicini) {\r\n\r\n let ancora = this.nodi[v].vicini[u].ancora;\r\n let r = 5;\r\n\r\n if(\r\n x >= ancora.x - r &&\r\n x <= ancora.x + r &&\r\n y >= ancora.y - r &&\r\n y <= ancora.y + r\r\n ) {\r\n return ancora;\r\n }\r\n }\r\n }\r\n }", "title": "" }, { "docid": "c462363b2bc1fce2a9cb3bb0a6e5190a", "score": "0.58086026", "text": "getClosest(p) {\n\t\t// Figure out what we're hovering over\n\t\tlet minD = 100\n\t\tlet closest = undefined\n\n\t\tthis.individuals.forEach((ind,index) => {\n\t\t\tlet d = Vector.getDistance(ind.center, p)\n\t\t\tif (d < minD) { \n\t\t\t\tclosest = index\n\t\t\t\tminD = d\n\t\t\t}\n\t\t})\n\t\treturn closest\n\t}", "title": "" }, { "docid": "d323b34b38f411403f36492de2ec0e2d", "score": "0.5723984", "text": "function closestIntersection(intersections) {\n let closestIntersection = Infinity\n\n intersections.forEach((coordinate) => {\n let distance = Math.abs(coordinate.x) + Math.abs(coordinate.y)\n\n if (distance < closestIntersection && distance > 0) {\n closestIntersection = distance\n }\n })\n return closestIntersection\n}", "title": "" }, { "docid": "717325cb48851f347806266eda337840", "score": "0.57220066", "text": "function closestPoint0d(a, x, result) {\n var d = 0.0;\n for(var i=0; i<x.length; ++i) {\n result[i] = a[i];\n var t = a[i] - x[i];\n d += t * t;\n }\n return d;\n}", "title": "" }, { "docid": "1e88b12ba3e1f27e49383ba4964bc61e", "score": "0.57091784", "text": "function nearestCentroid(element, centroids) {\n var minCentIndex = 0 // Index of the nearest centroid\n var minDist = vectorDist(centroids[minCentIndex], element) // Distance from nearest centroid\n\n for (var i = 1; i < centroids.length; i++) {\n var dist = vectorDist(centroids[i], element)\n if (dist < minDist) {\n minDist = dist\n minCentIndex = i\n }\n }\n\n return minCentIndex\n}", "title": "" }, { "docid": "83ee011ba1ecc4c16f8730ca4e1b826b", "score": "0.56662667", "text": "function getVectorIndex(sequence, vector, eps) {\n\tvar isfind = -1;\n\tfor (var i=0; i<sequence.length; i++){\n\t\tvecCurr = sequence[i];\n\t\tif (Math.abs(vecCurr.x-vector.x)<eps &&\n\t \tMath.abs(vecCurr.y-vector.y)<eps && \n\t\tMath.abs(vecCurr.z-vector.z)<eps){\n\t\t\tisfind=1;\t\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn isfind*i;\n}", "title": "" }, { "docid": "8c24d200be84d781c1add4a7624de340", "score": "0.5658622", "text": "findClosest(inputArray)//takes array of controlPoint objects\r\n {\r\n this.lowestDif = 50000;\r\n this.lowestID = null;\r\n for(let i=0; i<inputArray.length; i++)\r\n {\r\n this.inputPos = inputArray[i].pos;\r\n\r\n this.xDif = abs(this.inputPos.x - this.pos.x);\r\n\r\n this.yDif = abs(this.inputPos.y - this.pos.y);\r\n this.totalDif = (createVector(this.xDif,this.yDif)).mag();\r\n console.log(this.totalDif);\r\n if(this.totalDif<this.lowestDif && this.totalDif != 0)\r\n {\r\n //console.log(this.xDif);\r\n this.lowestDif=this.totalDif;\r\n this.lowestID = i;\r\n }\r\n else\r\n {\r\n }\r\n }\r\n return this.lowestID;\r\n }", "title": "" }, { "docid": "41f939f5c35622fa06d088c026ded545", "score": "0.56229925", "text": "static getClosestPointToRefPoint(basis, ref) {\n return (basis.map(x => {\n return {\n dist: this.eukDist(x, ref),\n p: x\n };\n })).sort((a, b) => {\n if (a.dist > b.dist)\n return 1;\n else if (a.dist < b.dist)\n return -1;\n return 0;\n })[0];\n }", "title": "" }, { "docid": "c9c3dd6df7cfefd0cdf31ba5ee17910a", "score": "0.56137997", "text": "function inclination(vector) {\n\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }", "title": "" }, { "docid": "eb42667379cb215fedb8526036af8ed1", "score": "0.558767", "text": "getClosestFoodVector() {\n\t\tvar closestFood = closestFoodTo(this.x, this.y);\n\n\t\treturn utils.normaliseVector({x: closestFood.x - this.x, y: closestFood.y - this.y});\n\t}", "title": "" }, { "docid": "4ef6d1fab43dfe0e8345a69d0761f72d", "score": "0.55611664", "text": "neighbourAlongVector (direction) {\n const posOfNeighbour = this.absolutePos.clone().add(direction.clone().setLength(getGrid().fieldDiameter))\n return this.plate.fieldAtAbsolutePos(posOfNeighbour)\n }", "title": "" }, { "docid": "144a977f8d5ca2d126a009c6e0d3118e", "score": "0.55392647", "text": "function closest(values, referenceValue) {\n return values.reduce(function (prev, curr) {\n return Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev;\n });\n }", "title": "" }, { "docid": "73c53fad43858c55776c17c8b5be8cfe", "score": "0.5526984", "text": "function inclination(vector) {\n\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }", "title": "" }, { "docid": "74a05b82bcffffbe435abf64ad0d1d93", "score": "0.5524747", "text": "function closest(values, referenceValue) {\n return values.reduce(function (prev, curr) {\n return (Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev);\n });\n}", "title": "" }, { "docid": "74a05b82bcffffbe435abf64ad0d1d93", "score": "0.5524747", "text": "function closest(values, referenceValue) {\n return values.reduce(function (prev, curr) {\n return (Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev);\n });\n}", "title": "" }, { "docid": "74a05b82bcffffbe435abf64ad0d1d93", "score": "0.5524747", "text": "function closest(values, referenceValue) {\n return values.reduce(function (prev, curr) {\n return (Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev);\n });\n}", "title": "" }, { "docid": "74a05b82bcffffbe435abf64ad0d1d93", "score": "0.5524747", "text": "function closest(values, referenceValue) {\n return values.reduce(function (prev, curr) {\n return (Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev);\n });\n}", "title": "" }, { "docid": "a495d21dc3e7d4c3dd8fea9f0a24d60b", "score": "0.55124605", "text": "function inclination(vector) {\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }", "title": "" }, { "docid": "eb0101d47150aba0b69536d606c59dea", "score": "0.5508969", "text": "function inclination(vector) {\n\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n\n }", "title": "" }, { "docid": "a85919f281e2e858b8e32fa38fae2150", "score": "0.5479976", "text": "function optimizeAnchors(positions) {\n return positions.map((position, index) => {\n const others = positions.slice();\n others.splice(index, 1);\n const othersBearing = getBearingFromOtherPoints(position, others);\n return {\n lngLat: position.lngLat,\n anchor: getAnchor(position, othersBearing),\n };\n });\n}", "title": "" }, { "docid": "7fd79f2e11658be6c5a3ee9f2cd8cc86", "score": "0.54677194", "text": "function findAnchorPoint2(shp, arcs) {\n var maxPath = geom.getMaxPath(shp, arcs);\n var pathBounds = arcs.getSimpleShapeBounds(maxPath);\n var centroid = geom.getPathCentroid(maxPath, arcs);\n var weight = getPointWeightingFunction(centroid, pathBounds);\n var area = geom.getPlanarPathArea(maxPath, arcs);\n var hrange, lbound, rbound, focus, htics, hstep, p, p2;\n\n // Limit test area if shape is simple and squarish\n if (shp.length == 1 && area * 1.2 > pathBounds.area()) {\n htics = 5;\n focus = 0.2;\n } else if (shp.length == 1 && area * 1.7 > pathBounds.area()) {\n htics = 7;\n focus = 0.4;\n } else {\n htics = 11;\n focus = 0.5;\n }\n hrange = pathBounds.width() * focus;\n lbound = centroid.x - hrange / 2;\n rbound = lbound + hrange;\n hstep = hrange / htics;\n\n // Find a best-fit point\n p = probeForBestAnchorPoint(shp, arcs, lbound, rbound, htics, weight);\n if (!p) {\n verbose(\"[points inner] failed, falling back to centroid\");\n p = centroid;\n } else {\n // Look for even better fit close to best-fit point\n p2 = probeForBestAnchorPoint(shp, arcs, p.x - hstep / 2,\n p.x + hstep / 2, 2, weight);\n if (p2.distance > p.distance) {\n p = p2;\n }\n }\n return p;\n}", "title": "" }, { "docid": "8f3442efe52d6d7aba3416b7ac50c322", "score": "0.5447526", "text": "closestAngle(angle) {\n let neighbors = this.adjacentCorners();\n let delta = 999999;\n let closestAngle = 0;\n let point = new Vector2();\n for (let i = 0; i < neighbors.length; i++) {\n let wall = this.wallToOrFrom(neighbors[i]);\n if (wall.wallType === WallTypes.CURVED) {\n continue;\n }\n let neighbourAngle = neighbors[i].location.clone().sub(this.location).angle();\n neighbourAngle = (neighbourAngle * 180) / Math.PI;\n let diff = Math.abs(angle - neighbourAngle);\n if (diff < delta) {\n delta = diff;\n point.x = neighbors[i].location.x;\n point.y = neighbors[i].location.y;\n closestAngle = neighbourAngle;\n }\n }\n return { angle: closestAngle, point: point };\n }", "title": "" }, { "docid": "9d4b25154cb94ef485874f9638e90ffd", "score": "0.5431785", "text": "function findMatch(x, start, step) {\n var a = x[0], b = x[step], c = x[2*step]\n var n = x.length\n var best_d = 8\n var best_i = start\n for(var i=start; i<n-2*step; ++i) {\n var s = x[i]-a, t = x[i+step]-b, u=x[i+2*step]-c\n var d = s*s + t*t + u*u\n if( d < best_d ) {\n best_d = d\n best_i = i\n }\n }\n return best_i\n}", "title": "" }, { "docid": "9d4b25154cb94ef485874f9638e90ffd", "score": "0.5431785", "text": "function findMatch(x, start, step) {\n var a = x[0], b = x[step], c = x[2*step]\n var n = x.length\n var best_d = 8\n var best_i = start\n for(var i=start; i<n-2*step; ++i) {\n var s = x[i]-a, t = x[i+step]-b, u=x[i+2*step]-c\n var d = s*s + t*t + u*u\n if( d < best_d ) {\n best_d = d\n best_i = i\n }\n }\n return best_i\n}", "title": "" }, { "docid": "5a13d07cf2991e1b03a3130073dd77e4", "score": "0.54268605", "text": "align(vehicles) {\r\n let alignment_direction = createVector();\r\n let total_neighbours = 0;\r\n for (let other of vehicles) {\r\n let distance = dist(\r\n this.location.x,\r\n this.location.y,\r\n other.location.x,\r\n other.location.y\r\n );\r\n\r\n if (other != this && distance <= this.perception_radius) {\r\n alignment_direction.add(other.velocity);\r\n total_neighbours++;\r\n }\r\n }\r\n if (total_neighbours > 0) {\r\n alignment_direction.div(total_neighbours);\r\n alignment_direction.setMag(this.maximum_speed);\r\n alignment_direction.sub(this.velocity);\r\n alignment_direction.limit(this.maximum_force);\r\n }\r\n\r\n return alignment_direction;\r\n }", "title": "" }, { "docid": "e9b0e29688646f5a538579cbd623e317", "score": "0.54203683", "text": "outerPoint(angle) {\n const intersectLine = new Vector(Math.cos(angle), Math.sin(angle))\n for(let i = 0; i < this.nodes.length; i++) {\n const tangentLine = new Vector({\n x: this.repNodes[i+1].x - this.repNodes[i].x,\n y: this.repNodes[i+1].y - this.repNodes[i].y,\n })\n const p = new Vector(this.nodes[i])\n const v = this.center().minus(p)\n const m = new Mat(\n tangentLine.x, -intersectLine.x,\n tangentLine.y, -intersectLine.y\n )\n const inv_m = m.inv()\n if(inv_m == null) continue;\n const { x:k,y:r } = inv_m.dot(v);\n if(k >= 0 && k <= 1 && r >= 0) {\n return this.center().add(intersectLine.scale(r))\n }\n }\n return 0\n }", "title": "" }, { "docid": "44612a8583c9639b113170fe60e0428d", "score": "0.5399647", "text": "function findClosestPoint (sources, target) {\n const distances = [];\n let minDistance;\n\n sources.forEach(function (source, index) {\n const d = distance(source, target);\n\n distances.push(d);\n\n if (index === 0) {\n minDistance = d;\n } else {\n minDistance = Math.min(d, minDistance);\n }\n });\n\n const index = distances.indexOf(minDistance);\n\n\n return sources[index];\n}", "title": "" }, { "docid": "3a51e4f5d3ffdb06a24ec143a434d4bf", "score": "0.5395868", "text": "function nearestPointOnLine(px,py,x1,y1,x2,y2){\n\n\tvar lx = x2 - x1;\n var ly = y2 - y1;\n\t\n if ( lx == 0 && ly == 0 ) {//If the vector is of length 0,\n\t\t//the two endpoints have the same position, so the nearest point is at that position\n return {\n\t\t\tx: x1,\n\t\t\ty: y1\n\t\t};\n } else {\n\t\t//Find the factor for how far along the line, from <x1,y1>, the nearest point is\n var g = ((px - x1) * lx + (py - y1) * ly) / (lx * lx + ly * ly);\n\t\tif( g < 0 ) g = 0;\n\t\telse if( g > 1 ) g = 1;\n\t\t//And calculate the nearest point\n\t\treturn new Point(x1 + g * lx, y1 + g * ly);\n }\n}", "title": "" }, { "docid": "d2cf9cfa9eb1b078e485102b54b2ddb6", "score": "0.5395137", "text": "function inclination( vector ) {\n \n return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n \n }", "title": "" }, { "docid": "704852a843e1aefe68c61dd1011f16a8", "score": "0.53863084", "text": "function getClosest($val1, $val2, $target) \n{ \n if ($target - $val1 >= $val2 - $target) \n return $val2; \n else\n return $val1; \n}", "title": "" }, { "docid": "4cac59c59692f57f439793d27a217a85", "score": "0.5384663", "text": "function closestPointOnPath(vertices,x,y){\n\n\t\tvar o = null;\n\n\t\tvertices.forEach(function(vertex){\n\n\t\t\tvertex.updateWorldTransform();\n\n\t\t\t//var dist = Math.sqrt( Math.pow(vertex.worldX-x,2) + Math.pow(vertex.worldY-y,2) );\n\t\t\tvar dist = distanceFrom(x,y,vertex.worldX,vertex.worldY);\n\n\t\t\tif(dist < 8){\n\n\t\t\t\t// exact vertex, not a clone\n\t\t\t\to = vertex;\n\t\t\t\tconsole.log(\"Found vertex\",JSON.stringify( vertex.getData() ));\n\t\t\t}\n\t\t});\n\n\t\treturn o;\n\t}", "title": "" }, { "docid": "91e84a7297ce9ef9443981c9435b5ee1", "score": "0.53829616", "text": "function inclination(vector) {\n\n\t\t\treturn Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n\t\t}", "title": "" }, { "docid": "5ca9ce383dc8b4028679cf9add371b0b", "score": "0.5380774", "text": "function inclination(vector) {\n\t return Math.atan2(-vector.y, Math.sqrt((vector.x * vector.x) + (vector.z * vector.z)));\n\t }", "title": "" }, { "docid": "cb6e647e0c6b5f2a68796102a20123c4", "score": "0.5342344", "text": "function closest (moment) {\n const [[ball], players] = R.partition(isBall, moment.coordinates);\n return R.reduce(distance(ball), MAX, players);\n}", "title": "" }, { "docid": "9dc52cfeae56bbb2002a06178899b725", "score": "0.531634", "text": "distance(v, from) {\n let diff = Math.PI - Math.abs(Math.abs(v - from) - Math.PI);\n return Math.floor(diff * diffScale);\n }", "title": "" }, { "docid": "0b29b09144aca35adcf99fe09a766178", "score": "0.5314475", "text": "function getClosestPosition(P, A, B, target) {\n subtract$2(P, A, tmpVectorAP);\n subtract$2(B, A, tmpVectorAB);\n const lengthSquaredAB = lengthSquared(tmpVectorAB);\n const dotProductAPAB = dot(tmpVectorAP, tmpVectorAB);\n const distanceRatioAX = dotProductAPAB / lengthSquaredAB;\n if (distanceRatioAX <= 0) return A;\n if (distanceRatioAX >= 1) return B;\n const vectorAX = multiply$1(tmpVectorAB, distanceRatioAX);\n add$3(A, vectorAX, target);\n return target;\n }", "title": "" }, { "docid": "e3f6fef401148e38d1c45b1db740bec8", "score": "0.53139603", "text": "function inclination( vector ) {\r\n\t\r\n\t\t\treturn Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\r\n\t\r\n\t\t}", "title": "" }, { "docid": "37407e0a92b1be9b4c91412cba0306b9", "score": "0.52982044", "text": "function inclination( vector ) {\n\n \t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n \t\t}", "title": "" }, { "docid": "ffa3c4d302bb75ab73cce8afb1680989", "score": "0.5295731", "text": "function inclination( vector ) {\r\n\r\n\t\treturn Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\r\n\r\n\t}", "title": "" }, { "docid": "9f207d75b2ce63196e35b4c53df81754", "score": "0.52899843", "text": "function findNearestSwitch(x, y, x0, y0, x1, y1) {\n var bx0 = Math.floor(x0 / tw);\n var by0 = Math.floor(y0 / th);\n var bx1 = Math.ceil(x1 / tw);\n var by1 = Math.ceil(y1 / th);\n\n var bestdist = Infinity;\n var best = null;\n for(var by = by0; by < by1; by++) {\n for(var bx = bx0; bx < bx1; bx++) {\n if(bx < 0 || by < 0 || bx >= w || by >= h) continue;\n var cell = world[by][bx];\n var c = cell.circuitsymbol;\n if(c == 's' || c == 'S' || c == 'p' || c == 'P' || c == 'r' || c == 'R') {\n var cx = bx * tw + (tw >> 1);\n var cy = by * th + (th >> 1);\n var dx = cx - x;\n var dy = cy - y;\n var d = dx * dx + dy * dy;\n if(d < bestdist) {\n bestdist = d;\n best = cell;\n }\n }\n }\n }\n return best;\n}", "title": "" }, { "docid": "933da616d43d06b9cfbcf2ba5eb2d2fd", "score": "0.5288963", "text": "function indexNearestRadiosonde(heightPos, values) {\n\tvar bisectRadMeasurements = d3.bisector(function(d) { return d.height; }).left;\n\tvar i = bisectRadMeasurements(values, heightPos, 1, values.length - 1);\n\tvar d0 = values[i - 1];\n\tvar d1 = values[i];\n\treturn heightPos - d0.height > d1.height - heightPos ? i : i-1;\n}", "title": "" }, { "docid": "05b8e6c7030eb8d421b5352e75ba234d", "score": "0.5274415", "text": "function findIntersectionXY(v0, v1, a, xpyp) {\n var xstar, ystar;\n var xp = xpyp[0];\n var yp = xpyp[1];\n var dsin = clampTiny(Math.sin(v1) - Math.sin(v0));\n var dcos = clampTiny(Math.cos(v1) - Math.cos(v0));\n var tanA = Math.tan(a);\n var cotanA = clampTiny(1 / tanA);\n var m = dsin / dcos;\n var b = yp - m * xp;\n\n if (cotanA) {\n if (dsin && dcos) {\n // given\n // g(x) := v0 -> v1 line = m*x + b\n // h(x) := ray at angle 'a' = m*x = tanA*x\n // solve g(xstar) = h(xstar)\n xstar = b / (tanA - m);\n ystar = tanA * xstar;\n } else if (dcos) {\n // horizontal v0 -> v1\n xstar = yp * cotanA;\n ystar = yp;\n } else {\n // vertical v0 -> v1\n xstar = xp;\n ystar = xp * tanA;\n }\n } else {\n // vertical ray\n if (dsin && dcos) {\n xstar = 0;\n ystar = b;\n } else if (dcos) {\n xstar = 0;\n ystar = yp;\n } else {\n // does this case exists?\n xstar = ystar = NaN;\n }\n }\n\n return [xstar, ystar];\n } // solves l^2 = (f(x)^2 - yp)^2 + (x - xp)^2", "title": "" }, { "docid": "19c409150eff651203db11734e472baa", "score": "0.5262337", "text": "getPreceding(refVehicle, offLane)\n {\n var vehicle, dist;\n var result = null;\n var distMin = Number.MAX_SAFE_INTEGER;\n var pos = refVehicle.pos;\n var lane = refVehicle.lane + offLane;\n\n for (let iVehicle = 0; iVehicle < this._aVehicles.length; iVehicle ++)\n {\n vehicle = this._aVehicles[iVehicle];\n\n if (vehicle === refVehicle) // ignore ourself\n continue;\n\n if (vehicle.lane != lane)\n continue;\n\n dist = vehicle.pos - pos;\n if (dist < 0)\n continue;\n\n if (dist < distMin)\n {\n distMin = dist;\n result = vehicle;\n }\n }\n\n return(result)\n }", "title": "" }, { "docid": "b1c9b9566216012f1a6fe3651bb8d29f", "score": "0.5260439", "text": "static forAnchorAndPlaneVectors(anchor, v0, v1) {\n assertVectors(anchor, v0, v1);\n assert(!v0.isParallelTo(v1));\n return this.normalOnAnchor(v0.cross(v1), anchor);\n }", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "4264826f8e08747bbe1df86c5eb135ad", "score": "0.52509975", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "bf5e129b12be11eb5862c4c253942fb8", "score": "0.5249498", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "bf5e129b12be11eb5862c4c253942fb8", "score": "0.5249498", "text": "function inclination( vector ) {\n\n\t\treturn Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}", "title": "" }, { "docid": "7e68ff02f30121eab0fb341e056920e0", "score": "0.5244709", "text": "function inclination( vector ) {\n\t\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\t\n\t\t}", "title": "" }, { "docid": "aefd7f603cf19380757ceb629cb65333", "score": "0.524365", "text": "function doNewell(intersect){\n let nx = 0;\n let ny = 0;\n let nz = 0;\n\n for (let i = 0; i < intersect.length; i++) {\n let current = vec4(intersect[i % intersect.length]);\n let next = vec4(intersect[(i + 1) % intersect.length]);\n nx += (current[1]-next[1])*(current[2]+next[2]);\n ny += (current[2]-next[2])*(current[0]+next[0]);\n nz += (current[0]-next[0])*(current[1]+next[1]);\n }\n return normalize(vec4(nx, ny, nz, 0.0));\n}", "title": "" }, { "docid": "90c31125bb60280d7f42ee1682feaa15", "score": "0.52291334", "text": "closestObstacle(obs)\n {\n let closestObs = null;\n let closestDistance = Infinity;\n\n for(let x = 0; x < obs.length; x++)\n {\n let distance = (obs[x].x + obs[x].width) - this.x;\n\n if(distance < closestDistance && distance > 0)\n {\n closestObs = obs[x];\n closestDistance = distance;\n }\n }\n\n return closestObs;\n }", "title": "" }, { "docid": "498a6d4abb834e1f2fd68b35c2ce121e", "score": "0.52267003", "text": "mirrorTop(vector) {\n let dyToTop = this.topRight.y - vector.y;\n return vector.preservingAttrs(vector.x, this.topRight.y + dyToTop);\n }", "title": "" }, { "docid": "fe42693e135b64c90260280bfcbdeb5d", "score": "0.52171236", "text": "function getClosest(point){\n\t\tlet currDist\n\t\treturn NODES.reduce((closest, node, i) => {\n\t\t\tcurrDist = getDistance(point, node)\n\t\t\tif(closest[1] === null || currDist < closest[1]) closest = [i, currDist]\n\t\t\treturn closest\n\t\t}, [0, null])[0]\n\t}", "title": "" }, { "docid": "03f3ac134bb74a415eda7529a4e596ae", "score": "0.5216435", "text": "_getIndexOfItemNear(selected, prev) {\n // edge case\n if (selected.items.length < 2) return 0;\n\n let prevItem = prev.selected || prev.currentItem;\n let prevOffset = prev.transition('x').targetValue || 0;\n let [itemX] = prevItem.core.getAbsoluteCoords(-prevOffset, 0);\n let prevMiddle = itemX + prevItem.w / 2;\n\n // set the first item to be closest\n let closest = selected.items[0];\n let closestMiddle = closest.core.getAbsoluteCoords(0, 0)[0] + closest.w / 2;\n\n // start at the 2nd item\n for (let i = 1; i < selected.items.length; i++) {\n const item = selected.items[i];\n const middle = item.core.getAbsoluteCoords(0, 0)[0] + item.w / 2;\n\n if (\n Math.abs(middle - prevMiddle) < Math.abs(closestMiddle - prevMiddle)\n ) {\n // current item is the closest\n closest = item;\n closestMiddle = middle;\n } else {\n // previous index is the closest, return it\n return i - 1;\n }\n }\n // last index is the closest\n return selected.items.length - 1;\n }", "title": "" }, { "docid": "51832ae40229907e4a9d67da2c442f73", "score": "0.5215081", "text": "function getClosestNonWallTile(target){\r\n let min = 1000;\r\n let minIndexj = 0;\r\n let minIndexi = 0;\r\n for(let i=0; i<28; i++){//goes through each tile\r\n for(let j=0; j<31; j++){\r\n if(!originalTiles[j][i].wall){//if it is the current closest target\r\n if(dist(i, j, target.x, target.y)<min){\r\n min = dist(i, j, target.x, target.y);\r\n minIndexj = j;\r\n minIndexi = i;\r\n }\r\n }\r\n }\r\n }return createVector(minIndexi, minIndexj);//returns a PVector to the tile\r\n}", "title": "" }, { "docid": "a97265f7a21cf76233d8d5474df98ac2", "score": "0.52050674", "text": "function minimumDistances(a) {\nlet lastseen = [];\nlet dist = -1;\n[...a].forEach((v, i) => {\nif (lastseen.hasOwnProperty(v)) {\nlet thisdist = i - lastseen[v];\ndist = Math.min(thisdist, (dist === -1 ? thisdist : dist));\n}\nlastseen[v] = i;\n})\nreturn dist;\n}", "title": "" }, { "docid": "b2cc2d4788c92007afd65837a1a2896d", "score": "0.5198336", "text": "function closest ( value, to ){\nreturn Math.round(value / to) * to;\n}", "title": "" }, { "docid": "d418f3552163aa5737a091eb6b38695f", "score": "0.5192757", "text": "function closestVertexToPoint(obj, p){\r\n let closestVertex;\r\n let minDist = null;\r\n for(let i=0; i<obj.vertex.length; i++){\r\n if(p.subtr(obj.vertex[i]).mag() < minDist || minDist === null){\r\n closestVertex = obj.vertex[i];\r\n minDist = p.subtr(obj.vertex[i]).mag();\r\n }\r\n }\r\n return closestVertex;\r\n}", "title": "" }, { "docid": "a6a55f87a5dcf291d666b6269e3d6d19", "score": "0.51906663", "text": "function nearest(n, v) {\n\t\t\tn = n / v;\n\t\t\tn = Math.ceil(n) * v;\n\t\t\tconsole.log('nearest: ', n);\n\t\t\treturn n;\n\t\t}", "title": "" }, { "docid": "ed99c0e48684bb56ed07f655985f2342", "score": "0.51880944", "text": "function getAboveOrBelow(a, b, c, d) {\n var norm = vec3.create(),\n ab = vec3.create(),\n ac = vec3.create(),\n cd = vec3.create(),\n dist;\n\n ab = vec3.sub(ab, b, a);\n ac = vec3.sub(ac, c, a);\n vec3.cross(norm, ab, ac);\n if (vec3.length(norm) == 0) return undefined;\n vec3.sub(cd, d, c);\n dist = vec3.dot(norm, projVector(cd, norm));\n if(dist == 0) return 0;\n else return vec3.dot(norm, d) > 0 ? 1 : -1;\n }", "title": "" }, { "docid": "4affd7c24f8cc26922309cedccaaf98b", "score": "0.51828676", "text": "function inclination( vector ) {\n\t\n\t\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\t\n\t\t\t}", "title": "" }, { "docid": "4affd7c24f8cc26922309cedccaaf98b", "score": "0.51828676", "text": "function inclination( vector ) {\n\t\n\t\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\t\n\t\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "605e815d357fc76cb4e9d1189ca831af", "score": "0.518172", "text": "function inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}", "title": "" }, { "docid": "129faaa7704edcd5bca88e3ac6fc2fbf", "score": "0.5175909", "text": "function closestDistanceBetweenLines(a0, a1, b0, b1, clampAll, clampA0, clampA1, clampB0, clampB1){\n //Given two lines defined by array pairs (a0,a1,b0,b1)\n //Return distance, the two closest points, and their average\n\n clampA0 = clampA0 || false;\n clampA1 = clampA1 || false;\n clampB0 = clampB0 || false;\n clampB1 = clampB1 || false;\n clampAll = clampAll || false;\n\n if(clampAll){\n clampA0 = true;\n clampA1 = true;\n clampB0 = true;\n clampB1 = true;\n }\n\n //Calculate denomitator\n var A = math.subtract(a1, a0);\n var B = math.subtract(b1, b0);\n var _A = math.divide(A, math.norm(A))\n var _B = math.divide(B, math.norm(B))\n var cross = math.cross(_A, _B);\n var denom = math.pow(math.norm(cross), 2);\n\n //If denominator is 0, lines are parallel: Calculate distance with a projection and evaluate clamp edge cases\n if (denom == 0){\n var d0 = math.dot(_A, math.subtract(b0, a0));\n var d = math.norm(math.subtract(math.add(math.multiply(d0, _A), a0), b0));\n\n //If clamping: the only time we'll get closest points will be when lines don't overlap at all. Find if segments overlap using dot products.\n if(clampA0 || clampA1 || clampB0 || clampB1){\n var d1 = math.dot(_A, math.subtract(b1, a0));\n\n //Is segment B before A?\n if(d0 <= 0 && 0 >= d1){\n if(clampA0 == true && clampB1 == true){\n if(math.absolute(d0) < math.absolute(d1)){\n return [b0, a0, math.norm(math.subtract(b0, a0))]; \n }\n return [b1, a0, math.norm(math.subtract(b1, a0))];\n }\n }\n //Is segment B after A?\n else if(d0 >= math.norm(A) && math.norm(A) <= d1){\n if(clampA1 == true && clampB0 == true){\n if(math.absolute(d0) < math.absolute(d1)){\n return [b0, a1, math.norm(math.subtract(b0, a1))];\n }\n return [b1, a1, math.norm(math.subtract(b1,a1))];\n }\n }\n\n }\n\n //If clamping is off, or segments overlapped, we have infinite results, just return position.\n return [null, null, d];\n }\n\n //Lines criss-cross: Calculate the dereminent and return points\n var t = math.subtract(b0, a0);\n var det0 = math.det([t, _B, cross]);\n var det1 = math.det([t, _A, cross]);\n\n var t0 = math.divide(det0, denom);\n var t1 = math.divide(det1, denom);\n\n var pA = math.add(a0, math.multiply(_A, t0));\n var pB = math.add(b0, math.multiply(_B, t1));\n\n //Clamp results to line segments if needed\n if(clampA0 || clampA1 || clampB0 || clampB1){\n\n if(t0 < 0 && clampA0)\n pA = a0;\n else if(t0 > math.norm(A) && clampA1)\n pA = a1;\n\n if(t1 < 0 && clampB0)\n pB = b0;\n else if(t1 > math.norm(B) && clampB1)\n pB = b1;\n\n }\n\n var d = math.norm(math.subtract(pA, pB))\n\n return [pA, pB, d];\n}", "title": "" }, { "docid": "4ad84640b9fb9308157d3b220cf3aefe", "score": "0.51691645", "text": "function closestpt(vn) {\n\t\t var b = vn.slope;\n var angle = Math.atan( (vn.spread[1]*nomDWeight)/(vn.spread[0]) );\n\t\t var a = vn.mid[1] - b*vn.mid[0];\n\t\t var xstar = -b*a/(1+b*b);\n\t\t var obj = {\n\t\t\tangle: angle,\n\t\t\tb: b,\n\t\t\ta: a,\n\t\t xstar: xstar,\n\t\t\tystar: b*xstar + a,\n\t\t\toffsetX: 0.05*Math.cos(angle)*Math.sign(vn.spread[0]),\n\t\t\toffsetY: (vn.slope>0?1:-1)*0.05*Math.sin(angle)*Math.sign(vn.spread[1])/nomDWeight \n\t\t }\n\t\t return(obj);\n\t\t}", "title": "" }, { "docid": "bcdfeee4eaf5241a399437d589590e14", "score": "0.51605743", "text": "function getNextPoint (components, v, A, mins, maxs) {\n const vRef = v\n for (let index = 0; index < components.length; index++) {\n components[index] += 1n\n v = add(A[index], v)\n if (components[index] > maxs[index]) {\n components[index] = mins[index]\n v = sub(v, scale(A[index], maxs[index] - mins[index] + 1n))\n } else {\n for (let i = 0; i < vRef.length; i++) vRef[i] = v[i]\n return true\n }\n }\n return false\n}", "title": "" }, { "docid": "a12118c96c3d7f32ae1f8b5bb92ddb66", "score": "0.5159951", "text": "copyBest(pos)\n\t {\n\t\t var holder = -1;\n\t\t var answer = 0;\n\t\t for(var i = 0; i < this.targetsSize; i++)\n\t\t {\n\t\t\t var d = dist(pos.x, pos.y, pos.z, this.targets[i].x, this.targets[i].y, this.targets[i].z);\n\t\t\t if(d < holder || holder == -1)\n\t\t\t {\n\t\t\t\t holder = d;\n\t\t\t\t answer = createVector(this.targets[i].x, this.targets[i].y, this.targets[i].z);\n\t\t\t }\n\t\t }\n\t\t return answer;\n\t }", "title": "" }, { "docid": "bddec85d66fd28cf32ee0d491b2a0456", "score": "0.5159814", "text": "function findClosestPoint(s, e, p) {\n // u = e - s\n // v = s+tu - p\n // d = length(v)\n // d = length((s-p) + tu)\n // d = sqrt(([s-p].x + tu.x)^2 + ([s-p].y + tu.y)^2)\n // d = sqrt([s-p].x^2 + 2[s-p].x*tu.x + t^2u.x^2 + [s-p].y^2 + 2[s-p].y*tu.y + t^2*u.y^2)\n // ...minimize with first derivative with respect to t\n // 0 = 2[s-p].x*u.x + 2tu.x^2 + 2[s-p].y*u.y + 2tu.y^2\n // 0 = [s-p].x*u.x + tu.x^2 + [s-p].y*u.y + tu.y^2\n // t*(u.x^2 + u.y^2) = [s-p].x*u.x + [s-p].y*u.y\n // t = ([s-p].x*u.x + [s-p].y*u.y) / (u.x^2 + u.y^2)\n var u = sub(e, s),\n d = sub(s, p),\n t = -(d[0]*u[0] + d[1]*u[1]) / (u[0]*u[0] + u[1]*u[1]);\n if (t <= 0 || t >= 1) {\n return [0, 0];\n }\n return add(s, mult(u, t));\n}", "title": "" }, { "docid": "1a3b98a84c90f9ea25843a9efb037939", "score": "0.5150537", "text": "look(walls) {\n for (let i = 0; i < this.rays.length; i++) {\n const ray = this.rays[i];\n let closest = null;\n let record = Infinity;\n for (let wall of walls) {\n const pt = ray.cast(wall);\n if (pt) {\n const d = p5.Vector.dist(this.pos, pt);\n if (d < record) {\n record = d;\n closest = pt;\n }\n }\n }\n if (closest) {\n stroke(255, 100);\n line(this.pos.x, this.pos.y, closest.x, closest.y);\n }\n }\n }", "title": "" }, { "docid": "ce0d0a39c782ae6b54dde787760492c7", "score": "0.5148905", "text": "function findClosestPoint(target) {\n var minDistance = Infinity,\n minIndex = -1;\n _coordinates.forEach(function(point, i) {\n var dist = target.distanceTo(point);\n if(dist < minDistance) {\n minDistance = dist;\n minIndex = i;\n }\n });\n\n return minIndex;\n}", "title": "" }, { "docid": "5f671b076fb250e4ace189d7ccf65073", "score": "0.5143752", "text": "neighboringPoint (sourceX, sourceY, towards) {\n if (towards === North) return [sourceX, sourceY + this.ySpacing()]\n if (towards === South) return [sourceX, sourceY - this.ySpacing()]\n if (towards === East) return [sourceX + this.xSpacing(), sourceY]\n if (towards === West) return [sourceX - this.xSpacing(), sourceY]\n if (towards === NorthEast) return [sourceX + this.xSpacing(), sourceY + this.ySpacing()]\n if (towards === SouthEast) return [sourceX + this.xSpacing(), sourceY - this.ySpacing()]\n if (towards === NorthWest) return [sourceX - this.xSpacing(), sourceY + this.ySpacing()]\n if (towards === SouthWest) return [sourceX - this.xSpacing(), sourceY - this.ySpacing()]\n }", "title": "" }, { "docid": "2f20a21fb1ddf653224ba28259d91b59", "score": "0.5138066", "text": "function heuristic(current, target) {\n // return Math.sqrt( (current.col-target.col)**2 + (current.row-target.row)**2);\n return (Math.abs(current.col-target.col) + (Math.abs(current.row - target.row)));\n}", "title": "" }, { "docid": "ca997b8d9b198d7bb48b231534c2d83d", "score": "0.513681", "text": "function queryNearest(){\n}", "title": "" } ]
c79912e44eb4c46e602589672d9ab875
Delete todo List item
[ { "docid": "1c358b7335be7fdd1b18aea93d04c497", "score": "0.0", "text": "function deleteCheck(e){\n const item = e.target;\n\n if (item.classList[0] === \"trash__btn\"){\n const todo = item.parentElement;\n\n //Animation\n todo.classList.add(\"fall\");\n todo.addEventListener(\"transitioned\", function(){\n todo.remove();\n })\n \n }\n\n if (item.classList[0] === \"complete__btn\"){\n const todo = item.parentElement;\n todo.classList.toggle(\"completed\");\n }\n\n}", "title": "" } ]
[ { "docid": "b77f66c021ef5454ac2cc40e517a6f32", "score": "0.8367077", "text": "function deleteItem(){\n trElement.remove();\n updateOptionsCategory();\n for( let i = 0; i<todoList.length; i++){\n if(todoList[i].id == this.dataset.id){\n todoList.splice(i,1);//Borro la tarea del LS\n }\n saveLocalStorage();\n //Se borra la tarea también en el calendario\n calendar.getEventById(this.dataset.id).remove();\n }\n }", "title": "" }, { "docid": "9d8773541f1d269183974152c122cb2d", "score": "0.8246096", "text": "function deleteItem() {\n // checks which list the item is in so it can be correctly removed from localStorage\n if (\n this.closest(\".button-cont\").children[0].classList.contains(\n \"fa-undo-alt\"\n )\n ) {\n removeLocal(\n this.closest(\".to-do-item\").children[0].innerHTML,\n \"completed\"\n );\n } else {\n removeLocal(this.closest(\".to-do-item\").children[0].innerHTML, \"todo\");\n }\n\n this.closest(\".to-do-item\").remove();\n}", "title": "" }, { "docid": "65ffcf09d239071904c55c967ed90ad6", "score": "0.8105458", "text": "function deleteToDo(event) {\n const btn = event.target;\n const li = btn.parentNode;\n toDoList.removeChild(li); // this's just remove on the display\n const cleanToDos = toDos.filter(function(toDo) {\n return toDo.id !== parseInt(li.id);\n }); // filter transfer new array when something goes throught it, if they are 'true'\n toDos = cleanToDos\n saveToDos();\n }", "title": "" }, { "docid": "c69fc9d5cc017056a5772e18f398d39c", "score": "0.8053539", "text": "function deleteButtonPressed(todo) {\n db.remove(todo);\n }", "title": "" }, { "docid": "637f5233487c7ba31be42d59303ca15a", "score": "0.8050744", "text": "function deleteTodo(e) {\n var li = e.target.parentNode;\n var id = li.getAttribute('id');\n\n window.app.Store.deleteTodo(id, function(e) {\n\n li.parentNode.removeChild(li);\n\n });\n }", "title": "" }, { "docid": "93638f6ddca7a071f11a3998b1d8e5bf", "score": "0.7916481", "text": "function deleteAnItem() { \n let item = this.parentNode.parentNode;\n let id = item.id\n let value = this.previousSibling.innerText\n \n if ( id === 'todo') {\n data.todo.splice(data.todo.indexOf(value),1);\n localStorage.setItem('todolist',JSON.stringify(data));\n } else {\n console.log('hi')\n data.completed.splice(data.completed.indexOf(value),1);\n localStorage.setItem('todolist',JSON.stringify(data));\n }\n \n\n let liToRemove = this.parentNode;\n this.parentNode.parentNode.removeChild(liToRemove);\n\n}", "title": "" }, { "docid": "05e26b57054411a3aa5ea36a55083263", "score": "0.7906922", "text": "function deleteItem(e) {\n // Haal het te verwijderen element uit het muisevent e.target.\n var elementToBeDeleted = e.target.parentElement;\n\n // Verwijder het uit de lijst.\n document.getElementById('todoitemlist').removeChild(elementToBeDeleted);\n }", "title": "" }, { "docid": "7000000030a8e7cc7b1f90d2490debdb", "score": "0.79064673", "text": "function delete_task(item) {\n let parent_li = item.parentElement;\n\n // delete from localstorage\n delete_ls(parent_li.childNodes[1].innerHTML);\n\n //delete todo object\n delete_todo(parent_li);\n\n parent_li.remove();\n task_counter();\n}", "title": "" }, { "docid": "eb6d725b77f7b2908b99dbab6163ef2e", "score": "0.78625", "text": "function deleteItem(item) {\r\n\titem.parentElement.removeChild(item);\r\n\tLIST[item.id].trash = true;\r\n\tlocalStorage.setItem('TODO', JSON.stringify(LIST));\r\n}", "title": "" }, { "docid": "277688124afe16722b84a6db64ef396f", "score": "0.7832412", "text": "function deleteToDo(event) {\n const btn = event.target;\n //console.dir(event);\n const li = btn.parentNode; // to get the father of btn\n toDoList.removeChild(li);\n const cleanToDos = toDos.filter(function(toDo) {\n return toDo.id !== parseInt(li.id); //change li.id(string) into number\n }); // they give an array of items that pass a check from filter function\n console.log(cleanToDos);\n toDos = cleanToDos;\n saveToDos();\n}", "title": "" }, { "docid": "473e032ef4e9a5428f38426d1c39f12c", "score": "0.7826318", "text": "function deleteTask() {\n\tvar wantDelete = this.parentNode.parentNode,\n\t\twantDeleteValue = wantDelete.textContent,\n\t\twantDeleteID = wantDelete.parentNode.id;\n\n\tif (wantDeleteID === 'todolist-toDoTask') {\n\t\tdata.todo.splice(data.todo.indexOf(wantDeleteValue), 1);\n\t} else {\n\t\tdata.completed.splice(data.completed.indexOf(wantDeleteValue), 1);\n\t}\n\n\twantDelete.parentNode.removeChild(wantDelete);\n}", "title": "" }, { "docid": "829059f02fb657378cb3af15e355f166", "score": "0.7804794", "text": "function removeItem(){\n var item = $(this).parent().parent();\n var listID = item.parent().attr('id');\n var value = item.text();\n\n if (listID == 'todo') {\n dataTodo.todo.splice(dataTodo.todo.indexOf(value), 1);\n } else {\n dataTodo.completed.splice(dataTodo.completed.indexOf(value), 1);\n }\n \n dataObjectUpdated();\n item.remove();\n}", "title": "" }, { "docid": "77774b2dc7f9e873d5fda8cba64d281b", "score": "0.7799811", "text": "deleteTodo() {\n let self = this,\n selectedTodoId = self.selectedTodo.getAttribute('id');\n\n database.deleteTodo(selectedTodoId);\n self.clearSelection();\n }", "title": "" }, { "docid": "0917e37d4ee0e5514255972edc6de04d", "score": "0.7792868", "text": "function removeToDo(event) {\n \n let specificListItem = $(event.target).parent();\n specificListItem.remove();\n\n saveToDos()\n}", "title": "" }, { "docid": "dd9cb21330343b11e330d554ee7ba382", "score": "0.77813655", "text": "function deleteTask() {\n form.removeChild(item);\n const dataLS = JSON.parse(localStorage.getItem('item.list'));\n if (id > -1) dataLS.splice(dataLS[id], 1);\n saveAndUpdateData(dataLS);\n }", "title": "" }, { "docid": "bcfec703baabd86c740e818e9672f2d9", "score": "0.7753304", "text": "Remove(item){\n todoListContainer.removeChild(item)\n numTask--\n }", "title": "" }, { "docid": "fdfd701fc421916bf54b0eef9f74377e", "score": "0.7717248", "text": "function deleteItem(pos) {\n todolist.splice(pos, 1);\n addItems();\n}", "title": "" }, { "docid": "791c2576fe612f2323333adf8585d88b", "score": "0.7705984", "text": "function deleteButtonPressed(todo) {\n var motivoAsociado = db.get(\"motivo.\"+todo._id);\n db.remove(todo);\n db.remove(motivoAsociado);\n\n }", "title": "" }, { "docid": "0bb3a63f22ae3c36fd32bffd0f7c011a", "score": "0.76963985", "text": "function deleteItem(index) {\n items.splice(index, 1);\n localStorage.setItem('todo-list', JSON.stringify(items))\n listItems();\n}", "title": "" }, { "docid": "d673b209bfd1617d233b851b8bedab70", "score": "0.7661929", "text": "function deleteTodo (e, clickedLi) {\n allTodos.forEach( (item, index) => {\n if (item === clickedLi) {\n allTodos.splice(index, 1);\n }\n })\n clickedLi.remove()\n}", "title": "" }, { "docid": "f6eec3da5957bee63fba528233d39d4d", "score": "0.7632523", "text": "function removeToDo(event) {\n const ELEMENT = event.target;\n ELEMENT.parentNode.parentNode.removeChild(ELEMENT.parentNode);\n list[ELEMENT.id].trash = true;\n localStorage.setItem(\"TODO\", JSON.stringify(list));\n}", "title": "" }, { "docid": "2eebea2776f69e6cb873c302ac67e462", "score": "0.76130456", "text": "removeToDo(item) {\n ToDos.remove( {_id: item._id });\n }", "title": "" }, { "docid": "d2a4951c1bb93f49ac6d6824942fb57f", "score": "0.76045567", "text": "deleteItem(id) {\n\t\tDeleteToDoAPI(id).then(resp => {\n\t\t\tthis.getItems()\n\t\t})\n\t}", "title": "" }, { "docid": "b60c8ad98131e0ce77b0cf0bda2d982f", "score": "0.7594039", "text": "function deleteTodo(pos) {\n //apartir da posição passada por parâmetro, remova o primeiro item\n todos.splice(pos, 1)\n renderTodos()\n saveToStorage()\n}", "title": "" }, { "docid": "f6c6f8c166fad6ac0790fde241f5e258", "score": "0.7591666", "text": "function deleteTask(li) {\n let sure = confirm(\"Delete task?\");\n if (sure) li.parentElement.removeChild(li);\n}", "title": "" }, { "docid": "ebb1d38a048223732548de27a03b7474", "score": "0.75743085", "text": "function deleteTodo(pos) {\r\n todos.splice(pos, 1);\r\n renderTodos();\r\n saveToStorage();\r\n}", "title": "" }, { "docid": "313bd1be59c16ac39e9f11b36a10a05d", "score": "0.7570817", "text": "function deleteTask(index){\r\n let getLocalStorageData = localStorage.getItem(\"New Todo\");\r\n listArray = JSON.parse(getLocalStorageData);\r\n listArray.splice(index, 1); //delete or remove the li\r\n localStorage.setItem(\"New Todo\", JSON.stringify(listArray));\r\n showtask(); //call the showTasks function\r\n}", "title": "" }, { "docid": "0b48d9fb71ace63e65c769cc272d369c", "score": "0.7558736", "text": "function removeItem() {\n const item = this.parentNode.parentNode;\n const parent = item.parentNode;\n const id = parent.id;\n const value = item.innerText;\n\n if (id === \"todo\") {\n data.todo.splice(data.todo.indexOf(value), 1);\n } else {\n data.completed.splice(data.completed.indexOf(value), 1);\n }\n dataObjectUpdated();\n\n parent.removeChild(item);\n}", "title": "" }, { "docid": "154c906c0bbfb83f8c924253e07ba790", "score": "0.7545058", "text": "function removeTodo(li) {\n todoList.removeChild(li);\n}", "title": "" }, { "docid": "35573a00525714cf26fe0e702abac4e5", "score": "0.7531068", "text": "function deleteTodo(position) {\ntodos.splice(position, 1);\ndisplayTodos();\n}", "title": "" }, { "docid": "1fdc99af7b6071c5ac1bb57a9c23c220", "score": "0.7527106", "text": "function deleteTask(id) {\r\n let indexOfItemForDeletion = toDos.findIndex((x) => x.id == id);\r\n toDos.splice(indexOfItemForDeletion, 1);\r\n refreshList(toDos);\r\n todosPending.textContent = toDos.length\r\n\r\n}", "title": "" }, { "docid": "99d3e8f085e813c4edb6a4bbc900e76d", "score": "0.7526054", "text": "function deleteItem(id){\r\n const newTodos = Todos.filter(todo => todo.id !== id );\r\n setTodos(newTodos);\r\n }", "title": "" }, { "docid": "053be40ef3ef6574a9b426e24f840e51", "score": "0.7514411", "text": "function deleteTask() {\n console.log(currentTodoIndex + '****************');\n currentTask.getListOfToDo().splice(currentTodoIndex, 1);\n getElement('write-todo')[currentTodoIndex].remove();\n var nextTodo = currentTodoIndex;\n if (currentTodoIndex > currentTask.getListOfToDo().length - 1) {\n currentTodoIndex = currentTodoIndex - 1;\n nextTodo = currentTodoIndex;\n }\n if (nextTodo != -1) {\n currentTodo = currentTask.getListOfToDo()[nextTodo];\n console.log(nextTodo);\n showNav(currentTodo);\n }\n else {\n closeRightSideWindow();\n }\n}", "title": "" }, { "docid": "ddb5990ea593d4d7994b04a63c6cc76a", "score": "0.7500286", "text": "function removeItem(){\n var item=this.parentNode.parentNode;\n var parent=item.parentNode;\n var id=parent.id;\n var value=item.innerText;\n parent.removeChild(item);\n if(id ==='todo'){\n data.todo.splice(data.todo.indexOf(value),1);\n }else{\n data.completed.splice(data.completed.indexOf(value),1);\n }\n objectUpdated();\n}", "title": "" }, { "docid": "f7af0e75b01db100ca33c65eeb12dcc4", "score": "0.7493635", "text": "function destroyTodoItem(e) {\n // note this.findResourceFromNode - it takes the node that triggered the event,\n // and recursively searches within the markup for it's parent resource. Specifically,\n // it's looking for a parent node with the attributes fjs-resource & fjs-id to identify\n // and load a single fjs resource.\n var todo = this.findResourceFromNode(e.currentTarget);\n \n // FlatJS.Resource.prototype.remove removes the item & any bound nodes from markup.\n todo.remove();\n // Since we changed the markup, we need to reload our component's model (this.fjsData)\n // by calling this.assembleFjsData()\n this.assembleFjsData();\n this.publish('todos-updated', [this.fjsData.todosList]);\n }", "title": "" }, { "docid": "d07e27534db6494be289b881ccc32ffd", "score": "0.74856657", "text": "function deleteCheck(e) {\r\n const item = e.target;\r\n const todoIndexText = item.parentElement.innerText;\r\n const todoIndex = taskList.findIndex(elem => elem['text'] === todoIndexText);\r\n if (item.classList[0] === 'delete-btn') {\r\n item.parentElement.remove();\r\n taskList.splice(todoIndex, 1);\r\n } else if (item.type === 'checkbox') {\r\n item.parentElement.querySelector('span').classList.toggle('completed');\r\n taskList[todoIndex].completed = taskList[todoIndex].completed === false;\r\n }\r\n localStorage.setItem(\"tasks\", JSON.stringify(taskList));\r\n}", "title": "" }, { "docid": "096dd2ec5f6803a83d09dc1b3ac44b01", "score": "0.74803996", "text": "function deleteTask() {\n\tconsole.log(\"Delete task...\");\n\tvar listItem = this.parentNode;\n\tvar ul = listItem.parentNode;\n\n\t//Remove the parent list item from the ul\n\tul.removeChild(listItem);\n}", "title": "" }, { "docid": "e675d365cafa3ca3fa7f73b0584ebbb8", "score": "0.7470195", "text": "function deleteTodos(position){\n toDos.splice(position, 1);\n displayTodos();\n }", "title": "" }, { "docid": "5ce4dda1c368bd10c31cd1f87850bd9c", "score": "0.74647915", "text": "@action\n remove(todo){\n const index = this.todos.indexOf(todo)\n if(index > -1){\n this.todos.splice(index, 1)\n }\n }", "title": "" }, { "docid": "fd213b1df577699be936aa300c05ecf8", "score": "0.7461253", "text": "function removeItem(e){\r\n\t\tif(e.target.id == \"remove\" ){\r\n\t\t\t// console.log(e.target)\r\n\t\t\tif (confirm(\"Remove item! Are you sure?\")) {\r\n\t\t\t\tlist.removeChild(e.target.parentElement);\r\n\t\t\t\tvar child = e.target.parentElement.firstChild;\r\n\r\n\t\t\t\tfor (var i = 0; i < todo.length; i++) {\r\n\t\t\t\t\tif (todo[i] === child.textContent) {\r\n\t\t\t\t\t\tvar index1 = todo.indexOf(child.textContent);\r\n\t\t\t\t\t\tvar index2 = completed.indexOf(child.textContent);\r\n\t\t\t\t\t\ttodo.splice(index1,1);\r\n\t\t\t\t\t\tif (index2 != -1){\r\n\t\t\t\t\t\t\tcompleted.splice(index2,1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// call to update localStorage\r\n\t\t\t\t\t\tupdateStorage(\"todoList\", todo);\r\n\t\t\t\t\t\tupdateStorage(\"completed\", completed);\r\n\t\t\t\t\t\tlocation.reload();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "b93fac27c849a46cab96f3b6aa575ae8", "score": "0.7459063", "text": "deleteItem(index) {\n this.todos.splice(index, 1);\n }", "title": "" }, { "docid": "f9b951d732093b588175fe036be79352", "score": "0.7458102", "text": "function Delete(item) {\n let blur = document.getElementById(\"blur\");\n let pop_up = document.getElementById(\"pop-up-window_desc\");\n if (confirm(\"The current task would be deleted permanently!\")) {\n taskArraystr = localStorage.getItem(\"itemsJson\");\n taskArray = JSON.parse(taskArraystr);\n // Delete the clicked item in the list.\n taskArray.splice(item, 1);\n localStorage.setItem(\"itemsJson\", JSON.stringify(taskArray));\n SetnUpdate();\n blur.classList.toggle(\"active\");\n pop_up.classList.toggle(\"active\");\n }\n}", "title": "" }, { "docid": "f2733dca1a5a9994c357cdf03d2b80b5", "score": "0.7457692", "text": "function deleteTodo(e) {\r\n const item = e.target;\r\n\r\n if (\r\n item.classList[0] === \"delete-btn\" &&\r\n // Confirm popup\r\n confirm(\"Are you sure you want to delete an item?!\")\r\n ) {\r\n const todo = item.parentElement;\r\n todo.remove();\r\n }\r\n\r\n // Completed\r\n if (item.classList[0] === \"completed-btn\") {\r\n const todo = item.parentElement;\r\n todo.classList.toggle(\"completedItem\");\r\n }\r\n}", "title": "" }, { "docid": "2c8dd759c7358350a05062e9f413a9de", "score": "0.74490356", "text": "function delete_item(marked_delete) {\n\tmarked_delete.parentNode.removeChild(marked_delete);\n}", "title": "" }, { "docid": "336a819aa36a592e27f1210cdc8b25ba", "score": "0.74279374", "text": "function deleteListItem(){\n // Deletes item from DOM\n // newItem.parentNode.removeChild(newItem);\n\n // Hides item\n newItem.classList.add('delete')\n }", "title": "" }, { "docid": "9d45f00ea12a1db8a965a055e173d343", "score": "0.74156445", "text": "function deleteTodo(pos) {\n // Uma funcao que exclui todo\n todos.splice(pos, 1);\n renderTodos();\n saveToStorage();\n}", "title": "" }, { "docid": "c4d6af8bce1531fcf94d55a9929b177e", "score": "0.7413084", "text": "function remove(itemBox, item) {\r\n itemBox.parentNode.removeChild(itemBox);\r\n let index = todos.indexOf(item);\r\n todos.splice(index, 1);\r\n window.localStorage.setItem(\"todos\", JSON.stringify(todos)); // Deletes the JSON Data in your localStorage\r\n}", "title": "" }, { "docid": "31dbe9f52e216f44eecd37cdc144bbee", "score": "0.7397131", "text": "function deleteItem() {\n\t\tvar $tick = $(this).parents(\".ticket\");\n\t\t$(this).parent().remove();\n\t\tupdateItems.call($tick[0]);\n\t}", "title": "" }, { "docid": "b5366cdeb927e2aca322c823219d6a12", "score": "0.73967373", "text": "function deleteItem(){\r\n this.parentNode.remove(this);\r\n updateListCountHeaderMessage();\r\n}", "title": "" }, { "docid": "aecf696e409c0f86d5e4b5d7b7c48cb7", "score": "0.7385271", "text": "function deleteItem(event) {\n\tif(event.target.classList.contains(\"delete\")) {\n\t\tlet li = event.target.parentElement;\n\t\tul.removeChild(li);\n\t}\n}", "title": "" }, { "docid": "6feb532fabf85ce9973ba0898a0c3a9d", "score": "0.73830074", "text": "function removeToDo(element){\n element.parentNode.parentNode.removeChild(element.parentNode);\n \n LIST[element.id].trash = true;\n}", "title": "" }, { "docid": "172caa7c4ecd9a3b2b4525e68dd64a5b", "score": "0.7376326", "text": "function deleteItem() {\n let title = this.id.replaceAll(\"-\", \" \").replace(\"delete \", \"\");\n let call = apiCall(\"/item/delete\", \"POST\");\n let json = {\n \"title\": title,\n \"status\": \"done\"\n };\n call.send(JSON.stringify(json));\n}", "title": "" }, { "docid": "4ff8c9092b0cabe79e8a109952695f31", "score": "0.73713666", "text": "function deleteTodo ( e ) {\n const parent = e.target.parentElement.parentElement;\n const tasks = JSON.parse( sessionStorage.getItem( 'tasks' ) );\n const newTasks = tasks.filter( task => task !== e.target.parentElement.innerText );\n sessionStorage.setItem( 'tasks', JSON.stringify( newTasks ) );\n parent.removeChild( e.target.parentElement );\n}", "title": "" }, { "docid": "b4bf15850f526d9e3112be842053f29a", "score": "0.7368783", "text": "function deleteTask(e) {\n\t\tvar id = e.target.id.substring(4);\n\t\t// span -> div -> container-div\n\t\tvar tasks = JSON.parse(localStorage.getItem('todoList')) || [];\n\t\ttasks[id].status = 0;\t// change status to deleted\n\t\tlocalStorage.setItem('todoList', JSON.stringify(tasks));\n\t\te.target.parentNode.parentNode.removeChild(e.target.parentNode);\n\t\tupdateNumbers();\n\t}", "title": "" }, { "docid": "aee3acc946bf8dc7bcc06fbe9e275b60", "score": "0.7366179", "text": "function deleteTodo(position) {\n todos.splice(position, 1);\n displayTodos();\n}", "title": "" }, { "docid": "aee3acc946bf8dc7bcc06fbe9e275b60", "score": "0.7366179", "text": "function deleteTodo(position) {\n todos.splice(position, 1);\n displayTodos();\n}", "title": "" }, { "docid": "f89fffbac4c83e34d745affd05ff5110", "score": "0.73651105", "text": "function deleteTodo (position) {\n todos.splice(position, 1);\n displayTodos();\n}", "title": "" }, { "docid": "af06410ba25ba21907788c51f9af6a39", "score": "0.7364416", "text": "function deleteItem(id) {\n const _alert = document.querySelector(\".alertDelete\")\n const _confirmDelete = document.querySelector(\"#confirm\")\n const _closeAlert = document.querySelector(\"#close\")\n _alert.style = 'display:flex;'\n\n _confirmDelete.onclick = () => {\n for (let i = 0; i < _listToDo.length; i++) {\n if (_listToDo[i].name == id) {\n const index = _listToDo.indexOf(_listToDo[i])\n _listToDo.splice(index, 1)\n ShowItemList(true)\n saveList()\n _alert.style = 'display:none;'\n\n }\n\n }\n }\n _closeAlert.onclick = () => {\n _alert.style = 'display:none;'\n\n }\n\n\n\n}", "title": "" }, { "docid": "06e4d5572a9f685743a6cdf91c7ebd0a", "score": "0.73620844", "text": "function deleteItem(e) {\n let item = e.target;\n if (item.classList[0] === \"deletebtn\") {\n let todo = item.parentElement;\n todo.remove();\n }\n}", "title": "" }, { "docid": "da9d1f1037588d4129bbc86f07173a2c", "score": "0.736105", "text": "function deleteTodo(position) {\n todos.splice(position, 1);\n displayTodos();\n}", "title": "" }, { "docid": "fda269df6b666bf56532d4d121696c00", "score": "0.7357714", "text": "function deleteTask(index) {\n let getLocalStorage = localStorage.getItem(\"New Todo\");\n listArr = JSON.parse(getLocalStorage);\n listArr.splice(index, 1); // menghapus atau menghapus li terindeks tertentu\n\n // setelah menghapus li, lallu perbarui penyimpanan lokal\n localStorage.setItem(\"New Todo\", JSON.stringify(listArr)); // mengubah objek js menjadi string json\n showTasks(); //memanggil function showTask\n}", "title": "" }, { "docid": "5bc7e1c536191dc3c930b9127e518541", "score": "0.735465", "text": "function deleteTodo(index) {\r\n let todo = localStorage.getItem('todo');\r\n let todoObj;\r\n if (todo == null) {\r\n todoObj = [];\r\n } else {\r\n todoObj = JSON.parse(todo);\r\n }\r\n todoObj.splice(index, 1);\r\n notes = localStorage.setItem('todo', JSON.stringify(todoObj));\r\n showTodo();\r\n}", "title": "" }, { "docid": "aee738c12ac122319949b8a9848c1edb", "score": "0.73345023", "text": "function deleteTodo(toDelete) {\n let deletedText = toDelete.previousElementSibling.innerText;\n let spliceStart = todoArray.indexOf(deletedText);\n toDelete.parentElement.remove();\n todoArray.splice(spliceStart, 1);\n listLength = listLength - 1;\n leftItems.innerText = listLength;\n}", "title": "" }, { "docid": "ea67d2b0801e9b9a72ac538e1186418f", "score": "0.7330036", "text": "function deleteToDoList(id) {\n // Update frequency status\n priorityStatus[toDoList[id].priority]--\n\n // Delete from todolist\n delete toDoList[id]\n\n // Hide modal\n $(`#modal-${id}`).modal('hide')\n\n // Render\n renderToDoList()\n return toDoList\n}", "title": "" }, { "docid": "11aa2eb37beb8a8893449cf52a1c94ab", "score": "0.73271984", "text": "function addDeleteTodo(deleteBtn, todo) {\n deleteBtn.addEventListener(\"click\", () => {\n // Remove todo from display\n todo.remove();\n\n // Delete corresponding projects from array with the index from todo\n const index = todo.getAttribute(\"data-index\");\n console.log(index);\n\n let projects = storage.getFromStorage(\"todo\");\n projects.splice(index, 1);\n storage.addToStorage(projects, \"todo\");\n });\n}", "title": "" }, { "docid": "1a8cd240a4fbcb3bee738f0ee7327d1e", "score": "0.732711", "text": "function deleteTask() {\n let li = this.parentElement;\n let h1 = li.querySelector(\"h1\");\n removeListElementsFromArray(h1);\n li.parentElement.removeChild(li);\n taskCount--;\n updateCounter(taskCount);\n }", "title": "" }, { "docid": "a79d1c4bab66a9f2b0d0766d09946a76", "score": "0.7320913", "text": "function deleteTask(e) {\n if (e.target.classList.contains('del-task-btn')){\n var taskID = e.target.getAttribute('data-id');\n console.log(taskID);\n quickTodo.splice(taskID, 1);\n localStorage['quickToDoKey'] = JSON.stringify(quickTodo);\n showMyTasks();\n console.log('Task with ID= '+ taskID + 'Deleted Successfully');\n }\n}", "title": "" }, { "docid": "86605273cb8c020908394c1edd1ba2fc", "score": "0.731016", "text": "function removeTodo(element){\n element.parentNode.parentNode.removeChild(element.parentNode); \n\n LIST[element.id].trash = true;\n}", "title": "" }, { "docid": "68bd2cd110235fc4f021d3f7173018bd", "score": "0.7306", "text": "function deleteTodo(position) {\n\ttodos.splice(position, 1);\n\tdisplayTodos();\n}", "title": "" }, { "docid": "3321c11d3d22101988d2e0663392b368", "score": "0.7305257", "text": "function deleteTodo(position) {\n todos.splice(position, 1);\n displayTodo();\n}", "title": "" }, { "docid": "15fead425bafadc168d03e4c477f30f7", "score": "0.7292967", "text": "function deleteTodo(key) {\n todoArray = todoArray.filter(item => item.id !== Number(key)); \n const item = document.querySelector(`[data-key='${key}']`);\n item.remove();\n displayTasks();\n}", "title": "" }, { "docid": "c7eb027d45a54c585b9c0b35a8cbd697", "score": "0.7290937", "text": "function deleteList(index,id){\n spinnerActive();\n $http.delete('http://front-test.tide.mx/api/task_lists/' + id).then(function(){\n vm.taskListData.splice(index,1);\n vm.toggleList = \"checked\";\n vm.taskListAdd = \"\";\n checkIfEmptyList();\n spinnerHide();\n })\n }", "title": "" }, { "docid": "0a003965571d7c606126a98ea3dd00bb", "score": "0.72846276", "text": "function deleteTodo(pos) {\n todos.splice(pos, 1); //Splice apaga um \"range\" de arrays, no caso estou apagamento 1 posição\n renderTodos();\n saveLocal();\n}", "title": "" }, { "docid": "429eb157957ad34054d6fddced233f73", "score": "0.72806007", "text": "function deleteItem() {\n\tvar x = event.target;\n\tif (\"LI\"===x.tagName) {\n\tx.classList.toggle(\"done\");\n\t} else if (\"LI\" === x.parentElement.tagName) {\n\t\tx.parentElement.remove();\n\t}\n\n}", "title": "" }, { "docid": "ec448f7cb6e3978589aba00d9fe3ff1f", "score": "0.7280367", "text": "function deleteToDo(index) {\n let xhr = new XMLHttpRequest();\n let url = 'https://mysterious-dusk-8248.herokuapp.com/todos/'+index;\n xhr.open('DELETE', url, true);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n}", "title": "" }, { "docid": "986a7fcda9aa0e8f47f9848c3a2e5ddf", "score": "0.7278757", "text": "DELETE_TASKLIST_ITEM(state, payload) {\n const board = state.boards.find(b => b.id == payload.boardId)\n const list = board.lists.find(l => l.id == payload.listId)\n const itemIdx = list.items.findIndex(item => item.id == payload.item.id)\n // For existing item\n if (itemIdx > -1) {\n Vue.delete(list.items, itemIdx)\n }\n }", "title": "" }, { "docid": "74beb4f24d660d3cc75ced0102453527", "score": "0.72773623", "text": "deleteTaskFromList(event) {\n\n let idToDelete = event.target.name;\n let todoTasks = this.todoTasks;\n\n \n /* Method 1 - Finding the index of the task to be deleted\n and deleting it using the below command\n */\n /*\n let todoTaskIndex;\n for(let i=0; i<todoTasks.length; i++) {\n if(idToDelete === todoTasks[i].id) {\n todoTaskIndex = i;\n }\n }\n */\n // * Comment the below line if you're using one of the two approaches given below\n //todoTasks.splice(todoTaskIndex, 1);\n\n /*\n * Un-Comment any one of the two below methods\n * which are used to directly splice or delete\n * the element from the array based on the index.\n * We're finding the index by using the findIndex()\n * function available in JavaScript\n */\n\n // * Method 2\n /*\n todoTasks.splice(\n todoTasks.findIndex(function(todoTask) {\n return todoTask.id === idToDelete;\n })\n , 1\n );\n */\n\n // * Method 3\n todoTasks.splice(todoTasks.findIndex(todoTask => todoTask.id === idToDelete), 1);\n }", "title": "" }, { "docid": "36480e55f62a64037b3cb391bd66284e", "score": "0.72711325", "text": "function deleteLi() {\n\tvar ulList = document.getElementById('listToDo');\n\tulList.removeChild(this);\n\tlocalStorage.removeItem(this.textContent);\n}", "title": "" }, { "docid": "0b2a7d6b8d343f9b6e08ba633c8d4908", "score": "0.72666204", "text": "function deleteItems(e){\n let target=e.currentTarget.parentElement.parentElement\n let id=target.dataset.id\n list.removeChild(target)\n if(list.children.length==0){\n container.classList.remove('show-list')\n }\n setDefault()\n displayAlert('to-do event deleted','danger')\n deleteStorage(id)\n}", "title": "" }, { "docid": "7b71f59deb74c67ae8c7a285b40c6e7b", "score": "0.7261508", "text": "function deleteItem(e) {\n\n if (e.target.className === \"fas fa-times\") {\n //e.target.parentElement.parentElement => list item\n e.target.parentElement.parentElement.remove()\n deleteItemFromLS(e.target.parentElement.parentElement.textContent)\n }\n e.preventDefault()\n}", "title": "" }, { "docid": "1abe40a9c345227aa071eada029923eb", "score": "0.7252211", "text": "function deleteTodo(position) {\n todosArray.splice(position, 1);\n displayTodos();\n}", "title": "" }, { "docid": "803f5879853fb0038bc1a841c9b87368", "score": "0.72508097", "text": "function remove() {\n var id = this.getAttribute('id');\n var todos = get_todos();\n //at position id, remove 1 item\n todos.splice(id, 1);\n localStorage.setItem('todo', JSON.stringify(todos));\n\n show();\n\n return false;\n}", "title": "" }, { "docid": "cd7fad0092f2431df7de6f3a84980704", "score": "0.72467154", "text": "function deleteTodo(position) {\n todos.splice(position, 1);\n // todos.splice(0,1); deleting an item\n displayTodos();\n}", "title": "" }, { "docid": "77017df70e75562da4e9796738e44f7d", "score": "0.7238041", "text": "function removeToDo(element) {\n element.parentNode.parentNode.removeChild(element.parentNode)\n LIST[element.id].trash = true;\n}", "title": "" }, { "docid": "47724ca29c4f16be61d8c728059a396a", "score": "0.7227981", "text": "function removeTodo() {\n /* `this` refers to the button clicked. The buttons parent is the actual\n * <li>-item that we want. Save that in a variable. The container \n * (incomplete or incomplete) is the parent of that <li>-item, save that too\n */\n const listItem = this.parentElement;\n const container = this.parentElement.parentElement;\n /* Remove from DOM */\n container.removeChild(listItem);\n /* Loop through the array and find the item with the same ID as the one \n * we clicked on, splice that item, removing it from the array */\n for(let i = 0; i < todoArray.length; i++) {\n if(todoArray[i].id === listItem.id){\n todoArray.splice(i, 1);\n }\n }\n}", "title": "" }, { "docid": "eaa133f62d1e561c2c5ac7e020d1395e", "score": "0.7212355", "text": "function removeToDo(element) {\n element.parentNode.parentNode.removeChild(element.parentNode);\n LIST[element.id].trash = true;\n}", "title": "" }, { "docid": "0689f57ee91f8afd525b76fe1f131dfd", "score": "0.7203914", "text": "function delList(index) {\n let getLocalStorage = localStorage.getItem(\"new todo\");\n emptyArr = JSON.parse(getLocalStorage);// converting json string to js object\n emptyArr.splice(index, 1); //to delete idividual o rparticular list\n localStorage.setItem(\"new todo\", JSON.stringify(emptyArr));\n showList();\n}", "title": "" }, { "docid": "86e26104d4e3f3a6ad855e090f7ceab5", "score": "0.72030014", "text": "deleteTodo(index) {\n this.todos.splice(index, 1)\n }", "title": "" }, { "docid": "088d47ab2a6629e990cc09be946a3bc8", "score": "0.7200023", "text": "function deleteItem(id){\n let itemsToDelete = todoItems.filter(function(item){\n return item.id === id;\n });\n\n let index = todoItems.indexOf(itemsToDelete[zeros1]);\n todoItems.splice(index, 1);\n refreshMainPage();\n}", "title": "" }, { "docid": "e09ff46b574578c76e91eeaaf0ac2186", "score": "0.71996444", "text": "deleteTodo(todoData) {\n this.allTodosRef.child(todoData.id).remove();\n }", "title": "" }, { "docid": "e7667a3cae57523d860d3de874f4363d", "score": "0.7198445", "text": "function deleteTodo(index){\n var state = getState();\n var newTodoList = [];\n for (var _index in state.todos) {\n if (_index == index) {\n continue;\n }\n newTodoList.push(state.todos[_index]);\n }\n state.todos = newTodoList;\n setState(state)\n}", "title": "" }, { "docid": "0db6ddf8a16fa50c428566f93bfa1508", "score": "0.7191029", "text": "static removeToDo(element){\n \n element.parentNode.parentNode.removeChild(element.parentNode);\n \n //you make sure to also erase from the storage that it is saved\n // and not only from the Display\n const curId = element.attributes.id.value;\n const todos = Store.getToDos();\n todos.forEach((todo, index) => {\n if(+todo.id === +curId){\n todos.splice(index, 1);\n }\n });\n\n localStorage.setItem('toDo', JSON.stringify(todos));\n }", "title": "" }, { "docid": "c749070ea67792567aae4b8b57dccad1", "score": "0.71864134", "text": "deleteTodo(index){\n const todos = this.state.todos;\n delete todos[index];\n\n this.setState({ todos });\n this.alert('Todo deleted successfully');\n }", "title": "" }, { "docid": "4cf48aa0239dec53368a0daeecba5db3", "score": "0.71811706", "text": "function delItem(e){\n if(e.target.classList.contains('delete')){\n if(confirm('Are You Sure To Delete This Item ?')){\n var li = e.target.parentElement;\n itemList.removeChild(li);\n }\n }\n}", "title": "" }, { "docid": "a2ba614c536e6a47f5178bfdc703ef28", "score": "0.718075", "text": "function removeTodo(e){\n // USE CONDITIONALS TO DELEGATE EVENT HANDLING\n if(e.target.parentElement.classList.contains('delete-item')){\n \n // CONFIRM DELETION USING WINDOW.CONFIRM METHOD\n // if(confirm('Delete this Todo Item?')){ // COMMENTED OUT CONFIRMATION COZ IT WAS ANNOYING\n\n // CALL REMOVE FROM LOCAL STORAGE FUNCTION\n removeTodoFromLocalStorage(e.target.parentElement.parentElement);\n\n e.target.parentElement.parentElement.remove(); // MOVE TO LI ELEMENT AND REMOVE FROM DOM \n let delToast = '<span>Removed ToDo Item</span><button class=\"btn-flat toast-action\" onclick=\"undoDelete(e.target.parentElement.parentElement)\">Undo</button>';\n \n M.toast({html: delToast, displayLength: toastTime});\n loadRandomPlaceholder();\n todoCounter();\n \n // }\n}}", "title": "" }, { "docid": "22f1550b651147d9575f5e753954a988", "score": "0.71635216", "text": "function cleanList() {\n \n // 1. Schritt: Suche nach Elementen in der <ul> mit data-done = true\n var taskList = document.querySelector(\"#tasklist\");\n var numberTodos = taskList.children.length;\n \n for(var i = 0; i < numberTodos; i++) {\n var done = taskList.children[i].dataset.done;\n \n if(done == \"true\") {\n firebasetools.removeContentItem(\"todos\", taskList.children[i].dataset.id, taskDeleted); \n }\n }\n \n}", "title": "" }, { "docid": "87b28caadee8c4c517bf550bcfb32f68", "score": "0.71629614", "text": "deleteListItem(ev) {\n \n //this should get the li element of the button that was clicked\n const item = ev.target.parentNode.parentNode\n const itemID = item.dataset.id\n\n //remove item from flick array\n const flickObj = this.getFlickItem(itemID)\n this.flicks.splice(this.flicks.indexOf(flickObj), 1)\n \n\n //remove item from list\n item.remove()\n\n }", "title": "" }, { "docid": "5349972a459d3992e71f257800c04e68", "score": "0.7160224", "text": "function deleteTask(e) {\n e.preventDefault();\n if (e.target.className === \"delete-btn\") {\n const deletedTask = e.target.parentElement.children[0].textContent;\n // Log of deleted task.\n console.log(`Task: ${deletedTask}, was deleted!`);\n // Removing task list item\n e.target.parentElement.remove();\n }\n}", "title": "" }, { "docid": "aee13a4f235fcb4da40a418e3641ee6b", "score": "0.7158856", "text": "function deleteTask() {\n var id = this.parentElement.getAttribute('id');\n var listitem = document.getElementById(id);\n listitem.remove();\n}", "title": "" }, { "docid": "0015f9b790a9276dfdb06758c5f2bcdf", "score": "0.71585804", "text": "function deleteTodos(position) {\n\t\ttodos.splice(position, 1);\n\t\tdisplayTodos()\n\t}", "title": "" }, { "docid": "3eb06ecd15914d4679f8927c41a3808a", "score": "0.7149771", "text": "function trashTodo(index) {\n // Remove todo from todo list\n todoList.splice(index, 1);\n\n // Re-generate todo list\n renderTodo();\n}", "title": "" } ]
53a9188b5a923df33dda605c0b2b9c70
a method to reset the state properties and unmount the Popup component
[ { "docid": "d7ff7f3fe121e694e758f9b09b84f302", "score": "0.65255713", "text": "hidePopup() {\n return this.setState({\n popUpStatus: false,\n activeTechCompany: null\n });\n }", "title": "" } ]
[ { "docid": "efd7601631bb714c9b524be481bc8cac", "score": "0.6988829", "text": "reset() {\n\t\tresetState(privateProps.get(this))\n\t}", "title": "" }, { "docid": "27e959f4979c8beb891f2010d825c436", "score": "0.6943382", "text": "resetDialogState() {\n \tvar newstate = Object.assign(this.state);\n \t\n \tnewstate.showDelete = false;\n \tnewstate.show = false;\n\t\t\n \tthis.setState(newstate);\n\t }", "title": "" }, { "docid": "3aacff3a754a53d78c924b00757fd957", "score": "0.67679757", "text": "resetPopover() {\n setOpenPopover(false);\n setUserInputValue('');\n setPopoverError('');\n }", "title": "" }, { "docid": "5034576073a39ac56e475185d74e4c06", "score": "0.676052", "text": "componentWillUnmount() {\n this.props.cleanStateValues();\n }", "title": "" }, { "docid": "2c7eadd92846f747e5a2e9998eab1dd1", "score": "0.6745435", "text": "reset() {\r\n this.changeState('normal');\r\n }", "title": "" }, { "docid": "c48d64ef2de3aa89b23918a0ad77c816", "score": "0.67448413", "text": "function reset() {\n\t\tsetState(null);\n\t}", "title": "" }, { "docid": "5e624759e770d569f21991c1ff683ecb", "score": "0.67407477", "text": "reset() {\r\n this.state = 'normal';\r\n }", "title": "" }, { "docid": "e37ac0081ee0a911f0a0fc5772795ec9", "score": "0.6731864", "text": "closePopup() {\n\t\tthis.setState({\n\t\t\tpopupActive: false\n\t\t});\n\t}", "title": "" }, { "docid": "ce92ace315a3d43fbfaa2f475223dede", "score": "0.6711252", "text": "componentWillUnmount(){\n this.props.cleanStateValues();\n }", "title": "" }, { "docid": "80e07479fc00384bb41267e1bd9d4b57", "score": "0.6695484", "text": "reset() {\n this._setState();\n this._storeState();\n }", "title": "" }, { "docid": "ac7de94cb6c9d9f66152ea25de82444d", "score": "0.6591356", "text": "resetState() {\n \n this.props.resetRequirementsState(); \n this.props.resetBusinessState();\n this.props.resetTechnicalState();\n this.props.resetPMOEvaluationState();\n this.props.resetROIRealizedState();\n \n }", "title": "" }, { "docid": "4a2eefbd8313240beb41866fe03c1398", "score": "0.6568789", "text": "componentWillUnmount(){\n this.props.onResetState();\n }", "title": "" }, { "docid": "2d3e99daad3366ff70f7a4d86b24301e", "score": "0.6527396", "text": "reset() {\n this.setState(defaultState);\n }", "title": "" }, { "docid": "91f177b9e144246cc48c1a4d8d210133", "score": "0.651776", "text": "function removePopupAndResetState(instance,container,isToast,onAfterClose){if(isToast){triggerOnAfterCloseAndDispose(instance,onAfterClose)}else{restoreActiveElement().then(function(){return triggerOnAfterCloseAndDispose(instance,onAfterClose)});globalState.keydownTarget.removeEventListener(\"keydown\",globalState.keydownHandler,{capture:globalState.keydownListenerCapture});globalState.keydownHandlerAdded=false}if(container.parentNode){container.parentNode.removeChild(container)}if(isModal()){undoScrollbar();undoIOSfix();undoIEfix();unsetAriaHidden()}removeBodyClasses()}", "title": "" }, { "docid": "98189d3c205b1cb760a7788a1a15e49b", "score": "0.6514841", "text": "destroyPopup() {\n this.$popupContainer.off();\n this.$popupContentContainer.off();\n this.$popupContainer.remove();\n }", "title": "" }, { "docid": "36cea07f7603a313d2ef1630a444f49a", "score": "0.6497828", "text": "reset() {\n this.visible_ = false;\n this.focusOnHide_ = null;\n if (this.clearTransition_) {\n this.clearTransition_();\n }\n }", "title": "" }, { "docid": "3b2baef8b8a268de3a851b0d7f9f60d5", "score": "0.6489647", "text": "clear() {\n\t\tlet states = this.constructor.RENDER_STATES;\n\t\tif ( this._state <= states.NONE ) return;\n\t\tthis._state = states.CLOSING;\n\n\t\t// Unbind\n\t\tthis.object = null;\n\t\tthis.element.hide();\n\t\tthis._element = null;\n\t\tthis._state = states.NONE\n\t}", "title": "" }, { "docid": "0664234449c117f9bea8a97f337bfe38", "score": "0.6471457", "text": "onClose() {\n this.setState({ isPropertyDialogOpen: false });\n }", "title": "" }, { "docid": "042ad7ed2dfaad85b9ce64b51d58a7c4", "score": "0.64699227", "text": "resetState(nameProp) {\n this.props.click();\n }", "title": "" }, { "docid": "127aa3bb93501f23ebfc04bb5f06c881", "score": "0.6463325", "text": "clearState() {\n this.events = null;\n }", "title": "" }, { "docid": "e389b8e80d4e9cc2498e6c8d608b929f", "score": "0.6454468", "text": "_destroyPopup() {\n if (this._popupRef) {\n this._popupRef.dispose();\n this._popupRef = this._popupComponentRef = null;\n }\n }", "title": "" }, { "docid": "820b65251dcd2d5bd66ebacd5142579c", "score": "0.6453814", "text": "_resetState() {\n this.setState(this.initialState);\n }", "title": "" }, { "docid": "c012075c2536435a1c1f50930b5c9191", "score": "0.64486855", "text": "clear() {\n\t let states = this.constructor.RENDER_STATES;\n\t if ( this._state <= states.NONE ) return;\n\t this._state = states.CLOSING;\n\n\t // Unbind\n\t this.object = null;\n\t this.element.hide();\n\t this._element = null;\n this._state = states.NONE\n }", "title": "" }, { "docid": "421aef8afde70961fb39a7a047adec72", "score": "0.64425665", "text": "reset() {\n this.state.sortby=\"none\"\n this.state.cap=\"all\"\n this.state.coast=\"all\"\n this.setState((state, props) => { return {}; })\n }", "title": "" }, { "docid": "5980ce71c6cbb06925d804cba6d33d03", "score": "0.64328545", "text": "closeModal() {\r\n this.setState({popup: false});\r\n }", "title": "" }, { "docid": "2b726f5eec97addb4ea9e00e6dc6c8c2", "score": "0.6426136", "text": "componentWillUnmount() {\n try {\n this.popup.close()\n clearInterval(this.timer)\n } catch (e) {}\n }", "title": "" }, { "docid": "0f5fd1a11c0d5c2bce0a4cbe3775c026", "score": "0.64241344", "text": "closePopup(){\n this.popupopened=false;\n }", "title": "" }, { "docid": "bf108b1fff67a9c1e78eca7e6f6a1386", "score": "0.64224213", "text": "managerReset() {\n this.opened = false;\n }", "title": "" }, { "docid": "460f343aa1cd01721be4f207fd6956f5", "score": "0.6421472", "text": "_dismissPopup() {\n this.props.hideAddBox();\n this.setState({ newItemName: '' });\n }", "title": "" }, { "docid": "acf6bee4c66884f8d2e861b6fe2775b4", "score": "0.6413504", "text": "clearState() {\n super.clearState();\n this.profile = null;\n }", "title": "" }, { "docid": "e4eae459fa7eab5345cf158ba7240ca6", "score": "0.640832", "text": "reset() {\r\n this.state = this.initial;\r\n this.clearHistory();\r\n }", "title": "" }, { "docid": "ba075f00aa4f9811e2f836e03af36b57", "score": "0.6404637", "text": "resetAssistant() {\n this.callerTranscript.current.updateTranscript('')\n this.calleeTranscript.current.updateTranscript('')\n this.setState({\n firstSOP: DEFAULT_SOP_BUTTON_VALUE,\n secondSOP: DEFAULT_SOP_BUTTON_VALUE,\n thirdSOP: DEFAULT_SOP_BUTTON_VALUE,\n selectedSOP: '',\n selectedJurisdiction: ''\n })\n this.jurisdictionDropdown.current.updateJurisdiction('')\n clearInterval(this.timerID)\n }", "title": "" }, { "docid": "5ff757782a721443807a166af147ff74", "score": "0.6401135", "text": "componentWillUnmount() {\n\t\tthis.props.setRecipesSelection(null);\n\t}", "title": "" }, { "docid": "989e1d21119784a5c52ca392fb1d5fb6", "score": "0.6401123", "text": "reset(state) {\n Object.keys(state).forEach((key) => {\n Object.assign(state[key], null);\n });\n }", "title": "" }, { "docid": "a6f19562522f8861fb25e9f0fbea26d0", "score": "0.63663167", "text": "componentWillUnmount() {\n ReactDOM.unmountComponentAtNode(this.node);\n this.modal.remove();\n delete this.modal;\n }", "title": "" }, { "docid": "842db003017f0cfd855cbccddc30805c", "score": "0.6364554", "text": "clearState() {\n this.setState({\n display: 0,\n current: false,\n storage: false,\n operator: false\n })\n }", "title": "" }, { "docid": "ae0d2962cd2283d9485d10180699a6da", "score": "0.6354105", "text": "reset() {\r\n this.activeState = 'normal';\r\n }", "title": "" }, { "docid": "c29af2c9270f46540c54ce4f55cd4c38", "score": "0.63332194", "text": "resetState() {\n this.setState({\n isVisible: false,\n typeOfEvent: \"\",\n selectedDate: null,\n selectedTime: null,\n isShowDateTimePicker: false,\n mode: 'date',\n location: '',\n userName: '',\n errorTypeOfEvent: '',\n errorLocation: ''\n })\n }", "title": "" }, { "docid": "a9bbd5842fe9d18975991dd5b0598f01", "score": "0.63156754", "text": "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n setCurrentStyleSanitizer(null);\n resetAllStylingState();\n}", "title": "" }, { "docid": "a9bbd5842fe9d18975991dd5b0598f01", "score": "0.63156754", "text": "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n setCurrentStyleSanitizer(null);\n resetAllStylingState();\n}", "title": "" }, { "docid": "a9bbd5842fe9d18975991dd5b0598f01", "score": "0.63156754", "text": "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n setCurrentStyleSanitizer(null);\n resetAllStylingState();\n}", "title": "" }, { "docid": "a9bbd5842fe9d18975991dd5b0598f01", "score": "0.63156754", "text": "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n setCurrentStyleSanitizer(null);\n resetAllStylingState();\n}", "title": "" }, { "docid": "09caef92eeeb4df41cae0c2c0db49ac4", "score": "0.630903", "text": "function resetPopup(){\n chrome.storage.local.set({'popup_activated': false}, function() {\n });\n }", "title": "" }, { "docid": "0d3ea9bbcf573f487c14b1497204c500", "score": "0.6296873", "text": "handleFormPopupClose() {\n this.setState({ savePopupShown: false });\n }", "title": "" }, { "docid": "4bb2938876471ecda888d08d16434b6e", "score": "0.6287466", "text": "reset() {\r\n this.activeStateIndex = 0;\r\n }", "title": "" }, { "docid": "cca506b6eee59a24a3d7d492c0f3de65", "score": "0.62822694", "text": "reset() {\n this.setState(initialState)\n }", "title": "" }, { "docid": "3ce998f8109c3125e81d2f9b46a1f5bf", "score": "0.6280257", "text": "function cancelPopupAction () {\n setPopupInfo({})\n }", "title": "" }, { "docid": "d8d8ad4e916ae81217c140e3b4958dda", "score": "0.62711656", "text": "reset() {\r\n this.currState = this.initial;\r\n }", "title": "" }, { "docid": "3bd939a12637bd5cb495229e804f7ec2", "score": "0.62648314", "text": "function _resetState() {\n eventManager.clearEvents();\n pressedKeys.clear();\n refCount = 0;\n}", "title": "" }, { "docid": "4413d2dfc47ec67e871f57d4cd3e70cb", "score": "0.6257489", "text": "reset() {\r\n\t\tthis.currentState = this.initialState;\r\n\t}", "title": "" }, { "docid": "435f42a0d5f56ff8d60265d8c458550c", "score": "0.6253513", "text": "clear(){\n \nthis.setState({\n display:\"0\",\n Input:'0',\n \n \n dotStatus:false\n})\n}", "title": "" }, { "docid": "617bcf9121664550075a6bd60b515a4c", "score": "0.62427884", "text": "componentWillUnmount(){\n this.props.setOpt(this.state)\n }", "title": "" }, { "docid": "8964e51db5d96259caa7eaae73093d66", "score": "0.62299305", "text": "handleClose() {\r\n this.setState(initialState);\r\n }", "title": "" }, { "docid": "2621f1b4e74ff29fa2ab70cd004e9f36", "score": "0.6213801", "text": "clearScreen() {\r\n this.setState({ orFilterText: \"\" });\r\n this.setState({ andFilterText: \"\" });\r\n this.setState({ classEvents: [] });\r\n this.setState({ filteredClassEvents: [] });\r\n this.setState({ warningList: [] });\r\n this.setState({ mondayOfFirstFullWeek: \"\" });\r\n this.setState({ fridayOfFirstFullWeek: \"\" });\r\n }", "title": "" }, { "docid": "6f23449163e5a578628a5309ed1449a8", "score": "0.6209375", "text": "reset() {this.state = this.config[\"initial\"];}", "title": "" }, { "docid": "47fd05cefa431d051fb7621930d6ab26", "score": "0.62073326", "text": "@action reset() {\n this.sideBarComp = null;\n this.headerComp = null;\n this.bodyComp = null;\n }", "title": "" }, { "docid": "46f0fa41bb641e565b57494c291cfa3e", "score": "0.62063724", "text": "reset() {\n clearInterval(this.timer);\n this.setState(this.initialState);\n }", "title": "" }, { "docid": "02002e21a57159ecadd6ab6a083c6ef0", "score": "0.619091", "text": "function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "02002e21a57159ecadd6ab6a083c6ef0", "score": "0.619091", "text": "function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "9a9e18fa23b26699c92f24fac5b15f3b", "score": "0.61855763", "text": "reset() {\r\n Object.keys(this.$props)\r\n .forEach((key) => this.$props[key].reset());\r\n return this;\r\n }", "title": "" }, { "docid": "ed5649964a4b62f03e385685daa4b7d8", "score": "0.6182747", "text": "ResetPageState(stateval) {\n stateval.setState({ StyleJSON: stateval.state.StyleJSON });\n }", "title": "" }, { "docid": "c8193d3c079cd9131b587cbb63d3e7a8", "score": "0.61778545", "text": "resetState() {\n this.setState({\n isGiikerConnected: false,\n giikerBattery: null,\n giikerMoveCount: null,\n devices: [],\n moves: \"\",\n giikerState: \"\",\n devicesModalVisible: false\n });\n }", "title": "" }, { "docid": "2c5db22164f67cfefa2db19706177c15", "score": "0.61710197", "text": "reset() {\n this.unbind();\n }", "title": "" }, { "docid": "1e588e3bba8d7261a54ae129b1add07e", "score": "0.616154", "text": "resetState() {\n this.setState(INITIAL_STATE)\n }", "title": "" }, { "docid": "631bf5197a6512a7b95c12c264be7c9f", "score": "0.61538744", "text": "reset() {\n this.setState({\n location: '',\n });\n }", "title": "" }, { "docid": "e6f960c3b649c86d11f1d9740f866df6", "score": "0.6147991", "text": "onDestroy(){\n // wrap in timeout to avoid errors\n // https://github.com/facebook/react/issues/3298\n setTimeout(ReactDOM.unmountComponentAtNode, 0, this.props.el);\n $(this.props.el).remove();\n Factory.destroy(this);\n // restore document padding to 0 to prevent page pop, overlay version only\n if (this.props.display === DISPLAY.MODES.OVERLAY) {\n this.restoreDocumentPadding();\n }\n }", "title": "" }, { "docid": "1b5adf86aeac84fa7a395089206cf657", "score": "0.61470634", "text": "reset() {\r\n this.state = this.config.initial;\r\n }", "title": "" }, { "docid": "8a028bb2e468ab3a805604ecd90ec806", "score": "0.61448395", "text": "function resetStateAfterCall() {\n state.popValues(gl);\n if (!scissorTestWasEnabled) {\n gl.disable(gl.SCISSOR_TEST);\n }\n if (framebuffer) {\n // TODO - was there any previously set frame buffer?\n // TODO - delegate \"unbind\" to Framebuffer object?\n framebuffer.unbind();\n }\n }", "title": "" }, { "docid": "cf470622ded97f81a95be35ebcafeb1c", "score": "0.6138878", "text": "reset() {\n this.setState(JSON.parse(JSON.stringify(this.initialState)));\n }", "title": "" }, { "docid": "a1cdd2f20b2c6a5faa118ed17d2d6ae5", "score": "0.61369133", "text": "closeCleanupDialog() {\n this.setState({\n cleanupDialog: false\n });\n }", "title": "" }, { "docid": "387a10de4b58f9008d7270f5ce097f17", "score": "0.61207765", "text": "reset() {\n\t\tthis.isDown = false;\n\t}", "title": "" }, { "docid": "b3ec3f9ef8d21d7bfc3d1363fe3a6fc0", "score": "0.6111958", "text": "reset() {\r\n this.state=this.config.initial;\r\n }", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "a67febcdca5ee92317f3875f058ecf20", "score": "0.61064434", "text": "function removePopupAndResetState(instance, container, isToast, onAfterClose) {\n if (isToast) {\n triggerOnAfterCloseAndDispose(instance, onAfterClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerOnAfterCloseAndDispose(instance, onAfterClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n}", "title": "" }, { "docid": "02e50bd252359d7e74dd4f58b97f22f5", "score": "0.6099347", "text": "destroyPopup(){\n\t\tthis.popupBackground.destroy();\n\t\tthis.buttonX.destroy();\n\t\tisAlive = false;\n\t\tbuttonPlay.inputEnabled = true;\t// Re-enables the play button\n\t}", "title": "" }, { "docid": "2c8792385acb4807005080236d37f71d", "score": "0.6097578", "text": "componentWillUnmount() {\n this.props.clearCurrentTarget();\n }", "title": "" }, { "docid": "1fc1b7b602ae4e7179ad7c607ef7fdb3", "score": "0.60852844", "text": "reset() {\r\n this.state = this.config.initial;\r\n this.clearHistory();\r\n }", "title": "" }, { "docid": "537ab7989de4b92a173f1c38497f79ba", "score": "0.60826886", "text": "reset() {\r\n this.currentState=this.initial;\r\n }", "title": "" }, { "docid": "1a25b9248a07898a77ab03a81f30f20e", "score": "0.607366", "text": "reset() {\r\n this.previousState = this.currentState;\r\n this.currentState = this.initial;\r\n }", "title": "" }, { "docid": "48bd81fda0e26a08d07437c13bab8582", "score": "0.6061403", "text": "toggleModalVisibility() {\n this.setState({ isModalVisible: false });\n this.resetButton();\n }", "title": "" }, { "docid": "339804f75798edb7f9f556d4e4d584f8", "score": "0.6061103", "text": "reset() {\r\n this._currentState = this._initialState;\r\n this.clearHistory();\r\n }", "title": "" }, { "docid": "e30d9121f7f0ea80d990e2722c9b0d8d", "score": "0.6061092", "text": "clear() {\n let defaultDisplay = {\n current: \"\",\n history: null\n }\n\n this.setState({\n display: defaultDisplay,\n firstNum: null,\n operator: null,\n isFinal: false\n })\n }", "title": "" }, { "docid": "9b744a46356c1eba38b98ef40f1e52e3", "score": "0.6059007", "text": "resetState() {\n\t\tthis.alive = true;\n\t\tthis.registered = false;\n\t\tif (this.type === 'hold') {\n\t\t\tthis.active = false;\n\t\t\tthis.held = false;\n\t\t\tthis.lastRelease = -1;\n\t\t}\n\t}", "title": "" }, { "docid": "a3b8865fddbe0ec145eb00a36a6f0390", "score": "0.60496926", "text": "openCleanupDialog() {\n this.setState({\n cleanupDialog: true\n });\n }", "title": "" }, { "docid": "7192e63da4d4314413cd6e592402a6ab", "score": "0.60485995", "text": "componentWillUnmount() {\n modalRoot.removeChild(this.container);\n }", "title": "" }, { "docid": "3e99b9b99b56ea0f2a2d8bb82f4c5fbf", "score": "0.604322", "text": "clearState() {\n this._isCompact = false;\n this._personDetails = null;\n }", "title": "" }, { "docid": "5d29d4c433508258a56a3ccb712216bb", "score": "0.60376763", "text": "function resetComponentState() {\n isParent = false;\n previousOrParentTNode = null;\n elementDepthCount = 0;\n bindingsEnabled = true;\n}", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" }, { "docid": "999429c08bae2d89940bfda997f73a90", "score": "0.6035801", "text": "function removePopupAndResetState(instance, container, isToast$$1, didClose) {\n if (isToast$$1) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement().then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n\n if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) {\n container.parentNode.removeChild(container);\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n undoIEfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }", "title": "" } ]
1e6d973239ef5e3ccbe52ab9bde15c32
START_CUSTOM_CODE_homeModel Add custom code here. For more information about custom code, see
[ { "docid": "3d5fd3c44c785eef690de1391f938bc3", "score": "0.0", "text": "function fun_checkstoreinfo(username, password) { \n var storelogin = new kendo.data.DataSource({\n transport: {\n read: {\n url: \"https://api.everlive.com/v1/zn4pzp5j7joaj6hq/Invoke/SqlProcedures/USP_Mobile_LoginCheck_GetTestDetailsByStoreId_GetProductDetails\",\n type: \"POST\",\n dataType: \"json\",\n data: {\n \"StoreUserName\": username, \"StorePassword\": password\n }\n }\n },\n schema: {\n parse: function (response) {\n var getstorelogin = response.Result.Data; \n return getstorelogin;\n }\n }\n });\n \n $(\"#btnsignin\").hide();\n $(\"#dvstartsigninprocess\").show(); \n storelogin.fetch(function () {\n var data = this.data(); \n if (parseInt(data[0][0].STORE_MASTER_ID) > 0) { \n $(\"#btnsignin\").show();\n $(\"#dvstartsigninprocess\").hide();\n localStorage.setItem(\"storeid\", data[0][0].STORE_MASTER_ID); //store details \n fun_checktestinfo(data[1]);//test details \n getallproductdetails(data[2]); // product detalils \n //redirect dashboard page \n app.mobileApp.navigate(\"components/storedashboard/view.html\");\n }\n else { \n $(\"#btnsignin\").show();\n $(\"#dvstartsigninprocess\").hide();\n localStorage.setItem(\"storeid\", 0);\n $(\"#h3errormessage\").html('Invalid credentials!');\n $(\"#modalview-error\").kendoMobileModalView(\"open\");\n } \n });\n \n}", "title": "" } ]
[ { "docid": "39425b7cd33871612d1620f9ef7fbe9c", "score": "0.5533722", "text": "processGoHome() {\n window.todo.model.goHome();\n }", "title": "" }, { "docid": "126c03226f52b6fc0063179fcd6f6746", "score": "0.52594566", "text": "function Home() {\n // TODO\n}", "title": "" }, { "docid": "cd1d0288108fd4b093f36716ac9eb8eb", "score": "0.5198805", "text": "function _Model() {\n\t\t//console.log(\"Model ready\");\n\t}", "title": "" }, { "docid": "2ccbc9f41e4ea3ae1e09d1161eaf0ed2", "score": "0.51714265", "text": "function onDidCreateModel(listener){return standaloneServices_1.StaticServices.modelService.get().onModelAdded(listener);}", "title": "" }, { "docid": "1a959507f870f4cbb6d2ccc8f7419dfe", "score": "0.5167045", "text": "function generateCode() {\n setShowScript(true);\n }", "title": "" }, { "docid": "bba9bdad34e064147d10acd119f3a49c", "score": "0.5125444", "text": "onCustomCodeChange() {\n this.set('content', this.get(keyCustomCode));\n }", "title": "" }, { "docid": "30a7b5a6d088eb5f1d31146a16935915", "score": "0.51226515", "text": "static create(model) {\n return internal.instancehelpers.createElement(model, ShowHomePageAction);\n }", "title": "" }, { "docid": "7c9d15f7025a4cd5489328a72c0c2e75", "score": "0.5114632", "text": "ready(model) {\n return true ;\n }", "title": "" }, { "docid": "72738bbee5b6fd3d19a35c847a68166c", "score": "0.5064584", "text": "onCodeButtonClick(e) {\n e.preventDefault();\n \n // use active view's component name as key in 'this.code' cache\n const activeViewName = this.activeView.id.replace('view-', '');\n\n // Intro is not a component, don't show code for intro\n if (activeViewName === 'intro') {\n e.target.blur();\n return false;\n };\n \n // language of code about to be displayed; one of 'html', 'css', 'scss', 'sass', or 'js'\n // if js is already selected for a component that has no js, default to html\n this.activeCode = e.target.dataset.code === 'js'\n ? (this.components[activeViewName].init ? e.target.dataset.code : 'html')\n : e.target.dataset.code;\n\n this.updateModalCode(activeViewName, this.activeCode);\n }", "title": "" }, { "docid": "71dd642edf57dabc19ab68f022920b2c", "score": "0.50504744", "text": "function onStartInteraction(config) {\n statusUpdater.start();\n ledUpdater.start();\n virtualmodelUpdater.start();\n\n // Initialize the Virtual Model\n var command = sprintf(\"VIRTUALWORLD_MODEL %s\", $rootScope.VIRTUALMODEL);\n Weblab.sendCommand(command, onVirtualModelSetSuccess, onVirtualModelSetFailure);\n } // !onStartInteraction", "title": "" }, { "docid": "34fed66ac3b995204ceb790a3d8b302c", "score": "0.50272435", "text": "function initCustomCode() {\n // Build the custom code tab\n ws.dom.ap(customCodeSplitter.top, customCodeBox);\n ws.dom.ap(customCodeSplitter.bottom, customCodeDebug);\n\n function setCustomCode() {\n ws.emit('UIAction', 'CustomCodeUpdate');\n customCodeDebug.innerHTML = '';\n if (chartPreview) {\n \n chartPreview.on('LoadCustomCode', function(options) {\n var code;\n\n if (chartPreview) {\n code = chartPreview.getCustomCode() || '';\n if (codeMirrorBox) {\n codeMirrorBox.setValue(code);\n } else {\n customCodeBox.value = code;\n }\n }\n });\n\n chartPreview.on('UpdateCustomCode', function() {\n chartPreview.setCustomCode(\n codeMirrorBox ? codeMirrorBox.getValue() : customCodeBox.value,\n function(err) {\n customCodeDebug.innerHTML = err;\n }\n );\n });\n\n chartPreview.setCustomCode(\n codeMirrorBox ? codeMirrorBox.getValue() : customCodeBox.value,\n function(err) {\n customCodeDebug.innerHTML = err;\n }\n );\n }\n }\n\n var timeout = null;\n\n if (typeof window['CodeMirror'] !== 'undefined') {\n codeMirrorBox = CodeMirror.fromTextArea(customCodeBox, {\n lineNumbers: true,\n mode: 'application/javascript',\n theme: ws.option('codeMirrorTheme')\n });\n codeMirrorBox.setSize('100%', '100%');\n codeMirrorBox.on('change', function() {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n setCustomCode();\n }, 500);\n });\n } else {\n ws.dom.on(customCodeBox, 'change', function() {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n setCustomCode();\n }, 500);\n });\n }\n }", "title": "" }, { "docid": "9126742ddeb7d6d019a760621d8beb7a", "score": "0.49731475", "text": "function ModelManager() {\n\n}", "title": "" }, { "docid": "86e7f687b8085aae5bcb10f8925ca2cf", "score": "0.49630117", "text": "createCodeEventHandler () {\n return (event) => {\n const theme = event.detail.theme\n if (!LanguageUtils.isInstanceOf(theme, Theme)) {\n Alerts.errorAlert({ text: 'Unable to create new code, theme is not defined.' })\n } else {\n let newCode // The code that the user is creating\n // Ask user for name and description\n Alerts.multipleInputAlert({\n title: 'You are creating a new code for theme: ',\n html: '<input autofocus class=\"formCodeName swal2-input\" type=\"text\" id=\"codeName\" type=\"text\" placeholder=\"Code name\" value=\"\"/>' +\n '<textarea class=\"formCodeDescription swal2-textarea\" data-minchars=\"1\" data-multiple rows=\"6\" id=\"codeDescription\" placeholder=\"Please type a description that describes this code...\"></textarea>',\n preConfirm: () => {\n const codeNameElement = document.querySelector('#codeName')\n let codeName\n if (_.isElement(codeNameElement)) {\n codeName = codeNameElement.value\n }\n const codeDescriptionElement = document.querySelector('#codeDescription')\n let codeDescription\n if (_.isElement(codeDescriptionElement)) {\n codeDescription = codeDescriptionElement.value\n }\n newCode = new Code({ name: codeName, description: codeDescription, theme: theme })\n },\n callback: () => {\n const newCodeAnnotation = newCode.toAnnotation()\n window.abwa.annotationServerManager.client.createNewAnnotation(newCodeAnnotation, (err, annotation) => {\n if (err) {\n Alerts.errorAlert({ text: 'Unable to create the new code. Error: ' + err.toString() })\n } else {\n LanguageUtils.dispatchCustomEvent(Events.codeCreated, { newCodeAnnotation: annotation, theme: theme })\n }\n })\n }\n })\n }\n }\n }", "title": "" }, { "docid": "45df61693c8b6c71b896cd3bdd315b59", "score": "0.4937789", "text": "function createModel() {\n\n var model = {};\n model.mainRegion = content.page.regions['main'];\n model.sitePath = site['_path'];\n model.currentPath = content._path;\n model.pageTitle = getPageTitle();\n model.metaDescription = getMetaDescription();\n model.menuItems = libs.menu.getMenuTree(3).menuItems;\n model.siteName = site.displayName;\n\n return model;\n }", "title": "" }, { "docid": "b9413b3579cf25bfa3cfdb317db18ff5", "score": "0.49317175", "text": "function createCode() {}", "title": "" }, { "docid": "7a43bd2eeb430df3e73396ce06e994a3", "score": "0.4906087", "text": "function addScript() {\n let gtmCode = Site.getCurrent().getCustomPreferenceValue('GtmCode');\n let localeObj = Locale.getLocale(request.locale);\n let userAuthenticated = (session.customer.authenticated === true) ? '1' : '0';\n let country = localeObj.country.toUpperCase(); // ex: US\n let locale = localeObj.ID; // ex: en_US\n let language = localeObj.language; // ex: en\n let instanceType = '';\n\n switch (System.instanceType) {\n case System.DEVELOPMENT_SYSTEM:\n instanceType = 'development';\n break;\n case System.STAGING_SYSTEM:\n instanceType = 'staging';\n break;\n case System.PRODUCTION_SYSTEM:\n instanceType = 'production';\n break;\n default:\n break;\n }\n\n app.getView({\n GtmCode: gtmCode,\n Data: {\n Country: country,\n Locale: locale,\n Language: language,\n UserAuthenticated: userAuthenticated,\n InstanceType: instanceType\n }\n }).render('gtmcode');\n}", "title": "" }, { "docid": "4c455005b687b227991f97edcde71a92", "score": "0.49050185", "text": "function Home(){\n\n}", "title": "" }, { "docid": "b1e474239bb79e3fb1b7da0f45353546", "score": "0.49002278", "text": "onCodePathStart(codePath, node) {\n funcInfo = {\n upper: funcInfo,\n codePath,\n hasReturn: false,\n hasReturnValue: false,\n messageId: \"\",\n node\n };\n }", "title": "" }, { "docid": "30261c57cc9bc4b39fee9f6fb78bb21a", "score": "0.48822126", "text": "function modelReady() {\r\n //select('#modelStatus').html('Base Model (MobileNet) Loaded!');\r\n classifier.load('./model/isl/A/model.json', function () {\r\n select('#modelStatus').html('Custom Model Loaded!');\r\n });\r\n}", "title": "" }, { "docid": "8e3678d23dd3d656515a6df995db7cd1", "score": "0.48695338", "text": "function loadModel() {\n }", "title": "" }, { "docid": "ae4bf60e09f34ad4e88b395699f62a83", "score": "0.48551393", "text": "function AnonModel() {}", "title": "" }, { "docid": "e4c8eeb30b6c7f4809a814da96b4b625", "score": "0.4854", "text": "function initModel () {\n\t\t\tvm.model = {\n\t\t\t\tpopular: [],\n\t\t\t\tsearch:[],\n\t\t\t\tconfig: {\n\t\t\t\t\tcategories: {},\n\t\t\t\t\tshowPopular: 12,\n\t\t\t\t\tshowSearch: 12\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (!vm.model.config.key) {\n\t\t\t\thomeService.getKey(postInit);\n\t\t\t} else {\n\t\t\t\tpostInit(vm.model.config.key);\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "3361e2a603aeff01d5105be8784a5717", "score": "0.48479295", "text": "function refreshDataInModelSuasanPham() {\n}", "title": "" }, { "docid": "5333d27e88de4c22e4dc15a2948a117c", "score": "0.48426002", "text": "onCodePathStart(codePath, node) {\n funcInfo = {\n upper: funcInfo,\n codePath,\n hasReturn: false,\n hasReturnValue: false,\n message: '',\n node\n };\n }", "title": "" }, { "docid": "bcf5fd503afafc42e2cd4a12f593ac51", "score": "0.4837007", "text": "function main() {\n\n // Step 1: Load Your Model Data\n // The default code here will load the fixtures you have defined.\n // Comment out the preload line and add something to refresh from the server\n // when you are ready to pull data from your server.\n CourseCoordinator.server.preload(CourseCoordinator.FIXTURES) ;\n OrionFw.server.preload(OrionFw.FIXTURES); \n\n // TODO: refresh() any collections you have created to get their records.\n // ex: Coursecoordinator.contacts.refresh() ;\n\n // Step 2: Instantiate Your Views\n // The default code just activates all the views you have on the page. If\n // your app gets any level of complexity, you should just get the views you\n // need to show the app in the first place, to speed things up.\n SC.page.awake() ;\n\n // Step 3. Set the content property on your primary controller.\n // This will make your app come alive!\n\n // TODO: Set the content property on your primary controller\n // ex: Coursecoordinator.contactsController.set('content',Coursecoordinator.contacts);\n var courses = OrionFw.Course.collection();\n courses.set('orderBy',['name ASC']);\n courses.refresh();\n CourseCoordinator.CM_courseListController.set('content',courses);\n \n var newcourses = OrionFw.Course.collection();\n newcourses.set('orderBy',['name ASC']);\n newcourses.set('conditions', { 'guid' : ''});\n newcourses.refresh();\n CourseCoordinator.CM_subjectAlsoInCourseListController.set('content',newcourses);\n \n var subjects = OrionFw.Subject.collection();\n subjects.set('orderBy',['name ASC', 'serialnumber ASC']);\n subjects.set('conditions', { 'guid' : '' });\n subjects.refresh();\n CourseCoordinator.CM_subjectsInCourseListController.set('content',subjects);\n}", "title": "" }, { "docid": "b684191833fffd3b5ff40aaa82916e39", "score": "0.48279098", "text": "function codeUiValidateAndSetSourceCode(code){\n\tcodeUiUpdateFormData();\n\tif (code){\n\t\t//choose correct extension type\n\t\tif (code.indexOf(\"implements ServiceInterface\") > 0){\n\t\t\tcodeUiSetExtensionType(\"smart-service\");\n\t\t}\n\t\t//replace package?\n\t\tif (extensionType == \"smart-service\"){\n\t\t\tcode = code.replace(/(^package .*\\.)(.*?)(;)/mi, \"$1\" + ($('#code-ui-id').val() || \"[your_user_ID]\") + \"$3\");\n\t\t}\n\t\tcodeEditor.setValue(code);\n\t}\n}", "title": "" }, { "docid": "607489060034b14ca05353e4dedf5c8a", "score": "0.48226315", "text": "function onRunModel() {\n\t console.log('onRunModel: ' + currentModelId);\n\n\t // Reset any previous runs\n\t onResetModel();\n\n\t $('.ui-panel').panel('close');\n\n\t document.getElementById('runModel').disabled = true;\n\t document.getElementById('resetModel').disabled = true;\n\t document.getElementById('pausePlayExecution').disabled = false;\n\t document.getElementById('stepExecution').disabled = true;\n\t document.getElementById('addModel').disabled = true;\n\t stepExecution = false;\n\t pauseExecution = false;\n\n\t var start = {\n\t command: 'start'\n\t };\n\n\t start.gw = generateJsonGraph();\n\t doSend(JSON.stringify(start));\n\t}", "title": "" }, { "docid": "e7a697225ff6ae2c822631f0478b1a26", "score": "0.481624", "text": "function startInfinityCustomFunctions() {\n\t\tsetReworkStyleCSS();\n\t\tloadTitlePhoneNumber();\n\t}", "title": "" }, { "docid": "a5331b6a6b8d3b1518b3fbb55408f3fe", "score": "0.48145825", "text": "handleSave() {\n const { editor, target } = this;\n const code = this.getCodeViewer().getContent();\n target.set(keyCustomCode, code);\n target.trigger(`change:${keyCustomCode}`);\n editor.Modal.close();\n return false;\n }", "title": "" }, { "docid": "c59b317d5e9be4c77a427a5a6a62f43e", "score": "0.48083827", "text": "static addBeforeToThis(){\n var currentItem = theController.myView.contextTarget\n theController.myModel.currentSuite = currentItem\n theController.myModel.addBeforeEach()\n let newMisc = theController.myModel.addMiscCode(\"\")\n theController.updateDisplay()\n document.getElementById(newMisc.id + 't').focus()\n }", "title": "" }, { "docid": "84b11017ad36dc2bff2a963c1403bae7", "score": "0.4796575", "text": "static loadView(model){\n $('#snippets').empty();\n\n var div = Overview.createDiv('btnDiv');\n Elements.buttons.forEach(command => {\n if (!Elements.buttonLoadCheck(command, model)) {\n if(command === 'Generate external tests'){\n var button = Elements.createTestButton(command, command, true);\n\n }\n else if (command === 'Generate internal tests') {\n var button = Elements.createTestButton(command, command);\n \n }\n else{\n var button = Elements.createButton(command, command);\n }\n\n div.append(button);\n }\n });\n document.getElementById('snippets').append(div);\n }", "title": "" }, { "docid": "36fb678a8812e6cb4e0a4fd1049d4038", "score": "0.47847867", "text": "beforeModel() {\n if (this.get('utils').get('token') || this.get('utils').get('fbToken')) {\n this.transitionTo('main');\n }\n return this.get('fb').FBInit();\n }", "title": "" }, { "docid": "df2674f1e0c15727fe6053d77d13abad", "score": "0.47615483", "text": "static getModelName() {\n return \"PackageCouponCode\";\n }", "title": "" }, { "docid": "ecdcc7177686185d41d5387f688cf3d0", "score": "0.4752895", "text": "function start(code) {\n startInternal({ code });\n }", "title": "" }, { "docid": "e9d4743cc3d62e19f9b8846dbc89423a", "score": "0.47421893", "text": "function enterCodeSnippetMode() {\n initEditMode();\n CodeSnippetTimeline.addClass('editable');\n\n EditPropertiesContainer\n .html('<span class=\"icon-code\"></span><div class=\"message active\">Add custom code by dragging Code Snippets into the active timeline, add \"Custom CSS\" rules, or react to events by editing the \"onReady\", \"onPlay\", \"onPause\" and \"onEnded\" tabs.</div>')\n .attr('data-editmode', 'codesnippets');\n }", "title": "" }, { "docid": "1c861c6f5ed5677c971ba5fc1a8fa4f6", "score": "0.4740586", "text": "function initializeModel() {\n //Initialize handler\n model.on(\n \"init\",\n function(m) {\n m.init = true;\n }\n );\n\n // Get each stepdetail and link, and drop them in the steps array.\n $(\".steps__step\").each(\n function (i, stepLink) {\n model.steps[i + 1] = {\n link: stepLink,\n detail: document.getElementById(stepLink.href.replace(/^.*#/, \"\")),\n friends: []\n };\n }\n );\n\n // Get Friends\n $.get(\n \"/app/assets/javascripts/baby-steps.json\",\n function (friends) {\n for (var i = 0; i < friends.friends.length; i++) {\n var friend = friends.friends[i];\n model.steps[friend.babyStep].friends.push(friend);\n }\n events.trigger(\"init\", model);\n }\n );\n }", "title": "" }, { "docid": "f95f37dbaf4ebded0c89c819c249bcd1", "score": "0.47325793", "text": "bootstrap () {\n super.bootstrap();\n\n\t\t/**\n\t\t * Navigation model from nodejs-admin app\n\t\t */\n\t\tvar NavigationModel = DioscouriCore.ApplicationFacade.instance.registry.load('Admin.Models.Navigation');\n\n NavigationModel.create({\n name: 'Pages',\n icon: 'fa-file-o',\n order: 103\n });\n\n NavigationModel.create({\n name: 'Pages Management',\n url: '/admin/pages',\n parent: 'Pages'\n });\n\n NavigationModel.create({\n name: 'Categories',\n url: '/admin/pages/categories',\n parent: 'Pages'\n });\n }", "title": "" }, { "docid": "58593b797eb6c659edb457d34b6d3f46", "score": "0.4728223", "text": "function createNewModel() {\n //Hide modelling tool with callback\n MODEL_EDIT_ENVIRONMENT.slideUp(400, function () {\n //Load empty model so that the user may create a new one\n vm.envModelToolApi.loadEmptyModel();\n\n //Ignore properties update, since it is not done by the user\n ignorePropertyUpdate = true;\n\n //Set default model properties\n vm.modelProperties = {\n name: \"Unnamed Model\",\n description: \"\"\n };\n\n //Set edit mode\n isNewModel = true;\n currentModelID = null;\n\n //New model, so no save necessary\n vm.saveNecessary = false;\n\n //Show modelling tool again\n MODEL_EDIT_ENVIRONMENT.slideDown();\n });\n }", "title": "" }, { "docid": "6bd1e40cc881ed0c9fc211ee432e04e5", "score": "0.4721348", "text": "function HomeController() {\n\tvar self = this;\n\t//Constructor\n\tthis.construct = function() {\n\t\tself.sifrAction();\n\t\tself.twitterAction();\n\t\tself.pngfixAction();\n\t\tself.socialnavAction();\n\t\tself.featuredAction();\n\t}\n\t\n\t/* !-- sifr action -- */\n\tthis.sifrAction = function() {\n\t\tself.view.sifr(\".headline>p\", \"/swf/quicksand.swf\", \"#770015\", \"#d6d6d6\", \"transparent\");\n\t}\n\t\n\t/* !-- twitter action -- */\n\tthis.twitterAction = function() {\n\t\tself.view.twitter(\"jessica_tsuji\", 50, 1, \"loading tweets...\");\n\t}\n\t\n\t/* !-- png fix action -- */\n\tthis.pngfixAction = function() {\n\t\tself.view.pngfix('body');\n\t}\n\t\n\t/* !-- social nav action -- */\n\tthis.socialnavAction = function() {\n\t\tvar index_model = new IndexModel();\n\t\t\n //adding the description container for the social site\n self.view.render.append($('#social'), '<span class=\"socialType\"></span>');\n \n //binding the hover events for \n $('#social .nav li a').bind(\"mouseover\", function() {\n \t//change the description to the social site type\n \tsocialType = index_model.get.attr($(this), 'title');\n \tself.view.render.text($('#social .socialType'), socialType);\n //binding to the blur event\n }).bind(\"mouseout\", function() {\n \t//clear the social type\n \tself.view.render.text($('#social .socialType'), \"\");\n });\n\t}\n\t\n\t/* !-- featured action -- */\n\tthis.featuredAction = function() {\n\t\tvar index_model = new IndexModel();\n\t\t\n\t\tvar gallery_helper = new GalleryHelper( index_model, self.view );\n\t\tgallery_helper.root = $('#featuredWork h3.tab');\n\t\tgallery_helper.liWidth = 730;\n\t\tgallery_helper.construct.featured();\n\t}\n\t\n\tself.construct();\n}", "title": "" }, { "docid": "e9aca1573932feacdb722ad9065cf1f9", "score": "0.47185862", "text": "function addHomework() {\n replaceColumn = false;\n replaceColumnWithItem(\"homework\", \"add\");\n}", "title": "" }, { "docid": "523825daac17802f4c4ea445ac0fec05", "score": "0.47182304", "text": "get CODE() {\n return CODE;\n }", "title": "" }, { "docid": "a4b7a986d5f06ae3a386941c6cdfbbf3", "score": "0.47059834", "text": "createNewCode ({theme, callback}) {\n if (!LanguageUtils.isInstanceOf(theme, Theme)) {\n callback(new Error('Unable to create new code, theme is not defined.'))\n } else {\n let newCode // The code that the user is creating\n // Ask user for name and description\n Alerts.multipleInputAlert({\n title: 'You are creating a new code for theme: ',\n html: '<input id=\"codeName\" class=\"formCodeName\" type=\"text\" placeholder=\"New code name\" value=\"\"/>' +\n '<textarea id=\"codeDescription\" class=\"formCodeDescription\" placeholder=\"Please type a description that describes this code...\"></textarea>',\n preConfirm: () => {\n let codeNameElement = document.querySelector('#codeName')\n let codeName\n if (_.isElement(codeNameElement)) {\n codeName = codeNameElement.value\n }\n let codeDescriptionElement = document.querySelector('#codeDescription')\n let codeDescription\n if (_.isElement(codeDescriptionElement)) {\n codeDescription = codeDescriptionElement.value\n }\n newCode = new Code({name: codeName, description: codeDescription, theme: theme})\n },\n callback: () => {\n let newCodeAnnotation = newCode.toAnnotation()\n window.abwa.storageManager.client.createNewAnnotation(newCodeAnnotation, (err, annotation) => {\n if (err) {\n Alerts.errorAlert({text: 'Unable to create the new code. Error: ' + err.toString()})\n } else {\n let code = Code.fromAnnotation(annotation, theme)\n // Add to the model the new theme\n theme.addCode(code)\n // Reload button container\n this.reloadButtonContainer()\n // Reopen sidebar to see the new added code\n window.abwa.sidebar.openSidebar()\n }\n })\n }\n })\n }\n }", "title": "" }, { "docid": "d1602fdbe4757f5eb5770f2a26842cc4", "score": "0.46911585", "text": "function startHome()\r\n{\r\n onInit();\r\n nome();\r\n}", "title": "" }, { "docid": "def8ba791c6c4abce89db716c3103546", "score": "0.4687463", "text": "function goHome() {\n \n // default page layout\n createPageLayout();\n $(\"#content\").html(\"<h1>IQ Trivia</h1>\");\n $(\"#content\").append(\"<h5>No host, no marketing, just trivia</h5>\");\n // play button\n createPlayButton(\"Play\");\n // dropdown for trivia categories\n createDropdown();\n }", "title": "" }, { "docid": "d8c001311d62f4aaac79a17bc790c06e", "score": "0.4681613", "text": "function buildModel(){\n _model.family = _family;\n _model.type = _type;\n _model.os = _os;\n _model.screenSize = _scrSize;\n}", "title": "" }, { "docid": "c4c18a81eccef1295cbe3d743234f066", "score": "0.46768457", "text": "init() {\n\t\tthis.model = app.get('models')[this.modelName];\n\t}", "title": "" }, { "docid": "5770a81dfbb802f386eb3b51933ed6b6", "score": "0.46761802", "text": "function controller_by_user(){\n\t\ttry {\n\t\t\t\n$ionicConfig.backButton.text(\"\");\n\n\n\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `coding` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "title": "" }, { "docid": "73ac50e9dee88ae11f599757441dbf09", "score": "0.46748114", "text": "ready(model,theme, intents) { \n model.lastEdited = model.lastEdited || {} ;\n intents = intents || this.intents ;\n theme = theme || this.theme ;\n \n var output = {\n header: model.needsUpdate.h ? theme.header(model.data) : null,\n footer: model.needsUpdate.f ? theme.footer(model.data) : null,\n page: model.needsUpdate.p ? theme.page(model.data) : null\n }\n \n return output ;\n }", "title": "" }, { "docid": "4c80b4f78e24e1b304c8b585d866c860", "score": "0.46738315", "text": "addModelWrapper () {\n this.output =\n `const ${this.name} = db.define('${this.name.toLowerCase()}', ` +\n this.output +\n ')\\n'\n }", "title": "" }, { "docid": "9fff31f5e5d6bca62ba77f3c3bd3e021", "score": "0.4664948", "text": "function MainController (){\n \n}", "title": "" }, { "docid": "b8bf28f64dfe3ef55d4342ddd29b0ce6", "score": "0.46640185", "text": "function home() {\n let _html =\n `<p>This is a single paged application for a bakery. </p>\n \n`;\n\n // Update the section heading, sub heading, and content\n updateMain('Home', 'Welcome to the Bakery Application', _html);\n}", "title": "" }, { "docid": "13c90018eca515b997c31c953bb98087", "score": "0.4654355", "text": "function init(thisIsMobile, countryNamesVocab) {\n model.isMobile = thisIsMobile;\n model.countryNames = countryNamesVocab;\n //NB: in other map projects some views would initilise when the model was ready by listening for this init event.\n //news.pubsub.emit('init');\n }", "title": "" }, { "docid": "4acf90926575a373bd5df5fc985bb116", "score": "0.46524858", "text": "start([model,ctx]) {\n \n //sets the context\n this.ctx = ctx;\n this.model = model;\n \n \n //Create population stats for this entity\n this.addStats();\n //Add the events in the model to the contexts\n this.addSimulationEvents();\n this.addResources();\n \n this.setConventions();\n this.scheduleNextCreation();\n \n \n \n \n }", "title": "" }, { "docid": "91a04ce169c8cb40c74c13264a0d78d2", "score": "0.46488732", "text": "function Home(homeService, parentModel, progressBarFactory, toastFactory) {\n\t\t/*jshint validthis: true */\n\t\tvar vm = this;\n\t\tvm.title = \"Hello, vha!\";\n\t\tvm.version = \"1.0.0\";\n\t\tvm.listFeatures = homeService.getFeaturesList();\n\t\tconsole.log(\"In HOME\");\n\n\t\t//hiding progress bar intially\n\t\tprogressBarFactory.hideProgressBar();\n\n\t\tvar StageStatusTiles = [{\n\t\t\t\"type\": \"stageStatusTiles\",\n\t\t\ttemplateOptions: {\n\t\t\t\t\"setOfFields\": [{\n\t\t\t\t\t\"class\": \"dashboard-stat blue-chambray\",\n\t\t\t\t\t\"iClass\": \"fa fa-tasks\",\n\t\t\t\t\t\"title\": \"Lead\",\n\t\t\t\t\t\"link\": \"#!/lead/viewAll\",\n\t\t\t\t\t\"mode\":\"leadCount\"\n\t\t\t\t}, {\n\t\t\t\t\t\"class\": \"dashboard-stat yellow-casablanca\",\n\t\t\t\t\t\"iClass\": \"fa fa-check-square-o\",\n\t\t\t\t\t\"title\": \"Opportunities\",\n\t\t\t\t\t\"link\": \"#!/opportunity/viewAll\",\n\t\t\t\t\t\"mode\": \"opportunityCount\"\n\t\t\t\t}, {\n\t\t\t\t\t\"class\": \"dashboard-stat blue-hoki\",\n\t\t\t\t\t\"iClass\": \"fa fa-tasks\",\n\t\t\t\t\t\"title\": \"Quotes\",\n\t\t\t\t\t\"link\": \"#!/quote/viewAll\",\n\t\t\t\t\t\"mode\":\"quoteCount\"\n\t\t\t\t}, {\n\t\t\t\t\t\"class\": \"dashboard-stat red-pink\",\n\t\t\t\t\t\"iClass\": \"fa fa-check-square-o\",\n\t\t\t\t\t\"title\": \"Agreement\",\n\t\t\t\t\t\"link\": \"#!/agreement/viewAll\",\n\t\t\t\t\t\"mode\":\"agreementCount\"\n\t\t\t\t}]\n\t\t\t}\n\t\t}]\n\n\t\tvm.getLeadCount = function(){\n\t\t\tparentModel.getLeadCount().then(\n\t\t\t\tfunction(response){\n\t\t\t\t\tconsole.log(response.data.length);\n\t\t\t\t\tvm.model.leadCount = response.data.length;\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\t\tvm.getOpportunityCount = function(){\n\t\t\tparentModel.getOpportunityCount().then(\n\t\t\t\tfunction(response){\n\t\t\t\t\tconsole.log(response.data.length);\n\t\t\t\t\tvm.model.opportunityCount = response.data.length;\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tvm.getQuoteCount = function(){\n\t\t\tparentModel.getQuoteCount().then(\n\t\t\t\tfunction(response){\n\t\t\t\t\tconsole.log(response.data.length);\n\t\t\t\t\tvm.model.quoteCount = response.data.length;\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tvm.getAgreementCount = function(){\n\t\t\tparentModel.getAgreementCount().then(\n\t\t\t\tfunction(response){\n\t\t\t\t\tconsole.log(response.data.length);\n\t\t\t\t\tvm.model.agreementCount = response.data.length;\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\n\tvm.getLeadCount();\n\tvm.getOpportunityCount();\n\tvm.getQuoteCount();\n\tvm.getAgreementCount();\n\n\n\n\t\tvm.getLayout = function(view) {\n\t\t\tif (view === 'StageStatusTiles') {\n\t\t\t\treturn JSON.stringify(StageStatusTiles);\n\t\t\t}\n\t\t}\n\t\t\tconsole.log(\"vm.model\");\n\t\t\tconsole.log(vm.model);\n\t\t\tvm.fields = JSON.parse(vm.getLayout('StageStatusTiles'));\n\n\n\n\n\t\tvm.line = {\n\t\t\tlabels: ['Aug 15', 'Sep 15', 'Oct 15', 'Nov 15', 'Dec 15', 'Jan 16'],\n\t\t\tseries: ['Need Analysis', 'Prospecting', 'Perception Analysis'],\n\t\t\tdata: [\n\t\t\t\t[200, 220, 280, 180, 150, 300],\n\t\t\t\t[175, 200, 250, 177, 141, 265],\n\t\t\t\t[130, 100, 80, 99, 60, 30]\n\t\t\t],\n\t\t\tcolors: [\"#ffe6e6\", \"#e6e6ff\", \"#f2f2f2\", \"#f2f5f2\", \"#f7f2f2\", \"#f2f2f5\"],\n\t\t\tonClick: function(points, evt) {\n\t\t\t\tconsole.log(points, evt);\n\t\t\t}\n\t\t};\n\n\t\tvm.bar = {\n\t\t\tlabels: ['14/12/2015', '21/12/2015', '28/12/2015', '4/1/2016', '11/1/2016'],\n\t\t\t/*labels: ['Week 1', 'Week 2', 'Week 3', 'Week 4', 'Week 5'],*/\n\t\t\tseries: ['Call', 'Presentations', 'Meeting'],\n\n\t\t\tdata: [\n\t\t\t\t[51, 4, 6, 11, 27],\n\t\t\t\t[15, 24, 62, 31, 17],\n\t\t\t\t[30, 48, 46, 59, 36]\n\t\t\t],\n\n\t\t\tcolours: ['#e35b5a', '#FFA500', '#66B366']\n\t\t};\n\n\t\tvm.donut = {\n\t\t\tlabels: [\"High\", \"Medium\", \"Low\"],\n\t\t\tdata: [35, 10, 55],\n\t\t\tcolours: ['#e35b5a', '#FFA500', '#66B366']\n\t\t};\n\n\t\tvm.line1 = {\n\t\t\tlabels: ['Aug 15', 'Sep 15', 'Oct 15', 'Nov 15', 'Dec 15', 'Jan 16'],\n\t\t\tseries: ['Need Analysis', 'Prospecting', 'Perception Analysis'],\n\t\t\tdata: [\n\t\t\t\t[200, 220, 280, 180, 150, 300],\n\t\t\t\t[175, 200, 250, 177, 141, 265],\n\t\t\t\t[130, 100, 80, 99, 60, 30]\n\t\t\t],\n\t\t\tonClick: function(points, evt) {\n\t\t\t\tconsole.log(points, evt);\n\t\t\t}\n\t\t};\n\n\t\tvm.bar1 = {\n\t\t\tlabels: ['14/12/2015', '21/12/2015', '28/12/2015', '4/1/2016', '11/1/2016'],\n\t\t\t/*labels: ['Week 1', 'Week 2', 'Week 3', 'Week 4', 'Week 5'],*/\n\t\t\tseries: ['Call', 'Presentations', 'Meeting'],\n\n\t\t\tdata: [\n\t\t\t\t[51, 4, 6, 11, 27],\n\t\t\t\t[15, 24, 62, 31, 17],\n\t\t\t\t[30, 48, 46, 59, 36]\n\t\t\t],\n\n\t\t\tcolors: [\"#ffe6e6\", \"#e6e6ff\", \"#f2f2f2\"]\n\t\t};\n\n\t\tvm.radar = {\n\t\t\tlabels: [\"Eating\", \"Drinking\", \"Sleeping\", \"Designing\", \"Coding\", \"Cycling\", \"Running\"],\n\n\t\t\tdata: [\n\t\t\t\t[65, 59, 90, 81, 56, 55, 40],\n\t\t\t\t[28, 48, 40, 19, 96, 27, 100]\n\t\t\t],\n\n\t\t\tcolors: [\"#ffe6e6\", \"#e6e6ff\", \"#f2f2f2\", \"#f2f5f2\", \"#f7f2f2\", \"#f2f2f5\"]\n\t\t};\n\n\n\t\tvm.map = {\n\t\t\tcenter: {\n\t\t\t\tlatitude: 40,\n\t\t\t\tlongitude: -99\n\t\t\t},\n\t\t\tzoom: 8,\n\t\t\tmarker: {\n\t\t\t\tid: 0,\n\t\t\t\tcoords: {\n\t\t\t\t\tlatitude: 40.1451,\n\t\t\t\t\tlongitude: -99.6680\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\tdraggable: true\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\n}", "title": "" }, { "docid": "0b5fdbd3f397320787eb2d2ee9f49076", "score": "0.4647969", "text": "function modelReady() {\n console.log('Model is ready!!!');\n classifier.load('https://cdn.jsdelivr.net/gh/galaedrik/PWaI/model.json', customModelReady);\n}", "title": "" }, { "docid": "78850e4237f7faaf171b51b1b38036af", "score": "0.46479294", "text": "afterModel() {\r\n this.transitionTo('home');\r\n }", "title": "" }, { "docid": "29ccddbe0fb77c3b74b7cf9ad4ddac94", "score": "0.46419314", "text": "function aurora_model(name,condition,value) {\n return aurora_model_module.main(name,condition,value);\n}", "title": "" }, { "docid": "8440bc411690b5e58ab3f57b560dcc83", "score": "0.46414334", "text": "function controller_by_user(){\n\t\ttry {\n\t\t\t\n$ionicConfig.backButton.text(\"\");\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `actualites_bookmark` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "title": "" }, { "docid": "64ff3e6e95b22481ec8fa0199e4f51c8", "score": "0.4640722", "text": "addSnippet(addCode){\n let tab = this.getRef('tabstrip').getVue(this.getRef('tabstrip').selected);\n bbn.vue.find(tab, \"bbn-code\").addSnippet(addCode);\n }", "title": "" }, { "docid": "7b9f10b3230f7acfb97e9178d01d862f", "score": "0.4638536", "text": "createMarkerFromHome(home) {\n const position = new google.maps.LatLng(home.lat, home.long);\n\n const homePrice = {\n fontSize: \"12px\",\n fontWeight: \"bold\",\n color: \"black\",\n text: `$${home.price}`\n };\n\n const customIcon = {\n path: \"M 25 0 L 375 0 L 375 200 L 260 200 L 200 250 L 140 200 L 25 200 Z\",\n anchor: new google.maps.Point(200, 240),\n labelOrigin: new google.maps.Point(200, 110),\n scale: 0.12,\n fillColor: \"white\",\n fillOpacity: 1,\n strokeColor: \"rgba(0, 0, 0, 0.2)\",\n strokeWeight: 1\n };\n\n const marker = new google.maps.Marker({\n position,\n map: this.map,\n homeId: home.id,\n icon: customIcon,\n label: homePrice,\n zIndex: this.setCustomZindex()\n });\n\n marker.addListener(\"click\", () => this.handleClick(home));\n this.markers[marker.homeId] = marker;\n }", "title": "" }, { "docid": "b35d7d0d57f68c44d97a1a1548e31cd4", "score": "0.46312976", "text": "function wbCodeData(){\t\n\tthis.ins_code_data_prep = wbCodeDataInsertCodeDataPrep;\n\tthis.ins_code_data_exec = wbCodeDataInsertCodeDataExec;\n\tthis.upd_code_data_prep = wbCodeDataUpdateCodeDataPrep;\n\tthis.upd_code_data_exec = wbCodeDataUpdateCodeDataExec;\n\tthis.del_code_data = wbCodeDataDeleteCodeData;\n\tthis.get_code_data_lst = wbCodeDataGetCodeData;\n\tthis.get_code_data_detail = wbCodeDataGetDetail\t;\n}", "title": "" }, { "docid": "50d572e6e8c796506393c7e54b0e9713", "score": "0.4629595", "text": "automate() {\n }", "title": "" }, { "docid": "aed3ffab1893a516c113f659ab2e60b5", "score": "0.46286684", "text": "function afterSave(data) {\n try {\n\n initEntry();\n vm.isCancelBtnHide = false;\n vm.fieldRange.index = data.refIndex;\n vm.field.index = data.refIndex; // set alphabetical letter\n _addToFlatObjectArrayList(data);\n\n vm.fieldDetail.applicationId = data.applicationId;\n // application data show into application dropdown field\n vm.appObj.selected = _getAppInfo(data.applicationId);\n\n showSuccessSaveMsg();\n\n } catch (e) {\n showErrorMsg(e);\n }\n }", "title": "" }, { "docid": "74cf5fe20d3fd9d3bf35fa1a004ba9f1", "score": "0.4627811", "text": "function init_home_view() \n {\n\t \n \tconsole.log(\"calling init_home_view\"); \n \t\n \t//$.mobile.showPageLoadingMsg(\"a\", \"Connecting...\");\n \t\n\t\tvar ud = localStorage.getItem('user_data');\n\t\t \n\t\tif (ud == \"\")\n\t\t{\n\t\t\tconsole.log(\"empty user data - initializing local storage and forwarding to login page...\");\n\t\t\tprefill_local_storage();\n\t\t\t$.mobile.navigate( \"#login\" );\n\t\t\treturn;\n\t\t}\n\t\t \n \tuser_data = JSON.parse(ud);\n \tuser_id = user_data.user.id;\n \t\n\t\tdone_with_cars_from_server = false;\n\t\tdone_with_regions_from_server = false;\n \t\t\n \t\tconsole.log(\"fetching cars database\");\n \t\tupdate_cars_list_from_server();\n \t\t\n \t\tuse_geoloction = localStorage.getItem('use_geolocation');\n \t\tif(use_geoloction == true)\n \t\t{\n\t \t\t$(\"input[type='checkbox']\").attr(\"checked\",true).checkboxradio(\"refresh\");\n \t\t}\n \t\t\n\t\tconsole.log(\"fetching region database\");\n\t\tupdate_regions_and_rates_from_server();\n\t\t\n \t\tconsole.log(\"setting up parking panel\");\n \thandle_parking_panel();\n \t\n \t//hideLoading();\n\t\t\n}", "title": "" }, { "docid": "e6d7cf5d8829bf8d1d6e7c48a6fcb61f", "score": "0.4626718", "text": "function call_home() {\n\tconsole.log(\"calling home\");\n\thandleCommands(\"H\");\n}", "title": "" }, { "docid": "ef3daa970469569761cdd8a7b8737968", "score": "0.4625321", "text": "function modelReady() {\n console.log(\"model Ready\");\n}", "title": "" }, { "docid": "dea28c516ecda2273e21d38af864acf3", "score": "0.46242374", "text": "function BaseApp()\n{\n \n}", "title": "" }, { "docid": "542ac043c328837e31813b1719758e2e", "score": "0.46237877", "text": "function modelReady() {\n console.log(\"ready\");\n}", "title": "" }, { "docid": "26c0965e433fa156be26c41894891b76", "score": "0.46205288", "text": "function customHeadSetter(range, data, col) {\n\n //shorten variable\n var fields = data.requirements.customFields\n\n //loop through model custom fields data\n //take passed in range and only overwrite the fields if a value is present in the model\n for (var i = 0; i < fields.length; i++) {\n //get cell and offset by one column every iteration\n var cell = range.getCell(1, i + 1)\n //set heading and wrap text to fit\n cell.setValue('Custom Field ' + (i + 1) + '\\n' + fields[i].Name).setWrap(true);\n //get column and offset (move to the right) every iteration and set background\n var column = col.offset(0, i)\n column.setBackground('#fff');\n }\n}", "title": "" }, { "docid": "8ad29566820b19b1be234da0c7d021aa", "score": "0.46191466", "text": "function modelReady() {\n console.log('Model is ready!!!');\n // classifier.load('model.json', customModelReady);\n}", "title": "" }, { "docid": "9666f005fd560efe4f4eef67f53b07f0", "score": "0.46041432", "text": "function LyCode() {\n\t$(\"body\").append('<div id=\"' + LyCode.ID + '\"><div class=\"title\"><button class=\\\"run_code\\\">运行代码/Ctrl+Entry</button><button class=\\\"min\\\">最小化</button><button class=\\\"clear\\\">清空</button><button class=\\\"close\\\">关闭</button></div><div class=\"content\"><div class=\"code\"><textarea id=\"RUN_CODE_TEXTAREA\"></textarea></div><div class=\"run\"><pre></pre></div><div class=\"clear\"></div></div></div>');\n\t$(\"#\" + LyCode.ID + \" .run_code\").click(function () {\n\t\tLyCode.prototype.run_code()\n\t});\n\t$(\"#\" + LyCode.ID + \" .min\").click(function () {\n\t\tLyCode.prototype.min_box()\n\t});\n\t$(\"#\" + LyCode.ID + \" .close\").click(function () {\n\t\tLyCode.prototype.close_box()\n\t});\n\t$(\"#\" + LyCode.ID + \" .clear\").click(function () {\n\t\tLyCode.prototype.clear_box()\n\t});\n\teditAreaLoader.init({\n\t\tid: \"RUN_CODE_TEXTAREA\"\t// id of the textarea to transform\n\t\t, start_highlight: true\t// if start with highlight\n\t\t, font_size: \"10\", allow_resize: \"yes\", allow_toggle: false, language: \"zh\", syntax: \"php\", EA_load_callback: \"LyCode.prototype.edit_load_ok\", replace_tab_by_spaces: 4\n\t});\n}", "title": "" }, { "docid": "2af902ddbc919dcacd1d290729708a68", "score": "0.45972407", "text": "do(code) {\n this.code = code\n return this\n }", "title": "" }, { "docid": "b6aeb3e90b9d8463092f18a9074d2dbc", "score": "0.4596944", "text": "function onRouteChange() {\n var appName = \"InterSystems DeepSee™\";\n if (dsw.mobile) {\n appName = \"DeepSight\";\n }\n $scope.model.onDashboard = isOnDashboard();\n $scope.model.searchText = \"\";\n $scope.model.canAdd = !favExists($routeParams.path);\n $scope.model.title = $routeParams.path || appName;\n $scope.model.title = $scope.model.title.replace(\".dashboard\", \"\");\n //var parts = $scope.model.title.split(\"/\");\n //if (parts.length != \"\")\n $scope.model.namespace = $routeParams.ns || localStorage.namespace || \"Samples\";\n var ns = localStorage.namespace;\n if (ns) ns = ns.toLowerCase();\n if (ns !== $scope.model.namespace.toLowerCase()) {\n // Namespace changed\n delete sessionStorage.dashboarList;\n localStorage.namespace = $scope.model.namespace;\n Connector.firstRun = true;\n }\n }", "title": "" }, { "docid": "3506ace270fd090ab9c183671e7f0ba6", "score": "0.45960963", "text": "enterCodeType(ctx) {\n\t}", "title": "" }, { "docid": "1ec52b8ddb698f07226622f2407bbeb9", "score": "0.45959473", "text": "async __before() {\n await this.getConfig();\n //设置CSRF值\n let csrf = await this.session(\"__CSRF__\");\n this.assign(\"csrf\", csrf);\n\n //获取tags\n let tagList = await this.model(\"home\").findAll('tags', {\n appear: 1\n });\n this.assign('tagList', tagList);\n\n //获取图文推荐列表\n let picrecomList = await this.model(\"home\").getArticleList({\n topicrecom: 1,\n ispublished: 1\n });\n this.assign(\"picrecomList\", picrecomList);\n\n //获取站长推荐列表\n let torecomList = await this.model(\"home\").getArticleList({\n torecom: 1,\n ispublished: 1\n });\n this.assign(\"torecomList\", torecomList);\n\n //获取点击排行列表\n let popularList = await this.model(\"home\").getPopularList({\n ispublished: 1\n });\n this.assign(\"popularList\", popularList);\n\n //获取最新文章列表\n let newestList = await this.model(\"home\").getArticleList({\n ispublished: 1\n })\n this.assign(\"newestList\", newestList);\n\n //获取导航链接\n let navList = await this.model(\"home\").findAll('menu');\n this.assign(\"navList\", navList);\n\n //显示用户名\n let sessionUser = await this.session(\"userInfo\")\n if (sessionUser) {\n this.assign(\"name\", sessionUser.name);\n } else {\n this.assign(\"name\", null);\n }\n\n }", "title": "" }, { "docid": "d8ca2fbea72fc207932e0be0a742132f", "score": "0.45955482", "text": "function initializeHomePage() {\r\n if (document.location.href.match(/shadertoy.com$|shadertoy.com\\//)) {\r\n loadScript(HOME_EXTENSION_FILENAME);\r\n }\r\n }", "title": "" }, { "docid": "eab6e5ea9f6377a2c4eacf3b7f40020a", "score": "0.45897093", "text": "function controller_by_user(){\r\n\t\ttry {\r\n\t\t\t\r\n$ionicConfig.backButton.text(\"\");\t\t\t\r\n\t\t} catch(e){\r\n\t\t\tconsole.log(\"%cerror: %cPage: `product_singles` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\r\n\t\t\tconsole.dir(e);\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "f7f21a8572d606cf5ed74610c4536099", "score": "0.45880407", "text": "enterCode_type(ctx) {\n\t}", "title": "" }, { "docid": "233115a8f00931d8b5e89b536d771ff9", "score": "0.45821264", "text": "function start_code() {\r\n\t\r\n //$('#span-version').html(OCTUNE_VERSION);\r\n session_id = gen_random_str();\r\n\t\t\r\n\tvar excavator_hostname = systemSettings['host'];\r\n var excavator_port = systemSettings['port'];\r\n \r\n url = 'http://' + excavator_hostname + ':' + excavator_port.toString() + '/';\r\n\r\n auth_token = getUrlParameter('auth');\r\n if (!auth_token) auth_token = null;\r\n\r\n clear_logs();\r\n log_write('normal', 'Starting up...');\r\n\r\n _tick();\r\n}", "title": "" }, { "docid": "cb4b51151babb01ba0bf2f089ccc0b43", "score": "0.45819592", "text": "function HomeAssistant() {\n}", "title": "" }, { "docid": "629d89df7e182a27f1249a7d26e926c4", "score": "0.45807993", "text": "function create() {\n\t\t// Code here ...\n\t}", "title": "" }, { "docid": "503794da7ec43bdfe7679a8c9e7a36b2", "score": "0.45797127", "text": "function modelReady() {\r\n console.log('Model Loaded');\r\n}", "title": "" }, { "docid": "503794da7ec43bdfe7679a8c9e7a36b2", "score": "0.45797127", "text": "function modelReady() {\r\n console.log('Model Loaded');\r\n}", "title": "" }, { "docid": "42062cab60d2995a3c908d2bdc08f707", "score": "0.45718786", "text": "function controller_by_user(){\n\t\ttry {\n\t\t\t\n//debug: all data\n//console.log(data_imageness);\n$ionicConfig.backButton.text(\"\");\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `menu_2` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "title": "" }, { "docid": "b3296ea0e4358fd11ab68f91dc97fdc1", "score": "0.45636255", "text": "function createModel(value,language,uri){value=value||'';if(!language){var path=uri?uri.path:null;var firstLF=value.indexOf('\\n');var firstLine=value;if(firstLF!==-1){firstLine=value.substring(0,firstLF);}return doCreateModel(value,standaloneServices_1.StaticServices.modeService.get().getOrCreateModeByFilenameOrFirstLine(path,firstLine),uri);}return doCreateModel(value,standaloneServices_1.StaticServices.modeService.get().getOrCreateMode(language),uri);}", "title": "" }, { "docid": "d712651a3df1c7d848ff9419b16b0751", "score": "0.45606327", "text": "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n\n /* mobilelist_22 */\n\n listView = $(\"#startScreen_mobilelist_22\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#startScreen_mobilelist_22 .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n\n /* itmMayor */\n\n /* itmCongress */\n\n /* itmSenator */\n\n /* itmHouseRep */\n\n }", "title": "" }, { "docid": "cffd4ced7037fa02d7e8d49f4b0b3805", "score": "0.45583084", "text": "function createModel( page_id ){ \n service.models[ page_id ] = new abstract_model_service({\n outdated_timeout: 1000*60*60*2, // 2 hours.\n \n cache_size: 60,\n cache_model_prefix: 'ug'+page_id+'.',\n cache_list_name: 'usrgrades'+ page_id +'.ids',\n \n _method_get: 'page.getUserGrades',\n _buildGetParams : function(ids){\n return { id : page_id, user_id : ids } \n }\n });\n \n return service.models[ page_id ];\n }", "title": "" }, { "docid": "98e4a5928e9848c648f2798daa633e94", "score": "0.4553505", "text": "constructor(){\n \n this.setModelname();\n }", "title": "" }, { "docid": "8413bb2517b47082b2d8a6a65faea0c0", "score": "0.45500523", "text": "function controller_by_user(){\r\n\t\ttry {\r\n\t\t\t\r\n$ionicConfig.backButton.text(\"\");\t\t\t\r\n\t\t} catch(e){\r\n\t\t\tconsole.log(\"%cerror: %cPage: `home` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\r\n\t\t\tconsole.dir(e);\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "7342c28411e6d93ecd0be62ba3bb6e76", "score": "0.45447385", "text": "if (GetRenderType()!=CEntity::RT_MODEL && GetRenderType()!=CEntity::RT_SKAMODEL) \n\t\t{\n\t\t\treturn;\n\t\t}", "title": "" }, { "docid": "aa60dbec0330c87155c6af6297f855cf", "score": "0.45440608", "text": "function _codeTag() {\n _addTag(\"code\");\n }", "title": "" }, { "docid": "8e7314badca1e711d4fd03c9ce901b56", "score": "0.45428973", "text": "homePress() {\n var loc = this.model.getLeftBreak();\n if(loc == -1) {\n this.model.setCursor(0);\n } else {\n this.model.setCursor(loc);\n }\n }", "title": "" }, { "docid": "2d640db649e33261ead7359ae74bffca", "score": "0.45423764", "text": "function modelLoaded() {\r\n console.log(\"Model Loaded\");\r\n}", "title": "" }, { "docid": "c5bfb3d34c38a723e0f09257d42ff519", "score": "0.45421445", "text": "function contactoController() {\n \n}", "title": "" }, { "docid": "ee3ea841ac74c3f9a4b83e55b42e599a", "score": "0.45395622", "text": "function vehicleModel_backBtn() {\n vyear = 0;\n vmodel_label.addClass('active');\n vyear_label.html('Año').removeClass('active');\n if (windowSize <= 768) {\n\n vyear_label.html('Año').addClass('hide');\n vmodel_label.html('Modelo');\n vbrand_label.removeClass('hide');\n $('#continue-btn').addClass('hide');\n mobile_vehicle.removeClass('hide');\n mobile_v_year.addClass('hide').empty();\n\n //$('#v-model-year').addClass('hide').empty();\n } else {\n $('#v-model-year').addClass('hide').empty();\n $('#continue-btn').addClass('hide');\n }\n\n models();\n }", "title": "" }, { "docid": "79384d9359cf7c7c9fd87a3df1ff3924", "score": "0.4539146", "text": "getNewEmployeeCode() {\n let urlFull = this.controler + \"/NewCode\";\n return BaseAPIConfig.get(urlFull);\n }", "title": "" }, { "docid": "db7d5c8a6aa8282156bcd6cfb24cccd9", "score": "0.45385167", "text": "function controller_by_user(){\r\n\t\ttry {\r\n\t\t\t\r\n$ionicConfig.backButton.text(\"\");\t\t\t\r\n\t\t} catch(e){\r\n\t\t\tconsole.log(\"%cerror: %cPage: `bookmarks` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\r\n\t\t\tconsole.dir(e);\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "89049238a8244d18724df968c0e0d006", "score": "0.45322883", "text": "function controller_by_user(){\n\t\ttry {\n\t\t\t\n$ionicConfig.backButton.text(\"\");\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `bands` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "title": "" }, { "docid": "a488272d26d3928fe57e273bd8759a9b", "score": "0.4530654", "text": "createNewBoat() { \n // Navigate to new record modal popup for Boat__c object\n this[NavigationMixin.Navigate]({\n type: 'standard__objectPage', // double underscores\n attributes: {\n objectApiName: 'Boat__c',\n actionName: 'new'\n },\n });\n }", "title": "" }, { "docid": "e17793258099db8e4cdf236e60a48272", "score": "0.4523446", "text": "function addBlazePoseControllers(modelConfigFolder, type) {\n params.STATE.modelConfig = { ...params.BLAZEPOSE_CONFIG };\n params.STATE.modelConfig.type = type != null ? type : 'full';\n\n const typeController = modelConfigFolder.add(\n params.STATE.modelConfig, 'type', ['lite', 'full', 'heavy']);\n typeController.onChange(type => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n });\n\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n }", "title": "" }, { "docid": "aab328a75743b67384b40f1ccb5037ec", "score": "0.45219454", "text": "static model(){\n return \"Transaction\";\n }", "title": "" } ]
de2a7c48c2e4da3556bfaf6a3f0ea10a
function injection STEP 1
[ { "docid": "3f4b1abdfdc2f2191ba1a74db1965467", "score": "0.0", "text": "function injectVideoContainer(){\n\t\t\t//getting html template\n\t\t\tvar $vidContainer = vidObj.src.youtube ? $(vidContainer_youtube_tmpl) : $(vidContainer_tmpl);\n\t\t\t//prepare video container obj\n\t\t\t$vidContainer\n\t\t\t\t.attr('id',vidObj.ref+'Container')\n\t\t\t\t.css({ 'display':'none' })\n\t\t\t\t.addClass( 'videoContainer' + vidObj.src.width + vidObj.src.height );\n\t\t\t$vidContainer.find('.video').attr('id',vidObj.ref);\n\t\t\t//inject player obj\n\t\t\tinjectVideo($vidContainer);\n\t\t}", "title": "" } ]
[ { "docid": "109156e05178de9a2539b13fb4a6ba13", "score": "0.6367173", "text": "inject () {}", "title": "" }, { "docid": "9016da3a8498a4d472d3aa3a062191a5", "score": "0.6324077", "text": "function inject(func)\r\n{\r\nvar source = func.toString();\r\nvar script = document.createElement('script');\r\n// Version 1013 Cracked & Stable\r\nscript.innerHTML = '('+source+')()';\r\ndocument.body.appendChild(script);\r\n}", "title": "" }, { "docid": "438bcf9eb92a000cf2cbfc098cae1005", "score": "0.62311095", "text": "function inject(func) {\r\n\t\tvar source = func.toString();\r\n\t\tvar script = document.createElement('script');\r\n\t\t// put parenthesis after source so that it will be invoked\r\n\t\tscript.innerHTML = '(' + source + ')()';\r\n\t\tdocument.body.appendChild(script);\r\n\t}", "title": "" }, { "docid": "967be2d68de29219f1127a47fa98edeb", "score": "0.6179464", "text": "hook1() {}", "title": "" }, { "docid": "cba8227d1ebefb824d1adc4897ed2a6c", "score": "0.6141857", "text": "enterOC_FunctionInvocation(ctx) {}", "title": "" }, { "docid": "07baaa7b10a2faddf5ad2c1b651b13e9", "score": "0.6116542", "text": "function miFuncion(){}", "title": "" }, { "docid": "335860a335bf8a6ae58dd92ada5a9116", "score": "0.61114365", "text": "function pass() {}", "title": "" }, { "docid": "b12d3c54ffad3c548d192da744aaa4fd", "score": "0.6038203", "text": "function thirdExampleFunction(iAmThePrameter){//function declaration with name and parameters \n console.log(iAmThePrameter);//code too be run and function ivocation \n}", "title": "" }, { "docid": "268afd9bdc9b82f80ff9f5bd59e59b45", "score": "0.59160763", "text": "function func17() {}", "title": "" }, { "docid": "0e70789cb3456f896e28f233cb1b42fe", "score": "0.5898144", "text": "function fun1(){}", "title": "" }, { "docid": "6463afec96f82e628b0ff67ebb450302", "score": "0.58865416", "text": "function pa(){}", "title": "" }, { "docid": "35266bbd17799c117911819744b65d26", "score": "0.58684134", "text": "function x() { inject(() => {}) }", "title": "" }, { "docid": "a4d22c12027eb4df8ee3768e1d65bca3", "score": "0.5798142", "text": "function pass(){\n\n}", "title": "" }, { "docid": "01e7a6d761edbe85b88d3f392736187e", "score": "0.57937795", "text": "function miFuncion1(){\n console.log('funcion 1');\n\n}", "title": "" }, { "docid": "8d89bda49f1a57fac7aa132c519aceca", "score": "0.5790145", "text": "enterFunctionParameter(ctx) {\n\t}", "title": "" }, { "docid": "b58939bef8483458b69110907e830f52", "score": "0.57820964", "text": "function miFuncion(){\n\n}", "title": "" }, { "docid": "cf0e8c3cadb65602323c4187184bcf27", "score": "0.57806563", "text": "function fc(){}", "title": "" }, { "docid": "cf0e8c3cadb65602323c4187184bcf27", "score": "0.57806563", "text": "function fc(){}", "title": "" }, { "docid": "edaf9644020839e0a03917cd76d34512", "score": "0.57773477", "text": "function func() {}", "title": "" }, { "docid": "edaf9644020839e0a03917cd76d34512", "score": "0.57773477", "text": "function func() {}", "title": "" }, { "docid": "f1b4d844c2af2035d66081695749da0c", "score": "0.57606375", "text": "function fn1(){ }", "title": "" }, { "docid": "b797bba5ed5066f5991edcb5becdc276", "score": "0.5758305", "text": "function inject(source) {\n log(\"functiontrace\", \"Start Function\");\n // Check for function input.\n if ('function' == typeof source) {\n // Execute this function with no arguments, by adding parentheses.\n // One set around the function, required for valid syntax, and a\n // second empty set calls the surrounded function.\n source = '(' + source + ')();';\n }\n\n // Create a script node holding this source code.\n var script = document.createElement('script');\n script.setAttribute(\"type\", \"application/javascript\");\n script.textContent = source;\n\n // Insert the script node into the page, so it will run, and immediately\n // remove it to clean up.\n document.body.appendChild(script);\n document.body.removeChild(script);\n}", "title": "" }, { "docid": "6e720516918b3cd9ce6285d5f308687e", "score": "0.5748091", "text": "static Inject() {\n // Inject code snippets\n }", "title": "" }, { "docid": "1433c3f49f199a9ac5e05b1aae2af365", "score": "0.57334065", "text": "funcao2() {\n\n }", "title": "" }, { "docid": "508caff6352d7f6d574af7e5503afcdb", "score": "0.5724916", "text": "enterFunctionType(ctx) {\n\t}", "title": "" }, { "docid": "e25b628820b9ecede18ebf8ae3240ca3", "score": "0.57201535", "text": "enterExtractFunction(ctx) {\n\t}", "title": "" }, { "docid": "7a1d5e0255ac83590aac31ffa521426c", "score": "0.5713108", "text": "function f1(){}", "title": "" }, { "docid": "5f733458bc213a9cc447aa6dd2f16ef1", "score": "0.5696668", "text": "func (param) {\n console.log('sample func');\n }", "title": "" }, { "docid": "46d7f066e0fccef61d6cce25aa7363b4", "score": "0.56883115", "text": "enterFunctionArg(ctx) {\n\t}", "title": "" }, { "docid": "4afe0090febc19af1264db297c3c1b7e", "score": "0.568586", "text": "function execution_passe() {\n // ici le code\n}", "title": "" }, { "docid": "23266dcc859df57f907c8e42174706a1", "score": "0.5671407", "text": "function myService1() {}", "title": "" }, { "docid": "79867565c3ab8063e8bad5b679e1fefb", "score": "0.5666325", "text": "function fun1() {}", "title": "" }, { "docid": "79867565c3ab8063e8bad5b679e1fefb", "score": "0.5666325", "text": "function fun1() {}", "title": "" }, { "docid": "79867565c3ab8063e8bad5b679e1fefb", "score": "0.5666325", "text": "function fun1() {}", "title": "" }, { "docid": "ad9ea4b8917de19779c67be4bafa7feb", "score": "0.5642594", "text": "function fun1(){ }", "title": "" }, { "docid": "ad9ea4b8917de19779c67be4bafa7feb", "score": "0.5642594", "text": "function fun1(){ }", "title": "" }, { "docid": "01c85619d5f162a80741b3d4cba50514", "score": "0.56308216", "text": "function fun1() { }", "title": "" }, { "docid": "01c85619d5f162a80741b3d4cba50514", "score": "0.56308216", "text": "function fun1() { }", "title": "" }, { "docid": "01c85619d5f162a80741b3d4cba50514", "score": "0.56308216", "text": "function fun1() { }", "title": "" }, { "docid": "8de6832e1be62fc8eb924f6a71c7bba5", "score": "0.56130886", "text": "prepareFirstAndSecondArgs () {\n // put second argument on D\n this.pushAssembly('@SP')\n this.pushAssembly('A=M-1')\n this.pushAssembly('D=M')\n // let M point to first argument, located at SP - 2\n this.pushAssembly('@SP')\n this.pushAssembly('A=M-1')\n this.pushAssembly('A=A-1')\n }", "title": "" }, { "docid": "e2fac0bb74e9591b1780dfb8a74df4ed", "score": "0.5612163", "text": "function helloworld(){\n\t\n}", "title": "" }, { "docid": "55dc82bd74db8f541cf53e2136015d74", "score": "0.5609207", "text": "function dummy(){}", "title": "" }, { "docid": "55dc82bd74db8f541cf53e2136015d74", "score": "0.5609207", "text": "function dummy(){}", "title": "" }, { "docid": "df9393c6a6fdd0ac474c681b7eed250d", "score": "0.5605887", "text": "function ha(){}", "title": "" }, { "docid": "9515c95be16dc1b4bca22b866aa26760", "score": "0.5600812", "text": "function example1(){\n console.log(\"Example 1\");\n \n}", "title": "" }, { "docid": "77a0b6122c5d33e19a26520b0c38b82d", "score": "0.55993277", "text": "function injectTheScript () {\n inject(toggleFeedEval);\n}", "title": "" }, { "docid": "476def06cf56facc8728233676ca71b8", "score": "0.55993253", "text": "execute(injector) {\r\n var params = this._tokens.map(t => injector.get(t));\r\n return FunctionWrapper.apply(this._fn, params);\r\n }", "title": "" }, { "docid": "e383232da17e1ad89ee5ac79b14eae6a", "score": "0.5598963", "text": "function Interfas() {}", "title": "" }, { "docid": "7ad248aa650608db6a91a71401ad8da8", "score": "0.55929124", "text": "function Interfaz() {}", "title": "" }, { "docid": "7ad248aa650608db6a91a71401ad8da8", "score": "0.55929124", "text": "function Interfaz() {}", "title": "" }, { "docid": "7ad248aa650608db6a91a71401ad8da8", "score": "0.55929124", "text": "function Interfaz() {}", "title": "" }, { "docid": "512129f7dd3cb4a6b09c5df2bcd9dbe1", "score": "0.5574856", "text": "function func1() { }", "title": "" }, { "docid": "c91b46dd41bd2084f23b32fe9f0c79f3", "score": "0.5572947", "text": "function one(){\n \n}", "title": "" }, { "docid": "c59c4804b2a1db283a007ec610ac616a", "score": "0.55650073", "text": "function functie1() {\r\n console.log('Hallo');\r\n}", "title": "" }, { "docid": "021445c3734e5898aaf3d4192aacd51a", "score": "0.55645865", "text": "function f_arg() {\n}", "title": "" }, { "docid": "bf2532e794ea8020003938c7fdbd0166", "score": "0.5561163", "text": "enterFunctionArgument(ctx) {\n\t}", "title": "" }, { "docid": "a44ac1bff4cb30921e0f5911cdffad04", "score": "0.55599415", "text": "function Code(){}", "title": "" }, { "docid": "a935ef6cc843fbc95b1bcf7d458af18d", "score": "0.55599254", "text": "function one() {}", "title": "" }, { "docid": "6b2c3365475968136d6cb24401fef205", "score": "0.5556084", "text": "function ba(){}", "title": "" }, { "docid": "6b2c3365475968136d6cb24401fef205", "score": "0.5556084", "text": "function ba(){}", "title": "" }, { "docid": "6b2c3365475968136d6cb24401fef205", "score": "0.5556084", "text": "function ba(){}", "title": "" }, { "docid": "e0778229e069e8238c2968acf64fb712", "score": "0.55458754", "text": "function Whatever(param1, param2){\n do stuff here; \n}", "title": "" }, { "docid": "57c381c1ff2e5e98f42ba589899e30cd", "score": "0.5534174", "text": "initparams(args, globs) {\r\n const paramsfn = {};\r\n this.paramlist.forEach(name => {\r\n !(name in this.decl.parameters) && error(this, `unknown parameter \"${name}\" it must be one of \"${toString()}\"`);\r\n paramsfn[name] = paramfunc(this.decl.parameters[name].type, this._params[name] || this.decl.parameters[name].default).bind(this.locals || {});\r\n });\r\n this._params = new Proxy(paramsfn, {\r\n get: (target, property) => {\r\n try {\r\n let paramdef = this.decl.parameters[property.toString()];\r\n paramdef || this.error(`unknown parameter \"${property.toString()}\" used`);\r\n const type = types_1.gettype(paramdef.type);\r\n return target[property](args, globs, this._params, this._pojo, type);\r\n }\r\n catch (e) {\r\n error(this, `error when evaluating step parameter \"${String(property)}\" due to => \\n \"${e.message}\" `);\r\n }\r\n },\r\n });\r\n }", "title": "" }, { "docid": "4880b05b00fda37d35eb13af0aa6fc7c", "score": "0.55336154", "text": "function fun1(){\n \n}", "title": "" }, { "docid": "28edcfe0efd33d9945dd6c143c0a6c04", "score": "0.55276096", "text": "enterFunctionDefinition(ctx) {\n }", "title": "" }, { "docid": "fb92695ad5aa9d1dd9b398add3ee0eb7", "score": "0.55271626", "text": "funcao2(){\n //...\n }", "title": "" }, { "docid": "a08e86975d8bf0a766f80636504a3a1f", "score": "0.5526876", "text": "beforeHook() {}", "title": "" }, { "docid": "a11a4e774577436c85c34a403841dc1f", "score": "0.5525869", "text": "function exampleFunction(string){ // the \"function\" keyword, name of function \"examplFunction\", input parameters \"(string)\"\n console.log(string); // code to run if function is called\n}", "title": "" }, { "docid": "e9778e9969a8a3235d4cfe91d77a0770", "score": "0.5520055", "text": "function fun1(){\n\n}", "title": "" }, { "docid": "28a5d61c8e3b51f70b1b72429f7ec5be", "score": "0.5518272", "text": "function fun1(){\r\n\r\n}", "title": "" }, { "docid": "2e2bc75c601076c307a519935c99bab9", "score": "0.55152845", "text": "function F01() {\n console.log('jasuil F01')\n}", "title": "" }, { "docid": "343ba7895619c97e75f963dc275be256", "score": "0.55127984", "text": "function f1(){\n console.log(\"f1 function\");\n}", "title": "" }, { "docid": "ffb51bf2057ff6c2b897876cdf6d6c0e", "score": "0.55101085", "text": "function funcdef() {\n cont(require(\"t_string\"), require(\"(\"), pushlex(\")\"), commasep(funcarg), require(\")\"), poplex, block);\n }", "title": "" }, { "docid": "ffb51bf2057ff6c2b897876cdf6d6c0e", "score": "0.55101085", "text": "function funcdef() {\n cont(require(\"t_string\"), require(\"(\"), pushlex(\")\"), commasep(funcarg), require(\")\"), poplex, block);\n }", "title": "" }, { "docid": "8175316973867a02146016dff5079e30", "score": "0.5503145", "text": "function fun1() { }", "title": "" }, { "docid": "7f18deb611464d53765b28094317277d", "score": "0.5496185", "text": "function index$1(){\n return function () {}\n}", "title": "" }, { "docid": "4f66fd2f510a79c40140fdebc7528594", "score": "0.5491493", "text": "function f1() {\n\n}", "title": "" }, { "docid": "97931c2b5b4737def8f0397507ba71e0", "score": "0.5483611", "text": "enterOC_FunctionName(ctx) {}", "title": "" }, { "docid": "b5e688bb6c09b218d7993c4f8354d6c9", "score": "0.5481089", "text": "function invoke(fn, self, locals) {\n // get the arguments for the fn by calling annotate.\n // which then looks up those args as keys in the cache\n // and returns those key's values as an array\n // this new array is whats actually used as the arguments when we apply the fn\n var args = _.map(annotate(fn), function(token) {\n if(_.isString(token)) {\n // this lets us override the cache value with a value of our own\n return locals && locals.hasOwnProperty(token) ?\n locals[token] :\n getService(token);\n } else {\n throw 'Incorrect injection token! Expected a string, got ' + (typeof token);\n }\n });\n // we need to do this because the fn is stored as the last value in the array \n if (_.isArray(fn)) {\n fn = _.last(fn);\n }\n return fn.apply(self, args);\n }", "title": "" }, { "docid": "f3a7c6437c44b687f51c0be564467c8b", "score": "0.5477619", "text": "function f1(){\n console.log('f1');\n}", "title": "" }, { "docid": "d91d41125828efccf7a642318d4ba162", "score": "0.54759383", "text": "function testFn1() {}", "title": "" }, { "docid": "e34a6ca6184a1d1dbe1889b20f1515e2", "score": "0.5475028", "text": "function fn() {}", "title": "" }, { "docid": "8441f0a25211bcbaae43554010367079", "score": "0.54724765", "text": "function fun01() {return \"output: fun01\";}", "title": "" }, { "docid": "ca95ab546a90f8e7cb1deeb8d813bb10", "score": "0.54646635", "text": "enterSpecificFunctionInceptor(ctx) {\n\t}", "title": "" }, { "docid": "d84998590e50447500339a47d122774f", "score": "0.5462228", "text": "_init() {\n this._loadFunctionSpec()\n }", "title": "" }, { "docid": "353fea608d745e707c9b2797fdc42cc4", "score": "0.54590523", "text": "function mainFn () {\n var\n start_map = xhiObj.getCommandMapFn( 'dev_start' ),\n stop_map = xhiObj.getCommandMapFn( 'dev_stop' ),\n start_xhi_obj = xhiObj.xhiUtilObj._makeExtractMap_( xhiObj ),\n stop_xhi_obj = xhiObj.xhiUtilObj._makeExtractMap_( xhiObj ),\n start_fn = require(\n xhiObj.fqLibDirname + '/xhi_' + start_map.id + '.js'\n ),\n stop_fn = require(\n xhiObj.fqLibDirname + '/xhi_' + stop_map.id + '.js'\n )\n ;\n\n logFn( prefixStr + 'Start' );\n\n start_xhi_obj.commandMap = start_map;\n start_xhi_obj.nextFn = onSuccessFn;\n start_xhi_obj.catchFn = onFailFn;\n\n stop_xhi_obj.commandMap = stop_map;\n stop_xhi_obj.nextFn = start_fn.bind( start_xhi_obj );\n stop_xhi_obj.catchFn = onFailFn;\n\n stop_fn.call( stop_xhi_obj );\n }", "title": "" }, { "docid": "0609b2b53872713e099803cdc868915b", "score": "0.5458196", "text": "function stepFct(nextStepFct){\n takeSample(nextStepFct); \n}", "title": "" }, { "docid": "59863c63e68998e2975fd1a48dc75941", "score": "0.54530954", "text": "function stuff(){\n\t\n}", "title": "" }, { "docid": "f0e15a614078574b1300e36436e19e8c", "score": "0.5450202", "text": "function warmUp(data) {\n return console.log(\"Imported this function: \", data);\n}", "title": "" }, { "docid": "f0e15a614078574b1300e36436e19e8c", "score": "0.5450202", "text": "function warmUp(data) {\n return console.log(\"Imported this function: \", data);\n}", "title": "" }, { "docid": "a70f0ee7e432f973512160bd7df09854", "score": "0.5443496", "text": "function fun1() {\r\n\r\n}", "title": "" }, { "docid": "29f7895680663bf387814489521e83de", "score": "0.5442935", "text": "test_params() {\n\t\tparse(`how to increase x by y: x+y;`);\n\t\tg = the.methods['increase'];\n\t\t// big python headache: starting from position 0 or 1 ?? (self,x,y) etc\n\t\t// args = [Argument({'name': 'x', 'preposition': None, 'position': 1, }),\n\t\t//\t\t Argument({'preposition': 'by', 'name': 'y', 'position': 2, })];\n\t\targs = [Argument({'name': 'x', 'preposition': null, 'position': 0,}),\n\t\t\tArgument({'preposition': 'by', 'name': 'y', 'position': 1,})];\n\t\tf = FunctionDef({'body': 'x+y;', 'name': 'increase', 'arguments': args,});\n\t\tassert_equals(f, g);\n\t\treturn f;\n\t}", "title": "" }, { "docid": "c8a69526f847b96d55abfc09b7294f65", "score": "0.54415053", "text": "function functionOne(x) { console.log(x); }", "title": "" }, { "docid": "5720750464763f8c0cdcf4a324c99018", "score": "0.54393506", "text": "function inception() {\n inception()\n}", "title": "" }, { "docid": "f54163c3059b3df0aa413e0c3b5f39a7", "score": "0.5433492", "text": "function f1(x){ return x*2 }", "title": "" }, { "docid": "438039ee4ddd3af87cad4f9f602930a6", "score": "0.5433152", "text": "saludar(fn) { //le pasamos una funcion como parametro a otra funcion\n console.log(`Hola, me llamo ${this.nombre} ${this.apellido}`);\n if (fn) { //vamos a ver si existe la funcion para responder el saludo\n fn(this.nombre, this.apellido, false); //llamamos a la funcion\n\n }\n }", "title": "" }, { "docid": "3a2655302a2fd19d10bd291bc39daeb6", "score": "0.54302007", "text": "function exampleFunction(){\r\n\tconsole.log(\"exampole function is working\");\r\n}", "title": "" }, { "docid": "7d23045643825139482c0c93a7979481", "score": "0.54286414", "text": "function fun1() {\n\n}", "title": "" }, { "docid": "aab10880ed7ad8eb920fb444382d038d", "score": "0.5425186", "text": "function embed(anotherfunction, value) {\n anotherfunction(value);\n}//this is the embedded function which takes a function and use it to execute", "title": "" }, { "docid": "85398e8835ab3948f5fdba2a27b2daf7", "score": "0.54195094", "text": "function firstClassFunction(fn){ // passing function as paramenter\n fn(); // passed function\n}", "title": "" }, { "docid": "ffa39c5220ed92316f59ad4042001c5c", "score": "0.54157346", "text": "function f2 (){\r\n console.log('f2 is calling');\r\n}", "title": "" } ]
7d317ceca04455e9d2cd9e1f70a7b646
Create the icon on the block.
[ { "docid": "ec5b49f290e9cde2200b4519d14d0991", "score": "0.7590472", "text": "createIcon() {\n if (this.iconGroup_) {\n // Icon already exists.\n return;\n }\n /* Here's the markup that will be generated:\n <g class=\"blocklyIconGroup\">\n ...\n </g>\n */\n this.iconGroup_ =\n dom.createSvgElement(Svg.G, {'class': 'blocklyIconGroup'}, null);\n if (this.block_.isInFlyout) {\n dom.addClass(\n /** @type {!Element} */ (this.iconGroup_),\n 'blocklyIconGroupReadonly');\n }\n this.drawIcon_(this.iconGroup_);\n\n this.block_.getSvgRoot().appendChild(this.iconGroup_);\n browserEvents.conditionalBind(\n this.iconGroup_, 'mouseup', this, this.iconClick_);\n this.updateEditable();\n }", "title": "" } ]
[ { "docid": "ba588cf1a88fa59644c611562fb5648e", "score": "0.7232946", "text": "function GenIcon() {\n}", "title": "" }, { "docid": "61d2c03c52d12a0006b23c1cd65a32bc", "score": "0.6995547", "text": "function icon(){}", "title": "" }, { "docid": "e83a2ec44c0ac042ca64cad716792a80", "score": "0.6935933", "text": "function PROJECT_ELEMENT_ICON$static_(){ProjectsTodosWidgetProject.PROJECT_ELEMENT_ICON=( ProjectsTodosWidgetProject.PROJECT_BLOCK.createElement(\"icon\"));}", "title": "" }, { "docid": "262a48939298874260d067cd3fc0a695", "score": "0.6855684", "text": "function LIST_ELEMENT_ICON$static_(){WidgetContentListBase.LIST_ELEMENT_ICON=( WidgetContentListBase.LIST_BLOCK.createElement(\"icon\"));}", "title": "" }, { "docid": "641285bd1762bf7e432e0a115f97aceb", "score": "0.6645216", "text": "function makeIcon(type, title) {\n return { type: type, title: title, width: 20 };\n}", "title": "" }, { "docid": "c49502d5efb14f4f07d6635258d8148f", "score": "0.6628318", "text": "getIcon() { return this.block.value?.format?.bookmark_icon }", "title": "" }, { "docid": "e622b1790326d929a74935d023c36a27", "score": "0.6578624", "text": "renderIcons() {\n const iconSize = this.opts.get('iconSize');\n const iconColor = this.opts.get('iconColor');\n const iconCount = this.opts.get('iconCount');\n const iconCode = this.opts.get('iconCode');\n\n let iconWidth;\n for (let i = 0; i < iconCount; i += 1) {\n const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n text.setAttribute('class', 'icon');\n text.setAttribute('font-size', iconSize);\n text.setAttribute('fill', iconColor);\n text.setAttribute('dominant-baseline', 'central');\n text.setAttribute('text-anchor', 'middle');\n text.setAttribute('y', this.innerHeight / 2 + this.yContentOffset);\n text.setAttribute('font-family', 'FontAwesomeb64');\n text.setAttribute('mask', `url(#${this.id}_clip)`);\n\n // Add icon to block's svg to be able to calculate its dimensions\n text.textContent = iconCode;\n this.root.appendChild(text);\n\n // Retrieve width of icon and adjust x position it accordingly\n iconWidth = iconWidth || text.getBBox().width;\n const iconDistance = (this.innerWidth - iconCount * iconWidth) / (iconCount + 1);\n const posX = iconDistance + iconWidth / 2 + (iconDistance + iconWidth) * i;\n text.setAttribute('x', this.xOffset + posX);\n }\n }", "title": "" }, { "docid": "5d883ee6081ecd05b1e4f58a575f8153", "score": "0.64995676", "text": "static createIcon(iconName, {\n asElement=false,\n classes=[],\n align=null,\n dataset={},\n }={})\n {\n let [iconClass, name] = helpers.getIconClassAndName(iconName);\n\n let icon = document.createElement(\"span\");\n icon.classList.add(\"font-icon\");\n icon.classList.add(iconClass);\n icon.lang = \"icon\";\n icon.innerText = name;\n\n for(let className of classes)\n icon.classList.add(className);\n if(align != null)\n icon.style.verticalAlign = align;\n for(let [key, value] of Object.entries(dataset))\n icon.dataset[key] = value;\n\n if(asElement)\n return icon;\n else\n return icon.outerHTML;\n }", "title": "" }, { "docid": "c54a8047f0ae0b68199a45502484224c", "score": "0.64506924", "text": "genIcon (type, cb, shouldDeprecate = true) {\n const icon = this[`${type}Icon`]\n const eventName = `click:${kebabCase(type)}`\n cb = cb || this[`${type}IconCb`]\n\n if (shouldDeprecate && type && cb) {\n deprecate(`:${type}-icon-cb`, `@${eventName}`, this)\n }\n\n const data = {\n props: {\n color: this.validationState,\n dark: this.dark,\n disabled: this.disabled,\n light: this.light\n },\n on: !(this.$listeners[eventName] || cb)\n ? null\n : {\n click: e => {\n e.preventDefault()\n e.stopPropagation()\n\n this.$emit(eventName, e)\n cb && cb(e)\n },\n // Container has mouseup event that will\n // trigger menu open if enclosed\n mouseup: e => {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n }\n\n return this.$createElement('div', {\n staticClass: `v-input__icon v-input__icon--${kebabCase(type)}`,\n key: `${type}${icon}`\n }, [\n this.$createElement(\n VIcon,\n data,\n icon\n )\n ])\n }", "title": "" }, { "docid": "b766722f467a66b2efe51cc5e7a69223", "score": "0.6434709", "text": "static xicon(icon, arialabel) {\n if (icon instanceof Object) { // this is probably a pre-defined icon\n return icon;\n }\n let i = document.createElement('span');\n i.classList.add('icon');\n\n if (Array.isArray(icon)) {\n for (let c of icon) {\n i.classList.add(c);\n }\n } else {\n i.classList.add(icon);\n }\n\n if (arialabel) {\n i.setAttribute('aria-label', arialabel);\n } else {\n i.setAttribute('aria-hidden', \"true\");\n }\n return i;\n }", "title": "" }, { "docid": "ad587ca8ab5d6d1bfe63bc405cd74e18", "score": "0.643271", "text": "renderIcon(data) {\n const e = document.createElement('div');\n e.className = this.createIconClass(data);\n e.appendChild(document.createTextNode(data.iconLabel));\n return e;\n }", "title": "" }, { "docid": "de913e228fa1938d3a31f390f80ddb89", "score": "0.6431321", "text": "getIcon() { return this.block.value?.format?.page_icon }", "title": "" }, { "docid": "065373983afcf38cc04344c0d416ad68", "score": "0.6309668", "text": "getIcon() { return this.block.value?.format?.drive_properties?.icon }", "title": "" }, { "docid": "a12904e23cc787b0bc4795b382c93849", "score": "0.6292802", "text": "get iconTemplate() {\n return !this.hasIcon\n ? \"\"\n : html`<simple-icon-lite\n id=\"icon\"\n aria-hidden=\"true\"\n icon=\"${this.currentIcon}\"\n part=\"icon\"\n ></simple-icon-lite>`;\n }", "title": "" }, { "docid": "4b0237688c1beca3dbf9618a73f8ea05", "score": "0.6254222", "text": "get icon(){ return this.__image ? this.__image.render.texture : ''; }", "title": "" }, { "docid": "ebf06aa1f409d55480ba7ce83d356473", "score": "0.6234792", "text": "function createBirdIcon(){\n var birdIcon = null;\n birdIcon = L.icon({\n iconUrl: \"https://i.ibb.co/gdVH9k8/birdIcon.png\",\n iconSize: [50, 50],\n iconAnchor: [25, 50],\n popupAnchor: [-3, -50]\n });\n return birdIcon;\n }", "title": "" }, { "docid": "b34d6259e78e63cfcb32814a92ad1ce2", "score": "0.623063", "text": "function normalIcon() {\n return {\n url: 'http://1.bp.blogspot.com/_GZzKwf6g1o8/S6xwK6CSghI/AAAAAAAAA98/_iA3r4Ehclk/s1600/marker-green.png'\n };\n}", "title": "" }, { "docid": "8514cddc2f2491d6e1bfc0df94f9a8e3", "score": "0.6229114", "text": "function createGenericBlock(block){\n\n let bbox = block.getBBox()\n\n console.log(block)\n console.log(bbox)\n console.log(block.length)\n console.log(block.width)\n\n let iconW;\n let iconH;\n\n if (block.width < 140){\n iconW = 90;\n iconH = 90;\n }\n else{\n iconW = 130;\n iconH = 130;\n }\n\n block.clear()\n\n let rect\n console.log(block.desc)\n if(block.desc == \"bar\"){\n rect = block.rect(bbox.x - block.length/2, bbox.y - block.width/2 + 200, block.length, block.width, 15, 15).attr({style:BAR_STYLE})\n }\n else{\n rect = block.rect(bbox.x - block.length/2, bbox.y - block.width/2 + 200, block.length, block.width, 15, 15).attr({style:KITCHEN_STYLE})\n }\n\n bbox = rect.getBBox()\n\n switch(block.desc){\n case \"kitchen\":\n block.image(`../images/kitchen2.png`, bbox.cx - iconW/2, bbox.cy - iconH/2, iconW, iconH);\n break;\n case \"restroom\":\n block.image(`../images/restroom2.png`, bbox.cx - iconW/2, bbox.cy - iconH/2, iconW, iconH);\n break;\n case \"bar\":\n block.image(`../images/bar2.png`, bbox.cx - iconW/2, bbox.cy - iconH/2, iconW, iconH)\n block.attr({\n style:BAR_STYLE\n });\n break;\n }\n\n\n}", "title": "" }, { "docid": "4e4971173f3185e44a48d3085e71309d", "score": "0.6226955", "text": "function addIcon(name, data) {\n storage[name] = fullIcon(data);\n}", "title": "" }, { "docid": "5efe0d4307386f3d1014b32466ac3e54", "score": "0.6224652", "text": "function _icon(name){\n\treturn \"<img src='img/icon/\"+name+\".png'/>\";\n}", "title": "" }, { "docid": "5efe0d4307386f3d1014b32466ac3e54", "score": "0.6224652", "text": "function _icon(name){\n\treturn \"<img src='img/icon/\"+name+\".png'/>\";\n}", "title": "" }, { "docid": "70222cfcc132dcfe541e6f0fb18bda21", "score": "0.6192144", "text": "function normalIcon() {\n return {\n url: 'http://1.bp.blogspot.com/_GZzKwf6g1o8/S6xwK6CSghI/AAAAAAAAA98/_iA3r4Ehclk/s1600/marker-green.png'\n };\n }", "title": "" }, { "docid": "152a8d4b045839da996d00e445540a85", "score": "0.6154248", "text": "getIcon() {\n return \"message-square\";\n }", "title": "" }, { "docid": "6c76bc44b191a01d0d6625d0514bf007", "score": "0.6143627", "text": "function _genIcons() {\n _genIcons = account_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(addresses) {\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", addresses.map(function (i) {\n var circles = polkadotIcon(i, {\n isAlternative: false\n }).map(function (_ref) {\n var cx = _ref.cx,\n cy = _ref.cy,\n fill = _ref.fill,\n r = _ref.r;\n return \"<circle cx='\".concat(cx, \"' cy='\").concat(cy, \"' fill='\").concat(fill, \"' r='\").concat(r, \"' />\");\n }).join(\"\");\n return [i, \"<svg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'>\".concat(circles, \"</svg>\")];\n }));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _genIcons.apply(this, arguments);\n}", "title": "" }, { "docid": "a79338ae5f0e13d7c2319cbc122474dc", "score": "0.6141872", "text": "function createIcon(path, id) {\r\n var img = document.createElement('img');\r\n img.src = path;\r\n img.setAttribute('qid', id);\r\n img.className = 'size';\r\n img.addEventListener('click', toggleMark);\r\n return img;\r\n}", "title": "" }, { "docid": "f0386bce3857897ea89fe0710b7486bf", "score": "0.60997874", "text": "function iconInstance(kitaStatus){\n var name = \"\";\n if(kitaStatus==0){ name = \"box\";}\n else if(kitaStatus==1){ name = \"box-checked\";}\n else if(kitaStatus==2){ name = \"box-crossed\";}\n return L.icon({\n iconUrl: \"img/\"+ name + \".png\",\n shadowUrl: null,\n iconSize: [16,16],\n shadowSize: [0,0],\n iconAnchor: [8,16],\n shadowAnchor: [0,0],\n popupAnchor:[0,-16]\n });\n}", "title": "" }, { "docid": "f36b932734752669a1f871c0d28dfaf0", "score": "0.6098664", "text": "function create_if_block_1(ctx) {\n\tlet span;\n\n\treturn {\n\t\tc() {\n\t\t\tspan = internal_element(\"span\");\n\t\t\tspan.innerHTML = `<i aria-hidden=\"true\" class=\"Glyph Glyph--basket\"></i>`;\n\t\t\tattr(span, \"class\", \"AddToBagButtonLarge__basketIcon\");\n\t\t},\n\t\tm(target, anchor) {\n\t\t\tinsert(target, span, anchor);\n\t\t},\n\t\td(detaching) {\n\t\t\tif (detaching) detach(span);\n\t\t}\n\t};\n}", "title": "" }, { "docid": "7c40149492ff572b741b4a3307fa9e43", "score": "0.6089602", "text": "icon(icon) {\n this.__data['icon'] = icon;\n\n return this;\n }", "title": "" }, { "docid": "e308367754de12d4635f5d1cda834ed0", "score": "0.60869676", "text": "function iconFactory(className) {\n return $('<i></i>').addClass(className);\n }", "title": "" }, { "docid": "85c2b84c4829f36461c1013be296bfaf", "score": "0.60738426", "text": "function addIcon(nj, type) {\r\n\t\tswitch (type) {\r\n\t\tcase 'photo':\r\n\t\t\tdmc = 'photo';\r\n\t\t\tsm = 'image';\r\n\t\t\tbreak;\r\n\t\tcase 'media':\r\n\t\t\tdmc = 'generic';\r\n\t\t\tsm = 'embed';\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tnj.iconContainer.append(mediaIcon(type, dmc, sm));\r\n\t\tnj.expandActionWrapper.addClass('icon-added');\r\n\t\tnj.collapseActionWrapper.addClass('icon-added');\r\n\t}", "title": "" }, { "docid": "323370987f0a605e6c5ba5ab2146f75d", "score": "0.605085", "text": "function renderIcon(icon) {\n return function renderIcon(ctx, left, top, styleOverride, fabricObject) {\n var size = this.cornerSize;\n ctx.save();\n ctx.translate(left, top);\n ctx.rotate(fabric.util.degreesToRadians(fabricObject.angle));\n ctx.drawImage(icon, -size/2, -size/2, size, size);\n ctx.restore();\n }\n}", "title": "" }, { "docid": "335d9890c9c398b01441fb3c262a9e02", "score": "0.6046433", "text": "function showMenuItemIcon() { // Public method\n var iconElm = createElm(\"span\");\n iconElm.id = this.id + \"Icon\";\n iconElm.className = arguments[0];\n this.insertBefore(iconElm, this.firstChild);\n var height;\n if (ie) {\n height = getPropIntVal(iconElm, \"height\");\n }\n else {\n height = iconElm.offsetHeight;\n }\n if( arguments[0]==\"icon_ip\" || arguments[0]==\"icon_host\" || arguments[0]==\"icon_switch\" || arguments[0]==\"icon_aheevaphone\")\n {\n\t iconElm.style.top = Math.floor((this.offsetHeight - (height/10)) / 2) + px;\n }\n else\n {\n \ticonElm.style.top = Math.floor((this.offsetHeight - height) / 2) + px;\n }\n if (ie) {\n var left = getPropIntVal(iconElm, \"left\");\n if (ie55 || ie6) {\n iconElm.style.left = (left - getPropIntVal(this, \"padding-left\")) + px;\n }\n else {\n iconElm.style.left = left + px;\n }\n }\n this.iconClassName = iconElm.className;\n if (arguments.length > 1 && arguments[1].length > 0) {\n this.iconClassNameOver = arguments[1];\n }\n this.iconObj = iconElm;\n this.setIconClassName = function(className) { // Public method\n this.iconClassName = className;\n this.iconObj.className = this.iconClassName;\n };\n this.setIconClassNameOver = function(classNameOver) { // Public method\n this.iconClassNameOver = classNameOver;\n };\n}", "title": "" }, { "docid": "32b0cfb2651f0fc3663886166a9f4c7f", "score": "0.60223496", "text": "static get definition() {\n return {\n icon: '🌟'\n }\n }", "title": "" }, { "docid": "e578d99a884c9386ea3537fcb6a4be3b", "score": "0.60214406", "text": "function createShowGraphCentralitiesCell() {\n return '<td>'\n + '<img class=\"icon iconBtn showGraphCentralities\" src=\"IMG/open-iconic/svg/eye.svg\" alt=\"cn\">'\n + '</td>';\n}", "title": "" }, { "docid": "c48a57692bfff763520a99e324e2e880", "score": "0.6020747", "text": "function getIcon(iconType, type) {\n switch (type) {\n case 'WEATHER':\n var icon = document.createElement('i');\n icon.id = \"weatherInfo\";\n icon.innerHTML = \"<i id =\\\"weatherIcon\\\" class = \\\"\" + iconType + \"\\\"></i>\";\n document.getElementById(\"weatherInfo\").insertBefore(icon, document.getElementById(\"weatherInfo\").firstChild);\n break;\n case 'WIND':\n var icon = document.createElement('i');\n icon.id = 'windInfo';\n icon.innerHTML = \"<i id =\\\"windIcon\\\" class = \\\"\" + iconType + \"\\\"></i>\";\n document.getElementById('windInfo').insertBefore(icon, document.getElementById('windInfo').firstChild);\n break;\n }\n}", "title": "" }, { "docid": "ccd0bccebc7f9b5036ee3b6d8c429a32", "score": "0.6001102", "text": "get block() {\n return {\n name: 'block',\n title: 'Centered image',\n icon: objectCenter,\n modelElements: ['imageBlock'],\n isDefault: true\n };\n }", "title": "" }, { "docid": "7ab0637775c05105bf3403f21ebd51ea", "score": "0.59688854", "text": "prepareFieldForIcon() {\n\t\t// 0 prepare our container\n\t\tlet el = document.createElement('div')\n\t\tel.classList.add('with-icon')\n\t\t// 1 insert next to the field\n\t\tthis.el.field.insertAdjacentElement('beforebegin', el)\n\t\t// 2 move the field into it\n\t\tel.appendChild(this.el.field)\n\t}", "title": "" }, { "docid": "4a9bfc89c630cd2a5074117c12bba90c", "score": "0.5952579", "text": "function itemIcon (color) {\n var pathAttrs = [\n {\n d: 'M0 0h24v24H0z',\n fill: 'none'\n },\n {\n d: 'M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z'\n }\n ];\n\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_Icons_makeIcon__[\"a\" /* default */])(color, pathAttrs);\n}", "title": "" }, { "docid": "c754e7303e9f25ba919c0d70d81bab76", "score": "0.59468013", "text": "function Icon_Icon({\n className = '',\n title = '',\n type\n}) {\n let pathData = null;\n\n switch (type) {\n case 'arrow':\n pathData = PATH_ARROW;\n break;\n\n case 'bug':\n pathData = PATH_BUG;\n break;\n\n case 'code':\n pathData = PATH_CODE;\n break;\n\n case 'components':\n pathData = PATH_COMPONENTS;\n break;\n\n case 'copy':\n pathData = PATH_COPY;\n break;\n\n case 'error':\n pathData = PATH_ERROR;\n break;\n\n case 'facebook':\n pathData = PATH_FACEBOOK;\n break;\n\n case 'flame-chart':\n pathData = PATH_FLAME_CHART;\n break;\n\n case 'profiler':\n pathData = PATH_PROFILER;\n break;\n\n case 'ranked-chart':\n pathData = PATH_RANKED_CHART;\n break;\n\n case 'timeline':\n pathData = PATH_SCHEDULING_PROFILER;\n break;\n\n case 'search':\n pathData = PATH_SEARCH;\n break;\n\n case 'settings':\n pathData = PATH_SETTINGS;\n break;\n\n case 'store-as-global-variable':\n pathData = PATH_STORE_AS_GLOBAL_VARIABLE;\n break;\n\n case 'strict-mode-non-compliant':\n pathData = PATH_STRICT_MODE_NON_COMPLIANT;\n break;\n\n case 'warning':\n pathData = PATH_WARNING;\n break;\n\n default:\n console.warn(`Unsupported type \"${type}\" specified for Icon`);\n break;\n }\n\n return /*#__PURE__*/react[\"createElement\"](\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n className: `${Icon_default.a.Icon} ${className}`,\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\"\n }, title && /*#__PURE__*/react[\"createElement\"](\"title\", null, title), /*#__PURE__*/react[\"createElement\"](\"path\", {\n d: \"M0 0h24v24H0z\",\n fill: \"none\"\n }), /*#__PURE__*/react[\"createElement\"](\"path\", {\n fill: \"currentColor\",\n d: pathData\n }));\n}", "title": "" }, { "docid": "b8bea7f3f01e2648e56a492131c7b8a4", "score": "0.59389716", "text": "function createeIdenticon() {\n\n\t\t/* creating the background */\n\t\tvar canvas = document.createElement('canvas');\n\t\tcanvas.width = SIZE;\n\t\tcanvas.height = SIZE;\n\n\t\tvar context = canvas.getContext('2d');\n\t\tvar color = generateColorFromHash(hash); \n\n\t\tvar colorRotated = rotateColor(color);\n\n\t\t/* creating the background color squares */\n\t\tvar index = 0; // the index is used to iterate through the sha256 string\n\t\tfor (var x = 0; x < GRID; x++) {\n\t\t\tfor (var y = 0; y < GRID; y++) {\n\t\t\t\t\n\t\t\t\t// sinze there can be more squres then the lenght of the hash, the index needs to be reset\n\t\t\t\tif(hash.length -1 == index)\n\t\t\t\t\tindex = 0; \n\t\t\t\t\n\t\t\t\tfillBlock(x, y, generateColorVariation(color, hash.charAt(index)), context);\n\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\n\t\t/* creating the avatar image */\n\t\tindex = 0;\n\t\tfor (var x = 1; x < GRID -1 ; x++) {\n\t\t\tfor (var y = 1; y < GRID -1 ; y++) {\n\t\t\t\t\n\t\t\t\tif(hash.length -1 == index)\n\t\t\t\t\tindex = 0; \n\t\t\t\t\n\t\t\t\t// calculating the fill chance \n\t\t\t\tif(parseInt(hash.charAt(index), 16) % 16 >= MODULO_RANGE ){\n\t\t\t\t\tfillBlock(x, y, generateColorVariation(colorRotated, hash.charAt(index)) , context);\n\t\t\n\t\t\t\t\t//mirroring the block\n\t\t\t\t\tfillBlock(GRID - (x+1), y, generateColorVariation(colorRotated, hash.charAt(index)) , context);\n\t\t\t\t}\n\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\n\t\treturn canvas.toDataURL();\n\t}", "title": "" }, { "docid": "79841675ef73e74f3f135758d15dc4d6", "score": "0.59230536", "text": "function createIcon(name, options) {\n options = options || {};\n var el = document.createElement('a');\n var shortcut = options.shortcut || tooltips[name];\n if (shortcut) {\n shortcut = fixShortcut(shortcut);\n el.title = shortcut;\n el.title = el.title.replace('Cmd', '⌘');\n if (isMac) {\n el.title = el.title.replace('Alt', '⌥');\n }\n }\n\n el.className = options.className || 'icon-' + name;\n // $(el).tooltip();\n var li = document.createElement('li');\n li.appendChild(el);\n return li;\n}", "title": "" }, { "docid": "f3ba5312701c5692721b4c3fc3284b56", "score": "0.59142387", "text": "function newWindowIcon (color) {\n var pathAttrs = [\n {\n d: 'M0 0h24v24H0z',\n fill: 'none'\n },\n {\n d: 'M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z'\n }\n ];\n\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_Icons_makeIcon__[\"a\" /* default */])(color, pathAttrs);\n}", "title": "" }, { "docid": "fc329e270bcd1e6d8f6715806e2eb693", "score": "0.58881754", "text": "function closeIcon () {\n return '<svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M.3 9.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3L5 6.4l3.3 3.3c.2.2.5.3.7.3.2 0 .5-.1.7-.3.4-.4.4-1 0-1.4L6.4 5l3.3-3.3c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L5 3.6 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4L3.6 5 .3 8.3c-.4.4-.4 1 0 1.4z\" fill=\"#000\" fill-rule=\"nonzero\"/></svg>'\n }", "title": "" }, { "docid": "bb614693a4342d3fb32111593a14767e", "score": "0.58871806", "text": "setIcon(i){this.icon=i}", "title": "" }, { "docid": "3a3a7a462f56f3553466d10c9dfd8218", "score": "0.5861399", "text": "drawIcon() {\n return this.bitmap.drawIcon(...arguments);\n }", "title": "" }, { "docid": "1aa5f0ed5cf6571817bac64369411875", "score": "0.58611053", "text": "function attachIcon() {\n var iconID = data.current.weather[0].icon;\n\n var iconURL = \"https://api.openweathermap.org/img/w/\" + iconID + \".png\";\n\n $(\"#weather-icon\").attr(\"src\", iconURL);\n $(\"#weather-icon\").attr(\"alt\", data.current.weather.description);\n }", "title": "" }, { "docid": "e422a855f6b5c9611289aaa821241ac8", "score": "0.5859623", "text": "function createNotificationIcon(icon_name) {\n\t// log( \"jenkins: createNotificationIcon, icon_name: \" + icon_name );\n\tlet params = {icon_name : icon_name, style_class : icon_name};\n\n\treturn new St.Icon(params);\n}", "title": "" }, { "docid": "b20e1f66babde15e0a45a039b3e55c02", "score": "0.5846994", "text": "function addIcon(iconName, eventType, callback) {\n const iNode = document.createElement('I');\n const iName = iconName !== '' ? `fa-${iconName}` : 'fa-pencil';\n\n iNode.classList.add('fa');\n iNode.classList.add(iName);\n iNode.addEventListener(eventType, callback);\n return iNode;\n}", "title": "" }, { "docid": "2616da99df1c1ba3ca4c4d8f1dead392", "score": "0.5838086", "text": "function iconCreateFunction( cluster ){\n let childCount = cluster.getChildCount()\n\n let c = ' marker-cluster-';\n if (childCount < 10) {\n c += 'small'\n } else if (childCount < 50) {\n c += 'medium'\n } else {\n c += 'large'\n }\n\n return new L.DivIcon({\n html: `<div><span>${childCount}</span></div>`\n , className: 'marker-cluster' + c\n , iconSize: new L.Point(40, 40)\n })\n }", "title": "" }, { "docid": "2943a575ea9477a421b0a3a908fa352a", "score": "0.5817174", "text": "icon() {\r\n // No point returning an icon if we don't know where to draw it\r\n if (this.iconPosition() == null) {\r\n return null;\r\n }\r\n\r\n // Get position for display\r\n var lat = this.iconPosition()[0];\r\n var lon = this.iconPosition()[1];\r\n\r\n // Generate full symbol for display\r\n var detailedSymb = showFullSymbolDetails || this.entitySelected();\r\n var mysymbol = new ms.Symbol(this.symbolCode(), {\r\n size: 35,\r\n staffComments: detailedSymb ? this.firstDescrip().toUpperCase() : \"\",\r\n additionalInformation: detailedSymb ? this.secondDescrip().toUpperCase() : \"\",\r\n direction: (this.heading != null) ? this.heading : \"\",\r\n altitudeDepth: (this.iconAltitude() != null && detailedSymb) ? (\"FL\" + this.iconAltitude() / 100) : \"\",\r\n speed: (this.speed != null && detailedSymb) ? (this.speed.toFixed(0) + \"KTS\") : \"\",\r\n type: this.mapDisplayName().toUpperCase(),\r\n dtg: ((!this.fixed && this.posUpdateTime != null && detailedSymb) ? this.posUpdateTime.utc().format(\"DDHHmmss[Z]MMMYY\").toUpperCase() : \"\"),\r\n location: detailedSymb ? (Math.abs(lat).toFixed(4).padStart(7, '0') + ((lat >= 0) ? 'N' : 'S') + Math.abs(lon).toFixed(4).padStart(8, '0') + ((lon >= 0) ? 'E' : 'W')) : \"\"\r\n });\r\n mysymbol = mysymbol.setOptions({\r\n size: 30,\r\n civilianColor: false\r\n });\r\n\r\n // Build into a Leaflet icon and return\r\n return L.icon({\r\n iconUrl: mysymbol.toDataURL(),\r\n iconAnchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y],\r\n });\r\n }", "title": "" }, { "docid": "086aa798a3365825ebc1234ddfab703d", "score": "0.5810354", "text": "function setupIconDiv(e) {\n e.style.backgroundRepeat = 'no-repeat';\n e.style.border = ICON_BORDER_SIZE + 'px solid black';\n e.style.width = ICON_SIZE + 'px';\n e.style.height = ICON_SIZE + 'px';\n e.style.position = 'absolute';\n var m = ICON_MARGIN + 'px ';\n e.style.margin = m + m + m + m;\n }", "title": "" }, { "docid": "baddf0712411772c4405ab0d7321811f", "score": "0.5808067", "text": "function appendRemoveIcon(node,subject,removeNode){var image=UI.utils.AJARImage(outlineIcons.src.icon_remove_node,'remove',undefined,dom);image.addEventListener('click',remove_nodeIconMouseDownListener);// image.setAttribute('align', 'right') Causes icon to be moved down\nimage.node=removeNode;image.setAttribute('about',subject.toNT());image.style.marginLeft=\"5px\";image.style.marginRight=\"10px\";//image.style.border=\"solid #777 1px\";\nnode.appendChild(image);return image;}", "title": "" }, { "docid": "ef2c69c063c13c266f2f1df27324ec5b", "score": "0.58075523", "text": "function createShowGraphCoversCell() {\n return '<td>'\n + '<img class=\"icon iconBtn showGraphCovers\" src=\"IMG/open-iconic/svg/eye.svg\" alt=\"co\">'\n + '</td>';\n}", "title": "" }, { "docid": "78dcd8187a850414d1b4b384338b325c", "score": "0.5807431", "text": "function getIcon(type) {\n switch (type) {\n case 'alert':\n return React.createElement(IconErrorSmall, {\n className: \"wds-banner-notification__icon-mark\"\n });\n\n case 'warning':\n return React.createElement(IconAlertSmall, {\n className: \"wds-banner-notification__icon-mark\"\n });\n\n case 'success':\n return React.createElement(IconCheckmarkCircleSmall, {\n className: \"wds-banner-notification__icon-mark\"\n });\n\n default:\n return React.createElement(IconFlagSmall, {\n className: \"wds-banner-notification__icon-mark\"\n });\n }\n}", "title": "" }, { "docid": "04dc188bc27a3ad969a182481e2c505a", "score": "0.57988745", "text": "function createShowGraphCell() {\n return '<td>'\n + '<img class=\"icon iconBtn showGraph\" src=\"IMG/open-iconic/svg/eye.svg\" alt=\"g\">'\n + '</td>';\n}", "title": "" }, { "docid": "51cbc169150be84b88684becdfb189b8", "score": "0.5788378", "text": "Icon(path, size) {\n\t\t\tconst i = element(\"ui-icon\");\n\t\t\t\n\t\t\ti.native.style.height = i.native.style.width = size + \"px\";\n\t\t\t\n\t\t\tconsole.log(path, fs.icon(path, size));\n\t\t\t\n\t\t\ti.add(public.Image(fs.icon(path, size)));\n\t\t\t\n\t\t\tif (fs.exists(path) && fs.isLink(path)) {\n\t\t\t\ti.add(public.Image(fs.icon(config.fs.icons.lnk, size)));\n\t\t\t}\n\t\t\t\n\t\t\treturn i;\n\t\t}", "title": "" }, { "docid": "b0107b006368611e52ab591b4a269762", "score": "0.5779307", "text": "get icon() { return namespace(this).icon; }", "title": "" }, { "docid": "a379ec55996c1551614d312407b3753b", "score": "0.577813", "text": "function icon(val){\n return '<div class=\"x-tree-node-el x-tree-node-leaf x-unselectable '+val+'\" unselectable=\"on\"><img width=\"16\" height=\"18\" class=\"x-tree-node-icon\" src=\"'+Ext.BLANK_IMAGE_URL+'\"/></div>';\n }", "title": "" }, { "docid": "51365bbc356ebdd04486373b4ddd611c", "score": "0.5770783", "text": "function createIcon() {\n if (document.getElementById('gamepad-button')) {\n return;\n }\n\n if (!subtitlesButton) {\n subtitlesButton =\n document.getElementsByClassName('ytp-subtitles-button')[0];\n }\n\n if (!gamepadButton) {\n var gamepadButtonTemplate = document.createElement('TEMPLATE');\n gamepadButtonTemplate.innerHTML = gamepadButtonHTML;\n gamepadButton = gamepadButtonTemplate.content.firstElementChild;\n }\n\n if (subtitlesButton) {\n subtitlesButton.parentElement.insertBefore(gamepadButton, subtitlesButton);\n } else {\n var logoElem = document.getElementById('logo');\n if (logoElem) {\n logoElem.append(gamepadButton);\n }\n }\n}", "title": "" }, { "docid": "18c6642f30a2bb1931904b03f74be3d2", "score": "0.57615787", "text": "mediumIcon() {\n const icon = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n icon.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n icon.setAttribute(\"viewBox\", \"0 0 52 68\");\n icon.innerHTML = `<defs><clipPath id=\"circleView\"><circle fill=\"#fff\" cx=\"26\" cy=\"26\" r=\"23\" /></clipPath></defs>\n <path fill=\"orange\" stroke=\"#aaa\" stroke-width=\"1\" stroke-opacity=\"0.6\" d=\"M 51 26 a 25 25 90 0 0 -50 0 c 0 11 5 20 10 25 l 12 12 c 3 3 3 3 6 0 l 11 -12 c 5 -5 11 -14 11 -25 z\" />\n <circle fill=\"#fff\" cx=\"26\" cy=\"26\" r=\"24\" opacity=\"0.8\" />\n <image x=\"2.5\" y=\"2.5\" width=\"47\" height=\"47\" href=\"${this.pic}\" clip-path=\"url(#circleView)\" />`;\n return icon;\n }", "title": "" }, { "docid": "8136b675d380dec7635aba123282daf2", "score": "0.57546616", "text": "drawIcon(){\n\t\tlet poly = document.createElementNS('http://www.w3.org/2000/svg', 'polyline')\n\t\tpoly.setAttribute('points', '0 0, 20 0, 20 20')\n\t\tpoly.setAttribute('stroke', 'black')\n\t\tpoly.setAttribute('fill', 'none')\n poly.setAttribute('stroke-width','3')\n return poly;\n }", "title": "" }, { "docid": "8d2af420a0b9bb3f7a0bbffed5201e78", "score": "0.5750679", "text": "getItemIcon (item) {\n\t\tif (item.isReview) {\n\t\t\tconst color = item.status === 'open' ? 'green' : (item.status === 'approved' ? 'purple' : 'red'); \n\t\t\treturn `review-${color}`;\n\t\t} else if (item.isCodemark) {\n\t\t\tif (item.type === 'comment' || item.type === 'issue') {\n\t\t\t\tconst color = !item.pinned ? 'gray' : (item.status === 'closed' ? 'purple' : 'green');\n\t\t\t\treturn `marker-${item.type}-${color}`;\n\t\t\t} else {\n\t\t\t\treturn item.type;\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "a92955fd1f826df0c34a2aafcbd5d416", "score": "0.5744874", "text": "function createSwitcherIcon(container) {\n container.each(function() {\n const icon = $(`<a class=\"${switcherClass}\" \n data-toggle=\"tooltip\"\n data-placement=\"top\"\n title=\"Change code theme\"></a>`)\n $(this).append(icon);\n })\n }", "title": "" }, { "docid": "e277fcdc06499b86a753a4d2559e9f71", "score": "0.57264537", "text": "function createMarkerIcon(color) {\n\t\tvar div = document.createElement(\"div\");\n\t\tvar img = '<img src=\"/assets/icons/marker_' + color + '.png\" />';\n\n\t\tdiv.innerHTML = img;\n\n\t\treturn new H.map.DomIcon(div, {\n\t\t\twidth: 16,\n\t\t\theight: 16,\n\t\t\tanchorX: 8,\n\t\t\tanchorY: 16,\n\t\t\tdrawable: false\n\t\t})\n\t}", "title": "" }, { "docid": "6c9557ada90c5d96e71180e4ab1b7705", "score": "0.57230294", "text": "function openIcon(icon) {\n return '<i style=\"cursor:pointer\" class=\"tTreeOpen fa fa-' + icon + '\"></i> ';\n }", "title": "" }, { "docid": "77243adb06717db26afb2550c59aa6bd", "score": "0.57224375", "text": "_setupIcons() {\n const customIcons = getWithDefault(this, 'customIcons', {});\n var newIcons = smartExtend(customIcons, defaultIcons);\n set(this, 'icons', O.create(newIcons));\n }", "title": "" }, { "docid": "d4cdc7692fad5b490714eaa5dfb6be2f", "score": "0.57172465", "text": "addIcon () {\n if (!this.options.icon) {\n return;\n }\n\n if (this.options.iconset) {\n if (this.options.iconset.startsWith('fa')) {\n this.classNames.push(this.options.iconset, `fa-${this.options.icon}`);\n } else {\n this.classNames.push(this.options.iconset, `${this.options.iconset}-${this.options.icon}`);\n }\n } else {\n this.classNames.push(`icon-${this.options.icon}`);\n }\n }", "title": "" }, { "docid": "4681bff9f05473d72a28f92052576336", "score": "0.57154614", "text": "createIconClass(data) {\n let name = 'jp-Dialog-buttonIcon';\n let extra = data.iconClass;\n return extra ? `${name} ${extra}` : name;\n }", "title": "" }, { "docid": "d1b8e46d9d5fa5fc588b4be5568c17f5", "score": "0.57147723", "text": "function createItemGroupIcon($itemAnchor) {\n var $itemGroupIcon = $(\"<i />\")\n .attr({\"class\": ((instance.settings.direction == 'rtl') ? \" floatRight iconSpacing_rtl \" : \" floatLeft iconSpacing_ltr \") + instance.settings.groupIcon})\n .prependTo($itemAnchor);\n }", "title": "" }, { "docid": "5e583730b1cb61c632c28b64abf6d8c2", "score": "0.56968665", "text": "generateIcons() {\n if (this.error !== true && this.error !== false) this.error = false;\n\n const terminalBase = Core.atlas.find(modName + \"-terminal\");\n const terminalDisplayWhite = Core.atlas.find(modName + \"-terminal-display-white\");\n\n // Other icons:\n // const terminalDisplayBlue = Core.atlas.find(modName + \"-terminal-display-blue\");\n // const terminalDisplayOrange = Core.atlas.find(modName + \"-terminal-display-orange\");\n // const terminalDisplayRed = Core.atlas.find(modName + \"-terminal-display-red\");\n\n return [terminalBase, terminalDisplayWhite];\n }", "title": "" }, { "docid": "37c8010bebe43fcceec2c2e6d41b2e88", "score": "0.5676715", "text": "smallIcon() {\n const icon = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n icon.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n icon.setAttribute(\"viewBox\", \"0 0 52 68\");\n icon.innerHTML = `<defs><clipPath id=\"circleView\"><circle fill=\"#fff\" cx=\"26\" cy=\"26\" r=\"23\" /></clipPath></defs>\n <path fill=\"yellow\" stroke=\"#aaa\" stroke-width=\"1\" stroke-opacity=\"0.6\" d=\"M 51 26 a 25 25 90 0 0 -50 0 c 0 11 5 20 10 25 l 12 12 c 3 3 3 3 6 0 l 11 -12 c 5 -5 11 -14 11 -25 z\" />\n <circle fill=\"#fff\" cx=\"26\" cy=\"26\" r=\"24\" opacity=\"0.8\" />\n <image x=\"2.5\" y=\"2.5\" width=\"47\" height=\"47\" href=\"${this.pic}\" clip-path=\"url(#circleView)\" />`;\n return icon;\n }", "title": "" }, { "docid": "7bda9d3f79f3a24de554372fc5a0c78c", "score": "0.56763244", "text": "addIcon(iconId, left_p, top_p, equipment) {\n\t\tconst newIconId = `ico_${iconId}`;\n\t\tif (this.icons[newIconId] != undefined)\n\t\t\treturn null;\n\t\tvar newIcon = new Icon(equipment);\n\t\tnewIcon.setSize(this.ico_width_p, this.ico_height_p)\n\t\t\t.setPos(left_p, top_p).click(function(e) {\n\t\t\t\tnewIcon.toggle();\n\t\t});\n\t\tthis.dom.append(newIcon.dom.attr('id', newIconId));\n\t\tthis.icons[newIconId] = newIcon;\n\n\t\treturn newIconId;\n\t}", "title": "" }, { "docid": "95c7de14df4bac57691ea7640cb06dc4", "score": "0.56746167", "text": "computeIconLocation() {\n // Find coordinates for the centre of the icon and update the arrow.\n const blockXY = this.block_.getRelativeToSurfaceXY();\n const iconXY = svgMath.getRelativeXY(\n /** @type {!SVGElement} */ (this.iconGroup_));\n const newXY = new Coordinate(\n blockXY.x + iconXY.x + this.SIZE / 2,\n blockXY.y + iconXY.y + this.SIZE / 2);\n if (!Coordinate.equals(this.getIconLocation(), newXY)) {\n this.setIconLocation(newXY);\n }\n }", "title": "" }, { "docid": "95c639331b663b351ca38c7ec89370e8", "score": "0.5674241", "text": "function addStaticSyariahIcon() {\n // only add icon if static icon is not existed yet in DOM\n if (document.body.querySelector(`[${ attributeName }=\"root-${ extensionName }]`)) {\n return\n }\n\n const rootIcon = `\n <svg ${ attributeName }=\"root-${ extensionName }\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"20px\" width=\"15px\" style=\"position: absolute\">\n <symbol xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-12 0 512 512.001\" id=\"syariah-icon\">\n <path d=\"m481.414062 387.503906c-46.253906 75.460938-129.484374 125.507813-224.226562 124.480469-142.894531-1.546875-257.1875-117.976563-257.1875-261.953125 0-115.910156 74.722656-214.253906 178.257812-248.757812 4.996094-1.664063 9.546876 3.523437 7.28125 8.308593-16.441406 34.6875-25.527343 73.601563-25.222656 114.691407 1.070313 144.238281 116.875 260 260.039063 260 18.78125 0 37.082031-2.007813 54.730469-5.832032 5.136718-1.113281 9.089843 4.554688 6.328124 9.0625zm0 0\"\n fill=\"#2ecc71\"></path>\n <path d=\"m481.394531 387.53125c-6.792969 11.078125-14.378906 21.601562-22.679687 31.496094-9.984375 1.027344-20.101563 1.546875-30.355469 1.546875-164.023437 0-297.003906-133.980469-297.003906-299.226563 0-38.714844 7.300781-75.707031 20.578125-109.652344 8.53125-3.941406 17.308594-7.421874 26.304687-10.421874 5.007813-1.667969 9.570313 3.511718 7.300781 8.304687-16.394531 34.589844-25.476562 73.378906-25.226562 114.34375.878906 144.339844 116.777344 260.347656 260.046875 260.347656 18.78125 0 37.082031-2.007812 54.726563-5.828125 5.152343-1.117187 9.078124 4.570313 6.308593 9.089844zm0 0\"\n fill=\"#27ae60\"></path>\n <path d=\"m389.464844 4.546875 26.585937 54.273437c1.179688 2.40625 3.457031 4.074219 6.09375 4.460938l59.449219 8.703125c6.640625.972656 9.289062 9.195313 4.484375 13.914063l-43.015625 42.246093c-1.90625 1.875-2.777344 4.574219-2.328125 7.222657l10.15625 59.648437c1.132813 6.664063-5.808594 11.746094-11.75 8.601563l-53.171875-28.164063c-2.355469-1.25-5.175781-1.25-7.535156 0l-53.167969 28.164063c-5.941406 3.144531-12.882813-1.9375-11.75-8.601563l10.15625-59.648437c.449219-2.648438-.421875-5.347657-2.328125-7.222657l-43.015625-42.246093c-4.804687-4.71875-2.15625-12.941407 4.484375-13.914063l59.449219-8.703125c2.636719-.386719 4.914062-2.054688 6.09375-4.460938l26.585937-54.273437c2.972656-6.0625 11.554688-6.0625 14.523438 0zm0 0\"\n fill=\"#2ecc71\"></path>\n <path d=\"m443.066406 128.144531c-1.90625 1.871094-2.785156 4.574219-2.328125 7.222657l10.148438 59.65625c1.132812 6.660156-5.808594 11.738281-11.75 8.59375l-7.300781-3.867188-12.179688-71.570312c-.558594-3.234376.515625-6.527344 2.847656-8.824219l49.648438-48.753907 9.433594 1.382813c6.644531.976563 9.292968 9.195313 4.488281 13.914063zm0 0\"\n fill=\"#27ae60\"></path>\n </symbol>\n </svg>\n `\n\n const rootSvg = parser.parseFromString(rootIcon, 'text/html').querySelector('svg')\n\n document.body.prepend(rootSvg)\n}", "title": "" }, { "docid": "7cf72b8c892737b817f335ce1e54953f", "score": "0.5672358", "text": "static get ORIGIN_ICON() {\n return {\n path: google.maps.SymbolPath.CIRCLE,\n fillColor: 'blue',\n fillOpacity: .4,\n scale: 4.5,\n strokeColor: 'white',\n strokeWeight: 1\n };\n }", "title": "" }, { "docid": "f478c08e60d375b8669a1a1c55713be0", "score": "0.5656707", "text": "function IoIosAddCircleOutline (props) {\n return (0,_lib__WEBPACK_IMPORTED_MODULE_0__.GenIcon)({\"tag\":\"svg\",\"attr\":{\"viewBox\":\"0 0 512 512\"},\"child\":[{\"tag\":\"path\",\"attr\":{\"d\":\"M346.5 240H272v-74.5c0-8.8-7.2-16-16-16s-16 7.2-16 16V240h-74.5c-8.8 0-16 6-16 16s7.5 16 16 16H240v74.5c0 9.5 7 16 16 16s16-7.2 16-16V272h74.5c8.8 0 16-7.2 16-16s-7.2-16-16-16z\"}},{\"tag\":\"path\",\"attr\":{\"d\":\"M256 76c48.1 0 93.3 18.7 127.3 52.7S436 207.9 436 256s-18.7 93.3-52.7 127.3S304.1 436 256 436c-48.1 0-93.3-18.7-127.3-52.7S76 304.1 76 256s18.7-93.3 52.7-127.3S207.9 76 256 76m0-28C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48z\"}}]})(props);\n}", "title": "" }, { "docid": "f478c08e60d375b8669a1a1c55713be0", "score": "0.5656707", "text": "function IoIosAddCircleOutline (props) {\n return (0,_lib__WEBPACK_IMPORTED_MODULE_0__.GenIcon)({\"tag\":\"svg\",\"attr\":{\"viewBox\":\"0 0 512 512\"},\"child\":[{\"tag\":\"path\",\"attr\":{\"d\":\"M346.5 240H272v-74.5c0-8.8-7.2-16-16-16s-16 7.2-16 16V240h-74.5c-8.8 0-16 6-16 16s7.5 16 16 16H240v74.5c0 9.5 7 16 16 16s16-7.2 16-16V272h74.5c8.8 0 16-7.2 16-16s-7.2-16-16-16z\"}},{\"tag\":\"path\",\"attr\":{\"d\":\"M256 76c48.1 0 93.3 18.7 127.3 52.7S436 207.9 436 256s-18.7 93.3-52.7 127.3S304.1 436 256 436c-48.1 0-93.3-18.7-127.3-52.7S76 304.1 76 256s18.7-93.3 52.7-127.3S207.9 76 256 76m0-28C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48z\"}}]})(props);\n}", "title": "" }, { "docid": "b8d3c1e9ca87836d585f59e3a3bdddb5", "score": "0.56474036", "text": "function editIcon (color) {\n var pathAttrs = [\n {\n d: 'M0 0h24v24H0z',\n fill: 'none'\n },\n {\n d: 'M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'\n }\n ];\n\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_Icons_makeIcon__[\"a\" /* default */])(color, pathAttrs);\n}", "title": "" }, { "docid": "21e1c58196ae302fe8b8b151c4c6ac24", "score": "0.5634221", "text": "function iconFor(ant){\n var icon, container;\n \n if(ant.container){ //if ant holds another (e.g., bodyguard)\n container = true; //note there is a container\n if (ant.contained != null) { \n ant = ant.contained; //ant is now whoever is inside\n }\n }\n\n icon = antIcons[ant.name];\n if(icon === undefined){\n icon = '?'; //unrecognized\n }\n\n if(container){\n icon = clc.bgGreen(icon); //draw container as green background\n }\n \n return icon;\n}", "title": "" }, { "docid": "c2bcf3f2aa44faa656e3bf4da978ba05", "score": "0.5632002", "text": "function makeIcon(bus){\n\tvar lastCoord = bus.route[bus.route.length - 1];\n\tL.marker(lastCoord,{icon: busIcon}).addTo(mymap);\n}", "title": "" }, { "docid": "273e2ba5662efb5a58c396e812ba6525", "score": "0.56222093", "text": "function createMarkerIcon(icon, prefix, markerColor, iconColor) {\n return L.AwesomeMarkers.icon({\n icon: icon,\n prefix: prefix,\n markerColor: markerColor,\n iconColor: iconColor\n });\n }", "title": "" }, { "docid": "489f2a639859cf5663676aa9103d5ea2", "score": "0.56161916", "text": "function loadIcon(shape) {\n var icon = L.divIcon({\n className: \"my-div-icon icon-white icon-\" + shape\n });\n return icon;\n}", "title": "" }, { "docid": "91583f5cd32b43dd5c4139c1b4cca811", "score": "0.5615038", "text": "function addIcon(source) {\r\n //src.removeAttribute(\"onclick\");\r\n if (image.hasChildNodes()) {\r\n image.removeChild(image.childNodes[0]);\r\n finalImage.img = \"\";\r\n }\r\n\r\n var currentIcon = document.createElement(\"i\");\r\n currentIcon.setAttribute(\"class\", source.classList);\r\n image.append(currentIcon);\r\n source.removeAttribute(\"onclick\");\r\n finalImage.icon = source;\r\n\r\n}", "title": "" }, { "docid": "67f1ec732e046efedabadf0ab3791359", "score": "0.56053233", "text": "function Icon(iconDefinition){\n\n\ttry {\n\t\n\t\t//Setup element\n\t\tthis.canvas = document.createElement('canvas');\n\t\tthis.ctx = this.canvas.getContext(\"2d\");\n\t\n\t\tthis.lineargradient = this.ctx.createLinearGradient(0,0,19,19);\n\t\n\t\t//Build canvas\n\t\tthis.buildIcon = function()\n\t\t{\n\t\t\n\t\t\t//Define font\n\t\t\tthis.ctx.font = this.def.font;\n\t\t\tthis.ctx.textAlign = this.def.textAlign;\n\t\t\tthis.ctx.textBaseline = this.def.textBaseline;\n\t\n\n\t\t\tif(this.def.easyRead !== 1 && this.def.easyRead !== 2)\t\t\t\n\t\t\t{\n\t\t\t\t//Outline\n\t\t\t\tthis.ctx.fillStyle = this.def.outlineColor;\n\t\t\t\tthis.ctx.fillRect (0, 0, 19, 19);\n\t\t\n\t\t\t\t//Main fill\n\t\t\t\tthis.ctx.fillStyle = this.def.fillColor;\n\t\t\t\tthis.ctx.fillRect (1, 1, 17, 17);\n\n\t\t\t\t//Top fill\n\t\t\t\tthis.ctx.fillStyle = this.def.topColor;\n\t\t\t\tthis.ctx.fillRect (1, 1, 17, 5);\n\t\t\n\t\t\t\t//Lines\n\t\t\t\tif(this.def.showNumbers == \"0\") {\n\t\t\t\t\tthis.ctx.fillStyle = this.def.lineColor;\n\t\t\t\t\tthis.ctx.fillRect (3,8, 13,0.8);\n\t\t\t\t\tthis.ctx.fillRect (3,10,13,0.8);\n\t\t\t\t\tthis.ctx.fillRect (3,12,13,0.8);\n\t\t\t\t\tthis.ctx.fillRect (3,14,13,0.8);\n\t\t\t\t}\n\t\t\t\telse //Add text\n\t\t\t\t{\n\t\t\t\t\tthis.ctx.fillStyle = this.def.textColor;\n\t\t\t\t\tthis.ctx.fillText(this.def.fillText, 10, 16);\n\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t//Add gradients\n\t\t\t\tthis.lineargradient.addColorStop(0, this.def.gradColorStart);\n\t\t\t\tthis.lineargradient.addColorStop(1, this.def.gradColorStop);\n\t\t\t\tthis.ctx.fillStyle = this.lineargradient;\n\t\t\t\tthis.ctx.fillRect(1, 1, 17, 17);\n\n\t\t\t}\n\t\t\telse //Easy read!\n\t\t\t{\n\t\t\t\tthis.ctx.font = '17px sans-serif';\n\t\t\t\tif(this.def.easyRead === 1)\n\t\t\t\t{\n\t\t\t\t\tthis.ctx.fillStyle = \"rgb(255,255,255)\";\n\t\t\t\t\tthis.ctx.fillRect (0, 0, 19, 19);\n\t\t\t\t\tthis.ctx.fillStyle = \"#000000\";\n\t\t\t\t\tthis.ctx.fillText(this.def.fillText,9,16);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.ctx.fillStyle = \"rgb(0,0,0)\";\n\t\t\t\t\tthis.ctx.fillRect (0, 0, 19, 19);\n\t\t\t\t\tthis.ctx.fillStyle = \"#FFFFFF\";\n\t\t\t\t\tthis.ctx.fillText(this.def.fillText,9,16);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} \n\n\n\t\t\tif(typeof(debug) !== \"undefined\" && debug === true)\n\t\t\t{\n\t\t\t\t\n\t\t\t\t//this.ctx.fillStyle = \"rgba(200,0,0,1)\";\n\t\t\t\t//this.ctx.fillRect (0,0,5,5);\n\t\t\t}\n\n\t\t};\n\t\n\t\t//Get canvas\n\t\tthis.getCanvas = function (){\n\t\t\tthis.buildIcon();\n\t\t\treturn this.canvas;\n\t\n\t\t};\n\t\n\t\t//Get imagedata\n\t\tthis.getImage = function (){\n\t\t\tthis.buildIcon();\n\t\t\treturn this.ctx.getImageData(0, 0, 19, 19);\n\t\t};\n\t\n\t\t/**\n\t\tthis.store = function (){\n\t\t\tvar iconDataJSON = JSON.stringify(this.def);\n\t\t\tsetItem(\"iconDataJson\", iconDataJSON);\n\t\t};\n\t\t\n\t\tthis.load = function (){\n\t\t\tvar iconDataJSON = getItem(\"iconDataJSON\"); // Load from storage\n\t\t\tif(iconDataJSON === null)\n\t\t\t{\n\t\t\t\tthis.storeDefaultIcon(); //If not set, create default values\n\t\t\t}\n\t\t\tthis.def = JSON.parse(iconDataJSON); //Load data into object\n\t\t\tthis.getDefaultValues(false); //Load any other data to ensure coverage\n\t\t};\n\t\t\n\t\tthis.storeDefaultIcon = function(){\n\t\t\tthis.getDefaultValues(true);\n\t\t\tthis.store();\n\t\t};\n\t\t**/\n\t\n\t\t//Define all the default values. If force is true, do it if it is already set as well.\n\t\tthis.getDefaultValues = function(force) {\n\t\t\t\n\t\t\tif(force || typeof(this.def.showNumbers) == 'undefined') this.def.showNumbers = \"0\";\n\t\t\tif(force || typeof(this.def.fillText) == 'undefined') this.def.fillText = \"?\";\n\t\t\tif(force || typeof(this.def.topColor) == 'undefined') this.def.topColor = \"rgba(27,140,160,1)\";\n\t\t\tif(force || typeof(this.def.textColor) == 'undefined') this.def.textColor = \"#121212\";\n\t\t\tif(force || typeof(this.def.outlineColor) == 'undefined') this.def.outlineColor = \"rgba(240,240,240,1)\";\n\t\t\tif(force || typeof(this.def.fillColor) == 'undefined') this.def.backColor = \"rgba(255,255,255,1)\";\n\t\t\tif(force || typeof(this.def.lineColor) == 'undefined') this.def.lineColor = \"rgba(200,200,200,1)\";\n\t\t\tif(force || typeof(this.def.gradColorStart) == 'undefined') this.def.gradColorStart = \"rgba(0, 0, 0, 0.3)\";\n\t\t\tif(force || typeof(this.def.gradColorStop) == 'undefined') this.def.gradColorStop = \"rgba(255, 255, 255, 0.1)\";\n\t\t\tif(force || typeof(this.def.font) == 'undefined') this.def.font = '10px sans-serif';\n\t\t\tif(force || typeof(this.def.textAlign) == 'undefined') this.def.textAlign = 'center';\n\t\t\tif(force || typeof(this.def.textBaseline) == 'undefined') this.def.textBaseline = \"alphabetic\";\n\t\t\tif(force || typeof(this.def.easyRead) == 'undefined') this.def.easyRead = 0;\n\t\n\t\t};\n\t\t\n\t\t//Get values from passed object\n\t\tthis.def = iconDefinition;\n\t\t\n\t\t//Fill inn the rest of the values\n\t\tthis.getDefaultValues(false);\n\t\t\n\t}\n\tcatch(e)\n\t{\n\t\thandleError(\"Icon.js Icon\", e);\n\t}\n\n}", "title": "" }, { "docid": "2a52bdd3623b1cd7c56b3fb0a93f9e67", "score": "0.56045", "text": "function setIcon(weather){\n if(weather === \"Clear\"){\n return '<i class=\"fas fa-sun\"></i>';\n }\n else if(weather === \"Clouds\"){\n return '<i class=\"fas fa-cloud\"></i>';\n }\n else if(weather === \"Rain\"){\n return '<i class=\"fas fa-cloud-rain\"></i>';\n }\n}", "title": "" }, { "docid": "ecd8bc59366eba3dce11739ced61fcad", "score": "0.56044126", "text": "function renderIconCell (object, imageURI) {\n const cell = dom.createElement('td')\n cell.style = 'vertical-align: middle;'\n const icon = cell.appendChild(dom.createElement('img'))\n icon.setAttribute('src', imageURI)\n icon.style = style.smallIconStyle\n // UI.widgets.setImage(icon, object) // @@ maybe loading each thing is not what you want\n return cell\n }", "title": "" }, { "docid": "93fb9c4047dba628dfcaa2620666bc9f", "score": "0.5592505", "text": "function icon(clsName, iconClassOne, iconClassTwo) {\n let i = document.createElement(\"i\");\n i.classList.add(iconClassOne, iconClassTwo);\n clsName.appendChild(i);\n}", "title": "" }, { "docid": "bc07ee29b7f614b545ebfbceb129faff", "score": "0.55906177", "text": "function showicon()\n{\n ejs.renderFile('ejs/icon.ejs', null, null, callback);\n}", "title": "" }, { "docid": "a3fa74eeef8bfc382be0a914c6e0828b", "score": "0.5582752", "text": "function createFileIcons(file) {\r\n\tvar icons = new Object();\r\n\t// fid\r\n\tif (file.pseudoFile || (file.relatedFiles && file.relatedFiles.length)) {\r\n\t\tvar a = createIcon(null, '[+]', null, expandFiles, 'expand this entry', 'i_plus');\r\n\t\ticons['expand'] = a;\r\n\t}\r\n\tif (!config['settings']['SHOWFID']) {\r\n\t\tif (!file.pseudoFile)\r\n\t\t\ticons['fid'] = createIcon(null, file.id, 'animedb.pl?show=file&fid='+file.id, null, 'show file details - FID: '+file.id, 'i_file_details');\r\n\t\telse\r\n\t\t\ticons['fid'] = createIcon(null, 'P'+file.id, 'http://wiki.anidb.net/w/Files:Pseudo_files', null, 'Pseudo File: P'+file.id, 'i_file_details');\r\n\t} else {\r\n\t\tif (!file.pseudoFile)\r\n\t\t\ticons['fid'] = createLink(null, file.id, 'animedb.pl?show=file&fid='+file.id, null, null ,null, null);\r\n\t\telse\r\n\t\t\ticons['fid'] = createLink(null, 'P'+file.id, 'http://wiki.anidb.net/w/Files:Pseudo_files', null, null ,null, null);\r\n\t}\r\n\t// extension\r\n\tif (file.type != 'generic') {\r\n\t\tvar tooltip = 'type: '+file.type+' | added: '+cTimeDate(file.date);\r\n\t\tif (file.relDate > 0) tooltip += ' | released: '+cTimeDate(file.relDate);\r\n\t\tif (file.fileType != '') tooltip += ' | extension: '+file.fileType;\r\n\t\ticons['ext'] = createIcon(null, file.fileType, null, null, tooltip, 'i_ext '+file.fileType);\r\n\t}\r\n\t// avdumped\r\n\tif (file.avdumped)\r\n\t\ticons['avdump'] = createIcon(null,' [avdumped]','http://wiki.anidb.net/w/Avdump',null,'File was verified by an AniDB Client','i_av_yes');\r\n\t// vid\r\n\tif (file.type == 'video') { // VIDEO StrEAM\r\n\t\tfor (var st in file.videoTracks) {\r\n\t\t\tvar stream = file.videoTracks[st];\r\n\t\t\tif (stream && stream.codec) {\r\n\t\t\t\tvar res;\r\n\t\t\t\tvar vc_RXP = /[^\\w]/ig;\r\n\t\t\t\tvar vcodec = 'unknown';\r\n\t\t\t\tif (stream.codec) vcodec = stream.codec.toLowerCase();\r\n\t\t\t\tvar vstyle = vcodec.replace(vc_RXP,'_');\r\n\t\t\t\tvar tooltip = 'video';\r\n\t\t\t\tif (file.resolution != 'unknown') tooltip += ' | resolution: '+file.resolution;\r\n\t\t\t\tif (stream.codec != 'unknown') tooltip += ' | codec: '+stream.codec;\r\n\t\t\t\tif (stream.ar != 'unknown')tooltip += ' | ar: '+stream.ar;\r\n\t\t\t\tif (file.length) tooltip += ' | duration: '+formatFileLength(file.length,'long');\r\n\t\t\t\t//createIcon(icons, 'vid0 ', null, null, tooltip, 'i_videostream_'+vstyle);\r\n\t\t\t\ticons['vid'] = createIcon(null, 'vid0 ', null, null, tooltip, 'i_video '+stream.codec_sname);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// audio languages\r\n\tif (file.type == 'video' || file.type == 'audio') { // AUDIO StrEAM\r\n\t\tvar audioLangs = new Array();\r\n\t\tvar audioCodecs = new Array();\r\n\t\tfor (var st in file.audioTracks) {\r\n\t\t\tvar stream = file.audioTracks[st];\r\n\t\t\tif (stream && stream.lang) {\r\n\t\t\t\tvar tooltip = 'audio: '+mapLanguage(stream.lang);\r\n\t\t\t\tif (st < 2) { // EXP only exports info other than lang for the first 2 streams\r\n\t\t\t\t\tif (stream.codec != 'unknown') tooltip += ' | codec: '+stream.codec;\r\n\t\t\t\t\tif (stream.chan != 'other') tooltip += ' | channels: '+mapAudioChannels(stream.chan);\r\n\t\t\t\t\tif (stream.type) tooltip += ' | type: '+mapAudioType(stream.type);\r\n\t\t\t\t\tif (file.length) tooltip += ' | duration: '+formatFileLength(file.length,'long');\r\n\t\t\t\t\taudioCodecs.push(createIcon(null, stream.codec, 'http://wiki.anidb.info/w/Codecs', null, 'Audio codec: '+stream.codec,'i_audio '+stream.codec_sname));\r\n\t\t\t\t}\r\n\t\t\t\taudioLangs.push(createIcon(null, 'aud'+st+'.'+stream.lang+' ', null, null, tooltip, 'i_audio_'+stream.lang));\r\n\t\t\t}\r\n\t\t}\r\n\t\ticons['audlangs'] = audioLangs;\r\n\t\ticons['audcodecs'] = audioCodecs;\r\n\t}\r\n\t// subtitle languages\r\n\tif (file.type == 'video' || file.type == 'subtitle' || file.type == 'other') { // SUBTITLE StrEAM\r\n\t\tvar subtitleLangs = new Array();\r\n\t\tfor (var st in file.subtitleTracks) {\r\n\t\t\tvar stream = file.subtitleTracks[st];\r\n\t\t\tif (stream && stream.lang) {\r\n\t\t\t\tvar tooltip = 'subtitle: '+mapLanguage(stream.lang);\r\n\t\t\t\tif (st < 2) {\r\n\t\t\t\t\tif (stream.type && stream.type != 'unknown') tooltip += ' | type: '+mapSubTypeData(stream.type);\r\n\t\t\t\t\tif (stream.flags) tooltip += ' | flags: '+mapSubFlagData(stream.flags);\r\n\t\t\t\t}\r\n\t\t\t\tsubtitleLangs.push(createIcon(null, 'sub'+st+'.'+stream.lang+' ', null, null, tooltip, 'i_sub_'+stream.lang));\r\n\t\t\t}\r\n\t\t}\r\n\t\ticons['sublangs'] = subtitleLangs;\r\n\t}\r\n\t// crc status\r\n\tif (file.crcStatus == 'valid') \r\n\t\ticons['crc'] = createIcon(null, 'crc.ok ', null, null, 'crc *matches* official crc ('+file.crc32.toUpperCase()+')', 'i_crc_yes');\r\n\telse if (file.crcStatus == 'invalid') \r\n\t\ticons['crc'] = createIcon(null, 'crc.bad ', null, null, 'crc *does not match* official crc', 'i_crc_no');\r\n\telse if (file.type != 'generic') \r\n\t\ticons['crc'] = createIcon(null, 'crc.unv ', null, null, 'crc *not* compared to official crc', 'i_crc_unv');\r\n\t// file version\r\n\tif (file.version != 'v1') \r\n\t\ticons['ver'] = createIcon(null, file.version+' ', null, null, 'version *'+file.version.charAt(1)+'* (error corrections)', 'i_vrs_'+file.version.charAt(1));\r\n\t// censor\r\n\tif (file.isCensored) \r\n\t\ticons['cen'] = createIcon(null, 'cen ', null, null, '*censored*', 'i_censored');\r\n\tif (file.isUncensored) \r\n\t\ticons['cen'] = createIcon(null, 'uncen ', null, null, '*uncensored*', 'i_uncensored');\r\n\t// FILE<->EP RELATIONS\r\n\tif (file.epRelations && file.epRelations[file.episodeId]) { // Do some work\r\n\t\tvar rel = file.epRelations[file.episodeId];\r\n\t\tvar tooltip = 'File covers: [';\r\n\t\tfor (var bar = 0; bar < rel['startp']/10; bar++) tooltip += '-';\r\n\t\tfor (var bar = rel['startp']/10; bar < rel['endp']/10; bar++) tooltip += '=';\r\n\t\tfor (var bar = rel['endp']/10; bar < 10; bar++) tooltip += '-';\r\n\t\ticons['file_ep_rel'] = createIcon(null, '['+rel['startp']+'-'+rel['endp']+']', null, null, tooltip+']', 'i_file2ep_rel');\r\n\t}\r\n\t// FILE<->FILE RELATIONS\r\n\tif (file.fileRelations && file.fileRelations.length) { // Do some work\r\n\t\tfor (var r in file.fileRelations) {\r\n\t\t\tvar rel = file.fileRelations[r];\r\n\t\t\tif (rel['relfile'] == undefined) continue;\r\n\t\t\tvar tooltip = 'File relation of type \\\"'+rel['type']+'\\\" \\\"'+rel['dir']+'\\\" with file id \\\"'+rel['relfile']+'\\\"';\r\n\t\t\ticons['file_file_rel'] = createIcon(null,'[rel: '+ rel['relfile'] + ']', null, null, tooltip, 'i_file2file_rel');\r\n\t\t}\r\n\t}\r\n\t// FILE COMMENT\r\n\tif ((file.other) && (file.other != '') && (file.other != undefined)) \r\n\t\ticons['cmt'] = createIcon(null, 'comment ', null, null, 'comment: '+clean_input(file.other), 'i_comment');\r\n\t// NEW FILE\r\n\tif (file.newFile)\r\n\t\ticons['date'] = createIcon(null, 'new.file ', null, null, '*new file* (last 24h)', 'i_new_icon');\r\n\t// MYLIST\r\n\tvar temp = new Array();\r\n\tvar mylistEntry = mylist[file.id];\r\n\tif (mylistEntry) {\r\n\t\ticons['mylist'] = createIcon(null, 'in.mylist ', null, null, '*in mylist*', 'i_mylist');\r\n\t\t// Mylist status icon\r\n\t\tvar tooltip = 'mylist status: '+mylistEntry.status;\r\n\t\tif (mylistEntry.storage && mylistEntry.storage != '') tooltip += ' | storage: '+mylistEntry.storage;\r\n\t\tvar className = mapMEStatusName(mylistEntry.status);\r\n\t\ticons['mylist_status'] = createLink(null, mylistEntry.status+' ', 'http://wiki.anidb.net/w/Filetype', 'anidb::wiki', null, tooltip, 'i_icon i_state_'+className);\r\n\t\t//createIcon(null, mylistEntry.status+' ', null, null, tooltip, 'i_state_'+className);\r\n\t\t// Mylist FileState\r\n\t\tif (mylistEntry.fstate && mylistEntry.fstate != 'unknown') {\r\n\t\t\tvar className = mapFState(mylistEntry.fstate);\r\n\t\t\tvar tooltip = 'mylist state: '+mylistEntry.fstate;\r\n\t\t\ticons['mylist_fstate'] = createLink(null, mylistEntry.fstate+' ', 'http://wiki.anidb.net/w/Filetype', 'anidb::wiki', null, tooltip, 'i_icon '+className);\r\n\t\t\t//createIcon(null, mylistEntry.fstate+' ', null, null, tooltip, className);\r\n\t\t}\r\n\t\tvar animeFL = anime.getTitle().charAt(0).toLowerCase();\r\n\t\t// Seen status\r\n\t\tif (mylistEntry.seen) \r\n\t\t\ticons['mylist_seen'] = createIcon(null, 'seen ', null, null, 'seen on: '+cTimeDateHour(mylistEntry.seenDate), 'i_seen');\r\n\t\t// mylist comment\r\n\t\tif ((mylistEntry.other) && (mylistEntry.other != '') && (mylistEntry.other != undefined)) \r\n\t\t\ticons['mylist_cmt'] = createIcon(null, 'mylist comment ', null, null, 'mylist comment: '+mylistEntry.other, 'i_comment');\r\n\t\t// mylist action\r\n\t\ticons['mylist_remove'] = createIcon(null, 'mylist.remove ', 'animedb.pl?show=mylist&do=del&lid='+mylistEntry.id+'&expand=' + file.animeId + '&showfiles=1&char='+animeFL+'#a'+file.animeId, removeFromMylist, 'remove from mylist', 'i_file_removemylist');\r\n\t\tif (mylistEntry.seen) \r\n\t\t\ticons['mylist_watch'] = createIcon(null, 'mylist.unwatch ', 'animedb.pl?show=mylist&do=seen&seen=0&lid='+mylistEntry.id+'&expand='+ file.animeId+'&showfiles=1&char='+animeFL+'#a'+file.animeId, changeWatchedState, 'mark unwatched', 'i_seen_no');\r\n\t\telse \r\n\t\t\ticons['mylist_watch'] = createIcon(null, 'mylist.watch ', 'animedb.pl?show=mylist&do=seen&seen=1&lid='+mylistEntry.id+'&expand='+file.animeId+'&showfiles=1&char='+animeFL+'#a'+file.animeId, changeWatchedState, 'mark watched', 'i_seen_yes');\r\n\t\ticons['mylist_edit'] = createIcon(null, 'mylist.edit ', 'animedb.pl?show=mylist&do=add&lid='+mylistEntry.id+'&fid='+mylistEntry.fileId, null, 'edit mylist entry', 'i_file_edit');\r\n\t} else {\r\n\t\t// mylist action\r\n\t\ticons['mylist_add'] = createIcon(null, 'mylist.add ', 'animedb.pl?show=mylist&do=add&fid=' + file.id, addToMylist, 'add to mylist', 'i_file_addmylist');\r\n\t}\r\n\t// ed2k\r\n\tif (uid != undefined && file.ed2k != '') {\r\n\t\tif (file.crcStatus != 'invalid') \r\n\t\t\ticons['ed2k'] = createIcon(null, 'ed2k', \"!fillme!\", null, 'ed2k hash', 'i_file_ed2k');\r\n\t\telse \r\n\t\t\ticons['ed2k'] = createIcon(null, 'ed2k.crc.bad', \"!fillme!\", null, 'ed2k hash (invalid CRC file)', 'i_file_ed2k_corrupt');\r\n\t}\r\n\t// Action icons\r\n\tif (file.type != 'generic') {\r\n\t\ticons['edit'] = createIcon(null, 'edit', 'animedb.pl?show=addfile&aid='+file.animeId+'&eid='+file.episodeId+'&edit='+file.id, null, 'edit', 'i_file_edit');\r\n\t\tvar qual = file.quality.replace(' ','');\r\n\t\ticons['quality'] = createIcon(null, file.quality, null, null, 'quality: '+file.quality, 'i_rate_'+qual);\r\n\t}\r\n\treturn icons;\r\n}", "title": "" }, { "docid": "f0f106a2b60326c08e7d3c4579fd3001", "score": "0.55818945", "text": "function createIcon(options, enableTooltips, shortcuts) {\n\toptions = options || {};\n\tvar el = document.createElement(\"a\");\n\tenableTooltips = (enableTooltips == undefined) ? true : enableTooltips;\n\n\tif(options.title && enableTooltips) {\n\t\tel.title = createTootlip(options.title, options.action, shortcuts);\n\n\t\tif(isMac) {\n\t\t\tel.title = el.title.replace(\"Ctrl\", \"⌘\");\n\t\t\tel.title = el.title.replace(\"Alt\", \"⌥\");\n\t\t}\n\t}\n\n\tel.tabIndex = -1;\n\tel.className = options.className;\n\treturn el;\n}", "title": "" }, { "docid": "f0f106a2b60326c08e7d3c4579fd3001", "score": "0.55818945", "text": "function createIcon(options, enableTooltips, shortcuts) {\n\toptions = options || {};\n\tvar el = document.createElement(\"a\");\n\tenableTooltips = (enableTooltips == undefined) ? true : enableTooltips;\n\n\tif(options.title && enableTooltips) {\n\t\tel.title = createTootlip(options.title, options.action, shortcuts);\n\n\t\tif(isMac) {\n\t\t\tel.title = el.title.replace(\"Ctrl\", \"⌘\");\n\t\t\tel.title = el.title.replace(\"Alt\", \"⌥\");\n\t\t}\n\t}\n\n\tel.tabIndex = -1;\n\tel.className = options.className;\n\treturn el;\n}", "title": "" }, { "docid": "f0f106a2b60326c08e7d3c4579fd3001", "score": "0.55818945", "text": "function createIcon(options, enableTooltips, shortcuts) {\n\toptions = options || {};\n\tvar el = document.createElement(\"a\");\n\tenableTooltips = (enableTooltips == undefined) ? true : enableTooltips;\n\n\tif(options.title && enableTooltips) {\n\t\tel.title = createTootlip(options.title, options.action, shortcuts);\n\n\t\tif(isMac) {\n\t\t\tel.title = el.title.replace(\"Ctrl\", \"⌘\");\n\t\t\tel.title = el.title.replace(\"Alt\", \"⌥\");\n\t\t}\n\t}\n\n\tel.tabIndex = -1;\n\tel.className = options.className;\n\treturn el;\n}", "title": "" }, { "docid": "c7aa601bd5f5c21c70806e8b0bfb6014", "score": "0.5567243", "text": "function createMarkerIcon(icon, prefix, markerColor, iconColor) {\n return L.AwesomeMarkers.icon({\n icon: icon,\n prefix: prefix,\n markerColor: markerColor,\n iconColor: iconColor\n });\n }", "title": "" }, { "docid": "b539fb1f6a9e014065160048c5ba626b", "score": "0.55648744", "text": "function createOptionIcon(classNames, title, preventDefault) {\n var node = createElement(\"i\");\n if(preventDefault !== true) {\n node.addEventListener('click',optionClicked);\n }\n node.classList.add(\"hand\",...classNames);\n node.title = title;\n return node;\n }", "title": "" }, { "docid": "1ed5615e5c97372887b49a56202e039b", "score": "0.5560752", "text": "function iconFile(width, height, id) {\n return `\n <svg\n viewBox=\"0 0 43.3 43.2\"\n height=${height}px\n width=${width}px\n data-email=\"${id}\"\n class=\"iconover\"\n id=\"iconFile\"\n >\n <path \n d=\"M36.4,0H7c-1,0-1.9,0.4-2.6,1.1L1.1,4.4C0.4,5.1,0,6,0,7v31.8c0,2.4,2,4.4,4.4,4.4h34.5c2.4,0,4.4-2,4.4-4.4V7\n\t\t c0-1-0.4-1.9-1-2.6L39,1.1C38.4,0.4,37.4,0,36.4,0z M8.1,2.8h27.4c0.7,0,1.3,0.3,1.8,0.8l1,1c0.3,0.4,0.1,0.9-0.4,0.9l-4.9,0H5.6\n\t\t c-0.5,0-0.7-0.6-0.4-1l1.1-1C6.8,3,7.4,2.8,8.1,2.8z M21.3,35.2L9.1,22.7c-0.3-0.4-0.1-1,0.4-1h6.3c0.3,0,0.6-0.2,0.6-0.6v-4.5\n\t\t c0-0.3,0.2-0.6,0.6-0.6h9.7c0.3,0,0.6,0.2,0.6,0.6v4.5c0,0.3,0.2,0.6,0.6,0.6H34c0.5,0,0.7,0.6,0.4,1L22.1,35.2\n\t\t C21.9,35.4,21.5,35.4,21.3,35.2z\"\n fill=\"\"\n />\n </svg>\n `;\n}", "title": "" }, { "docid": "2f4a34c92ba2f8a091fca76af30dedc0", "score": "0.5557087", "text": "function ExpanderIcon(_a) {\n var depth = _a.depth, hasChildren = _a.hasChildren, isExpanded = _a.isExpanded, onExpanderClick = _a.onExpanderClick;\n var nodes = [];\n for (var i = 0; i < depth; i++) {\n nodes.push(createElement(\"span\", { className: 'fc-icon' }));\n }\n var iconClassNames = ['fc-icon'];\n if (hasChildren) {\n if (isExpanded) {\n iconClassNames.push('fc-icon-minus-square');\n }\n else {\n iconClassNames.push('fc-icon-plus-square');\n }\n }\n nodes.push(createElement(\"span\", { className: 'fc-datagrid-expander' + (hasChildren ? '' : ' fc-datagrid-expander-placeholder'), onClick: onExpanderClick },\n createElement(\"span\", { className: iconClassNames.join(' ') })));\n return createElement.apply(void 0, __spreadArrays([Fragment, {}], nodes));\n}", "title": "" }, { "docid": "24e7548f4583270afaf73b0775878434", "score": "0.55518436", "text": "renderIcon(icon, iconField, accent, accentField, size, defaultIconSize, dataItem) {\n let iconToUse = icon;\n if (dataItem && iconField && dataItem[iconField]) {\n iconToUse = dataItem[iconField];\n }\n let accentToUse = accent;\n if (dataItem && accentField && dataItem[accentField]) {\n accentToUse = dataItem[accentField];\n }\n if (iconToUse) {\n return (h(\"tag-icon\", { icon: iconToUse, size: size ? size : defaultIconSize, accent: accentToUse }));\n }\n else {\n return null;\n }\n }", "title": "" }, { "docid": "a507f9345d60f4ef9b6ca1fe4011ab3e", "score": "0.5551344", "text": "trophy_icon(){\n return '<i class=\"nf nf-fa-trophy\" style=\"color:rgba(255, 215, 0, 1.0)\"></i>'\n }", "title": "" }, { "docid": "9695c922b86dad39236936ba735db37a", "score": "0.5550155", "text": "function MatIconLocation() { }", "title": "" }, { "docid": "285f2cc2d5061629b94afbc9a26c5627", "score": "0.5548357", "text": "function getIcon(icon) {\n switch (icon) {\n case \"clear-day\":\n return '<i class=\"wi wi-day-sunny\" aria-hidden=\"true\">';\n break;\n case \"clear-night\":\n return '<i class=\"wi wi-night-clear\" aria-hidden=\"true\">';\n break;\n case \"rain\":\n return '<i class=\"wi wi-rain\" aria-hidden=\"true\">';\n break;\n case \"snow\":\n return '<i class=\"wi wi-snow\" aria-hidden=\"true\">';\n break;\n case \"sleet\":\n return '<i class=\"wi wi-sleet\" aria-hidden=\"true\">';\n break;\n case \"wind\":\n return '<i class=\"wi wi-cloudy-gusts\" aria-hidden=\"true\">';\n break;\n case \"fog\":\n return '<i class=\"wi wi-fog\" aria-hidden=\"true\">';\n break;\n case \"cloudy\":\n return '<i class=\"wi wi-cloud\" aria-hidden=\"true\">';\n break;\n case \"partly-cloudy-day\":\n return '<i class=\"wi wi-day-cloudy\" aria-hidden=\"true\">';\n break;\n case \"partly-cloudy-night\":\n return '<i class=\"wi wi-night-partly-cloudy\" aria-hidden=\"true\">';\n break;\n default:\n return '<i class=\"wi wi-storm-showers\" aria-hidden=\"true\">';\n }\n }", "title": "" } ]
d1128f61466fc21b40d58573f33f4676
Write a function sayHello that takes a language parameter, and returns "hello" in that language. Make the function work with at least three languages.
[ { "docid": "8ed4be6585086eb0b64a4341a77efa44", "score": "0.78895485", "text": "function sayHello (lang){\r\n if (lang === \"english\"){\r\n return \"hello\";\r\n }\r\n else if (lang === \"Hindi\"){\r\n return \"Namste\";\r\n }\r\n else{\r\n return \"default\";\r\n }\r\n \r\n}", "title": "" } ]
[ { "docid": "5e56034d90a19babb815d247b3e99fa4", "score": "0.81356436", "text": "function helloWorld(language) {\n if (language === 'es') {\n return 'Hola, Mundo';\n } else if (language === 'de') {\n return 'Hallo, Welt';\n } else {\n return 'Hello, World';\n }\n}", "title": "" }, { "docid": "5d1d03b8fdc6fb6ac0d747fbda9f8041", "score": "0.80529225", "text": "function helloWorld(lang) {\n if (lang == 'fr') {\n return 'Bonjour tout le monde';\n } else if (lang == 'es') {\n return 'Hola, Mundo';\n } else {\n return 'Hello, World';\n }\n}", "title": "" }, { "docid": "ac10e16883afd570606685a75251e89a", "score": "0.7850876", "text": "function helloWorld(lang){\n if(lang === \"af\"){\n console.log(\"Hello Werld\");\n } else if(lang === \"pt\"){\n console.log(\"Olá Mundo\");\n } else if(lang === \"it\"){\n console.log(\"Ciao Mondo\");\n } else {\n console.log(\"Hello World\");\n }\n}", "title": "" }, { "docid": "cd1902524416b483ac336ecbfe79bbca", "score": "0.7725786", "text": "function helloWorld(language) {\n\tif (language == 'English'){\n\t\tconsole.log(\"Hello World\");\n\t} else if (language == 'Spanish') {\n\t\tconsole.log(\"Hola mundo!\");\n\t} else if (language == 'French') {\n\t\tconsole.log(\"Bonjour le monde!\");\n\t} else {\n\t\tconsole.log(\"I am not programmed to speak that language.\")\n\t}\t\t\n}", "title": "" }, { "docid": "8a754ca7f49d38d793a099c529597548", "score": "0.77127475", "text": "function helloWorld(language) {\n if (language == \"es\") {\n console.log(\"Hola, Mundo!\");\n } else if (language == \"de\") {\n console.log(\"Hallo, Welt!\");\n } else if (language == \"por\") {\n console.log(\"Ola, Mundo!\");\n } else {\n console.log(\"Hello, World!\");\n }\n}", "title": "" }, { "docid": "753b4a28cbf04a2576ca47199b80c171", "score": "0.7629567", "text": "function helloWorld(langCode) {\n if (langCode == \"es\") {\n return \"Hola, Mundo\"\n } else if (langCode == \"de\") {\n return \"Hallo, Welt\"\n } else {\n return \"Hello, World\"\n }\n }", "title": "" }, { "docid": "b0db4d9f7ffc96e030c6d0da7407ee8c", "score": "0.7612697", "text": "function helloWorld(languageCode) {\n\tif (languageCode == \"es\") {\n\t\treturn \"Hola Mundo\";\n\t} else if (languageCode == \"de\") {\n\t\treturn \"Hallo Welt\";\n\t} else {\n\t\treturn \"Hello World\";\n\t}\n}", "title": "" }, { "docid": "338e6a447387cc104f3ed2084d4d3e55", "score": "0.749453", "text": "function helloWorld(language) {\n if(language == \"fr\"){ //if the language is fr, log a message in french\n console.log(\"Bonjour, monde\")\n }\n else if(language == \"es\") { // else if the language is es, log a message in spanish\n console.log(\"Hola, mundo!\")\n }\n else { // in all other cases, log a message in english\n console.log(\"Hello, world!\")\n }\n}", "title": "" }, { "docid": "9042664cce24ef059f58962315dc14fa", "score": "0.74629164", "text": "function greeting(language) {\n switch (language) {\n case language = \"German\":\n return ('Guten Tag!');\n\n case language = \"Mandarin Chinese\":\n return ('Ni Hao!');\n\n case language = \"Spanish\":\n return ('Hola!');\n\n default:\n return ('Hello!');\n\n }\n}", "title": "" }, { "docid": "17ec6c3e335387c91932e1bb0b280b2b", "score": "0.74587476", "text": "function helloWorld(lang){\n\tif (lang === 'es'){\n\t console.log('Hola, cómo estás?');\n\t}else if (lang === 'de') {\n\t console.log('hallo hoe gaat het');\n\t\n\t}else {console.log('Hello, World');}\n\n\t}", "title": "" }, { "docid": "7ef5b9573f1adea922d71dcf342f2ef2", "score": "0.73436844", "text": "function greet(firstname, lastname, language) {\n \n language = language || \"en\";\n \n if (language === \"en\") {\n console.log(\"Hello \" + firstname + \" \" + lastname);\n }\n \n if (language === \"es\") {\n console.log(\"Hola \" + firstname + \" \" + lastname);\n }\n \n}", "title": "" }, { "docid": "8d939bdb37ea0dddf332952fa554152f", "score": "0.7327396", "text": "function greet_english(firstname,lastname){\n greet(firstname,lastname,'engligh');\n}", "title": "" }, { "docid": "d65f5f073241639f5291ef3a880b8dc0", "score": "0.7298914", "text": "function greet(language) {\n //write your code here\n return languages[language];\n}", "title": "" }, { "docid": "453cf0ff08fab93ad84a8b8c7b3652b6", "score": "0.72562325", "text": "function makeGreeting(language) {\n return function(firstname, lastname) {\n if (language === \"en\") {\n console.log(\"Hello \" + firstname + \" \" + lastname);\n }\n \n if (language === \"es\") {\n console.log(\"Hola \" + firstname + \" \" + lastname);\n }\n };\n}", "title": "" }, { "docid": "2a5e1451b79719ceeb8d64e611693c0c", "score": "0.7140579", "text": "function makeGreeting(language) {\n \n return function(firstname, lastname) {\n \n if (language === 'en') {\n console.log('Hello ' + firstname + ' ' + lastname); \n }\n\n if (language === 'es') {\n console.log('Hola ' + firstname + ' ' + lastname); \n }\n \n }\n \n}", "title": "" }, { "docid": "3b7c62de23dabc3f005ebf591841040c", "score": "0.7134936", "text": "function SayHello(name){\r\n return 'Hello ' + name;\r\n}", "title": "" }, { "docid": "ebb0dbff3740f5b43ae76d03a154ecb8", "score": "0.7080022", "text": "function greet(lang) {\n if (lang === 'en') {\n en();\n return;\n }\n if (lang === \"es\") {\n es();\n return;\n }\n console.log('Namaskara in KA');\n}", "title": "" }, { "docid": "bbabe59ed2458c04f8e59cba4c838f2e", "score": "0.70798415", "text": "function sayHello(name) {\n return \"Hello, \" + name + \"!\";\n}", "title": "" }, { "docid": "f79117d16bb9b0bdf5334f551c5bee1e", "score": "0.7051701", "text": "function sayHello(name) {\n var message = \"hello, \" + name + \"!\";\n return message;\n}", "title": "" }, { "docid": "4724b9054d09b617916d567b5d96ba6c", "score": "0.70488966", "text": "function greet (lang) {\n if (lang === 'eng') {\n return function (name) {\n console.log('Hello ' + name + '!');\n }\n } else if (lang === 'esp') {\n return function (name) {\n console.log('Hola ' + name + '!');\n }\n } else {\n throw 'Unsupported language!';\n }\n}", "title": "" }, { "docid": "03c39bf9a23499b0149b25cb58c4cddc", "score": "0.704785", "text": "function sayHello(name) {\n return \"Hello, \" + name + \".\";\n}", "title": "" }, { "docid": "8dc12502c0ba7c23f529b8fdaa8c03ee", "score": "0.70359063", "text": "function greet (lang1, lang2, lang3) {\n console.log(`Hello, my name is ${this.name} and I know ${lang1}.`)\n}", "title": "" }, { "docid": "2af10c2015fc5decd9904ab56ff2a7af", "score": "0.70108426", "text": "function greet3(firstName, lastName){ \n return 'Hello ' + firstName + ' ' + lastName;\n}", "title": "" }, { "docid": "2c2da6fec095e5c0d7c5c84ac584bce5", "score": "0.6975559", "text": "function sayHello(){\n return \"Greetings my friend\"\n}", "title": "" }, { "docid": "208506686a6e0fb1597e7512e284d19b", "score": "0.6970997", "text": "function sayHello() {}", "title": "" }, { "docid": "26128daf081d00c8997ff449bf0c841b", "score": "0.69506454", "text": "function makeGreeting(lang) {\n return function(firstname, lastname) {\n var greet;\n if (lang === 'en') {\n greet = 'Hello!';\n }\n if (lang === 'es') {\n greet = 'Hello!';\n }\n console.log(greet + ' ' + firstname + ' ' + lastname);\n }\n}", "title": "" }, { "docid": "a4c749907ebb00a31e0766f6b1e59a23", "score": "0.6905351", "text": "function sayHello(name) {\n return \"Hi \" + name + \"!\";\n }", "title": "" }, { "docid": "77562b744bde5e4e879b884414ddc3b7", "score": "0.6892254", "text": "function makeGreeting (language)\n{\n var supportedLanguages = ['en', 'es', 'de', 'it'];\n\n if (arguments.length === 0)\n {\n return function ()\n {\n console.log(\"ERROR: You must specified a supported language.\");\n }\n }\n else if (supportedLanguages.includes(language) === false)\n {\n return function ()\n {\n console.log(\"ERROR: Unsupported language.\");\n }\n }\n\n // NOTE: 'language' value is preserved to this function scope and making different things depending on the value.\n return function (firstname, lastname)\n {\n if (language === 'en') \n {\n console.log('Hello ' + firstname + ' ' + lastname); \n }\n\n if (language === 'es')\n {\n console.log('Hola ' + firstname + ' ' + lastname); \n }\n }\n}", "title": "" }, { "docid": "a9fc27d22fcb0ed8d684724c4d9ce6f7", "score": "0.68555593", "text": "function sayHello(name){\n\tvar result = \"Hello \" + name;\n\treturn result;\n}", "title": "" }, { "docid": "c666a83ff9fd7e3012fff30ce981d10a", "score": "0.6834307", "text": "function sayHello() {\n return 'Hello world';\n}", "title": "" }, { "docid": "97ad799d6b6bf5cb60ade7819e65efb3", "score": "0.68176293", "text": "function sayHelloTo(name) {\n return \"Hello \" + name;\n}", "title": "" }, { "docid": "83dc0eb357455a63720b5e3f7f5fea79", "score": "0.68089795", "text": "function greet(name){\n return \"Hello \" + name\n}", "title": "" }, { "docid": "a8ee1eab5b23fbd3cc90ab1166ad623e", "score": "0.680663", "text": "function sayhello() {\n return \"Hello friends\";\n}", "title": "" }, { "docid": "8ceba5fe22481c44f21a681639bac0f3", "score": "0.6797844", "text": "function helloWorld (nn){\n if (nn === es) {\n return \"hola, mundo\";\n }\n else if (nn === fr) {\n return \"bonjour, monde\";\n\n } else (nn === en) {\n return \"hellow, world\";\n\n }\n}", "title": "" }, { "docid": "01ea0b420bb5464443382361eada4228", "score": "0.6794532", "text": "function sayHello(name){\n\n console.log(\"hello to \"+name);\n}", "title": "" }, { "docid": "58f26181c92ca8f00765286c14247647", "score": "0.67851126", "text": "function sayHi(name){\n return \"Hi \"+ name;\n}", "title": "" }, { "docid": "b484a51e872e37b057d6532ec5226dd7", "score": "0.6779741", "text": "function sayHi(name) {\n return \"Hi there ,\" +name\n}", "title": "" }, { "docid": "27225fd1b5a245a82f4d7cb952654226", "score": "0.67783666", "text": "function sayHello(name) {\n return `Hello, ${name}`;\n}", "title": "" }, { "docid": "9c70beec7016d5fa3e44da449a5340d4", "score": "0.67734003", "text": "function sayHello(name)\n{\n // Code goes here\n}", "title": "" }, { "docid": "19679a4d079279fb7777adfb26ea0721", "score": "0.6763872", "text": "function sayHello(name){\n console.log(`hello ${name}`)\n}", "title": "" }, { "docid": "a51b3f65af73fba4b874bc5344e682ee", "score": "0.6757685", "text": "function makeGreeting(language) {\n//* The language variable will be 'trapped' within this closure.\n\treturn function(firstname, lastname) {\n\t\t//* When this function is executed here, it will look for the language variable up the scope and have access to it\n\t\t//* even after makeGreeting's executin context is done.\n\t\tif (language === 'en') {\n\t\t\tconsole.log('Hello ' + firstname + ' ' + lastname);\n\t\t}\n\t\tif (language === 'es') {\n\t\t\tconsole.log('Hola ' + firstname + ' ' + lastname);\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5c582dfb9e33e604ad9caede1b52ac25", "score": "0.6751045", "text": "function sayHello(person) {\n return 'Hello, ' + person;\n}", "title": "" }, { "docid": "710d256201f1922a3e09a0e3bb99768d", "score": "0.673543", "text": "function sayHello(name) {\n var helloOutput = \"Hello, \" + name +\"!\";\n return helloOutput\n}", "title": "" }, { "docid": "27b473261bff3cbc56d06b8587e93041", "score": "0.6702453", "text": "function sayHello () {\n return \"Hello Mr Brock\" ;\n}", "title": "" }, { "docid": "7af82225409d60d535746990209782bf", "score": "0.670126", "text": "function translator (lang) {\n if (lang === \"fr\") {\n \"Bonjour, le monde\";\n } else if (lang === \"en\") {\n \"Hello world\";\n } else if (lang === \"gb\") {\n \"LKJSDKLJSD\";\n }\n}", "title": "" }, { "docid": "bf9c199979cc14a86b7a748a34ba093b", "score": "0.6687974", "text": "function sayHello(name){\n console.log(\"Hello \"+ name);\n}", "title": "" }, { "docid": "0d79d0723b6dd7389910ccafc9315ddd", "score": "0.6685093", "text": "function greet(name){\n return \"Hello, \" + name;\n}", "title": "" }, { "docid": "94e78fdc4d68796bbf7b6f22c58e9f4d", "score": "0.6681132", "text": "function greet(parameter) {\n return 'Hello ' + parameter + '!';\n}", "title": "" }, { "docid": "be8aa5265c5dab16c54bbe4c1ec0e4ac", "score": "0.6658775", "text": "function sayHello(name) {\n console.log(\"Hello \" + name);\n}", "title": "" }, { "docid": "71e1d204b4dc426005fc6b37cd4302cd", "score": "0.6651995", "text": "function sayHello (name) {\n console.log(\"Hello, \" + name);\n}", "title": "" }, { "docid": "3884dfc6a818a313eed0f55d4edf228f", "score": "0.66486466", "text": "function sayHello(){\n return \"Hello!\";\n}", "title": "" }, { "docid": "8308c53e6b08ce8b4bd9dfaad2f70102", "score": "0.66479933", "text": "function greet(a) {\n return \"Hello\" + \" \" + a;\n}", "title": "" }, { "docid": "a7fca7d5d288918ba1e1d2e179431f5b", "score": "0.6640401", "text": "function sayHello(name){\n console.log(\"Hello\" + name);\n}", "title": "" }, { "docid": "b9d3385517b6c6f4c153701fe2a7af1d", "score": "0.6639571", "text": "function sayHi(name) {\n return `How are you, ${name}?`;\n}", "title": "" }, { "docid": "808b0fc0ce83a401b977660259b3eb0d", "score": "0.66253567", "text": "function sayHello() {\n var message = \"Hello!\"\n return message;\n}", "title": "" }, { "docid": "05364e7ad7242d1aac3df53413d77a0b", "score": "0.6624593", "text": "function greet(name) {\n return \"hello\" + \" \" + name;\n}", "title": "" }, { "docid": "d88e942bc1dd82344ac480b5a43a1dbe", "score": "0.66197", "text": "function sayHello(name) {\n console.log(\"Hallo \" + name + \"!\")\n}", "title": "" }, { "docid": "2a6037cf92ba8e7ac3c6fb0e5c0dd6d5", "score": "0.6618415", "text": "function sayHello(name) {\n if (name === 'Will') {\n return `No more testing ${name}!`;\n } else\n return `Hi there ${name}!`;\n}", "title": "" }, { "docid": "97c3f2e65ed8ccffedf79589a4ff2c1f", "score": "0.6617707", "text": "function sayHello(name) {\n console.log(\"Hello, \" + name);\n}", "title": "" }, { "docid": "ea656fb2e989a20407831a325acc5e45", "score": "0.661396", "text": "function sayHello(){\n\n}", "title": "" }, { "docid": "fe14bdb8ad9046a688cec73d236f98dd", "score": "0.66089785", "text": "function greet(name){\n return \"Hello, \" + name + \" how are you doing today?\";\n }", "title": "" }, { "docid": "d7d0f0a01e439dcf1c7de2a6d0c448a8", "score": "0.6608726", "text": "function greet(name, age) {\r\n return 'Hi ' + name + ', you are ' + age;\r\n}", "title": "" }, { "docid": "99d1713609e9d55a02b2cb0213f7490c", "score": "0.6603444", "text": "function sayHello (sb) {\n // TODO: say hello prints out (console.log's) hello in the\n // language of the speaker, but returns it in the language\n // of the listener (the sb parameter above).\n // use the 'hello' object at the beginning of this exercise\n // to do the translating\n\n // two variables for the speaker and the listener language values\n var speakerLang = this.language;\n var listenerLang = sb.language;\n // prints the greeting in the speakers's language on the console\n console.log(hello[speakerLang]);\n // returns the greeting in the listener's language\n return (hello[listenerLang]);\n //TODO: put this on the SentientBeing prototype\n}", "title": "" }, { "docid": "ce7f250f3d478b73bdd3c64cd8aa32af", "score": "0.66000366", "text": "function greet(parameter) {\n return \"Hello, \" + parameter + \"!\";\n\n}", "title": "" }, { "docid": "b33dc6aa31ecee52f51907b60bee03dc", "score": "0.6598766", "text": "function greet(name){\n\treturn (\"Hello,\" + name + \"!\");\n}", "title": "" }, { "docid": "4c1e0d9c81e98b119dcea7d0e507a9fd", "score": "0.6592652", "text": "function sayHello(name) {\n console.log(`Hello ${name}`);\n}", "title": "" }, { "docid": "12c3357c39283668a6af15a21ec5056d", "score": "0.65847623", "text": "function greet(name){\n return('Hello, '+ name + '!')\n}", "title": "" }, { "docid": "d7c0d8d7f417d12dc5aa86daf2af4c58", "score": "0.6580848", "text": "function sayHello(name) {\n return \"Hello, \"+name;\n }", "title": "" }, { "docid": "d75be291898650de49d39155fce7be96", "score": "0.65772367", "text": "function sayHelle() {\n return \"Hello\";\n}", "title": "" }, { "docid": "981a8d82ac7c9eda1a9a26fa080d23d0", "score": "0.6576084", "text": "function greet(name) {\n return \"Hello, \" + name + \"!\";\n}", "title": "" }, { "docid": "8c62cd63ab0dbd153b8b216c9bc0a3f3", "score": "0.65715945", "text": "function greet2(name){\n return 'Hello '+ name;\n}", "title": "" }, { "docid": "3c17957d4c20f7cce6640c572954fa74", "score": "0.65414405", "text": "function greet3(name) {\r\n console.log('hello' + name);\r\n}", "title": "" }, { "docid": "3f7b5786808b08fdbd13931b72247acf", "score": "0.652972", "text": "function sayHello() {\n console.log('hello and name. ', helloName());\n}", "title": "" }, { "docid": "c37080081c91dc50c46510a2e31c7907", "score": "0.65280735", "text": "function translate(word, language) {\n\n}", "title": "" }, { "docid": "ec614e3595aca73e3c325e3fa751ab13", "score": "0.6511761", "text": "function greet(name) {\n\treturn 'Hi '+name;\n}", "title": "" }, { "docid": "30fe71327f2249f6447bb7b87ce61be0", "score": "0.6502584", "text": "function greet3(name){\n return 'Hello ' + name;\n console.log('Hello '+ name);\n}", "title": "" }, { "docid": "decc5db70bffa435de1d6d33790914ad", "score": "0.65011567", "text": "function sayHello (sb) {\n // TODO: say hello prints out (console.log's) hello in the\n // language of the speaker, but returns it in the language\n // of the listener (the sb parameter above).\n // use the 'hello' object at the beginning of this exercise\n // to do the translating\n\n console.log(hello[this.language]);\n return hello[sb.language];\n\n //TODO: put this on the SentientBeing prototype\n }", "title": "" }, { "docid": "b0b61750179a171382268b3ec22ae091", "score": "0.64986515", "text": "function sayHello2(name){\n console.log(\"Hello, \" + name);\n}", "title": "" }, { "docid": "7ba2a389fe4ff0bb36630f56154050bb", "score": "0.6481612", "text": "function sayHello(sb) {\r // TODO: say hello prints out (console.log's) hello in the\r // language of the speaker, but returns it in the language\r // of the listener (the sb parameter above).\r // use the 'hello' object at the beginning of this exercise\r // to do the translating\r\r //TODO: put this on the SentientBeing prototype\r console.log(hello[this.language]); //speaker\r return hello[sb.language]; //listener\r }", "title": "" }, { "docid": "7544b3ad1c21ea0099a2ff8b8e795102", "score": "0.6469988", "text": "function greet3(firstName = 'John', lastName= 'Doe'){\n // console.log('Hello');\n return `hello ${firstName} ${lastName}`;\n }", "title": "" }, { "docid": "bd63b4bf652cbc02ad5e3e35bdbc4b9f", "score": "0.644987", "text": "function sayIt(what) {\n return `Saying: ${what}`;\n}", "title": "" }, { "docid": "4c1d524622bfaa8f68c703ec740966f0", "score": "0.6448738", "text": "function sayWhatUp(first, last, language) {\n language = language || 'es';\n\n if (language === 'es') {\n console.log(`Hola ${first} ${last}`);\n }\n if (language === 'en') {\n console.log(`Hi ${first} ${last}`);\n }\n\n}", "title": "" }, { "docid": "ea19dd564751c54a37bc1ca452c14b00", "score": "0.6443", "text": "function greeter1(name){\n return \"hello \" + name\n}", "title": "" }, { "docid": "9edb7f3a5a4bc022390d15e2e0d5aa61", "score": "0.6442914", "text": "function Hello3(){\n return 'Hello world'\n}", "title": "" }, { "docid": "4dc5a252842609ebbf0c581160adc2ad", "score": "0.6441593", "text": "function greetHello(theName){\n if(typeof(theName)!==\"string\"){\n return \"Hello!\";\n }\n return `Hello ${theName}`;\n }", "title": "" }, { "docid": "38f6a070610d54212165fbbfacb41a9b", "score": "0.6438159", "text": "function greet() {\n return 'hello world!';\n}", "title": "" }, { "docid": "80886ccf64bf6cf0ce129d15c4f50e69", "score": "0.64015186", "text": "function sayHello(firstName, lastName){\n const message = `Hello, ${firstName} ${lastName}`;\n console.log(message);\n}", "title": "" }, { "docid": "fbb194d42e22e70a856c7a4b5775cd66", "score": "0.6396551", "text": "function greet() {\r\n return \"hello world!\";\r\n}", "title": "" }, { "docid": "bc9367e1cb89f241005f2c20a8ba711a", "score": "0.63886774", "text": "function sayHello(){\n return \"Hello There Stranger\"\n}", "title": "" }, { "docid": "5b906f0e8e42da8391fcdc38a02de45b", "score": "0.6386974", "text": "function sayHello(message) { // returns Hello World! alert box\n alert(\"Hello World\");\n}", "title": "" }, { "docid": "a6d34cd5700f602c793c3f4d112d820c", "score": "0.6366811", "text": "function greet(name) {\n return `Hello ${name}`;\n}", "title": "" }, { "docid": "51829c6c496f21a875b5f72de06e6b79", "score": "0.6363769", "text": "function greet (name) {\n\treturn \"Hello,\" + name + \"!\"\n}", "title": "" }, { "docid": "034f5599e3d12a317cc59ba0eed99f95", "score": "0.63562834", "text": "function greet(firstname, lastname, language = \"en\", ...other) {\n \n // language = language || \"en\";\n \n if (arguments.length === 0) {\n console.log(\"Missing prameters!\");\n console.log(\"==============\");\n return;\n }\n \n console.log(firstname);\n console.log(lastname);\n console.log(language);\n console.log(arguments);\n console.log(\"arg 0: \" + arguments[0]);\n console.log(\"==============\");\n}", "title": "" }, { "docid": "b4aff370c30f4b31a8a5c3f3e1e6b038", "score": "0.6350392", "text": "function say(word) {\n console.log('You said: ' + word);\n}", "title": "" }, { "docid": "f660ede6b545f7ee363cd78e173ab9ca", "score": "0.6346334", "text": "function hello() {\n return 'Hello World!'\n}", "title": "" }, { "docid": "e2f0adccf436aca0d107556f4fa6b896", "score": "0.63387567", "text": "function makeGreeting(language){ //factory function\n \n return function (firstname, lastname) {\n //look up the scope chain for 'language' variable\n if (language === 'en') { \n console.log('Hello ' + firstname + ' ' + lastname);\n }\n\n if(language === 'es'){ \n \n console.log('Hola ' + firstname + ' ' + lastname);\n }\n \n };\n}", "title": "" }, { "docid": "89f5635fedc51003158c7f48d78520d5", "score": "0.63338244", "text": "function sayHello(input) {\n // if (input === \"Alex\") {\n // return \"Hello, Alex\";\n // } if(input === \"Pat\") {\n // return \"Hello, Pat\";\n // } else {\n // return \"Hello, Jane\";\n // }\n\n if(input === true) {\n return \"Hello, World\";\n } else {\n return \"Hello, \" + input;\n }\n}", "title": "" }, { "docid": "ad6a1633fe3425603c764923133350e9", "score": "0.63324773", "text": "function hello(){\n return 'Hello you!'\n}", "title": "" }, { "docid": "47245941aa9894f7ea68cce522405390", "score": "0.632775", "text": "function greet(name) {\r\n console.log('hello' + name);\r\n}", "title": "" }, { "docid": "b9bc1b33bb4fd12b10ced67e3e1b847d", "score": "0.6327017", "text": "function sayHello(name: string){\n return `Hello, ${name}!`;\n}", "title": "" } ]
7230bf3a1374c9a3f6470dff47ff035d
To initialize BubblePlot object.
[ { "docid": "ef2c6a9b056de1f796ddea9b5b052234", "score": "0.70486724", "text": "function BubblePlot(runtime, options) {\n BubblePlot.superclass.constructor.apply(this, arguments);\n this._seletedSeries = [];\n this._semanticMgr.setUseSemanticPattern(true);\n }", "title": "" } ]
[ { "docid": "766e6b93a3c0fe64ac03729abe94a4e9", "score": "0.62784415", "text": "function init() {\n data = [{\n x: [1, 2, 3, 4, 5],\n y: [1, 2, 4, 8, 16] }];\n \n Plotly.newPlot(\"plot\", data);\n }", "title": "" }, { "docid": "69b3eb9b14e720fa07e49fb9e2e4b1e1", "score": "0.6260059", "text": "function initBubble() {\n d3.json(\"samples.json\").then((data) => {\n \n // select the beginning of the index of the sample data (index 0, id 940)\n var selectObject = Object.values(data.samples[0])\n\n // set x values, referring to index 1 \n var initX = selectObject[1]\n\n // set y values based on index of 2, which is the OTU values\n var initY = selectObject[2]\n\n // set the marker size to the data from index of 2\n var markerSize = selectObject[2]\n\n // set the colors based on the index of 1 \n var colorSchema = selectObject[1]\n\n // set the labels based on the index of 3\n var label = selectObject[3]\n\n // Create trace\n var trace = {\n x: initX,\n y: initY,\n text: label,\n mode: \"markers\",\n marker: {\n size: markerSize,\n color: colorSchema\n }\n };\n\n // add title to the x axis\n var layout = {\n xaxis: {title: \"OTU ID\"},\n }\n \n var data = [trace];\n \n Plotly.newPlot(\"bubble\", data, layout);\n });\n}", "title": "" }, { "docid": "5c80544811567855437de2da595d6d86", "score": "0.6239306", "text": "function init() {\n data = [{\n x: [1, 2, 3, 4, 5],\n y: [1, 2, 4, 8, 16] }];\n \n Plotly.newPlot(\"plot2\", data);\n}", "title": "" }, { "docid": "cc5aed1dffc88b3f41fc75cec5505046", "score": "0.6223269", "text": "function init(){\n\n // Call functions to create graphs\n initBar(\"940\");\n initBubble(\"940\");\n initTable(\"940\");\n initGauge(\"940\");\n }", "title": "" }, { "docid": "f688adba5a436b7dfb22640f9bd1e040", "score": "0.6159558", "text": "function Bubble(descr) {\n // Common inherited setup logic from Entity\n this.setup(descr);\n\n this.sprite = this.sprite || g_sprites.bubble;\n this.scale = this.scale || 1;\n}", "title": "" }, { "docid": "1650f8fac01410e1dcb214983c646a12", "score": "0.6127644", "text": "function init() {\n drawBarChart();\n}", "title": "" }, { "docid": "53c52c37d68a17e20b918fc2e8095563", "score": "0.61097234", "text": "function preInit(target, data, options) {\n options = options || {};\n options.axesDefaults = options.axesDefaults || {};\n options.seriesDefaults = options.seriesDefaults || {};\n // only set these if there is a Bubble series\n var setopts = false;\n if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {\n setopts = true;\n }\n else if (options.series) {\n for (var i=0; i < options.series.length; i++) {\n if (options.series[i].renderer == $.jqplot.BubbleRenderer) {\n setopts = true;\n }\n }\n }\n \n if (setopts) {\n options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;\n options.sortData = false;\n }\n }", "title": "" }, { "docid": "53c52c37d68a17e20b918fc2e8095563", "score": "0.61097234", "text": "function preInit(target, data, options) {\n options = options || {};\n options.axesDefaults = options.axesDefaults || {};\n options.seriesDefaults = options.seriesDefaults || {};\n // only set these if there is a Bubble series\n var setopts = false;\n if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {\n setopts = true;\n }\n else if (options.series) {\n for (var i=0; i < options.series.length; i++) {\n if (options.series[i].renderer == $.jqplot.BubbleRenderer) {\n setopts = true;\n }\n }\n }\n \n if (setopts) {\n options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;\n options.sortData = false;\n }\n }", "title": "" }, { "docid": "c4ed6d04576d0b8c0c1390104e58e280", "score": "0.6068604", "text": "function init() {\n // Set data color and text in value\n var data_arr = [30, 30, 17, 18, 5];\n var color_arr = [\"#6a48b6\", \"#f26c4f\", \"#fbaf5d\", \"#d24297\", \"#bd8cbf\"];\n var text_arr = [\"Grphic Design\", \"Web Design\", \"Motion Graphic\", \"HTML, CSS\", \"JS & PHP\"];\n drawCircle(\"pie_chart\", data_arr, color_arr,text_arr);\n\n}", "title": "" }, { "docid": "07c039c5d467392e9190268a191f7c97", "score": "0.6047017", "text": "async initialise(xLabel, yLabel, width, height, data) {\n this.settings = { xLabel, yLabel, width, height }\n this.data = data\n await this.loadConfig()\n await this.drawInitialPoints()\n }", "title": "" }, { "docid": "732ba0abba9c1f28a86c9f1cb672bad2", "score": "0.5998072", "text": "function init(){\n buildPlots(\"940\");\n}", "title": "" }, { "docid": "b12210a05fc7784fd0c9d330c374bac2", "score": "0.5958436", "text": "init() {\n\t\t\t\tChart.resize();\n\t\t\t\tChart.render();\n\t\t\t}", "title": "" }, { "docid": "adca2a8186e5f2bff0eea9246546a3dd", "score": "0.5922684", "text": "function init() {\n //console.log(data);\n //set ID No.940 as default plot\n defaultDataset = data.samples[0];\n //console.log(defaultDataset)\n\n //select ALL sample_values, otu_ids, and otu_labels\n allSampleValuesDefault = defaultDataset.sample_values;\n\t\tallOtuIdsDefault = defaultDataset.otu_ids;\n\t\tallOtuLabelsDefault = defaultDataset.otu_labels;\n\n // BAR CHART //\n\n //sellect TOP 10 OTU's for the ID with sample_values, otu_ids, and otu_labels\n default_sampleValues = allSampleValuesDefault.slice(0,10);\n default_otu_ids = allOtuIdsDefault.slice(0,10);\n default_otu_labels = allOtuLabelsDefault.slice(0,10);\n// console.log(default_otu_ids);\n// console.log(default_sampleValues)\n\n //plot horizontal bar chart\n trace1 = [{\n type: 'bar',\n x: default_sampleValues,\n y: default_otu_ids.map(default_otu_ids => `OTU ${default_otu_ids}`),\n text: default_otu_labels,\n orientation: 'h',\n }];\n\n var barData = trace1;\n \n var barLayout = {\n title: `<b>Top 10 Bacteria Cultures Found`,\n xaxis: {title: \"Sample Value\"},\n yaxis: {autorange: \"reversed\"},\n // width: 450,\n // height: 600,\n }\n\n var config = {responsive: true}\n\n Plotly.newPlot('bar', barData, barLayout, config);\n\n // BUBBLE CHART //\n\n var trace2 = [{\n x: allOtuIdsDefault,\n y: allSampleValuesDefault,\n text: allOtuLabelsDefault,\n mode: 'markers',\n marker: {\n\t\t\t\tcolor: allOtuIdsDefault,\n\t\t\t\tsize: allSampleValuesDefault\n\t\t\t}\n }];\n\n var bubbleData = trace2\n \n var bubbleLayout = {\n title: '<b>Bacteria Cultures Per Sample',\n\t\t\txaxis: { title: \"OTU ID\"},\n\t\t\tyaxis: { title: \"Sample Value\"}, \n\t\t\tshowlegend: false,\n\t\t};\n\t\t\n\t\tPlotly.newPlot('bubble', bubbleData, bubbleLayout, config);\n \n // DEMOGRAPHICS TABLE //\n\n //Grab default metadata array \n var defaultDemo = data.metadata[0];\n// console.log(defaultDemo);\n //console.log(data.metadata);\n\n //Display key-value pairs from metadata JSON object\n Object.entries(defaultDemo).forEach(\n ([key, value]) => d3.select(\"#sample-metadata\").append(\"p\").text(`${key.toUpperCase()}: ${value}`)\n );\n\n // GAUGE CHART //\n\n //Grab washing frequency attribute from metadata JSON object\n var defaultWfreq = defaultDemo.wfreq\n// console.log(defaultWfreq);\n \n //Build guage chart\n var trace3 = [\n {\n domain: { x: [0, 1], y: [0, 1] },\n value: defaultWfreq,\n title: { text: '<b> Belly Button Washing Frequency </b> <br>Scrubs per Week'},\n type: \"indicator\",\n mode: \"gauge+number\",\n //Add steps to display gradual color change of range\n gauge: {\n axis: {range: [null, 9]},\n steps: [\n { range: [0, 1], color: 'rgb(248, 243, 236)' },\n { range: [1, 2], color: 'rgb(245, 246, 230)' },\n { range: [2, 3], color: 'rgb(233, 230, 202)' },\n { range: [3, 4], color: 'rgb(229, 231, 179)' },\n { range: [4, 5], color: 'rgb(213, 228, 157)' },\n { range: [5, 6], color: 'rgb(183, 204, 146)' },\n { range: [6, 7], color: 'rgb(140, 191, 136)' },\n { range: [7, 8], color: 'rgb(138, 187, 143)' },\n { range: [8, 9], color: 'rgb(133, 180, 138)' },\n ]\n }\n }\n ];\n\n var gaugeData=trace3;\n\n var config = {responsive: true}\n\n // var guageLayout = {width: 600, height:450, margin: {t:0, b:0}};\n var guageLayout = {margin: {t:0, b:0}};\n\n Plotly.newPlot('gauge', gaugeData, guageLayout, config);\n \n //call update when a change takes place to the DOM\n d3.select(\"#selDataset\").on(\"change\", updatePlotly);\n }", "title": "" }, { "docid": "4ba0aaba884d123b3442a8e55959d579", "score": "0.5915334", "text": "function setup() {\r\n\tcreateCanvas(800, 600);\r\n\r\n\t// Initialize Global Variables\r\n\tbubble = new Bubble(200, 400, 20);\r\n\tbubble2 = new Bubble(400, 344, 50);\r\n\tbubble3 = new Bubble(600, 100, 10);\r\n}", "title": "" }, { "docid": "e57736a0d11568a106102438c59aeb0b", "score": "0.5853029", "text": "function buildBubblePlot(id) {\n console.log(\"*** buildBubblePlot() ***\");\n var otu_ids = otuSampleObjs.map(obj => obj.otu_id);\n var sample_values = otuSampleObjs.map(obj => obj.sample);\n var labels = otuSampleObjs.map(obj => obj.label);\n var colors = otuSampleObjs.map(obj => obj.otu_id);\n\n var trace1 = {\n x: otu_ids,\n y: sample_values,\n text: labels,\n mode: 'markers',\n marker: {\n color: colors,\n size: sample_values\n }\n };\n \n var data = [trace1];\n \n var layout = {\n title: `OTU Samples for Subject: ${id}`,\n showlegend: false,\n // height: 600,\n // width: 600\n };\n \n // Plotly.newPlot('bubble', data, layout);\n Plotly.react('bubble', data, layout);\n}", "title": "" }, { "docid": "4bf19ec917178d74f97eb8a1981aa6b8", "score": "0.5844347", "text": "constructor(args) {\n\t\tsuper(args);\n\t\tthis.color = \"LightSalmon\";\n\t\tthis.name = \"Balloon\";\n\t\tthis.image.height = 60;\n\t\tthis.image.width = 34;\n\t\tthis.height = 60;\n\t\tthis.width = 34;\n\t}", "title": "" }, { "docid": "9924e318375d3af9382a7596a861d219", "score": "0.5839904", "text": "function bubbleChart(){\n return new Chart(place, {\n type: 'bubble',\n data: {\n datasets: []\n },\n options: {\n title: {\n display: true, \n text: null\n },\n legend: {\n display: false,\n },\n scales: {\n yAxes: [{\n scaleLabel: {\n display: true,\n labelString: null,\n },\n }],\n xAxes: [{\n scaleLabel: {\n display: true,\n labelString: null,\n }\n }],\n \n }\n }\n });\n}", "title": "" }, { "docid": "5d52cc4a3af83755282df7f0cabbe175", "score": "0.5837914", "text": "constructor(p, x, y){\r\n\t\tsuper(\"plot\", x, y, \"Hoe\");\r\n\t\tthis.plot = p;\r\n\t}", "title": "" }, { "docid": "ac97869a04663018f35fd3b79ec5b5aa", "score": "0.58317614", "text": "function defaultBubble(){\n d3.json(url).then((data) => {\n var sample = data.samples\n var samples = sample[0]\n var trace1 = {\n x: samples.otu_ids,\n y: samples.sample_values,\n mode: 'markers',\n // marker: {\n // size: (sample.sample_values),\n // }\n };\n var layout = {\n xaxis: {title: 'OTU ID'},\n };\n \n Plotly.newPlot('bubble', [trace1], layout);\n });\n}", "title": "" }, { "docid": "1e54f51c1ef51a95140165f5869c22aa", "score": "0.5820111", "text": "init() {\n\t\t\t\t$svg = $sel.append('svg.multipleMethods-chart');\n\t\t\t\t$g = $svg.append('g');\n\n\t\t\t\t// offset chart for margins\n\t\t\t\t$g.at('transform', `translate(${marginLeft}, ${marginTop})`);\n\n\t\t\t\t// create axis\n\t\t\t\t$axis = $g.append('g.g-axis');\n\n\t\t\t\t// setup viz group\n\t\t\t\t$vis = $g.append('g.g-vis');\n\n barGroups = $vis\n .selectAll('.g-bar')\n .data(data)\n .enter()\n .append('g')\n .attr('class', 'g-bar')\n\n\t\t\t\tChart.resize();\n\t\t\t\tChart.render();\n\t\t\t}", "title": "" }, { "docid": "7565e86e85edb90dbecd517fd5e9acec", "score": "0.5811731", "text": "function initialize_bubblechart(tagid) {\n $.get('/dashboard/chart_data/' + tagid + '.csv', function(data) {\n var options = {\n chart: {\n renderTo: 'bubble-chart',\n defaultSeriesType: 'bubble',\n zoomType: 'xy'\n },\n title: {\n text: 'Number of votes'\n },\n xAxis: {\n type: 'integer'\n },\n yAxis: {\n title: {\n text: 'Units'\n }\n },\n plotOptions: {\n series: {\n cursor: 'pointer',\n point: {\n events: {\n click: function() {\n window.location.href = this.options.url,target=\"_newtab\" ;\n }\n }\n }\n }\n },\n series: []\n };\n var lines = data.split('\\n');\n $.each(lines, function(lineNo, line) {\n if (line == \"\") return;\n var items = line.split(',');\n var series = {\n name: items[0],\n data: [{y: parseInt(items[1]),x:parseInt(items[2]), url: '/ideas/' + items[2]}]\n };\n\n options.series.push(series);\n });\n\n var chart = new Highcharts.Chart(options);\n console.log(options);\n });\n}", "title": "" }, { "docid": "e063dcb658c3a81e14334e0b7b7376ca", "score": "0.58019745", "text": "init(){\n if (this.mode == 'manual' ){\n this.number = this.labels.length ;\n if (this.ticks.length != this.labels.length ){\n warn('Number of ticks and tick labels are not equal') ;\n }\n }\n \n if (this.mode == 'auto'){\n var delta = this.delta ;\n var dl = 1./(this.number+1) ;\n this._ticks = [] ;\n this._labels = [] ;\n for(var i=0 ; i<this.number ;i++){\n var num = delta*(i+1)+this.min ;\n if ( this.precision != undefined ){\n num = num.toFixed(this.precision) ;\n }\n this.ticks.push( (1+i)*dl );\n this.labels.push(num+this.unit) ;\n }\n }\n this.callback() ;\n }", "title": "" }, { "docid": "c71635c203bb7e8422322c97e6454823", "score": "0.57795054", "text": "function init() {\n setupCharts()\n setupProse()\n update(0)\n }", "title": "" }, { "docid": "0468797f84899f84eb491d8ebb1bb62c", "score": "0.5739684", "text": "function initializeBubbles() {\n\n // DECREASE BUBBLE COUNT ON SMALLEST SCREENS\n let num = rootTones.length;\n if (cw < 400 || ch < 400) {\n num = rootTones.length - 1;\n }\n\n // UNIQUE BUBBLE ID\n let index = 0;\n\n // CREATE BUBBLE OBJECTS\n for (let i=0; i<num; i++){\n for (let j=0; j<intervals.length; j++) {\n\n // SET RANDOM STARTING POSITION\n // CHECK TO SEE IF ITS TOO CLOSE\n let x, y;\n do {\n x = Math.round(getRandomNumber(0, cw));\n y = Math.round(getRandomNumber(0, ch));\n } while (checkBubblePositions(x, y) === false );\n\n // SET MASS BASED ON FREQUENCY\n let massMin = 0.5;\n let massMax = 2.5;\n let m1 = remapNumber(i, rootTones.length-1, 0, massMin, massMax);\n let m2 = remapNumber(j, intervals.length-1, 0, massMin, massMax);\n let m = m1 + m2;\n\n // SET KEY AND TONE IDS\n let k = i;\n let n = j;\n\n // SET WAVE\n let wave = bassWave;\n if (i % 2 === 1) {\n wave = celesteWave;\n }\n\n // CREATE BUBBLE\n let b = new Bubble(x, y, m, k, n, wave, index);\n bubbles.push(b);\n\n // INCREAE UNIQUE ID\n index++;\n }\n }\n}", "title": "" }, { "docid": "39bc80502ce38f603f1d65cd1738e33d", "score": "0.5739444", "text": "init() {\r\n // Add Button Graphics \r\n this.button = new Graphics(0, 0, 300, 50);\r\n this.button.lineStyle(0, 0xFF0000, 1);\r\n this.button.beginFill(0xFF0000, 1);\r\n this.button.drawRect(0, 0, 300, 100);\r\n this.button.x = -120;\r\n this.button.y = 180;\r\n this.button.on('click', () => { this.emit('click'); });\r\n this.addChild(this.button);\r\n\r\n // Add text for the Graphics\r\n this.buttonText = new Text('THROW BALL',\r\n {\r\n font: '12px Arial',\r\n fill: 0xffffff,\r\n align: 'center',\r\n cacheAsBitmap: true, // for better performance\r\n });\r\n\r\n this.buttonText.x = 65;\r\n this.buttonText.y = 35;\r\n this.button.addChild(this.buttonText);\r\n }", "title": "" }, { "docid": "f88f72c2b738c2b1768045e9ab23c223", "score": "0.57352173", "text": "_init() {\n\n\t\tthis.axis= {};\n\n\t\t// Figures\n\t\tthis._points= [];\n\t\tthis._lines= [];\n\n\t\t// Shift and transform origin\n\t\tthis.point= {\n\t\t\tshiftX: x => this.width/2 - (this.axis.x[1] + this.axis.x[0]) + x,\n\t\t\tshiftY: y => this.height/2 + (this.axis.y[1] + this.axis.y[0]) - y,\n\t\t};\n\n\t\t// Scale point to the real canvas coordinates\n\t\tthis.proportionX= x => this.point.shiftX( x / this.scale.x );\n\t\tthis.proportionY= y => this.point.shiftY( y / this.scale.y );\n\n\t\tthis.render= this.render.bind(this);\n\t}", "title": "" }, { "docid": "4d04fb3d35a48dc4bd7de58afe7d8fbe", "score": "0.5723961", "text": "function BubbleLayerOptions() {\n this.container = map;\n this.type = 'point';\n this.shape = 'circle';\n this.eventSupport = false;\n}", "title": "" }, { "docid": "b99f29d54e31030e9c48259f88aaa4f3", "score": "0.57157165", "text": "function init(){\n chart.data.labels = []\n dataset.backgroundColor = [];\n dataset.data = [];\n for (let i = 0; i < 70; i++) {\n chart.data.labels.push('Arr');\n dataset.backgroundColor.push('blue');\n dataset.data.push(Math.ceil(Math.random() * 133));\n }\n n = dataset.data.length;\n chart.update();\n}", "title": "" }, { "docid": "eb1edbb101d3d264e8532a6d0e62be26", "score": "0.5664987", "text": "init() {\n this._additionalData = this.getAttribute('data') ? pfChartUtil.getJSONAttribute(this, 'data') : {};\n this._width = this.getAttribute('width') ? parseInt(this.getAttribute('width')) : null;\n this._height = this.getAttribute('height') ? parseInt(this.getAttribute('height')) : 171;\n this._legend = this.getAttribute('legend') ? pfChartUtil.getJSONAttribute(this, 'legend') : { show: false };\n this._targetSelector = this.getAttribute('target-selector');\n this._title = this.getAttribute('title') ? this.getAttribute('title') : '';\n this._colors = this.getAttribute('colors') ? pfChartUtil.getJSONAttribute(this, 'colors') : {};\n this._getData();\n this._prepareData();\n }", "title": "" }, { "docid": "4ba1e5d46a0bf6e0801ceeed17657918", "score": "0.56551677", "text": "function ready() {\n bubble.visible = true\n}", "title": "" }, { "docid": "d6a2124f50f0b243e7a767fe8955bc20", "score": "0.5639793", "text": "function initialise()\n{\n include_navbar();\n make_nav_item_active(\"line-chart-item\");\n tooltip= generate_tooltip();\n svg = generate_svg(\"#line-chart\",650,800);\n canvas = add_canvas(svg);\n [width,height] = svg_dimensions(svg);\n}", "title": "" }, { "docid": "4d8c0e7fee1322f320e8e9d6211843ad", "score": "0.5623674", "text": "init() {\n if (this.tooltips.length) {\n this.addTooltipsEvent();\n }\n return this;\n }", "title": "" }, { "docid": "55062c181943e98cbab233a0d2a262e2", "score": "0.5621834", "text": "constructor(self) {\n\t\tthis.ball = this.createBall(self);\n\t\tthis.init();\n\t}", "title": "" }, { "docid": "7ed6b0b24522a17ab6808007c616ba0e", "score": "0.56207615", "text": "function BarChartInit() {\n\tvar fill \t= HexToRGBA('#FF2626', 0.5); \t// fill colour\n\tvar stroke\t= HexToRGBA('#BF0000', 1); \t\t// stroke colour\n\tvar scale\t= HexToRGBA('#000000', 0.75);\t// scale line colour\n\tvar grid\t= HexToRGBA('#000000', 0.15);\t// grid line colour\n\t\t\t\t\n\tvar barChartData = {\n\t\t\tlabels : _histLabelArray(),\n\t\t\tdatasets : [\n\t\t\t\t{\n\t\t\t\t\tfillColor \t: \tfill,\n\t\t\t\t\tstrokeColor : \tstroke,\n\t\t\t\t\tdata \t\t: _histDataArray()\n\t\t\t\t}\n\t\t\t]\n\t};\n\t\n\tvar barOptions = {\n\t\t\tanimation \t\t: false,\n\t\t\tscaleLineColor \t: scale,\n\t\t\tscaleGridLineColor\t: grid\n\t};\n\t\n\tClearLegend();\n\t\n\tvar target = document.getElementById(\"canvas\");\n\tif(target == null) return FAIL;\n\tvar myBar = new Chart(target.getContext(\"2d\")).Bar(barChartData, barOptions);\n\tif(myBar == null) return FAIL;\n\t\n\treturn SUCCESS;\n}", "title": "" }, { "docid": "fb4a8c388280429bdf5e3ed2f2e7dc0b", "score": "0.56193477", "text": "constructor(bubbleFactory,screenBottom,width,bubbleRadius) {\r\n\t\tthis.angle = 90;\r\n\t\tthis.bubbleFactory = bubbleFactory;\r\n\t\tthis.bottom = screenBottom;\r\n\t\tthis.bubble = null;\r\n\t\tthis.width = width;\r\n\t\tthis.bubbleRadius = bubbleRadius;\r\n\t\t//this.addBubble();\r\n\t}", "title": "" }, { "docid": "342262297534eceef29edcdf6d7c2227", "score": "0.56115305", "text": "_initPlot(){\n var that = this;\n \n this._plot = new Chartist.Line( this._parentElem, {\n labels: null, // Array\n series: null // Array of Arrays\n }, {\n //high: 255,\n low: 0,\n divisor: 5,\n showPoint: false,\n lineSmooth: Chartist.Interpolation.none(),\n showArea: false,\n axisX: {\n showLabel: false,\n showGrid: false\n }\n \n }); \n \n this._colorCounter = 0;\n \n // refreshing the style\n this._plot.on('draw', function(context) {\n if(context.type === 'line') {\n context.element._node.style.stroke = that._lineColors[ that._colorCounter % that._lineColors.length ]\n context.element._node.style[\"stroke-width\"] = that._lineThickness + \"px\";\n that._colorCounter ++;\n }\n });\n\n }", "title": "" }, { "docid": "e0ec06950d3332a4d0a413f4da6edcca", "score": "0.5604355", "text": "function plotBubble(sampleData) {\n \n var x = [];\n var y = [];\n \n var trace1 = {\n x: sampleData.otu_ids,\n y: sampleData.sample_values,\n text: sampleData.otu_labels,\n mode: 'markers',\n marker: {\n color: sampleData.otu_ids,\n size: sampleData.sample_values,\n colorscale: 'Blackbody'\n },\n \n };\n \n // data\n var data = [trace1];\n \n // layout\n var layout = {\n xaxis: {\n title: 'OTU ID'\n },\n showlegend: false\n };\n \n // Render the plot to the div tag with id \"bubble\"\n Plotly.newPlot('bubble', data, layout);\n}", "title": "" }, { "docid": "f6ce68799857f12f510747be60239615", "score": "0.55857533", "text": "function Bubble() {\n this.x = random(100, 120);\n this.y = random(0, height);\n this.i = random(100, 120);\n this.j = random(0, height - 100);\n //two types of bubble for variation\n this.display = function() {\n noStroke();\n fill(260, 80);\n ellipse(this.x, this.y, 20);\n\n noStroke();\n fill(260, 60);\n ellipse(this.i, this.j, 28);\n }\n //moving the bubbles in a circular loop with variations\n this.move = function() {\n this.x = this.x + random(-0.50, 0.50);\n this.y = this.y - 1;\n this.i = this.i + random(-0.50, 0.50);\n this.j = this.j - 1;\n if (this.y < 0) {\n this.y = height;\n this.x = random(100, 120);\n }\n if (this.j < 0) {\n this.j = height;\n this.i = random(100, 120);\n }\n }\n}", "title": "" }, { "docid": "dccfa9a71714cc7d50f7525dbb527044", "score": "0.5585278", "text": "function initChartBtns() {\n self.chartBtns.on(\"click\", function() {\n self.setChartType($(this).data(\"viz\"), true);\n });\n }", "title": "" }, { "docid": "a86582af473678ba8ba9b6856294191b", "score": "0.55804336", "text": "function Bubble(horizontalPos, minSize, maxSize) {\r\n this.horizontalProportion = horizontalPos\r\n this.x = this.horizontalProportion * windowWidth;\r\n this.y = random(0, windowHeight);\r\n var size = random(minSize, maxSize)\r\n this.w = size;\r\n this.h = size;\r\n\r\n this.display = function() {\r\n color(190, 20);\r\n ellipse(this.x, this.y, this.w, this.h);\r\n }\r\n\r\n this.move = function(direction) {\r\n if (this.y < 0 - this.h) {\r\n this.y = windowHeight; //resets to the bottom of the screen\r\n var size = random(minSize, maxSize)\r\n this.w = size;\r\n this.h = size;\r\n } else if (this.y > windowHeight + this.h) {\r\n this.y = 0; //resets to the top of the screen\r\n var size = random(minSize, maxSize)\r\n this.w = size;\r\n this.h = size;\r\n } else {\r\n this.y += direction;\r\n }\r\n }\r\n}", "title": "" }, { "docid": "d678ec0628c047c1a836ca42ac95a81b", "score": "0.5571916", "text": "initialiseChart() {\r\n\t\tthis.svg = d3.select(this.selector)\r\n\t\t\t.append('svg')\r\n\t\t\t\t.attr('width', this.dimensions.width)\r\n\t\t\t\t.attr('height', this.dimensions.height);\r\n\r\n\t\tthis.wrapper = this.svg\r\n\t\t\t.append('g')\r\n\t\t\t\t.attr('width', this.dimensions.width - this.margins.x)\r\n\t\t\t\t.attr('height', this.dimensions.height - (2 * this.margins.y))\r\n\t\t\t\t.attr('class', 'wrapper')\r\n\t\t\t\t.attr('transform', `translate(0, ${this.margins.y})`);\r\n\r\n\t\t// this.buildFilter();\r\n\t\tthis.buildGuide();\r\n\t\tthis.buildLine();\r\n\t\tthis.buildEndCircle();\r\n\t}", "title": "" }, { "docid": "d6088163ef55e3723bf5f3eb8d904909", "score": "0.55678725", "text": "initVis(){\n var vis = this;\n this.bar = false;\n\n vis.scatterPlot = new ScatterPlot(vis.parentElement, vis.data);\n vis.barChart = new BarChart(vis.parentElement, vis.data);\n vis.barChart.svg\n .style(\"opacity\", 0)\n .attr(\"display\", \"none\");\n\n $('#' + vis.parentElement + 'StartBtn').on(\"click\",()=>vis.bars? vis.toScatterPlot() : vis.toBarChart())\n }", "title": "" }, { "docid": "71b4aaeb6f7ca4b45a5ac2c76c0e4e77", "score": "0.55520123", "text": "function bubblePlot(sample) {\r\n\r\n // Use D3 fetch to read the JSON file \r\n d3.json(\"samples.json\").then(function(data) {\r\n \r\n // code to isolate selected sample ID data from the JSON file \r\n var bubbles = data.samples;\r\n var bubbleResultArray = bubbles.filter(sampleObject => sampleObject.id == sample);\r\n var bubbleResult = bubbleResultArray[0];\r\n console.log(bubbleResult);\r\n\r\n //code to designate the x and y axes for the bubble chart \r\n var trace2 = {\r\n x : bubbleResult.otu_ids,\r\n y : bubbleResult.sample_values,\r\n mode : 'markers',\r\n marker : {\r\n size: bubbleResult.sample_values,\r\n color: bubbleResult.otu_ids\r\n },\r\n text: bubbleResult.otu_labels\r\n }\r\n \r\n var data3 = [trace2];\r\n \r\n // code to format the layout of the bubble chart\r\n var layout3 = {\r\n title: 'Bully Button Samples Bubble Chart',\r\n showlegend: false,\r\n height: 800\r\n };\r\n \r\n// code to create bubble chart using selected sample from external JSON file\r\nPlotly.newPlot('bubble', data3, layout3);\r\n})}", "title": "" }, { "docid": "f148aea3151c8424192db0da0b846028", "score": "0.5548999", "text": "initTooltip() {\n const self = this;\n\n // Array containing all tooltip lines (visible or not)\n self.d3.tooltipLines = [];\n self.curData.forEach(function (datum, index) {\n if (index > self.colorPalette.length) {\n notify().error(\"Palette does not contain enough colors to render curve with color, \" +\n \"this should never occur, contact an administrator\");\n self.d3.tooltipLines.push(\n self.d3.o.tooltip.append(\"p\")\n .style(\"color\", \"#000\")\n .style(\"margin\", \"0 0 4px\")\n .style(\"font-size\", \"0.8em\")\n );\n } else {\n self.d3.tooltipLines.push(\n self.d3.o.tooltip.append(\"p\")\n .style(\"color\", self.colorPalette[index])\n .style(\"margin\", \"0 0 4px\")\n .style(\"font-size\", \"0.8em\")\n );\n }\n });\n }", "title": "" }, { "docid": "9f7f2dcd0c49299aae3b0ba8ce86e32f", "score": "0.5545514", "text": "burstBubble(){\n\t this.bubble = new createjs.Sprite(window.burstSheet, \"animate\");\n\t }", "title": "" }, { "docid": "ceea175a55acbb41357d40109314466d", "score": "0.55331486", "text": "function BizLegend()\n{\n this.BLACK = \"#000000\";\n this.WHITE = \"#ffffff\";\n this.GRAY = \"#aaaaaa\";\n this.VERTICAL = 0;\n this.HORIZONTAL = 1;\n\n // // red, blue, green, purple,\n // // orange, cyan, yellow, magenta\n //this.def_colors = new Array(\"#ff0000\", \"#0000ff\", \"#008800\", \"#900090\",\n // \"#ffa500\", \"#00ffff\", \"#ffff00\", \"#ff00ff\");\n\n\n this.def_colors = new Array(\"#ff0000\", // red\n \"#0000ff\", // blue\n \"#008000\", // green\n \"#800080\", // purple\n \"#ffa580\", // orange\n \"#00ffff\", // cyan\n \"#ffff00\", // yellow\n \"#008080\", // teal\n \"#ff00ff\", // pink\n \"#00ff00\", // lime\n \"#800000\", // maroon\n \"#808000\"); // olive\n\n//gray #808080\n//navy #000080\n//silver #C0C0C0\n\n this.legend_colors = new Array();\n\n this.legend_labels = new Array();\n this.layout = this.VERTICAL;\n this.backgroundColor = \"#ffffff\";\n\n this.legendFont = 10;\n this.legendFontSize = 10;\n\n if ( this.legend_labels.length != 0 )\n this.initialize();\n}", "title": "" }, { "docid": "40495e52068d1781995f62060a4050f1", "score": "0.55315256", "text": "function init() {\n \n // Demographic Info\n // Select the drop down menu\n var demoInfo = d3.select(\"#sample-metadata\");\n \n // assign demo info to div\n Object.entries(onLoadDemoData[0]).forEach(([key, value]) => {\n var demoData = demoInfo.append(\"p\");\n demoData.text(`${key}: ${value}`);\n });\n \n // Bar Chart\n trace = [{\n x: xdata,\n y: ydata,\n text: tdata,\n type: \"bar\",\n orientation: \"h\",\n marker: {color: \"rgb(121,190,199\"}}];\n layout = {\n title: \"Top 10 Bacteria Cultures Found\",\n };\n Plotly.newPlot(\"bar\", trace, layout);\n \n // Bubble Chart\n var trace1 = {\n x: xbubb,\n y: ybubb,\n text: tbubb,\n mode: 'markers',\n marker: {\n size: ybubb,\n color: xbubb,\n }\n };\n var data = [trace1];\n var layout2 = {\n title: \"Bacteria Cultures Per Sample\",\n xaxis: {title: \"OTU ID\"},\n showlegend: false,\n height: 500,\n width: 800\n };\n Plotly.newPlot(\"bubble\", data, layout2);\n\n // Gauge Chart\n var gData = [{\n domain: { x: [0, 1], y: [0, 1] },\n value: xGauge,\n title: { text: \"<span style='color:#333333'>Belly Button Washing Frequency</span><br><span style='font-size:0.8em;'>Scrubs Per Week</span>\" },\n type: \"indicator\",\n mode: \"gauge+number\",\n gauge: {\n bar: {color: \"#DC7573\"},\n axis: {range: [null, 9] },\n steps: [\n {range: [0, 1], color: \"#9292b1\" },\n {range: [1, 2], color: \"#9095b3\" },\n {range: [2, 3], color: \"#8d9ab5\" },\n {range: [3, 4], color: \"#8b9fb7\" },\n {range: [4, 5], color: \"#88a5bb\" },\n {range: [5, 6], color: \"#83abbe\" },\n {range: [6, 7], color: \"#80b1c0\" },\n {range: [7, 8], color: \"#7db7c3\" },\n {range: [8, 9], color: \"#7db7c3\" },],\n }\n }];\n var layout3 = { \n font: {color: \"gray\"}};\n\n Plotly.newPlot(\"gauge\", gData, layout3);\n \n }", "title": "" }, { "docid": "a3cea4848109a5e1de8cbf160c2a8026", "score": "0.55277634", "text": "function init() {\n var dataset = selector.property(\"value\");\n \n var topTenIds = samples[dataset][\"otu_ids\"].slice(0,10);\n var ttiStrings = topTenIds.map(d => \"OTU \" + d.toString());\n\n var topTenValues = samples[dataset][\"sample_values\"].slice(0,10);\n \n var dataBar = [{\n type: 'bar',\n x: topTenValues.reverse(),\n y: ttiStrings.reverse(),\n orientation: 'h'\n }];\n \n var layoutBar = {\n height: 500,\n width: 800\n };\n \n Plotly.newPlot('bar', dataBar, layoutBar);\n\n \n var trace1 = {\n x: samples[dataset][\"otu_ids\"],\n y: samples[dataset][\"sample_values\"],\n text: samples[dataset][\"otu_labels\"],\n mode: 'markers',\n marker: {\n size: samples[dataset][\"sample_values\"],\n color: samples[dataset][\"otu_ids\"]\n }\n };\n \n var dataBubble = [trace1];\n \n var layoutBubble = {\n showlegend: false,\n xaxis: {title: \"OTU IDs\"},\n yaxis: {title: \"Sample Values\"},\n height: 600,\n width: 1200\n };\n \n Plotly.newPlot('bubble', dataBubble, layoutBubble);\n\n var summary = []\n Object.entries(metadata[dataset]).forEach(([key, value]) => {\n summary.push(`${key.toString()}: ${value.toString()}`);\n });\n \n var chart = d3.select(\"#sample-metadata\")\n\n chart.selectAll(\"p\")\n .remove();\n \n chart.selectAll(\"p\")\n .data(summary)\n .enter()\n .append(\"p\")\n .text(d => d);\n \n var dataGauge = [\n {\n value: metadata[dataset][\"wfreq\"],\n title: { text: \"Wash Frequency\" },\n type: \"indicator\",\n mode: \"gauge+number\",\n // text: [\"0-1\", \"1-2\", \"2-3\",\"3-4\",\"4-5\",\"5-6\",\"6-7\",\"7-8\",\"8-9\"],\n gauge: {\n axis: {range: [0, 9]},\n steps: [\n { range: [0, 1], color: \"#FFFFFF\", name: \"0-1\"},\n { range: [1, 2], color: \"#EFEFEF\" },\n { range: [2, 3], color: \"#DFDFDF\" },\n { range: [3, 4], color: \"#CFCFCF\" },\n { range: [4, 5], color: \"#BFBFBF\" },\n { range: [5, 6], color: \"#AFAFAF\" },\n { range: [6, 7], color: \"#9F9F9F\" },\n { range: [7, 8], color: \"#8F8F8F\" },\n { range: [8, 9], color: \"#7F7F7F\" },\n ]\n }\n }\n ];\n \n var layoutGauge = { width: 600, height: 500, margin: { t: 0, b: 0 } };\n \n Plotly.newPlot('gauge', dataGauge, layoutGauge);\n\n }", "title": "" }, { "docid": "c6c63b90925d45feefddb0b61dfdd7d1", "score": "0.55206895", "text": "function Bubble(x, y, p) {\n this.x = x;\n this.y = y;\n this.degree = p;\n\n // Dtermines the distance from mouse location.\n this.distX = 0;\n this.distY = 0;\n this.isPressed = false;\n\n // Determines the velocity of the note (range: [0,1]).\n // The diameter is the size of the bubble as used in\n // drawning an p5 ellipse.\n this.vel = VELOCITY;\n this.diam = DIAMETER;\n\n // Determines the coloring starting point.\n this.col = randomColor();\n\n this.display = function() {\n stroke(255);\n fill(this.col);\n ellipse(this.x, this.y, this.diam);\n }\n\n this.pressed = function() {\n let d = dist(mouseX, mouseY, this.x, this.y);\n if (d < this.diam / 2) {\n triggerAttack(this.degree, this.vel);\n this.isPressed = true;\n }\n }\n\n this.released = function () {\n let d = dist(mouseX, mouseY, this.x, this.y);\n if (d < this.diam) {\n this.brighten();\n triggerRelease(this.degree);\n this.isPressed = false;\n }\n }\n\n this.brighten = function () {\n this.col.setAlpha(alpha(this.col) + 1);\n }\n\n this.move = function() {\n this.x = this.x + random(-0.5, 0.5);\n this.y = this.y + random(-0.5, 0.5);\n }\n}", "title": "" }, { "docid": "ef4fe9c23b4b6a7065f50df0d6321a53", "score": "0.551223", "text": "function init(){\n addOptions();\n plotCharts(\"940\");\n displayData(\"940\");\n plotGauge(\"940\");\n}", "title": "" }, { "docid": "f788a25934d3f6a99f5aee7f1090b568", "score": "0.55104136", "text": "constructor(x, y, origin){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.boutonHeight = boutonHeight;\n\t\tthis.origin = origin;\n\t\tthis.rgb = [185, 185, 185, 1.0]; \t\n\t}", "title": "" }, { "docid": "505592e0d0c447ee102594fc169d6fea", "score": "0.55057746", "text": "function init()\n {\n self.options = options;\n self.nodes = [];\n // @v4 strength to apply to the position forces\n self.forceStrength = 0.03;\n self.velocityDecay = 0.6;\n self.defaultDuration = 200;\n self.maxEarthquakeMagnitude = 0;\n self.bubbles = null;\n \n // go ahead and build the svg\n self.svg = d3.select(\"#\" + self.options.divId).insert(\"svg\", \":first-child\");\n \n self.popupDiv = d3.select(\"#\" + self.options.divId)\n .append(\"div\")\n .attr(\"class\", \"tooltip\")\n .style(\"opacity\", 0);\n \n updateRadiusScale(2);\n \n chart.onWindowResize();\n \n runSimulation();\n }", "title": "" }, { "docid": "7aecec149bc666625db85780ca8cef0b", "score": "0.5501317", "text": "function bubblechart() {\n d3.json(\"StarterCode/samples.json\").then(function(data) {\n \n var otu_ids = data.samples[0].otu_ids\n \n var sample_values = data.samples[0].sample_values\n \n var otu_labels = data.samples[0].otu_labels\n var dataset_id = d3.select(\"#selDataset\")\n var trace2 = {\n x: otu_ids,\n y: sample_values,\n type: \"bubble\",\n text: otu_labels,\n hoverinfo: \"x+y+text\",\n mode: 'OTU Id',\n marker: {\n color: otu_ids,\n size: [sample_values]\n }\n };\n \n var data = [trace2];\n \n var layout = {\n title: 'Bacteria Cultures Per Sample',\n xaxis: { title: \"OTU IDs\" },\n yaxis: { title: \"Amount of Samples Collected\" },\n\n showlegend: false,\n height: 600,\n width: 600\n };\n \n Plotly.newPlot('bubble', data, layout);\n})}", "title": "" }, { "docid": "bf54e4bcd0f9763a5c55cf5d750678eb", "score": "0.5496096", "text": "initalizeChart() {\n const cs = this[this.chartData.chartType]('init');\n this.drawTitle();\n this.generateLegend(cs);\n }", "title": "" }, { "docid": "8776bc86d6a7faa06cd775d829f99cea", "score": "0.5491082", "text": "constructor (...params) {\n super(...params);\n this._bandScale = Scales.band();\n this._plotPadding = {\n x: 0,\n y: 0\n };\n this._plotSpan = {\n x: 0,\n y: 0\n };\n this._pointMap = {};\n this._overlayPath = {};\n this._rtree = new RTree();\n }", "title": "" }, { "docid": "f1a230864cd67657294e60074ee922fb", "score": "0.54859245", "text": "function init() {\n\n let fileteredID = data.samples.filter(subject => subject.id === \"940\")[0];\n // console.log(fileteredID);\n\n let sampleValues = fileteredID.sample_values;\n // console.log(sampleValues);\n\n let otuIDs = fileteredID.otu_ids;\n // console.log(otuIDs);\n\n let otuLabels = fileteredID.otu_labels;\n // console.log(otuLabels);\n\n let top10SampleValues = sampleValues.slice(0, 10).reverse();\n // console.log(top10SampleValues);\n\n let top10OtuIDs = otuIDs.slice(0, 10).reverse();\n // console.log(top10OtuIDs);\n\n let top10OtuLabels = otuLabels.slice(0, 10).reverse();\n // console.log(top10OtuLabels);\n\n //Create horizontal bar graph\n trace = {\n x: top10SampleValues,\n y: top10OtuIDs.map(id => `OTU ${id}`),\n text: top10OtuLabels,\n type: \"bar\",\n orientation: \"h\"\n }\n\n let traceData = [trace]\n\n let layout = {\n title: \"Top 10 Microbial Species (OTUs)\",\n yaxis: { title: \"OTU ID\" },\n xaxis: { title: \"Sample Value\" },\n margin: {\n l: 100,\n r: 100,\n t: 100,\n b: 100\n }\n }\n\n Plotly.newPlot(\"bar\", traceData, layout);\n\n //Create bubble graph\n let trace2 = {\n x: otuIDs,\n y: sampleValues,\n text: otuLabels,\n mode: 'markers',\n marker: {\n color: otuIDs,\n size: sampleValues\n }\n };\n\n var trace2Data = [trace2];\n\n var layout2 = {\n showlegend: false,\n height: 600,\n width: 1200,\n xaxis: { title: \"OTU ID\" },\n yaxis: {title: \"Sample Value\"},\n title: \"Microbial Species Found per Sample\"\n };\n\n Plotly.newPlot('bubble', trace2Data, layout2);\n\n //Create default demographic info for ID: 940\n let filterMetadata = data.metadata[0]\n // console.log(filterMetadata);\n\n // Use `Object.entries` to add each key and value pair to the panel\n Object.entries(filterMetadata).forEach(([key, value]) => {\n // Log the key and value\n // console.log(`${key}: ${value}`);\n d3.select(\"#sample-metadata\")\n .append(\"p\")\n .text(`${key}:${value}`)\n })\n\n //Optional : Gauge Chart\n let wfreq = filterMetadata.wfreq\n console.log(wfreq)\n\n let gaugeData = [\n {\n domain: { x: [0, 1], y: [0, 1] },\n value: wfreq,\n title: { text: \"Belly Button Washing Frequency\" },\n type: \"indicator\",\n mode: \"gauge+number\",\n gauge: { \n axis: { range: [null, 9] }, \n steps: [\n {range: [0, 1], color: \"floralwhite\"},\n {range: [1, 2], color: \"antiquewhite\"},\n {range: [2, 3], color: \"beige\"},\n {range: [3, 4], color: \"bisque\"},\n {range: [4, 5], color: \"blanchedalmond\"},\n {range: [5, 6], color: \"cornsilk\"},\n {range: [6, 7], color: \"ivory\"},\n {range: [7, 8], color: \"lightgoldenrodyellow\"},\n {range: [8, 9], color: \"linen\"}\n ]\n }\n }\n ];\n\n \n \n let gaugeLayout = { width: 600, height: 500, margin: { t: 0, b: 0 } };\n Plotly.newPlot('gauge', gaugeData, gaugeLayout);\n\n }", "title": "" }, { "docid": "e00207282f51c4b3c504fb9dc065ef11", "score": "0.5480076", "text": "function Bubble(text, width, x, y, side, colour) {\n this.width = width;\n this.y = y;\n //either left or right\n this.side = side;\n this.x = x;\n this.colour = colour;\n\n //set css properties\n var css = { top: y + 'px', 'background-color': colour, 'color': '#FFFFFF' };\n css[side] = x + 'px';\n\n //create div element with - text set - css properties applied and - css class added\n this.$bubble = $('<div/>')\n .html(text)\n .css(css)\n .addClass('bubble');\n\n //prepend adds element as first child of body\n $('body').prepend(this.$bubble);\n }", "title": "" }, { "docid": "3e9373ec0b02162e06ba514540e1687a", "score": "0.54798436", "text": "constructor(x, y) {\n this.x = x;\n this.y = y;\n\n // Randomly set the hue value\n this.hue = random(30, 50);\n\n this.size = 0;\n // Randomly set max size\n this.maxSize = random(width / 5, width / 2);\n\n // Randomly set pulseSpeed, used to decide the speed of the size of the circle pulsing\n this.pulseSpeed = random(0.01, 0.05);\n\n // Initialize done to false\n this.done = false;\n // Start life at full\n this.life = 1;\n\n // Randomly set lifeSpeed, used to decide the speed of Bubble fading\n this.lifeSpeed = random(0.001, 0.005);\n }", "title": "" }, { "docid": "87ba3cbfb3997e8ce2fd0599e635533e", "score": "0.5453354", "text": "constructor(canvas) {\n // Logical variables\n super(canvas);\n this.mouseDownOnSlider = false;\n this.onClick = (x, y) => { this._onClick(x, y); };\n this.onMouseUp = (x, y) => { this._onMouseUp(x, y); };\n this.onMouseMove = (x, y) => { this._onMouseMove(x, y); };\n\n // Value of input.\n this.value = 0.5;\n\n // Slider bubble (container of slider).\n this.bubbleWidth = 500;\n this.bubbleHeight = 100;\n this.bubble = undefined;\n\n // Knob that is slid to change input value.\n this.knob = undefined;\n\n // Header information.\n this.headerFont = Fonts.DEFAULT_FONT;\n this.headerText = '';\n this.header = undefined;\n\n // Style of bubble outline stroke.\n this.strokeStyle = Colors.DEFAULT_LINE_SHINE;\n\n // Strike-through line that knob rests on.\n this.line = undefined;\n\n this._compose();\n }", "title": "" }, { "docid": "d7f6be5e83ed522951267e4f444a7ba1", "score": "0.5434909", "text": "function BarChart(){}", "title": "" }, { "docid": "04ae1a03a85614431c4a7bccb342ff21", "score": "0.5426673", "text": "function charts_init() {\n line_init();\n heatmap_init();\n map_init();\n}", "title": "" }, { "docid": "3727f124875406c28f9b08461a5ca368", "score": "0.54264665", "text": "init() {\n // this.svgElement = this.canvas.paper.el.childNodes[0];\n // this.setGrid(1)\n }", "title": "" }, { "docid": "1ec7a488bd3ce637521a988ac5774fb1", "score": "0.54159117", "text": "function bubbleChart(test) {\n var sampled = data.samples.filter(obj => obj.id == test)[0];\n \n var trace2 = {\n x : sampled.otu_ids,\n y : sampled.sample_values,\n text: sampled.otu_labels,\n mode: 'markers',\n marker: {\n color: sampled.otu_ids,\n size: sampled.sample_values,\n }\n };\n var bubbleT = [trace2];\n\n // Apply the layout\n var layout2 = {\n title: \"Test Subject Samples\",\n xaxis: {\n autorange: true,\n title: \"Operational Taxonomic Unit (OTU) ID\"\n },\n yaxis: {\n autorange: true,\n title: \"Sample Values\"\n }\n };\n \n// Render the plot to the id \"#bubble\" \n Plotly.newPlot('bubble',bubbleT,layout2);\n}", "title": "" }, { "docid": "642da9a6fa6a157fa2d0af75bf286a7e", "score": "0.54130983", "text": "_compose() {\n this.knobWidth = (this.bubbleWidth - this.bubbleHeight) * 0.9;\n this.knobMinX = this.x - this.knobWidth / 2;\n this.knobMaxX = this.x + this.knobWidth / 2;\n this.knobX = this.x + ((this.knobMaxX - this.x) * ((this.value - 0.5) * 2));\n this.mouseDownX = this.knobX;\n\n this.bubble =\n new MillionaireBubbleBuilder(this.canvas)\n .setPosition(this.x - this.bubbleWidth / 2, this.y)\n .setDimensions(this.bubbleWidth, this.bubbleHeight)\n .setStrokeStyle(this.strokeStyle)\n .build();\n\n this.line = new Path2D();\n this.knob = new Path2D();\n\n this.header =\n new TextElementBuilder(this.canvas)\n .setPosition(this.x, this.y - this.bubbleHeight * 1.2)\n .setTextAlign('center')\n .setFont(this.headerFont)\n .setText(this.headerText)\n .build();\n }", "title": "" }, { "docid": "4f74bfcc5e1d76700efd74571b233cc6", "score": "0.5409347", "text": "initConfig() {\n var margin = this.margin,\n id = this.id,\n width = this.width - margin.left - margin.right,\n height = this.height - margin.top - margin.bottom;\n\n this.container = d3.select(id);\n\n this.svg = d3.select(id)\n .append(\"svg\")\n .style('overflow', 'visible') // to overwrite overflow: hidden by Boostrap as default\n .attr(\"width\", width + margin.left + margin.right)\n .attr(\"height\", height + margin.top + margin.bottom);\n\n this.body = this.svg\n .append(\"g\")\n .attr('class', 'c9-chart c9-custom-container')\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n \n }", "title": "" }, { "docid": "48a5df092f7b735d5956d1e098c92801", "score": "0.53931683", "text": "function makeBubbleChart(){\n //Get unique varieties and occurances\n var winenames = []\n var favorites = []\n var tweets = []\n var favoriteRetweets = []\n var retweets = [];\n mayson.forEach(function(d) {\n winenames.push(d.Wine);\n tweets.push(d.TotalTweets);\n favorites.push(d.Favorited);\n favoriteRetweets.push(\"Favorited \"+d.Favorited+\" times. </br>Retweeted \"+d.Retweets+\" times.\");\n retweets.push(d.Retweets);\n });\n\n //... adding to chart\n var trace = {\n x: winenames,\n y: tweets,\n text: favoriteRetweets,\n mode: 'markers',\n marker: {\n size: favorites,\n sizemode: 'area',\n sizeref: 0.15,\n color: retweets,\n colorscale: [[0, 'rgb(25, 150, 25)'], [1, 'rgb(150, 25, 150)']]\n }\n };\n\n var data = [trace];\n\n // Put chart on page\n var layout = {\n title: 'Twitter Popularity',\n xaxis: {title: 'Wine Variety'},\n yaxis: {title: 'Number of Tweets'}\n };\n\n Plotly.newPlot('bubblechart', data, layout);\n}", "title": "" }, { "docid": "af9898f778a5eeeaa3a6001b2ab52a90", "score": "0.53907037", "text": "constructor(width, height, size) {\n this.width = width;\n this.height = height;\n this.size = size;\n\n // var tempBrick = new Brick(100, 200, 20);\n // var tempBrick2 = new Brick(200, 200, 20);\n // var tempBrick3= new Brick(300, 200, 20);\n\n this.brickMgr = new BrickManager();\n\n this.initData();\n }", "title": "" }, { "docid": "7e15946a6ab36adbf4f6c64826109464", "score": "0.5388777", "text": "constructor(el, data, options) {\n Graph.instances.push(this);\n this.options = options || {};\n this.id = Graph.lastUniqueId++;\n this.el = d3.select(el);\n this.data = data || [];\n this.autosize = false;\n this.activeTips = [];\n Graph.installResizeListener();\n }", "title": "" }, { "docid": "b3363769c53bd9472211a6953445e270", "score": "0.5385507", "text": "function init() {\n DiagramComponent.init();\n }", "title": "" }, { "docid": "7490e9dd10e3d1199c843e0c42808723", "score": "0.5377588", "text": "function initializeData(){\n \"use strict\";\n chartData = {\n labels: [],\n datasets: [{\n data:[],\n backgroundColor: []\n\n }]\n };\n}", "title": "" }, { "docid": "4dd8229b844c487a7c544129be689fb9", "score": "0.53701663", "text": "initialize() {\n const size = 48;\n const bitmap = new Bitmap(size, size);\n bitmap.drawCircle(size / 2, size / 2, size / 2, '#FF00FF');\n super.initialize();\n this.bitmap = bitmap;\n this.anchor.x = 0.5;\n this.anchor.y = 1;\n }", "title": "" }, { "docid": "b16dfdc62579475302ad4cdc02b3d2c1", "score": "0.5369299", "text": "function bubbleChart(sampleID) {\n d3.json('samples.json').then(data => {\n var metadata = data.metadata;\n var names = data.names;\n var samples = data.samples;\n\n var resultArray = samples.filter(sampleObj => sampleObj.id == sampleID);\n var result = resultArray[0];\n\n let smplBubble = result.sample_values;\n var idsBubble = result.otu_ids;\n var lblsBubble = result.otu_labels;\n\n var bubble = [\n {\n x: idsBubble,\n y: smplBubble,\n text: lblsBubble,\n mode: `markers`,\n marker: {\n size: smplBubble, \n color: idsBubble\n }\n }\n ];\n \n var layout = {\n xaxis: {title: \"OTU ID\"}, \n margin: { t: 0 },\n hovermode: \"closest\",\n margin: { t: 30},\n width: 1000,\n showlegend: false,\n title: \"Belly Button Bacteria\"\n };\n Plotly.newPlot('bubble', bubble, layout);\n\n}).catch(error => console.log(error));\n}", "title": "" }, { "docid": "547772d08c7348f26fb9ac06ff064ac7", "score": "0.536378", "text": "function main(){\r\n setup();\r\n\r\n population = new Population();\r\n population.particles[0].circle.material.color.setHex(0x72b886); //set one particle light green\r\n graph = new BarGraph(bins, [0,0.7], [0.2,1]);\r\n\r\n animate();\r\n}", "title": "" }, { "docid": "ee1e74e3e3ada960342776b0453a5d2b", "score": "0.5356049", "text": "function createBubble(id) {\n \n d3.json('data/samples.json').then(data => {\n var selected = data.samples.filter(sample => sample.id == id)[0];\n\n var sampleValues = selected.sample_values; // y values, marker size\n var otuIds = selected.otu_ids; // x values, marker colors \n var labels = selected.otu_labels; // text values\n\n // Test\n // console.log(sampleValues, otuIds, labels);\n\n var trace1 = {\n x: otuIds,\n y: sampleValues,\n text: labels,\n mode: 'markers',\n marker: {\n size: sampleValues,\n color: otuIds\n }\n };\n\n var data = [trace1];\n\n var layout = {\n title : `OTUs Found in Test Subject ID No.${id}`, \n xaxis: { title: \"OTU ID\" },\n yaxis: { title: \"Value\" }\n };\n\n Plotly.newPlot(\"bubble\", data, layout);\n\n });\n}", "title": "" }, { "docid": "7f2c7085ddc27411a0a1500bfe54206a", "score": "0.5354875", "text": "initialize() {\n // Let's give every instance its own color!\n this.color = [Math.random(), Math.random(), Math.random()];\n }", "title": "" }, { "docid": "78471bbd1cc0dc6a64825980b99e8bab", "score": "0.53509396", "text": "constructor(elem, graph) {\n super();\n this.elem = elem;\n this.graph = graph;\n this.dim = [100, 100];\n this.attrs = {\n x: new Attribute(),\n y: new Attribute(),\n size: new Attribute('sqrt')\n };\n this.bounds = new Rect(0, 0, 0, 0);\n this.items = [];\n this.color = null;\n this.colorRange = null;\n this.xaxis = d3.svg.axis().orient('bottom');\n this.yaxis = d3.svg.axis().orient('left');\n this.timelinescale = d3.scale.linear();\n this.timelineaxis = d3.svg.axis().orient('bottom').scale(this.timelinescale).tickFormat(d3.format('d'));\n //private popRadial = d3.svg.line.radial();\n this.initedListener = false;\n this.timeIds = null;\n this.showUseTrails = false;\n this.interactive = true;\n this.totooltip = ToolTip.bind(this.createTooltip.bind(this), 0);\n this.$node = d3.select(elem).datum(this);\n this.ref = graph.findOrAddObject(this, 'GapMinder', 'visual');\n this.noneRef = graph.findOrAddObject('', 'None', 'data');\n this.init(this.$node);\n }", "title": "" }, { "docid": "2ee4f299855fd7b061e4e63c03169127", "score": "0.5339328", "text": "constructor() {\n super();\n // initialization\n this.endLabel = new objects.Label();\n this._background = new objects.Background();\n this._backButton = new objects.Button();\n this._scoreBoard = new managers.ScoreBoard;\n this.Start();\n }", "title": "" }, { "docid": "6cb0c9410b36f54452215798d24d6c2f", "score": "0.5338605", "text": "function setup() {\n\tcreateCanvas(600, 500);\n\tgraph = new Graph();\n\tlabels = new Labels();\n\toptions = new Options();\n\tInit();\n}", "title": "" }, { "docid": "2dfcc39f9bad702d52857665c65e821e", "score": "0.5333506", "text": "wakeUp() {\n\n // Initialize all the SVG and canvas components\n this.initSvg();\n\n // Draw the scatterplot\n this.draw();\n }", "title": "" }, { "docid": "63a5186a24b988475cb30312df0af634", "score": "0.5330159", "text": "function setupGraph(){\n\tcurrGraph = new Graph(true,false,\"Untitled graph\",-1);\n}", "title": "" }, { "docid": "f611ac1ce4caadcda5aa9b33ccb39394", "score": "0.53268176", "text": "async initChart(){\n google.charts.load('current', { packages: ['corechart', 'bar'] });\n await google.charts.setOnLoadCallback(() => {\n const chartElement = new google.visualization.BarChart(this.refs.chart);\n this.chart = new Chart(chartElement);\n });\n }", "title": "" }, { "docid": "ce7c7a028f7a8119751a3f1c8c563d93", "score": "0.5321735", "text": "function initData() {\n\t\tif (g != null) {\n\t\t\tModel.removeChangeListener(g.change);\n\t\t\tg.kill();\n\t\t}\n\t\tdata = [\n\t\t\t{\n\t\t\t\tkey: getVarName(Model.comparison.var1),\n\t\t\t\tvalues: []\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tkey: getVarName(Model.comparison.var2),\n\t\t\t\tvalues: []\n\t\t\t}\n\t\t]\n\n\t\tvar dat = Model.constituenciesArray.slice(0);\n\t\tdat = sortConst(dat);\n\t\tvar j = 0;\n\t\tfor (var i=0; i<dat.length; i++) {\n\t\t\tif (dat[i].selected) {\n\t\t\t\tdata[0].values[j] = {x: dat[i].name, y:dat[i].x, d:dat[i]};\n\t\t\t\tdata[1].values[j++] = {x: dat[i].name, y:dat[i].y, d:dat[i]};\n\t\t\t}\n\t\t}\n\n\t\tvar div = document.getElementById(\"barCont\");\n\t\twhile (div.firstChild) {\n\t\t\tdiv.removeChild(div.firstChild);\n\t\t}\n\t\tg = new drawGraph(data, t);\n\t}", "title": "" }, { "docid": "1bb1e3ce6452ae3ec176ede224e87518", "score": "0.5318804", "text": "function init() {\n data = [{\n x: [1, 2, 3, 4, 5],\n y: [0, 0, 0, 0, 0] }];\n var LINE = document.getElementById(\"plot\");\n Plotly.plot(LINE, data);\n}", "title": "" }, { "docid": "28782e6e42ad8a2b5752fb26ee9f07ed", "score": "0.53182155", "text": "function buildBubble () {\n d3.json(\"samples.json\").then(function(data) {\n\n // Get X Values, same method as previously mentioned function.\n\n var userSelection = idSelect.property(\"value\");\n\n var selectionIndex = parseInt(userSelection);\n\n var sampleSelection = data.samples[selectionIndex];\n\n var sampleValues = Object.values(sampleSelection);\n\n var xValues = sampleValues[1];\n\n // Get Y Values\n\n var yValues = sampleValues[2];\n\n // Get Marker Size Values\n\n var markerSize = sampleValues[2];\n\n // Get Values for Marker Colors\n\n var colorValues = sampleValues[1];\n\n // Get Text Values\n\n var textValues = sampleValues[3];\n\n // Plot bubble chart\n var trace = {\n x: xValues,\n y: yValues,\n text: textValues,\n mode: \"markers\",\n marker: {\n size: markerSize,\n color: colorValues,\n colorscale: \"Earth\"\n }\n };\n\n var data = [trace];\n\n var layout = {\n title: \"OTUs per Sample\",\n margin: {t:0},\n hovermode: \"closest\",\n xaxis: {title: \"OTU ID\"},\n margin: {t:30}\n };\n\n Plotly.newPlot(\"bubble\", data, layout);\n });\n\n}", "title": "" }, { "docid": "37262bbb86aa1933282a6c02552f107b", "score": "0.5314716", "text": "function BuildBubbleChart(data, variableID){\n\n// Extract the needed data from the data(JSON), and save it as a variables\n var samples = data.samples; \n var dataId = samples.filter(sample =>sample.id == variableID);\n var Ids = dataId[0].otu_ids;\n var sample_value = dataId[0].sample_values;\n var sample_labels = dataId[0].otu_labels;\n \n// Create the trace, layout and the plot\nvar trace1 = {\n x: Ids,\n y: sample_value,\n text: sample_labels,\n mode: 'markers',\n marker: {\n color: Ids,\n size: sample_value\n }\n};\n\nvar data = [trace1];\n\nvar layout = {\n title: 'Bubble chart for each sample',\n showlegend: false,\n height: 500,\n width: 1000,\n xaxis: {\n visible: true,\n title: {\n text: \"OTU ID\"}\n }\n};\n\nPlotly.newPlot(\"bubble\", data, layout);\n\n}", "title": "" }, { "docid": "8d857ed52d654d1dfb98acb26e87104d", "score": "0.53137004", "text": "function init(_event) {\r\n let canvas;\r\n canvas = document.getElementsByTagName(\"canvas\")[0]; //das erste von der Liste von elements \r\n Bricks2.crc2 = canvas.getContext(\"2d\");\r\n Bricks2.crc2.fillRect(0, 0, canvas.width, canvas.height);\r\n Bricks2.bar = new Bricks2.Bar(canvas.width / 2 - 50, canvas.height - 40); // (canvas.width-this.width)/2 !?\r\n Bricks2.ball = new Bricks2.Ball();\r\n createBrickField();\r\n drawStartScreen();\r\n //Eventlisteners\r\n document.addEventListener(\"keydown\", handleKeyPress, false);\r\n document.addEventListener(\"keyup\", handleKeyRelease, false);\r\n canvas.addEventListener(\"click\", handleMouseClick, false);\r\n document.addEventListener(\"mousemove\", handleMouseMove, false);\r\n canvas.addEventListener(\"touchstart\", handleTouchStart, false);\r\n canvas.addEventListener(\"touchmove\", handleTouchMove, false);\r\n // window.addEventListener(\"resize\", resizeCanvas, false); \r\n } //init", "title": "" }, { "docid": "dd3df3cc9cea8d20090642f5077a4a96", "score": "0.53125703", "text": "function plotCreation(id) {\n d3.json(SampleData).then(function (data) {\n // Variables for Bubble Chart\n var filteredObject = data.samples.filter(subject => subject.id == id)[0]\n var sampleValue = filteredObject.sample_values;\n var otuID = filteredObject.otu_ids;\n var otuLabel = filteredObject.otu_labels;\n // console.log(filteredObject[0].sample_values)\n // console.log(sampleValue)\n // console.log(filteredObject)\n \n // Variables for Bar Chart\n var sampleValueTop = sampleValue.slice(0, 10).reverse();\n var otuIDTop = (otuID.slice(0, 10)).reverse();\n var otuLabelTop = otuLabel.slice(0, 10).reverse();\n // console.log(sampleValueTop)\n\n\n // Building the Bar Chart\n var idTopMap = otuIDTop.map(function (element) {\n return \"OTU \" + element\n });\n\n var barTrace = [{\n x: sampleValueTop,\n y: idTopMap,\n type: \"bar\",\n text: otuLabelTop,\n marker: {\n color: 'blue'\n },\n orientation: \"h\",\n }];\n\n var barLayout = {\n title: \"Top 10 OTU for ID\",\n yaxis: {\n tickmode: \"linear\",\n },\n };\n\n Plotly.newPlot(\"bar\", barTrace, barLayout);\n\n\n // Building the Bubble Chart\n var bubbleTrace = [{\n x: otuID,\n y: sampleValue,\n mode: \"markers\",\n marker: {\n color: otuID,\n size: sampleValue\n },\n text: otuLabel\n }];\n\n var bubbleLayout = {\n xaxis: { title: \"OTU ID\" },\n height: 500,\n width: 1080\n };\n\n Plotly.newPlot(\"bubble\", bubbleTrace, bubbleLayout); \n\n });\n}", "title": "" }, { "docid": "2e6071ab96ffd81812a2cfb4f731965e", "score": "0.5311179", "text": "_setupChart()\n {\n this._createSvgCanvas();\n }", "title": "" }, { "docid": "62cfe7aa0f2e9ac8bda134f7e02e47b2", "score": "0.5290788", "text": "InitWith(bc) {\n const cnv = document.getElementById('cnv');\n cnv.width = window.innerWidth * 0.94;\n cnv.height = window.innerWidth * 0.94;\n cnv.style.backgroundColor = this.bgColor;\n\n const pad = cnv.width / (bc.numOfBars * bc.numOfBars);\n const dx = cnv.width / bc.numOfBars - pad;\n let posX = pad;\n\n for (let i = 0; i < bc.numOfBars; i++) {\n let height = Math.random() * cnv.height * 0.9 + cnv.height * 0.05;\n bc.Insert(\n new Bar(posX, cnv.height - height, dx, height, bc.neutralColor)\n );\n posX += dx + pad;\n }\n this.Draw(bc);\n }", "title": "" }, { "docid": "7816a58972c8dfbb9ffe3b6794255670", "score": "0.52877975", "text": "function init() {\n\t//initialize variables\n\ttopics = ['cat','dog','horse','fish','bird','snake','cow','shark','parrot','ostrich'];\n\tgenerateButtons(topics);\n}", "title": "" }, { "docid": "059e933120c173d7249aae03a58644a8", "score": "0.5285949", "text": "function init() {\n \tcanvas = d.querySelector('canvas');\n \tctx = canvas.getContext('2d');\n\t w = canvas.width;\n\t h = canvas.height;\n\t setUpColors();\n\t eventListeners();\n\t}", "title": "" }, { "docid": "8486bbf1c284cd676b35c2a573df1019", "score": "0.52731097", "text": "constructor(props){\n // this.model = new TwoDotsModel();\n // this.view = new TwoDotsView();\n super(props);\n this.points = 0;\n this.moveCount = 5;\n }", "title": "" }, { "docid": "cc47a898164d15221c35a3e5588ebb61", "score": "0.52671146", "text": "constructor(p, x, y, k){\r\n\t\tsuper(\"seed\", x, y, \"Dibber\");\r\n\t\tthis.plot = p;\r\n\t\tthis.kind = k\r\n\t}", "title": "" }, { "docid": "d91e4ca5c2e1c2550ee139f7cc30cf0f", "score": "0.5266281", "text": "function initializeData() {\n\n\t__.data = __.model.addDimension(__.dimKey).binDimension(__.dimKey, 0.001);\n\n\t__.xScale = d3.scale.linear()\n .domain([0, 1])\n .range([0, plotWidth()]);\n\n\t__.yScale = d3.scale.linear()\n .domain([0, d3.max(__.data, function(d) { return d.y; })])\n .range([plotHeight(), 0]);\n}", "title": "" }, { "docid": "2e4142e8f2f50f61942424fdd8a4beab", "score": "0.5254692", "text": "function addBubbleChartBubbles(bubbleChartBubbles) {\n\n //move all the bubbles up by 100 to center them more\n for (var b in bubbleChartBubbles.features) {\n bubbleChartBubbles.features[b].geometry.coordinates[1] = bubbleChartBubbles.features[b].geometry.coordinates[1] - 100;\n }\n\n bubbleChartG.selectAll(\"circle\")\n .data(bubbleChartBubbles.features, function (d) {\n return d;\n }).enter().append(\"circle\")\n .attr('r', function (d) {\n return radius(d.properties.speakers) * 2 //make the radius of the bubbles the log of # of speakers *2\n })\n .attr('cx', function (d) {\n return d.geometry.coordinates[0] //don't project bubble chart circles\n })\n .attr('cy', function (d) {\n return d.geometry.coordinates[1] //don't project bubble chart circles\n })\n .attr('stroke', function (d) {\n return d.properties.color //color each bubble chart bubble\n })\n //.attr('stroke-width', 0.2)\n .attr('fill', '#323232ff') //set fill color same as background to it looks empty\n .attr(\"class\", \"bubbleChartBubbles\") //set class to bubbleChartBubbles\n .attr(\"id\", function (d) {\n return \"bubbleChart-\" + d.properties.ID // set id to wals_code\n })\n\n}", "title": "" }, { "docid": "3a9f0f32db28a72df5a204792dfff6c5", "score": "0.52535284", "text": "function createStateLevelBubblePlot(data, state, impact) {\n\n // Sort by year\n var data = data.sort((a, b) => b[\"Year\"] - a[\"Year\"]);\n\n var yearArray = data.map(row => row[\"Year\"]);\n var impactArray = data.map(row => row[impact]);\n var obesityArray = data.map(row => row[\"% Adults with Obesity\"]);\n var diabetesArray = data.map(row => row[\"% Adults with Diabetes\"]);\n\n if (impact == \"Median Household Income\") {\n impactArray = impactArray.map(impactVal => impactVal / 1000)\n var impact = impact + \" (in Thousands)\"\n };\n\n opacity = yearArray.map(id => 0.95);\n\n // State Level Bubble Plot: \n var impactTrace = {\n x: yearArray,\n y: impactArray,\n text: impact,\n name: impact,\n mode: 'markers',\n marker: {\n color: yearArray,\n colorscale: 'Rainbow',\n opacity: opacity,\n size: impactArray\n }\n };\n\n var obesityTrace = {\n x: yearArray,\n y: obesityArray,\n text: `Obesity %`,\n name: '% Adults with Obesity',\n mode: 'markers',\n marker: {\n color: yearArray,\n colorscale: \"Rainbow\",\n opacity: opacity,\n size: obesityArray\n }\n };\n\n var diabetesTrace = {\n x: yearArray,\n y: diabetesArray,\n text: `Diabetes %`,\n name: '% Adults with Diabetes',\n mode: 'markers',\n marker: {\n color: yearArray,\n colorscale: \"Rainbow\",\n opacity: opacity,\n size: diabetesArray\n }\n };\n\n // Create the data arrays for the plot\n var dataStateLevelPlot = [impactTrace, obesityTrace, diabetesTrace];\n\n // Define the plot layout\n var layoutStateLevelPlot = {\n title: `${impact} vs Disease Prevalence - ${state}`,\n\n // Adding ticks on the axis\n xaxis: {\n showgrid: true,\n showline: true,\n linecolor: 'rgb(200, 0, 0)',\n ticks: 'inside',\n tickcolor: 'rgb(200, 0, 0)',\n tickwidth: 1\n },\n\n yaxis: {\n showgrid: true,\n showline: true,\n linecolor: 'rgb(200, 0, 0)',\n ticks: 'inside',\n tickcolor: 'rgb(200, 0, 0)',\n tickwidth: 1\n },\n\n paper_bgcolor: 'RGB(219, 233, 235)',\n plot_bgcolor: 'RGB(219, 233, 235)'\n };\n\n // Plot the \"bubble\" plot\n Plotly.newPlot('stateLevelPlot', dataStateLevelPlot, layoutStateLevelPlot);\n\n}", "title": "" }, { "docid": "888dee737040ce3d3724ca75b9c3dd0a", "score": "0.5251625", "text": "function Plot() {\n this.dataseries = [];\n this.container = \"\";\n\n if ('plot' in $) {\n this.plotapi = new PlotApi();\n } else {\n this.plotapi = undefined;\n }\n}", "title": "" }, { "docid": "9c7d484f245073b69c9efd2debcdd345", "score": "0.52494514", "text": "constructor(){\n this.length =70;\n this.width =10;\n this.y =0;\n this.x =0;\n this.color=\"white\";\n this.border=\"red\";\n }", "title": "" }, { "docid": "03c386befcc0ca43d09f9abadd26ae7b", "score": "0.52440894", "text": "constructor(x, y) {\n this.x = x;\n this.y = y;\n this.height = 20;\n this.width = 20;\n this.displayed = true;\n }", "title": "" }, { "docid": "496837a7e05c9bc143ce2c9d67a43140", "score": "0.52381533", "text": "makeActiveBubble(){\n this.bubble = new Bubble({game: this.game,\n x :this.ship.body.x,\n y: this.ship.body.y,\n asset:'bluebubble',\n rightBound: this.rightBound,\n leftBound: this.leftBound,\n ship:this.ship});\n this.game.add.existing(this.bubble);\n }", "title": "" } ]
1795783fb83550b881e1a7f0209fe9bf
// Write a function where() that filters for all the values // in the properties object.
[ { "docid": "d6b9bdc0f30d66516d7c774259a71020", "score": "0.7354923", "text": "function where(list, properties) {\n // YOUR CODE HERE\n return list.filter(function(value){\n var itemsPassed = true;\n for (key in properties) {\n if (properties.hasOwnProperty(key)) {\n if (value[key] !== properties[key]) {\n itemsPassed = false;\n };\n };\n };\n return itemsPassed;\n });\n}", "title": "" } ]
[ { "docid": "ca905006e1424abf67799cea9d91360c", "score": "0.63329506", "text": "filter(prop, criteria) {\n return this[prop].filter((item) => {\n let criteriaPass = false;\n Object.keys(criteria).forEach((k) => {\n const v = criteria[k];\n let regexp = new RegExp(`${v}`, \"i\");\n criteriaPass = regexp.test(item[k]);\n });\n return criteriaPass;\n });\n }", "title": "" }, { "docid": "9b6f87b5e7789b8d204b86e37b2ba292", "score": "0.6060955", "text": "function CfnAnalyzer_FilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('contains', cdk.listValidator(cdk.validateString))(properties.contains));\n errors.collect(cdk.propertyValidator('eq', cdk.listValidator(cdk.validateString))(properties.eq));\n errors.collect(cdk.propertyValidator('exists', cdk.validateBoolean)(properties.exists));\n errors.collect(cdk.propertyValidator('neq', cdk.listValidator(cdk.validateString))(properties.neq));\n errors.collect(cdk.propertyValidator('property', cdk.requiredValidator)(properties.property));\n errors.collect(cdk.propertyValidator('property', cdk.validateString)(properties.property));\n return errors.wrap('supplied properties not correct for \"FilterProperty\"');\n}", "title": "" }, { "docid": "973f30c25c18ae779d5aae5970b2fa78", "score": "0.584725", "text": "function filterData(row, property){\n return row[property] != \"\" && row[property] != undefined\n}", "title": "" }, { "docid": "8ee1db1dce319f3d1ce8836e3123ceb8", "score": "0.5831328", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n }", "title": "" }, { "docid": "8ee1db1dce319f3d1ce8836e3123ceb8", "score": "0.5831328", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n }", "title": "" }, { "docid": "8ee1db1dce319f3d1ce8836e3123ceb8", "score": "0.5831328", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n }", "title": "" }, { "docid": "8ee1db1dce319f3d1ce8836e3123ceb8", "score": "0.5831328", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n }", "title": "" }, { "docid": "5d8df50e4cab9ffe4014697543b240f5", "score": "0.5787131", "text": "where(...args) {\n return this.build(coll => args.reduce((acc, elem) => {\n if (typeof elem === 'function') {\n return acc.filter(elem);\n } \n return acc.filter( coll => \n Object.keys(elem).every( key => elem[key] === coll[key])\n );\n }, coll));\n }", "title": "" }, { "docid": "21d2053f26e114866523bc1e43991b24", "score": "0.5761344", "text": "function filter(collection)\n{\n\t\treturn collection.where(\n\t\t\n\t\t{\n\t\t\tmake: \"Honda\"\n\t\t}\n\t);\n}", "title": "" }, { "docid": "4a2725c346346a424013ef548261a5a0", "score": "0.56862015", "text": "function PropertyFilter (property, operator, value) {\n this.property = property;\n this.operator = operator.toLowerCase();\n this.value = value;\n }", "title": "" }, { "docid": "4a2725c346346a424013ef548261a5a0", "score": "0.56862015", "text": "function PropertyFilter (property, operator, value) {\n this.property = property;\n this.operator = operator.toLowerCase();\n this.value = value;\n }", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "2c02dfae1aa5719ac8478d68c4aa0f74", "score": "0.5670834", "text": "function where(obj, attrs) {\n return filter(obj, matcher(attrs));\n}", "title": "" }, { "docid": "f8e1e419bfb98b2629b5f8926d581a0e", "score": "0.56256485", "text": "function te(e,t){if(null==e.$where)return;const n=Object.keys(e.$where),r=n.length;for(let o=0;o<r;++o)t[n[o]]=e.$where[n[o]]}", "title": "" }, { "docid": "2c5f0b9db8d80ec847896485a4abefdb", "score": "0.562564", "text": "function get_where( json ){\n\t\tvar where = [];\n\t\tfor ( var i=0; i<json.where.length; i++ ){\n\t\t\t\n\t\t\tvar tri = json.where[i];\n\t\t\tif ( tri == null ) continue;\n\t\t\t\n\t\t\t\n\t\t\t// Get options\n\t\t\t\n\t\t\tvar opt = {};\n\t\t\tvar last = tri[tri.length-1];\n\t\t\tif ( last instanceof Object ){\n\t\t\t\topt = last;\n\t\t\t}\n\t\t\t\n\t\t\t// Create optional clauses\n\t\t\t\n\t\t\tif ( \"optional\" in opt ){\n\t\t\t\tif ( Array.isArray( tri[0] ) ){\n\t\t\t\t\tvar sub = [];\n\t\t\t\t\tfor ( var j=0; j<tri.length-1; j++ ){\n\t\t\t\t\t\tsub.push( line( tri[j] ) );\n\t\t\t\t\t}\n\t\t\t\t\twhere.push( \"OPTIONAL { \" );\n\t\t\t\t\twhere = where.concat( sub );\n\t\t\t\t\twhere.push( \"}\" );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twhere.push( \"OPTIONAL { \"+ line( tri ) +\" }\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\twhere.push( line( tri ) );\n\t\t\t}\n\t\t\t\n\t\t\t// Build a filter\n\t\t\t\n\t\t\tif ( \"filter\" in opt ){\n\t\t\t\twhere.push( \"FILTER ( \"+ opt.filter +\" )\" );\n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn where;\n\t}", "title": "" }, { "docid": "612069981fba8e0538cac4f1ae026fc6", "score": "0.5622069", "text": "function listProperties(pre,x,filter,nofunctions) { // {{{\r\n message('// ----start---- listing attributes for '+pre);\r\n if (x.attributes)\r\n for (var i=0; i<x.attributes.length; i++)\r\n message(x.attributes.item(i).nodeName+'=\"'+x.attributes.item(i).nodeValue+'\"');\r\n message('// ------------- listing properties for '+pre);\r\n for (var key in x) {\r\n p = x[key];\r\n if (p!==null && p!=='' \r\n && (filter==null || key.match(filter))\r\n && (!nofunctions || (typeof p!==\"function\"))) {\r\n message(pre+'.'+key+\"(\"+typeof p+\") : \"+p);\r\n }\r\n }\r\n message('// ----end------ listing properties for '+pre);\r\n}", "title": "" }, { "docid": "17b6663c91d73500464077e6c231b515", "score": "0.5621616", "text": "async where(prop, value, options = {}) {\n // const c = this.table.orderBy(options.orderBy || \"lastUpdated\");\n const [op, val] = Array.isArray(value) && [\"=\", \">\", \"<\"].includes(value[0])\n ? value\n : [\"=\", value];\n let query = op === \"=\"\n ? this.table.where(prop).equals(val)\n : op === \">\"\n ? this.table.where(prop).above(val)\n : this.table.where(prop).below(val);\n if (options.limit) {\n query = query.limit(options.limit);\n }\n if (options.offset) {\n query = query.offset(options.offset);\n }\n return query.toArray().catch(e => {\n throw new errors_1.DexieError(`list.where(${prop}, ${value}, ${JSON.stringify(options)}) failed to execute: ${e.message}`, `dexie/${e.code || e.name || \"list.where\"}`);\n });\n }", "title": "" }, { "docid": "1ce74b000703264e5d822302af64d40f", "score": "0.5615935", "text": "function cfnAnalyzerFilterPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAnalyzer_FilterPropertyValidator(properties).assertSuccess();\n return {\n Contains: cdk.listMapper(cdk.stringToCloudFormation)(properties.contains),\n Eq: cdk.listMapper(cdk.stringToCloudFormation)(properties.eq),\n Exists: cdk.booleanToCloudFormation(properties.exists),\n Neq: cdk.listMapper(cdk.stringToCloudFormation)(properties.neq),\n Property: cdk.stringToCloudFormation(properties.property),\n };\n}", "title": "" }, { "docid": "803be4b74b432345424d12e8abbb7797", "score": "0.56065154", "text": "function te(e,t){if(null==e.$where)return;const n=Object.keys(e.$where),i=n.length;for(let o=0;o<i;++o)t[n[o]]=e.$where[n[o]]}", "title": "" }, { "docid": "aa030c97b13ed26aa82680e167bf0dd8", "score": "0.55618244", "text": "function filter(collection) {\n\treturn collection.where({\n\t\tmake : 'Honda'\n\t});\n}", "title": "" }, { "docid": "4f5235ac399c1425b9665b32656228a1", "score": "0.5542204", "text": "function getRecordsByPropertyFilter(propArgs) {\n let foundRecords = [];\n let transformerObject = {};\n // check if it exists as an argument at all\n if (propArgs) {\n // check if it is an array\n if (Array.isArray(propArgs)) {\n dataset.forEach((r, i) => {\n Object.keys(r).forEach(key => {\n if (propArgs[i] === key) transformerObject[key] = r[key];\n });\n foundRecords.push(transformerObject);\n });\n\n return foundRecords;\n // just use a string passed in as argument\n } else {\n dataset.forEach(r => {\n foundRecords.push({ [propArgs]: r[propArgs] });\n });\n return foundRecords;\n }\n } else {\n return {\n error: \"no arguments supplied. Please provide one or more properties.\"\n };\n }\n }", "title": "" }, { "docid": "3c32bd9e1fc22e54b9a484922f2f55eb", "score": "0.55341136", "text": "function item_filter(property_id, items){\n for(var i=0; i<items.length; i++){\n for(var key=0; key<=properties.length; key++){\n if(key!=property_id && key!=1){\n delete items[i][properties[key]];\n }\n }\n }\n return items;\n}", "title": "" }, { "docid": "3c32bd9e1fc22e54b9a484922f2f55eb", "score": "0.55341136", "text": "function item_filter(property_id, items){\n for(var i=0; i<items.length; i++){\n for(var key=0; key<=properties.length; key++){\n if(key!=property_id && key!=1){\n delete items[i][properties[key]];\n }\n }\n }\n return items;\n}", "title": "" }, { "docid": "41c04f13401cc48ae0b3c29c5bb870ab", "score": "0.5530619", "text": "function J(e,t){if(null==e.$where)return;const n=Object.keys(e.$where),o=n.length;for(let r=0;r<o;++r)t[n[r]]=e.$where[n[r]]}", "title": "" }, { "docid": "23e1c94382b2074a51db230a4f7f0898", "score": "0.549743", "text": "function CfnDataCellsFilter_ColumnWildcardPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('excludedColumnNames', cdk.listValidator(cdk.validateString))(properties.excludedColumnNames));\n return errors.wrap('supplied properties not correct for \"ColumnWildcardProperty\"');\n}", "title": "" }, { "docid": "dbc702988889fb2f75f03c287b26a0b2", "score": "0.54890954", "text": "function filterBy(array, prop) {\n if (!array || !prop) {\n if(DEBUG) $log.error('filterBy: missing array or property');\n return;\n }\n return $filter('filter')(array, function (item) {\n return item[prop];\n });\n }", "title": "" }, { "docid": "780bbdc15454742baf6ddfb41d8cddb8", "score": "0.5427117", "text": "function filter(collection, properties, query) {\n // Spliting the query and joining it with the\n // oiginal query creates a fuzzy search, returning\n // both the full string match and the individual tokesn\n query = _.union([query],query.split(' '));\n collection = _.filter(collection, (predicate) => {\n var match = false,\n matchProps = (properties !== null) ?\n properties :\n Object.keys(predicate)\n\n query.forEach(term => {\n matchProps.forEach(key => {\n if (predicate[key].toString().toLowerCase().indexOf(term.toLowerCase()) !== -1) {\n predicate.relevance = term.length;\n match = true;\n }\n });\n })\n\n return match;\n\n }, query)\n\n return collection;\n }", "title": "" }, { "docid": "d85804be9441bdeecb6b4a3f0a054a72", "score": "0.5419317", "text": "function ee(e,t){if(null==e.$where)return;const n=Object.keys(e.$where),r=n.length;for(let i=0;i<r;++i)t[n[i]]=e.$where[n[i]]}", "title": "" }, { "docid": "bda88a810f8990be06e311e94ae848c6", "score": "0.53733265", "text": "function CfnDataCellsFilter_RowFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('allRowsWildcard', cdk.validateObject)(properties.allRowsWildcard));\n errors.collect(cdk.propertyValidator('filterExpression', cdk.validateString)(properties.filterExpression));\n return errors.wrap('supplied properties not correct for \"RowFilterProperty\"');\n}", "title": "" }, { "docid": "a44f330633e3fa7b9fe24a1bc5a66a09", "score": "0.53623563", "text": "function cfnDataCellsFilterColumnWildcardPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDataCellsFilter_ColumnWildcardPropertyValidator(properties).assertSuccess();\n return {\n ExcludedColumnNames: cdk.listMapper(cdk.stringToCloudFormation)(properties.excludedColumnNames),\n };\n}", "title": "" }, { "docid": "4d578bc55320946edadfa9eff2a91817", "score": "0.5343081", "text": "where(obj)\n {\n let idsWhere = this.getIdsWhere(obj);\n let results = [];\n\n for (let id of idsWhere)\n {\n results.push(this.values[id]);\n }\n\n return results;\n }", "title": "" }, { "docid": "893ce468ef99a17e0bbfb7a240ab4447", "score": "0.53361225", "text": "function metaschema_lookup(property){\n property=property.toLowerCase();\n property=property.replace(/\\W(is|was|are|will be|has been)\\W/,' ')\n property=property.replace(/ /g,' ');\n property=property.replace(/_/g,' ');\n property=property.replace(/^\\s+|\\s+$/, '');\n var candidate_properties=data.metaschema.filter(function(v){\n v.aliases=v.aliases||[]\n return v.id==property || v.name.toLowerCase()==property || fns.isin(property, v.aliases) || v.search_filter_operand.replace(/_/g,' ')==property\n })[0]\n candidate_properties=candidate_properties||{}\n return candidate_properties.search_filter_operand;\n}", "title": "" }, { "docid": "fc0136c0e2dab4d3e5694a9cd6ea634c", "score": "0.5317775", "text": "function quickQuery(objectName, properties, ) {\n let queryArr = [];\n Object.keys(properties).forEach(key => {\n queryArr.push(`${objectName}.\\`${key}\\` = \"${properties[key]}\"`);\n });\n if (addBrackets) {\n return `{ ${queryArr.join(', ')} }`\n } else {\n return queryArr.join(', ');\n }\n}", "title": "" }, { "docid": "6c7e29b616e29ddba44712072b1b9cb4", "score": "0.53167564", "text": "static where() {\n return true; // Default where clause filter that returns true to access all records\n }", "title": "" }, { "docid": "ce909abc8d9bbdb04d84af75a8b58ff3", "score": "0.5296503", "text": "filterQuery() {\n let values = this.get('filters');\n let filters = {};\n\n for(var key in values) {\n if(values.hasOwnProperty(key) && key !== \"toString\") {\n filters[underscore(key)] = values.get(key);\n }\n }\n\n return filters;\n }", "title": "" }, { "docid": "9df8170412a5dd408143a255bbbba62f", "score": "0.52768797", "text": "function createPropertyRows(data, db, properties) {\n\tvar rows = [];\n\t\n\tfor (var index = 0; index < properties.length; index++) {\n\t\tvar property = properties[index];\n\t\tvar results = db.find(data[\"subject\"], property[1], null);\n\t\t\t\n\t\tif (results.length > 0) {\n\t\t\tresults.forEach(function (result) {\n if(isLiteral(result.object)) {\n rows.push(createTableRow(\"<a href='\" + property[1] + \"'>\" + property[0] + \"</a>\", getLiteralValue(result.object)));\n } else {\n\t\t\t\trows.push(createTableRow(\"<a href='\" + property[1] + \"'>\" + property[0] + \"</a>\", \"<a href='#\" + removePrefix(result[\"object\"], knownPrefixes) + \"'>\" + searchForLabel(result[\"object\"], db) + \"</a>\"));\n }\n\t\t\t});\n\t\t}\n\t}\n\t\n\treturn rows;\n}", "title": "" }, { "docid": "038d82504c8cb5304b60be4b27496d9a", "score": "0.5263024", "text": "function cfnDataCellsFilterRowFilterPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDataCellsFilter_RowFilterPropertyValidator(properties).assertSuccess();\n return {\n AllRowsWildcard: cdk.objectToCloudFormation(properties.allRowsWildcard),\n FilterExpression: cdk.stringToCloudFormation(properties.filterExpression),\n };\n}", "title": "" }, { "docid": "4c7f9206aa6146f5ab1f1d169e903637", "score": "0.5251844", "text": "function searchProperties() {\n\t\tvar highlighted = collectClicked();\n\t\tvar argString = \"\";\n\t\tif (highlighted.length > 0){\n\t\t\tfor (var i = 0; i < highlighted.length; i++) {\n\t\t\t\targString = argString + \"property=\" + highlighted[i];\n\t\t\t\targString = argString + \"&\";\n\t\t\t}\n\t\t\twindow.location = \"results?\" + argString;\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById(\"hidden_p\").style.visibility = \"visible\";\n\t\t}\n\t}", "title": "" }, { "docid": "16c6af6a3a9a55ed9badec207fd5fc12", "score": "0.52353776", "text": "function CfnPermissions_ColumnWildcardPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('excludedColumnNames', cdk.listValidator(cdk.validateString))(properties.excludedColumnNames));\n return errors.wrap('supplied properties not correct for \"ColumnWildcardProperty\"');\n}", "title": "" }, { "docid": "e698170f99e0fa59eb16eb3021ed4eb2", "score": "0.5202388", "text": "@action\n handleFilter(property, event) {\n // Set property manually because on modifier runs before @value={{this.property}}\n this[property] = event.target.value;\n\n const buildQuery = (min, max) => `${min}to${max}` === 'to' ? '' : `${min}to${max}`;\n const maxInches = this.maxLength === '' ? '' : this.maxLength * 12;\n const minInches = this.minLength === '' ? '' : this.minLength * 12;\n const lengthQuery = buildQuery(minInches, maxInches);\n const priceQuery = buildQuery(this.minPrice, this.maxPrice);\n const yearQuery = buildQuery(this.minYear, this.maxYear);\n\n let filters = {\n search: this.search,\n length: lengthQuery,\n price: priceQuery,\n year: yearQuery\n }\n\n // Call parent action and update query filters\n this.args.updateFilters(filters);\n }", "title": "" }, { "docid": "130ca51c064188d0aebd98cab6d89e9c", "score": "0.5202101", "text": "_constructWhereCondition() {\n if (this._query.command.name !== 'UPDATE' || !this._schema || !this._queryParams) {\n return;\n }\n\n const keyValues = this._schema.extractKeys(this._queryParams);\n\n for (let k in keyValues) {\n this.where(`${k} = ?`, keyValues[k]);\n }\n\n this._queryParams = this._schema.extractNotKeys(this._queryParams);\n }", "title": "" }, { "docid": "296b2b02386d480d93b579cd138c6e3c", "score": "0.5194628", "text": "function transformWhere(className, restWhere, schema, count = false) {\n const mongoWhere = {};\n for (const restKey in restWhere) {\n const out = transformQueryKeyValue(className, restKey, restWhere[restKey], schema, count);\n mongoWhere[out.key] = out.value;\n }\n return mongoWhere;\n}", "title": "" }, { "docid": "9d007815bfe282adee1128546ff2cc9b", "score": "0.5171481", "text": "search(elements = [], query = \"\", properties = []) {\n\t\tquery = query.toLowerCase(); // Normalise query (and properties individually later)\n\t\treturn elements.filter(el => { // Get all elements\n\t\t\treturn properties.some(prop => { // Check properties until match is found\n\t\t\t\tif (String(el[prop]).toLowerCase().includes(query)) return true; // Determine if property is a match for query\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "db3040c7f76590f723828dc0d3553d36", "score": "0.5167951", "text": "function filterEmployee(...args) {\n let json = JSON.parse(args[0]);\n let filterCriteria = args[1].split('-');\n let counter = 0;\n for (let el of json) {\n if (el.hasOwnProperty(filterCriteria[0]) && (Object.values(el).indexOf(filterCriteria[1]) > -1)) {\n console.log(`${counter}. ${el.first_name} ${el.last_name} - ${el.email}`);\n counter++;\n }\n }\n}", "title": "" }, { "docid": "c9fe557cf96b39405fbb8ac9f1c24709", "score": "0.51370144", "text": "function jsonFilter() {\n var ctx = {\n scope: {\n // Access props on an object, returning undefined if\n // not an object at this point:\n '.': function (a, b) {\n var obj = a.eval();\n return typeof obj === 'object'\n ? obj[b.name()]\n : undefined;\n },\n // Concat results together:\n 'and': function (a, b) {\n var aRes = a.eval();\n var bRes = b.eval();\n var aArr = Array.isArray(aRes) ? aRes : [aRes];\n var bArr = Array.isArray(bRes) ? bRes : [bRes];\n return __spreadArrays(aArr, bArr);\n }\n },\n precedence: [\n ['.'],\n ['and']\n ]\n };\n // We might expose a method like this:\n function filterJson(obj, filter) {\n var res = angu.evaluate(filter, ctx, { o: obj });\n return res.value;\n }\n // We could then use it like this:\n assert.equal(filterJson({ foo: { bar: 'wibble' } }, 'o.foo.bar'), 'wibble');\n assert.equal(filterJson({ foo: { bar: 'wibble' } }, 'o.foo.bar.wibble.more'), undefined);\n assert.equal(filterJson({ foo: { bar: [0, 1, 2, { wibble: 'wobble' }] } }, 'o.foo.bar.3.wibble'), 'wobble');\n assert.equal(filterJson({ foo: { '$complex-name': 'wibble' } }, 'o.foo.\"$complex-name\"'), 'wibble');\n assert.deepEqual(filterJson({ foo: { bar: [0, 1, 2], lark: [3, 4, 5], wibble: 6 } }, 'o.foo.bar and o.foo.lark and o.foo.wibble'), [0, 1, 2, 3, 4, 5, 6]);\n}", "title": "" }, { "docid": "985bcaa1d3cfb89cdf3bfae18fb96727", "score": "0.51259243", "text": "function filter( oname, okind, orole, otype, level)\r\n{\r\n /// display some information about the criteria\r\n print_details_what_we_search_for( null, oname, okind, orole, otype, level);\r\n\r\n var flt = p.CreateFilter();\r\n flt.Name = oname;\r\n flt.Kind = okind;\r\n flt.Role = orole;\r\n flt.ObjType = otype;\r\n flt.Level = level;\r\n var res = p.AllFCOs( flt); // filter used project-wide\r\n return coll2array( res);\r\n}", "title": "" }, { "docid": "1a7038d18dfb83deee12179e4394bae1", "score": "0.51169705", "text": "filter(obj, predicate) {\n let result = {}\n Object.keys(obj).forEach(key => {\n if (predicate(key, obj[key])) result[key] = obj[key]\n })\n return result\n }", "title": "" }, { "docid": "d5bf9731d398457b8fd8339a60945f22", "score": "0.5100854", "text": "function where(collection, source) {\n // \"What's in a name? that which we call a rose\n // By any other name would smell as sweet.”\n // -- by William Shakespeare, Romeo and Juliet\n var srcKeys = Object.keys(source);\n\n // filter the collection\n return collection.filter(function (obj) {\n // return a Boolean value for `filter` method\n return srcKeys.every(function (key) {\n // reduce to Boolean value to be returned for `every` method\n return obj.hasOwnProperty(key) && obj[key] === source[key];\n });\n });\n}", "title": "" }, { "docid": "5beb9f94fae44cc0f2a6361a5c3d49cb", "score": "0.509716", "text": "function filter(predicate) {\n var obj = this.value(), result = {};\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (predicate(key, value))\n result[key] = value;\n });\n return new lift_1.ObjectOps(result);\n}", "title": "" }, { "docid": "8ae0fafd3ba9db9394b7f2e41cb862e6", "score": "0.50758886", "text": "function cfnPermissionsColumnWildcardPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnPermissions_ColumnWildcardPropertyValidator(properties).assertSuccess();\n return {\n ExcludedColumnNames: cdk.listMapper(cdk.stringToCloudFormation)(properties.excludedColumnNames),\n };\n}", "title": "" }, { "docid": "f8026845e3cc25fdfb4cc73461abc524", "score": "0.50754845", "text": "function buildWhere(WhereIn){\n\t if (WhereIn.hasOwnProperty(\"logic\")){\n\t return buildWhereHelperTerms(WhereIn);\n\t } else if (WhereIn.hasOwnProperty(\"operator\")){\n\t \treturn buildWhereHelperOperator(WhereIn);\n\t } else {\n\t \t// at this point where is a string that is a colum name\n\t \t// we use a cts.elementQuery to make sure that the document has that colum in it\n\t return cts.elementQuery(WhereIn, cts.andQuery([]));\n\t }\n\t}", "title": "" }, { "docid": "c61688bdf698c7cb508ab3208813e84f", "score": "0.5070077", "text": "function CfnDataCellsFilterPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('columnNames', cdk.listValidator(cdk.validateString))(properties.columnNames));\n errors.collect(cdk.propertyValidator('columnWildcard', CfnDataCellsFilter_ColumnWildcardPropertyValidator)(properties.columnWildcard));\n errors.collect(cdk.propertyValidator('databaseName', cdk.requiredValidator)(properties.databaseName));\n errors.collect(cdk.propertyValidator('databaseName', cdk.validateString)(properties.databaseName));\n errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('rowFilter', CfnDataCellsFilter_RowFilterPropertyValidator)(properties.rowFilter));\n errors.collect(cdk.propertyValidator('tableCatalogId', cdk.requiredValidator)(properties.tableCatalogId));\n errors.collect(cdk.propertyValidator('tableCatalogId', cdk.validateString)(properties.tableCatalogId));\n errors.collect(cdk.propertyValidator('tableName', cdk.requiredValidator)(properties.tableName));\n errors.collect(cdk.propertyValidator('tableName', cdk.validateString)(properties.tableName));\n return errors.wrap('supplied properties not correct for \"CfnDataCellsFilterProps\"');\n}", "title": "" }, { "docid": "fdf5e72c5e63328a1b260e012262fb23", "score": "0.5055638", "text": "function inPropertyValues(λ){\n var d = {};\n λ.inProperties.forEach(function (inProperty){\n d[inProperty] = simpleModel.get(inProperty);\n });\n return d;\n }", "title": "" }, { "docid": "fa1f8c2100497f13db9cae0ee2d8e0f0", "score": "0.50546", "text": "function CfnPermissions_TableWithColumnsResourcePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('catalogId', cdk.validateString)(properties.catalogId));\n errors.collect(cdk.propertyValidator('columnNames', cdk.listValidator(cdk.validateString))(properties.columnNames));\n errors.collect(cdk.propertyValidator('columnWildcard', CfnPermissions_ColumnWildcardPropertyValidator)(properties.columnWildcard));\n errors.collect(cdk.propertyValidator('databaseName', cdk.validateString)(properties.databaseName));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n return errors.wrap('supplied properties not correct for \"TableWithColumnsResourceProperty\"');\n}", "title": "" }, { "docid": "8bd49cfef28af6b8a78880e710f2c20c", "score": "0.5053221", "text": "function filterByString( dataProperty, value ) {\r\n\t\t\t$scope.people = [];\r\n\r\n\t\t\tfor( $scope.i=0; i < personData.length; i++ ) {\r\n\t\t\t\t$scope.person = personData[i];\r\n\t\t\t\tif( person[dataProperty] == value ) {\r\n\t\t\t\t\tpeople.push( person );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tremovePersonMarker( person.id );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn people;\r\n\t\t}", "title": "" }, { "docid": "07b03205945c2fc96116cf2ae52740c0", "score": "0.50468135", "text": "where( conditions = null )\n {\n\n let stringConditions= \"\";\n\n if (conditions != null){\n for (let key in conditions){\n stringConditions += `${this.prefixNode}.${key} = ${conditions[key]},`\n }\n stringConditions= this.prefixNode;\n }\n\n if (stringConditions.length > 0){\n stringConditions = stringConditions.substring(0, stringConditions.length - 1);\n }\n\n this.conditions = stringConditions;\n return this;\n }", "title": "" }, { "docid": "07415bb89f314dc6767a823fcda674bc", "score": "0.50018364", "text": "function findWhere(array, criteria) {\n \nvar property = Object.keys(criteria);\n\nvar newArray = array.find((item) => {\n \n return item[property] === criteria[property];\n});\n \n return newArray;\n \n}", "title": "" }, { "docid": "ffe91a42780e290392ba11f82a3e9706", "score": "0.499487", "text": "function additionalFilters() {\n var key = d3.select(this).property('id');\n var value = d3.select(this).property('value');\n\n tableData = tableData.filter(obj => obj[key] == value);\n display(tableData);\n}", "title": "" }, { "docid": "3e14f2d15d04c83b7398aa624af76dde", "score": "0.4986021", "text": "function filterProperty(array, type, name) {\n // setting new attribute to make show and hide the markers\n let data = array.filter((data) => {\n \n if(name === 'Parking') {\n data.rest.Parking === type ? data.show = true : data.show = false;\n }\n\n if(name === 'BuildingType') {\n data.rest.BuildingType === type ? data.show = true : data.show = false;\n }\n if(name === 'Price') {\n console.log(name, type);\n if(type == 0) {\n data.price <= 1001 ? data.show = true : data.show = false;\n }\n else if(type == 1) {\n data.price <= 2001 ? data.show = true : data.show = false;\n }\n else{\n data.price > 2001 ? data.show = true : data.show = false;\n }\n }\n return data;\n })\n mapMarkers = data;\n}", "title": "" }, { "docid": "d9946062b470595848e4efd4b3b8586a", "score": "0.49792174", "text": "function CfnPrincipalPermissions_ColumnWildcardPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('excludedColumnNames', cdk.listValidator(cdk.validateString))(properties.excludedColumnNames));\n return errors.wrap('supplied properties not correct for \"ColumnWildcardProperty\"');\n}", "title": "" }, { "docid": "193b3a217336f0091c2db60925a57e4e", "score": "0.49735242", "text": "function filterEventProperties(workflowProperties, selectedIds) {\n var result = {};\n for (var workflowProp in workflowProperties) {\n if (workflowProp.indexOf('$') !== 0 && Object.prototype.hasOwnProperty.call(workflowProperties, workflowProp)) {\n if (selectedIds.indexOf(workflowProp) >= 0) {\n result[workflowProp] = workflowProperties[workflowProp];\n }\n }\n }\n return result;\n }", "title": "" }, { "docid": "a95aa140f3969ab0db318f05aef25672", "score": "0.49649438", "text": "function CfnPrincipalPermissions_DataCellsFilterResourcePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('databaseName', cdk.requiredValidator)(properties.databaseName));\n errors.collect(cdk.propertyValidator('databaseName', cdk.validateString)(properties.databaseName));\n errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('tableCatalogId', cdk.requiredValidator)(properties.tableCatalogId));\n errors.collect(cdk.propertyValidator('tableCatalogId', cdk.validateString)(properties.tableCatalogId));\n errors.collect(cdk.propertyValidator('tableName', cdk.requiredValidator)(properties.tableName));\n errors.collect(cdk.propertyValidator('tableName', cdk.validateString)(properties.tableName));\n return errors.wrap('supplied properties not correct for \"DataCellsFilterResourceProperty\"');\n}", "title": "" }, { "docid": "f05d6495457d8cd558eea75682dfa087", "score": "0.494769", "text": "function properties(params,callback,tax){\n\n // Properties Array\n let properties = [];\n\n // Regex Test\n let regex = function(t){\n return /^[Y]/.test(t);\n };\n\n // Cycle through params\n // Only need \"properties\"\n Object.keys(params)\n .filter((name) => /properties/.test(name)) // only properties\n .filter((name) => (params[name] !== \"\")) // remove empty values\n .forEach(function(property) { // cycle\n\n // Rebuild the key to get rid of the properties[] element\n // This allows us to only show what we want the user to see\n // https://stackoverflow.com/a/17779833/1143732\n let name = property.match(/\\[.*?\\]/g).toString().replace(/[\\[\\]']/g,'');\n let prop = params[property].toString(); // Manipulate vars here - allows us to change them later\n\n // Do something to determine whether property should be pursued or not\n // For now, we'll just handle true/false for whether the \"tax\" should be shown, or whether it should be the other stuff\n // Obviously, this should change to a regex-based system...\n if ((tax) && (!regex(name))) {\n return; // Skips if \"tax\" var is present and the property does not have y in the beginning\n } else if ((!tax) && (regex(name))) {\n return; // Skips if tax is not present and it has \"y\" in the beginning\n }\n\n // Append the new values to the \"properties\" variable\n properties.push({ \"name\": name, \"value\": prop });\n\n });\n\n // Send data back\n return callback(properties);\n}", "title": "" }, { "docid": "4b71f1743c4610ebc6dbab39b592d8a1", "score": "0.4939646", "text": "function eventValuesForField(events, searchProp) {\n var result = [];\n for(var eid in events) {\n for (var evProp in events[eid]) {\n if (evProp === searchProp) {\n result.push(events[eid][evProp]);\n }\n }\n }\n return result;\n }", "title": "" }, { "docid": "d1da86f329fc2ceb0b56eb91674fe32b", "score": "0.4912965", "text": "whereExpressions(query) {\r\n let min = null;\r\n let max = null;\r\n let whereExpressions = []\r\n let queryValues = []\r\n\r\n for (let item in query) {\r\n if (item.includes(\"min\")) {\r\n min = [item, query[item]];\r\n queryValues.push(query[item])\r\n } else if (item.includes(\"max\")) {\r\n max = [item, query[item]];\r\n queryValues.push(query[item])\r\n };\r\n };\r\n if (min && max) {\r\n if (max[1] < min[1]) {\r\n throw new LPGError(\"Min must be lower than max\", 400);\r\n };\r\n };\r\n if (min) {\r\n whereExpressions.push(`${min[0].slice(4)} >= $${queryValues.length}`)\r\n };\r\n if (max) {\r\n whereExpressions.push(`${max[0].slice(4)} <= $${queryValues.length}`)\r\n };\r\n if (query.search) {\r\n queryValues.push(`%${query.search}%`);\r\n whereExpressions.push(`${this.columns[1]} ILIKE $${queryValues.length}`);\r\n };\r\n return { whereExpressions, queryValues };\r\n }", "title": "" }, { "docid": "10e7f1b9f09b36770b94f9a7c3254d76", "score": "0.49115905", "text": "function findByProperty(property, value) {\n if (properties.indexOf(property) > -1) {\n // Two special cases - property is id or appContext:\n var a = [];\n switch(property) {\n case 'appContext':\n if (registry.hasOwnProperty(value)) {\n Object.keys(registry[value]).forEach(function(key){\n a.push(registry[value][key]);\n });\n }\n break;\n case 'id' :\n Object.keys(registry).forEach(function(appContext){\n if (registry[appContext].hasOwnProperty(value)) {\n a.push(registry[appContext][value]);\n }\n });\n break;\n default:\n this.list().forEach(function(obj) {\n if (obj.hasOwnProperty(property) && obj[property] === value ){\n a.push(obj);\n }\n });\n break;\n }\n return a;\n } else {\n l('DEBUG') && console.log('EndpointRegistry.findByProperty '+property+' not valid ');\n return []; \n }\n }", "title": "" }, { "docid": "078c3197d81344e07ab7e15ec7bf5395", "score": "0.48912802", "text": "function containsProps(filter, object) {\r\n var match = true;\r\n Object.keys(filter).forEach(function (prop) {\r\n if (filter[prop] !== object[prop]) {\r\n match = false;\r\n }\r\n });\r\n return match;\r\n }", "title": "" }, { "docid": "c314cf43deb30161b98985b6af59c5c3", "score": "0.48833504", "text": "function CfnPermissions_TableWildcardPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n return errors.wrap('supplied properties not correct for \"TableWildcardProperty\"');\n}", "title": "" }, { "docid": "5ee4bca13ad7c5abd76ddd6a74e92d48", "score": "0.48818988", "text": "function cfnPermissionsTableWildcardPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnPermissions_TableWildcardPropertyValidator(properties).assertSuccess();\n return {};\n}", "title": "" }, { "docid": "82cbf0ad67dab1140bd45e215a0db44f", "score": "0.48781776", "text": "function filterSObjectsByValue(contextSObject, filterSObjects, filterKey, filterValue) {\n\t\t\t// filter result\n\t\t\tvar results = [];\n\t\t\tvar hasFilter = typeof(filterKey) !== 'undefined' && filterKey != null && filterKey != '';\n\t\t\tif(!hasFilter) {\n\t\t\t\treturn filterSObjects;\n\t\t\t} else {\n\t\t\t\tfor(var i=0; i < filterSObjects.length; i++) {\n\t\t\t\t\tvar filterSObject = filterSObjects[i];\n\t\t\t\t\tif(typeof(filterValue) !== 'undefined') { //old style expression\n\t\t\t\t\t\tvar objectValue = getValue(filterSObject, filterKey);\n\t\t\t\t\t\tif(objectValue == filterValue) {\n\t\t\t\t\t\t\tresults.push(filterSObject);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar qualifies = FormulaEvaluatorService.calculate(filterKey, [filterSObject, contextSObject]);\n\t\t\t\t\t\tif(typeof(qualifies) !== 'undefined' &&\n\t\t\t\t\t\t\t\tqualifies == true) {\n\t\t\t\t\t\t\tresults.push(filterSObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn results;\n\t\t}", "title": "" }, { "docid": "52f4334501ddb6f1a09996ce4c46a092", "score": "0.48770806", "text": "function buildSqlQuery(properties){\n var sqlQuery = 'SELECT * FROM questions';\n var added= false;\n\n // Adding the tag\n if (properties.tag != 'random'){\n added = true;\n sqlQuery += \" WHERE tags LIKE '%\" + properties.tag + \"%'\";\n }\n\n // Adding the question type\n if (properties.questionType != 'random'){\n if (!added){\n sqlQuery += ' WHERE';\n }\n else{\n sqlQuery += ' AND';\n }\n sqlQuery += \" question_type = '\" + properties.questionType +\"'\";\n }\n\n // Adding the difficulty\n if(properties.difficulty != 'mix'){\n if (!added){\n sqlQuery += ' WHERE';\n }\n else{\n sqlQuery += ' AND';\n }\n sqlQuery += \" difficulty = '\" + properties.difficulty +\"'\";\n }\n\n return sqlQuery;\n }", "title": "" }, { "docid": "afdeb151cced0d37cb9df9fd4709f18c", "score": "0.4869018", "text": "function getByProp(filterProp, sourceItemProp, filters, sourceArray) {\n var resultArray = [];\n\n filters.forEach(function (filter) {\n var temp = sourceArray.filter(function (sourceItem) {\n return filter[filterProp] == sourceItem[sourceItemProp];\n });\n temp.forEach(function (filtered) {\n return resultArray.push(filtered);\n });\n });\n\n return resultArray;\n }", "title": "" }, { "docid": "33812803ac3dbb1f726bd9bc03a15685", "score": "0.48516345", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }", "title": "" }, { "docid": "33812803ac3dbb1f726bd9bc03a15685", "score": "0.48516345", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }", "title": "" }, { "docid": "33812803ac3dbb1f726bd9bc03a15685", "score": "0.48516345", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }", "title": "" }, { "docid": "33812803ac3dbb1f726bd9bc03a15685", "score": "0.48516345", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }", "title": "" }, { "docid": "51ec2b3bac9cf18b3879a81f2c3e7dfd", "score": "0.4850061", "text": "function filterMake(row) {\n return row['Make'] == 'Honda';\n}", "title": "" }, { "docid": "662edcfa8febee3a9ade3bec1944bedd", "score": "0.48462525", "text": "function getFilterProperty(prop){\n\n var familyFilterProps = {\n memberId: 'memberList.memberId'\n };\n\n return familyFilterProps[prop];\n\n}", "title": "" }, { "docid": "6fa91abeea0852407e8bc3057a09550c", "score": "0.4840276", "text": "function applyFilterPredicate() {\n\tvar sql = getPhenotypesSQL();\n\tvar obj = new Object();\n\tobj.sql = objectToString(sql);\n\tobj.predicate = 'selectFilters';\n\tobj.columns = arrayToString(filters);\n\tvar url = window.location.href;\n\tPFINDR.post(url, obj, postApplyFilterPredicate, null, 0);\n}", "title": "" }, { "docid": "f7147282697af3cdf58c23673fe86e97", "score": "0.4816847", "text": "argsToConditions(args) {\n\n if (!args || !args.filter) {\n return {}\n }\n\n debug('argsToConditions', args);\n\n // Build filter.where\n if (args.filter.where) {\n return this.buildWhere(args.filter.where)\n }\n\n\n return {};\n }", "title": "" }, { "docid": "95f7ca0f72bec0c2ef546fde6b1d5fa0", "score": "0.48028073", "text": "function filter(filters) {\n\n // reset any previous filter indexes\n resetFilters();\n\n if (filters) {\n // get the keys\n var fields = [];\n for ( var i = 0; i < _metadata.length; i++) {\n var entry = _metadata[i];\n var searchKey = entry.field;\n\n // if the metadata\n if (filters.hasOwnProperty(searchKey)) {\n fields[searchKey] = entry.type;\n }\n }\n\n // if we do have valid filters i.e with searck keys defined\n // within the table metadata.\n if (!$.isEmptyObject(fields)) {\n\n // remember the filters\n _filters = filters;\n // now for each item of the data, check if it has the\n // values defined by the search keys in the filters.\n _data.filter(function(element, index, array) {\n var hasValue = false;\n for ( var key in fields) {\n if (fields.hasOwnProperty(key)) {\n var type = fields[key];\n var filterValue = filters[key];\n var itemValue = element[key];\n switch (type) {\n case 'number':\n case 'double':\n case 'float':\n hasValue = ((parseFloat(filterValue) - parseFloat(itemValue)) == 0);\n break;\n\n case 'date':\n var t1 = new Date(filterValue).getTime();\n var t2 = new Date(itemValue).getTime();\n hasValue = (t1 === t2);\n break;\n\n case 'string':\n filterValue = filterValue.toLowerCase();\n itemValue = itemValue.toLowerCase();\n\n // first check if the entire sentence is contained as is\n if (itemValue.indexOf(filterValue) > UNDEFINED_INDEX) {\n hasValue = true;\n } else {\n filterValue = filterValue.split(' ');\n var size = filterValue.length;\n var count = 0;\n // All key search key words must be part\n // of the field regardless of their order.\n for ( var i = 0; i < size; i++) {\n var value = filterValue[i];\n if (itemValue.indexOf(value) > UNDEFINED_INDEX) {\n count++;\n }\n }\n hasValue = (count === size);\n }\n break;\n }\n\n // Only items that match all the filters's\n // fields are accepted. If any previous filter\n // value did not match he corresponding element\n // value then there is no need to continue\n // checking the remaining item fields.\n if (!hasValue) {\n break;\n }\n\n }\n }\n if (hasValue) {\n _filtered.push(index);\n }\n });\n }\n }\n }", "title": "" }, { "docid": "139eded22dd997b1bcc079fdefea605c", "score": "0.47969386", "text": "function filterData(data) {\n return data.filter(function (item) {\n return item.category === \"women\" && item.fashion === \"Casual style\";\n });\n}", "title": "" }, { "docid": "9b34441c29ef771a0bf6e90b7fbe50f1", "score": "0.47904173", "text": "function createPropertyPredicate(propertyNames) {\n if (!propertyNames || !propertyNames.length) {\n return null;\n }\n\n if (propertyNames.length === 1) {\n const propertyName = propertyNames[0] + '';\n\n if (propertyName === ANY) {\n return null;\n }\n\n return propName => {\n // PROF: 226 - 0.5%\n return propName === propertyName;\n };\n }\n\n const propertyNamesMap = {};\n\n for (let i = 0, len = propertyNames.length; i < len; i++) {\n const propertyName = propertyNames[i] + '';\n\n if (propertyName === ANY) {\n return null;\n }\n\n propertyNamesMap[propertyName] = true;\n }\n\n return propName => {\n return !!propertyNamesMap[propName];\n };\n}", "title": "" }, { "docid": "6016e6f4fd07325f7821df9b72f7e9f1", "score": "0.47897086", "text": "selectProperties(op, block, index, properties, params, rec) {\n let project = this.getProjection(index);\n /*\n NOTE: Value templates for unique items may need other properties when removing unique items\n */\n for (let [name, field] of Object.entries(block.fields)) {\n if (field.schema)\n continue;\n let omit = false;\n if (block == this.block) {\n let attribute = field.attribute[0];\n // Missing sort key on a high-level API for get/delete\n if (properties[name] == null && attribute == index.sort && params.high && KeysOnly[op]) {\n if (op == 'delete' && !params.many) {\n throw new Error_js_1.OneError('Missing sort key', { code: 'Missing' });\n }\n /*\n Missing sort key for high level get, or delete without \"any\".\n Fallback to find to select the items of interest. Get will throw if more than one result is returned.\n */\n params.fallback = true;\n return;\n }\n if (KeysOnly[op] && attribute != index.hash && attribute != index.sort && !this.hasUniqueFields) {\n // Keys only for get and delete. Must include unique properties and all properties if unique value templates.\n // FUTURE: could have a \"strict\" mode where we warn for other properties instead of ignoring.\n omit = true;\n }\n else if (project && project.indexOf(attribute) < 0) {\n // Attribute is not projected\n omit = true;\n }\n else if (name == this.typeField && op == 'find') {\n omit = true;\n }\n /*\n } else {\n // result[name] = this.transformWriteAttribute(op, field, value, params, properties)\n rec[name] = properties[name]\n */\n }\n if (!omit && properties[name] !== undefined) {\n rec[name] = properties[name];\n }\n }\n this.addProjectedProperties(op, properties, params, project, rec);\n }", "title": "" }, { "docid": "d3c716fb9bb94425da59b043104599c6", "score": "0.47893578", "text": "createWherePart(params)\n {\n if(Object.keys(params).length <= 0) {\n return '';\n }\n\n let whereParts = _.map(params, (value, key) => {\n return this.poolPromise.escapeId(key) + '=' + this.poolPromise.escape(value);\n });\n\n return ' WHERE ' + whereParts.join(' AND ')\n }", "title": "" }, { "docid": "8f7cf8f637928b06abc7b5520f956051", "score": "0.47783345", "text": "function getWhereClause() {\n\tvar obj = new Object();\n\n\t// studies and categories predicates\n\t$.each(query_predicate, function(predicate, values) {\n\t\tif (obj.where == null) {\n\t\t\tobj.where = new Object();\n\t\t}\n\t\tobj.where[predicate] = new Object();\n\t\tobj.where[predicate].op = '=';\n\t\tobj.where[predicate].values = new Array();\n\t\t$.each(values, function(i, value) {\n\t\t\tvar arr = value.split('<br/>');\n\t\t\tobj.where[predicate].values.push(arr.length == 1 ? value : arr[1]);\n\t\t});\n\t});\n\n\t// keyword(s) predicate\n\tvar pattern = $('#query_input').val();\n\tif (pattern.replace(/^\\s*/, '').replace(/\\s*$/, '') != '') {\n\t\tif (obj.where == null) {\n\t\t\tobj.where = new Object();\n\t\t}\n\t\tif ($('#query_regex').attr('checked') != 'checked') {\n\t\t\tpattern = escapeRegExp(pattern);\n\t\t}\n\t\tpattern = pattern.replace(/\\\\/g, \"\\\\\\\\\");\n\t\tvar keyword = $('input:radio[name=keywordSelect]:checked').val();\n\t\tobj.where[keyword] = new Object();\n\t\tobj.where[keyword].op = '~*';\n\t\tobj.where[keyword].values = new Array();\n\t\tobj.where[keyword].values.push(pattern);\n\t}\n\n\t// score predicate\n\tvar hasScore = score1 != 0 || score2 != 1;\n\tif (hasScore) {\n\t\tif (obj.where == null) {\n\t\t\tobj.where = new Object();\n\t\t}\n\t\tobj.where.score = new Object();\n\t\tobj.where.score.op = 'Between';\n\t\tobj.where.score.values = new Array();\n\t\tobj.where.score.values.push('' + score1);\n\t\tobj.where.score.values.push('' + score2);\n\t}\n\treturn obj;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" }, { "docid": "655d1d9064b964a6e7a8b9abbf750809", "score": "0.4775509", "text": "function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}", "title": "" } ]
de7960c816fe9d215f9bdb40cdb3053c
Create the Click Event
[ { "docid": "b3b3a33a74e91038dfcc426ed09c1b53", "score": "0.0", "text": "function click(card) {\n card.addEventListener('click', function() { \n const currentCard = this;\n const previousCard = flippedCards[0];\n\n //we have an existing open card\n if(flippedCards.length === 1) { //if openCrads length is 1 it is true and will run the code\n \n card.classList.add(\"open\", \"show\", \"disable\"); //add card class open + show + new class of disabled to prevent a card from showing as matched if it is doubled clicked so fixing that bug\n\n flippedCards.push(this); //push this-> as in this opened card into the flippedCards variable array\n\n //here invoke the function compare the two opened cards to see if they match\n compare(currentCard, previousCard);\n\n } else {\n //here we do not have any open cards\n card.classList.add(\"open\", \"show\", \"disable\"); //add card class open + show + disable\n flippedCards.push(this); //push this-> as in this opended card into the flippedCards variable array \n } \n\n});\n}", "title": "" } ]
[ { "docid": "0e856be7661e99c9011ccee1d8bd52b2", "score": "0.70706636", "text": "function addClickEvent() {\r\n\r\n\r\n\r\n}", "title": "" }, { "docid": "58bb6b777e11f237e71b218b8aed1a0d", "score": "0.70663357", "text": "handleClick(event) {\n\n const createdEvent = new CustomEvent('buttonclicked', {\n bubbles: true,\n detail: this.title\n });\n\n this.dispatchEvent(createdEvent);\n }", "title": "" }, { "docid": "a8ccf41189990f6388d09d6de9f1b830", "score": "0.6948761", "text": "onClick(pEvent) {\n\t}", "title": "" }, { "docid": "b4979c97b9b901a9c02b2bbcce23b9e9", "score": "0.69334066", "text": "function click(event) {\n\n}", "title": "" }, { "docid": "7b190a847c1a94415c3968f16c14b6d5", "score": "0.66634464", "text": "performClickFunctionality() {}", "title": "" }, { "docid": "154ad0ade55dae2e5a0ed0946fa4e786", "score": "0.6636435", "text": "onClick() {\n this.click.raise();\n }", "title": "" }, { "docid": "5b3b2beb62b3e3ad9b4a1e8bae5f4c5b", "score": "0.6617396", "text": "function trackingClick(e) { }", "title": "" }, { "docid": "40148b5923f26e5fcfaf0fb58f09bd2e", "score": "0.6592685", "text": "function onClick(event) {\n }", "title": "" }, { "docid": "0c585ebc02ad48cfe20af3e9468603c1", "score": "0.65924525", "text": "clickHandler(evt) {\r\n var rect = evt.target.getBoundingClientRect();\r\n var x = evt.clientX - rect.left;\r\n var y = evt.clientY - rect.top;\r\n this.scene.click(x, y);\r\n }", "title": "" }, { "docid": "00f6f81df3adb20a3dd3611594c5729a", "score": "0.65406466", "text": "function handleClick(evt) {\n}", "title": "" }, { "docid": "74151beea9948cc93f01cb08640053f1", "score": "0.64820004", "text": "function clickEvent(action, event_category, event_label) {\n // var element = document.querySelector('#'+'clicked_id');\n gtag('event', action, {\n 'event_category': event_category,\n 'event_label': event_label\n });\n\n}", "title": "" }, { "docid": "9019657f580378cc2cd52da06553672e", "score": "0.6478259", "text": "function onClick(ctx,event) {\n\n}", "title": "" }, { "docid": "a9b39c73a8a6179b184ab16797774c8e", "score": "0.647633", "text": "onClickEvent(e) {\n this.onClick(e);\n }", "title": "" }, { "docid": "9e728fc3cb531c3674d9e5ba7c284cb3", "score": "0.643921", "text": "click() {\n\t\t\tthis.send(new util.Evt('click', {station:this}));\n\t\t}", "title": "" }, { "docid": "bf39c2b5ece39389dce64af482634c9d", "score": "0.6416292", "text": "click() { }", "title": "" }, { "docid": "e21740c5f7dd272e725b67290ef0459e", "score": "0.63895226", "text": "function clickCallback( event ){\n console.log(\"clicked by add event handler\");\n}", "title": "" }, { "docid": "95d7fc643af2916ace90b165baf9f2c3", "score": "0.6375106", "text": "function clickEventFunction () {\n clickEvents.htmlEx.textContent = \"clicked\"\n}", "title": "" }, { "docid": "46b3955534912ed700de6fdf3e5fbfc5", "score": "0.63649267", "text": "_buttonClick(e) {\n /**\n * Fires when button is clicked\n * @event click-details\n */\n this.dispatchEvent(new CustomEvent(\"button-click\", { detail: this }));\n }", "title": "" }, { "docid": "56a75c223ffdeead56bf7c1dc5b193f3", "score": "0.63594556", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallNanoflowClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, CallNanoflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "0a84e79a9265c9d196488589e4c24baf", "score": "0.63506335", "text": "onClick(event) {\n this.$emit('click', event);\n }", "title": "" }, { "docid": "8d747e4b398c2e75cfacf4d9dc2fa574", "score": "0.6338272", "text": "function event_click()\n{\n console.log('button clicked')\n}", "title": "" }, { "docid": "8c838e221b07626c14baff0c385ce704", "score": "0.63315475", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallWorkflowClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, CallWorkflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "a38ebd4ce10099c5da7d42f9d307ff90", "score": "0.63040596", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallNanoflowClientAction.structureTypeName, { start: \"7.8.0\" });\n return internal.instancehelpers.createElement(container, CallNanoflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "50c4750b0403946cc502ba7e53dcbaeb", "score": "0.6303123", "text": "function click(e, type) {\r\nif(!e) {return;}\r\nif(typeof e=='string') e=document.getElementById(e);\r\nvar evObj = document.createEvent('MouseEvents');\r\nevObj.initMouseEvent((type||'click'),true,true,window,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "50c4750b0403946cc502ba7e53dcbaeb", "score": "0.6303123", "text": "function click(e, type) {\r\nif(!e) {return;}\r\nif(typeof e=='string') e=document.getElementById(e);\r\nvar evObj = document.createEvent('MouseEvents');\r\nevObj.initMouseEvent((type||'click'),true,true,window,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "50c4750b0403946cc502ba7e53dcbaeb", "score": "0.6303123", "text": "function click(e, type) {\r\nif(!e) {return;}\r\nif(typeof e=='string') e=document.getElementById(e);\r\nvar evObj = document.createEvent('MouseEvents');\r\nevObj.initMouseEvent((type||'click'),true,true,window,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "50c4750b0403946cc502ba7e53dcbaeb", "score": "0.6303123", "text": "function click(e, type) {\r\nif(!e) {return;}\r\nif(typeof e=='string') e=document.getElementById(e);\r\nvar evObj = document.createEvent('MouseEvents');\r\nevObj.initMouseEvent((type||'click'),true,true,window,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "50c4750b0403946cc502ba7e53dcbaeb", "score": "0.6303123", "text": "function click(e, type) {\r\nif(!e) {return;}\r\nif(typeof e=='string') e=document.getElementById(e);\r\nvar evObj = document.createEvent('MouseEvents');\r\nevObj.initMouseEvent((type||'click'),true,true,window,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "d35ac12a4bda6cb3babc682363ad023d", "score": "0.62809634", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenLinkClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, OpenLinkClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "14e6cf6b0bac406711ef64e545049d43", "score": "0.62773204", "text": "click(event) {\n this.clickPersons(event);\n this.clickWeddings(event);\n reDraw();\n }", "title": "" }, { "docid": "5d08c8fca777884fd82cac7b4fa9e39e", "score": "0.6263495", "text": "click() { createAddWindow(); }", "title": "" }, { "docid": "37b5c57b5647f51fa680f80dfc2fc622", "score": "0.6258909", "text": "function click(e, type) {\r\nif(!e && typeof e=='string') e=document.getElementById(e);\r\nif(!e) return;\r\nvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\nevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\ne.dispatchEvent(evObj);\r\n}", "title": "" }, { "docid": "096abbb269eb8badb086f847d458666d", "score": "0.6258302", "text": "function handleClick(e) {\n console.log('click', e);\n }", "title": "" }, { "docid": "82f327801b6f4b2e1c0c0726522f100f", "score": "0.62438434", "text": "function click(e) {\n\t\t\tif(!e && typeof e=='string') e=document.getElementById(e);\n\t\t\tif(!e) return;\n\t\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\n\t\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\n\t\t\te.dispatchEvent(evObj);\n\t\t}", "title": "" }, { "docid": "0e08974070ba51e04d8fa89db79386b2", "score": "0.62329364", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CreateObjectClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, CreateObjectClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "4aed8302a75b297cb35beb8320bf1216", "score": "0.62209415", "text": "onClick() {}", "title": "" }, { "docid": "4aed8302a75b297cb35beb8320bf1216", "score": "0.62209415", "text": "onClick() {}", "title": "" }, { "docid": "70a44f4825ae5faca13fb3e6bda3ec67", "score": "0.62140924", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenLinkClientAction.structureTypeName, { start: \"7.3.0\" });\n return internal.instancehelpers.createElement(container, OpenLinkClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "fd9dea43022ddfc43cf2600a1b3d5b63", "score": "0.6208678", "text": "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "title": "" }, { "docid": "fd9dea43022ddfc43cf2600a1b3d5b63", "score": "0.6208678", "text": "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "title": "" }, { "docid": "c6768e69022a8717b6543e9cd74c2557", "score": "0.6207226", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, PageClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, PageClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "9baa42137040ebc828f76d9e9dbd3b64", "score": "0.62068534", "text": "function setUp(){\t\n\t\t/* Alternative code snippet\n\t\t\t$('#example_button').click(function() {\n\t\t\tconsole.log(\"event successfully added\")\n\t\t\t});\n\t\t*/\n\t\t\n\t\t$('#example_button').click(buttonClickEvent);\n\t}", "title": "" }, { "docid": "d783b23055033dbc42beff85d6e2f9e9", "score": "0.6204451", "text": "handleClick(event) {\n const bookSlotEvent = new CustomEvent('bookslot', {\n detail: {\n dt: event.target.dataset.dt,\n slotName: event.target.dataset.slotName,\n slotStart: event.target.dataset.slotStart,\n slotEnd: event.target.dataset.slotEnd,\n phyId: event.target.dataset.phyId,\n phyName: event.target.dataset.phyName\n\n }\n });\n this.dispatchEvent(bookSlotEvent);\n }", "title": "" }, { "docid": "7b38724fba75a26016bd6d50a55f8ce5", "score": "0.62012726", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallWorkflowClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, CallWorkflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "5c102034d75ba0d8fe9f049043bc1f61", "score": "0.61909646", "text": "function click(e) {\r\n\t\t\tif(!e && typeof e=='string') e=document.getElementById(e);\r\n\t\t\tif(!e) return;\r\n\t\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\n\t\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\n\t\t\te.dispatchEvent(evObj);\r\n\t\t\tevObj=null;\r\n\t\t}", "title": "" }, { "docid": "331b8095f1ab3db1d176298628216d19", "score": "0.618254", "text": "static createInListViewUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallNanoflowClientAction.structureTypeName, { start: \"7.8.0\" });\n return internal.instancehelpers.createElement(container, CallNanoflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "21271d03fec7486188504a8b7ee9f298", "score": "0.61693287", "text": "function Click() {\n HTMLDecorators.Decorator.call(this);\n }", "title": "" }, { "docid": "ba8933596393e57eca1291e2bd1d1d88", "score": "0.61648613", "text": "function _onClick(evt){\r\n\t _log(\"canvas clicked!\");\r\n\t}", "title": "" }, { "docid": "240c46bccc14527f13dca52de84eb2c0", "score": "0.6158451", "text": "static createInListViewUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenLinkClientAction.structureTypeName, { start: \"7.3.0\" });\n return internal.instancehelpers.createElement(container, OpenLinkClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "96a17b3f21bee4dcf815214cc7333eb9", "score": "0.6157542", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, NoClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, NoClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "9d040f7ec0d03ed42f7cc43138f89171", "score": "0.6149886", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CreateObjectClientAction.structureTypeName, { start: \"7.17.0\" });\n return internal.instancehelpers.createElement(container, CreateObjectClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "8a4847b1494ec08332918c6d5be9ecfc", "score": "0.61482817", "text": "function click(e) {\r\n\t\tif(!e && typeof e=='string') e=document.getElementById(e);\r\n\t\tif(!e) return;\r\n\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\n\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\n\t\te.dispatchEvent(evObj);\r\n\t}", "title": "" }, { "docid": "b36b50f0c04618689984849ff9cb2c4f", "score": "0.61448485", "text": "clickQuery(e) {\n const data = this.basicInfo();\n data['targetClass'] = e['target'].className;\n data['targetID'] = e['target'].id;\n data['type'] = 'click';\n new Image().src = '/ui_tracker?' + this.query(data);\n }", "title": "" }, { "docid": "9b9aa2d4cb81281407469d9fa187f00d", "score": "0.6142094", "text": "click() {\n if (this.mouseIn()) {\n this.a(mouseX);\n }\n }", "title": "" }, { "docid": "9aca285dd48b5ea4e4a5994faba9a35e", "score": "0.6141733", "text": "onClick() {\n console.log(\"clicked\");\n }", "title": "" }, { "docid": "8e00b484064f8f8110b70fdb325b3434", "score": "0.6133516", "text": "click(ev) {\n // Print x,y coordinates.\n console.log(ev.clientX, ev.clientY);\n\n var shape = new Triangle(shader, this.image);\n this.scene.addGeometry(shape);\n }", "title": "" }, { "docid": "ec8c30e6c471a24780a7b2ad1c98efd0", "score": "0.6129544", "text": "handleClickEvent (e) {\n super.handleClickEvent(e)\n }", "title": "" }, { "docid": "ec8c30e6c471a24780a7b2ad1c98efd0", "score": "0.6129544", "text": "handleClickEvent (e) {\n super.handleClickEvent(e)\n }", "title": "" }, { "docid": "ec8c30e6c471a24780a7b2ad1c98efd0", "score": "0.6129544", "text": "handleClickEvent (e) {\n super.handleClickEvent(e)\n }", "title": "" }, { "docid": "ad535469d479ef28f01e4e531c4e8244", "score": "0.6124411", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, MicroflowClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, MicroflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "9d7eb335ddba1fc25442968a5b41391f", "score": "0.61158895", "text": "static createInListViewUnderClickAction(container) {\n return internal.instancehelpers.createElement(container, PageClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "68eb58d17f52892d321a51f33cfaa5f6", "score": "0.6112606", "text": "function clickEvent(event) {\n const rect = canvas.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n socket.emit(\"save click\", x, y);\n }", "title": "" }, { "docid": "bdb315f0ec0f05354cce0d9ab0073dc8", "score": "0.611154", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenUserTaskClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, OpenUserTaskClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "0c868137be71a37871201152cdd5a00d", "score": "0.6109034", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenWorkflowClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, OpenWorkflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "ffb4a7fa50d49b782e22dd87336f58a3", "score": "0.6107392", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, SetTaskOutcomeClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, SetTaskOutcomeClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "19ec515af2aa84769bc34e52dcb05edd", "score": "0.6106972", "text": "function clickListener(evt) {\n evt.addEventListener(\"click\", () => {\n // console.log(\"On the right track\");\n let j = evt.getElementsByTagName(\"BUTTON\")[0];\n j.click();\n });\n}", "title": "" }, { "docid": "7a33de23ace68cb8488ad8e9931061b1", "score": "0.6106701", "text": "_onButtonClick(e) {\n if (!(e.target instanceof Button))\n return;\n this.onButtonClick(e.target);\n }", "title": "" }, { "docid": "ed17998541a805c4414297a0f45edf99", "score": "0.61024857", "text": "handleClickMoBV(event) {\n\n }", "title": "" }, { "docid": "be93887386ab2a1a9c487efd67b06afd", "score": "0.6101326", "text": "function addClick(ind){\n var elem = shapes[ind];\n elem.addEventListener(\"click\", function(){\n checkOrder();\n\n });\n }", "title": "" }, { "docid": "a8213558c0c47faf80ee5691c062540b", "score": "0.60932606", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, SyncClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, SyncClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "ee379ae18fde97602fbb78a5e4664423", "score": "0.6083764", "text": "function Click() {\n console.log(\"Clicked !\");\n}", "title": "" }, { "docid": "e00eef0b85b5dbfcd48b2be8f9e3b794", "score": "0.6079099", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, SaveChangesClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, SaveChangesClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "5e85416fe3f5e7d884e459f282f59153", "score": "0.6075873", "text": "static createInStaticImageViewerUnderClickAction(container) {\n return internal.instancehelpers.createElement(container, PageClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "76bc29b52b76cc1bf0abee493b25c36b", "score": "0.6073308", "text": "static createInDynamicImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, ClosePageClientAction.structureTypeName, { start: \"7.18.0\" });\n return internal.instancehelpers.createElement(container, ClosePageClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "c5b640e779a435583511799b0abf663e", "score": "0.60732317", "text": "mouseClick() {\n\t\tif (this._click != null)\n\t\t\tthis._click();\n\t}", "title": "" }, { "docid": "7d8c7ae991a95ea403dd800ac970ca0e", "score": "0.606991", "text": "function handleClick(){\n \n \n}", "title": "" }, { "docid": "408a6df500881a243d6cc4cba103833b", "score": "0.60643435", "text": "function click(name, age, personId) {\n console.log(\"name click event : \" + name);\n console.log(\"age : \" + age);\n console.log(\"personId : \" + personId);\n\n\n }", "title": "" }, { "docid": "28ec59ec2dfd0a775d9eaad182642bc6", "score": "0.6062373", "text": "onClick(event) {\n if (event.target === this._element) {\n this.notifyClick(event);\n }\n }", "title": "" }, { "docid": "8ba89d396e4aeeefb8567591984a5ae4", "score": "0.6058562", "text": "static createInStaticImageViewerUnderClickAction(container) {\n return internal.instancehelpers.createElement(container, NoClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "5d05d6b6759a062a889ce1959c7ba71b", "score": "0.6056678", "text": "static createInListViewUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CreateObjectClientAction.structureTypeName, { start: \"7.17.0\" });\n return internal.instancehelpers.createElement(container, CreateObjectClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "fc1797daee88f881e342b37da19fa50e", "score": "0.6051112", "text": "function createBrokenClickMe(event) {\n event.preventDefault();\n\n var buttonEx12 = $(\"<button>\")\n .attr({\n class: \"dynamic-example\",\n id: \"button-example-12\",\n type: \"button\"\n })\n .text(\"Click me! I also won't work\");\n\n // SELECT THE PARENT OF THIS CREATE BUTTON\n $(this).parent().append(buttonEx12);\n }", "title": "" }, { "docid": "de58531f6bcf19472157443f5a1eb7fd", "score": "0.6042392", "text": "function Click() {\n console.log(\"Clicked...\");\n}", "title": "" }, { "docid": "182a8dec540aaf7904778605255e9d94", "score": "0.60408586", "text": "function click(e) {\r\n\t\tif(!e && typeof e=='string') e=document.getElementById(e);\r\n\t\tif(!e) return;\r\n\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\n\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\n\t\te.dispatchEvent(evObj);\r\n\t\tevObj=null;\r\n\t}", "title": "" }, { "docid": "88669c45ddb8e651e20e153e7e614f0f", "score": "0.6039026", "text": "static createInListViewUnderClickAction(container) {\n internal.createInVersionCheck(container.model, CallWorkflowClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, CallWorkflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "f35a8315a67e7f5d9365e127ec0a8c56", "score": "0.60389423", "text": "function onClick(e){\n // console.log('Hello World!');\n // the following method overrides the default behavior of forms, links, etc.\n e.preventDefault();\n\n val = e; // most important element of event object is .target, which refers to the DOM element the event object is immediately connected to (e.g., a clicked button, etc.)\n // e.target element\n val = e.target;\n val = e.target.id;\n val = e.target.className;\n val = e.target.classList;\n e.target.innerText = 'Did Something!'\n\n // event type\n val = e.type;\n\n // timestamp\n val = e.timeStamp;\n console.log(e.timeStamp);\n\n // coords of event relative to window\n val = e.clientY;\n val = e.clientX;\n\n // coords of event relative to selected element\n val = e.offsetY;\n val = e.offsetX;\n\n // console.log(val);\n}", "title": "" }, { "docid": "797aac489eac35b98376fbef7e25bb86", "score": "0.6038225", "text": "static createInListViewUnderClickAction(container) {\n return internal.instancehelpers.createElement(container, NoClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "cccc9de171a9d075fbf04a7d30a2e84e", "score": "0.6033304", "text": "function bindClickEvent(item, callback){\n item.on(\"click\", callback);\n }", "title": "" }, { "docid": "9ba8f8c108709bc55a4cbef85b2667e3", "score": "0.602504", "text": "click (e) {\n !this.fab &&\n e.detail &&\n this.$el.blur()\n\n this.$emit('click', e)\n }", "title": "" }, { "docid": "de7adf161b9a41fd3b213939c959b25b", "score": "0.6021702", "text": "function addClickEvent() {\n // Use one here, not on, to avoid problems with rapid clicking\n $submitButton.one('click', function (e) {\n validateSelection();\n });\n }", "title": "" }, { "docid": "bf3c54bfe0fe69a8204e4d7c40ac830e", "score": "0.6021162", "text": "static createInStaticImageViewerUnderClickAction(container) {\n return internal.instancehelpers.createElement(container, MicroflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "15011c4d1de10aa2232f8850278885af", "score": "0.6020188", "text": "makeClick(size) {\n\t\t\tthis.valor = event.target.getAttribute('value');\n\t\t\tthis.direction = event.target.getAttribute('direction');\n\t\t\tconsole.log(`Direction : ${this.direction}`);\n\t\t\tconsole.log(`value: ${this.valor}`);\n\t\t\tthis.removeHover();\n\t\t\tthis.tags.forEach((div) => div.setAttribute('data-size', size));\n\t\t\tthis.makeHover();\n\t\t\tthis.makeAclick();\n\t\t}", "title": "" }, { "docid": "0de416a3f43f97ae1edfcb7d2d3e2f45", "score": "0.60146886", "text": "function clicked()\n\t{\n\t\tif (enabled)\n\t\t\tthat.click && that.click.call(that, that);\n\t}", "title": "" }, { "docid": "2a032aa67605325ffc2a22f74946a367", "score": "0.601456", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenUserTaskClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, OpenUserTaskClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "1e3a029b661ebbea7f6e0b934159ebaa", "score": "0.60101646", "text": "function clickHandler() {\n console.log('click event!');\n}", "title": "" }, { "docid": "290e308884e12bd1e4b25c312d46aed7", "score": "0.60100186", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, SetTaskOutcomeClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, SetTaskOutcomeClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "0609a21b00e3dc26443b3696fc38dd5a", "score": "0.60085833", "text": "function handleClick() {\n console.log('Clicked!');\n}", "title": "" }, { "docid": "23e6778e6afbcae8e305044cbaad8da5", "score": "0.6005332", "text": "setClickListener() {\n var self = this;\n document.addEventListener(\"click\", function (e) {\n var elem = self.clickInsideElement(e, contextMenuLinkClassName);\n\n if (elem) {\n e.preventDefault();\n self.funcAction(elem);\n self.toggleMenuOff();\n } else {\n var button = e.which || e.button;\n if (button === 1) {\n self.toggleMenuOff();\n }\n }\n });\n }", "title": "" }, { "docid": "f18e115c6e493479d258caeb6c2a2766", "score": "0.60026664", "text": "_createButton(className, fn) {\n const button = super._createButton(className, fn);\n button.clickFunction = fn;\n return button;\n }", "title": "" }, { "docid": "57e694ef4632059701c25b4baee11c78", "score": "0.5991497", "text": "handleClicked(_status) {\n this.clicked = _status;\n }", "title": "" }, { "docid": "f8a1d78007149affcb11f31a2d7c7c57", "score": "0.59862685", "text": "static createInStaticImageViewerUnderClickAction(container) {\n internal.createInVersionCheck(container.model, OpenWorkflowClientAction.structureTypeName, { start: \"9.0.2\" });\n return internal.instancehelpers.createElement(container, OpenWorkflowClientAction, \"clickAction\", false);\n }", "title": "" }, { "docid": "73325127acfb1160f014c399b5e1c9bf", "score": "0.59846693", "text": "function handleCreateCalClick(event) {\n console.log(\"DEBUG: Button to create calendar clicked.\");\n createCalendar();\n closePopup();\n}", "title": "" } ]
b296316c7b9d1f556e165bc8cc684be6
"this" should be the larger one if appropriate.
[ { "docid": "ac355031e922a8d971279f3c284f7e9d", "score": "0.0", "text": "function bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n\n while (--i >= 0) {\n r[i] = 0;\n }\n\n for (i = 0; i < y.t; ++i) {\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n }\n\n r.s = 0;\n r.clamp();\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n} // (protected) r = this^2, r != this (HAC 14.16)", "title": "" } ]
[ { "docid": "5f6b6eb02b2fe6f89c9798c1d5552192", "score": "0.65660876", "text": "function normalThis() {\n return this;\n}", "title": "" }, { "docid": "975b8df5d56db2fcd5d117ec8af56bb4", "score": "0.6225705", "text": "function getThis () { return this; }", "title": "" }, { "docid": "8083a6350c16b52726e42063fb641e1e", "score": "0.60477245", "text": "function whatIsThis(){\n return this;\n}", "title": "" }, { "docid": "0133268956b7ee45704c4f289b174f21", "score": "0.60458463", "text": "getMax() {\n const that = this;\n }", "title": "" }, { "docid": "950113af7ea921189dd2167559e1d562", "score": "0.60314506", "text": "function whatIsThis(){\n return this;\n}", "title": "" }, { "docid": "02febc0030bacdf4d9c2129429d58885", "score": "0.6028778", "text": "function returnThis() {\n return this;\n}", "title": "" }, { "docid": "6d733448df9beac15a0b8c8c8965fb42", "score": "0.59586996", "text": "function returnThis () {\n return this;\n}", "title": "" }, { "docid": "4ba33d87efd7472f41fe00ca25147451", "score": "0.58025986", "text": "getSize() {\n const that = this;\n }", "title": "" }, { "docid": "c629b7e53d2fc4f3382db32cf8162b3f", "score": "0.5646005", "text": "ThisExpression() {\n this._eat('this');\n return {\n type: 'ThisExpression',\n };\n }", "title": "" }, { "docid": "e56d5a1ec84cea15532dfc9b797ff2e4", "score": "0.5645452", "text": "function normalThis() {\n return arguments;\n}", "title": "" }, { "docid": "7c78a1b384fb79c25108f96bfd89e2ab", "score": "0.5637843", "text": "function whatsThis(){return this.a;}", "title": "" }, { "docid": "972ee3b70298abadcd19c8b23bee11c8", "score": "0.55559236", "text": "_validateAndSanitize() {\n const oThis = this;\n }", "title": "" }, { "docid": "40e2fa5958884a9fb481df1ce1cbd386", "score": "0.55557907", "text": "function MyOtherObject() { this.self = e('this'); }", "title": "" }, { "docid": "7e15acf8cb6359152a39b80858621409", "score": "0.5551017", "text": "function thisFunc() {\n var x = this;\n var x;\n}", "title": "" }, { "docid": "795e165438dfc7359717932559b7bd98", "score": "0.5492804", "text": "function times_something(elem) {\n return elem*this;\n}", "title": "" }, { "docid": "11029b57ed5f1e1b4b9ccfc8665f44bd", "score": "0.5490845", "text": "function foob(something) {\r\n console.log(this.a, something);\r\n // return this.a + something; // for the sake of the call vs apply difference, not needed here\r\n}", "title": "" }, { "docid": "d81385a580cdcedc4f1051eac2a933c5", "score": "0.54627657", "text": "function isThisProperty(node){var kind=node.kind;return(kind===194/* PropertyAccessExpression */||kind===195/* ElementAccessExpression */)&&node.expression.kind===104/* ThisKeyword */;}", "title": "" }, { "docid": "0baf883a799c90224e580680587219c0", "score": "0.54604393", "text": "function capacity(self) {\n ;\n return self.capacity;\n}", "title": "" }, { "docid": "665a776b873ac3bb1a24470f40e540a7", "score": "0.543789", "text": "function returnThis(param1, param2) {\n return this;\n}", "title": "" }, { "docid": "413b573caefe248ecd461c4b818f68a4", "score": "0.54073566", "text": "function thisHeight(){\n return $(this).height();\n }", "title": "" }, { "docid": "6eb5831234524203ae4c23664002aa55", "score": "0.538657", "text": "function isThislessTypeParameter(node){var constraint=ts.getEffectiveConstraintOfTypeParameter(node);return!constraint||isThislessType(constraint);}", "title": "" }, { "docid": "c599cf5ca160bfd9353864b106d1c630", "score": "0.5360717", "text": "function someFunction() {\n return this;\n}", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "bf87116fdea8cd5254cf158fc6322f5d", "score": "0.5347496", "text": "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "title": "" }, { "docid": "ac4f7a2e33e02b46c034614f0fe0040d", "score": "0.53238153", "text": "function f(this: empty) {\n this; // fine\n\n let g = { m() { this }}; // error, refer to method here\n }", "title": "" }, { "docid": "034f4a1927edeca6074df9961dfecfa3", "score": "0.5312451", "text": "function f(){\r\n\t\treturn this\r\n \t}", "title": "" }, { "docid": "9c4e0b8293aa12df4cee6545a9cdcb3c", "score": "0.530254", "text": "function size(self) {\n ;\n return self.size;\n}", "title": "" }, { "docid": "f522269c79e939a738197a98f2cae9b2", "score": "0.5297179", "text": "lower() {\n this._max = this._current;\n }", "title": "" }, { "docid": "da34b745d9d2382117ba8dc5d56f6c49", "score": "0.5277464", "text": "greater() {\n this._min = this._current;\n }", "title": "" }, { "docid": "009f14d688e0950d70c03934bf6c1d7a", "score": "0.5276116", "text": "function Bigger() {\n\tscaleObject += 0.1;\n\tReset();\n}", "title": "" }, { "docid": "d6bebaa6e2747ed6e3a69655f5b10dc1", "score": "0.52585983", "text": "function fixThisPointer(_this, func){return\n _this[func.name] = bind(_this[func.name], _this);\n}", "title": "" }, { "docid": "529e1d4434eebab8b149c11075ed0599", "score": "0.52479076", "text": "function substituteThisKeyword(node){if(enabledSubstitutions&1/* CapturedThis */&&hierarchyFacts&16/* CapturesThis */){return ts.setTextRange(ts.createFileLevelUniqueName(\"_this\"),node);}return node;}", "title": "" }, { "docid": "264a2ef56870cfe6619f31086dfaa3e2", "score": "0.5246181", "text": "function someOtherFunction() {\n \"use strict\";\n return this;\n}", "title": "" }, { "docid": "bdaef168ecd0b71156e36a9609587525", "score": "0.5242666", "text": "capacityAt(t){throw 'pure virtual';}", "title": "" }, { "docid": "7e85feb986a4ee2aa002c08e09552a3c", "score": "0.52421135", "text": "function extractValueFromThisExpression() {\n return 'this';\n}", "title": "" }, { "docid": "e0c93383cfb216f68039f2513bc28c37", "score": "0.52397996", "text": "function maintain_this_binding(parent,orig,val){if(parent instanceof AST_Call&&parent.expression===orig){if(val instanceof AST_PropAccess||val instanceof AST_SymbolRef&&val.name===\"eval\"){return make_node(AST_Seq,orig,{car:make_node(AST_Number,orig,{value:0}),cdr:val});}}return val;}", "title": "" }, { "docid": "976b5bd1535400788e4f311348782e0c", "score": "0.52385455", "text": "get Overflow() {}", "title": "" }, { "docid": "36d5e63f9f44703ef8a1748f2ded9869", "score": "0.52319103", "text": "change(tothis)\n {\n this.setSize(thothis.value);\n this.setPos(tothis.Pos);\n }", "title": "" }, { "docid": "59554db2ac8673f82037a12ea8f6e193", "score": "0.52316356", "text": "function f() {\n return this.a;\n}", "title": "" }, { "docid": "ba19a62ca908e3796f4175257885d906", "score": "0.5217657", "text": "function f(){\n return this.a;\n}", "title": "" }, { "docid": "c7cc6431739e86962d3b7b59b6b8410a", "score": "0.5200172", "text": "f() {\n return this;\n }", "title": "" }, { "docid": "670402fff6c216f0167fff54cbbbe49d", "score": "0.5195732", "text": "function too(){\n console.log(this.b);\n}", "title": "" }, { "docid": "45d0325cad8b6dd91a78b7668ba3721e", "score": "0.51930404", "text": "function tFunction(p1, p2) {\n return this\n}", "title": "" }, { "docid": "12c3852c8f3949e5ae822128567784af", "score": "0.51848257", "text": "function checkThis(){\n console.log(this);\n}", "title": "" }, { "docid": "d8f916addbbae91ad0babed31665e0bd", "score": "0.5183315", "text": "get full() {\n return this.size > this.max - this.min;\n }", "title": "" }, { "docid": "198af82b3ed0ca5c32ff147a82e4ab0c", "score": "0.5172386", "text": "function f1B() {\n 'use strict';\n return this;\n}", "title": "" }, { "docid": "1b124a4bded441863cfadbdb2a01cb3c", "score": "0.5171178", "text": "function whatIsThis() {\n console.log(this)\n}", "title": "" }, { "docid": "145974037687ace7f5793696b7a85ac6", "score": "0.5168145", "text": "function useThis(){\n this.myProp = \"this property\";\n}", "title": "" }, { "docid": "d3fd6e36652ec218a731a7453792a641", "score": "0.5167432", "text": "get backingOuterExtent() {\n return this.i.by;\n }", "title": "" }, { "docid": "e0d0a66f9e03774436fb98146ecddd1f", "score": "0.5164692", "text": "function myFunction() {\n return this;\n}", "title": "" }, { "docid": "e0d0a66f9e03774436fb98146ecddd1f", "score": "0.5164692", "text": "function myFunction() {\n return this;\n}", "title": "" }, { "docid": "e52cb39a1686307e85f5de60fbfed379", "score": "0.5152855", "text": "originalWidth(){return this._origWidth;}", "title": "" }, { "docid": "efe1e431ec52c57b370fe550d2920d49", "score": "0.51470417", "text": "function second() {\n 'use strict';\n\n return this;\n}", "title": "" }, { "docid": "b57ce3bc4253e7a64f139c0e2004598c", "score": "0.5140348", "text": "function f1A() {\n return this;\n}", "title": "" }, { "docid": "dd8d9d623d94211ad0fd137a64e707fa", "score": "0.51375127", "text": "isTight() {\n return this.size >= 2;\n }", "title": "" }, { "docid": "c6341508b7f516f4acc3d2fcb6782db4", "score": "0.5105759", "text": "function whatIsThis() {\n\tconsole.log(this); \n}", "title": "" }, { "docid": "056c71cb36555115dc68e96a498234b3", "score": "0.5102988", "text": "function second() {\n 'use strict';\n return this;\n}", "title": "" }, { "docid": "d4e5c52fc024c6eae9a3ee0340dc653d", "score": "0.510182", "text": "function getThisArgumentOfCall(node){if(node.kind===196/* CallExpression */){var callee=ts.skipOuterExpressions(node.expression);if(ts.isAccessExpression(callee)){return callee.expression;}}}", "title": "" }, { "docid": "695921e41bde3dbf7cd89a7fa0531c54", "score": "0.5101238", "text": "function whatIsThis() {\n\tconsole.log(this);\n}", "title": "" }, { "docid": "8b56788bda04cc046ad18dc39522f293", "score": "0.5095654", "text": "function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError(\"Cannot instantiate an arrow function\"); } }", "title": "" }, { "docid": "ae3e02a7637dd981d504ec3498ea9796", "score": "0.50880706", "text": "constructor (sz) {\nreturn this;\n}", "title": "" }, { "docid": "e1346bf4d3ca4509f531e1973770768c", "score": "0.5079599", "text": "function isThislessType(node){switch(node.kind){case 125/* AnyKeyword */:case 148/* UnknownKeyword */:case 143/* StringKeyword */:case 140/* NumberKeyword */:case 151/* BigIntKeyword */:case 128/* BooleanKeyword */:case 144/* SymbolKeyword */:case 141/* ObjectKeyword */:case 110/* VoidKeyword */:case 146/* UndefinedKeyword */:case 100/* NullKeyword */:case 137/* NeverKeyword */:case 187/* LiteralType */:return true;case 174/* ArrayType */:return isThislessType(node.elementType);case 169/* TypeReference */:return!node.typeArguments||node.typeArguments.every(isThislessType);}return false;}", "title": "" }, { "docid": "f97684e4f0862775fb79ae5bea3f0baf", "score": "0.5079281", "text": "width() { return this.w; }", "title": "" }, { "docid": "1428fb6bedf18e2344e3c3ec0258533a", "score": "0.5073794", "text": "get_overCurrentLimit() {\n return this.liveFunc._overCurrentLimit;\n }", "title": "" }, { "docid": "df64cb77064c8ccbfc5f93a99823f80d", "score": "0.5072249", "text": "function foo() {console.log(this.x);}", "title": "" }, { "docid": "0ec1d580d81e3639fdc7c9f2d3858f49", "score": "0.5070126", "text": "function foo(something) {\r\n console.log(this.a, something);\r\n return this.a + something;\r\n}", "title": "" }, { "docid": "6052e4ac27b5dae066e606db5276224a", "score": "0.5068655", "text": "min() {\n return this.left.H() ? this : this.left.min();\n }", "title": "" }, { "docid": "3b0372696536905df84ff1e428f52e82", "score": "0.50661373", "text": "function a(x) {\n\tthis.m = x;\n\tthis;\n }", "title": "" }, { "docid": "3b5b0cfb7e3c51483b298892ebf62cd5", "score": "0.50552034", "text": "constructor(value) {\r\n this.value = value;\r\n this.larger = null;\r\n this.smaller = null;\r\n }", "title": "" }, { "docid": "b42336f791a0a17abdda0a54e5d6ac49", "score": "0.50440687", "text": "nextLarger(lowerBound) {\n return (this.root ? this.root.findNextLarger(lowerBound) : null);\n }", "title": "" }, { "docid": "5d9ca72941ba26299606ca9337b7672f", "score": "0.5031628", "text": "function f1() {\n return this;\n}", "title": "" }, { "docid": "590d8d10f59ff0ad82ecaec79a7d38fb", "score": "0.50301844", "text": "function f() {\n return this.a;\n }", "title": "" }, { "docid": "47bcc84a4b84b494e1a47a58f00b5508", "score": "0.50278664", "text": "distanceTo(that) {\n \n var minDistance = Number.MAX_VALUE;\n for (let thisBlock of this.occupiedBlocks()) {\n for (let thatBlock of that.occupiedBlocks()) {\n\n if (thisBlock.distanceTo(thatBlock) < minDistance) {\n minDistance = thisBlock.distanceTo(thatBlock);\n }\n }\n }\n return minDistance;\n }", "title": "" }, { "docid": "9f6e840e21411141e13749e5dcd9e302", "score": "0.5020842", "text": "function foo(something) {\n console.log(this.a, something);\n return this.a + something;\n}", "title": "" }, { "docid": "9f6e840e21411141e13749e5dcd9e302", "score": "0.5020842", "text": "function foo(something) {\n console.log(this.a, something);\n return this.a + something;\n}", "title": "" }, { "docid": "15caf82941cbc6477ccb9931c967576d", "score": "0.5015098", "text": "function foo(sth) {\n console.log(this.a, sth)\n return this.a + sth\n}", "title": "" }, { "docid": "b50c36d093c1561a050d2b5725029771", "score": "0.5011661", "text": "function B(a){this.yl=a}", "title": "" }, { "docid": "72d1dcad41658ebf267c21e016d112f8", "score": "0.500996", "text": "function myFunction() {\n return this;}", "title": "" }, { "docid": "9d6e24e785e7a7335748d768da157924", "score": "0.50068414", "text": "function larger(a, b) {\n if (a > b) {\n return a;\n } else {\n return b;\n }\n}", "title": "" }, { "docid": "e41df797c48d042d8ceb989393b6c28e", "score": "0.50058484", "text": "ot() {\n return this.min().key;\n }", "title": "" }, { "docid": "c5b5e59535debd65dabe75d6f5bc19a0", "score": "0.50018036", "text": "function isThisless(symbol){if(symbol.declarations&&symbol.declarations.length===1){var declaration=symbol.declarations[0];if(declaration){switch(declaration.kind){case 159/* PropertyDeclaration */:case 158/* PropertySignature */:return isThislessVariableLikeDeclaration(declaration);case 161/* MethodDeclaration */:case 160/* MethodSignature */:case 162/* Constructor */:case 163/* GetAccessor */:case 164/* SetAccessor */:return isThislessFunctionLikeDeclaration(declaration);}}}return false;}// The mappingThisOnly flag indicates that the only type parameter being mapped is \"this\". When the flag is true,", "title": "" }, { "docid": "a2cab7562eef9c8687fdfb301ac2d9f4", "score": "0.4997514", "text": "function myfunction5() {\n return this; \n}", "title": "" }, { "docid": "9512a5c09eedc0bb5efa69a4ca589ea1", "score": "0.49938658", "text": "function z(){this.o=new Eb;Object.defineProperty(this,\"size\",{get:function(){return this.o.yc()}})}", "title": "" }, { "docid": "f9f286fe348c61277f3d3af33a084701", "score": "0.49932998", "text": "nextLarger(lowerBound) {\n let nextLargerResult = null;\n let nodeStack = [this.root];\n while (nodeStack.length) {\n let current = nodeStack.pop();\n if (current !== null) {\n if (\n current.val > lowerBound &&\n (nextLargerResult === null || current.val < nextLargerResult)\n )\n nextLargerResult = current.val;\n nodeStack.push(current.left);\n nodeStack.push(current.right);\n }\n }\n return nextLargerResult;\n }", "title": "" }, { "docid": "e7b2fa3b4f75d3654200af8afb5984dd", "score": "0.4993137", "text": "function foo() {\r\n setTimeout(() => {\r\n // this here is lexically adopted from foo()\r\n console.log(this.a);\r\n }, 100);\r\n}", "title": "" }, { "docid": "4a562d1c9aa49900e01ae5a901e8e083", "score": "0.49878293", "text": "function Foo(){\n this.A = 1;\n this.B = 2;\n\n return this;\n}", "title": "" }, { "docid": "5bbca838e14035c9ba6621d066ae74a5", "score": "0.4987671", "text": "function testEvalRenamedThis_0() {\n x = 0;\n function test() {\n var o = {x:1};\n function func() {f = eval; f(\"x++; this.x++\");}\n func.call(o);\n assertEquals(1,o.x);\n }\n test();\n assertEquals(2,x);\n}", "title": "" }, { "docid": "5600953e08620e0c61627119dc943d2c", "score": "0.49864152", "text": "function BaseSequence() {\n return this;\n}", "title": "" }, { "docid": "95dcecf95b72bd6079423fdafe0ab619", "score": "0.49841237", "text": "function findMaxLength(prev,current){\n if(prev.length > current.length) return prev;\n else return current;\n }", "title": "" }, { "docid": "d39fb19f4aec38c34aaaa3e006b0e8e7", "score": "0.49802312", "text": "function length(){\n return this.top;\n}", "title": "" }, { "docid": "e048be8a1eb91e7bba8c78229293f660", "score": "0.49787408", "text": "function test () {\n // invalid use of this, not_used is not used\n var not_used = this.value;\n return null;\n}", "title": "" }, { "docid": "ec1334930869eae27ad07d536ce2b914", "score": "0.49784353", "text": "function y() {\n console.log(this.length)\n}", "title": "" }, { "docid": "9ce6426c276d332ce69c4002fb07ab6e", "score": "0.49770424", "text": "nextLarger(lowerBound) {\n if (!this.root) return null;\n\n let queue = [this.root];\n let topper = null;\n\n while (queue.length) {\n let currNode = queue.shift();\n let currVal = currNode.val;\n let topsLB = currVal > lowerBound;\n let reassign = currVal < topper || topper === null;\n\n if (topsLB && reassign) {\n topper = currVal\n }\n\n if (currNode.left) queue.push(currNode.left);\n if (currNode.right) queue.push(currNode.right);\n\n }\n\n return topper;\n\n }", "title": "" }, { "docid": "a6f9659609b31e80501dfd7fab826e5c", "score": "0.49763396", "text": "latest() {\n return this.current;\n }", "title": "" }, { "docid": "0d0b1cf358411ce9d41a75edb64a9ba5", "score": "0.49736935", "text": "function a(){\n console.log(\"a:this\" + this.x);\n}", "title": "" }, { "docid": "95a0ecb46959e3c45b0db03de37f83fc", "score": "0.4972001", "text": "function parent() {\n console.log(this);\n return 0;\n}", "title": "" } ]
624f216535dcff4e02f94db4260afba9
eslintdisable nobitwise, nocondassign HTML DOM and SVG DOM may have different support levels, so we need to check on context instead of a document root element.
[ { "docid": "85cf76eb2830f8c6b1ed6d1f621e89ee", "score": "0.5354595", "text": "function contains(context, node) {\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n}", "title": "" } ]
[ { "docid": "475dcc328ce26de9ecacf26f93de145a", "score": "0.64540833", "text": "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n }", "title": "" }, { "docid": "7442df7f09d8ecafc7180621960e5245", "score": "0.63931876", "text": "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n}", "title": "" }, { "docid": "7442df7f09d8ecafc7180621960e5245", "score": "0.63931876", "text": "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n}", "title": "" }, { "docid": "7442df7f09d8ecafc7180621960e5245", "score": "0.63931876", "text": "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n}", "title": "" }, { "docid": "7442df7f09d8ecafc7180621960e5245", "score": "0.63931876", "text": "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);\n}", "title": "" }, { "docid": "49d5f1c9e0b0b166228625996297153f", "score": "0.620804", "text": "static IsDOM (node) {\n\t\treturn node && typeof(node.getBBox) === \"undefined\";\n\t}", "title": "" }, { "docid": "d3214081dea9080565b60dd0a168dba8", "score": "0.605552", "text": "function svgEnabled() {\n var d = document;\n return (!!d.createElementNS &&\n !!d.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect);\n}", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "67588ca21d89ac748263efffeda9812e", "score": "0.60420275", "text": "get SUPPORT_SVG_DRAWING() {\n 'use strict';\n\n var value = testSVG(document);\n Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });\n return value;\n }", "title": "" }, { "docid": "3041b29313b6cc2534eaeca9738b53be", "score": "0.59188396", "text": "function canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}", "title": "" }, { "docid": "e90f2f7c6afe5cdc32ad4a9bde417318", "score": "0.59187764", "text": "function a(e,t){return!!t&&(e===t.documentElement||e===t.body)}", "title": "" }, { "docid": "def900ef613fa441ac7b0e63db7f081e", "score": "0.5896728", "text": "function supportsSvg() {\n\t\treturn !! document.createElementNS &&\n\t\t\t!! document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\").createSVGRect;\n\t}", "title": "" }, { "docid": "8f5aeb1c51e031ad3bccbabc8f3a198d", "score": "0.5887564", "text": "function isSvgDocOrElement(elem) {\n var isSvg = false;\n var parent = elem;\n\n while ((parent != null) && (parent != document)) {\n if (parent.tagName == \"svg\") {\n isSvg = true;\n break;\n }\n\n if (parent.tagName == \"foreignObject\") {\n isSvg = false;\n break;\n }\n\n if (parent.parentNode == null) {\n // CHW: return true when root is an SVG.*Element\n var cname = parent.constructor.toString();\n\n if (cname.match(/object SVG.*Element/i)) {\n // consider part of SVG tree if root element is an SVG element\n isSvg = true;\n break;\n }\n }\n\n parent = parent.parentNode;\n }\n\n return isSvg;\n }", "title": "" }, { "docid": "a4c817ddba0673fc866b1bf9cd058f96", "score": "0.58150285", "text": "isDomNode(o) {\n return (\n typeof Node === \"object\" ? o instanceof Node :\n o && typeof o === \"object\" && typeof o.nodeType === \"number\" && typeof o.nodeName === \"string\"\n );\n }", "title": "" }, { "docid": "ca9afe4b9a49e1b1565ab238b502e6c8", "score": "0.5800435", "text": "function isSvgElement(obj) {\n var isSvg = (obj && obj.tagName == \"svg\") ? false : vp.utils.isSvgDocOrElement(obj);\n return isSvg;\n }", "title": "" }, { "docid": "d18eb13cbc883faefdfb423b709d208b", "score": "0.57138944", "text": "function SVGElement() {}", "title": "" }, { "docid": "d18eb13cbc883faefdfb423b709d208b", "score": "0.57138944", "text": "function SVGElement() {}", "title": "" }, { "docid": "d18eb13cbc883faefdfb423b709d208b", "score": "0.57138944", "text": "function SVGElement() {}", "title": "" }, { "docid": "d18eb13cbc883faefdfb423b709d208b", "score": "0.57138944", "text": "function SVGElement() {}", "title": "" }, { "docid": "e9aaf3f4c3fbc0ecde013662853c389d", "score": "0.5709128", "text": "function No() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}", "title": "" }, { "docid": "9e80226fe989decd20c8306d085fac41", "score": "0.56858635", "text": "function SVGElement () {}", "title": "" }, { "docid": "0e234d79af707d055a9d88de5540c16e", "score": "0.568145", "text": "function isDomNode(x) {\n return (x.nodeType != undefined);\n }", "title": "" }, { "docid": "017cffb3e23520c05071fd43a29c93bf", "score": "0.5658796", "text": "function v(){return\"undefined\"!=typeof window&&\"undefined\"!=typeof document&&\"function\"==typeof document.createElement}", "title": "" }, { "docid": "8472537ff7bb76327fda88b45cef647d", "score": "0.5657189", "text": "function isDocumentElement(el) {\n return [document.documentElement, document.body, window].indexOf(el) > -1;\n}", "title": "" }, { "docid": "8472537ff7bb76327fda88b45cef647d", "score": "0.5657189", "text": "function isDocumentElement(el) {\n return [document.documentElement, document.body, window].indexOf(el) > -1;\n}", "title": "" }, { "docid": "8472537ff7bb76327fda88b45cef647d", "score": "0.5657189", "text": "function isDocumentElement(el) {\n return [document.documentElement, document.body, window].indexOf(el) > -1;\n}", "title": "" }, { "docid": "06fa5f4dd30dc0435108c6e22349f8cc", "score": "0.56083494", "text": "function n(e){var t=e?e.ownerDocument||e:document,n=t.defaultView||window;return!(!e||!(\"function\"==typeof n.Node?e instanceof n.Node:\"object\"==typeof e&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName))}", "title": "" }, { "docid": "bcef2a0fa2e57f4cded030978a78de1d", "score": "0.5599734", "text": "function n(e){var t=(e?e.ownerDocument||e:document).defaultView||window;return!(!e||!(\"function\"==typeof t.Node?e instanceof t.Node:\"object\"==typeof e&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName))}", "title": "" }, { "docid": "bd0b9078e5f551d97fdbaec7450151ee", "score": "0.55764866", "text": "function n(e){var n,r=null;\n// Provides a safe context\nreturn!i&&document.implementation&&document.implementation.createHTMLDocument&&(n=document.implementation.createHTMLDocument(\"foo\"),n.documentElement||(\"production\"!==t.env.NODE_ENV?o(!1,\"Missing doc.documentElement\"):o(!1)),n.documentElement.innerHTML=e,r=n.getElementsByTagName(\"body\")[0]),r}", "title": "" }, { "docid": "98c80f2d36e28b1356db8d453a72c3ee", "score": "0.55466855", "text": "static isHTMLElement(o) {\n /* eslint-disable no-undef */\n if (typeof HTMLElement === 'object') {\n return o instanceof HTMLElement;\n }\n /* eslint-enable no-undef */\n return (\n o &&\n typeof o === 'object' &&\n o !== null &&\n o.nodeType === 1 &&\n typeof o.nodeName === 'string'\n );\n }", "title": "" }, { "docid": "c8078880b70d11500722737ccd5fa49b", "score": "0.55446076", "text": "function isHTMLElement(node) {\n var OwnElement = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__getWindow_js__[\"a\" /* default */])(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "13f6558d415faca8008945baec825d9d", "score": "0.55367345", "text": "function or() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}", "title": "" }, { "docid": "3eee9334634f6bb5a01c337882cfc72e", "score": "0.55131716", "text": "function isHTMLElement(node) {\n var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "3eee9334634f6bb5a01c337882cfc72e", "score": "0.55131716", "text": "function isHTMLElement(node) {\n var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "3eee9334634f6bb5a01c337882cfc72e", "score": "0.55131716", "text": "function isHTMLElement(node) {\n var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "3eee9334634f6bb5a01c337882cfc72e", "score": "0.55131716", "text": "function isHTMLElement(node) {\n var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "f12e9fa1de54b3986ae1c526b275940c", "score": "0.55129755", "text": "function isValidContainerLegacy(node) {\n return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));\n}", "title": "" }, { "docid": "069f2a2fca32fd790b21c168eaf7e724", "score": "0.55102366", "text": "function zr() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}", "title": "" }, { "docid": "1588608d885d5718d27327643f1486a3", "score": "0.5502059", "text": "function isElement(o){\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : /*DOM2*/\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName===\"string\"\n );\n }", "title": "" }, { "docid": "d90c23c1f30e8efb74c4106ba619090c", "score": "0.5487509", "text": "createSvgFragment(ctxt) {\n throw \"ChantLayout Elements must implement createSvgFragment(ctxt)\";\n }", "title": "" }, { "docid": "4f3e8a1f556e74fb2d3af5443443ceee", "score": "0.54685557", "text": "function t(e){return!(!e||!(\"function\"==typeof Node?e instanceof Node:\"object\"==typeof e&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName))}", "title": "" }, { "docid": "4f3e8a1f556e74fb2d3af5443443ceee", "score": "0.54685557", "text": "function t(e){return!(!e||!(\"function\"==typeof Node?e instanceof Node:\"object\"==typeof e&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName))}", "title": "" }, { "docid": "4f3e8a1f556e74fb2d3af5443443ceee", "score": "0.54685557", "text": "function t(e){return!(!e||!(\"function\"==typeof Node?e instanceof Node:\"object\"==typeof e&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName))}", "title": "" }, { "docid": "ae2cdb0f19fa4f6bbba3aaee57b3e999", "score": "0.5461248", "text": "function d7_documentElement(node){\n return node && (node.ownerDocument || node || node.document).documentElement; \n}", "title": "" }, { "docid": "2c00a0d10563cfdb41abafe66f534484", "score": "0.5456655", "text": "function isElement(o) {\n return typeof HTMLElement === \"object\"\n ? o instanceof HTMLElement //DOM2\n : o &&\n typeof o === \"object\" &&\n o.nodeType === 1 &&\n typeof o.nodeName === \"string\";\n }", "title": "" }, { "docid": "cf30743f1f3ca39a79485f5e3e4826eb", "score": "0.5430565", "text": "static IsSVG (node) {\n\t\t// SEE: http://www.w3.org/TR/SVG11/types.html#__svg__SVGLocatable__getBBox\n\t\treturn typeof(node.getBBox) != \"undefined\";\n\t}", "title": "" }, { "docid": "8b859d4d17f845c106b4537d64eefcfa", "score": "0.54292655", "text": "function isBrowser() {\n return _.isObject(document) && !!document;\n}", "title": "" }, { "docid": "b385523f7733bbea68cfb753e53a17b3", "score": "0.5414456", "text": "function isElement(o){\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName===\"string\"\n );\n }", "title": "" }, { "docid": "84361e472bc21607f338ef04494b1126", "score": "0.54126394", "text": "function isElement(o) {\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName === \"string\"\n );\n }", "title": "" }, { "docid": "8f3ed2dc34c699918b5a554e8318fce5", "score": "0.54116946", "text": "function contains(context, node) {\n if (context.contains) return context.contains(node)\n if (context.compareDocumentPosition)\n return context === node || !!(context.compareDocumentPosition(node) & 16)\n }", "title": "" }, { "docid": "682079c73af594159dd3707d0c2c564a", "score": "0.5405232", "text": "_isAttachedToDOM() {\n const element = this._elementRef.nativeElement;\n if (element.getRootNode) {\n const rootNode = element.getRootNode();\n // If the element is inside the DOM the root node will be either the document\n // or the closest shadow root, otherwise it'll be the element itself.\n return rootNode && rootNode !== element;\n }\n // Otherwise fall back to checking if it's in the document. This doesn't account for\n // shadow DOM, however browser that support shadow DOM should support `getRootNode` as well.\n return document.documentElement.contains(element);\n }", "title": "" }, { "docid": "18a78bca35a405b5fdf94d6398439109", "score": "0.54014754", "text": "function isElement(o) {\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName === \"string\"\n );\n }", "title": "" }, { "docid": "8b923bac6657ecb5cd52025322b13fca", "score": "0.5398883", "text": "function supportsInlineSVG() {\n var div = document.createElement( 'div' );\n div.innerHTML = '<svg/>';\n\n return 'http://www.w3.org/2000/svg' === ( 'undefined' !== typeof SVGRect && div.firstChild && div.firstChild.namespaceURI );\n }", "title": "" }, { "docid": "83f6e15e7199a252858f5502283e83d3", "score": "0.5384454", "text": "function CheckBrowserSupport()\n{\n if(BattleCouch.IsSimulator() || UseMouseClick())\n {\n // Note : Not working on React components\n if (!('ontouchstart' in document.createElement('div')))\n {\n let elements = document.getElementsByTagName('*');\n for (let i = 0; i < elements.length; ++i)\n {\n let element = elements[i];\n let onTouchStartAttribute = element.getAttribute('ontouchstart');\n let onTouchEndAttribute = element.getAttribute('ontouchend');\n if (onTouchStartAttribute)\n element.setAttribute('onmousedown', onTouchStartAttribute);\n if (onTouchEndAttribute)\n element.setAttribute('onmouseup', onTouchEndAttribute);\n }\n }\n }\n}", "title": "" }, { "docid": "e5c5ac63b6244af17f70034aed073980", "score": "0.5376198", "text": "function f(e){\n// must use == for ie8\n/* eslint eqeqeq:0 */\nreturn null!=e&&e==e.window}", "title": "" }, { "docid": "a3a663da2b012338a6e205db9ad531d5", "score": "0.536258", "text": "function hasDocument() {\n return typeof document !== \"undefined\";\n}", "title": "" }, { "docid": "8c9ad96b9eec72f98a1be95f6921f698", "score": "0.53590864", "text": "function checkGlobal(value){return value && value.Object === Object?value:undefined;} // element ids can ruin global miss checks", "title": "" }, { "docid": "8c9ad96b9eec72f98a1be95f6921f698", "score": "0.53590864", "text": "function checkGlobal(value){return value && value.Object === Object?value:undefined;} // element ids can ruin global miss checks", "title": "" }, { "docid": "43c9bb9fab4d63e50fe146bffda699f1", "score": "0.5354038", "text": "function isHTMLElement(node) {\n var OwnElement = (0, _getWindow.default)(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "43c9bb9fab4d63e50fe146bffda699f1", "score": "0.5354038", "text": "function isHTMLElement(node) {\n var OwnElement = (0, _getWindow.default)(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "3895e2aaa24e789098f92f5b9bc563fc", "score": "0.5353049", "text": "function isElement (o) {\n return (\n typeof window.HTMLElement === 'object'\n ? o instanceof window.HTMLElement // DOM2\n : o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string'\n )\n}", "title": "" }, { "docid": "62723bb44343718b9dcfcc3094b9dc15", "score": "0.53514856", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n }", "title": "" }, { "docid": "62723bb44343718b9dcfcc3094b9dc15", "score": "0.53514856", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n }", "title": "" }, { "docid": "62723bb44343718b9dcfcc3094b9dc15", "score": "0.53514856", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n }", "title": "" }, { "docid": "4efa908a309af77b0d87af7d1b9cc6ac", "score": "0.53419816", "text": "isDomElement(o) {\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName === \"string\"\n );\n }", "title": "" }, { "docid": "62ecb27123558fc4868d0c85e11704d5", "score": "0.53384906", "text": "function l(e){\n// must use == for ie8\n/* eslint eqeqeq:0 */\nreturn null!==e&&void 0!==e&&e==e.window}", "title": "" }, { "docid": "d15026d6ab8a4bcb1130af829e868511", "score": "0.53320444", "text": "function hasSvgNamespace(obj){\n return obj && obj.namespaceURI && obj.namespaceURI === svgns;\n }", "title": "" }, { "docid": "e21886d368c4a1a7cce8a08f7caf9b6e", "score": "0.5331315", "text": "function isStandardBrowserEnv(){return typeof window!=='undefined'&&typeof document!=='undefined'&&typeof document.createElement==='function';}", "title": "" }, { "docid": "0268f1f3d41f35e4e1103d809222353d", "score": "0.5323009", "text": "function checkSupport() {\n canvas = document.createElement('canvas');\n\n if (canvas && canvas.getContext) {\n context = canvas.getContext('2d');\n supported = true;\n } else {\n supported = false;\n }\n }", "title": "" }, { "docid": "216e4d7c38e8669cc85582d781d12dd6", "score": "0.5316705", "text": "function isHTMLElement (node) {\n const OwnElement = getWindow (node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "title": "" }, { "docid": "070706a5030b80f4e68ff83159ac5171", "score": "0.5312464", "text": "function isElement(o) {\n\n return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? o instanceof HTMLElement : o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';\n}", "title": "" }, { "docid": "c7b2157e0d82b79bd7ebe10f641ef183", "score": "0.53093463", "text": "function isElement(o){\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName===\"string\"\n );\n}", "title": "" }, { "docid": "c7b2157e0d82b79bd7ebe10f641ef183", "score": "0.53093463", "text": "function isElement(o){\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName===\"string\"\n );\n}", "title": "" }, { "docid": "aa7f48353ca1192c96e8c4c53abd57a4", "score": "0.53034395", "text": "function isElement(o){\n\t return (\n\t typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n\t o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName===\"string\"\n\t );\n\t}", "title": "" }, { "docid": "b910440c4940860ab512e557891da367", "score": "0.5298872", "text": "function isElement(o) {\r\n return (typeof HTMLElement === 'object' ? o instanceof HTMLElement : o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string');\r\n}", "title": "" }, { "docid": "83ef62c603232c59b45fa60308f7a893", "score": "0.5293387", "text": "function checkGlobal(value) {\n return value && value.Object === Object ? value : undefined;\n } // element ids can ruin global miss checks", "title": "" }, { "docid": "83ef62c603232c59b45fa60308f7a893", "score": "0.5293387", "text": "function checkGlobal(value) {\n return value && value.Object === Object ? value : undefined;\n } // element ids can ruin global miss checks", "title": "" }, { "docid": "83ef62c603232c59b45fa60308f7a893", "score": "0.5293387", "text": "function checkGlobal(value) {\n return value && value.Object === Object ? value : undefined;\n } // element ids can ruin global miss checks", "title": "" }, { "docid": "83ef62c603232c59b45fa60308f7a893", "score": "0.5293387", "text": "function checkGlobal(value) {\n return value && value.Object === Object ? value : undefined;\n } // element ids can ruin global miss checks", "title": "" }, { "docid": "504b4192bc91f7a0940ba374010c049c", "score": "0.5290645", "text": "function ngxChartsPolyfills() {\r\n // IE11 fix\r\n // Ref: https://github.com/swimlane/ngx-charts/issues/386\r\n if (typeof (SVGElement) !== 'undefined' && typeof SVGElement.prototype.contains === 'undefined') {\r\n SVGElement.prototype.contains = HTMLDivElement.prototype.contains;\r\n }\r\n}", "title": "" }, { "docid": "504b4192bc91f7a0940ba374010c049c", "score": "0.5290645", "text": "function ngxChartsPolyfills() {\r\n // IE11 fix\r\n // Ref: https://github.com/swimlane/ngx-charts/issues/386\r\n if (typeof (SVGElement) !== 'undefined' && typeof SVGElement.prototype.contains === 'undefined') {\r\n SVGElement.prototype.contains = HTMLDivElement.prototype.contains;\r\n }\r\n}", "title": "" }, { "docid": "b6a78cad935a5ec7a5cefb7bf16d7d72", "score": "0.5268967", "text": "function checkElementIdShadowing(value) {\n return value && value.nodeType === undefined ? value : undefined;\n }", "title": "" }, { "docid": "86f55ca3eb68f5da513fdc516140b46a", "score": "0.5268852", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}", "title": "" }, { "docid": "86f55ca3eb68f5da513fdc516140b46a", "score": "0.5268852", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}", "title": "" }, { "docid": "86f55ca3eb68f5da513fdc516140b46a", "score": "0.5268852", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}", "title": "" }, { "docid": "86f55ca3eb68f5da513fdc516140b46a", "score": "0.5268852", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}", "title": "" }, { "docid": "86f55ca3eb68f5da513fdc516140b46a", "score": "0.5268852", "text": "function isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}", "title": "" } ]
733b8d02ed429b1ad49814cfe6b56ed9
Copyright Joyent, Inc. and other Node contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. resolves . and .. elements in a path array with directory names there must be no slashes, empty elements, or device names (c:\) in the array (so also no leading and trailing slashes it does not distinguish relative and absolute paths)
[ { "docid": "a4066c37ae4262eaeebb866479c680c5", "score": "0.0", "text": "function normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}", "title": "" } ]
[ { "docid": "add373005c0c9b270a75a648fb011621", "score": "0.59586495", "text": "function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s\nif(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "add373005c0c9b270a75a648fb011621", "score": "0.59586495", "text": "function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s\nif(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "add373005c0c9b270a75a648fb011621", "score": "0.59586495", "text": "function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s\nif(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "d6edd5f2c53d958a5928a0a1cbf1ba00", "score": "0.5872318", "text": "function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s\nif(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// path.resolve([from ...], to)", "title": "" }, { "docid": "cf78269cd4ae988b59d892f9310a3f95", "score": "0.58318627", "text": "function normalizeArray(parts,allowAboveRoot){ // if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length;i >= 0;i--) {var last=parts[i];if(last == '.'){parts.splice(i,1);}else if(last === '..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}} // if the path is allowed to go above the root, restore leading ..s\nif(allowAboveRoot){for(;up--;up) {parts.unshift('..');}}return parts;} // Regex to split a filename into [*, dir, basename, ext]", "title": "" }, { "docid": "208a6f58ea9258758867e032ec5ca1b4", "score": "0.57520247", "text": "function resolvePathDots(input) {\n var output = [];\n input.replace(/^(\\.\\.?(\\/|$))+/, '')\n .replace(/\\/(\\.(\\/|$))+/g, '/')\n .replace(/\\/\\.\\.$/, '/../')\n .replace(/\\/?[^\\/]*/g, function (part) { part === '/..' ? output.pop() : output.push(part); });\n return output.join('').replace(/^\\//, input.charAt(0) === '/' ? '/' : '');\n }", "title": "" }, { "docid": "e714081c426c1d5bdd63cefb7309f26a", "score": "0.5688383", "text": "function normalizePath(path) {\n if (path instanceof Array) {\n return path;\n }\n if (typeof(path) == \"number\") {\n return [path];\n }\n // if (typeof(path) == \"string\") {\n // path = path.split(\".\");\n // var out = [];\n // for (var i=0; i<path.length; i++) {\n // var part = path[i];\n // if (String(parseInt(part, 10)) == part) {\n // out.push(parseInt(part, 10));\n // } else {\n // out.push(part);\n // }\n // }\n // return out;\n // }\n }", "title": "" }, { "docid": "d45fe1a772da99e472357cdb5d058ecc", "score": "0.56818885", "text": "compatibility() {\n this.args.paths = Object.entries(this.args.paths).map(([id, path]) => ({ id, path }));\n }", "title": "" }, { "docid": "58ead6bbc6b2e8fe93b215a6473e4974", "score": "0.56756157", "text": "function normalizePath(p) {\n return sources_path/* npath.toPortablePath */.cS.toPortablePath(p);\n }", "title": "" }, { "docid": "7646d6ec963b1075e58af636b154a640", "score": "0.56698835", "text": "function p(...paths) {\n return path.join(__dirname, ...paths);\n}", "title": "" }, { "docid": "c6ffe200f9b8c43af5d5475240e1e75d", "score": "0.5616949", "text": "normalizePath(p) {\n return p.split(path.sep).join('/');\n }", "title": "" }, { "docid": "30e765e807e261a881014039e73aa24d", "score": "0.5595945", "text": "function pathParse() {\n const pathParse = path.parse(__dirname);\n console.log(pathParse);\n}", "title": "" }, { "docid": "c880626e0519f6924009b7b7faed5579", "score": "0.55689573", "text": "function matchFileNames(fileNames,include,exclude,basePath,options,host,errors,extraFileExtensions){basePath=ts.normalizePath(basePath);// The exclude spec list is converted into a regular expression, which allows us to quickly\n// test whether a file or directory should be excluded before recursively traversing the\n// file system.\nvar keyMapper=host.useCaseSensitiveFileNames?caseSensitiveKeyMapper:caseInsensitiveKeyMapper;// Literal file names (provided via the \"files\" array in tsconfig.json) are stored in a\n// file map with a possibly case insensitive key. We use this map later when when including\n// wildcard paths.\nvar literalFileMap=ts.createMap();// Wildcard paths (provided via the \"includes\" array in tsconfig.json) are stored in a\n// file map with a possibly case insensitive key. We use this map to store paths matched\n// via wildcard, and to handle extension priority.\nvar wildcardFileMap=ts.createMap();if(include){include=validateSpecs(include,errors,/*allowTrailingRecursion*/false);}if(exclude){exclude=validateSpecs(exclude,errors,/*allowTrailingRecursion*/true);}// Wildcard directories (provided as part of a wildcard path) are stored in a\n// file map that marks whether it was a regular wildcard match (with a `*` or `?` token),\n// or a recursive directory. This information is used by filesystem watchers to monitor for\n// new entries in these paths.\nvar wildcardDirectories=getWildcardDirectories(include,exclude,basePath,host.useCaseSensitiveFileNames);// Rather than requery this for each file and filespec, we query the supported extensions\n// once and store it on the expansion context.\nvar supportedExtensions=ts.getSupportedExtensions(options,extraFileExtensions);// Literal files are always included verbatim. An \"include\" or \"exclude\" specification cannot\n// remove a literal file.\nif(fileNames){for(var _i=0,fileNames_1=fileNames;_i<fileNames_1.length;_i++){var fileName=fileNames_1[_i];var file=ts.combinePaths(basePath,fileName);literalFileMap.set(keyMapper(file),file);}}if(include&&include.length>0){for(var _a=0,_b=host.readDirectory(basePath,supportedExtensions,exclude,include);_a<_b.length;_a++){var file=_b[_a];// If we have already included a literal or wildcard path with a\n// higher priority extension, we should skip this file.\n//\n// This handles cases where we may encounter both <file>.ts and\n// <file>.d.ts (or <file>.js if \"allowJs\" is enabled) in the same\n// directory when they are compilation outputs.\nif(hasFileWithHigherPriorityExtension(file,literalFileMap,wildcardFileMap,supportedExtensions,keyMapper)){continue;}// We may have included a wildcard path with a lower priority\n// extension due to the user-defined order of entries in the\n// \"include\" array. If there is a lower priority extension in the\n// same directory, we should remove it.\nremoveWildcardFilesWithLowerPriorityExtension(file,wildcardFileMap,supportedExtensions,keyMapper);var key=keyMapper(file);if(!literalFileMap.has(key)&&!wildcardFileMap.has(key)){wildcardFileMap.set(key,file);}}}var literalFiles=ts.arrayFrom(literalFileMap.values());var wildcardFiles=ts.arrayFrom(wildcardFileMap.values());return{fileNames:literalFiles.concat(wildcardFiles),wildcardDirectories:wildcardDirectories};}", "title": "" }, { "docid": "7409c1c735fdaec15c57616a5b414af4", "score": "0.55613685", "text": "get_paths () {\n\t\t\n\t}", "title": "" }, { "docid": "393f06d2bd5ff3636337fb85af9fda26", "score": "0.55480707", "text": "function path(...name) {\n return join(rootDir, ...name);\n}", "title": "" }, { "docid": "f6b6048efb09c04e7a9027039add5eba", "score": "0.5528355", "text": "constructor(rootArray) {\n\n this.path = path.dirname(rootArray);\n\n [this.module, this.array] = path.basename(rootArray).split('.');\n }", "title": "" }, { "docid": "8aff37197c73154dd64ab9117806f31d", "score": "0.54558516", "text": "static normalize(path) {\n let source = path.split(/\\/+/)\n let target = []\n\n for(let token of source) {\n if(token === '..') {\n target.pop()\n } else if(token !== '' && token !== '.') {\n target.push(token)\n }\n }\n\n if(path.charAt(0) === '/')\n return '/' + target.join('/')\n else\n return target.join('/')\n }", "title": "" }, { "docid": "5b504e7a60f12626dfa94c24fc6a4f5f", "score": "0.5451594", "text": "function resolvePath(path) {\n var paths = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n paths[_i - 1] = arguments[_i];\n }\n return normalizePath(ts.some(paths) ? combinePaths.apply(void 0, __spreadArray([path], paths, false)) : normalizeSlashes(path));\n }", "title": "" }, { "docid": "28fffb3bd20d3de5ef419df73fdceb2e", "score": "0.5434569", "text": "function join(...paths) {\n // console.log('-----------------');\n // console.log(paths);\n return path.join(__root, paths);\n}", "title": "" }, { "docid": "5793ef6c945c7a6d7fce4c9bc66dcee3", "score": "0.54306", "text": "function filesystemPathHelpers () {\n let nodePath = host.node ? require(\"path\") : null;\n let nodeUrl = host.node ? require(\"url\") : null;\n let testsDir = nodePath.resolve(__dirname, \"..\");\n let isWindows = /^win/.test(process.platform);\n\n // Run all tests from the \"test\" directory\n process.chdir(nodePath.join(__dirname, \"..\"));\n\n const path = {\n /**\n * Returns the relative path of a file in the \"test\" directory\n */\n rel (file) {\n return nodePath.normalize(file);\n },\n\n /**\n * Returns the absolute path of a file in the \"test\" directory\n */\n abs (file) {\n file = nodePath.join(testsDir, file || nodePath.sep);\n return file;\n },\n\n /**\n * Returns the path of a file in the \"test\" directory as a URL.\n * (e.g. \"file://path/to/json-schema-ref-parser/test/files...\")\n */\n url (file) {\n let pathname = path.abs(file);\n\n if (isWindows) {\n pathname = pathname.replace(/\\\\/g, \"/\"); // Convert Windows separators to URL separators\n }\n\n let url = nodeUrl.format({\n protocol: \"file:\",\n slashes: true,\n pathname\n });\n\n return url;\n },\n\n /**\n * Returns the absolute path of the current working directory.\n */\n cwd () {\n return nodePath.join(process.cwd(), nodePath.sep);\n }\n };\n\n return path;\n}", "title": "" }, { "docid": "13083d4a8c2cef5981b8d888b2ad8fa7", "score": "0.5411584", "text": "function getPaths(paths) {\n return {\n components: {\n src: process.cwd() + '/' + paths.base.src + paths.components.src,\n },\n css: {\n dist: process.cwd() + '/' + paths.base.dist + paths.css.dist,\n src: process.cwd() + '/' + paths.base.src + paths.css.src,\n },\n favicon: {\n dist: process.cwd() + '/' + paths.base.dist + paths.favicon.dist,\n src: process.cwd() + '/' + paths.base.src + paths.favicon.src,\n },\n icon: {\n dist: process.cwd() + '/' + paths.base.dist + paths.icon.dist,\n src: process.cwd() + '/' + paths.base.src + paths.icon.src,\n },\n img: {\n dist: process.cwd() + '/' + paths.base.dist + paths.img.dist,\n src: process.cwd() + '/' + paths.base.src + paths.img.src,\n },\n js: {\n dist: process.cwd() + '/' + paths.base.dist + paths.js.dist,\n src: process.cwd() + '/' + paths.base.src + paths.js.src,\n },\n templates: {\n dist: process.cwd() + '/' + paths.base.dist + paths.templates.dist,\n src: process.cwd() + '/' + paths.base.src + paths.templates.src,\n },\n starter: {\n backups: process.cwd() + '/_starter/backups/',\n build: process.cwd() + paths.base.build,\n components: process.cwd() + '/_starter/components/',\n templates: process.cwd() + '/_starter/templates/',\n styleInventory: process.cwd() + '/_starter/style_inventory/',\n }\n }\n}", "title": "" }, { "docid": "b3a0dc23f5b68c3ed41c03f221482623", "score": "0.5403767", "text": "function realpath(path) {\r\n\tvar old = path.split('/'),\r\n\t\tret = [];\r\n\t\t\r\n\tfor_each(old, function(part, i){\r\n\t\tif (part === '..') {\r\n\t\t\tif (ret.length === 0) {\r\n\t\t\t \tloaderError(530);\r\n\t\t\t}\r\n\t\t\tret.pop();\r\n\t\t\t\r\n\t\t} else if (part !== '.') {\r\n\t\t\tret.push(part);\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn ret.join('/');\r\n}", "title": "" }, { "docid": "dc1f72f05859469513efbb5e0bc669d5", "score": "0.53751296", "text": "function getBasePaths(path,includes,useCaseSensitiveFileNames){// Storage for our results in the form of literal paths (e.g. the paths as written by the user).\nvar basePaths=[path];if(includes){// Storage for literal base paths amongst the include patterns.\nvar includeBasePaths=[];for(var _i=0,includes_1=includes;_i<includes_1.length;_i++){var include=includes_1[_i];// We also need to check the relative paths by converting them to absolute and normalizing\n// in case they escape the base path (e.g \"..\\somedirectory\")\nvar absolute=isRootedDiskPath(include)?include:normalizePath(combinePaths(path,include));// Append the literal and canonical candidate base paths.\nincludeBasePaths.push(getIncludeBasePath(absolute));}// Sort the offsets array using either the literal or canonical path representations.\nincludeBasePaths.sort(useCaseSensitiveFileNames?compareStrings:compareStringsCaseInsensitive);var _loop_2=function _loop_2(includeBasePath){if(ts.every(basePaths,function(basePath){return!containsPath(basePath,includeBasePath,path,!useCaseSensitiveFileNames);})){basePaths.push(includeBasePath);}};// Iterate over each include base path and include unique base paths that are not a\n// subpath of an existing base path\nfor(var _a=0,includeBasePaths_1=includeBasePaths;_a<includeBasePaths_1.length;_a++){var includeBasePath=includeBasePaths_1[_a];_loop_2(includeBasePath);}}return basePaths;}", "title": "" }, { "docid": "5243179ac4ad986e76d88e6220a64c78", "score": "0.5344092", "text": "function realPath(path) {\n // /a/b/./c/./d ==> /a/b/c/d\n path = path.replace(DOT_RE, \"/\")\n\n // a/b/c/../../d ==> a/b/../d ==> a/d\n while (path.match(DOUBLE_DOT_RE)) {\n path = path.replace(DOUBLE_DOT_RE, \"/\")\n }\n\n return path;\n }", "title": "" }, { "docid": "c4607452d2356eb0be2da5ddd941cb7b", "score": "0.5343524", "text": "function combinePaths() {\r\n var paths = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n paths[_i] = arguments[_i];\r\n }\r\n return paths\r\n .filter(function (path) { return !Util.stringIsNullOrEmpty(path); })\r\n .map(function (path) { return path.replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"); })\r\n .join(\"/\")\r\n .replace(/\\\\/g, \"/\");\r\n}", "title": "" }, { "docid": "5139f7606bcfb36f2b952da9ef9cba3d", "score": "0.5340774", "text": "static ct(t) {\n const e = [];\n let n = \"\", s = 0;\n const i = () => {\n if (0 === n.length) throw new $(x$1.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);\n e.push(n), n = \"\";\n };\n let r = !1;\n for (;s < t.length; ) {\n const e = t[s];\n if (\"\\\\\" === e) {\n if (s + 1 === t.length) throw new $(x$1.INVALID_ARGUMENT, \"Path has trailing escape character: \" + t);\n const e = t[s + 1];\n if (\"\\\\\" !== e && \".\" !== e && \"`\" !== e) throw new $(x$1.INVALID_ARGUMENT, \"Path has invalid escape sequence: \" + t);\n n += e, s += 2;\n } else \"`\" === e ? (r = !r, s++) : \".\" !== e || r ? (n += e, s++) : (i(), s++);\n }\n if (i(), r) throw new $(x$1.INVALID_ARGUMENT, \"Unterminated ` in path: \" + t);\n return new Z$1(e);\n }", "title": "" }, { "docid": "e2f24de4bfb77344c1a9a94243c9a9f0", "score": "0.5328822", "text": "function resolve$3() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter$1(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n }", "title": "" }, { "docid": "dc626fb94ee221d38c0b31511575a2b2", "score": "0.5326906", "text": "function resolvePath (path, parent) {\n if (path.indexOf('\\\\') !== -1)\n path = path.replace(winSepRegEx, '/');\n\n if (parent && (!isWindows || !hasWinDrivePrefix(path)) && path[0] !== '/') {\n if (!path.startsWith('./') && !path.startsWith('../'))\n path = './' + path;\n path = parent.slice(0, parent.lastIndexOf('/') + 1) + path;\n }\n\n // linked list of path segments\n const headSegment = {\n prev: undefined,\n next: undefined,\n segment: undefined\n };\n let curSegment = headSegment;\n let segmentIndex = 0;\n\n for (var i = 0; i < path.length; i++) {\n // busy reading a segment - only terminate on '/'\n if (segmentIndex !== -1) {\n if (path[i] === '/') {\n const nextSegment = { segment: path.substring(segmentIndex, i + 1), next: undefined, prev: curSegment };\n curSegment.next = nextSegment;\n curSegment = nextSegment;\n segmentIndex = -1;\n }\n continue;\n }\n\n // new segment - check if it is relative\n if (path[i] === '.') {\n // ../ segment\n if (path[i + 1] === '.' && path[i + 2] === '/') {\n curSegment = curSegment.prev || curSegment;\n curSegment.next = undefined;\n i += 2;\n }\n // ./ segment\n else if (path[i + 1] === '/') {\n i += 1;\n }\n else {\n // the start of a new segment as below\n segmentIndex = i;\n continue;\n }\n\n // trailing . or .. segment\n if (i === path.length) {\n let nextSegment = { segment: '', next: undefined, prev: curSegment };\n curSegment.next = nextSegment;\n curSegment = nextSegment;\n }\n continue;\n }\n\n // it is the start of a new segment\n segmentIndex = i;\n }\n // finish reading out the last segment\n if (segmentIndex !== -1) {\n if (path[segmentIndex] === '.') {\n if (path[segmentIndex + 1] === '.') {\n curSegment = curSegment.prev || curSegment;\n curSegment.next = undefined;\n }\n // not a . trailer\n else if (segmentIndex + 1 !== path.length) {\n const nextSegment = { segment: path.slice(segmentIndex), next: undefined, prev: curSegment };\n curSegment.next = nextSegment;\n }\n }\n else {\n const nextSegment = { segment: path.slice(segmentIndex), next: undefined, prev: curSegment };\n curSegment.next = nextSegment;\n }\n }\n\n curSegment = headSegment;\n let outStr = '';\n while (curSegment = curSegment.next)\n outStr += curSegment.segment;\n\n if (!path.endsWith('/') && outStr.endsWith('/'))\n outStr = outStr.slice(0, -1);\n return outStr;\n}", "title": "" }, { "docid": "53e3d16f9eafadf0f2a8ceab4ad7e727", "score": "0.5313996", "text": "_getAbsolutePath(baseAbsolutePath, relativePath) {\r\n let stack = [];\r\n let isWindows = false;\r\n if (baseAbsolutePath.indexOf(\"\\\\\") !== -1) {\r\n stack = baseAbsolutePath.split(\"\\\\\");\r\n isWindows = true;\r\n }\r\n else {\r\n stack = baseAbsolutePath.split(\"/\");\r\n }\r\n let parts = relativePath.split(\"/\");\r\n stack.pop();\r\n for (let i = 0; i < parts.length; i++) {\r\n if (parts[i] === \".\") {\r\n continue;\r\n }\r\n if (parts[i] === \"..\") {\r\n stack.pop();\r\n }\r\n else {\r\n stack.push(parts[i]);\r\n }\r\n }\r\n if (isWindows) {\r\n return stack.join(\"\\\\\");\r\n }\r\n return stack.join(\"/\");\r\n }", "title": "" }, { "docid": "5da3d30d335f248b5b91f0f3097a4853", "score": "0.5308585", "text": "function resolve() {\n let resolvedPath = '',\n resolvedAbsolute = false;\n\n for (let i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path != 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path[0] === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/'),\n !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n}", "title": "" }, { "docid": "76828e8eafa3856e4a4c9ba381b96e21", "score": "0.5288507", "text": "function simplifyPath(path) {\n var paths = path.split(\"/\");\n //console.log(paths);\n var spaths = [];\n for (var i = 0; i < paths.length; i++) {\n if (i == 0) {\n if (paths[i] === '') {\n spaths.push('/');\n } else if (paths[i] === '.') {\n } else if (paths[i] === '..') {\n spaths.push(paths[i]);\n } else {\n spaths.push('/');\n spaths.push(paths[i]);\n }\n } else {\n if (paths[i] === '' || paths[i] === '.') {\n } else if (paths[i] === '..') {\n if (spaths.length > 0) {\n spaths.pop();\n }\n } else {\n spaths.push(paths[i]);\n }\n }\n }\n console.log(spaths);\n //console.log(spaths.join(\"/\").replace(\"//\", \"/\"));\n\n var answer = spaths.join(\"/\").replace(\"//\", \"/\");\n if (!answer.startsWith(\"/\")) {\n answer = \"/\" + answer;\n }\n return answer;\n}", "title": "" }, { "docid": "3246993b2f5e5cb0a5693177be3bbc39", "score": "0.5280134", "text": "function combinePaths(...paths) {\r\n return paths\r\n .filter(path => !stringIsNullOrEmpty(path))\r\n .map(path => path.replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"))\r\n .join(\"/\")\r\n .replace(/\\\\/g, \"/\");\r\n}", "title": "" }, { "docid": "7f8a936b9f4c6d7b7eb6c9351998e95d", "score": "0.5269774", "text": "function normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n} // Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "7f8a936b9f4c6d7b7eb6c9351998e95d", "score": "0.5269774", "text": "function normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n} // Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "1a92293f2df5649560dbfc33131cef75", "score": "0.5268555", "text": "function _resolvePath(path) {\n if (path.substring(0, 1) != '/') {\n path = process.cwd() + '/' + path;\n }\n var newPath = new Array();\n var splittedPath = path.split('/');\n for (var i in splittedPath) {\n var t = splittedPath[i];\n if (t == '..') {\n newPath.pop();\n } else if (t != '' && t != '.') {\n newPath.push(t);\n }\n }\n return '/' + newPath.join('/');\n }", "title": "" }, { "docid": "537ee92a8257dfe95e96a0ab12c8b128", "score": "0.52652687", "text": "function fromPortablePath(p) {\n if (process.platform !== `win32`) return p;\n if (p.match(PORTABLE_PATH_REGEXP)) p = p.replace(PORTABLE_PATH_REGEXP, `$1`);else if (p.match(UNC_PORTABLE_PATH_REGEXP)) p = p.replace(UNC_PORTABLE_PATH_REGEXP, (match, p1, p2) => `\\\\\\\\${p1 ? `.\\\\` : ``}${p2}`);else return p;\n return p.replace(/\\//g, `\\\\`);\n} // Path should look like \"N:/berry/scripts/plugin-pack.js\"", "title": "" }, { "docid": "16e056cd5ae6d2d8635abf8164d9b1eb", "score": "0.5262965", "text": "findGlobsPaths(globs) {\n return _.flatten(\n globs.map(g => {\n return glob.sync(g) || [];\n })\n );\n }", "title": "" }, { "docid": "7f4172ac40c496a67dec86f47191f2a7", "score": "0.5239444", "text": "normalizePath (path) {\n return pathlib.normalize(`/${path}`);\n }", "title": "" }, { "docid": "159a611f6318985c293818096cb17b30", "score": "0.52391136", "text": "function combine(...paths) {\n return paths\n .filter(path => !stringIsNullOrEmpty(path))\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n .map(path => path.replace(/^[\\\\|/]/, \"\").replace(/[\\\\|/]$/, \"\"))\n .join(\"/\")\n .replace(/\\\\/g, \"/\");\n}", "title": "" }, { "docid": "159a611f6318985c293818096cb17b30", "score": "0.52391136", "text": "function combine(...paths) {\n return paths\n .filter(path => !stringIsNullOrEmpty(path))\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n .map(path => path.replace(/^[\\\\|/]/, \"\").replace(/[\\\\|/]$/, \"\"))\n .join(\"/\")\n .replace(/\\\\/g, \"/\");\n}", "title": "" }, { "docid": "42da6d56df9a0199bdaddcb6e6c61ee7", "score": "0.52388847", "text": "set full_path(full_path) {\n const delimiter = full_path.match(/\\\\|\\//);\n //\n // Set name and this.path\n {\n if (!delimiter) {\n this.full_name = full_path;\n this.path = get_root_dir_path();\n }\n else {\n let last_delimiter = full_path.lastIndexOf(delimiter[0]);\n //\n // Delimiter is the last character\n // => fetch the previous delimiter\n if (last_delimiter === full_path.length - 1) {\n last_delimiter = full_path.lastIndexOf(delimiter[0], last_delimiter - 1);\n }\n this.full_name = full_path.slice(last_delimiter + delimiter[0].length);\n this.path = full_path.slice(0, last_delimiter);\n }\n }\n //\n //Fetch Dirent\n {\n fs_promises.opendir(this.path).then(async (dir) => {\n for await (const entry of dir) {\n if (entry.name === this.full_name) {\n this.dirent = entry;\n close_dir();\n return;\n }\n }\n close_dir();\n logger.error =\n \"Directory entry \" + this.full_name + \" not found in \" + this.path;\n function close_dir() {\n try {\n dir.close();\n }\n catch (ex) { }\n }\n });\n }\n }", "title": "" }, { "docid": "3445ba4385ee17478d9c4ec8ae20ab77", "score": "0.52368647", "text": "function combine() {\r\n var paths = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n paths[_i] = arguments[_i];\r\n }\r\n return paths\r\n .filter(function (path) { return !stringIsNullOrEmpty(path); })\r\n .map(function (path) { return path.replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"); })\r\n .join(\"/\")\r\n .replace(/\\\\/g, \"/\");\r\n}", "title": "" }, { "docid": "3445ba4385ee17478d9c4ec8ae20ab77", "score": "0.52368647", "text": "function combine() {\r\n var paths = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n paths[_i] = arguments[_i];\r\n }\r\n return paths\r\n .filter(function (path) { return !stringIsNullOrEmpty(path); })\r\n .map(function (path) { return path.replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"); })\r\n .join(\"/\")\r\n .replace(/\\\\/g, \"/\");\r\n}", "title": "" }, { "docid": "98707dc1073b48676d31f05350bb5b0f", "score": "0.5203893", "text": "function __get_path ( src )\r\n\t {\r\n\t\treturn ( src. replace ( /\\?.*/, '' ). replace ( /\\\\/, '/' ) ) ;\r\n\t }", "title": "" }, { "docid": "f8483af08486b8a2d8b87006bddd49af", "score": "0.5203175", "text": "function toPortablePath(p) {\n if (process.platform !== `win32`) return p;\n if (p.match(WINDOWS_PATH_REGEXP)) p = p.replace(WINDOWS_PATH_REGEXP, `/$1`);else if (p.match(UNC_WINDOWS_PATH_REGEXP)) p = p.replace(UNC_WINDOWS_PATH_REGEXP, (match, p1, p2) => `/unc/${p1 ? `.dot/` : ``}${p2}`);\n return p.replace(/\\\\/g, `/`);\n}", "title": "" }, { "docid": "2715eee38c17a898159f9cb7627fdc07", "score": "0.52018124", "text": "function translatePathArray(pathArray) {\n var getIdentifiersValues = function (identifiers) {\n return identifiers.map(function (i) {\n return i.value.length ? i.value.replace(/\\//g, '%2F') : '{' + i.label + '}';\n }).join('/');\n },\n getLastElem = function (i) {\n var result = null;\n if ((i - 1) >= 0) {\n result = pathArray[i - 1];\n }\n return result;\n },\n getModuleStr = function (actElem, lastElem) {\n return ((lastElem && actElem.module && lastElem.module !== actElem.module) ?\n (actElem.module + ':') : '');\n },\n getIdentifiersStr = function (actElem) {\n return (actElem.hasIdentifier() ? '/' + getIdentifiersValues(actElem.identifiers) : '');\n },\n getElemStr = function (actElem, lastElem) {\n return getModuleStr(actElem, lastElem) + actElem.name + getIdentifiersStr(actElem);\n };\n\n return pathArray.map(function (pe, i) {\n return getElemStr(pe, getLastElem(i));\n });\n }", "title": "" }, { "docid": "23865d90ef7ca2c383e6c159212b23f5", "score": "0.5197124", "text": "function combine(...paths) {\n return paths\n .filter(path => !stringIsNullOrEmpty(path))\n .map(path => path.replace(/^[\\\\|/]/, \"\").replace(/[\\\\|/]$/, \"\"))\n .join(\"/\")\n .replace(/\\\\/g, \"/\");\n}", "title": "" }, { "docid": "8d83224fd7b92cc6f3c4df092f9e8e65", "score": "0.5195179", "text": "function pathFinder(directories, targetFile) {\n\n}", "title": "" }, { "docid": "12bd0812aca3a6ae1131c2ca013743ae", "score": "0.5192562", "text": "function resolve() {\n\t var resolvedPath = '',\n\t resolvedAbsolute = false;\n\n\t for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n\t var path = (i >= 0) ? arguments[i] : '/';\n\n\t // Skip empty and invalid entries\n\t if (typeof path !== 'string') {\n\t throw new TypeError('Arguments to path.resolve must be strings');\n\t } else if (!path) {\n\t continue;\n\t }\n\n\t resolvedPath = path + '/' + resolvedPath;\n\t resolvedAbsolute = path.charAt(0) === '/';\n\t }\n\n\t // At this point the path should be resolved to a full absolute path, but\n\t // handle relative paths to be safe (might happen when process.cwd() fails)\n\n\t // Normalize the path\n\t resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n\t return !!p;\n\t }), !resolvedAbsolute).join('/');\n\n\t return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n\t}", "title": "" }, { "docid": "c9700d456aff7cc5118ce380a73357a1", "score": "0.5192159", "text": "function applyNodeExtensionResolution(unqualifiedPath, candidates, {\n extensions\n }) {\n let stat;\n\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n } catch (error) {} // If the file exists and is a file, we can stop right there\n\n\n if (stat && !stat.isDirectory()) return opts.fakeFs.realpathSync(unqualifiedPath); // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n\n if (stat && stat.isDirectory()) {\n let pkgJson;\n\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(sources_path/* ppath.join */.y1.join(unqualifiedPath, `package.json`), `utf8`));\n } catch (error) {}\n\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main) nextUnqualifiedPath = sources_path/* ppath.resolve */.y1.resolve(unqualifiedPath, pkgJson.main); // If the \"main\" field changed the path, we start again from this new location\n\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, {\n extensions\n });\n\n if (resolution !== null) {\n return resolution;\n }\n }\n } // Otherwise we check if we find a file that match one of the supported extensions\n\n\n for (let i = 0, length = extensions.length; i < length; i++) {\n const candidateFile = `${unqualifiedPath}${extensions[i]}`;\n candidates.push(candidateFile);\n\n if (opts.fakeFs.existsSync(candidateFile)) {\n return candidateFile;\n }\n } // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n\n\n if (stat && stat.isDirectory()) {\n for (let i = 0, length = extensions.length; i < length; i++) {\n const candidateFile = sources_path/* ppath.format */.y1.format({\n dir: unqualifiedPath,\n name: `index`,\n ext: extensions[i]\n });\n candidates.push(candidateFile);\n\n if (opts.fakeFs.existsSync(candidateFile)) {\n return candidateFile;\n }\n }\n } // Otherwise there's nothing else we can do :(\n\n\n return null;\n }", "title": "" }, { "docid": "9716c4d737b9ebd84b9fb9ef09b6af2a", "score": "0.5182958", "text": "BuildPath(string, string) {\n\n }", "title": "" }, { "docid": "b4e66e8535184ad1ce25c9549ce89beb", "score": "0.5182327", "text": "function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n}", "title": "" }, { "docid": "e5a611dd1f1dffc57908f0e424421aa6", "score": "0.5180809", "text": "function pathJoin(...args) {\n var _args$0$match;\n\n return (0, _utils().winPath)(`${((_args$0$match = args[0].match(/^\\.[\\/\\\\]/)) === null || _args$0$match === void 0 ? void 0 : _args$0$match[0]) || ''}${_path().default.join(...args)}`);\n}", "title": "" }, { "docid": "2e980dfda1c82dc87de32a02107f348a", "score": "0.5176056", "text": "function systemPath(parts) {\n return parts.join(path.sep);\n}", "title": "" }, { "docid": "f88701dcd504549ba4c4ac4cb95d2f8b", "score": "0.5174132", "text": "function combine() {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i] = arguments[_i];\n }\n return paths\n .filter(function (path) { return !stringIsNullOrEmpty(path); })\n .map(function (path) { return path.replace(/^[\\\\|/]/, \"\").replace(/[\\\\|/]$/, \"\"); })\n .join(\"/\")\n .replace(/\\\\/g, \"/\");\n}", "title": "" }, { "docid": "4ae86249b44af6367d81036db4623093", "score": "0.517313", "text": "function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n }", "title": "" }, { "docid": "4ae86249b44af6367d81036db4623093", "score": "0.517313", "text": "function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n }", "title": "" }, { "docid": "653520cdeccc5e44efc646bde0feef4c", "score": "0.5171685", "text": "function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n }", "title": "" }, { "docid": "9b511515d82d71c9b4be28a383ac48ea", "score": "0.5171193", "text": "function parsePaths(input){\n\n var directories = input.split(\"/\");\n return directories;\n}", "title": "" }, { "docid": "480901694bf2a3488f7789cd8221d1a3", "score": "0.51549727", "text": "function combine() {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i] = arguments[_i];\n }\n return paths\n .filter(function (path) { return !stringIsNullOrEmpty(path); })\n .map(function (path) { return path.replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"); })\n .join(\"/\")\n .replace(/\\\\/g, \"/\");\n}", "title": "" }, { "docid": "0695b29727840c055507c81b139ea72d", "score": "0.51523626", "text": "function stringToPath(paths) {\n\n var result = [];\n var str = interpretString(paths);\n\n if ((/^\\./).test(str)) {\n result.push('');\n }\n\n str.replace(\n /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,\n function(match, number, quote, string) {\n\n result.push(\n quote\n ? string.replace(/\\\\(\\\\)?/g, '$1')\n : (number || match)\n );\n\n }\n );\n\n return result;\n\n }", "title": "" }, { "docid": "e8c538ea1f1a311fb1a798e460063cb4", "score": "0.51467437", "text": "function getNamePath(path) {\n return Object(__WEBPACK_IMPORTED_MODULE_5__typeUtil__[\"a\" /* toArray */])(path);\n}", "title": "" }, { "docid": "e8c538ea1f1a311fb1a798e460063cb4", "score": "0.51467437", "text": "function getNamePath(path) {\n return Object(__WEBPACK_IMPORTED_MODULE_5__typeUtil__[\"a\" /* toArray */])(path);\n}", "title": "" }, { "docid": "b9552fd20dfcb37ca9c56dbc1f249cd7", "score": "0.5145471", "text": "function getCorePaths() {\n const spec = path_1.default.resolve(path_1.default.join('.', 'packages', '*'));\n return glob_1.default.sync(spec);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "07ad5605713aef9f0d06d05aebf22db3", "score": "0.5138875", "text": "function toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}", "title": "" }, { "docid": "5b22547f3ff05f43ffc8d5de4dcd8f48", "score": "0.51385474", "text": "join_path(...list) {\n return path.join(...list).split(path.sep).join(\"/\");\n }", "title": "" }, { "docid": "d6695d9395fb15371d16d13b17fe4cc5", "score": "0.51363945", "text": "function realpath(path) {\n\n var oldPath = path.split('/');\n var newPath = [];\n\n for (var i = 0; i < oldPath.length; i++) {\n if (oldPath[i] == '.' || !oldPath[i].length)\n continue;\n if (oldPath[i] == '..') {\n if (!newPath.length)\n throw new Error(\"Invalid module path: \" + path);\n newPath.pop();\n continue;\n }\n newPath.push(oldPath[i]);\n }\n\n newPath.unshift('');\n return newPath.join('/');\n }", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "b9cd30d0a2e766476708df296ccd3dc7", "score": "0.5130331", "text": "function resolve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var resolvedPath = '';\n var resolvedAbsolute = false;\n for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = i >= 0 ? args[i] : '/';\n // Skip empty entries\n if (!path) {\n continue;\n }\n resolvedPath = path + \"/\" + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeArray(resolvedPath.split('/').filter(function (p) { return !!p; }), !resolvedAbsolute).join('/');\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}", "title": "" }, { "docid": "8b2ae11ad1b55ee3de6530881dfbe947", "score": "0.5130247", "text": "function normalizePath(str) {\n \n let directories = str.split(\"/\");\n // [\"foo\", \"bar\", \"..\", \"baz\"]\n let i = directories.length;\n while (i--) {\n if (directories[i] === \".\") {\n directories.splice(i, 1);\n }\n else if (directories[i] === \"..\") {\n if (i === 0) {\n directories.splice(i, 1);\n } else {\n directories.splice(i-1, 2);\n }\n }\n }\n return directories.join(\"/\");\n}", "title": "" }, { "docid": "4efb33580910f63e66ee902d1a3ed102", "score": "0.51149774", "text": "function normalizePath(input) {\n // If there are no \"..\"s, we can treat this as if it were an absolute path.\n // The return won't be an absolute path, so it's easy.\n if (!parentRegex.test(input))\n return normalizeSimplePath(input);\n // We already found one \"..\". Let's see how many there are.\n let total = 1;\n while (parentRegex.test(input))\n total++;\n // If there are \"..\"s, we need to prefix the the path with the same number of\n // unique directories. This is to ensure that we \"remember\" how many parent\n // directories we are accessing. Eg, \"../../..\" must keep 3, and \"foo/../..\"\n // must keep 1.\n const uniqDirectory = `z${uniqInStr(input)}/`;\n // uniqDirectory is just a \"z\", followed by numbers, followed by a \"/\". So\n // generating a runtime regex from it is safe. We'll use this search regex to\n // strip out our uniq directory names and insert any needed \"..\"s.\n const search = new RegExp(`^(?:${uniqDirectory})*`);\n // Now we can resolve the total path. If there are excess \"..\"s, they will\n // eliminate one or more of the unique directories we prefix with.\n const relative = normalizeSimplePath(uniqDirectory.repeat(total) + input);\n // We can now count the number of unique directories that were eliminated. If\n // there were 3, and 1 was eliminated, we know we only need to add 1 \"..\". If\n // 2 were eliminated, we need to insert 2 \"..\"s. If all 3 were eliminated,\n // then we need 3, etc. This replace is guranteed to match (it may match 0 or\n // more times), and we can count the total match to see how many were eliminated.\n return relative.replace(search, (all) => {\n const leftover = all.length / uniqDirectory.length;\n return '../'.repeat(total - leftover);\n });\n}", "title": "" }, { "docid": "7b2f3e5d671e04cc7293dacb62952d73", "score": "0.50957614", "text": "function arrayToPath(arr){\n var ret = \"\";\n for(var i in arr){\n ret += \" \" + arr[i][0] + \",\" + arr[i][1];\n }\n return ret;\n}", "title": "" }, { "docid": "f6c9feab57a9d40d4df6d65b0ee87f38", "score": "0.5083586", "text": "static X(t) {\n const n = [];\n let e = \"\", r = 0;\n const s = () => {\n if (0 === e.length) throw new R(h, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);\n n.push(e), e = \"\";\n };\n let i = !1;\n for (;r < t.length; ) {\n const n = t[r];\n if (\"\\\\\" === n) {\n if (r + 1 === t.length) throw new R(h, \"Path has trailing escape character: \" + t);\n const n = t[r + 1];\n if (\"\\\\\" !== n && \".\" !== n && \"`\" !== n) throw new R(h, \"Path has invalid escape sequence: \" + t);\n e += n, r += 2;\n } else \"`\" === n ? (i = !i, r++) : \".\" !== n || i ? (e += n, r++) : (s(), r++);\n }\n if (s(), i) throw new R(h, \"Unterminated ` in path: \" + t);\n return new Y(n);\n }", "title": "" }, { "docid": "4fe86c67b504077b5865e8295683034a", "score": "0.5071726", "text": "function parsePath(path){\n if(getOS() == \"Windows\"){\n //replace \\ by \\\\ \t\n var path = path.replace(/\\//g, \"\\\\\") ; \n \treturn path;\n }\n // no problem with MAC or Linux\n else\n {\n return path;\n }\n \n}", "title": "" }, { "docid": "f8f582cfd15ec20d7957fd0fb7c32486", "score": "0.50663817", "text": "function R(t,e){var r=e.split(/\\.(\\d+)\\.|\\.(\\d+)$/).filter(Boolean);if(r.length<2)return t.paths.hasOwnProperty(r[0])?t.paths[r[0]]:\"adhocOrUndefined\";var n=t.path(r[0]),o=!1;if(!n)return\"adhocOrUndefined\";for(var i=r.length-1,s=1;s<r.length;++s){o=!1;var a=r[s];if(s===i&&n&&!/\\D/.test(a)){n=n.$isMongooseDocumentArray?n.$embeddedSchemaType:n instanceof u.Array?n.caster:void 0;break;}if(/\\D/.test(a)){if(!n||!n.schema){n=void 0;break;}o=\"nested\"===n.schema.pathType(a),n=n.schema.path(a);}else n instanceof u.Array&&s!==i&&(n=n.caster);}return t.subpaths[e]=n,n?\"real\":o?\"nested\":\"adhocOrUndefined\";}", "title": "" }, { "docid": "7f58d5c42bdad93915d951c666d64a17", "score": "0.50473493", "text": "function normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n\n if (last === \".\") {\n parts.splice(i, 1);\n } else if (last === \"..\") {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift(\"..\");\n }\n }\n\n return parts;\n } // Split a filename into [root, dir, basename, ext], unix version", "title": "" }, { "docid": "b02c5eeae6222c3c14a35f532f32d4e3", "score": "0.50387263", "text": "static isDirectory(filePath){return new _promise2.default(function(resolve,reject){return fileSystem.stat(filePath,function(error,stat){if(error){if(error.hasOwnProperty('code'// IgnoreTypeCheck\n)&&['ENOENT','ENOTDIR'].includes(error.code))resolve(false);else reject(error);}else resolve(stat.isDirectory())})})}", "title": "" }, { "docid": "c74e293385fc27b87dd8cf438fe9528a", "score": "0.50358063", "text": "function normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47/*/*/)\n break;\n else\n code = 47/*/*/;\n if (code === 47/*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 ||\n res.charCodeAt(res.length - 1) !== 46/*.*/ ||\n res.charCodeAt(res.length - 2) !== 46/*.*/) {\n if (res.length > 2) {\n var start = res.length - 1;\n var j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === 47/*/*/)\n break;\n }\n if (j !== start) {\n if (j === -1)\n res = '';\n else\n res = res.slice(0, j);\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46/*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}", "title": "" }, { "docid": "61c51433d59995e96935eed57dcdbcc5", "score": "0.50265384", "text": "static async listDir(path) {\n if (ios.Module) {\n return await ios.Module.listDir(path);\n }\n else if (android.Module) {\n return await android.Module.listDir(path);\n }\n else {\n throw new Error('platform not supported');\n }\n }", "title": "" }, { "docid": "5e6a912243f0dac754da5f56c24ba7ad", "score": "0.5018929", "text": "requireResolve(ctx, req) {\n // try to mimic require.resolve(req, {paths: modulePaths})\n // excepts:\n // 1- don't use GLOBAL_FOLDERS\n // 2- don't returns the actual .js file (if req refer to a folder)\n // 3- return null if not found (instead of throwing an exception)\n\n // Search paths (like module.paths without GLOBAL_FOLDERS\n let modulePaths = ctx.split(path.sep).reduce((acc, folderSection, idx) => {\n if (idx > 0) {\n acc.push(path.join(acc[idx-1], folderSection))\n } else {\n acc.push(`${folderSection}${path.sep}`)\n }\n return acc\n }, [])\n modulePaths = modulePaths.map(f => path.resolve(f, \"node_modules\"))\n // local path (without 'node_modules')\n modulePaths.push(ctx)\n // reverse to make sure that first item is the 'clothest' path (like module.paths)\n modulePaths.reverse()\n // find first existed module\n for(const base of modulePaths) {\n const test = path.join(base, req)\n const jsFile = test.toUpperCase().endsWith('.JS') ? test : `${test}.js`\n if (fs.extras.existsSync(jsFile, 'file')) return test\n if (fs.extras.existsSync(test, 'folder')) {\n if (fs.extras.existsSync(path.join(test, 'index.js'), 'file')) return test\n if (fs.extras.existsSync(path.join(test, 'package.json'), 'file')) return test\n }\n }\n return null\n }", "title": "" }, { "docid": "989427dd71c2ea68d4ace4ba5aa2e0a4", "score": "0.5011175", "text": "function realpath(path) {\n // /a/b/./c/./d ==> /a/b/c/d\n path = path.replace(DOT_RE, \"/\")\n\n // a/b/c/../../d ==> a/b/../d ==> a/d\n while (path.match(DOUBLE_DOT_RE)) {\n path = path.replace(DOUBLE_DOT_RE, \"/\")\n }\n\n return path\n}", "title": "" }, { "docid": "3750e091168499f20d088364732ddfee", "score": "0.5007138", "text": "function cleanupPaths(profile) {\n var externalFileCounter = 0;\n var remappedPaths = new ts.Map();\n var normalizedDir = ts.normalizeSlashes(__dirname);\n // Windows rooted dir names need an extra `/` prepended to be valid file:/// urls\n var fileUrlRoot = \"file://\".concat(ts.getRootLength(normalizedDir) === 1 ? \"\" : \"/\").concat(normalizedDir);\n for (var _i = 0, _a = profile.nodes; _i < _a.length; _i++) {\n var node = _a[_i];\n if (node.callFrame.url) {\n var url = ts.normalizeSlashes(node.callFrame.url);\n if (ts.containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) {\n node.callFrame.url = ts.getRelativePathToDirectoryOrUrl(fileUrlRoot, url, fileUrlRoot, ts.createGetCanonicalFileName(useCaseSensitiveFileNames), /*isAbsolutePathAnUrl*/ true);\n }\n else if (!nativePattern.test(url)) {\n node.callFrame.url = (remappedPaths.has(url) ? remappedPaths : remappedPaths.set(url, \"external\".concat(externalFileCounter, \".js\"))).get(url);\n externalFileCounter++;\n }\n }\n }\n return profile;\n }", "title": "" }, { "docid": "f81817ffbcd00797fac96b86eea1b381", "score": "0.5004852", "text": "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__[\"a\" /* isBlank */])(path) ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "title": "" }, { "docid": "9208d7a8dacea2312c8d47ad4c4cf4c0", "score": "0.50041133", "text": "function path_join() {\r\n\t// trim slashes from arguments, prefix a slash to the beginning of each, re-join (ignores empty parameters)\r\n\tvar args = Array.prototype.slice.call(arguments, 0)\r\n\tvar nonempty = args.filter(function(arg, idx, arr) {\r\n\t\treturn typeof(arg) != 'undefined'\r\n\t})\r\n\tvar trimmed = nonempty.map(function(arg, idx, arr) {\r\n\t\treturn '/' + String(arg).replace(new RegExp('^/+|/+$'), '')\r\n\t})\r\n\treturn trimmed.join('')\r\n}", "title": "" }, { "docid": "8c07def8d11d46f7c939aaebe8c636c9", "score": "0.5001488", "text": "function realpath(path) {\n // /a/b/./c/./d ==> /a/b/c/d\n path = path.replace(DOT_RE, \"/\");\n\n /*\n @author wh1100717\n a//b/c ==> a/b/c\n a///b/////c ==> a/b/c\n DOUBLE_DOT_RE matches a/b/c//../d path correctly only if replace // with / first\n */\n path = path.replace(MULTI_SLASH_RE, \"$1/\");\n\n // a/b/c/../../d ==> a/b/../d ==> a/d\n while (path.match(DOUBLE_DOT_RE)) {\n path = path.replace(DOUBLE_DOT_RE, \"/\");\n }\n\n return path;\n }", "title": "" }, { "docid": "f5fa6f922218afadbe83f77693c54c0a", "score": "0.4997958", "text": "function reducePathComponents(components) {\n if (!ts.some(components))\n return [];\n var reduced = [components[0]];\n for (var i = 1; i < components.length; i++) {\n var component = components[i];\n if (!component)\n continue;\n if (component === \".\")\n continue;\n if (component === \"..\") {\n if (reduced.length > 1) {\n if (reduced[reduced.length - 1] !== \"..\") {\n reduced.pop();\n continue;\n }\n }\n else if (reduced[0])\n continue;\n }\n reduced.push(component);\n }\n return reduced;\n }", "title": "" }, { "docid": "2b7acfa0b1c44cf9ae7540ad67b2de6c", "score": "0.49888954", "text": "get dirname() {\n return typeof this.path === 'string' ? path$b.dirname(this.path) : undefined\n }", "title": "" }, { "docid": "471f9157b084ad6f8357a1cddfa9a761", "score": "0.49875766", "text": "function normalizePathArray(parts, allowAboveRoot) {\n var res = [];\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i];\n\n // ignore empty parts\n if (!p || p === '.') {\n continue;\n }\n\n if (p === '..') {\n if (res.length && res[res.length - 1] !== '..') {\n res.pop();\n } else if (allowAboveRoot) {\n res.push('..');\n }\n } else {\n res.push(p);\n }\n }\n\n return res;\n }", "title": "" }, { "docid": "471f9157b084ad6f8357a1cddfa9a761", "score": "0.49875766", "text": "function normalizePathArray(parts, allowAboveRoot) {\n var res = [];\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i];\n\n // ignore empty parts\n if (!p || p === '.') {\n continue;\n }\n\n if (p === '..') {\n if (res.length && res[res.length - 1] !== '..') {\n res.pop();\n } else if (allowAboveRoot) {\n res.push('..');\n }\n } else {\n res.push(p);\n }\n }\n\n return res;\n }", "title": "" }, { "docid": "3cc5be9a83c93612ae6c15498766e68b", "score": "0.49854416", "text": "testCurrentCharacter() {\n // Has no effect\n this.areSame(Path.normalize(''), '.');\n this.areSame(Path.normalize('./'), './');\n // Has effect\n this.areSame(Path.normalize('./././'), './');\n this.areSame(Path.normalize('./././A'), 'A');\n this.areSame(Path.normalize('././A/././B'), 'A/B');\n this.areSame(Path.normalize('././A/././../B'), 'B');\n }", "title": "" } ]
661c51d158ad8685b3841ec676009b7c
Creates Tribonacci sequence tree
[ { "docid": "5f2dad0122354be8e3c2da11c389f43a", "score": "0.70503557", "text": "function tribonacci(iter, node){\n var sum;\n var div = divBuild('trib', null);\n if (iter <= 2){\n if (iter == 0) sum = 0;\n else if (iter == 1) sum = 0;\n else if (iter == 2) sum = 1;\n \n pSeqBuild('Trib', iter, sum, div);\n }\n else {\n var left = tribonacci(iter - 1, div);\n var className = left.node.getAttribute(\"class\");\n left.node.setAttribute('class', className + ' left');\n \n var center = tribonacci(iter - 2, div);\n className = center.node.getAttribute(\"class\");\n center.node.setAttribute('class', className + ' center');\n \n var right = tribonacci(iter - 3, div);\n className = right.node.getAttribute(\"class\");\n right.node.setAttribute('class', className + ' right');\n \n sum = left.result + center.result + right.result;\n \n pSeqBuild('Trib', iter, sum, div);\n \n div.appendChild(left.node);\n div.appendChild(center.node);\n div.appendChild(right.node);\n }\n return {'result': sum, 'node': div};\n}", "title": "" } ]
[ { "docid": "9ff76bca14bd6bd5666ac5dad31083ed", "score": "0.6414725", "text": "function tribonacci(n) {\n if (n<2){\n return 0;\n }\n if (n<3){\n return 1;\n }\n return tribonacci(n-3) + tribonacci(n-2) + tribonacci(n-1);\n}", "title": "" }, { "docid": "f77013c16a109182dd405a399831a551", "score": "0.60937786", "text": "function genTree (trvals) {\n let root = new TreeNode(trvals[0])\n let queue = [root]\n let start = 1\n while (queue.length && start < trvals.length) {\n let curnode = queue.shift()\n if (trvals[start] != undefined) {\n curnode.left = new TreeNode(trvals[start])\n queue.push(curnode.left)\n }\n start ++\n if (trvals[start] != undefined) {\n curnode.right = new TreeNode(trvals[start])\n queue.push(curnode.right)\n }\n start ++\n }\n return root\n}", "title": "" }, { "docid": "5fc0dad623df509a34870b9416952013", "score": "0.60857075", "text": "function tribonacci(signature,n){\n\tvar array = signature;\n\tif(n < 4 && n >= 0){\n\t\treturn array.slice(0,n);\n\t}\n\tfunction helper(array,n) {\n\t\tif(array[n] !== undefined) {\n\t\t\treturn array[n];\n\t\t}\n\t\tif (n <= 2){\n \t\t\treturn array[n];\n \t\t} else {\n \t\t\treturn array[n] = helper(array,n-1) + helper(array,n-2) + helper(array,n-3);\n \t\t}\n\t}\n\thelper(array,n-1);\n\treturn array; \n}", "title": "" }, { "docid": "5f5690f961e812574a2d48d1a8ab9899", "score": "0.60703933", "text": "function createTree() {\n// A function that adds children to a node\n// The temporary holder for each row of nodes\n// The index of the current value\n// The current tree's depth\n// The tree's max depth\n// The current node\n var addNodes, row, val, d, depth, node;\n// Adds children to the provided node\n// param: The node to add the children\n addNodes = function (prtNode) {\n// Create the nodes and increase the value\n prtNode.left = {\n val: vals[val],\n left: null,\n right: null\n };\n ++val;\n prtNode.right = {\n val: vals[val],\n left: null,\n right: null\n };\n ++val;\n// Add the nodes to temp holder\n row.next.push(prtNode.left, prtNode.right);\n };\n// Set the temp holders, value, and max depth\n row = {\n now: [tree],\n next: []\n };\n val = 1;\n depth = 4;\n// Add the nodes to tree\n for (d = 1; d < depth; d++) {\n// Add nodes\n row.now.forEach(function (node) {\n addNodes(node);\n });\n// Reset temp arrays\n row.now = row.next.slice(0);\n row.next = [];\n }\n }", "title": "" }, { "docid": "dd29e845a5a5e015b59cdc98acdb456f", "score": "0.58698875", "text": "function tribonacci(signature,n){ \n for (var i = 0; i < n-3; i++) { // iterate n times\n signature.push(signature[i] + signature[i+1] + signature[i+2]); // add last 3 array items and push to trib\n }\n return signature.slice(0, n); //return trib - length of n\n}", "title": "" }, { "docid": "94ff4fb8d6e8cdd08f278e6f7da15a0f", "score": "0.58519214", "text": "function tribonacci(signature, n) {\n const result = signature.slice(0, n);\n while (result.length < n) {\n result[result.length] = result.slice(-3).reduce((p, c) => p + c, 0);\n }\n return result;\n}", "title": "" }, { "docid": "6ad1d1cd04aedb40f8cd1be92af86048", "score": "0.5818862", "text": "function tree(number){\n for (let i = 0; i < number; i++){\n let build1 = \"*\".repeat(2 * i +1)\n let build2 = \" \".repeat(number - i - 1)\n console.log(build2 + build1)\n }\n}", "title": "" }, { "docid": "347a21d190824f3712db077d4a0fe50b", "score": "0.580333", "text": "function tribonacci(signature, n) {\n let answer = signature\n\n while (answer.length < n) {\n let lastThree = answer.slice(answer.length - 3)\n let newNumber = lastThree.reduce((acc, curr) => acc += curr, 0)\n answer.push(newNumber)\n }\n\n return answer.slice(0, n)\n}", "title": "" }, { "docid": "c2f673f66b3724fdfe2e99da4d0e6f7b", "score": "0.5762739", "text": "function tabFun (inputTree) {\n tree ();\n for(var i=0;i<inputTree.height; i++){\n tab =\" \";\n tab = tab.repeat(inputTree.height-i);\n char = inputTree.char.repeat((i+1)+i);\n console.log(tab + char);\n }\n}", "title": "" }, { "docid": "a880bec80a5bbd1ce7269f48ac1e4068", "score": "0.57108104", "text": "function makeBalancedTree(values) {\n var tree = new Tree();\n if (values && values.length) {\n add(tree, values, 0, values.length - 1);\n }\n return tree;\n}", "title": "" }, { "docid": "2d7266a2dd9ad7c3de949b9aaac23c57", "score": "0.5661275", "text": "function createTree(arr) {\n\n}", "title": "" }, { "docid": "5d45462d331e0c4342279061aa5dbf04", "score": "0.56180644", "text": "function createTree (nums) {\n function TreeNode (val) {\n return { val: val, left: null, right: null };\n }\n\n for (const i in nums) nums[i] = TreeNode(nums[i]);\n\n function ConnectNode (nums, a, n) {\n for (let i = a; i < a + n; i++) {\n if (a + n + (i - a) * 2 < nums.length) nums[i].left = nums[a + n + (i - a) * 2];\n if (a + n + (i - a) * 2 + 1 < nums.length) nums[i].right = nums[a + n + (i - a) * 2 + 1];\n }\n if (a + n + 1 > nums.length) return true;\n return ConnectNode(nums, a + n, n * 2);\n }\n\n nums[0].left = nums[1];\n nums[0].right = nums[2];\n\n ConnectNode(nums, 0, 1);\n\n return nums[0];\n}", "title": "" }, { "docid": "2da47c66b4ac886562c8551cc52f1cef", "score": "0.5565797", "text": "function create(item,h){if(h===0){return{ctor:'_Array',height:0,table:[item]};}return{ctor:'_Array',height:h,table:[create(item,h-1)],lengths:[1]};}// Recursively creates a tree that contains the given tree.", "title": "" }, { "docid": "c36c644116ce09bac29bb3b735de8ef2", "score": "0.5524285", "text": "function tree(t){\n let tick=0;\n if(!t){ \n return 0;\n }\n tick++;\n console.log(`ticks: ${tick}`);\n return tree(t.left) + t.value + tree(t.right);\n}", "title": "" }, { "docid": "98dde84c4abd480c327db576d175fb04", "score": "0.5517345", "text": "function buildTree(treePlans) {\n\tvar number = treePlans.rows;\n\n\tfor (var i = 0; i < treePlans.rows; i += 1) {\n\t\tvar spaces = \" \";\n\t\tvar tree = \"\";\n\t\tif (treePlans.rows -1 > i) {\n\t\t\ttree += spaces.repeat(number-=1) + treePlans.character.repeat(i *2 + 1);\n\t\t\tconsole.log(tree);\n\t\t} else {\n\t\t\tconsole.log(tree + treePlans.character.repeat(i *2 +1));\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44ea5a61281f33a3fdf6a911f0d3ba03", "score": "0.55103695", "text": "function createBinaryTree(array) {\n const BT = new BinaryTree();\n for (let i = 0; i < array.length; ++i) {\n BT.insert(array[i], 1);\n }\n return BT;\n}", "title": "" }, { "docid": "d51117c27e700d44f44638fcb00f6c3a", "score": "0.5486318", "text": "function Trees() {\n}", "title": "" }, { "docid": "d51117c27e700d44f44638fcb00f6c3a", "score": "0.5486318", "text": "function Trees() {\n}", "title": "" }, { "docid": "68d2fb8dba65a5c06487e0370c51805c", "score": "0.546579", "text": "function trianguloPascal(n) {\n resultado=[[1], [1, 1]];\n for (let l=3; l<=n; l++) {\n resultado.push(\n [...Array(l)].map((el, i, a) =>\n i==0 || i==a.length-1 ? 1 : resultado[l-2][i-1]+resultado[l-2][i]\n )\n );\n }\n return resultado;\n}", "title": "" }, { "docid": "67c77ad7799aa34c36f99c6391b24e74", "score": "0.5443462", "text": "function factorialTree(n) {\n if (n == 0) {\n return \"(function() { return 1; }())\";\n } else {\n return \"(function (n) { return n * \" + factorialTree(n-1) + \" }(\" + n + \"))\";\n\t}\n}", "title": "" }, { "docid": "0e820a7f2fd67369ede283f79a281408", "score": "0.5429871", "text": "function createPyramidRecursive() {\n //\n}", "title": "" }, { "docid": "103982aede3e6df84fd85352d10d5964", "score": "0.5428293", "text": "function BinaryTree() {}", "title": "" }, { "docid": "679155c42701641a4f649916f9bf5b7d", "score": "0.54160273", "text": "function tribonacci(signature, n) {\n // handle falsy values\n (!n || !signature || signature.length < 3) && [];\n\n // store a copy of signature\n let newSig = [...signature];\n\n // while length of new array is less than `n`\n while (newSig.length < n) {\n // get the sum of signature array\n let sum = signature => signature.reduce((acc, cur) => acc + cur, 0);\n // push sum of current signature into new array\n newSig.push(sum(signature));\n // modify signature to be last 3 digits of new array\n signature = newSig.slice(newSig.length - 3, newSig.length);\n }\n // return the new array from start to n\n return newSig.splice(0, n);\n}", "title": "" }, { "docid": "fd678d2af1689360e94caea5dced5cf1", "score": "0.5413374", "text": "build_tree() {\n // If number of leaves in a full binary tree is n,\n // total number of internal nodes in the tree is n - 1.\n // Hence, total number of nodes in the tree will be 2n - 1.\n this.n_leaves = SegmentTree.next_power_of_2(this.len_arr);\n const n = this.n_leaves << 1;\n\n // initializing all nodes of the tree to 0\n this.tree = [];\n for (let i = 0; i < n; i++)\n this.tree.push(this.default);\n\n // copying array to leaves of the tree\n for (let i = 0; i < this.len_arr; i++)\n this.tree[this.len_arr + i] = this.arr[i];\n\n // updating all the nodes of the tree\n for (let i = this.len_arr - 1; i > 0; i--)\n this.tree[i] = this.func(this.tree[i << 1], this.tree[i << 1 | 1])\n\n }", "title": "" }, { "docid": "b6982cf172180baf91fc3ff705694797", "score": "0.53246886", "text": "static properRebuild(sequence) {\n let tree = new this(sequence[0]);\n let ind = 1;\n let Q = new Deque([tree._root]);\n while (ind < sequence.length && !Q.empty()) {\n let node = Q.shift();\n if (sequence[ind] != null)\n Q.push(tree.insertAsLC(node, sequence[ind]));\n ind++;\n if (sequence[ind] != null)\n Q.push(tree.insertAsRC(node, sequence[ind]));\n ind++;\n }\n return tree;\n }", "title": "" }, { "docid": "ec2c8d7753b0f47d9a46c4e45262b715", "score": "0.5264244", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "b79124c67a1838b0e19550c745b30ed4", "score": "0.5255943", "text": "function treeTraversals() {\n let BST = new BinarySearchTree();\n BST.insert(25, '25');\n BST.insert(15, '15');\n BST.insert(50, '50');\n BST.insert(10, '10');\n BST.insert(24, '24');\n BST.insert(35, '35');\n BST.insert(70, '70');\n BST.insert(4, '4');\n BST.insert(12, '12');\n BST.insert(18, '18');\n BST.insert(31, '31');\n BST.insert(44, '44');\n BST.insert(66, '66');\n BST.insert(90, '90');\n BST.insert(22, '22');\n}", "title": "" }, { "docid": "0ef87c480b1f85540a1d8d503a509666", "score": "0.52443385", "text": "function generateTriangularNumbers(upTo) {\n var array = [];\n var value = 0;\n var i;\n for (i = 1; value < upTo; i++) {\n value += i;\n array.push(value);\n }\n return array;\n}", "title": "" }, { "docid": "22bf357f2f4695bda0aa058d833e9c32", "score": "0.5243019", "text": "function createSimpleFenwickTree(input) {\n const tree = [...input];\n const size = tree.length;\n\n for (let i = 1; i < size; i++) {\n const parent = i + (i & -1);\n if (parent < size) {\n tree[parent] += tree[i];\n }\n }\n\n const prefixSum = i => {\n if (i < 1) {\n throw Error(`Can't calculate prefix sum for index less than 1`);\n }\n let sum = 0;\n while (i > 0) {\n sum += tree[i];\n i -= i & -i;\n }\n return sum;\n };\n\n return {\n update: (i, change) => {\n while (i < size) {\n tree[i] += change;\n i += i & -i;\n }\n },\n // from 5 to 1, from 7 to 4\n queryRange: (left, right) => {\n if (right < left) {\n throw Error(`right must be less than left`);\n }\n\n return prefixSum(right) - prefixSum(left - 1);\n },\n query: index => prefixSum(index),\n };\n}", "title": "" }, { "docid": "c78c5f842fdfbd3fef956be561ea03b4", "score": "0.52337176", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "c78c5f842fdfbd3fef956be561ea03b4", "score": "0.52337176", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "c78c5f842fdfbd3fef956be561ea03b4", "score": "0.52337176", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "dbe3602ba46814b0a03629618d95858b", "score": "0.52259046", "text": "function fibonnaci(n){\nif (n === 0){ return [0];}\nif (n === 1){ return [0, 1];}\n\nconst previous = fibonnaci(n - 1);\nconst currentNumber = previous[previous.length -2] + previous[previous.length - 1];\nprevious.push(currentNumber);\n\nreturn previous;\n}", "title": "" }, { "docid": "5001940aef07ea26f21a092516b94e25", "score": "0.5222634", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right);\n}", "title": "" }, { "docid": "786e87eb3bf62641d15fe587e37fbb1a", "score": "0.52198625", "text": "function buildTree(tree) { //this fuction builds the tree; it uses the values passed by 'tree'\n\tvar space = \" \"; //variable created for the string \" \" to be used in the tree build\n\tfor (i = 0; i < tree.height; i++) { //A for loop; it will calculate the number of spaces/chars\n\t\tvar numberOfSpaces = tree.height-(i+1);\n\t\tvar numberOfCharacters = i+(i+1);\n\t\tconsole.log(space.repeat(numberOfSpaces) + tree.type.repeat(numberOfCharacters));\n\t}\n\tconsole.log(tree);\n}", "title": "" }, { "docid": "108c9ab1bf96edb5a181e52a9065d264", "score": "0.5215694", "text": "function tree(t) {\n if (!t) {\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "646232af4ac15e43d3c295c53a430066", "score": "0.5203038", "text": "function triangularNumber(base) {\n if (base === 1) {\n return 1;\n }\n return base + triangularNumber(base - 1);\n}", "title": "" }, { "docid": "1fab19ed2fd4db4e4037f43da2d9a714", "score": "0.5191326", "text": "function tree(t) {\n if (!t) {\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right);\n}", "title": "" }, { "docid": "07041945ceabbdf1d21c7eff8e8c1a96", "score": "0.5179602", "text": "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.key + tree(t.right);\n}", "title": "" }, { "docid": "447a40123e3c275bee7f5c9563e3da8d", "score": "0.5179042", "text": "buildThrees(initialNummber, currentIndex, limit, currentString) {\n\n // the possible operands, from -3 to 3, excluding the zero\n var numbersArray = [-3, -2, -1, 1, 2, 3];\n\n // looping from 0 to numbersArray's length\n for (var i = 0; i < numbersArray.length; i++) {\n\n // \"sum\" is the sum between the first number and current numberArray item\n var sum = initialNummber + numbersArray[i];\n\n // output string is generated by the concatenation of current string with\n // current numbersArray item. I am adding a \"+\" if the item is greater than zero,\n // otherwise it already has its \"-\"\n var outputString = currentString + (numbersArray[i] < 0 ? \"\" : \"+\") + numbersArray[i];\n\n // if sum is between 1 and 3 and we reached the limit of operands we want...\n if (sum > 0 && sum < 4 && currentIndex == limit) {\n\n // then push the output string into sumsArray[amount of operands][result]\n this.sumsArray[limit][sum - 1].push(outputString);\n }\n\n // if the amount of operands is still below the amount we want...\n if (currentIndex < limit) {\n\n // recursively calling buildThrees, passing as arguments:\n // the current sum\n // the new amount of operands\n // the amount of operands we want\n // the current output string\n this.buildThrees(sum, currentIndex + 1, limit, outputString);\n }\n }\n }", "title": "" }, { "docid": "b3e1e3a948355885bc79ae0781d75744", "score": "0.5178843", "text": "function tree(t) {\n if (!t) {\n return '';\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" }, { "docid": "d74c23348ec5b88483aee54c24bc2467", "score": "0.5177077", "text": "function TreeConstructor(strArr) { \n/* helper function to arrange the string arr into an object whose key/value\n pair represents parent node and an array of children nodes respectively\n */\nlet getTree = (arr)=> { \nlet o = {};\narr.forEach( tuple=>{\n let [child, parent] = tuple.match(/\\d+/ig);\n parent_children = o[parent];\n if( parent_children) { \n parent_children.push(child);\n } else o[parent] = [child]; \n });\nreturn o;\n}\n\n// get object Tree of the strArr\nlet tree = getTree(strArr);\n\n/* If any parent node has more than 2 children, this tree is not a \nbinary tree */\nlet highest_children_count = 0;\nfor( parentNode in tree){\n children = tree[parentNode];\n //update highest_children_count \n highest_children_count = ( children.length > highest_children_count) ? \n children.length : highest_children_count;\n}\n\n //if highest_children_count is greater than 2 return 'false' else return true\n return (highest_children_count > 2 ) ? \"false\":\"true\"; \n\n}", "title": "" }, { "docid": "b7765a97bff1c5fb5dd2457a144d285d", "score": "0.5176439", "text": "function Tree(pine){\n for (var x=1; x <= pine.pineHeight; x++){\n var spacesCount = pine.pineHeight-x;\n var charCount = (2*x)-1;\n\n console.log(\" \".repeat(spacesCount) + pine.character.repeat(charCount) );\n }\n\n}", "title": "" }, { "docid": "fdcf494742360fd7b09966efb52d466a", "score": "0.51757705", "text": "function fibonacciGenerator(n) {\n var lista = [];\n\n for (var counter = 1; counter <= n; counter++) {\n\n if(counter === 1) {\n lista.push(0);\n }\n else if (counter === 2){\n lista.push(1);\n }\n else {\n lista.push(lista[lista.length -2] + lista [lista.length -1]);\n }\n }\n return (lista);\n}", "title": "" }, { "docid": "ee4cf0af4c333f6abea3a9eed55be84f", "score": "0.51754874", "text": "function GenerateTree()\n{\n var root = new Node(\"root\");\n {\n var constNode = new Node(\"makao\");\n {\n var info = new Node(\"info\");\n info.add(new Leaf(\"program\", \"makao\"));\n info.add(new Leaf(\"version\", \"v0.0\"));\n info.add(new Leaf(\"author\", \"titapo\"));\n constNode.add(info);\n }\n root.add(constNode);\n }\n root.add(new Leaf(\"README\", \"- todo -\"))\n root.add(new Leaf(\"TODO\", \"- todo -\"))\n\n return root;\n}", "title": "" }, { "docid": "0c0089d277306c3347588f1849d71151", "score": "0.51627445", "text": "function pascal(depth) \n{\n var res = [];\n \n if (depth == 1)\n return JSON.stringify([[1]]);\n \n depth--;\n \n res.push([1]); \n res.push([1, 1]);\n \n for (var i = 2; i <= depth; i++)\n {\n var cur = [1], prev = res[i - 1];\n \n for (var j = 0; j < prev.length - 1; j++)\n cur.push(prev[j] + prev[j + 1])\n \n cur.push(1);\n \n res.push(cur);\n }\n \n return JSON.stringify(res);\n \n}", "title": "" }, { "docid": "0ec08a45f59a2bdfec41ddee5486d728", "score": "0.5157136", "text": "create(num, initFcn = turtle => {}) {\n return util.repeat(num, (i, a) => {\n a.push(this.createOne(initFcn))\n })\n }", "title": "" }, { "docid": "dc947d516bcf7cc186db3702be97769b", "score": "0.5148899", "text": "function fibonacciSequence(n) {\r\n if (n===1) \r\n {\r\n return [0, 1];\r\n } \r\n else \r\n {\r\n var s = fibonacciSequence(n - 1);\r\n s.push(s[s.length - 1] + s[s.length - 2]);\r\n return s;\r\n }\r\n}", "title": "" }, { "docid": "26d4159ed75277c3e5bd1e4d0f77d3a7", "score": "0.514476", "text": "function tree(t) {\n\tif (!t) {\n\t\treturn 0;\n\t}\n\treturn tree(t.left) + t.value + tree(t.right);\n}", "title": "" }, { "docid": "5addedc4548c34d1617799715e446752", "score": "0.51447", "text": "function fibTab(n) {\n if (n <= 2) return 1;\n const result = [0, 1, 1];\n for (let i = 3; i <= n; i++) {\n result[i] = result[i - 1] + result[i - 2];\n }\n return result[n];\n}", "title": "" }, { "docid": "dec6f260dc2150a15fa52db9fbb0b564", "score": "0.5138129", "text": "static buildTree(arr) {\n const root = new Node(arr[0]);\n root.left = createSubTree(arr, 1);\n root.right = createSubTree(arr, 2);\n return root;\n }", "title": "" }, { "docid": "e6791a9dde9d8631ffd0dacd0c0244b8", "score": "0.51370746", "text": "function Tree(x) {\n this.value = x;\n this.left = null;\n this.right = null;\n}", "title": "" }, { "docid": "76f3d83945aa243a47911dd402713fc8", "score": "0.51157516", "text": "function fibonacciNonrecursive(n) {\n\n}", "title": "" }, { "docid": "c99c815af601150011ec9c9f4f04fd6b", "score": "0.50965893", "text": "function getSlot(i,a){var slot=i>>5*a.height;while(a.lengths[slot]<=i){slot++;}return slot;}// Recursively creates a tree with a given height containing", "title": "" }, { "docid": "6c0b261e9d98a1790ca86611daf4c068", "score": "0.50956166", "text": "function getTriangNums(n) {\n // Returns a list of the first n triangular numbers\n \n var out = [1];\n var lastVal = 1;\n var newVal = 0;\n for (var i=2; i<=n; i++) {\n newVal = lastVal + i;\n out.push(newVal);\n lastVal = newVal;\n }\n return out;\n}", "title": "" }, { "docid": "313019b675de36aef8c607f521d39e07", "score": "0.50888836", "text": "function triangularNumber(n) {\n if (n === 0) {\n return 0;\n }\n return n + triangularNumber(n - 1);\n}", "title": "" }, { "docid": "e480e93f91a4a78c73a30f5b793ebbd6", "score": "0.5088197", "text": "function triangularNum(n) {\n if (n === 0) {\n return 0\n }\n return n + triangularNum(n - 1)\n}", "title": "" }, { "docid": "b1a85faa9414a3c5ba9206013ace3a9f", "score": "0.5085923", "text": "function fibonacci(position) {\n\n}", "title": "" }, { "docid": "cebeb95f22c365307c8777b49b262c5f", "score": "0.50820255", "text": "ct() {\n return new N(this.root, null, this.F, !1);\n }", "title": "" }, { "docid": "b82a6ed11e2d8a4caaea7552af33a288", "score": "0.5075544", "text": "function fibonacci(iter, node){\n var sum;\n var div = divBuild('fib', null);\n if (iter <= 1){\n if (iter == 0) sum = 0;\n else if (iter == 1) sum = 1;\n \n pSeqBuild('Fib', iter, sum, div);\n }\n else {\n var left = fibonacci(iter - 1, div);\n var className = left.node.getAttribute(\"class\");\n left.node.setAttribute('class', className + ' left');\n \n var right = fibonacci(iter - 2, div);\n className = right.node.getAttribute(\"class\");\n right.node.setAttribute('class', className + ' right');\n \n sum = left.result + right.result;\n \n pSeqBuild('Fib', iter, sum, div);\n \n div.appendChild(left.node);\n div.appendChild(right.node);\n }\n return {'result': sum, 'node': div};\n}", "title": "" }, { "docid": "1483ac8e61152e957032e693f2426fe0", "score": "0.5075436", "text": "randomTree(variables) {\r\n let tempTree = new Tree(this.newSign(), []);\r\n let tempVars = variables.slice();//copiar array\r\n let index;\r\n\r\n for (let i = 0; i < variables.length; i++) {//********** forma de determinar los nodos iniciales\r\n\r\n if (tempTree.child.length === 2) {\r\n tempTree = new Tree(this.newSign(), [tempTree]);\r\n let recursiveTree = this.randomTree(tempVars);\r\n\r\n if (recursiveTree.child.length == 1) {\r\n tempTree.child.push(recursiveTree.child[0]);\r\n } else {\r\n tempTree.child.push(recursiveTree);\r\n }\r\n return tempTree;\r\n } else {\r\n index = 0;\r\n if (tempVars.length !== 1) {\r\n index = this.randFloor(0, tempVars.length - 1);\r\n }\r\n }\r\n\r\n tempTree.child.push(tempVars[index]);\r\n tempVars.splice(index, 1);\r\n }\r\n return tempTree;\r\n }", "title": "" }, { "docid": "7f0babb95550bf256a62f78ef83f7ad0", "score": "0.50658554", "text": "static from(arr) {\n const root = new Node(null);\n if (!arr) return root;\n\n const _left = (i) => 2 * i + 1;\n const _right = (i) => _left(i) + 1;\n\n const _insert = (node, i) => {\n // Base case for recursion\n if (i < arr.length) {\n node = new Node(arr[i]);\n\n // insert left child\n node.left = _insert(node.left, _left(i));\n // insert right child\n node.right = _insert(node.right, _right(i));\n }\n return node;\n };\n\n return _insert(root, 0);\n }", "title": "" }, { "docid": "7f0babb95550bf256a62f78ef83f7ad0", "score": "0.50658554", "text": "static from(arr) {\n const root = new Node(null);\n if (!arr) return root;\n\n const _left = (i) => 2 * i + 1;\n const _right = (i) => _left(i) + 1;\n\n const _insert = (node, i) => {\n // Base case for recursion\n if (i < arr.length) {\n node = new Node(arr[i]);\n\n // insert left child\n node.left = _insert(node.left, _left(i));\n // insert right child\n node.right = _insert(node.right, _right(i));\n }\n return node;\n };\n\n return _insert(root, 0);\n }", "title": "" }, { "docid": "265447cf56ec8f8d0a2601913b9a1fc8", "score": "0.5064128", "text": "binarytree(){\n let l=this.smallest(null);\n let r=this.smallest(null);\n while (r != null){ \n let parent = new node(l.frequency+r.frequency,'$');\n parent.left = l;\n parent.right = r;\n this.add( parent );\n l = this.smallest(null);\n r = this.smallest(null);\n }\n l.parented=false;\n return l;\n}", "title": "" }, { "docid": "c642aaaea2f46f4af8ecfe8c1b991e8a", "score": "0.50625306", "text": "function thirdFibonacci(number) {\n {\n if (number === 0) {\n return [0];\n } else if (number === 1) {\n return [0, 1];\n } else {\n const s = thirdFibonacci(number - 1);\n s.push(s[s.length - 1] + s[s.length - 2]);\n return s;\n }\n }\n}", "title": "" }, { "docid": "59c3967cbd75ca9eeae0ef879ca3e57d", "score": "0.5055016", "text": "function fibonacci1(n){\n\nif(n==0){\n return [0]\n}\nif(n==1){\n return [0,1]\n}\nelse{\n var fibo1 = fibonacci1(n-1);\n var nextElement = fibo1[n-1] + fibo1[n-2];\n fibo1.push(nextElement);\n return fibo1\n}\n}", "title": "" }, { "docid": "61b5a6956e1c99c6d99aa781d4acde6e", "score": "0.5054839", "text": "function fibonacci(n) {\n if (n == 1) return [1]\n if (n == 2) return [1, 1]\n let prev = fibonacci(n - 1)\n let nextNum = prev[prev.length - 1] + prev[prev.length - 2]\n prev.push(nextNum)\n return prev\n}", "title": "" }, { "docid": "b1cb4f0567d3bd25c4c2e0a2bb281ad0", "score": "0.50447816", "text": "function calculateTriangularNumber(nth) {\n if (nth === 1) {\n return 1;\n }\n \n return nth + calculateTriangularNumber(nth - 1);\n}", "title": "" }, { "docid": "5900cf381ec0161861f2c7e980cb9691", "score": "0.5042447", "text": "function TrieNode(chr) {\n this.val = chr;\n this.isWord = false;\n this.children = [];\n}", "title": "" }, { "docid": "7fa9fe893b2fb489b265594020d69fb9", "score": "0.50303036", "text": "function gen_codes(tree,max_code,bl_count)// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{var next_code=new Array(MAX_BITS+1);/* next code value for each bit length */var code=0;/* running code value */var bits;/* bit index */var n;/* code index *//* The distribution counts are first used to generate the code values\n * without bit reversal.\n */for(bits=1;bits<=MAX_BITS;bits++){next_code[bits]=code=code+bl_count[bits-1]<<1;}/* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n *///Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n// \"inconsistent bit counts\");\n//Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\nfor(n=0;n<=max_code;n++){var len=tree[n*2+1]/*.Len*/;if(len===0){continue;}/* Now reverse the bits */tree[n*2]/*.Code*/=bi_reverse(next_code[len]++,len);//Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n}}", "title": "" }, { "docid": "e857f688c7a9da42cddaba0d8da931a0", "score": "0.50291556", "text": "function fibonacci (n){\n if(n==0){\n return 0\n }\n if(n==1){\n return 1\n }\n else {\n return fibonacci(n-1)+ fibonacci(n-2);\n }\n}", "title": "" }, { "docid": "0914dc117be752655bd2f2612883da34", "score": "0.5028615", "text": "fibonacci(n){\n \n let sequence = [0, 1];\n for (let i = 0; i < sequence.length; i++) {\n if ( i == 1){\n let sum = 1; \n sequence.push(sum);\n }\n return sequence; \n }\n }", "title": "" }, { "docid": "eef431bd5d352309b16c71bb32d201ee", "score": "0.50281394", "text": "function genLeftSidedRightAngleTri(n) {\n let result = '';\n for (let i = 1; i <= n; i++) {\n for (let j = i; j >= 1; j--) {\n result += `${String(j)} `;\n }\n result += '\\n';\n }\n return result;\n}", "title": "" }, { "docid": "61eafb8ec79a31ddcf5d487c63f9585c", "score": "0.5026091", "text": "function Tree() {\n\tthis.branches = 0;\n\tthis.grow = function(N) {\n\t\t// grow will increase the tree height by value passed in and branches by 1\n\t\tthis.increaseHeight(N);\n\t\tthis.branches += 1;\n\t};\n\tthis.trim = function(N) {\n\t\t// trim will decrease the tree height by value passed in and branches by 1\n\t\tthis.decreaseHeight(N);\n\t\tthis.branches -= 1;\n\t};\n}", "title": "" }, { "docid": "cd053ccadcdfd0867a3938b3c023f2f5", "score": "0.5013966", "text": "function pascalTriangle(n) {\r\n if (n===0){\r\n return [1];\r\n } else{\r\n const arr = [];\r\n const previousRow = pascalTriangle(n-1);\r\n for (let i = 0; i < previousRow.length - 1; i++)\r\n arr.push(previousRow[i] + previousRow[i+1]);\r\n return [1].concat(arr).concat([1]);\r\n } \r\n }", "title": "" }, { "docid": "40f42acd82559e062c94b307400495ee", "score": "0.500592", "text": "function fibSeq(n) {\n\n if (i === 0) {\n return 0;\n }\n else if (i === 1) {\n return 1;\n }\n return fibSeq(i - 2) + fibSeq(i - 1);\n\n}", "title": "" }, { "docid": "334dfeded6ffa657a7ea25f5f7951aa2", "score": "0.49989402", "text": "function RadixTree() {\n //private variables\n var keywordCount = 0,\n dataCount = 0,\n tree = {};\n //optional variable to swap keys\n // keySwap = {key:swap_key};\n var keySwap = {};\n\n /***************************************************************************\n * Insert Functions\n */\n\n /*****\n * @public\n * insert()\n * The purpose of this function is to check whether or not\n * the key exists and either inserts the existing\n * data for the key or creates a new node in the data\n * structure.\n *\n * @params\n * key = mandatory, new key String used to insert new node and/or new data\n * data = mandatory, new \"data\" to attach to new/exiting node\n */\n function insert(key, data) {\n var index = Index(tree),\n callbacks = Callbacks(createNode, createNode, insertData, splitNode);\n\n //process key\n key = processKey(key);\n\n //start recursive insert\n traverse(key, data, index, callbacks);\n }\n\n /*****\n * @private\n * insertData()\n * The purpose of this function is to insert a data into the\n * existing node.\n *\n * @params\n * key = mandatory, existing key String used to insert data\n * data = mandatory, new \"data\" to attach to existing node\n * index = mandatory, Index object used to provide info of the tree\n */\n function insertData(key, data, index) {\n if (index.node.$ && index.node.$.length) {\n index.node.$.push(data);\n } else {\n index.node.$ = [data];\n }\n dataCount++;\n }\n\n /*****\n * @private\n * createNode()\n * The purpose of this function is to create a new node in\n * the data structure and add it to the array of words.\n *\n * @params\n * key = mandatory, new key String used to add new node\n * data = mandatory, new \"data\" to attach to new node\n * index = mandatory, Index object used to provide info of the tree\n */\n function createNode(key, data, index) {\n if (index.ttlCharsMatch !== 0) {\n key = key.substr(index.ttlCharsMatch);\n }\n index.node[key] = {$:[data]};\n keywordCount++;\n dataCount++;\n }\n\n /*****\n * @private\n * splitNode()\n * The purpose of this function is to split an existing node.\n *\n * @params\n * key = mandatory, new key String used to split existing nodes and add new node\n * data = mandatory, new \"data\" to attach to new node\n * index = mandatory, Index object used to provide info of the tree\n */\n function splitNode(key, data, index) {\n //create new key for existing content\n var i = index.ttlCharsMatch - index.charsMatch,\n tempKey = \"\",\n tempIndexKey = index.nodeKey.substr(index.charsMatch);\n tempKey = key.substr(i, index.charsMatch);\n\n //add new node to existing index\n if (index.ttlCharsMatch === key.length) {\n index.node[tempKey] = {$:[data]};\n //add new nodes to existing index\n } else {\n var str = key.substr(index.ttlCharsMatch);\n index.node[tempKey] = {};\n index.node[tempKey][str] = {$:[data]};\n }\n\n //append existing content to new node\n index.node[tempKey][tempIndexKey] = index.node[index.nodeKey];\n\n //delete existing node\n delete index.node[index.nodeKey];\n keywordCount++;\n dataCount++;\n }\n\n /***************************************************************************\n * Remove Functions\n */\n\n /*****\n * @public\n * remove()\n * The purpose of this function is to check whether or not\n * the key exists and either removes the data or responds\n * with an appropriate error message why nothing was removed.\n *\n * @params\n * key = mandatory, signifies key String to remove\n * data = optional, if no \"data\" is passed, node will be removed\n */\n function remove(key, data) {\n var index = Index(tree),\n callbacks = Callbacks(removeError, removeError, removeData, removeError);\n\n //process key\n key = processKey(key);\n\n //start recursive removal\n traverse(key, data, index, callbacks);\n }\n\n /*****\n * @private\n * removeData()\n * The purpose of this function is to first check if the data\n * exists on the matching node. If so, then remove the data.\n * If not, then throw an error message.\n *\n * @params\n * key = mandatory, existing key String used to remove either key or data\n * data = mandatory, existing \"data\" used to delete or \"undefined\" to delete entire node\n * index = mandatory, Index object used to provide info of the tree\n */\n function removeData(key, data, index) {\n //if data is undefined, delete node\n if (typeof data === \"undefined\") {\n dataCount = dataCount - index.node.$.length;\n delete index.node.$;\n keywordCount--;\n //else delete data\n } else {\n var testData = JSON.stringify(data);\n \n //find matching data\n for (var i = 0, arrlen = index.node.$.length; i < arrlen; i++) {\n if (testData === JSON.stringify(index.node.$[i])) {\n break;\n }\n }\n \n //if match is found, remove data\n if (i < arrlen) {\n index.node.$.splice(i,1);\n dataCount--;\n //if data is empty, perform additional cleanup of node\n if (index.node.$.length === 0) {\n delete index.node.$;\n keywordCount--;\n }\n //else log error that data doesn't exist\n } else {\n console.log(\"Removal failed. Key: '\" + key + \"' matched but cound not find matching data to remove.\");\n }\n }\n\n //if node is empty, remove empty nodes\n if (isEmpty(index.node)) {\n removeEmptyParents(index.parents);\n }\n }\n\n /*****\n * @private\n * removeEmptyParents()\n * The purpose of this function is check the parents of the\n * node that was removed in order to clean-up any additional\n * empty nodes.\n *\n * @params\n * parents = mandatory, Object[] used to remove additional empty nodes\n */\n function removeEmptyParents(parents) {\n //reverse order of parents array to traverse up the tree\n parents.reverse();\n //check parents for empty nodes\n for (var i = 0, arrlen = parents.length; i < arrlen; i++) {\n for (var str in parents[i]) {\n //if node is empty, delete it\n if (isEmpty(parents[i][str])) {\n delete parents[i][str];\n }\n }\n }\n }\n\n /*****\n * @private\n * removeError()\n * The purpose of this function is to log the appropriate error\n * message based on what exactly went wrong when traversing the\n * tree for the appropriate key.\n *\n * @params\n * key = mandatory, String searched against to process error message\n * data = mandatory, \"data\" not used but mandatory for standardizing _processResults\n * index = mandatory, Index object used to provide info of the tree\n */\n function removeError(key, data, index) {\n switch(true) {\n //if key doesn't exist\n case (index.ttlCharsMatch === 0):\n console.log(\"Removal failed. key: '\" + key + \"' doesn't exist\");\n break;\n //if key contains suffix of index.nodeKey\n case (index.ttlCharsMatch < key.length):\n console.log(\"Removal failed. key: '\" + key + \"' contains a suffix of a matching key: '\" + key.substr(0, index.ttlCharsMatch) + \"'\");\n break;\n //if key exists\n case (index.ttlCharsMatch > 0):\n console.log(\"Removal failed. key: '\" + key + \"' has a partial match until here: '\" + key.substr(0, index.ttlCharsMatch) + \"'. Check spelling and try removal again\");\n break;\n //error handling\n default:\n console.log(\"process results failed: \" + key);\n }\n }\n\n /***************************************************************************\n * Utility Functions\n */\n\n /*****\n * @private\n * traverse()\n * The purpose of this function is to recursively traverse the\n * data structure to find the matching node. Once the correct\n * node on the tree is found, it passes the key, data, index,\n * and callbacks to _processResults().\n *\n * @params\n * key = mandatory, String used to _processResults of tree traversal\n * data = mandatory, \"data\" used to _processResults\n * index = mandatory, Index object used to provide info of the tree\n * callbacks = mandatory, Callbacks object used to _processResults\n */\n function traverse(key, data, index, callbacks) {\n var tempKey = key.substr(index.ttlCharsMatch),\n tempMatch = index.ttlCharsMatch;\n\n //loop through child objects\n for (var str in index.node) {\n //loop through characters\n for (var i = 0, strlen = tempKey.length; i < strlen; i++) {\n if (tempKey.charAt(i) !== str.charAt(i)) {\n break;\n }\n }\n\n //if any characters match\n if (i > 0) {\n index.charsMatch = i;\n index.ttlCharsMatch += i;\n //if exact match, add current node to parents and move to matching node\n if (i === str.length) {\n index.parents.push(index.node);\n index.node = index.node[str];\n }\n index.nodeKey = str;\n break;\n }\n }\n\n //if entire key hasn't been checked and there is more tree to search and matching node chars equals node length and total chars match has increased\n if (index.ttlCharsMatch < key.length && leafCount(index.node) && index.charsMatch === index.nodeKey.length && tempMatch !== index.ttlCharsMatch) {\n traverse(key, data, index, callbacks);\n //else process results\n } else {\n processResults(key, data, index, callbacks);\n }\n }\n\n /*****\n * @private\n * processResults()\n * The purpose of this function is to process the results of the\n * tree traversal with callbacks to either insert or remove.\n *\n * @params\n * key = mandatory, String used to _processResults of tree traversal\n * data = mandatory, \"data\" used to _processResults\n * index = mandatory, Index object used to provide info of the tree\n * callbacks = mandatory, Callbacks object used to _processResults\n */\n function processResults(key, data, index, callbacks) {\n switch(true) {\n //if key doesn't exist\n case (index.ttlCharsMatch === 0):\n callbacks.nonExists(key, data, index);\n break;\n //if key contains suffix of index.nodeKey\n case (index.ttlCharsMatch < key.length && index.charsMatch === index.nodeKey.length):\n callbacks.suffix(key, data, index);\n break;\n //if there is an exact match\n case (index.ttlCharsMatch === key.length && index.charsMatch === index.nodeKey.length):\n callbacks.exact(key, data, index);\n break;\n //if key exists\n case (index.ttlCharsMatch > 0):\n callbacks.exists(key, data, index);\n break;\n //error handling\n default:\n console.log(\"Process results failed: \" + key);\n }\n }\n\n /*****\n * @private\n * processKey()\n * The purpose of this function is to check the keySwap first to see if a\n * better search string exists. Whether or not a keySwap takes place,\n * it returns a lower case key with spaces converted to underscores.\n *\n * @param\n * key = mandatory, String used to process key before being entered/removed from the tree\n */\n function processKey(key) {\n if (keySwap && keySwap[key]) {\n key = keySwap[key];\n }\n return key.toLowerCase().replace(/ /g,\"_\");\n }\n\n /*****\n * @private\n * leafCount()\n * The purpose of this function is to get the amount of children in the node\n * but is limited to just the children, not the keyword data stored in $.\n *\n * @param\n * node = mandatory, Object used to check if node is empty\n */\n function leafCount(node) {\n var size = 0;\n for (var key in node) {\n if (node.hasOwnProperty(key) && key !== \"$\") {\n size++;\n }\n }\n return size;\n }\n\n /*****\n * @private\n * isEmpty()\n * The purpose of this function is to check if a leaf node is empty.\n *\n * @param\n * node = mandatory, Object used to check if node is empty\n */\n function isEmpty(node) {\n return Object.keys(node).length === 0;\n }\n\n /***************************************************************************\n * Utility Objects\n */\n\n /*****\n * @private\n * Index Object\n * The purpose of this object is to hold data used when traversing the tree\n *\n * @params\n * node = mandatory, Object used to reference current matching node in the tree\n * nodeKey = mandatory, String contains current node key used for processing inserts\n * charsMatch = mandatory, int used to specify how many characters match on the current node\n * ttlCharsMatch = mandatory, int used to specify how my total characters match the current key\n * parents = mandatory, Object[] used to hold references of all the matching parent nodes\n */\n function Index(node) {\n return {\n node: node,\n nodeKey: \"\",\n charsMatch: 0,\n ttlCharsMatch: 0,\n parents:[]\n }\n }\n\n /*****\n * @private\n * Callbacks Object\n * The purpose of this object is to hold callbacks used when processing results\n *\n * @params\n * nonExists = mandatory, Function used to reference callback used when key doesn't exist\n * suffix = mandatory, Function used to reference callback used when key contains suffix of matching keyword\n * exact = mandatory, Function used to reference callback when exact match is found\n * exists = mandatory, Function used to reference callback when parts of the key exist in the tree\n */\n function Callbacks(callback1, callback2, callback3, callback4) {\n return {\n nonExists: callback1,\n suffix: callback2,\n exact: callback3,\n exists: callback4\n }\n }\n\n //returns access to read variables only and access to the public functions insert and remove\n return {\n keywordCount: function getKeywordCount() { return keywordCount; },\n dataCount: function getDataCount() { return dataCount; },\n tree: function getTree() { return JSON.stringify(tree, null, 2); },\n insert: insert,\n remove: remove\n }\n}", "title": "" }, { "docid": "4c320bf23f1a878456df0bcbe34ed1ae", "score": "0.49954128", "text": "function solve2(preorder) {\n\n let len = preorder.length;\n let i = 0;\n\n return buildTree(Infinity);\n\n function buildTree(bound) {\n if(i === len || preorder[i] > bound){\n return null;\n }\n\n let node = new TreeNode(preorder[i++]);\n node.left = buildTree(node.val);\n node.right = buildTree(bound);\n return node;\n }\n}", "title": "" }, { "docid": "3c54b27cd55277d8d167f28991e50228", "score": "0.49931502", "text": "function Tree(arr){\n let res = new Node(arr[0]);\n \n res.left = arr[1] ? Tree(arr[1]): null;\n res.right = arr[2] ? Tree(arr[2]) : null;\n\n return res;\n}", "title": "" }, { "docid": "4e4181abcdbc8515aca07a5842e63907", "score": "0.49890345", "text": "function fibonacci(n) {\n if (n <= 1) return 0\n if (n <= 3) return 1\n return fibonacci(n - 1) + fibonacci(n - 2)\n}", "title": "" }, { "docid": "9f78682790bc669330faac8e6a0529ca", "score": "0.49882948", "text": "function fibonacciGenerator() {\n let fibs = [0,1];\n\n return () => {\n fibs.push(fibs[0] + fibs[1]);\n return fibs.shift();\n }\n}", "title": "" }, { "docid": "c69c2a0ec578cb4877c178b21c65f25c", "score": "0.49845296", "text": "function TreeConstructor(strArr) {\n const childFreqDict = {};\n const parentFreqDict = {};\n\n strArr = strArr.map((str) =>\n str.replace('(', '').replace(')', '').split(',')\n );\n\n for (const item of strArr) {\n if (!childFreqDict[item[0]]) {\n childFreqDict[item[0]] = 1;\n } else childFreqDict[item[0]]++;\n\n if (!parentFreqDict[item[1]]) {\n parentFreqDict[item[1]] = 1;\n } else parentFreqDict[item[1]]++;\n }\n for (const child in childFreqDict) {\n if (childFreqDict[child] > 1) {\n return false;\n }\n }\n\n for (const parent in parentFreqDict) {\n if (parentFreqDict[parent] > 2) {\n return false;\n }\n }\n\n return true;\n}", "title": "" }, { "docid": "6c4a0b330b852571ba80cc5047dd3e61", "score": "0.49630684", "text": "function fibonaci(n){\n if(n === 0 || n === 1) return 1;\n return fibonaci(n-1) + fibonaci(n-2);\n}", "title": "" }, { "docid": "eeba077cf1714d942f6391e0d1867e7d", "score": "0.49621153", "text": "function nthTriangularNumber(num) {\n //base case\n if(num === 1) {\n return num;\n }\n //recursive case\n return num + nthTriangularNumber(num - 1);\n}", "title": "" }, { "docid": "9fdc1292a04814795f3fb0d1b3f00c72", "score": "0.49599442", "text": "function christmasTree(height) {\n var tree = '';\n var spaces = Array(height).join(' ');\n\n for (var i = 0; i < height; i++) {\n var stars = Array((i * 2) + 2).join('*');\n if (tree !== '') tree += '\\n';\n tree += spaces + stars + spaces;\n spaces = spaces.slice(0, -1);\n }\n\n return tree;\n}", "title": "" }, { "docid": "9d95378cb8e2acb820cfbe922cb18bc7", "score": "0.49587503", "text": "function createTree(nodes, level, categoryIndex){\n if(level === 0)\n // node is final\n return nodes[0];\n if(!isPowerOfTwo(nodes.length))\n throw Error(\"nodes must be a power of two length array\");\n let parents = createParentNodes(nodes, level, categoryIndex);\n return createTree(parents, level-1, categoryIndex)\n}", "title": "" }, { "docid": "be877fa85695cad85945f3166e13f3fe", "score": "0.49567664", "text": "function transformTree() {\n tree.parentIdx = -1;\n bfsIdx(tree);\n bfsArrs(tree);\n\n nextIdx = new Array(ages.length);\n dfsNext(tree);\n\n var str = JSON.stringify(tree, null, 32);\n //console.log(str);\n\n console.log(\"struct %s_tree_t {\", process.argv[3].split(\".\")[0]);\n console.log(\"\\tstatic const int NUM_NODES = %d;\", ages.length);\n console.log(\"\\tstatic const int MAX_DEPTH = %d;\", treeMaxDepth(tree));\n \n //console.log(\"\\nAges:\");\n //console.log(ages);\n console.log(\"\\tconst floating_t ages[NUM_NODES] = \", JSON.stringify(ages, null, 0).replace(\"[\", \"{\").replace(\"]\", \"}\").concat(\";\"));\n \n //console.log(\"\\nleftIdx:\");\n //console.log(leftIdx);\n console.log(\"\\tconst int idxLeft[NUM_NODES] = \", JSON.stringify(leftIdx, null, 0).replace(\"[\", \"{\").replace(\"]\", \"}\").concat(\";\"));\n \n //console.log(\"\\nrightIdx:\");\n //console.log(rightIdx);\n console.log(\"\\tconst int idxRight[NUM_NODES] = \", JSON.stringify(rightIdx, null, 0).replace(\"[\", \"{\").replace(\"]\", \"}\").concat(\";\"));\n \n //console.log(\"\\nparentIdx:\");\n //console.log(parentIdx);\n console.log(\"\\tconst int idxParent[NUM_NODES] = \", JSON.stringify(parentIdx, null, 0).replace(\"[\", \"{\").replace(\"]\", \"}\").concat(\";\"));\n \n //console.log(\"\\nnextIdx:\");\n //console.log(nextIdx);\n console.log(\"\\tconst int idxNext[NUM_NODES] = \", JSON.stringify(nextIdx, null, 0).replace(\"[\", \"{\").replace(\"]\", \"}\").concat(\";\"));\n\n console.log(\"};\\n\");\n}", "title": "" }, { "docid": "3934e4c719d3d295a36815e393723fbf", "score": "0.49557316", "text": "function Treenode(label) {\n this.label = label;\n this.children = [];\n this.toString = function() {\n if (this.children.length == 0) {\n return this.label;\n }\n var pieces = [\"(\" + this.label];\n for (var i = 0; i < this.children.length; ++i) {\n pieces.push(\" \" + this.children[i].toString());\n }\n pieces.push(\")\");\n return pieces.join(\"\");\n }\n}", "title": "" }, { "docid": "20c17f2ebd61013e692ab3bbaef1828b", "score": "0.4950108", "text": "function b2TreeNode()\n{\n this.aabb = new b2AABB();\n this.userData = null;\n this.parent = 0; // next = parent!!\n this.child1 = this.child2 = this.height = 0;\n}", "title": "" }, { "docid": "18d6e3d21f3f8ae99014fe0f4226edae", "score": "0.49450958", "text": "function fibonnacci(num){\n if(num<=1){\n return 1;\n }\n return fibonnacci(num-1) + fibonnacci(num-2);\n}", "title": "" }, { "docid": "c035685373dc936aecba2d267f8478d5", "score": "0.49431974", "text": "function fibonacci(n) {\n if (n === 1) {\n return [0, 1];\n } else {\n var s = fibonacci(n - 1);\n s.push(s[s.length - 1] + s[s.length - 2]);\n return s;\n }\n}", "title": "" }, { "docid": "5ebfd27ae4393518d88517ce595494d0", "score": "0.49342242", "text": "function recursiveFibonnacci(num) {\n if (num <= 1) return num;\n return fibonacci(num - 2) + fibonacci(num - 1);\n}", "title": "" }, { "docid": "e1c88761af93f61e785db86c4f8928b9", "score": "0.492952", "text": "binaryTree(arr, state, end) {\n //\n }", "title": "" }, { "docid": "30d47dd7c3cb499fc2629a7085edacb3", "score": "0.49292627", "text": "function tampilAngka (n) {\n if ( n === 0 ){\n return ;\n }\n console.log (n);\n return tampilAngka(n-1);\n}", "title": "" }, { "docid": "bf4fbe471b3447ae5a6c90590d37b452", "score": "0.49234375", "text": "function createToten(){\n //Creating totens\n for(let i = 0; i < node.length; i++){\n totens[i] = new Toten(i);\n }\n}", "title": "" }, { "docid": "f630bcc9c093885918cbf506efe00e85", "score": "0.49172866", "text": "function fib(n){\n if(n === 0) return 0;\n return n + fib(n - 1)\n }", "title": "" }, { "docid": "95844bab4d49a9c117abd2cf7989c09b", "score": "0.4914955", "text": "function nthTriangle(naturalNum) {\n if (naturalNum <= 0) {\n return 0;\n }\n\n let tNum = naturalNum + nthTriangle(naturalNum -1);\n return tNum;\n}", "title": "" }, { "docid": "27174156eb5b8e4b272aa2abd91a08ab", "score": "0.49095657", "text": "function nthTriangle(num) {\n if (num === 1) {\n return 1;\n }\n\n return num + nthTriangle(num - 1);\n}", "title": "" }, { "docid": "f70e143b7b19f102100a885587da3b1d", "score": "0.4907789", "text": "function RedBlackTree() {}", "title": "" }, { "docid": "b46c243af7f5ea28bbdc8a1cd0940ef7", "score": "0.4905635", "text": "function tree(t){\n //If there are no values in the tree, return 0.\n if(!t){\n return 0;\n }\n //Recur repeatedly through the tree, adding all values and eventually returning their total sum.\n return tree(t.left) + t.value + tree(t.right)\n}", "title": "" } ]
8a59fd368833dd031beb8ae23228ef9c
to animate, need to do x++ 60 times a second. using requestAnimationFrame, but if going to do gaming script seriously, just use a JS library
[ { "docid": "121d4cd49c1b26d66fd6318e04aa9483", "score": "0.66109586", "text": "function funcForEachFrame() {\n animation = requestAnimationFrame(funcForEachFrame)\n timer++\n // whatever write below, will happen 60 times a second\n\n ctx.clearRect(0, 0, canvas.width, canvas.height) // removing canvas and recreating every time\n // dino.x++ // but this will leave an afterimage so will look like it is increasing. thus we wrote above line\n\n if (timer % 120 === 0) { // every 120 frames (depending on hardware, monitor) draw a cactus\n var cactus = new Cactus()\n cactusArr.push(cactus) // every 120 frames put a cactus into the array\n }\n\n cactusArr.forEach((a, i, o) => {\n // if x coordinate is lower than 0, remove from array\n if (a.x < 0) {\n o.splice(i, 1)\n }\n a.x--\n\n // keep on collision checking\n isCollision(dino, a);\n\n a.draw()\n\n // for jumping, only when space bar is triggered\n if (jumping == true) {\n dino.y -= 1\n jumpTimer++\n }\n if (jumping == false) {\n if (dino.y < 100) {\n dino.y++\n }\n }\n // stop jumping after reaching 100 frames\n if (jumpTimer > 100) {\n jumping = false\n jumpTimer = 0 // enables to use Space again\n }\n })\n\n dino.draw()\n}", "title": "" } ]
[ { "docid": "c0ad5b1987f68edc7998245e08caa0dc", "score": "0.7270481", "text": "function animate() {\n\n\t // request another frame\n\t requestAnimationFrame(animate);\n gameLoop();\n\n\t}", "title": "" }, { "docid": "f92da7a474c73565e525525652f3f157", "score": "0.72228724", "text": "function animate()\n{\n frameCount++;\n // movement update\n update();\n // render update\n render();\n // trigger next frame\n requestAnimationFrame(animate);\n}", "title": "" }, { "docid": "9022163e0dddc895e0c4c3508508294e", "score": "0.71398264", "text": "function animate(){\n game.run(); // run the game\n requestAnimationFrame(animate);\n}", "title": "" }, { "docid": "faf072b7a2a001ac4b09a2b0bcdd39f7", "score": "0.70924383", "text": "function animate() {\n\trequestAnimFrame( animate );\n\tgame.tick();\n}", "title": "" }, { "docid": "d2ad07675b3835a6c104d6d14f6c8052", "score": "0.6977796", "text": "function nextFrame() {\n\n x += step;\n\n element.style.left = x + \"px\";\n\n if (distance >= 0) {\n if (x > distance) {\n element.style.left = distance + \"px\";\n }\n\n if (\n x < distance\n ) {\n requestAnimationFrame(nextFrame);\n }\n\n } else {\n if (x < distance) {\n element.style.left = distance + \"px\";\n }\n\n if (x > distance) {\n requestAnimationFrame(nextFrame);\n }\n }\n }", "title": "" }, { "docid": "5f970b5dd9443f4d342e74a73bbae63a", "score": "0.69650733", "text": "function tick() {\n requestAnimFrame(tick);\n animate();\n draw();\n}", "title": "" }, { "docid": "dd280475be296c33a83a4663bab442f0", "score": "0.6914338", "text": "function tick() {\n requestAnimFrame(tick);\n draw();\n animate();\n}", "title": "" }, { "docid": "dd280475be296c33a83a4663bab442f0", "score": "0.6914338", "text": "function tick() {\n requestAnimFrame(tick);\n draw();\n animate();\n}", "title": "" }, { "docid": "1ba352d8d59c64c3465de3ecea0b4e9a", "score": "0.6891106", "text": "function BeginRender()\n{\n var frameRate = 1000/30;\n setInterval(animate, frameRate);\n}", "title": "" }, { "docid": "0a7821cd3136be9bf04de61730657e27", "score": "0.6877933", "text": "function startAnimating(fps){\n fpsInterval = 1000/fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "title": "" }, { "docid": "2d3dcfcdf8ba0fba82de4e1852b3cb84", "score": "0.68516356", "text": "function main(ctime){\n window.requestAnimationFrame(main);\n // console.log(ctime);\n if((ctime - lastPaintTime)/1000 < 1/speed){\n return;\n }\n lastPaintTime = ctime;\n gameEngine();\n\n}", "title": "" }, { "docid": "94b7af40b7c9c7187ebc88501fa44db9", "score": "0.681254", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */ \n var now = Date.now(), dt = (now - lastTime) / 1000.0;\n gd.framesCounter++;\n if(gd.framesCounter > 10000000){gd.framesCounter = 0;};\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render(dt);\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "cc5f0b06f155fbf86f7e57fd091c99b1", "score": "0.68072724", "text": "function tick() {\n requestAnimationFrame(tick);\n\n drawScene();\n animate();\n}", "title": "" }, { "docid": "307daa5e7d635ac3b027cb7cab1e4734", "score": "0.67964727", "text": "function startAnimating(fps)\n{\n\tfpsInterval = 1000/fps;\n\tthen = Date.now();\n\tanimate();\n}", "title": "" }, { "docid": "3ee96bd87cf9f6266fb96e12b47b71a9", "score": "0.6774166", "text": "function animate() {\n 'use strict';\n chairMovement();\n\n render();\n\n requestAnimationFrame(animate);\n}", "title": "" }, { "docid": "fcf4a6f749df4c3d75eb236754fc9925", "score": "0.67736006", "text": "function runAnimation(x) {\n\n setInterval(display,20,x);\n\n\n function display(x) {\n\n drawMasses( imageData3( imageData2( imageData1( drawScreen( x ) ) ) ) ) ; \n }\n}", "title": "" }, { "docid": "67c637ed519875688774a641af0e2cd1", "score": "0.67564064", "text": "function tick(){\n\tgame.nextFrame();\n}", "title": "" }, { "docid": "67c637ed519875688774a641af0e2cd1", "score": "0.67564064", "text": "function tick(){\n\tgame.nextFrame();\n}", "title": "" }, { "docid": "8792963021a3ff15c09a301156f7c96c", "score": "0.6737984", "text": "function animate() {\n draw();\n requestAnimationFrame(animate);\n}", "title": "" }, { "docid": "9f30a42e7b4543233fe34a5af6722c18", "score": "0.6726255", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n animate();\n}", "title": "" }, { "docid": "13c301d50f01e45bd650a72885bfca60", "score": "0.66919816", "text": "function tick() {\r\n requestAnimFrame(tick);\r\n drawSpheres();\r\n animate();\r\n}", "title": "" }, { "docid": "9bfe88d2f1c97015e4d569b8fd4e7083", "score": "0.6674305", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "title": "" }, { "docid": "d2752a5bb24adbd9bb3ec0bff362b8aa", "score": "0.6659865", "text": "function animate() {\n requestAnimationFrame(animate);\n render();\n\n}", "title": "" }, { "docid": "758221b64e4c6ec966059363e01ae265", "score": "0.6653881", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "title": "" }, { "docid": "dd26eb54d71d90c8e1cb8293af13a9bc", "score": "0.6648977", "text": "function requestAnimationFrame(callback) {\n\t setTimeout(callback, 1000 / 60);\n\t}", "title": "" }, { "docid": "b55ff7d4312861437a483aab99f767ab", "score": "0.6644512", "text": "function animate() {\n // Clear the canvas of old pixel data\n context.clearRect(0, 0, canvas.width, canvas.height);\n\n // All shapes overlap and the color is\n // determined by adding the color values\n context.globalCompositeOperation = 'lighter';\n\n // Increment the time\n time += .05;\n\n // Time to create some particle magic!\n var i = 5000,\n m = 0,\n x = 0,\n y = 0,\n cx = canvas.width * 0.5,\n cy = canvas.height * 0.5;\n\n while (i--) {\n // Simple magic formula\n m = 300 * Math.sin(1 + 1 * i * Math.sin(time * .0001));\n\n // Update the particles positions\n x = cx + Math.sin(i) * m;\n y = cy + Math.cos(i) * m;\n\n // Draw the particles\n context.fillStyle = 'rgba(0, 204, 255, 1)';\n context.fillRect(x, y, 1, 1);\n }\n\n // Set up the next frame\n setTimeout(animate, FRAMERATE);\n }", "title": "" }, { "docid": "05fd3f94a1c2978c36f4c9b0d48e51de", "score": "0.66426075", "text": "animate(){\n\n if(frameCount % this.animateSpeed === 0){\n this.sprite_number ++;\n this.sprite_number %= 2;\n }\n }", "title": "" }, { "docid": "a3a7b35c70c90c0f998213a76ede9a2f", "score": "0.664024", "text": "render() {\n const times = [];\n var fps;\n \n function refreshLoop() {\n requestAnimationFrame(() => {\n const now = performance.now();\n while (times.length > 0 && times[0] <= now - 1000) {\n times.shift();\n }\n times.push(now);\n fps = times.length;\n document.getElementById('fps').innerHTML=fps\n console.log(fps)\n refreshLoop();\n });\n }\n refreshLoop();\n // return\n }", "title": "" }, { "docid": "3a45e6303018302a407873b65d63dd10", "score": "0.6640159", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n }", "title": "" }, { "docid": "08187161c1ff58e65d0b5b9b46e8ebd4", "score": "0.6624316", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "4692f557aef2ba81865edd1750fe03ee", "score": "0.66239995", "text": "function animate() {\n requestAnimationFrame( animate );\n update();\n render();\n}", "title": "" }, { "docid": "fffbc77b1bbe4904399ba3829cbf7c32", "score": "0.6623586", "text": "function animation(time)\n{\n \n requestAnimationFrame(animation);\n TWEEN.update(time);\n}", "title": "" }, { "docid": "a9af91991f82a48847c0f8502215ad54", "score": "0.6622412", "text": "function startGame() {\n setInterval(incrementTime,1000)\n}", "title": "" }, { "docid": "169db6c7aad6110595977244d3cdafb2", "score": "0.6613667", "text": "function animate() {\n window.requestAnimationFrame(animate);\n render();\n update();\n}", "title": "" }, { "docid": "95d9e63b16223497f8d750db04117bc5", "score": "0.6607087", "text": "function loop() {\n update();\n draw();\n frames++;\n if (frames % 600 == 0) { acceleration *= -1 };\n if (frames % 200 == 0) { SPEED += 0.5 * acceleration };\n requestAnimationFrame(loop);\n}", "title": "" }, { "docid": "dbb2e020956fa31be509981f5e0b395d", "score": "0.6604315", "text": "function tick() {\n requestAnimFrame(tick);\n draw();\n handleKeys();\n animate();\n}", "title": "" }, { "docid": "2f64de3caee81ea44ddae173a9c7a8dc", "score": "0.66022295", "text": "function animate() {\n createRainbow();\n // requestAnimationFrame is a one shot function, needs to keep calling itself\n window.requestAnimationFrame(animate);\n }", "title": "" }, { "docid": "76d7aa006bb89564e4fcd5162a217b9c", "score": "0.66016287", "text": "function nextFrame(x, y, startTime, timePeriod) {\r\n //finds the elapsed time of the drawing\r\n var date = new Date();\r\n var now = date.getTime();\r\n var elapsedTime = now-startTime;\r\n//recursively recalls this algorithm so that several circles are drawn to formt he animation effect\r\n requestId = requestAnimationFrame(function() {\r\n nextFrame(x,y, startTime, timePeriod); \r\n });\r\n //draws the next circle arc by initialising the draw function\r\n draw(x, y, elapsedTime/timePeriod);\r\n if (elapsedTime > timePeriod) {\r\n//after the elapsed time becomes greater than the set time period this function will end and hence \r\n//the circle will stop growing by calling the stop function\r\n stop();\r\n }\r\n}", "title": "" }, { "docid": "ac7efb822a127599f2bc258f8bb417da", "score": "0.6600862", "text": "function main(ctime) {\r\n\twindow.requestAnimationFrame(main);\r\n\t\r\n\tif((ctime - lastPaintTime)/1000 < 1/speed){\r\n\t\treturn;\r\n\t}\r\n\tlastPaintTime = ctime;\r\n\tgameEngine();\r\n\r\n}", "title": "" }, { "docid": "3e1670ec7a6877437f93112e283b0eab", "score": "0.6600208", "text": "function tick() {\n\t// arranges for tick to be called again\n requestAnimFrame(tick);\n\t// draws everything\n drawScene();\n\t// changes vars for next frame\n animate();\n}", "title": "" }, { "docid": "5938efe75ab2c6343a70a8ef8fb872e8", "score": "0.66001505", "text": "function animate() {\r\n requestAnimationFrame( animate );\r\n\trender();\t\t\r\n\tupdate();\r\n}", "title": "" }, { "docid": "87e0b4bf77ed50b4499db71a38c2341e", "score": "0.65998006", "text": "function requestNextFrame( fun )\n{\n setTimeout( function() {\n requestAnimationFrame( fun );\n frameCount++;\n }, 1000 / frameRate );\n}", "title": "" }, { "docid": "98529a1c3c723933979d1869909a61ff", "score": "0.6581273", "text": "function tick() \n{\n requestAnimFrame(tick);\n handleKeys();\n draw();\n animate();\n}//end tick", "title": "" }, { "docid": "b4fc0eabc35734580fd4bd7896bb20d9", "score": "0.6578804", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n }", "title": "" }, { "docid": "1de903b256f7702da6143042144b08de", "score": "0.656737", "text": "function animate(thing, frame){\n\n //clearTimeout(window.animateLoop);\n\n thing.draw(frame);\n if(frame < thing.nFrames){\n frame++;\n window.animateLoop = setTimeout(function(){animate(thing, frame)},thing.duration/thing.FPS*1000);\n }\n}", "title": "" }, { "docid": "1de903b256f7702da6143042144b08de", "score": "0.656737", "text": "function animate(thing, frame){\n\n //clearTimeout(window.animateLoop);\n\n thing.draw(frame);\n if(frame < thing.nFrames){\n frame++;\n window.animateLoop = setTimeout(function(){animate(thing, frame)},thing.duration/thing.FPS*1000);\n }\n}", "title": "" }, { "docid": "929177ede4fd970e40c02b62e610f3de", "score": "0.6566957", "text": "function animate() \n{\n if (then == 0)\n {\n then = Date.now();\n }//enf if\n \n else\n {\n now = Date.now();\n // Convert to seconds\n now *= 0.001;\n // Remember the current time for the next frame.\n then = now;\n }//end else\n}", "title": "" }, { "docid": "cf5029e501f54fc9ae4fec8c65b108f1", "score": "0.6565363", "text": "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n }", "title": "" }, { "docid": "7c6d69cd79068b94385d1c239217a7bd", "score": "0.6565174", "text": "frame() {\n this.cycles(29780)\n }", "title": "" }, { "docid": "7817cb75e58fff9663baabd15ad7f1ca", "score": "0.655949", "text": "function animate() {\n // we take x, calculate where the points should be\n let points = xDirection.map(x => {\n let y = 200 + 20 * Math.sin((x + time) / 10)\n return [x, y]\n })\n\n // turn the x, y values into an html attribute\n let path = \"M\" + points.map(point => {\n return point[0] + \",\" + point[1]\n }).join(\" L\")\n\n // replace the current path attribute with what it should be\n document.querySelector(\"path\").setAttribute(\"d\", path)\n\n // add time to move the x value, and with it, the page\n time += 1;\n\n // we loop over the animation, but we need to start it, which\n // occurs at the bottom of this file\n requestAnimationFrame(animate)\n}", "title": "" }, { "docid": "0832e05403fc52a4a5babb0dab1de024", "score": "0.6557644", "text": "function tick() {\n //request next frame callback\n window.requestAnimationFrame(tick, canvas);\n\n update();\n render();\n}", "title": "" }, { "docid": "004c2a64728760b5748cd4e8cd3ca9f8", "score": "0.65535855", "text": "function main() {\n /* This gets our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* This calls our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* This sets our lastTime variable which is used to determine the time\n * delta for the next time this function is called.\n */\n lastTime = now;\n\n /* This uses the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "3f799ee29722ba760d8cc987b3f906d4", "score": "0.6537735", "text": "function nextFrame() {\n\n y += step;\n\n element.style.top = y + \"px\";\n\n if (distance >= 0) {\n if (y > distance) {\n element.style.top = distance + \"px\";\n }\n\n if (\n y < distance\n ) {\n requestAnimationFrame(nextFrame);\n }\n\n } else {\n if (y < distance) {\n element.style.top = distance + \"px\";\n }\n\n if (y > distance) {\n requestAnimationFrame(nextFrame);\n }\n }\n }", "title": "" }, { "docid": "aebef5437513ba9ffd676b322a8d884f", "score": "0.65313196", "text": "function animloop() {init = requestAnimFrame(animloop); draw(); gameLoop();}", "title": "" }, { "docid": "cb779012143127933f8629a043774731", "score": "0.65127075", "text": "tick() {\n var currentTime = window.performance.now(),\n elapsed;\n\n elapsed = currentTime - this.previousTime;\n this.previousTime = currentTime;\n this.lag += elapsed;\n\n while (this.lag >= this._millisecondsPerFrame) {\n //let beforeUpdate = window.performance.now()\n this._constantly(this.lag / this._millisecondsPerFrame);\n //let afterUpdate = window.performance.now();\n //this.lag -= afterUpdate - beforeUpdate;\n this.lag -= this.millisecondsPerFrame;\n }\n this._constantly(this.lag / this._millisecondsPerFrame);\n this._everyFrame(this.lag / this._millisecondsPerFrame);\n this.updateTimers(this.lag / this._millisecondsPerFrame);\n this.frame++;\n if (this._frameStop === this.frame) {\n this._isRunning = false;\n this._onFrameStop();\n }\n }", "title": "" }, { "docid": "a6edb9ccfe7e3573e0277efb092081fa", "score": "0.64955956", "text": "function runTimeFrame() {\n g.beginPath();\n evolve();\n draw();\n g.stroke();\n}", "title": "" }, { "docid": "b42ba7bef38fbe601c920fb0ec105abc", "score": "0.6490118", "text": "function animateFastCircle() {\n setIncrement(5);\n animateCircle();\n}", "title": "" }, { "docid": "f25e6f7b43a6326a9cd97d54329eb266", "score": "0.6488155", "text": "function frame() {\n if (running) {\n // Draw one frame of the animation, and schedule the next frame.\n updateFrame();\n draw();\n requestAnimationFrame(frame);\n }\n}", "title": "" }, { "docid": "39a3aa37e98ef7c0e6ed48d7ec7ca1ac", "score": "0.648679", "text": "start() {\n requestAnimationFrame((timestamp) => {\n this.secondsPassed = 0;\n this.render(0);\n });\n }", "title": "" }, { "docid": "84cb22df2372d0cd090adbc9c83047fe", "score": "0.6478996", "text": "function nextFrame() {\n if (animation.isRunning) {\n const timeUsed = Date.now() - animation.startOfFrame;\n setTimeout(function() {\n requestAnimationFrame(step);\n }, Math.max(0, animation.frameTime - timeUsed));\n }\n}", "title": "" }, { "docid": "28aca0519569599c177e3e10e3854bef", "score": "0.64761055", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now();\n var dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "95108126cc7119071fc26342fa1212f7", "score": "0.6475291", "text": "function animate() {\n\t\t// Rendering loop.\n\t\t_animationFrameId = window.requestAnimationFrame(animate);\n\t\trender();\n\t\t_stats.update();\n\t}", "title": "" }, { "docid": "06e1aeea44c180b390badcdd9f51fa22", "score": "0.6470799", "text": "function everyFrame() {\n\tupdate();\n\trender();\n\trequestAnimationFrame(everyFrame);\n}", "title": "" }, { "docid": "37167382552ff9d895919d5774205d36", "score": "0.6468865", "text": "function animate() {\n\n\trequestAnimationFrame( animate );\n\n\trender();\n\n}", "title": "" }, { "docid": "9418577b91b60448e8df9fdd7a442f30", "score": "0.64673895", "text": "function animate() {\n\n\trequestAnimationFrame( animate );\n\trender();\n\n}", "title": "" }, { "docid": "68c3b11dd3fe8994cc013e8bed8ed253", "score": "0.6462623", "text": "function animate() {\n\twindow.requestAnimationFrame(animate);\n\trender();\n}", "title": "" }, { "docid": "7392dc65e6aa1d15a2dc4795a26bd0cf", "score": "0.64620847", "text": "function animate() {\n jsDither();\n draw();\n if (gPlaying) {\n requestAnimationFrame(animate);\n }\n}", "title": "" }, { "docid": "26807dfebad0a07f364c3589920d89d4", "score": "0.6458904", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "26807dfebad0a07f364c3589920d89d4", "score": "0.6458904", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "706395b0b16e2b1922f3736180db1ed9", "score": "0.64557916", "text": "function startAnimation()\n{\n\tg_animTime = 0;\n\tg_requestAnimationID = requestAnimationFrame( animationIteration );\n}", "title": "" }, { "docid": "319e77b95b091502b422e4799f685c07", "score": "0.64552814", "text": "startAnimating(fps) {\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.addParticles();\n this.particlesSpread();\n }", "title": "" }, { "docid": "b0fe987e120a556cb1485a49b72949c3", "score": "0.6447081", "text": "function animate(time) {\n requestAnimationFrame(animate);\n // TWEEN.update(time);\n}", "title": "" }, { "docid": "2f8c29e39e1bd2a6bb23cc392195d7e5", "score": "0.6434745", "text": "function init() {\n //little man animation\n\n setInterval(update, 5000); // <------\n}", "title": "" }, { "docid": "2f8c29e39e1bd2a6bb23cc392195d7e5", "score": "0.6434745", "text": "function init() {\n //little man animation\n\n setInterval(update, 5000); // <------\n}", "title": "" }, { "docid": "b9cb3acaf0198a7529991e8210d12f03", "score": "0.6430036", "text": "animate() {\n // request new frame as soon as possible\n if (!this.state.freezed) {\n window.requestAnimationFrame(this.animate);\n }\n // get now and calculate the time that has passed\n const now = Date.now();\n const elapsed = now - this.frameCache.timeOfLastFrame;\n // if more time has passed than the interval between frames\n if (elapsed > this.frameCache.fpsInterval) {\n // set the time of the last frame as now adjusted to smooth out lag\n this.frameCache.timeOfLastFrame = now - (elapsed % this.frameCache.fpsInterval);\n this.render();\n }\n }", "title": "" }, { "docid": "b5266f0af4d24729abeeaefc389d78fc", "score": "0.6427218", "text": "function main() {\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n update(dt);\n render();\n lastTime = now;\n win.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "cf4eae3489874e6d0a84137ad1886ab2", "score": "0.64225227", "text": "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "title": "" }, { "docid": "cf4eae3489874e6d0a84137ad1886ab2", "score": "0.64225227", "text": "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "title": "" }, { "docid": "01ccf2804d550bbdfa770e377fdd0cb9", "score": "0.6407688", "text": "function animate() {\n requestAnimationFrame(animate);\n renderer.render(scene, camera);\n onWindowResize();\n\n uniform.u_time.value = clock.getElapsedTime();\n}", "title": "" }, { "docid": "01ccf2804d550bbdfa770e377fdd0cb9", "score": "0.6407688", "text": "function animate() {\n requestAnimationFrame(animate);\n renderer.render(scene, camera);\n onWindowResize();\n\n uniform.u_time.value = clock.getElapsedTime();\n}", "title": "" }, { "docid": "e5ae5905948299b08634012e6d361a3d", "score": "0.64060366", "text": "function update(time){\n if(time-lastFrameTime < FRAME_MIN_TIME){ //skip the frame if the call is too early\n requestAnimationFrame(update);\n return; // return as there is nothing to do\n }\n lastFrameTime = time; // remember the time of the rendered frame\n // render the frame\n draw1(ctx);\n requestAnimationFrame(update); // get next farme\n}", "title": "" }, { "docid": "c67475d4a6725040056a3c115da20609", "score": "0.64024085", "text": "animate() {\n requestAnimationFrame(this.animate);\n this.t += 0.0005;\n this.hive.position.x = 20 * Math.cos(this.t) + 0;\n this.hive.position.z = 10 * Math.sin(this.t) + 0;\n this.renderer.render(this.scene, this.camera);\n }", "title": "" }, { "docid": "e8c13255f74b7d311b269b60ee4ffcc5", "score": "0.6401129", "text": "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n global.window.requestAnimationFrame(main);\n }", "title": "" }, { "docid": "85feb84b61877fae7bd742934fb666bf", "score": "0.6400942", "text": "function animate() {\n\t\tif(timer == null)\n\t\t\ttimer = setInterval(move, 1000/gameSpeed);\n\t\telse { clearInterval(timer); timer = null; }\n\t}", "title": "" }, { "docid": "e26b03b3df8d74016b4d854983f7b015", "score": "0.6399217", "text": "function main() {\n var now = Date.now();\n var dt = (now - lastTime) / 1000.0;\n\n update(dt);\n render();\n\n lastTime = now;\n requestAnimFrame(main);\n}", "title": "" }, { "docid": "ec09bd7dae0296756ad1244c9fbf9aad", "score": "0.6398575", "text": "function animate() {\n requestAnimationFrame(animate);\n render();\n update();\n }", "title": "" }, { "docid": "5761895d6a03f1312af5f476cf4fa2a4", "score": "0.63976663", "text": "function animate() {\n\trequestAnimationFrame(animate);\n\trender();\n}", "title": "" }, { "docid": "80183cd0f781f756efef6a9c38f673e2", "score": "0.6396044", "text": "function animate() {\n ctx.clearRect(0, 0, canvas.width, canvas.height); //(x,y, dx, dy)\n //ctx.fillRect(20, startingPosition, 60, 60);\n backgroundScrolling();\n\n newPlayer.falling();\n newPlayer.draw();\n createPipes();\n\n if (pauseB) {\n pauseScreen();\n return;\n }\n //testC\n checkBirdHit();\n drawScore();\n showReward();\n\n frame++;\n\n birdHeight += 1;\n if (newPlayer.birdIsAlive === false) {\n gameOver();\n return;\n } else requestAnimationFrame(animate);\n}", "title": "" }, { "docid": "d86c1cb53f8e53b095a425f659779da6", "score": "0.6394866", "text": "function animate(t) {\n requestAnimationFrame( animate );\n render();\n}", "title": "" }, { "docid": "4c0af0f591cbfda718940d63d6652084", "score": "0.63930583", "text": "function game(){\r\n init();\r\n\r\n interval = setInterval(update,1000/fps);\r\n}", "title": "" }, { "docid": "abf4ecd101f7c5d3a7813e39412447d8", "score": "0.6392771", "text": "function animate(timestamp) {\n render();\n requestAnimationFrame(animate);\n }", "title": "" }, { "docid": "54af9680b9a54c502c1f9fabc9a54aa7", "score": "0.63927484", "text": "function animFrame(){\n setTimeout(function(){\n requestAnimationFrame(animFrame, mapdiv);\n updateSim();\n }, 1000/60);\n}", "title": "" }, { "docid": "1e472fb696007b03b64b147cd2ef4a82", "score": "0.63835216", "text": "function animate() {\n\trequestAnimationFrame( animate );\n\trender();\n}", "title": "" }, { "docid": "0e21ced34f99f3bdeebfaa461acc94eb", "score": "0.6382332", "text": "function animate(){\n ctx.clearRect(0,0, enemyPlain.width, enemyPlain.height);\n\n //Sees if enough time has elapsed\n characterTime.now = window.performance.now();\n characterTime.elapsed = characterTime.now - characterTime.then;\n \n //if it did, we draw the frame\n if(characterTime.elapsed > characterTime.fpsInterval){\n \n //calculates then time stamp\n characterTime.then = characterTime.now - (characterTime.elapsed % characterTime.fpsInterval);\n \n //Draw each of the images\n for(let i = 0; i <carArray.length; i++){\n ctx.drawImage(carArray[i].carImg, carArray[i].xPosition, carArray[i].yPosition, 80, 80);\n carArray[i].splat();\n if(carArray[i].xPosition > -10){\n carArray[i].xPosition = carArray[i].xPosition - carArray[i].speed;\n }else{\n carArray[i].xPosition = enemyPlain.width;\n }\n }\n requestID = requestAnimationFrame(function(){\n animate();\n }); \n }else{\n cancelAnimationFrame(requestID);\n requestID = undefined;\n xPosition = enemyPlane.width\n requestID = requestAnimationFrame(function(){\n animate();\n });\n }\n}", "title": "" }, { "docid": "3d3434916a38a5bdca1ca217c6894a4e", "score": "0.6382079", "text": "updateFrame () {\n this.currentFrame = ++this.currentFrame % this.frameCount; // returns 0-3\n this.sourceX = this.currentFrame * this.width; // updates the sourceX for sprite animation purposes\n }", "title": "" }, { "docid": "760f5880508b412546afab1e763bf6b0", "score": "0.63801974", "text": "function animate()\n{\n var T;\n var ease;\n var time = (new Date).getTime();\n\n\n T = limit_3(time-animation.starttime, 0, animation.duration);\n\n if (T >= animation.duration)\n {\n clearInterval (animation.timer);\n animation.timer = null;\n animation.now = animation.to;\n }\n else\n {\n ease = 0.5 - (0.5 * Math.cos(Math.PI * T / animation.duration)); ///\n animation.now = computeNextFloat (animation.from, animation.to, ease);\n }\n\n animation.setValue( animation.now );\n}", "title": "" }, { "docid": "a9e9c07aa5bc5e852ef8b7fc84c9c610", "score": "0.63784766", "text": "tick(time) {\n canvasInteractor.fpsCount(time);\n for (const instance of canvasInteractor.instances) {\n instance.notify('tick',{t:time,dt:(time-instance.t)/1000,dirty:instance.dirty}); // notify listeners .. \n instance.t = time;\n instance.dirty = false;\n }\n canvasInteractor.rafid = requestAnimationFrame(canvasInteractor.tick); // request next animation frame ...\n }", "title": "" }, { "docid": "133746ff9eff17c798a491b6044b5427", "score": "0.63747346", "text": "function speedy(){\n xspeed = 5;\n}", "title": "" }, { "docid": "2c1e2ea1bfa3f57011b0fcb827e34d10", "score": "0.6373396", "text": "function FireAnim(timestamp){\n\t setTimeout(function(){ //throttle requestAnimationFrame to 20fps\n\t for(i=0;i<fire.length;i++){\n\t\tfire[i].animRow+=63.875;\n\t\tfire[i].fireCounter++;\n\t\tif(fire[i].fireCounter ==8){\n\t\t\tfire[i].fireResetCounter++;\n\t\t\tfire[i].fireCounter =0;\n\t\t\tfire[i].animRow=0;\n\t\t\tfire[i].animCol+=127.75;\n\t\t}\n\t\tif (fire[i].fireResetCounter==4){\n\t\t\tfire[i].fireResetCounter=0;\n\t\t\tfire[i].fireCounter=0;\n\t\t\tfire[i].animRow=0;\n\t\t\tfire[i].animCol=0\n\t\t}\n\t}\n\trequestAnimationFrame(FireAnim)\n\t },1000/20)\n}", "title": "" }, { "docid": "c7f55ee13d67fac9584a85ab5fd96264", "score": "0.63733065", "text": "function animate(time) {\n requestAnimationFrame(animate);\n TWEEN.update(time);\n}", "title": "" } ]
f6f775445c60baced9bf9a31f48ace80
funcao chamada pelo servidor para cada vez que alguem da ready ter controle sobre o contador de
[ { "docid": "1d9aaa5b4a65d75e913747368ff9c48d", "score": "0.0", "text": "function updateCounter (data) {\n\tif (ready)\n\t\tdocument.getElementById('control').innerHTML = '<div>' +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'<form id=\"controls\">' +\n\t \t'<a href=\"#\" class=\"btn btn-primary\" disabled>' + data.readyCounter + '/' + data.clients + '</a>' +\n\t \t'<p></p>' +\n\t \t'</form>' +\n\t '</div>';\n}", "title": "" } ]
[ { "docid": "d9339afcfcca9f04b5f6dea72769cf29", "score": "0.67772585", "text": "function connessioneClient() {\n if (statoConn == 0) { \n client.connect(port, host, function () {\n statoConn = 1;\n ee.emit('Logga', 'Connessione', 'Connesso al Server Raspberry');\n })\n }\n}", "title": "" }, { "docid": "1dd5cac02c9877d353cd197e8165d3b7", "score": "0.6764691", "text": "function iniciar(){\n\tfunction arrancaServidor(requiere, respuesta){\n\t\tconsole.log(\"Hola consola, alguien se ha conectado\"); // cada vez que alguien se conecte al servidor web se verá este mensaje en la consola\n\t\t//ese mensaje aparecerá 2 veces en la consola, porque el navegador suele enviar 2 peticiones, una para el favicon y otra para la página web en sí.\n\t\trespuesta.writeHead(200, {\"Content-Type\":\"text/html\"});\n\t\trespuesta.write(\"<h1>El servidor funciona correctamente</h1>\"); // Se verá en el navegador\n\t\trespuesta.end();\n\t}\n\tservidor.createServer(arrancaServidor).listen(8080); //crea un servidor arrancaServidor y se queda escuchando peticiones en el puerto 8080\n}", "title": "" }, { "docid": "41b32eb130d7b1c87da867e13e12ed5e", "score": "0.6731445", "text": "function controlloconnessione() {\n console.log(\"Entrato nella funzione controlloconnessione\");\n if (statoConn == 0) {\n client.connect(port, host, function () {\n statoConn = 1;\n ee.emit('Logga', 'Connessione', 'Connesso al Server Raspberry');\n })\n // Appena questo client si collega con successo al server, inviamo dei dati che saranno ricevuti dal server quale messaggio dal client\n }\n}", "title": "" }, { "docid": "442a482820f5178471538b5847b02556", "score": "0.6688823", "text": "function pedirEstadoServidores(){\n console.log('<all-status> al DIST_MON');\n sockClientDistMon.emit('all-status');\n}", "title": "" }, { "docid": "946c9ccbd8a449c455ce9f910626064d", "score": "0.66535306", "text": "msgOnConectado(cliente){\n\t\tcliente.socket.on('conectado', data => {\n\t\t\tif(data.length > 0)\n\t\t\t\tcargarListaPartidas(data);\n\t\t\telse\n\t\t\t\tcargarListaPartidas(false);\n\t\t});\n\t}", "title": "" }, { "docid": "3d70d1745f0e57841e7245ae773f141c", "score": "0.65430695", "text": "_readyClients() {\n this.__enableOrFlushClients();\n }", "title": "" }, { "docid": "d00fda4002ce5bb7d4d31cf76188b2c5", "score": "0.6443785", "text": "async ready() {\n await this.report('The client is ready!');\n this.isReady = true;\n if (config.ping) {\n if (this.pingInterval) {\n clearInterval(this.pingInterval);\n }\n this.pingChat = await (await this.client\n .getContactById(config.ping.contact))\n .getChat();\n this.pingInterval = setInterval(\n this.ping.bind(this),\n config.ping.interval || 60 * 60 * 1000\n );\n }\n }", "title": "" }, { "docid": "3fce177d6af385b026bf0a1107fa4854", "score": "0.6439871", "text": "function onStartServer() {\n\n}", "title": "" }, { "docid": "7d657dc36d066a81279b5177163c3d12", "score": "0.63257194", "text": "ready() {}", "title": "" }, { "docid": "7d657dc36d066a81279b5177163c3d12", "score": "0.63257194", "text": "ready() {}", "title": "" }, { "docid": "7d657dc36d066a81279b5177163c3d12", "score": "0.63257194", "text": "ready() {}", "title": "" }, { "docid": "7d657dc36d066a81279b5177163c3d12", "score": "0.63257194", "text": "ready() {}", "title": "" }, { "docid": "7a908604a0d88d207a8d6f5a36e823ce", "score": "0.6307225", "text": "run() {\n this.api = this.api.listen(this.port);\n\n // Escucha los eventos del servidor (para realizar acciones en caso de ser necesario)\n this.api\n .on('listening', () => {\n console.log(` Servidor escuchando a través del puerto ${this.port}. `.bgBlue);\n })\n .on('close', () => {\n console.log(' El servidor se ha detenido. '.bgRed);\n });\n }", "title": "" }, { "docid": "a5c485379ee917157bf91dbeb32b198c", "score": "0.6262157", "text": "onready() {}", "title": "" }, { "docid": "7a92f516e3077a7bca63df3e3439875c", "score": "0.6235758", "text": "function f_IniciarEnvioRespostas(){\n // programa uma verificação para daqui 5 segundos\n\ttmrEnvResps = setTimeout(\"f_EnviarRespostasServidor(function(a){})\", 5000);\n}", "title": "" }, { "docid": "39871ab8770152b85e6b1356a68be041", "score": "0.6209833", "text": "function checkServerUp() {\n portInService(8888, function(up) {\n if (up) {\n callback();\n } else {\n setTimeout(checkServerUp, 100);\n }\n });\n }", "title": "" }, { "docid": "104d7d026ab3b2e62afaaf10000851ea", "score": "0.61913633", "text": "function isReady () {\n postMessage({\n type: 'STATUS',\n message: 'READY'\n });\n}", "title": "" }, { "docid": "fe71abe633646e719ad5cb318a8ce3bb", "score": "0.6110416", "text": "function servoOn(){\n console.log(\"click sul bottone 'Ruota il servo'\");\n var requestUrl = \"http://\" + DEVICE_IP + \"/servoOpen\";\n $.get(requestUrl, function(){\n //alert(\"sto facendo una get all'ESP8266\");\n console.log(\"sto facendo una get all'ESP8266\"); \n });\n\n}", "title": "" }, { "docid": "9e4e7f80d1c2f471a8bf3fdc1bbdc6ee", "score": "0.6104972", "text": "function ready() {\n if (READY) return;\n READY = 1;\n utils.each(READY_BUFFER,\n function(connect) {\n connect();\n });\n }", "title": "" }, { "docid": "91ed812707c7eb31b77776dcfcbbd833", "score": "0.6101392", "text": "function onConnect() {\n client.subscribe(\"/home/socket/response/#\");\n connectDef.resolve();\n ClientService.setConnected(true);\n }", "title": "" }, { "docid": "8622d87a7bf60f80783f755a1efe19e6", "score": "0.6084419", "text": "isServerUp() {\n HTTP.get('/images/logo.png?d='+Date.now(), {}, (err, results) => {\n let connected = !err;\n log.debug('http server check, connected:', connected);\n this.updateRebootStatus(connected, true);\n this.setState({status: this.rebootStatus}); // Force update/render\n })\n }", "title": "" }, { "docid": "7f75826560e9052fdc91a7bf6fbb0409", "score": "0.60634196", "text": "function ready() { timeout( function() {\n if (READY) return;\n READY = 1;\n each( READY_BUFFER, function(connect) { connect() } );\n}, SECOND ); }", "title": "" }, { "docid": "fb5bd7cda03f6a0374c282eba3fee68f", "score": "0.60531026", "text": "function FYEUCAUCHECKSERVER() {\n io.sockets.emit('YEUCAUCHECKSERVER', {\n CHECK: 1,\n });\n}", "title": "" }, { "docid": "55fa36258db73966129db2f74ee2e262", "score": "0.60435027", "text": "triggerReady() {\n \tif(this.checkIfReady()) {\n \t\tthis.client.emit(\"ready\");\n \t} else {\n \t\tif(this.client.DEBUG) console.log(\"Couldn't trigger ready due to being not ready\");\n \t\treturn false;\n \t}\n }", "title": "" }, { "docid": "5c966d1af15e49c9340814258e5bd4da", "score": "0.60211784", "text": "function whenServerReady(cb) {\n var serverReady = false;\n var appReadyInterval = setInterval(() =>\n checkAppReady((ready) => {\n if (!ready || serverReady) {\n return;\n }\n clearInterval(appReadyInterval);\n serverReady = true;\n cb();\n }),\n 100);\n}", "title": "" }, { "docid": "5c966d1af15e49c9340814258e5bd4da", "score": "0.60211784", "text": "function whenServerReady(cb) {\n var serverReady = false;\n var appReadyInterval = setInterval(() =>\n checkAppReady((ready) => {\n if (!ready || serverReady) {\n return;\n }\n clearInterval(appReadyInterval);\n serverReady = true;\n cb();\n }),\n 100);\n}", "title": "" }, { "docid": "17094a1e87cca9876adb5d1a967f2386", "score": "0.59957486", "text": "function serverConnected() {\n print(\"We are connected!\");\n}", "title": "" }, { "docid": "7fb774739ef4ff595b1b01363a95805d", "score": "0.59949905", "text": "function onConnect() {\n\n console.log(no_seri);\n \n\n swal(\n 'Success',\n 'Koneksi ke server',\n 'success'\n )\n\n $('#btn_set_kwh').button('reset');\n\n client.subscribe(\"/\"+no_seri+\"/data\");\n\n }", "title": "" }, { "docid": "16a2113fc3ec2e1a6aaa0e9209427232", "score": "0.5987725", "text": "function connectToServer() {\n\n }", "title": "" }, { "docid": "490a28fc65f88669499e4d0e6406b21e", "score": "0.5974348", "text": "function enviarClasifiacionServidor(nombreResiduo, id_residuo, porcentaje){\n \n nombreResiduo = nombreResiduo.trim();\n \n //si no hay nada NO SE ENVÍA NADA (no hace nada) al servidor\n if(nombreResiduo !== \"NADA\" && proceso === false){\n //Esperar unos segundos para verificar realmente qué es lo que cae en la plataforma\n cont_espera++;\n console.log(\"identificando objeto :) \",cont_espera,\"----> \",nombreResiduo);\n\n if(cont_espera >= 8){\n señal = true; \n proceso = true;\n \n if(nombreResiduo === \"BOTELLA\"){ \n console.log(\"es una botella\");\n // se evía al servidor para clasificarlo en el contenedor de botellas\n EnvioBasuraProcessAjax(nombreResiduo, id_residuo); \n }else{\n // se envía al servidor para clasificarlo en el contenedor de residuos normales\n EnvioBasuraProcessAjax(nombreResiduo, id_residuo);\n console.log(\"es otra cosa\")\n }\n \n envCantS++;\n \n console.log(\"Enviando servidor...\",envCantS,\"veces\"); \n\n }\n\n\n }else{\n // En el caso de que exista un bloqueo.\n // por ejemplo cuando el modelo nologre capturar la etiqueta de 'NADA' durante 10 segundos. En este caso se inicializa todo de nuevo\n if(señal){\n envCantS++;\n if(envCantS==10){\n señal = false;\n proceso = false;\n envCantS = 0;\n cont_espera=0;\n console.log(\"ERROR, enviando otra vez\");\n }\n console.log(\"Tardando proceso \",envCantS,\" veces\");\n }\n //Se espera que después de realizar una clasificació, la etiqueta sea 'NADA'\n if(nombreResiduo === \"NADA\"){\n señal = false;\n proceso = false;\n envCantS = 0;\n cont_espera=0;\n }\n }\n}", "title": "" }, { "docid": "e84391442ea406da366d93760a5fe009", "score": "0.59723127", "text": "function serverConnected() {\n print(\"We are connected!\");\n}", "title": "" }, { "docid": "3d3268fc0b28999305b0aeaf6fd56206", "score": "0.5966241", "text": "function comprobarConexion(){\n new Ajax.Request('test.html',{\n onComplete: function(inServerResponse) {\n if(inServerResponse.status != 200 || navigator.onLine == false){\n Ext.MsgPopup.msg(APP_TITLE, \"Vaya, por el momento estamos sin conexi\\u00f3n!<br>Espera unos pocos minutos y trata de nuevo.\", MsgPopup.WARNING);\n ONLINE = false;\n }else if(ONLINE == false){\n Ext.MsgPopup.msg(APP_TITLE, \"El servicio ha regresado!.\", MsgPopup.INFO);\n ONLINE = true;\n }\n }\n });\n}", "title": "" }, { "docid": "5b00bbb8f55a61cbca40b3fcd3979114", "score": "0.5963312", "text": "async function serverWakeUp() {\n let getResult = null;\n try {\n getResult = await $.get(indexUrl);\n } catch (error) {\n getResult = await $.get(indexUrl);\n } finally {\n if (getResult.status == \"success\") {\n setInitLoadingProgress(50 + Math.round(Math.random() * 6) * 5); // 50% - 75%\n change(1, 1);\n }\n }\n}", "title": "" }, { "docid": "26ccafa78a9143c215ad045373acf27f", "score": "0.5949413", "text": "async procesar() {\n\t\tconsole.log(\"Procesando... el servidor de fondo esta procesando...\");\n\t\tawait this.hacerPeticion();\n\t\tthis.mandarRespuesta()\n\t}", "title": "" }, { "docid": "28ce5092dba5388533cc0db6e50964d2", "score": "0.59457767", "text": "function part() {\n // conn.send('SERVER_PART');\n conn.close();\n }", "title": "" }, { "docid": "94aca965f36134dcacefd7c2c029610f", "score": "0.593786", "text": "ready() {\n this.registerMessages();\n this.setReady();\n }", "title": "" }, { "docid": "01e96571de57b7fe31fd8d286a244196", "score": "0.59331834", "text": "function recargaDatos()\r\n\t{\r\n\t\tif(http.readyState ==4)\r\n\t\t\t{\r\n\t\t\tif (http.status == 200)\r\n\t\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t/*Respuesta del servior correcta*/\r\n\t\t\t\t/*Recoge el valor en segundos del archivo xml*/\r\n\t\t\t\tvar segundos = http.responseXML.getElementsByTagName(\"hora\")[0].childNodes[0].nodeValue\r\n\t\t\t\t//milisegundos desde 1970(Época Unix)\r\n\t\t\t\thoraServer.setTime(Number(segundos)*1000);\r\n\t\t\t\t\r\n\t\t\t\t//muestra la fecha de ultima sincronización con el servidor\r\n\t\t\t\tdocument.getElementById('servidor').innerHTML = \"</p><p>&Uacute;ltima sincronizaci&oacute;n con el servidor: \"+ horaServer + \"</p>\";\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t//mensaje de error\r\n\t\t\t\tdocument.getElementById('servidor').innerHTML = '<p><img src=\"img/error.jpg\"> No se encuentra el servidor</p>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\telse\r\n\t\t\t{\r\n\t\t\t\tdocument.getElementById('servidor').innerHTML = '<p>Waiting server...<img src=\"img/wait.gif\"></p><p>';\r\n\t\t\t}\r\n\t}", "title": "" }, { "docid": "c967999b03386f73042452af3b0b14c7", "score": "0.59268904", "text": "started() {\n\t//\tclient.start();\n\t}", "title": "" }, { "docid": "a78fee469027a7830d39695f7db188dc", "score": "0.59141093", "text": "execute() {\n // inicializar al middleware\n this.middlewares();\n\n // inicializamos las configuraciones de sockets\n this.configurarSockets();\n\n // inicializar el server\n this.server.listen(this.port, () => {\n console.log(\"Server corriendo en el puerto :\", this.port);\n });\n }", "title": "" }, { "docid": "f46129c76eb95ae7c4766e3078ecf7bc", "score": "0.5907829", "text": "function getServerConnected(request, response, next) {\n respond.success(response, { connected: true });\n}", "title": "" }, { "docid": "4be8b62f54d478d016cdd00e42f4135b", "score": "0.5905944", "text": "function sendReady() {\n if (!isReady) {\n sendMessageString('isReady' + userName)\n setIsReady(true)\n }\n }", "title": "" }, { "docid": "1ffcd79f12aa4801622c5dcd77a17c40", "score": "0.5904065", "text": "function bind_status(el, server) {\n server.onopen = function() {\n el.style.color = 'green';\n el.textContent = 'connected';\n };\n server.onclose = function() {\n el.style.color = 'red';\n el.textContent = 'disconnected';\n };\n }", "title": "" }, { "docid": "1a909ecfa2a9a2abffed01cc463719ec", "score": "0.59000415", "text": "ready() { }", "title": "" }, { "docid": "592b1619df188cfcc4a73fc18836c7a0", "score": "0.5899804", "text": "function heartbeat() {\n\tsendDataToServer();\n}", "title": "" }, { "docid": "0a2a85e29ed6ccc639eb743fd8b382cc", "score": "0.5899103", "text": "connectedCallback() {\n this.__ready = true;\n }", "title": "" }, { "docid": "a7424ba000005a45393bdca859ad68dd", "score": "0.58948636", "text": "function serverUpCallback(){\n\tconsole.log(\"listening on port: \" + port);\n}", "title": "" }, { "docid": "f6a0f68198dc42a199106cca145a0d11", "score": "0.5894454", "text": "async function sendReady(_event) {\n if (user == \"jsn\") {\n jsn = true;\n jsnDiv.style.backgroundColor = \"#77dd77\";\n jsnP.innerHTML = \"I'm ready\";\n }\n if (user == \"dim\") {\n dim = true;\n dimDiv.style.backgroundColor = \"#77dd77\";\n dimP.innerHTML = \"I'm ready\";\n }\n if (user == \"drnz\") {\n drnz = true;\n drnzDiv.style.backgroundColor = \"#77dd77\";\n drnzP.innerHTML = \"I'm ready\";\n }\n if (user == \"hnrk\") {\n hnrk = true;\n hnrkDiv.style.backgroundColor = \"#77dd77\";\n hnrkP.innerHTML = \"I'm ready\";\n }\n if (user == \"olx\") {\n olx = true;\n olxDiv.style.backgroundColor = \"#77dd77\";\n olxP.innerHTML = \"I'm ready\";\n }\n buttonHTML.addEventListener(\"click\", sendNotReady);\n buttonHTML.removeEventListener(\"click\", sendReady);\n let message = \"ready\";\n let can = text.value;\n let url = \"https://bajergis-gis-2020.herokuapp.com\";\n url += \"/send\" + user + \"Ready\" + \"?\" + \"username=\" + user + \"&message=\" + message + \"&can=\" + can;\n console.log(\"successfully sent!\");\n await fetch(url);\n pullStatus();\n //hopefully right one\n text.value = \"\";\n }", "title": "" }, { "docid": "83b36b544d135d8cd190799871d961b1", "score": "0.5892414", "text": "isReady() {\n return new Promise((resolve, reject) => {\n const client = net.createConnection(this.port);\n\n client.once('error', error => {\n clearConnection(client);\n reject(error);\n });\n\n client.once('connect', () => {\n clearConnection(client);\n resolve();\n });\n });\n }", "title": "" }, { "docid": "aad287b24a6303f88fa9c585d586cedc", "score": "0.5884612", "text": "despertarServidor(){\n\n //Leventamiento del servidor (abrimos el restaurante)\n this.app.listen(process.env.PORT,function(){\n console.log(`Estoy conectado al puerto ${process.env.PORT}`);\n });\n\n }", "title": "" }, { "docid": "7f844616666074625400bd1f49b0f223", "score": "0.5882612", "text": "readyToSpinEvent ()\n {\n /**\n * Success connect to server\n */\n if(this._successInit === false){\n this._successInit = true;\n\n if(typeof this._callbackInit == 'function'){\n this._callbackInit();\n\n this._callbackInit = null;\n }\n }\n }", "title": "" }, { "docid": "3b9ee79666da370c871b04e128ebf546", "score": "0.5880642", "text": "function waitConnection() {\n socket.onmessage = (event) => {\n\n let d = JSON.parse(event.data);\n\n switch (d.key){\n\n case 'ids':\n\n showClientsOnline(d.data);\n break;\n case 'logout':\n\n showClientsOnline(d.data);\n break;\n case 'ban':\n console.log('ban ',d.data);\n\n break;\n case 'mute':\n console.log('mute ',d.data);\n\n break;\n case 'message':\n showMessage(JSON.parse(d.data));\n break;\n default:\n console.log(\"cannot get data\");\n }\n\n $(\"#subscribe\").scrollTop(999999999999);\n\n };\n\n socket.onclose = (event) => {\n if (event.wasClean) {\n alert('Connection is closed');\n } else {\n alert('Connection gap');\n }\n };\n}", "title": "" }, { "docid": "76ced98cd6bde3eea1654eb0ee221290", "score": "0.58794105", "text": "msgSocketOnCrearPartida(servidor,socket,juego){\n\t\tsocket.on(\"crearPartida\", (num,nombre) => {\n\t\t\tlet result = juego.crearPartida(parseInt(num),nombre);\n\t\t\tif(!(\"msg\" in result)){\n\t\t\t\tconsole.log(\"Nueva partida : \"+result.codigoPartida);\n\t\t\t\tsocket.leave(\"acogida\");\n\t\t\t\tsocket.join(result.codigoPartida);\n\t\t\t\tservidor.serverEnviarACliente(socket,\"partidaCreada\",{\"nombre\":nombre,\"codigo\":result.codigoPartida,\"isOwner\":true});\n\t\t\t\tservidor.serverEnviarARoom(socket,\"acogida\",\"nuevaPartidaDisponible\",{\"codigo\":result.codigoPartida,\"numJug\":1,\"numJugMax\":num});\n\t\t\t}\n\t\t\telse\n\t\t\t\tservidor.serverEnviarACliente(socket,\"partidaCreada\",result);\n\t\t});\n\t}", "title": "" }, { "docid": "00a2f6ee05c0be820906b4001af835e7", "score": "0.5872681", "text": "function sendPING() {\n \n client.write('50F70A3F730150494E4773C4')\n \n console.log('HEARBEAT')\n\n }", "title": "" }, { "docid": "36349433bcd356114a9f0c27b021afa5", "score": "0.58708495", "text": "isReady() {\n this.socker.on('is-ready', () => {\n this.store.clients.forEach(player => {\n if (player.id === this.socker.id) {\n player.isReady = true;\n }\n });\n this.showPlayers();\n\n const arePlayersReady = this.store.clients.every(player => player.isReady === true);\n if (arePlayersReady) {\n this.beginDraft();\n }\n });\n }", "title": "" }, { "docid": "7d5ea1ed5a9eff0f9f091e3152b791b8", "score": "0.5857375", "text": "function preChan(cb) {\n\t\t//console.log('conn');\n\t\tvar connection = MikroNode.getConnection(serverIp, 'admin', '123456789#a');\n\t\t//console.log('affter conn');\n\t\tconnection.closeOnDone = true;\n\n\t\tconnection.connect(function (conn) {\n\t\t\tvar chan = conn.openChannel();\n\t\t\tchan.closeOnDone = true;\n\t\t\t//showUser(chan);\n\t\t\tcb(chan, conn);\n\n\t\t});\n\t\t// connection.getConnectPromise().then(function (conn) {\n\t\t// \tconn.getCommandPromise('/ip/address/print').then(function resolved(values) {\n\t\t// \t\tconsole.log('Addreses: ' + JSON.stringify(values));\n\t\t// \t}, function rejected(reason) {\n\t\t// \t\tconsole.log('Oops: ' + JSON.stringify(reason));\n\t\t// \t});\n\t\t// });\n\t}", "title": "" }, { "docid": "f46150ec0967de277a3e77828e942b58", "score": "0.58528894", "text": "async start() {\n this.waitingPromise = new DeferredPromise();\n this.socket.onMessage((msg) => {\n if (msg.type === TYPES.CHANNELS_INFO) {\n this._handleChannelInfo(msg);\n }\n if (msg.type === TYPES.REPLY) {\n this.rpcManager.onReply(msg, this.routerName);\n }\n });\n\n this.socket.onDisconnected((peerId) => {\n global.logger.error(`Router ${this.routerName} disconnesso...`);\n this.rpcManager.dropPendingRpc(peerId);\n if (this.onDisconnectHandler) {\n this.onDisconnectHandler();\n }\n this.waitingPromise = new DeferredPromise();\n });\n\n\n global.logger.info(`In connessione al router ${this.routerName}...`);\n\n await this.socket.start();\n\n global.logger.info(`Connesso al router ${this.routerName}`);\n\n\n if (this.config.waitChannels) {\n global.logger.info(`Aspetto i canali [ ${this.config.waitChannels} ] per il router ${this.routerName}`);\n await this.waitingPromise.wait();\n }\n if (this.onConnectHandler) {\n this.onConnectHandler();\n }\n global.logger.info(`Client per router ${this.routerName} attivo`);\n\n this.socket.onReady(async () => {\n if (this.config.waitChannels) {\n global.logger.info(`Aspetto i canali [ ${this.config.waitChannels} ] per il router ${this.routerName}`);\n await this.waitingPromise.wait();\n if (this.onConnectHandler) {\n this.onConnectHandler();\n }\n }\n });\n }", "title": "" }, { "docid": "cb8cf8411498abefb16b9105616591ae", "score": "0.5838113", "text": "function checkServerStatusAndRunWhenItDown(){\n _.forEach(serverList, (server) => {\n http.get(server.heartbeat, (res) => {\n if(res.statusCode === 200) {\n setServerActiveStatus(server, true);\n return;\n }\n\n handleServerWhenDown(server, res);\n }).on('error', (error) => {\n handleServerWhenDown(server, error);\n });\n });\n}", "title": "" }, { "docid": "6a0253fee1ff337ffcea4d46269f0f47", "score": "0.58374065", "text": "solicitarAtencion() {\n if (this.isViewMsjSolicitudPersoanl) {\n return;\n }\n\n console.log('notificar-cliente-llamado');\n this.socketService.emit('notificar-cliente-llamado', this.infoToken.numMesaLector);\n this.isViewMsjSolicitudPersoanl = true;\n setTimeout(() => {\n this.isViewMsjSolicitudPersoanl = false;\n }, 30000);\n }", "title": "" }, { "docid": "b14df2834e369cd63e4646231ccb5230", "score": "0.5837114", "text": "function pingServer() {\n\n const timeout = 25 * 60 * 1000 // 25 minutes\n\n setInterval(function() {\n\n const options = {\n host: config.get(\"url_prod\"),\n port: 8080,\n path: \"/\"\n };\n\n http.get(options, function(res) {\n res.on(\"data\", function(chunk) {\n try {\n // optional loggin\n } catch (err) {\n console.log(err.message);\n }\n });\n }).on(\"error\", function(err) {\n console.log(\"Error: \" + err.message);\n });\n }, timeout);\n}", "title": "" }, { "docid": "61c8fcd9da468a3360f54ac8a06e5094", "score": "0.5832736", "text": "function server_listening() {\n console.log('Server is starting...');\n console.log('Server listening...');\n}", "title": "" }, { "docid": "9fae972880f0afb2f8bb714f3e6d7a36", "score": "0.5824656", "text": "_checkReady() {\n for (let shardId in this.shards) {\n if (this.shards.hasOwnProperty(shardId)) {\n if (!this.shards[shardId].ready) {\n return;\n }\n }\n }\n /**\n * @event Client#ready\n * @type {void}\n * @description Emitted when all shards turn ready\n * @example\n * //Connect bot to discord and get a log in the console once it's ready\n * let bot = new CloudStorm(token)\n * await bot.connect()\n * bot.on('ready', () => {\n * // The bot has connected to discord successfully and authenticated with the gateway\n * });\n */\n this.client.emit('ready');\n }", "title": "" }, { "docid": "322ee78161aec14ac35fe3be0e282e15", "score": "0.58201706", "text": "function isReady() {\n\treturn new Promise((resolve, reject) => {\n\t\tconst options = {\n\t\t\thost: 'localhost',\n\t\t\tport: 6094,\n\t\t\tpath: '/ready',\n\t\t};\n\n\t\tconst callback = (res) => {\n\t\t\tlet data = '';\n\t\t\n\t\t\tres.on('data', (chunk) => {\n\t\t\t\tdata += chunk;\n\t\t\t});\n\t\t\t\n\t\t\tres.on('end', () => {\n\t\t\t\tresolve(data === 'OK');\n\t\t\t});\n\n\t\t\tres.on('error', reject);\n\t\t};\n\t\ttry {\n\t\t\tconst req = http.request(options, callback);\n\t\t\treq.on('error', reject);\n\t\t\treq.end();\n\t\t} catch (e) {\n\t\t\treject(e);\n\t\t}\n\t});\n}", "title": "" }, { "docid": "2de8466d0b4e79baf73fc460f3f6e9be", "score": "0.5803415", "text": "onReady() {\n this.ready = true;\n console.log(\"ws port open\");\n }", "title": "" }, { "docid": "033ca509950fc760352679e52892f7b8", "score": "0.5800115", "text": "function testConn(){\n var xmlhttp=new XMLHttpRequest();\n xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){postMessage(\"CONNECTED\");}else{postMessage(\"OFFLINE\");}}}\n xmlhttp.open(\"GET\",\"/bin/detectoffline/heartbeat.servlet.php\",true);\n xmlhttp.send();\n}", "title": "" }, { "docid": "63265f67b6d73d41bfd1acbbde2f9d2c", "score": "0.5792623", "text": "function pingServer() {\n if (userState.doPing) {\n setTimeout(function() {\n COMM.json(\"/ping\", {}, function(response) {\n setRobotState(response);\n pingServer();\n });\n }, 5000);\n }\n}", "title": "" }, { "docid": "02c91e5095f9f8f4ae02e7201f8579d9", "score": "0.57892954", "text": "function client_ready(){\r\n\r\n if(!error){\r\n\r\n\r\n \r\n /*\r\n \r\n provide each of the method handlers\r\n\r\n the container supplier will map these for stamping portals etc\r\n \r\n */\r\n\r\n supplier.stampwrapper({\r\n type:'quarry/containers'\r\n })\r\n supplier.portalwrapper();\r\n supplier.selectwrapper(handlers.select(mongoclient));\r\n supplier.appendwrapper(handlers.append(mongoclient));\r\n supplier.savewrapper(handlers.save(mongoclient));\r\n supplier.deletewrapper(handlers.delete(mongoclient));\r\n\r\n }\r\n\r\n finished();\r\n }", "title": "" }, { "docid": "61ad2466331e397b730e821b65efb652", "score": "0.5777258", "text": "async function ready(){\n\n\t// Print some statistcs.\n\n\t// No further processing beyond this point.\n\tlogger.logInfo(\"Ready!\");\n}", "title": "" }, { "docid": "b42fa2fd5f249e124ef90340c58313cc", "score": "0.57758325", "text": "function _readyHandler() {\n _player.onBuffer(_bufferHandler);\n _player.onIdle(_idleHandler);\n _player.onTime(_timeHandler);\n if(window.addEventListener) {\n window.addEventListener('beforeunload',_unloadHandler);\n } else if (window.attachEvent) {\n window.attachEvent('onbeforeunload', _unloadHandler);\n } else {\n window.onbeforeunload = _unloadHandler;\n }\n if(window.top != window) {\n _referrer = document.referrer;\n } else { \n _referrer = window.location.href;\n }\n _sendPing('ready');\n }", "title": "" }, { "docid": "1779ed5ea7c346b23c95a021261187e6", "score": "0.57664776", "text": "function pingServer() {\n setTimeout(function() {\n getRoomsInfo();\n pingServer();\n }, 3200);\n}", "title": "" }, { "docid": "00cf67c4f59310638a16274836d62f02", "score": "0.5762842", "text": "function RTCIceServer() {\n}", "title": "" }, { "docid": "3fc867d1bf6483a418c4f77035fc59e9", "score": "0.57583666", "text": "function loop() {// Dès qu'un membre se connecte\n\twsServer.on('connection', function(ws) {\n\t\t// IP du client\n\t\t//lientIp = new String(ws._socket.remoteAddress);\n\t\t// Test quel type de client se connecte (arduino ou écran)\n\t\t//if (clientIp.valueOf() == arduinoIp.valueOf()) {\n\t\t// sauvegarde de la\n\t\t// Envoie des infos aux\n\t\t// Si c'est un ecran\n\t\tplayerConnection(ws);\n\t\tconsole.log(\"client connected !\");\n\t\t\n\t\t// Dès qu'on reçoit un message\n\t\tws.onmessage = function(message){\n\t\t\t// Traitement de l'action en fonction du message\n\t\t\tvar new_message = JSON.parse(message.data);\n\t\t\tmessageReceived(new_message, ws);\n\t\t};\n\n\t\tws.on('close', function(){\n\t\t\tvar tmp = -1;\n\t\t\tfor(var i in listWsClient)\n\t\t\t{\n\t\t\t\tif(listWsClient[i] == ws)\n\t\t\t\t{\n\t\t\t\t\ttmp = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//reprendre quand amélioration TAG LHI\n\t\t\tfor(var k in matchStatus)\n\t\t\t{\n\t\t\t\tif(matchStatus[k].black == ws)\n\t\t\t\t{\n\t\t\t\t\tmatchStatus[k].black = null\n\t\t\t\t}\n\t\t\t\telse if(matchStatus[k].red == ws)\n\t\t\t\t{\n\t\t\t\t\tmatchStatus[k].red = null\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfor(var j in matchStatus[k].viewers_list)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(matchStatus[k].viewers_list[j] == ws)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmatchStatus[k].viewers_list.splice(j, 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole.log(\"deconnexion de \" + tmp);\n\t\t\tlistWsClient.splice(tmp, 1);\n\t\t});\n\n\t\tws.on('open', function() {\n\t\t\tconsole.log(\"connected\");\n\t\t});\n\t});\n}", "title": "" }, { "docid": "0d77af28e7b75684cb80748a6bc106cc", "score": "0.5753518", "text": "function serverConnected() {\n console.log(\"Connected to Server\");\n}", "title": "" }, { "docid": "0d77af28e7b75684cb80748a6bc106cc", "score": "0.5753518", "text": "function serverConnected() {\n console.log(\"Connected to Server\");\n}", "title": "" }, { "docid": "0d77af28e7b75684cb80748a6bc106cc", "score": "0.5753518", "text": "function serverConnected() {\n console.log(\"Connected to Server\");\n}", "title": "" }, { "docid": "2461b0d90305bdd1c5ef8bb1a1f38fa1", "score": "0.57528687", "text": "function server_status(callback){\r\n\tvar i=0;\r\n\tvar con_detail={};\r\n\tfunction check(i){\r\n\r\n\t\tif(i>=num_con)\r\n\t\t{\r\n\t\t\tcallback(con_detail);\r\n\t\t}\r\n\r\n\t\telse{\r\n\t\t\tif(conn_obj[i].Status==\"on\")\r\n\t\t\t{\r\n\t\t\t\tvar con_id = conn_obj[i].Con_id;\r\n\t\t\t\tvar time = conn_obj[i].Tout_sec;\r\n\t\t\t\tcon_detail[con_id] = time;\r\n\t\t\t}\r\n\t\t\ti++;\r\n\t\t\tcheck(i);\r\n\t\t}\r\n\r\n\t}\r\n\tcheck(0);\r\n\r\n}", "title": "" }, { "docid": "cd6d8b3b73b388fdf006495eee951172", "score": "0.57527876", "text": "resume() {\r\n this.server.listen(this.port, this.host);\r\n }", "title": "" }, { "docid": "b59b089c0c73970489a0f578d4d0803c", "score": "0.5746121", "text": "function serverOnConnect() {\n // What to do on connect to the server.\n console.log(\"I'm connected!\");\n}", "title": "" }, { "docid": "6216c1b41a7c0970116c0cc173d52101", "score": "0.5745194", "text": "function statusReady(){\n\tattacker.status = 'ready'; \n}", "title": "" }, { "docid": "d8a499637f49d0aced4a0aa2831a1c1c", "score": "0.5745013", "text": "function obtenerClientes() {\n console.log('Descargando...');\n\n // Lanzar función asincrona\n setTimeout(function(){\n console.log('Completo');\n }, 3000);\n}", "title": "" }, { "docid": "e983028a3297eb0eaaf2306aeb85124d", "score": "0.57444125", "text": "function serverConnected() {\n console.log(\"Connected to Server\");\n}", "title": "" }, { "docid": "7604113737c4bf980b106deddd1d9739", "score": "0.57119584", "text": "function getServer() {\n setTimeout(function () {\n fetch(\"http://192.168.1.15:3003\", {\n method: 'GET',\n headers: { \"Content-Type\": \"application/json\" }\n })\n .then(res => {\n return res.json();\n })\n .then(res => {\n serverComunication = res.server4\n })\n .catch(res => {\n })\n getServer();\n }, 500)\n}", "title": "" }, { "docid": "ee94c67acc6f0f520bf140ecaa1a4dca", "score": "0.57102495", "text": "msgOnNuevaPartidaDisponible(cliente){\n\t\tcliente.socket.on(\"nuevaPartidaDisponible\", data => {\n\t\t\tanadirPartida(data);\n\t\t});\n\t}", "title": "" }, { "docid": "e56942a665d964cd2a5009d2e81439d1", "score": "0.57102245", "text": "function serialPortReadyCallback() {\r\n\r\n console.log('CNC server API listening on ' +\r\n (gConf.get('httpLocalOnly') ? 'localhost' : '*') +\r\n ':' + gConf.get('httpPort')\r\n );\r\n\r\n // Is the serialport ready? Start reading\r\n if (!pen.simulation) {\r\n serialPort.on(\"data\", serialReadline);\r\n }\r\n\r\n\r\n sendBotConfig();\r\n startServer();\r\n\r\n // CNC Server API ============================================================\r\n // Return/Set CNCServer Configuration ========================================\r\n createServerEndpoint(\"/v1/settings\", function(req, res){\r\n if (req.route.method == 'get') { // Get list of tools\r\n return {code: 200, body: {\r\n global: '/v1/settings/global',\r\n bot: '/v1/settings/bot'\r\n }};\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n createServerEndpoint(\"/v1/settings/:type\", function(req, res){\r\n // Sanity check type\r\n var setType = req.params.type;\r\n if (setType !== 'global' && setType !== 'bot'){\r\n return [404, 'Settings group not found'];\r\n }\r\n\r\n var conf = setType == 'global' ? gConf : botConf;\r\n\r\n function getSettings() {\r\n var out = {};\r\n // Clean the output for global as it contains all commandline env vars!\r\n if (setType == 'global') {\r\n var g = conf.get();\r\n for (var i in g) {\r\n if (i == \"botOverride\") {\r\n break;\r\n }\r\n out[i] = g[i];\r\n }\r\n } else {\r\n out = conf.get();\r\n }\r\n return out;\r\n }\r\n\r\n // Get the full list for the type\r\n if (req.route.method == 'get') {\r\n return {code: 200, body: getSettings()};\r\n } else if (req.route.method == 'put') {\r\n for (var i in req.body) {\r\n conf.set(i, req.body[i]);\r\n }\r\n return {code: 200, body: getSettings()};\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n // Return/Set PEN state API =================================================\r\n createServerEndpoint(\"/v1/pen\", function(req, res){\r\n if (req.route.method == 'put') {\r\n // SET/UPDATE pen status\r\n setPen(req.body, function(stat){\r\n if (!stat) {\r\n return [500, \"Error setting pen!\"];\r\n } else {\r\n if (req.body.ignoreTimeout){\r\n return {code: 202, body: pen};\r\n }\r\n }\r\n });\r\n } else if (req.route.method == 'delete'){\r\n // Reset pen to defaults (park)\r\n setHeight('up');\r\n setPen({x: 0, y:0, park: true}, function(stat){\r\n if (!stat) {\r\n return [500, \"Error parking pen!\"];\r\n }\r\n });\r\n } else if (req.route.method !== 'get') {\r\n return false;\r\n }\r\n\r\n // Default return, just return the pen!\r\n return {code: 200, body: pen};\r\n });\r\n\r\n // Return/Set Motor state API ================================================\r\n createServerEndpoint(\"/v1/motors\", function(req, res){\r\n // Disable/unlock motors\r\n if (req.route.method == 'delete') {\r\n run('custom', 'EM,0,0');\r\n return [201, 'Disable Queued'];\r\n } else if (req.route.method == 'put') {\r\n if (req.body.reset == 1) {\r\n // TODO: This could totally break queueing as movements are queued with\r\n // offsets that break if the relative position doesn't match!\r\n pen.x = 0;\r\n pen.y = 0;\r\n console.log('Motor offset reset to zero')\r\n return [200, 'Motor offset zeroed'];\r\n } else {\r\n return [406, 'Input not acceptable, see API spec for details.'];\r\n }\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n // Command buffer API ========================================================\r\n createServerEndpoint(\"/v1/buffer\", function(req, res){\r\n if (req.route.method == 'get' || req.route.method == 'put') {\r\n\r\n // Pause/resume\r\n if (typeof req.body.paused == \"boolean\") {\r\n if (req.body.paused != bufferPaused) {\r\n bufferPaused = req.body.paused;\r\n console.log('Run buffer ' + (bufferPaused ? 'paused!': 'resumed!'));\r\n bufferRunning = false; // Force a followup check as the paused var has changed\r\n }\r\n }\r\n\r\n return {code: 200, body: {\r\n running: bufferRunning,\r\n paused: bufferPaused,\r\n count: buffer.length,\r\n buffer: buffer\r\n }};\r\n } else if (req.route.method == 'delete') {\r\n buffer = [];\r\n console.log('Run buffer cleared!')\r\n return [200, 'Buffer Cleared'];\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n // Get/Change Tool API =======================================================\r\n createServerEndpoint(\"/v1/tools\", function(req, res){\r\n if (req.route.method == 'get') { // Get list of tools\r\n return {code: 200, body:{tools: Object.keys(botConf.get('tools'))}};\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n createServerEndpoint(\"/v1/tools/:tool\", function(req, res){\r\n var toolName = req.params.tool;\r\n // TODO: Support other tool methods... (needs API design!)\r\n if (req.route.method == 'put') { // Set Tool\r\n if (botConf.get('tools:' + toolName)){\r\n setTool(toolName, function(data){\r\n pen.tool = toolName;\r\n res.status(200).send(JSON.stringify({\r\n status: 'Tool changed to ' + toolName\r\n }));\r\n });\r\n return true; // Tell endpoint wrapper we'll handle the response\r\n } else {\r\n return [404, \"Tool: '\" + toolName + \"' not found\"];\r\n }\r\n } else {\r\n return false;\r\n }\r\n });\r\n\r\n\r\n // UTILITY FUNCTIONS =======================================================\r\n\r\n // Send direct setup var command\r\n exports.sendSetup = sendSetup;\r\n function sendSetup(id, value) {\r\n // TODO: Make this WCB specific, or refactor to be general\r\n run('custom', 'SC,' + id + ',' + value);\r\n }\r\n\r\n function setPen(inPen, callback) {\r\n // Force the distanceCounter to be a number (was coming up as null)\r\n pen.distanceCounter = parseInt(pen.distanceCounter);\r\n\r\n // Counter Reset\r\n if (inPen.resetCounter) {\r\n pen.distanceCounter = Number(0);\r\n callback(true);\r\n return;\r\n }\r\n\r\n // Setting the value of simulation\r\n if (typeof inPen.simulation != \"undefined\") {\r\n\r\n // No change\r\n if (inPen.simulation == pen.simulation) {\r\n callback(true);\r\n return;\r\n }\r\n\r\n if (inPen.simulation == 0) { // Attempt to connect to serial\r\n connectSerial({complete: callback});\r\n } else { // Turn off serial!\r\n // TODO: Actually nullify connection.. no use case worth it yet\r\n simulationModeInit();\r\n }\r\n\r\n return;\r\n }\r\n\r\n\r\n // State has changed\r\n if (typeof inPen.state != \"undefined\") {\r\n if (inPen.state != pen.state) {\r\n setHeight(inPen.state, callback);\r\n return;\r\n }\r\n }\r\n\r\n // Absolute positions are set\r\n if (inPen.x !== undefined){\r\n // Input values are given as percentages of working area (not max area)\r\n\r\n // Don't accept bad input\r\n if (isNaN(inPen.x) || isNaN(inPen.y) || !isFinite(inPen.x) || !isFinite(inPen.y)) {\r\n callback(false);\r\n return;\r\n }\r\n\r\n // Sanity check incoming values\r\n inPen.x = inPen.x > 100 ? 100 : inPen.x;\r\n inPen.x = inPen.x < 0 ? 0 : inPen.x;\r\n\r\n inPen.y = inPen.y > 100 ? 100 : inPen.y;\r\n inPen.y = inPen.y < 0 ? 0 : inPen.y;\r\n\r\n // Convert the percentage values into real absolute and appropriate values\r\n var absInput = {\r\n x: BOT.workArea.left + ((inPen.x / 100) * (BOT.maxArea.width - BOT.workArea.left)),\r\n y: BOT.workArea.top + ((inPen.y / 100) * (BOT.maxArea.height - BOT.workArea.top))\r\n }\r\n\r\n if (inPen.park) {\r\n absInput.x-= BOT.workArea.left;\r\n absInput.y-= BOT.workArea.top;\r\n\r\n // Don't repark if already parked\r\n if (pen.x == 0 && pen.y == 0) {\r\n callback(false);\r\n return;\r\n }\r\n }\r\n\r\n // Actually move the pen!\r\n var distance = movePenAbs(absInput, callback, inPen.ignoreTimeout);\r\n if (pen.state === 'draw' || pen.state === 1) {\r\n pen.distanceCounter = parseInt(Number(distance) + Number(pen.distanceCounter));\r\n }\r\n return;\r\n }\r\n\r\n if (callback) callback(true);\r\n }\r\n\r\n // Set servo position\r\n exports.setHeight = setHeight;\r\n function setHeight(height, callback) {\r\n var fullRange = false; // Whether to use the full min/max range\r\n var min = parseInt(botConf.get('servo:min'));\r\n var max = parseInt(botConf.get('servo:max'));\r\n var range = max - min;\r\n var stateValue = null; // Placeholder for what to set pen state to\r\n var p = botConf.get('servo:presets');\r\n var servoDuration = botConf.get('servo:duration');\r\n\r\n // Validate Height, and conform to a bottom to top based percentage 0 to 100\r\n if (isNaN(parseInt(height))){ // Textual position!\r\n if (p[height]) {\r\n stateValue = height;\r\n height = parseFloat(p[height]);\r\n } else { // Textual expression not found, default to UP\r\n height = p.up;\r\n stateValue = 'up';\r\n }\r\n fullRange = true;\r\n } else { // Numerical position (0 to 1), moves between up (0) and draw (1)\r\n height = Math.abs(parseFloat(height));\r\n height = height > 1 ? 1 : height; // Limit to 1\r\n stateValue = height;\r\n\r\n // Reverse value and lock to 0 to 100 percentage with 1 decimal place\r\n height = parseInt((1 - height) * 1000) / 10;\r\n }\r\n\r\n // Lower the range when using 0 to 1 values\r\n if (!fullRange) {\r\n min = ((p.draw / 100) * range) + min;\r\n max = ((p.up / 100) * range) + parseInt(botConf.get('servo:min'));\r\n\r\n range = max - min;\r\n }\r\n\r\n // Sanity check incoming height value to 0 to 100\r\n height = height > 100 ? 100 : height;\r\n height = height < 0 ? 0 : height;\r\n\r\n // Calculate the servo value from percentage\r\n height = Math.round(((height / 100) * range) + min);\r\n\r\n\r\n // Pro-rate the duration depending on amount of change\r\n if (pen.height) {\r\n range = parseInt(botConf.get('servo:max')) - parseInt(botConf.get('servo:min'));\r\n servoDuration = Math.round((Math.abs(height - pen.height) / range) * servoDuration)+1;\r\n }\r\n\r\n pen.height = height;\r\n pen.state = stateValue;\r\n\r\n // Run the height into the command buffer\r\n run('height', height, servoDuration);\r\n\r\n // Pen lift / drop\r\n if (callback) {\r\n // Force the EBB block buffer for the pen change state\r\n setTimeout(function(){\r\n callback(1);\r\n }, Math.max(servoDuration - gConf.get('bufferLatencyOffset'), 0));\r\n }\r\n }\r\n\r\n // Tool change\r\n exports.setTool = setTool;\r\n function setTool(toolName, callback) {\r\n var tool = botConf.get('tools:' + toolName);\r\n\r\n console.log('Changing to tool: ' + toolName);\r\n\r\n // Set the height based on what kind of tool it is\r\n // TODO: fold this into bot specific tool change logic\r\n var downHeight = toolName.indexOf('water') != -1 ? 'wash' : 'draw';\r\n\r\n // Pen Up\r\n setHeight('up');\r\n\r\n // Move to the tool\r\n movePenAbs(tool);\r\n\r\n // \"wait\" tools need user feedback to let cncserver know that it can continue\r\n if (typeof tool.wait != \"undefined\") {\r\n\r\n if (callback){\r\n run('callback', callback);\r\n }\r\n\r\n // Pause or resume continued execution based on tool.wait value\r\n // In theory: a wait tool has a complementary resume tool to bring it back\r\n if (tool.wait) {\r\n bufferPaused = true;\r\n } else {\r\n bufferPaused = false;\r\n executeNext();\r\n }\r\n\r\n } else { // \"Standard\" WaterColorBot toolchange\r\n // Pen down\r\n setHeight(downHeight);\r\n\r\n // Wiggle the brush a bit\r\n wigglePen(tool.wiggleAxis, tool.wiggleTravel, tool.wiggleIterations);\r\n\r\n // Put the pen back up when done!\r\n setHeight('up');\r\n\r\n if (callback){\r\n run('callback', callback);\r\n }\r\n }\r\n }\r\n\r\n // Move the Pen to an absolute point in the entire work area\r\n // Returns distance moved, in steps\r\n function movePenAbs(point, callback, immediate) {\r\n\r\n // Something really bad happened here...\r\n if (isNaN(point.x) || isNaN(point.y)){\r\n console.error('INVALID Move pen input, given:', point);\r\n if (callback) callback(false);\r\n return 0;\r\n }\r\n\r\n // Sanity check absolute position input point\r\n point.x = Number(point.x) > BOT.maxArea.width ? BOT.maxArea.width : point.x;\r\n point.x = Number(point.x) < 0 ? 0 : point.x;\r\n\r\n point.y = Number(point.y) > BOT.maxArea.height ? BOT.maxArea.height : point.y;\r\n point.y = Number(point.y) < 0 ? 0 : point.y;\r\n\r\n var change = {\r\n x: Math.round(point.x - pen.x),\r\n y: Math.round(point.y - pen.y)\r\n }\r\n\r\n // Don't do anything if there's no change\r\n if (change.x == 0 && change.y == 0) {\r\n if (callback) callback(true);\r\n return 0;\r\n }\r\n\r\n var distance = Math.sqrt( Math.pow(change.x, 2) + Math.pow(change.y, 2));\r\n var speed = pen.state ? botConf.get('speed:drawing') : botConf.get('speed:moving');\r\n speed = (speed/100) * botConf.get('speed:max'); // Convert to steps from percentage\r\n\r\n // Sanity check speed value\r\n speed = speed > botConf.get('speed:max') ? botConf.get('speed:max') : speed;\r\n speed = speed < botConf.get('speed:min') ? botConf.get('speed:min') : speed;\r\n\r\n var duration = Math.abs(Math.round(distance / speed * 1000)); // How many steps a second?\r\n\r\n // Don't pass a duration of 0! Makes the EBB DIE!\r\n if (duration == 0) duration = 1;\r\n\r\n // Save the duration state\r\n pen.lastDuration = duration;\r\n\r\n pen.x = point.x;\r\n pen.y = point.y;\r\n\r\n if (botConf.get('controller').position == \"relative\") {\r\n // Invert X or Y to match stepper direction\r\n change.x = gConf.get('invertAxis:x') ? change.x * -1 : change.x;\r\n change.y = gConf.get('invertAxis:y') ? change.y * -1 : change.y;\r\n } else { // Absolute! Just use the \"new\" absolute X & Y locations\r\n change.x = pen.x;\r\n change.y = pen.y;\r\n }\r\n\r\n // Swap motor positions\r\n if (gConf.get('swapMotors')) {\r\n change = {\r\n x: change.y,\r\n y: change.x\r\n }\r\n }\r\n\r\n // Queue the final serial command\r\n run('move', {x: change.x, y: change.y}, duration);\r\n\r\n if (callback) {\r\n if (immediate == 1) {\r\n callback(1);\r\n } else {\r\n // Set the timeout to occur sooner so the next command will execute\r\n // before the other is actually complete. This will push into the buffer\r\n // and allow for far smoother move runs.\r\n\r\n var cmdDuration = Math.max(duration - gConf.get('bufferLatencyOffset'), 0);\r\n\r\n if (cmdDuration < 2) {\r\n callback(1);\r\n } else {\r\n setTimeout(function(){callback(1);}, cmdDuration);\r\n }\r\n\r\n }\r\n }\r\n\r\n return distance;\r\n }\r\n\r\n // Wiggle Pen for WCB toolchanges\r\n function wigglePen(axis, travel, iterations){\r\n var start = {x: Number(pen.x), y: Number(pen.y)};\r\n var i = 0;\r\n travel = Number(travel); // Make sure it's not a string\r\n\r\n // Start the wiggle!\r\n _wiggleSlave(true);\r\n\r\n function _wiggleSlave(toggle){\r\n var point = {x: start.x, y: start.y};\r\n\r\n if (axis == 'xy') {\r\n var rot = i % 4; // Ensure rot is always 0-3\r\n\r\n // This confuluted series ensure the wiggle moves in a proper diamond\r\n if (rot % 3) { // Results in F, T, T, F\r\n if (toggle) {\r\n point.y+= travel/2; // Down\r\n } else {\r\n point.x-= travel; // Left\r\n }\r\n } else {\r\n if (toggle) {\r\n point.y-= travel/2; // Up\r\n } else {\r\n point.x+= travel; // Right\r\n }\r\n }\r\n } else {\r\n point[axis]+= (toggle ? travel : travel * -1);\r\n }\r\n\r\n movePenAbs(point);\r\n\r\n i++;\r\n\r\n if (i <= iterations){ // Wiggle again!\r\n _wiggleSlave(!toggle);\r\n } else { // Done wiggling, go back to start\r\n movePenAbs(start);\r\n }\r\n }\r\n }\r\n}", "title": "" }, { "docid": "d46f89cd8d1d8134c12cb960f883a915", "score": "0.5706133", "text": "function l1() { \r\n\tif (sock) {\r\n\t\t\tif(l1status == 0){\t\t\t\t\r\n\t\t\t\tsock.send(\"uL1T4\");\r\n\t}else{\r\n\t\t\t\tsock.send(\"uL1F4\");\r\n\t}\r\n\t} else {\r\n\t alert(\"Not connected.\");\r\n\t}\r\n\t\r\n\t\r\n\tsock.onmessage = function(e) {\r\n\t\tmessagedata = e.data;\r\n\t\thunchres();\r\n\t}\r\n}", "title": "" }, { "docid": "78b675c611c92611fcbb27293c433446", "score": "0.5701064", "text": "function OnConnectedToServer()\n{\n\tDebug.Log(\"connected to server\");\n}", "title": "" }, { "docid": "e2127f2997a3a107b6d6e54fab6cb237", "score": "0.5690133", "text": "sendHeartbeat() {\n this.sendServerMessage('IAMHERE');\n }", "title": "" }, { "docid": "1f1f22cf906aa9a7bc3faf073ec18a80", "score": "0.5683172", "text": "healthcheck(server, password) {\n queue.add(server, () => {\n this.rcon[server].command(\"status\", 2500).then(() => {\n queue.complete(server);\n log.trace(`[RCON][${server}][HEALTHCHECK]: OK`);\n }, () => {\n log.error(`[RCON][${server}][HEALTHCHECK]: Server error reconnecting...`);\n queue.complete(server);\n\n this.initServer(server, password);\n }).catch(() => {\n log.error(`[RCON][${server}][HEALTHCHECK]: Server error reconnecting...`);\n queue.complete(server);\n\n this.initServer(server, password);\n });\n });\n }", "title": "" }, { "docid": "57c4c713f1a7158b0330bdf74e493706", "score": "0.56825644", "text": "async onReady() {\n this.logger.debug(`${this.client.user.username} ready!`);\n this.logger.debug(`Bot: ${this.client.user.username}#${this.client.user.discriminator}`);\n this.client.user.setPresence({\n status: 'online',\n afk: false,\n game: {\n name: `@${this.client.user.username} help`,\n url: 'https://genesis.warframestat.us',\n },\n });\n await this.settings.ensureData(this.client);\n this.readyToExecute = true;\n\n const self = this;\n setInterval(checkPrivateRooms, self.channelTimeout, self, self.shardId);\n \n setInterval(updatePresence, 60000, self);\n }", "title": "" }, { "docid": "9d05f47ef22717788438d1272315be89", "score": "0.5681952", "text": "function handleListen() {\n console.log(\"Listening\"); // Konsolenausgabe sobald der Server parat ist\n }", "title": "" }, { "docid": "6c919b1a134c7e302070b988596cf9d6", "score": "0.56715876", "text": "ready() { return true; }", "title": "" }, { "docid": "4c01b684ae8cc7fd320615e9e0083930", "score": "0.5660796", "text": "function OnConnectedToServer()\n{\n\tDebug.Log(\"This CLIENT has connected to a server\");\t\n}", "title": "" }, { "docid": "38b51a9dfc78fbcd5dec1fb9e9cf688c", "score": "0.5657728", "text": "start() {\n this.online = true;\n }", "title": "" }, { "docid": "b33beea61fc3ca0454084258c4b7b4ee", "score": "0.5656038", "text": "function startServer() {\nweb.use('/res', require('express').static(__dirname + '/res'))\n\n web.get('/login', function(req, res) {\n require('dns').resolve('www.google.com', function(err) {\n if (err) {\n res.sendFile(__dirname + '/offline.html')\n } else {\n res.sendFile(__dirname + '/login.html')\n }\n })\n })\n\n web.post('/api/notification', function(req, res) {\n res.setHeader('Content-Type', 'application/json')\n res.send(JSON.stringify(handleNotification(JSON.stringify(req.body))))\n mixpanel.track('api-http-notification', req.body.payload)\n })\n\n web.get('/api/version', function(req, res) {\n res.setHeader('Content-Type', 'application/json')\n res.send(JSON.stringify(handleVersionRequest(JSON.stringify(req.body))))\n req.body.payload.uuid = uuid\n mixpanel.track('api-http-version', req.body.payload)\n })\n\n web.get('*', function(req, res) {\n res.status(404).sendFile(__dirname + '/404.html')\n mixpanel.track('api-http-404', {uuid: uuid})\n })\n\n io.on('connection', function(socket) {\n socket.on('notification', function(msg) {\n var n = JSON.parse(msg)\n io.emit(n.metadata.from, JSON.stringify(handleNotification(msg)))\n n.payload.uuid = uuid\n mixpanel.track('api-ws-notification', n.payload)\n })\n\n socket.on('version', function(msg) {\n var v = JSON.parse(msg)\n io.emit(v.metadata.from, JSON.stringify(handleVersionRequest(msg)))\n\n broadcastPing()\n v.payload.uuid = uuid\n mixpanel.track('api-ws-version', v.payload)\n })\n\n socket.on('broadcast', function(msg) {\n var b = JSON.parse(msg)\n if (b.metadata.type == 'broadcast-pong') {\n log.info('Received response from ' + b.metadata.from)\n\n io.emit('devices', JSON.stringify({\n metadata: {\n version: 1,\n type: 'devices-add',\n from: serverId,\n to: ''\n },\n payload: {\n name: b.metadata.from\n }\n }))\n mixpanel.track('api-ws-pong', {\n uuid: uuid,\n from: b.metadata.from\n })\n }\n })\n\n socket.on('disconnect', function() {\n if (!quitting) {\n log.info('Client disconnected, checking on other clients...')\n mixpanel.track('api-ws-disconnect', {uuid: uuid})\n broadcastPing()\n }\n })\n })\n\n http.listen(3753, function() {\n log.info('Listening on *:3753')\n })\n}", "title": "" }, { "docid": "b5434f7b2327dfa66b19eb7963f88235", "score": "0.564802", "text": "function testPerformSimpleGet() {\n\t\t\t\n\tvar haïkuLog=new Log(\"haïku.txt\");\n\thaïkuLog.date();\n\n\tvar responseBuf=new Buffer(0);\n\n\tvar sock=new net.Socket();\n\n\tsock.connect(8081, \"127.0.0.1\", function() {\n\t\t\n\t\trequestBuf=new Buffer(\n\"GET /haiku.html HTTP/1.1\\r\\n\\\nHost: 127.0.0.1:8081\\r\\n\\\n\\r\\n\"\n\t\t);\n\n\t\thaïkuLog.append(\"Request...\").append(requestBuf.toString('utf8', 0, requestBuf.length));\n\n\t\tsock.write(requestBuf);\n\n\t\tsock.addListener('data', function(buf) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\thaïkuLog.append(\"Response...\").append(buf.toString('utf8', 0, buf.length));\n\t\t\t\n\t\t\tresponseBuf=ConcatBuffers(responseBuf, buf);\n\t\t})\n\t\t\n\t\tsock.addListener('end', function() {\n\t\t\t\n\t\t\thaïkuLog.append(\"End !\");\n\t\t\t\t\t\t\n\t\t\texitWait();\t\n\t\t})\n\t\t\n\t\tsock.addListener('close', function(err) {\n\n\t\t\tif(!err)\n\t\t\t\thaïkuLog.append(\"Close (no error) !\");\n\t\t\telse\n\t\t\t{\n\t\t\t\thaïkuLog.append(\"Close (with error) !\");\n\n\t\t\t\tY.Assert.fail(\"Connection closed with an error.\");\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\texitWait();\t\n\t\t})\n\t\t\n\t\tsock.addListener('error', function(err) {\n\t\t\t\t\t\t\n\t\t\texitWait();\t\n\t\t})\n\t})\t\n\t\n\t//BUG - Le wait marche pas bien ! Mieux vaut trop que pas assez !\n\twait(123);\n\twait(123);\n\twait(123);\n\twait(123);\n\twait(123);\n\t\t\n\t//Check the haïku integrity !\n\tvar responseString=responseBuf.toString('utf8', 0, responseBuf.length);\n\tvar pos1=responseString.indexOf('古池や', 0);\n\tvar pos2=responseString.indexOf('蛙飛込む', pos1);\n\tvar pos3=responseString.indexOf('水の音', pos2);\n\t\n\tY.Assert.isTrue(pos1>0 && pos2>pos1 && pos3>pos2, \"Check read data integrity : \");\n\n\thaïkuLog.date().append(\"Done !\");\n\n\tsock.destroy();\n}", "title": "" }, { "docid": "592c3b62efac78b3711d7c5f4445efac", "score": "0.5642697", "text": "async function inicioServer(){\n try {\n await Usuarios.sync({alter: true})\n await Fechas.sync({alter: true})\n await Presupuestos.sync({alter: true})\n await ConceptosIngresos.sync({alter: true})\n await ConceptosCostos.sync({alter: true})\n await ConceptosGastosAdmin.sync({alter: true})\n await RolesRecursos.sync({alter: true})\n await Ingresos.sync({alter: true})\n await CostosDirectos.sync({alter: true})\n await GastosAdmin.sync({alter: true})\n await PorcentajeRecursos.sync({alter: true})\n await sequelize.authenticate()\n console.log('Se autenticó correctamente la DB')\n app.listen(process.env.PORT, function(){\n console.log(`Servidor inicializado en http://${process.env.HOST}:${process.env.PORT}`)\n })\n } catch (error) {\n console.log(error)\n }\n}", "title": "" }, { "docid": "8a0a6d01c4b14876279db9aa87db7443", "score": "0.5641881", "text": "function connectToServer(){\n\tthis.showStatus(\"..connecting\");\n\tthis.executeServerCommand(new ServerCommand(\"REQ_Channels\",\"\"));\n}", "title": "" }, { "docid": "dc7643950eca08a5ed6f0797a3900358", "score": "0.56414586", "text": "async function doHealthCheck(){\n console.log(\"Inside checkAllServices\");\n conn = await MongoClient.connect(url);\n //console.log('DB Connection :', conn);\n \n db = conn.db('stezy_services');\n //console.log('DB :', db);\n var serviceName = 'node';\n var serviceStatus = 2;\n\n\n\n\n socket = io.connect('http://localhost:3000', {\n reconnection : true\n });\n\n var serviceResp = {\n serviceName : \"s1\"\n }\n /*socket.emit('client_event', function(data){\n console.log(\"Recived Data from Servcer\", data);\n })*/\n socket.emit('server_event', serviceResp);\n\n //saveDefaultService();\n \n /*for(let count =0; count < serviceList.length; count++){\n //Getting Each service Type\n let servName = serviceList[count].service_name;\n let servType = serviceList[count].type;\n let servPort = serviceList[count].port;\n let servUrl = serviceList[count].url;\n let servRestartRequired = serviceList[count].restart_required;\n let hostDetials = serviceList[count].server;\n let restartCmd = serviceList[count].restartCmd;\n if(servType == \"tcp\"){\n isPorcessRunning(hostDetials, servPort, servName, restartCmd);\n } \n }*/\n setTimeout(doHealthCheck, serviceMonitorPollInterval);\n}", "title": "" }, { "docid": "6be24944a167004cae1f53fa2d401eea", "score": "0.5640267", "text": "function siguiente(i){\n\tif(i>=0){\n\t\trqs[i].send(sRequest); //Enviamos al servidor i el string\n\t\tconsole.log(' Enviando a... '+ hlist[i].toString());\n\t\trecibido = false;\n\t\tsetTimeout(function TDeEspera(){//Cada 1 segundo repetir la funcion\n\t\t\tif(!recibido){\t//Si no hemos recibido mensaje\n\t\t\t\tconsole.log(' |-El servido parece estar caido, reenvio: ');\n\t\t\t\tsiguiente(i-1);\t//Llamar a la funcion con i-1\n\t\t\t}\n\t\t},1000);\n\t}\n}", "title": "" }, { "docid": "35adccec744bcf8e2218378776990ea2", "score": "0.5635603", "text": "function obtenerClientes(){\n console.log('Descargando...');\n\n setTimeout (function() {\n console.log('Completo');\n }, 3000);\n}", "title": "" }, { "docid": "2fa923abdce82658ecf26608f5df76d0", "score": "0.56312704", "text": "handleConnectionSuccess() {\n this.connected = true;\n }", "title": "" }, { "docid": "4438bb6dffedf47d8eb5e71f5998745e", "score": "0.5620857", "text": "setReady() {\n this._ready = true;\n this.emit('ready');\n }", "title": "" } ]
f3ef4e58b37196cb177b464c1ed16b2f
... = hide, block, report
[ { "docid": "967b8ee1ae1e078b250052a089c74844", "score": "0.0", "text": "function MoreIcon() {\n\n function hide() {\n alert(\"You have hidden this content and will no longer see it again.\")\n }\n\n let hidePopover = (\n <Popover id=\"popover-basic\">\n <Popover.Content>\n This content will be hidden from you.\n </Popover.Content>\n </Popover>\n );\n\n let reportPopover = (\n <Popover id=\"popover-basic\">\n <Popover.Content>\n Report this content.\n </Popover.Content>\n </Popover>\n );\n\n return (\n <Dropdown>\n <Dropdown.Toggle variant=\"light\" >\n {<FiMoreHorizontal />}\n </Dropdown.Toggle>\n <Dropdown.Menu>\n <Dropdown.Item>\n <OverlayTrigger trigger=\"hover\" placement=\"right\" overlay={hidePopover}>\n <Button variant=\"light\" onClick={() => hide()}>Hide</Button>\n </OverlayTrigger>\n </Dropdown.Item>\n <Dropdown.Item href=\"/report\">\n <OverlayTrigger trigger=\"hover\" placement=\"right\" overlay={reportPopover}>\n <Button variant=\"light\">Report</Button>\n </OverlayTrigger>\n </Dropdown.Item>\n </Dropdown.Menu>\n </Dropdown>\n )\n\n}", "title": "" } ]
[ { "docid": "2ec93cf142e5ba8c5d35b82a904621ea", "score": "0.72470385", "text": "hide() {}", "title": "" }, { "docid": "4d5bf382a1118af65d19721bc7ed305c", "score": "0.6512279", "text": "hide(){this._canRender=false;}", "title": "" }, { "docid": "1d3686a367d6d43b6b7c90108ff3ba07", "score": "0.6385953", "text": "hide() {\n\n }", "title": "" }, { "docid": "2ae6c5b8186f73de49fc522c04b56841", "score": "0.620685", "text": "function hide()\n{\n // Stop monitor timers to prevent CPU usage\n if (monitorRunning) {\n budgetMonitor.stop();\n monitorRunning = false;\n }\n}", "title": "" }, { "docid": "9c514f48e3aa8b1f76d2f31056c05e27", "score": "0.61956537", "text": "function hideIt(f) {\n switch(f) {\n case 'all':\n $(\".all, .webmaster, .bots\").hide();\n $(\".normal\").show();\n $(\"#webmaster\").text(\"Show webmaster\");\n $(\"#bots\").text(\"Show bots\");\n break;\n case 'webmaster': // default is don't show\n $(\".webmaster\").hide();\n break;\n case 'bots': // true means we are showing robots\n $('.bots').hide();\n break;\n }\n flags[f] = false;\n let msg = \"Show \";\n $(\"#\"+ f).text(msg + f);\n calcAv();\n return;\n}", "title": "" }, { "docid": "096c49d08ae01fae37e8002456cb4496", "score": "0.61775804", "text": "hide(){const e=this.getCurrentStep();if(e)return e.hide()}", "title": "" }, { "docid": "ae3113b9d8ccfaede9386a98ce892f4f", "score": "0.61571157", "text": "function hide()\n{\n console.log(\"hide\");\n // Stop any timers to prevent CPU usage\n}", "title": "" }, { "docid": "cfc6003369cbf99f924a3be37a8cae09", "score": "0.6148939", "text": "function hide() {\n // stop monitoring the product\n store.off(render);\n }", "title": "" }, { "docid": "9523741d8e8d8985fd96da1933e3ea41", "score": "0.61427695", "text": "function hide() {\n // Stop any timers to prevent CPU usage\n}", "title": "" }, { "docid": "03b66f516b4204f98895e352f63465ea", "score": "0.6117437", "text": "hideInstance() {}", "title": "" }, { "docid": "98d4da82235a099639df76bfbd4aa6c8", "score": "0.60894936", "text": "function hidePayments() {\n creditCard.hide();\n paypal.hide();\n bitcoin.hide();\n}", "title": "" }, { "docid": "993b8a7efc1ad0da3466ad7a3124bbab", "score": "0.6084139", "text": "function hideElements() {\n hideButtons();\n hideCanvas();\n hideSlider();\n hideText();\n}", "title": "" }, { "docid": "2f78422fc0da8fc9b3ae76a20891ab95", "score": "0.6079045", "text": "function hide() {\n // Stop any timers to prevent CPU usage\n}", "title": "" }, { "docid": "2f78422fc0da8fc9b3ae76a20891ab95", "score": "0.6079045", "text": "function hide() {\n // Stop any timers to prevent CPU usage\n}", "title": "" }, { "docid": "b0ce559b7db80ed2aff349341722eb59", "score": "0.6070975", "text": "function testFunctionHide() {\n\t//showBoard();\n\t//hideStrategyCards();\n\tconsole.log('Test hide');\n}", "title": "" }, { "docid": "8171fbc9d325cfddd39cf8528d5d1d7e", "score": "0.6040813", "text": "function hide(){\n //totalsVizDiv.hide();\n //timelineVizDiv.hide();\n }", "title": "" }, { "docid": "c3abed85c6c13e4c2cd60d507fde0401", "score": "0.60268384", "text": "function hideAll(exception) {\r\n for (i = 0; i < data.memes.length; i++) { \r\n hide(i);\r\n }\r\n}", "title": "" }, { "docid": "ebb9266e0094c076570e9788e3c3fbc2", "score": "0.6024004", "text": "function hide_plans() {\n\n \t//remove_action();\n \t//remove_upgrade_button();\n \t//remove_activate_free_version();\n \t//remove_upgrade_tab();\n\n\t}", "title": "" }, { "docid": "f9aa5740acc251f063337b1874bd1894", "score": "0.5995482", "text": "show() {}", "title": "" }, { "docid": "137b4ab337b8a1ae94ce3117474c3cfe", "score": "0.59939253", "text": "onHidden() {}", "title": "" }, { "docid": "137b4ab337b8a1ae94ce3117474c3cfe", "score": "0.59939253", "text": "onHidden() {}", "title": "" }, { "docid": "137b4ab337b8a1ae94ce3117474c3cfe", "score": "0.59939253", "text": "onHidden() {}", "title": "" }, { "docid": "137b4ab337b8a1ae94ce3117474c3cfe", "score": "0.59939253", "text": "onHidden() {}", "title": "" }, { "docid": "6751c3b396bde21752d146ee503b5da6", "score": "0.59665495", "text": "function hide()\n{\n // Stop any timers to prevent CPU usage\n}", "title": "" }, { "docid": "cb489b442fa94feb1eac8f6000fff53e", "score": "0.59462386", "text": "function hideAll(){\n $('#displayEntryBudget').css('display','none');\n $('#displayBudgetCharts').css('display','none');\n hideStatsOverLay();\n if($('#setupPage').css('display') == 'block'){\n hideSetUp();\n $('#setupPage').css('display','none');\n }\n}", "title": "" }, { "docid": "27d9d6e653f46ef9b3d0dea4e57f89cb", "score": "0.5943761", "text": "function gen_reports() {\n\t if (!$('#chart').hasClass('hide')) {\n\t total_income_bar_report();\n\t } else if (!report_customers.hasClass('hide')) {\n\t customers_report();\n\t } else if(!$('#customers-group-gen').hasClass('hide')){\n\t \treport_by_customer_groups();\n\t } else if(!report_invoices.hasClass('hide')){\n\t \tinvoices_report();\n\t }\n\t}", "title": "" }, { "docid": "74e20a51df409dc86357387993ebfd14", "score": "0.59425294", "text": "hide() {\n if (this._isShutDown) return;\n this._parentDiv.style.display = 'none';\n this._noOps = true;\n }", "title": "" }, { "docid": "44bac5783364fa9e0664258d508fa0db", "score": "0.59414047", "text": "function hidebuttons(){\n console.log(\"called negative\");\n buttonwork1.hide();\n buttonwork2.hide();\n buttonpub.hide();\n buttonsleep1.hide();\n buttonsleep2.hide();\n buttoneat.hide();\n}", "title": "" }, { "docid": "a17f9b56b6dd3ebff82130732dcabf36", "score": "0.59398806", "text": "function showReportOnly()\n{\n\tisDisplay = document.getElementById('_ctl0_chkShowGrid').checked;\n\tcollapse('tdPages',isDisplay);\n\tcollapse('trGrid',isDisplay);\n\t//if check multi sort\n\tif (isDisplay == true && document.getElementById('_ctl0_chkSort').checked == true)\n\t\tcollapse('tdSort',isDisplay);\n\telse\n\t\tcollapse('tdSort',!isDisplay);\n}", "title": "" }, { "docid": "752a5f38b5405657469c9f431276389a", "score": "0.5935705", "text": "function hide()\n{\ndocument.getElementById('block1').style.visibility = 'hidden';\ndocument.getElementById('block2').style.visibility = 'hidden';\ndocument.getElementById('block3').style.visibility = 'hidden';\n}", "title": "" }, { "docid": "561bc7c77ecca66b42f29fb008b66305", "score": "0.5913544", "text": "[ POST_MESSAGE.HIDE ](source, data) {\n this.hide();\n }", "title": "" }, { "docid": "b3aa69a9120abdb8b0c1fe41857db58e", "score": "0.58942926", "text": "function hideMeasuringInfo() {\n //console.log(\"hideMeasuringInfo() called..\");\n tau.changePage('#main');\n infoTimeoutEnd = 0;\n}", "title": "" }, { "docid": "20f71c1d20b68689445ba3443a97f273", "score": "0.58840597", "text": "hide(){this.tour.modal.hide(),this.trigger(\"before-hide\"),document.body.removeAttribute(\"data-shepherd-step\"),this.target&&this._updateStepTargetOnHide(),this.tooltip&&this.tooltip.hide(),this.trigger(\"hide\")}", "title": "" }, { "docid": "6ddccef9edbe3bfcdafa5b16c366a381", "score": "0.58687603", "text": "function hide(ninja) {\n\tninja.visibity = false; \n}", "title": "" }, { "docid": "a9880988b97012b6de620baee40e2d98", "score": "0.58672094", "text": "function hideHealth1() {\n\n}", "title": "" }, { "docid": "cac7f351fced4a6478edb46ed4830904", "score": "0.5853179", "text": "function hide()\n{\n createUser.hide();\n viewUser.hide();\n deleteUser.hide();\n mainTitle.hide();\n\n}", "title": "" }, { "docid": "4c37323b2493bf9dc77ba276b98ab1b5", "score": "0.58413255", "text": "function stopShowing() {\n\t}", "title": "" }, { "docid": "e3f08bbbccd5e6aeddee5d244d94b321", "score": "0.5834107", "text": "onHide() {}", "title": "" }, { "docid": "e3f08bbbccd5e6aeddee5d244d94b321", "score": "0.5834107", "text": "onHide() {}", "title": "" }, { "docid": "e3f08bbbccd5e6aeddee5d244d94b321", "score": "0.5834107", "text": "onHide() {}", "title": "" }, { "docid": "e3f08bbbccd5e6aeddee5d244d94b321", "score": "0.5834107", "text": "onHide() {}", "title": "" }, { "docid": "e3f08bbbccd5e6aeddee5d244d94b321", "score": "0.5834107", "text": "onHide() {}", "title": "" }, { "docid": "0759d6af884ef3e09ed8acdd7b7117e5", "score": "0.5825554", "text": "function showCriteriaBlock()\n{\n // On manual paginate add class to trigger pagination\n reportico_jquery(\".reportico-show-criteria\").hide();\n reportico_jquery(\".reportico-hide-criteria\").show();\n reportico_jquery(\"#criteria-block\").show();\n return false;\n}", "title": "" }, { "docid": "a2efb51cc24a6b8e8d11bbcac5710094", "score": "0.58243936", "text": "hide() {\n this.clearSimulationPoints();\n this.visible = false;\n }", "title": "" }, { "docid": "7fc83acffc7553bb8a2f20fcc1689a31", "score": "0.58069545", "text": "show() {\n\t\t// write our own show method which will ignore the parent class show method and run this one instead.\n\t}", "title": "" }, { "docid": "6e8aadc235502a274e986a739a8a4954", "score": "0.5805833", "text": "hide() {\n this._hide();\n }", "title": "" }, { "docid": "e9e902180590a956cdfdc0cf1b29ac32", "score": "0.5780311", "text": "function hideWeare (){\n\t\t$(\"#section_weare .wrap_heading > div\").velocity(\"stop\");\n\t\t$(\"#section_weare .wrap_heading > div\").css('opacity', '0');\n\t\t$(\"#section_weare .item_point .wrap_point\").velocity(\"stop\");\n\t\t$(\"#section_weare .item_point .wrap_point\").css('opacity', '0');\n\t}", "title": "" }, { "docid": "6489c446a6c3d75b2b9760392ab701e0", "score": "0.5761343", "text": "function hideExtra()\n {\n jq('#dialog').hide();\n jq('#multiple_actions').hide();\n jq('#div_dropdown_category').hide(); \n jq('#edit_categories').hide();\n jq('#window_edit_categories').hide();\n jq('#square_actions').hide();\n jq('#choose_rotation').hide();\n jq('#windows_group_label').hide();\n jq('#upload-area').hide();\n \n }", "title": "" }, { "docid": "9bb5c814d66e0ab739845e1a72dd5133", "score": "0.5757021", "text": "function hideUpload() {\n hide('choosehars');\n hide('loading');\n show('result');\n}", "title": "" }, { "docid": "07629a5c590d5d02b072bfd11a0053ec", "score": "0.57486784", "text": "function prepareToShow() {}", "title": "" }, { "docid": "d6cfe41333bbb56a0e30d4606e8ec25f", "score": "0.5722354", "text": "function\nHideBlocker\n()\n{\n var blocker;\n\n blocker = document.getElementById(\"MainBlocker\");\n blocker.style.visibility = \"hidden\";\n}", "title": "" }, { "docid": "d6cfe41333bbb56a0e30d4606e8ec25f", "score": "0.5722354", "text": "function\nHideBlocker\n()\n{\n var blocker;\n\n blocker = document.getElementById(\"MainBlocker\");\n blocker.style.visibility = \"hidden\";\n}", "title": "" }, { "docid": "45dacb67d521a92d1da5cf3aee9166b0", "score": "0.57135224", "text": "function hide(obj)\r\n{\r\n var theObj = getObject(obj);\r\n if (theObj)\r\n {\r\n if (theObj.visibility) theObj.visibility = \"hidden\";\r\n if (theObj.style) theObj.style.display = 'none';\r\n }\r\n}", "title": "" }, { "docid": "42f8a773de0d8af6f2e7abe57d915000", "score": "0.5706466", "text": "function ScreedBlock() {\n}", "title": "" }, { "docid": "7f259f4c431baf7c59ad42edce2dd350", "score": "0.5705745", "text": "function oc_ccr_hide_show_elem(){\n if($( \"#tn_plan_ccr\" ).val() == 1){\n\n opt_blt_dln = 1;\n\n element_id_show_inline(\"btn_add_lvl\");\n element_id_show_inline(\"btn_del_lvl\");\n\n element_id_hide(\"tr_setpoint_block\");\n\n element_id_hide(\"btn_bailout\");\n element_id_hide(\"btn_diluent\");\n\n element_id_show_inline(\"tn_deco_block\");\n\n element_id_show(\"7-header\");\n element_id_show(\"t_total_cons\");\n //element_id_show(\"7-content\");\n }\n else{\n //ccr plan!\n element_id_hide(\"btn_add_lvl\");\n element_id_hide(\"btn_del_lvl\");\n\n element_id_show(\"tr_setpoint_block\");\n\n //warning about interface demo mode\n openNav();\n\n if(opt_blt_dln == 1){\n element_id_hide(\"btn_bailout\");\n element_id_show_inline(\"btn_diluent\");\n\n element_id_show_inline(\"tn_deco_block\");\n\n\n element_id_show(\"7-header\");\n element_id_show(\"t_total_cons\");\n //element_id_show(\"7-content\");\n\n }\n else{\n\n element_id_show_inline(\"btn_bailout\");\n element_id_hide(\"btn_diluent\");\n\n element_id_hide(\"tn_deco_block\");\n\n element_id_hide(\"7-header\");\n element_id_hide(\"t_total_cons\");\n\n\n //element_id_hide(\"7-content\");\n }\n }\n // /if NO decompression mixtures then hide all gas consumptions\n if(($( \"#tn_plan_ccr\" ).val() == 2)){\n if(($( \"#opt_deco\" ).val()*1.0) == 0){\n console.log(\"TRUE\");\n element_id_hide(\"7-header\");\n element_id_hide(\"t_total_cons\");\n }\n }\n}", "title": "" }, { "docid": "f16c6b50da2da2f4bc643d39669dd471", "score": "0.5705168", "text": "function doMainThing() {\n doHide();\n do_post();\n }", "title": "" }, { "docid": "dfff8b9f7e11a2cf09a3fa8c814e58ab", "score": "0.56945497", "text": "function runReport() {\n $('#reorder').click(() => {\n $('.report').addClass('js-hide-display'); \n getInventoryItems(reorderReport);\n });\n}", "title": "" }, { "docid": "2c0b4fdb3fff9fd328e5b4eee3a3fc25", "score": "0.5681621", "text": "function showHide(name) {\n showHideEx(name, null, false);\n}", "title": "" }, { "docid": "5ff4fb3e76f0ff5b650019b53bff6f10", "score": "0.56718516", "text": "function hideAllModify()\n\t{\n\t\tdocument.getElementById(\"stockShopForm\").style.display = \"none\";\n\t\tdocument.getElementById(\"returnsForm\").style.display = \"none\";\n\t\tdocument.getElementById(\"deliveryForm\").style.display = \"none\";\n\t\tdocument.getElementById(\"stockFullForm\").style.display = \"none\";\n\t\tdocument.getElementById(\"deleteRecordForm\").style.display = \"none\";\n\t}", "title": "" }, { "docid": "7a7a13d2074ee8b81c76e7d46f0e86e5", "score": "0.5667845", "text": "function hide() {\n\t\t\t\tthat.hide();\n\t\t\t}", "title": "" }, { "docid": "1b47147d5d53bef7a2d3970bdc115eff", "score": "0.5645813", "text": "hide() {\n this.off();\n super.hide();\n }", "title": "" }, { "docid": "a923940cf5d2e0e654cddfc1856d04ac", "score": "0.56437504", "text": "function toMain () {panelStatus(\"none\"); panelCustom(\"none\"); panelVehicles(\"none\");\r\npanelInfo(\"none\"); panelMain(\"block\"); clearInfo();}", "title": "" }, { "docid": "b4a5e3d2bfc95743c780d17cea2e2487", "score": "0.56348205", "text": "hide(){\n this.visible = false ;\n }", "title": "" }, { "docid": "17881491b66f72cdfe57f7c5ca5dc599", "score": "0.5632714", "text": "function applyCustomShows() {\n if (! fromPreview) {\n cloga('showHideTags');\n// if (perm.yk) {\n// showHideTags(!! lu_console.showAdminTags);\n// }\n cloga('showHideFreeTags');\n if (showFT) {\n showHideFreeTags();\n }\n cloga('showHideHeader');\n showHideHeader(!! lu_console.showHeader);\n }\n}", "title": "" }, { "docid": "f4b937af2bdcde916e8e1a44c1dbb6b2", "score": "0.5630679", "text": "hide(){\nthis.greeting.hide();\nthis.input.hide();\nthis.button.hide();\n\n}", "title": "" }, { "docid": "56b67069a1ffffbdd58ed36e3b42c920", "score": "0.562787", "text": "function show(visible, type) {\n blockType = visible ? type : undefined;\n blockVisible = visible;\n notifyCallbacks();\n }", "title": "" }, { "docid": "0df29c5e65279ba96b1a3da9e1a87f52", "score": "0.5615823", "text": "function requestHide(elem) {\n\telem.outTimeout = setTimeout(function() { out2(elem); }, 300);\n}", "title": "" }, { "docid": "7043ecf176d944eba318aee549576975", "score": "0.5612213", "text": "function badger() { show('badger') }", "title": "" }, { "docid": "ed9e22dd279e5eaeb7d62f0e0b7d3c40", "score": "0.561202", "text": "hideActivities() {\n }", "title": "" }, { "docid": "dc74fdd7980997d64504e418951409b3", "score": "0.56076086", "text": "hide(node) {\n hidden = node;\n }", "title": "" }, { "docid": "5f8e82cd49a594148cc36ac9c00ebb32", "score": "0.5600093", "text": "hideActivities() {\n\t this.activityLocked.alpha = 0.0;\n\t this.top_mid_panel.alpha = 0.0;\n\t /*this.r1_map.alpha = 0;\n\t this.r1_notebook.alpha = 0;\n\t this.help_menu.alpha = 0.0;\n\t this.helpOpen = false;*/\n }", "title": "" }, { "docid": "d345edd3d4dc37fc331e9e353103c9ab", "score": "0.55965894", "text": "function displayInstructions(){\nif(instructionVisibility ===true){\n instructionVisibility=false;\n}\nelse{\n instructionVisibility=true;\n}\nchangeInstructionVisibility(instructionVisibility);\n}", "title": "" }, { "docid": "6f1adc82ca946f8c7d0c907a6d40a59e", "score": "0.5593932", "text": "function display_block() {\n\t$('body').children('table').eq(10).after('<div style=\"background: #FFF1DC;width: 350px;padding: 10px;\">' +\n\t\t'<p style=\"margin-top: 0px;\"><button class=\"click-to-download-csv\" style=\"padding: 5px;\">DOWNLOAD CSV</button></p>' +\n\t\t//'<p><b>Last update time</b></p>' +\n\t\t'<div id=\"last-upload-date\"></div></div>');\n\n\t$('.click-to-download-csv').click(function () {\n\t\tfilter_to_grap();\n\t});\n}", "title": "" }, { "docid": "037bb9bcb87e8d176a1a40687c9a5a16", "score": "0.5582097", "text": "function hideHuntElements() {\n toggleHintButton(/* hide = */ true);\n toggleSubmitForm(/* hide = */ true);\n toggleGenerateButton(/* hide = */ true);\n document.getElementById(HINT_DISPLAY).classList.add(INVISIBLE_CLASS);\n document.getElementById(SUBMIT_BOX).classList.add(INVISIBLE_CLASS);\n}", "title": "" }, { "docid": "59b9e0c2ff26105ec273f04ef93e434e", "score": "0.5575187", "text": "function enableHideInternal() {\n $el.find(\".hide-internal\").css(\"display\", \"\");\n }", "title": "" }, { "docid": "4f0b9880eca1e232a1d509da5c1883ab", "score": "0.5574951", "text": "function _hideAllDescriptions() {\n div_help_about.style.display = \"none\";\n div_help_cockpit.style.display = \"none\";\n div_help_dataExplorer.style.display = \"none\";\n div_help_dataSources.style.display = \"none\";\n }", "title": "" }, { "docid": "924f38defed8e440188edebe0ad7d710", "score": "0.5572873", "text": "function showBids()\r\n{\r\n\tTechSpec.show(\"showbids\",\"bids.do\");\r\n}", "title": "" }, { "docid": "43b8ddb413d854eb888c26ef08abdb93", "score": "0.55593145", "text": "function NoneReport() {\n Report.call(this);\n}", "title": "" }, { "docid": "b4f8379a3b98f49f3cd6b69f451ae4c6", "score": "0.5553384", "text": "hide_() {\n Blockly.WidgetDiv.hide();\n Blockly.DropDownDiv.hideWithoutAnimation();\n }", "title": "" }, { "docid": "2ad684e4d8cb9b1c8cbc4878e5cf6874", "score": "0.5546909", "text": "function show(el) {\n\tel.style.display = '';\n}", "title": "" }, { "docid": "c60dc32e8a4c04624c048dbc82e02965", "score": "0.55460596", "text": "function hideUnwantedMainStatistics(){\n\tvar maskArmor = [true, true, false, true, true];\n\tvar maskShoes = [true, true, false, false, true];\n\tvar maskWeapon = [false, false, true, true, true];\n\tvar maskLoadingMechanism = [false,false,true,true,false];\n\tif(currentType === 0 || currentType === 2 || currentType === 13)\n\t{\n\t\tsetupMainStatsVisibility(maskArmor);\n\t}\n\telse if(currentType === 1)\n\t{\n\t\tsetupMainStatsVisibility(maskShoes);\n\t}\n\telse if(currentType === 4){\n\t\tsetupMainStatsVisibility(maskLoadingMechanism);\n\t}\n\telse\n\t{\n\t\tsetupMainStatsVisibility(maskWeapon);\n\t}\n\t\t\n}", "title": "" }, { "docid": "256a3b50979a839b6cb216c9f86fd129", "score": "0.5532359", "text": "function newAssetstoreHide() {\n 'use strict';\n $(document).trigger('hideCluetip');\n} // end function newAssetstoreHide", "title": "" }, { "docid": "c59dd1aaa2d39d7fafc45838e04da5f9", "score": "0.5528953", "text": "hideHandler() {\r\n\t\tthis.setState({ showDetails: false, active_asset: {} });\r\n\t}", "title": "" }, { "docid": "8ebb56854d477d143963de314a2f5dbe", "score": "0.55269253", "text": "hide() {\n this.hidden = true;\n }", "title": "" }, { "docid": "add9143affca52a8ca9a18b678eff07d", "score": "0.5526368", "text": "function showRender(){\n\n\t}", "title": "" }, { "docid": "7c9b559c1a96bfe874352f68d410da37", "score": "0.55263174", "text": "function show(target) {\n $('#general').hide();\n $('#demographics').hide();\n $('#act').hide();\n $('#campaign').hide();\n $('#' + target).fadeIn(1300);\n if (target == 'campaign') {\n\n plot5.replot();\n plot6.replot();\n plot7.replot();\n }\n}", "title": "" }, { "docid": "29fdec4c6c579b619b2e701b3b343f41", "score": "0.5522146", "text": "function hidactentry() {\n $(\"#invoicedetail\").hideColumn(7); // hide voucher no at AP and BIll verification\n //$(\"#invoicedetail\").hideColumn(10); // hide Payref NO Number at AP 1 and Bill Verification\n $(\"#invoicedetail\").hideColumn(11); // hide POD Number show at dispatch only\n}", "title": "" }, { "docid": "f723c2fb88adf6c66d10b924a3990081", "score": "0.5519156", "text": "hide() {\n this.visible = false;\n }", "title": "" }, { "docid": "378f193ae5bc8cdc863a9687feb5fe21", "score": "0.550675", "text": "function HIDE_CURRENT_FORM()\n{\n if (GLOBAL_flagTraceModeOn) TRACE(\"HIDE_CURRENT_FORM executed to hide the current 5250 screen\"); \n \n VF_SY120_ADDMESSAGE(\"HIDE\",VF_BUILD_ARGUMENT_STRING(arguments)); \n return;\n}", "title": "" }, { "docid": "5e3af5ae292002e5f4cff75ccad394a9", "score": "0.5505288", "text": "function set_display() {\n good = !good;\n display();\n good = !good;\n display();\n }", "title": "" }, { "docid": "795b4582cf171f3f6823519ef6fa8a2c", "score": "0.55024105", "text": "function onHide() {\r\n \t//View.onHide();\r\n \tLogger.getInstance().infoF(\"ref=$1$ at=on-hide\", [self.ref]);\r\n \tself.clearToast();\r\n \tself.clearToastPoller();\r\n \treturn false;\r\n }", "title": "" }, { "docid": "f404c3f003089a178ffda91a7fe4808c", "score": "0.54957473", "text": "function hideDisplays() {\n\tvar hitpoints = document.getElementById(\"div-hitpoints\");\n\tvar weight = document.getElementById(\"div-weight\");\n\tvar speed = document.getElementById(\"div-speed\");\n\tvar attack = document.getElementById(\"div-attack\");\n\tvar defense = document.getElementById(\"div-defense\");\n\tvar abilities = document.getElementById(\"div-ability\");\n\t\n\t\n\tif(document.getElementById(\"check-hitpoints\").checked) {\n\t hitpoints.className = \"info-div\";\n\t} else {\n\t hitpoints.className = \"hidden\";\n\t}\n\t\n\tif(document.getElementById(\"check-weight\").checked) {\n\t weight.className = \"info-div\";\n\t} else {\n\t weight.className = \"hidden\";\n\t}\n\t\n\tif(document.getElementById(\"check-speed\").checked) {\n\t speed.className = \"info-div\";\n\t} else {\n\t speed.className = \"hidden\";\n\t}\n\t\n\tif(document.getElementById(\"check-attack\").checked) {\n\t attack.className = \"info-div\";\n\t} else {\n\t attack.className = \"hidden\";\n\t}\n\t\n\tif(document.getElementById(\"check-defense\").checked) {\n\t defense.className = \"info-div\";\n\t} else {\n\t defense.className = \"hidden\";\n\t}\n\t\n\tif(document.getElementById(\"check-abilities\").checked) {\n\t abilities.className = \"info-div\";\n\t} else {\n\t abilities.className = \"hidden\";\n\t}\n}", "title": "" }, { "docid": "6db4ce51486a7901fbfe629b6c2c4343", "score": "0.5493727", "text": "function control_iss_form2_itemwise_report_form(ptr)\n {\n\n if(ptr>0)\n {\n jQuery('#search_form_table_n').show('slow');\n jQuery('#search_form_table_iss2_1').show('slow');\n jQuery('#search_form_table_iss2_2').show('slow');\n if(ptr==1 || ptr==5)\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').hide('slow');\n }\n else\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').show('slow');\n\n }\n\n //control missing & completed\n if(ptr==2)\n {\n jQuery('#missing_list,#completed_list').hide('slow');\n }\n else\n {\n var login_office_status=jQuery('#login_office_status').val();\n if(login_office_status != 4)\n {\n jQuery('#missing_list,#completed_list').show('slow');\n }\n else\n {\n jQuery('#missing_list,#completed_list').hide('slow');\n }\n }\n\n }\n else\n {\n jQuery('#search_form_table_n').hide('slow');\n jQuery('#search_form_table_iss2_1').hide('slow');\n jQuery('#search_form_table_iss2_2').hide('slow');\n }\n }", "title": "" }, { "docid": "a6ac78f1bbade421bd170aec26e262f9", "score": "0.54911053", "text": "function disp(id, handle){\r\n\tif(handle=='show'){\r\n\t\t$(id).style.display = 'block';\r\n\t}else{\r\n\t\t$(id).style.display = 'none';\r\n\t}\r\n}", "title": "" }, { "docid": "2823c6fffa66c727c13a3f260f46ce69", "score": "0.5485216", "text": "function hideHeader() {\n \n //grab the elements to hide by ID\n var instructionsHide = document.getElementById(\"instructions\");\n var headerHide = document.getElementById(\"orig_heading\");\n var originalTiles = document.getElementById(\"originals\");\n \n //call the hide function and pass the variables as parameters\n hide(instructionsHide);\n hide(headerHide);\n hide(originalTiles);\n \n //create the hide function, which sets the style display to none on the requested items\n function hide( toHide ) {\n toHide.style.display = \"none\";\n }\n \n}", "title": "" }, { "docid": "1f18bd0b7e93a445d766c94955bf07c0", "score": "0.54813915", "text": "function show()\n{\n\t// Restart any timers that were stopped on hide\n}", "title": "" }, { "docid": "6cbb299ab4abaa1c4344505ce7ccb4a6", "score": "0.5481207", "text": "function hide_receive_section(userid) {\n setTimeout(function() {\n if (!calling) {\n reject_call(userid);\n }\n }, 18000);\n}", "title": "" }, { "docid": "907d1ddff3b8b0f03df2ca10ac8283d7", "score": "0.548021", "text": "function\nShowBlocker\n()\n{\n var blocker;\n\n blocker = document.getElementById(\"MainBlocker\");\n blocker.style.visibility = \"visible\";\n}", "title": "" }, { "docid": "907d1ddff3b8b0f03df2ca10ac8283d7", "score": "0.548021", "text": "function\nShowBlocker\n()\n{\n var blocker;\n\n blocker = document.getElementById(\"MainBlocker\");\n blocker.style.visibility = \"visible\";\n}", "title": "" }, { "docid": "23c01272057738097789b51e4d12e37f", "score": "0.5479893", "text": "function switch_display() \r\n{\r\n\r\n}", "title": "" }, { "docid": "ecb7fcfe74f364284e3c93fae16c9718", "score": "0.5479621", "text": "function setHidden() {\n canvas = voorkantcanvas;\n $('#voorKant').css('font-weight', 'bold');\n voorkant.parent().css('margin-right', '325px');\n middelste.parent().css('display', 'none');\n envelop.parent().css('display', 'none');\n canvas.calcOffset();\n canvas.renderAll();\n }", "title": "" } ]
6eeaf2f2a3864b1b31a7bc0063a6e47a
param: array: an array of heights. return: the amount of water we can save in all the ruptures.
[ { "docid": "628bb53ece4f83117d9c6b248db73c45", "score": "0.6546828", "text": "function waterfall(array) {\n return sumRuptures(array, [], 0);\n\n // params:\n // array: the array to look for ruptures. (Sometimes I will send different array)\n // ruptures: array of all the ruptures I found so far.\n // startIndexOfRupture: the start index to look for the next rupture.\n //\n // return: the amount of water we can save in all the ruptures.\n function sumRuptures(array, ruptures, startIndexOfRupture) {\n if (array.length <= 2)\n return ruptures;\n\n if (startIndexOfRupture >= array.length - 1)\n return ruptures;\n\n const leftHeightOfRupture = array[startIndexOfRupture];\n\n const isEndOfRupture = index => leftHeightOfRupture > array[index];\n\n // the function returns the first index which fulfills: leftHeightOfRupture > array[index] && leftHeightOfRupture <= array[index+1]\n // reminder: array[index+1] is the end of the rupture.\n // it means that, that index is the prev before the last index of the current rupture:\n // [...,startIndexOfRupture,...,*almostEndIndexOfRupture*,last-index-of-rupture,...].\n const almostEndIndexOfRupture = findLastIndexBy(array, startIndexOfRupture + 1, array.length, isEndOfRupture);\n\n // four possible outcomes:\n // 1. almostEndIndexOfRupture === array.length-2 ==> the last cell of the array is the highest ==>\n // we calculate such that the left side is the highest point.\n // 2. almostEndIndexOfRupture === array.length-1 ==> the last cell of the array is NOT the highest =>\n // we can flip that sub array and then we are in option 1 or 3.\n // (3 if we will have multiple ruptures in this rupture).\n // 3. almostEndIndexOfRupture < array.length-2 ==> we calculate such that the left side is the highest point.\n // 4. almostEndIndexOfRupture === -1 ==> the next number was bigger then the start of the rupture. so there is no rupture.\n\n if (almostEndIndexOfRupture === -1) {\n // option: 4: the next number was bigger then the start of the rupture. so there is no rupture.\n // I will try to loop the next rupture from this position:\n return sumRuptures(array, ruptures, startIndexOfRupture + 1);\n }\n\n if (almostEndIndexOfRupture === array.length - 1) {\n // option: 2: the last cell of the array is NOT the highest =>\n // we can flip that sub array and then we are in option 1 or 3.\n // (3 if we will have multiple ruptures in this rupture).\n\n // *Note*: I can build the array with much better speed but this is for test-readability only!!!\n const reversedPartialArray = array.slice(startIndexOfRupture, almostEndIndexOfRupture + 1).reverse();\n const rupturesFromPartialArray = sumRuptures(reversedPartialArray, [], 0)\n // I sent the partial array in reverse so I will receive the results in reverse.\n .reverse()\n // we need to add offset to every index because we calculated the ruptures from a partial array.\n .map(rupture => ({\n ...rupture,\n from: startIndexOfRupture + (reversedPartialArray.length - 1 - rupture.to),\n to: startIndexOfRupture + (reversedPartialArray.length - 1 - rupture.from)\n }));\n return [...ruptures, ...rupturesFromPartialArray];\n }\n\n // options: 1,3: we calculate such that the left side is the highest point.\n // we look at all the cells such that: [startIndexOfRupture + 1 ,almostEndIndexOfRupture]\n\n const waterInRupture = array.slice(startIndexOfRupture + 1, almostEndIndexOfRupture + 1)\n .map(height => leftHeightOfRupture - height)\n .reduce((sum, height) => sum + height, 0);\n\n const rupture = {\n from: startIndexOfRupture,\n to: almostEndIndexOfRupture + 1,\n maxHeight: leftHeightOfRupture,\n water: waterInRupture\n };\n\n // we search for the next rupture and calculate how much water it will save.\n return sumRuptures(array, [...ruptures, rupture], almostEndIndexOfRupture + 1);\n }\n}", "title": "" } ]
[ { "docid": "c4b3f730ef7a702f0ccec5131891e5e2", "score": "0.74373615", "text": "function waterArea(heights) {\n let leftMax = [...Array(heights.length).keys()].map(() => null);\n let rightMax = [...Array(heights.length).keys()].map(() => null);\n let localLeftMax = 0;\n let localRightMax = 0;\n let j = heights.length-1;\n for (let i = 0; i < heights.length; i++) {\n j = heights.length-1 - i;\n\n leftMax[i] = localLeftMax;\n localLeftMax = Math.max(localLeftMax, heights[i]);\n\n rightMax[j] = localRightMax;\n localRightMax = Math.max(localRightMax, heights[j]);\n }\n let water = [];\n let minHeight = 0;\n\n for (let x = 0; x < heights.length; x++) {\n minHeight = Math.min(leftMax[x], rightMax[x]);\n if (heights[x] < minHeight) {\n water.push(minHeight - heights[x]);\n } else {\n water.push(0);\n }\n }\n if (water.length === 0) return 0;\n return water.reduce((a, b) => a + b);\n}", "title": "" }, { "docid": "75dbe9b746251d082434ecd1715cd5bb", "score": "0.6935953", "text": "function waterArea(heights) {\n // Write your code here.\n\n let leftmaxes = [];\n let lMax = 0;\n\n for (let i = 0; i < heights.length; i++) {\n leftmaxes[i] = lMax;\n lMax = Math.max(heights[i], lMax);\n }\n console.log(\"leftmaxes\", leftmaxes);\n let rightMaxes = [];\n let rMax = 0;\n\n for (let i = heights.length - 1; i >= 0; i--) {\n rightMaxes[i] = rMax;\n rMax = Math.max(rMax, heights[i]);\n }\n console.log(\"rightmaxes\", rightMaxes);\n let area = 0;\n let res = [];\n for (let i = 0; i < heights.length; i++) {\n //now looking at current el let's calculate the area of water above it\n let minHeight = Math.min(leftmaxes[i], rightMaxes[i]); //take the min Height on both sides of current el\n if (heights[i] < minHeight) {\n //find the difference between the minHeight and the current el(how much water will be stored)\n //and add it to the prev area\n area += minHeight - heights[i]; // skip+skip+8+8+3+8+8+skip+3+3+2+2+3=>48\n }\n }\n return area;\n}", "title": "" }, { "docid": "b203df40950e62ad4a69be82f728bc77", "score": "0.647758", "text": "function naiveSolution(heights) {\n let totalWater = 0;\n for (let i = 1; i < heights.length - 1; i++) {\n let leftBound = 0;\n let rightBound = 0;\n // We only want to look at the elements to the left of i, which are the elements at the lower indices\n for (let j = 0; j < i; j++) { \n leftBound = Math.max(leftBound, heights[j]);\n }\n // Likewise, we only want the elements to the right of i, which are the elements at the higher indices\n for (let j = i+1; j < heights.length; j++) {\n rightBound = Math.max(rightBound, heights[j]);\n }\n totalWater += Math.min(leftBound, rightBound) - heights[i];\n }\n return totalWater;\n}", "title": "" }, { "docid": "4f0bf1b029435238f05fdb28d6dc5885", "score": "0.64319146", "text": "function trappingRnWtrOptimized(heights) {\n let pL = 0,\n pR = heights.length - 1,\n maxLeft = 0,\n maxRight = 0,\n totalWater = 0;\n\n while (pL !== pR) {\n if (heights[pL] <= heights[pR]) {\n if (heights[pL] < maxLeft) totalWater += maxLeft - heights[pL];\n else maxLeft = heights[pL];\n pL++;\n }\n if (heights[pL] > heights[pR]) {\n if (heights[pR] < maxRight) totalWater += maxRight - heights[pR];\n else maxRight = heights[pR];\n pR--;\n }\n }\n return totalWater;\n}", "title": "" }, { "docid": "e48db09af2f15957343d88fb0f5672ab", "score": "0.6197489", "text": "function waterArea(heights) {\n // Write your code here.\n //for each index calculate how much water will be contained above that index\n //if there's no pillar at least at one side of the existing pillar->\n //then the water spills(No reason to calculate it)\n //!!!Water should be trapped in between two pillars!!!\n //1. find the tallest pillar to the left of the current index\n //2. find the tallest pillar to the right to it\n //3.find the minimum height of two tallest pillars=>\n // what is the smallest between the two tallest(right , left) to see if the current element has room for water\n //4.if the minHeight < currentEl then substract currentEl from minHeigt and it will be\n //how much water can be trapped above the current element\n //BUT if curEl>minHeight => water will be 0 (it will run away)\n\n let maxes = [];\n let leftMax = 0;\n\n for (let i = 0; i < heights.length; i++) {\n //from the very start maxes[0] will be 0 because if we look at heights[0] there will never be pillars\n //to the left of it\n maxes[i] = leftMax; //0 8 8 8 8 8 8 10 10 10 10 10\n //now update leftMax for the next iteration\n leftMax = Math.max(leftMax, heights[i]); //0 8 8 8 8 8 8 10 10 10 10 10\n }\n //once we are done with the loop above maxes will contain all the maxLeft pillars\n //now store right maxes somewhere\n let rightMax = 0;\n //we'll restore rightmaxes in our maxes array\n for (let i = heights.length - 1; i >= 0; i--) {\n //because maxes[i] already has the tallest leftMax stored\n let minHeight = Math.min(rightMax, maxes[i]); //min between maxRight and maxLeft 0\n if (heights[i] < minHeight) {\n //element is lower then pillars so wthere's room for water above it\n maxes[i] = minHeight - heights[i];\n } else {\n maxes[i] = 0; // pillar is lower then element->water will run away\n }\n //update the rightMax with each iteration\n rightMax = Math.max(rightMax, heights[i]); // 3\n }\n return maxes.reduce((curEl, sum) => sum + curEl, 0);\n}", "title": "" }, { "docid": "a3d0c446f1a06ddc5265f010079c5fd0", "score": "0.61153775", "text": "function measureWater(arr) {\n let sum = 0;\n let left = 0;\n let highestIndex = 1;\n while (left < arr.length - 1) {\n for (let i = left + 1; i < arr.length; i++) {\n if (arr[i] > arr[highestIndex]) {\n highestIndex = i\n }\n if (arr[i] >= arr[left]) {\n highestIndex = i\n //if the right wall is higher or the same height of the left, then we are finished with this section of the array\n //therefore we can stop the for loop here, and begin a new one with a new left wall\n break;\n }\n }\n //store our sum and make make the left wall the highIndex\n sum += calculateVolume(arr, left, highestIndex)\n left = highestIndex\n highestIndex = left + 1\n }\n return sum;\n}", "title": "" }, { "docid": "c84c7739aa800aac99c195d5f1e74a25", "score": "0.5896748", "text": "function myTileHeight(i, j){\n\n if(noise(i, j) > 0.86 && noise(i, j) <= 1.0){\n boatPoints.push(i);\n boatPoints.push(j);\n\n for(var k = 0; k < boatPoints.length; k += 2){\n if(i == boatPoints[k] && j == boatPoints[k+1]){\n return 2.2; //returning boat\n }\n }\n }\n\n //scanning for a high point in the noise and placing a drowning person at that point\n if(noise(i, j) > 0.8 && noise(i, j) <= 0.86){\n\n highPoints.push(i);\n highPoints.push(j);\n\n\n //if the user has clicked on a dworning person, change to a saved person\n if(clicks.length > 0){\n for(var k = 0; k < clicks.length; k += 2){\n if(i == clicks[k] && j == clicks[k+1]){\n return 2.1; //returning drowningPersonSaved\n }\n }\n }\n //otherwise, setting up drowning person\n return 2;\n }\n //if not drowning or saved person, return noise function of time for water effect \n return cos(sin(noise(i)*(millis()/200)*noise(j)));;\n}", "title": "" }, { "docid": "852c889836baf68cd7bc377c41cf7647", "score": "0.580301", "text": "function mostWaterContainer(ints) {\n let largestArea = 0;\n let totalLength = ints.length;\n let x = 0;\n let y = 0;\n\n while (x < totalLength) {\n // console.log(\"x,y\", x,y);\n currHeight = ints[x] > ints[y] ? ints[y] : ints[x];\n // console.log(\"height\", currHeight)\n currLength = y - x;\n // console.log(\"length\", currLength);\n currArea = currHeight * currLength;\n // console.log(\"curARea\", currArea);\n\n if (currArea > largestArea) {\n largestArea = currArea;\n }\n\n y += 1;\n\n if (y >= totalLength) {\n x += 1;\n y = x;\n }\n }\n return largestArea;\n}", "title": "" }, { "docid": "263148dd305ca1bcc1b9f5247ab6dd67", "score": "0.5686843", "text": "function IceandWaterFunc() {\n var t = [];\n var p = [];\n items.map(function (singleElement) {\n t.push(parseFloat(singleElement.eave));\n p.push(parseFloat(singleElement.valleyRM));\n });\n var x = t.reduce((a, b) => a + b, 0);\n var y = p.reduce((a, b) => a + b, 0);\n return setTotalEaves(((x + y) / 60).toFixed(1));\n }", "title": "" }, { "docid": "79a68af6e7f019618404c75bf2c06495", "score": "0.563148", "text": "function numTicksForHeight(height) {\n if (height <= 300) return 3;\n if (300 < height && height <= 600) return 5;\n return 10;\n}", "title": "" }, { "docid": "79a68af6e7f019618404c75bf2c06495", "score": "0.563148", "text": "function numTicksForHeight(height) {\n if (height <= 300) return 3;\n if (300 < height && height <= 600) return 5;\n return 10;\n}", "title": "" }, { "docid": "a29e81ffffbfb2ecf53e14778d20b51f", "score": "0.5623642", "text": "function skylineHeights(arr) {\n var max = 0; // init lock lvl \n var count = 0; // counter for how many buldings are hidden \n for (var trac = 0; trac < arr.length; trac++){\n if (arr[trac] < max) {\n count++; \n } else {\n max = arr[trac];\n arr[trac - count] = arr[trac];\n }\n }\n console.log(arr,count);\n arr.length -= count;\n return arr;\n}", "title": "" }, { "docid": "f8afc86c8297ef969017c7578084bec1", "score": "0.5620308", "text": "function getHeight(height) {\n return Math.round(obj.height * scale);\n }", "title": "" }, { "docid": "6cadc240ccb267a5c9a148f0fb924127", "score": "0.5618162", "text": "function numTicksForHeight(height) {\n if (height <= 300) return 3;\n if (300 < height && height <= 600) return 5;\n return 10;\n}", "title": "" }, { "docid": "6b378c1cae26350d4f615a970ae3946a", "score": "0.56132716", "text": "function findWather(array) {\n\n var max_one = array[0],\n index_one = 0,\n max_two = array[array.length-1],\n index_two = 0,\n count = 0,\n water_one = 0,\n water_two = 0,\n water = 0;\n\n\n do{\n\n for (var i = 0; i < array.length; i++) {\n if (array[i] >= max_one) {\n water += max_one * index_one - water_one;\n water_one = 0;\n index_one = 0;\n max_one = array[i];\n console.log(max_one);\n } else {\n water_one += array[i];\n index_one += 1;\n }\n }\n\n\n for ( i = array.length-1; i >= 0; i--) {\n if (array[i] > max_two) {\n water += max_two * index_two - water_two;\n water_two = 0;\n index_two = 0;\n max_two = array[i];\n console.log(max_two)\n } else {\n water_two += array[i];\n index_two +=1;\n }\n }\n\n if (max_one === max_two) {\n index_two = array.length;\n continue;\n }\n\n} while (index_two < array.length);\n console.log('water = ', water);\n}", "title": "" }, { "docid": "47d88b3f6f2ceada53e1eb8996285da7", "score": "0.56084114", "text": "function numTicksForHeight(height) {\n if (height <= 300) return 3;\n if (300 < height && height <= 600) return 6;\n return 10;\n}", "title": "" }, { "docid": "ca7562d4e3c56c332ec43c294357eef5", "score": "0.5476384", "text": "function tp_sum_height(layers, max)\n{\n\tvar total_height = 0;\n\tfor (var i = 0; i < layers.length; i++) {\n\t\tif (null != max && i == max) break;\n\t\ttotal_height += layers[i].bounds[3].value - layers[i].bounds[1].value;\n\t}\n\n\treturn total_height;\n}", "title": "" }, { "docid": "e51e564248ae19b2ef8a863c327c6849", "score": "0.54294425", "text": "heightAt(x, y, z) {\r\n\t\t//compute one octave of noise\r\n\t\tx *= 2;\r\n\t\ty *= 2;\r\n\t\tz *= 2;\r\n\t\tconst n1 = this.noise.perlin3d(x, y, z) + 0.5;\r\n\t\t\r\n\t\tx *= 2;\r\n\t\ty *= 2;\r\n\t\tz *= 2;\r\n\t\tconst n2 = this.noise.perlin3d(x, y, z) * 0.5;\r\n\r\n\t\tx *= 4;\r\n\t\ty *= 4;\r\n\t\tz *= 4;\r\n\t\tconst n3 = this.noise.perlin3d(x, y, z) * 0.125;\r\n\r\n\t\t//combine octaves\r\n\t\treturn Math.max(0, n1+n2+n3);\r\n\t}", "title": "" }, { "docid": "1282b618d5ab052e28f730a1a5ad1de5", "score": "0.5370412", "text": "function getHeight(num){\n var height= 1;\n for (i=0; i<num;i++){\n if (i%2==0){\n height *=2;\n }\n if (i%2>0){\n height +=1;\n }\n }\n return (height).toString();\n\n }", "title": "" }, { "docid": "c6288479d24a0a4b1ecb33b43cbe8393", "score": "0.53664035", "text": "function estimateReservoirArea(damHeight) {\n var z0 = 62 // SRTM value at the dam before contruction\n \n var res = srtm.mask(srtm.subtract(z0).lt(damHeight))\n\n Map.addLayer(res, {min:0, max:damHeight}, 'Three Gorges Depth, dam height = ' + damHeight, false)\n\n var area = ee.Number(\n res.mask()\n .multiply(ee.Image.pixelArea())\n .reduceRegion({reducer: ee.Reducer.sum(), geometry: vs_three_gorges.geometry(), scale: 60, maxPixels: 1e8})\n .get('elevation')\n )\n \n return area.divide(1000000).round()\n }", "title": "" }, { "docid": "8c9848fd2bc9786ccd8a5a2fe9deaa8a", "score": "0.5289477", "text": "function getHeight(_height) {\r\n return Math.round((maxBarHeight - _height) / 2);\r\n }", "title": "" }, { "docid": "e988b8f8664110bc9117997fbff0b53b", "score": "0.52269125", "text": "function calculateHeight(response) {\n\tvar height;\n\ttemperature = Math.round(response.current_observation.temp_f);\n\t \n\tif (temperature == 0) {\n\t\theight = 50;\n\t\treturn height;\n\t} else if (temperature > 0) {\n\t\theight = temperature * 2 + 50;\n\t\treturn height;\n\t} else {\n\t\theight = 50 + temperature * 2;\n\t\treturn height;\n\t}\n}", "title": "" }, { "docid": "2a8fd9aa4d4aa4226a954d739a633295", "score": "0.52039146", "text": "function getHeight (data) {\n const ROW_SPACING = 198.125\n totalPostNum = data.length\n totalRow = (totalPostNum%stepsX !== 0) ? Math.floor(totalPostNum/stepsX) + 1 : totalPostNum/stepsX\n section_height = (ROW_SPACING * totalRow) + 110\n return section_height\n }", "title": "" }, { "docid": "ae386656e46dc98917423c8b03ecd85c", "score": "0.5177351", "text": "function sumBetween(i1, i2) {\r\n var tot = 0;\r\n var min = Math.min(heights[i1], heights[i2]);\r\n if(heights[i1] <= heights[i2]){\r\n for(var i = i1 + 1; i < i2; i++) {\r\n if(heights[i] < min) tot += min - heights[i];\r\n else break;\r\n }\r\n }\r\n else {\r\n for(var i = i2 - 1; i > i1; i--) {\r\n if(heights[i] < min) tot += min - heights[i];\r\n else break;\r\n }\r\n }\r\n return tot;\r\n }", "title": "" }, { "docid": "67f899e3ba03383fd791899e175b76c7", "score": "0.5161966", "text": "function effWalW(holeNum) {\n return walW + 0.75 * fhDs[holeNum];\n}", "title": "" }, { "docid": "40a42545e5a82927e7a547f832f7aad0", "score": "0.515793", "text": "getLevelHeight() {\n return this.level.tilesHigh;\n }", "title": "" }, { "docid": "aeb9205bcbf600d22f4c5b08976b1e85", "score": "0.51282984", "text": "function grassGrow(array) {\n if (asdf % 200 == 0) {\n for (let p = 0; p < array.length; p++) {\n array[p].y1 -= 1;\n }\n }\n asdf++;\n}", "title": "" }, { "docid": "4887311acff8f416056fc948cd7e3c3a", "score": "0.5099125", "text": "function main() {\n var t = parseInt(readLine()); //cycles to consider\n var height = 1; //starting height of plant\n for(var a0 = 0; a0 < t; a0++){\n var n = parseInt(readLine()); //number of cycles of growth\n\n for (var i = 0; i < n; i++){\n if(i === 0 || i % 2 === 0){\n height *= 2;\n }else if (i === 1 || i % 2 !== 0){\n height += 1;\n }\n }\n console.log(height);\n height = 1;\n }\n}", "title": "" }, { "docid": "4318360b4e3a8d02130d13defa848291", "score": "0.5094881", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n pouchdbMerge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "147e35648bc2defff8e6fc4d2c89f5ba", "score": "0.50921816", "text": "function getTotalAmountWaterTopoPets() {\n\n\t// Set the variables\n\tvar totalAmountWaterTopoPets = 0;\n\n\t// Get the total amount of TopoPets\n\tfor (i=0; i<topoPets.length; i++) {\n\t\tif (topoPets[i][1] == \"WATER\") {\n\t\t\ttotalAmountWaterTopoPets++;\n\t\t// No 2nd type yet\n\t\t//} else if (topoPets[i][2] == \"WATER\") {\n\t\t//\ttotalAmountWaterTopoPets++;\n\t\t}\n\t}\n\n\t// Return the amount of TopoPets\n\treturn totalAmountWaterTopoPets;\n}", "title": "" }, { "docid": "694dfcb480b4f5a99a9fde1a0cc16a1d", "score": "0.50905514", "text": "function totalDistance(height, length, tower) {\n\tlet numberStair = 0;\n numberOfStair = tower / height;\n totaldistance = numberOfStair * (height + length);\n return totaldistance.toFixed(1)*1;\n}", "title": "" }, { "docid": "8fe4fbd936d57a8a385a7536e4f082f2", "score": "0.5088225", "text": "function pokemonHeight(){\n if (heights <=4) {circleheight = 200}\n if (heights >4) {circleheight = 220}\n if (heights >6) {circleheight = 240}\n if (heights >8) {circleheight = 260}\n if (heights >10) {circleheight = 280}\n if (heights >12) {circleheight = 300}\n if (heights >14) {circleheight = 320}\n if (heights >16) {circleheight = 340}\n if (heights >18) {circleheight = 360}\n}", "title": "" }, { "docid": "bc6d96b1f74989211965dbcda26a90d7", "score": "0.507928", "text": "function recVolume(height) {\n let dimensions = [height];\n const _measure = (num) => {\n if (dimensions.length < 3) {\n dimensions.push(num);\n }\n if (dimensions.length === 3) {\n let sum = dimensions.reduce((acc, el) => (acc *= el));\n return sum;\n } else {\n return _measure;\n }\n };\n return _measure;\n}", "title": "" }, { "docid": "ec751c0c575e0b427ff5979ce7aca9af", "score": "0.5075287", "text": "function calcDiveHeight(){ \n if (windowposition <= 20000) {\n diveHeight = windowposition / 10;\n convRate = 10;\n } else if (windowposition < 40000) {\n diveHeight = (2000) + (windowposition - 20000)/ 5;\n convRate = 5;\n } else {\n diveHeight = (6000) + (windowposition - 40000)/ 2;\n convRate = 2;\n }\n \n }", "title": "" }, { "docid": "7a48fa6f97821b9bf19bfc2ca96a6fb6", "score": "0.5075223", "text": "function getHeightMap(x, z) {\n\tvar xs = 0.8 + 2 * Math.sin(x / 10)\n\tvar zs = 0.4 + 2 * Math.sin(z / 15 + x / 30)\n\treturn xs + zs\n}", "title": "" }, { "docid": "a324176190bd7933710a6b8642379a1b", "score": "0.5072709", "text": "function getHeightMap(x, z) {\n\tvar xs = 0.8 + Math.sin(x / 10)\n\tvar zs = 0.4 + Math.sin(z / 15 + x / 30)\n\treturn xs + zs\n}", "title": "" }, { "docid": "701c4f98d8baa9a68386ea7b0e66185f", "score": "0.50715876", "text": "get height() {}", "title": "" }, { "docid": "1f401f3a35abb9b8953d133143994ae9", "score": "0.5071371", "text": "function calculateArea(width, heigth, depth) {\n\tvar area = width * heigth;\n\tvar volume = width * heigth * depth;\n\tvar sizes = [area, volume];\n\treturn sizes;\n}", "title": "" }, { "docid": "43e4be611137d6a8a977f3ca0a9acbbb", "score": "0.50659883", "text": "function hitungBmi(weight, height) {\n return weight / (height * height);\n}", "title": "" }, { "docid": "076a0164b8d3dc887ddfc9e4a1b9946d", "score": "0.50616294", "text": "get estimatedHeight() { return -1; }", "title": "" }, { "docid": "b69d42be2d7fd5095ee0c4fce3c758c8", "score": "0.505812", "text": "_getHeight(y, x) {\n // NO DATA from SRTM (ocean)\n if (this.sampleData[y][x] == -32768) {\n return 0;\n }\n\n return ((this.sampleData[y][x] - this.min) / this._groundResolution);\n }", "title": "" }, { "docid": "36c3b23c54a99918d4423a3edce6b838", "score": "0.50547266", "text": "function minHeightBst(array) {\n return getHalf(null, array, 0, array.length - 1);\n}", "title": "" }, { "docid": "5cd4e392c75d8362caf1b452b719863b", "score": "0.50487214", "text": "function countingValleys(n, s) {\n let heights = [];\n let height = 0;\n let numValleys = 0;\n\n for(let i = 0; i < s.length; i++) {\n if(s[i] === \"D\") {\n height -= 1;\n }\n if(s[i] === \"U\") {\n height += 1;\n }\n heights.push(height);\n }\n\n for(let j = 0; j < heights.length; j++) {\n if(heights[j] === -1 && heights[j+1] === 0) {\n numValleys += 1;\n }\n }\n return numValleys;\n}", "title": "" }, { "docid": "88df3dcf1ddf108ae21a51c37520c9bb", "score": "0.5048123", "text": "function waterfallStreams(array, source) {\n const width = array[0].length;\n let prevRow = Array(width).fill(0);\n\n prevRow[source] = 100;\n\n for (let i = 1; i < array.length; i++) {\n const currentRow = Array(width).fill(0);\n \n for (let waterIndex = 0; waterIndex < width; waterIndex++) {\n const waterAmtAbove = prevRow[waterIndex];\n const currentBlockFree = array[i][waterIndex] === 0;\n const isBlockWithinBoundaries = waterIndex > 0 && waterIndex < width - 1;\n\n if (waterAmtAbove === 0) continue;\n\n if (currentBlockFree) {\n currentRow[waterIndex] += waterAmtAbove;\n\n } else if (isBlockWithinBoundaries) {\n // move 50% water left to next empty block unless any block above is blocking flow\n for (let j = waterIndex - 1; j >= 0; j--) {\n if (array[i - 1][j] === 1) break;\n if (array[i][j] === 0) {\n currentRow[j] += waterAmtAbove / 2;\n break;\n }\n }\n\n // move 50% water right to next empty block unless any block above is blocking flow\n for (let k = waterIndex + 1; k < width; k++) {\n if (array[i - 1][k] === 1) break;\n if (array[i][k] === 0) {\n currentRow[k] += waterAmtAbove / 2;\n break;\n }\n }\n }\n }\n\n prevRow = currentRow;\n }\n\n return prevRow;\n}", "title": "" }, { "docid": "b9a2a5abb662dcbc30a0233053fa6bfd", "score": "0.50455517", "text": "function generateTerrain() {\n background(255);\n fill(0);\n let xOff = start;\n //resetting the flag variables and average height variable\n highestPoint = height;\n flagX = 0;\n averageHeight = 0;\n rectNum = 0;\n for (let x = 0; x < width; x++) {\n let y = noise(xOff) * height;\n if (y <= highestPoint) {\n //setting my flag variables\n highestPoint = y;\n flagX = x;\n }\n //adding up every rect y and counting how many their are\n averageHeight += y;\n rectNum++;\n fill(0);\n rect(x, y, rectWidth, height - y);\n xOff += inc;\n }\n start += inc;\n}", "title": "" }, { "docid": "108aeb62f0e9475d10d3853f7f296652", "score": "0.5035599", "text": "save() {\n let saveBins = [];\n this.bins.forEach((bin => {\n let saveBin = {\n width: bin.width,\n height: bin.height,\n maxWidth: bin.maxWidth,\n maxHeight: bin.maxHeight,\n freeRects: [],\n rects: [],\n options: bin.options\n };\n if (bin.tag)\n saveBin = Object.assign({}, saveBin, { tag: bin.tag });\n bin.freeRects.forEach(r => {\n saveBin.freeRects.push({\n x: r.x,\n y: r.y,\n width: r.width,\n height: r.height\n });\n });\n saveBins.push(saveBin);\n }));\n return saveBins;\n }", "title": "" }, { "docid": "e9728316e5dc41bf3249ce3fdbbdb6f9", "score": "0.5033206", "text": "function bar_height(d, i, roll) {\n var val = roll[1][i], chart_height = hist.chart_height();\n if(val === 0) return 0;\n val = y_scale(val);\n return chart_height-val;\n return Math.max(chart_height - val, min_bar_height);\n }", "title": "" }, { "docid": "1d912e3ffd3c3ef66c8c2177f078b2ea", "score": "0.5028899", "text": "get fundedBlockHeight() {\n let height = 0;\n\n const models = this.paymentsIn\n .filter(payment => {\n const paymentHeight = payment.get('height');\n return typeof paymentHeight === 'number' && paymentHeight > 0;\n })\n .sort((a, b) => (a.get('height') - b.get('height')));\n\n _.every(models, (payment, pIndex) => {\n if (this.getBalanceRemaining(new Transactions(models.slice(0, pIndex + 1))) <= 0) {\n height = payment.get('height');\n return false;\n }\n\n return true;\n });\n\n return height;\n }", "title": "" }, { "docid": "db48a90384af9e645edaf7682c2ae4e8", "score": "0.5023022", "text": "function unavailableLocationsInTower(legA, legB, legC, legD){\n currentHeight = towerHeight - 2.6;\n\n while (currentHeight > 0){\n let numberOfOccurences = 0;\n\n legA.forEach(function(antenna){\n if (Math.abs(antenna - currentHeight) < 0.001){\n numberOfOccurences++;\n }\n });\n\n legB.forEach(function(antenna){\n if (Math.abs(antenna - currentHeight) < 0.001){\n numberOfOccurences++;\n }\n });\n\n legC.forEach(function(antenna){\n if (Math.abs(antenna - currentHeight) < 0.001){\n numberOfOccurences++;\n }\n });\n\n legD.forEach(function(antenna){\n if (Math.abs(antenna - currentHeight) < 0.001){\n numberOfOccurences++;\n }\n });\n\n //console.log(\"Current Height: \", currentHeight);\n //console.log(\"Number of occurences: \", numberOfOccurences);\n\n if (numberOfOccurences <= 1){\n blockedHeights.push(currentHeight.toFixed(2));\n }\n\n currentHeight -= 0.1;\n }\n\n return blockedHeights;\n}", "title": "" }, { "docid": "519abe16de3edb5c364826f2d3a81270", "score": "0.50017035", "text": "function beeStings(weight){\n //# of bee stings = victim's weight/stingsPerPound\n var numOfStings = weight/stingsPerPound;\n //returns number of stings it takes to kill animal\n return numOfStings;\n}", "title": "" }, { "docid": "e8c654a8d5c77d3f672b6291faceec6c", "score": "0.49977815", "text": "function computeHeight(revs) {\n\t var height = {};\n\t var edges = [];\n\t traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n\t var rev = pos + \"-\" + id;\n\t if (isLeaf) {\n\t height[rev] = 0;\n\t }\n\t if (prnt !== undefined) {\n\t edges.push({from: prnt, to: rev});\n\t }\n\t return rev;\n\t });\n\t\n\t edges.reverse();\n\t edges.forEach(function (edge) {\n\t if (height[edge.from] === undefined) {\n\t height[edge.from] = 1 + height[edge.to];\n\t } else {\n\t height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n\t }\n\t });\n\t return height;\n\t}", "title": "" }, { "docid": "451c5b5de5520470b492ab6c565fe171", "score": "0.4993635", "text": "function findWeight(scope, array, x) {\t\n\tfor (var i=0; i<=array.length-1; i++) {\t\t\n\t\tvar _scale_y = (Math.floor(Math.random() * 5) + 1)/10;\n\t\tvar _y_val=(array[i][1]/1000)*3+200; /** (Molecular weight/1000)+150 */\n\t\tloadImagesProteins(queue.getResult(\"blue_solid_color\"), \"blue_solid_color\"+i, x, _y_val, \"\", 0, scene2_container, _scale_y, 1);\n\t\tapplyBlurFn(scope, scene2_container.getChildByName(\"blue_solid_color\"+i)); /** Applying blur effect for these loading images */\n\t}\t\n}", "title": "" }, { "docid": "5b78bddf1ba5b62a7a3382d7bdff8dba", "score": "0.49925447", "text": "function myHeight(chosen, d, clusterNames, binNames, y, heights) {\n if (chosen.cluster == null) {\n return 0;\n }\n if (clusterNames.indexOf(chosen.cluster) > clusterNames.indexOf(d.cluster)) {\n return y(0);\n }\n return y(heights[chosen.cluster][binNames.indexOf(d.x)]);\n }", "title": "" }, { "docid": "1adec2b7c8d1b78816bf29fd9ba5bd68", "score": "0.49848184", "text": "function parseHeights(heightArr) {\n let index = -1;\n const length = heightArr.length;\n const map = new Map();\n\n while (++index < length) {\n let current = heightArr[index];\n\n if (map.has(heightArr[index])) {\n map.set(current, map.get(current) + 1);\n } else {\n map.set(current, 1);\n }\n }\n\n return map;\n}", "title": "" }, { "docid": "4c2a82eca35aecac319eecc5369f51a7", "score": "0.49804705", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n }", "title": "" }, { "docid": "1e1eb6b2f38b4b7b1b70de139d8414d8", "score": "0.49798298", "text": "getTotalVolume()\n {\n return this.water + this.red + this.green + this.blue;\n\n }", "title": "" }, { "docid": "57e72c242056537d303154485d16ef33", "score": "0.49775255", "text": "function countingValleys(steps, path) {\r\n\t// Write your code here\r\n\tlet u = 0;\r\n\tlet d = 0;\r\n\tlet currLevel = 0;\r\n\tlet valleys = 0;\r\n\tlet mountains = 0;\r\n\tfor (let i = 0; i < steps; i++) {\r\n\t\t//update the current level\r\n\t\tif (path[i] === 'U') {\r\n\t\t\tcurrLevel += 1;\r\n\t\t\t// check if going up will bring me back to sea level\r\n\t\t\tif (currLevel == 0) valleys += 1;\r\n\t\t} else {\r\n\t\t\tcurrLevel -= 1;\r\n\t\t\t// check if going down will bring me back to sea level\r\n\t\t\tif (currLevel == 0) mountains += 1;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn valleys;\r\n}", "title": "" }, { "docid": "c3880df144035a9bedd031b7226a56bb", "score": "0.49731472", "text": "get height() { return 2.5; }", "title": "" }, { "docid": "a65160fbfc01e67cf385a5adfd6301c5", "score": "0.49691197", "text": "function computeHeight(revs) {\n\t var height = {};\n\t var edges = [];\n\t traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n\t var rev$$1 = pos + \"-\" + id;\n\t if (isLeaf) {\n\t height[rev$$1] = 0;\n\t }\n\t if (prnt !== undefined) {\n\t edges.push({from: prnt, to: rev$$1});\n\t }\n\t return rev$$1;\n\t });\n\n\t edges.reverse();\n\t edges.forEach(function (edge) {\n\t if (height[edge.from] === undefined) {\n\t height[edge.from] = 1 + height[edge.to];\n\t } else {\n\t height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n\t }\n\t });\n\t return height;\n\t}", "title": "" }, { "docid": "8f562a313d1367f24a19b9564ba2dce6", "score": "0.49644834", "text": "function maxArea(height) {\n let maxArea = 0\n let left = 0\n let right = height.length - 1\n\n while (left < right) {\n // Smallest wall height stops the water from spilling\n const smallestWall = Math.min(height[left], height[right])\n\n // Width of the base\n const base = right - left\n\n // Area = height * width\n const currentArea = smallestWall * base\n\n // Calculate maxArea\n maxArea = Math.max(currentArea, maxArea)\n\n // Shift walls\n const leftWall = height[left]\n const rightWall = height[right]\n\n if (leftWall < rightWall) {\n left++\n } else {\n right--\n }\n }\n\n return maxArea\n}", "title": "" }, { "docid": "f0ae8ba61ffdb7cc4877a62de031c1fa", "score": "0.49644312", "text": "function topple() {\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n nextpiles[x][y] = sandpiles[x][y];\n }\n }\n\n // adjust the critical height if needed\n criticalHeight = 4;\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n let num = sandpiles[x][y];\n if (num >= criticalHeight) {\n nextpiles[x][y] -= 4;\n if (x + 1 < width)\n nextpiles[x + 1][y]++;\n if (x - 1 >= 0)\n nextpiles[x - 1][y]++;\n if (y + 1 < height)\n nextpiles[x][y + 1]++;\n if (y - 1 >= 0)\n nextpiles[x][y - 1]++;\n }\n }\n }\n\n let tmp = sandpiles;\n sandpiles = nextpiles;\n nextpiles = tmp;\n}", "title": "" }, { "docid": "603b4b67bf517fc8a0d2d4d7ad981270", "score": "0.49590153", "text": "function fImageHeightWidth (imgsArray, ht, wt) {\n /**----( aHorizonImages: Setting array member's heights and widths )----**/\n for (var i = 0; i < imgsArray.length; i++) {\n fAnimateHeightWidth (imgsArray[i], ht, wt); //rowImgRightColmnWidth);\n ////console.log (\"imgsArray[i]: \", imgsArray[i]);\n }\n }", "title": "" }, { "docid": "11038def490d1483c6a5bf710e7648df", "score": "0.49490586", "text": "getHeight() {\n return new Promise(function(resolve, reject) {\n db.getBlocksCount().then((result) => {\n resolve(result);\n }).catch(function(err) {\n reject(err);\n });\n });\n }", "title": "" }, { "docid": "ba8456127f494bd754a1588dac3ec280", "score": "0.4942705", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n merge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "ba8456127f494bd754a1588dac3ec280", "score": "0.4942705", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n merge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "e6faee8f0ac5648b5505ada78d61c30a", "score": "0.4937247", "text": "get fundedBlockHeight() {\n let height = 0;\n\n const models = this.paymentsIn\n .filter(payment => {\n const paymentHeight = payment.get('height');\n return typeof paymentHeight === 'number' && paymentHeight > 0;\n })\n .sort((a, b) => (a.get('height') - b.get('height')));\n\n _.every(models, (payment, pIndex) => {\n const transactions = new Transactions(\n models.slice(0, pIndex + 1),\n { paymentCoin: this.paymentCoin }\n );\n if (this.getBalanceRemaining(transactions) <= 0) {\n height = payment.get('height');\n return false;\n }\n\n return true;\n });\n\n return height;\n }", "title": "" }, { "docid": "cdac37c67c729694f40f3cd68dcca1c3", "score": "0.49217448", "text": "function countingValleys(steps, path) {\n // create an altitude variable representing sea level and equal to zero\n let altitude = 0;\n // create a previousAlt variable equal to zero\n let previousAlt = 0;\n // create a valleys variable\n let valleys = 0;\n // iterate over the path string\n for (let i = 0; i < path.length; i++) {\n // previousAlt equals altitude\n let previousAlt = altitude;\n // if the current value is U increment sea level, if the value is D decrement the value\n if (path[i] === \"U\") {\n altitude++;\n } else {\n altitude--;\n }\n // if previousAlt < 0 && altitude === 0 then increment valleys\n if (previousAlt < 0 && altitude === 0) {\n valleys++;\n }\n }\n // return valleys\n return valleys;\n}", "title": "" }, { "docid": "f3abbca6ba07f870cfab9f4567c2b661", "score": "0.49198842", "text": "function buildings(arr, myElevation){\n newArr = []\n maxHeight = arr[0]\n for (var i = 0; i < arr.length; i++){\n if(maxHeight <= arr[i]){\n maxHeight = arr[i];\n // console.log(maxHeight);\n }\n if (arr[i] >= myElevation && arr[i] >= maxHeight){\n newArr.push(arr[i]);\n }\n }\n return newArr;\n}", "title": "" }, { "docid": "e926a5178902c160ae73fd110351f36e", "score": "0.49166498", "text": "getPictureHeight() {\n const mhm = (this.camera.MatrixHeight / 10000); /* matrix height in meters */\n const { altitude } = this.mission;\n const fm = (this.camera.Focal / 10000); /* focal in meters */\n return ((mhm * altitude) / fm).toFixed(2);\n }", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "cfc7e5c4041b25e5c8283e2d69581aca", "score": "0.491167", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "8606fb47c9649f8dffb7683fab1c1a06", "score": "0.49080756", "text": "function whiteboardHeight( indices ) \n { \n if (!indices) indices = slideIndices;\n\n // minimum height: one Reveal page\n var height = 1;\n\n // find maximum y-coordinate of slide's curves\n if (hasSlideData(indices, 1))\n {\n var slideData = getSlideData(indices, 1);\n for (var i=0; i<slideData.events.length; i++)\n {\n var event = slideData.events[i];\n if (event.type == \"draw\")\n {\n for (var j=1; j<event.coords.length; j+=2)\n {\n var y = event.coords[j];\n if (y > height) height = y;\n }\n }\n }\n }\n \n height = Math.round(height);\n if (DEBUG) console.log(\"slide height: \" + height);\n\n return height;\n }", "title": "" }, { "docid": "f038681c4a4fe81a42dc2daa2c2e5aab", "score": "0.49065605", "text": "set height(value) {}", "title": "" }, { "docid": "710bf73d3ca6a056cecb249d3388028b", "score": "0.49051827", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev$$1 = pos + \"-\" + id;\n if (isLeaf) {\n height[rev$$1] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev$$1});\n }\n return rev$$1;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "710bf73d3ca6a056cecb249d3388028b", "score": "0.49051827", "text": "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev$$1 = pos + \"-\" + id;\n if (isLeaf) {\n height[rev$$1] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev$$1});\n }\n return rev$$1;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "title": "" }, { "docid": "2b1d8af06e327f1b85dde3742d4390f3", "score": "0.49017134", "text": "function findmaxheight(ignorets)\n {\n ignorets = (ignorets ? ignorets : -1);\n \n // Sanity counter\n var counter = 0;\n \n // Get a list of the $li elements\n var $dv = elm.find('.pic-div');\n \n // Reset max height and width\n elm.maxheight = elm.minmaxheight; \n \n // Reset counts\n elm.maxheightcnt = 0;\n \n // Iterate to find maxes\n $dv.each(function(i) {\n \n //if(this.pinfo == undefined) {\n //console.log('pinfo is undefined?');\n //}\n \n // Ignore the picture that's being removed\n if(this.pinfo.timestamp != ignorets) {\n \n // Height\n if(this.pinfo.height > elm.maxheight) { \n elm.maxheight = this.pinfo.height; \n elm.maxheightcnt = 1; \n }\n else if(this.pinfo.height == elm.maxheight) { \n elm.maxheightcnt++;\n }\n }\n \n // Increment counter\n counter++;\n });\n \n // 'Assert'\n //if(elm.numpics > 0 && counter != elm.numpics) {\n //console.log('Error: numpics mismatch!');\n //}\n }", "title": "" }, { "docid": "1a46f748bb86cab8c8d4a6d44e226bd5", "score": "0.4898067", "text": "function makePercentage(packhouses){\n for (var z = 0; z < packhouses.length; z++) {\n var currTally = packhouses[z];\n sum = 0;\n\n for (var y = 0; y < currTally.length; y++) {\n sum = currTally[y] + sum;\n }\n\n for (var x = 0; x < currTally.length; x++) {\n currTally[x] = (currTally[x] / sum) * 100 ;\n }\n }\n }", "title": "" }, { "docid": "45ec9f9140e1b223572ce55601021034", "score": "0.48932192", "text": "function calculateHeight (feet, inches) {\n return parseInt(feet) * 12 + parseInt(inches)\n}", "title": "" }, { "docid": "ab425b163843d8f3c0f706bda21c7daf", "score": "0.48842186", "text": "function exponentHeight(){\n return(totalHeight()**2);\n}", "title": "" }, { "docid": "8c09934a57fe31b3dd196e712e29d392", "score": "0.48826098", "text": "function tp_sum_width_at_height(layers, max, height) {\n\tif (null == height) return tp_sum_width(layers, max);\n\n\tvar total_width = 0;\n\tvar s;\n\tfor (var i = 0; i < layers.length; i++) {\n\t\tif (null != max && i == max) break;\n\t\ts = height / (layers[i].bounds[3].value - layers[i].bounds[1].value);\n\t\ttotal_width += s * (layers[i].bounds[2].value - layers[i].bounds[0].value);\n\t}\n\n\treturn total_width;\n}", "title": "" }, { "docid": "bab0f6de86c7843cf5329bb007f4fc16", "score": "0.48801646", "text": "function beeStung(weight) {\n \n //calculate for bee stings\n var stings=8.666666667*weight\n \n //Return number of Bee stings\n return stings;\n}", "title": "" }, { "docid": "c82b2f45ca883b0e40f99eccc294df33", "score": "0.4878842", "text": "function hourglassSum(arr) {\n var height = arr.length;\n var length = arr[0].length;\n var max\n\n for (var i = 0; i < height - 2; i++){\n for (var x = 0; x < length - 2; x++){\n if (arr[i][x] !== undefined && arr[i][x + 1] !== undefined && arr[i][x + 2] !== undefined && arr[i + 1][x + 1] !== undefined && arr[i + 2][x] !== undefined && arr[i + 2][x + 1] !== undefined && arr[i + 2][x + 2] !== undefined) {\n var sum = arr[i][x] + arr[i][x + 1] + arr[i][x + 2] + arr[i + 1][x + 1] + arr[i + 2][x] + arr[i + 2][x + 1] + arr[i + 2][x + 2]\n if (max === undefined){\n max = sum\n } else if (max < sum){\n max = sum\n }\n }\n }\n }\n return max\n}", "title": "" }, { "docid": "0a3372392f063bd4064ab8cf2a424b7d", "score": "0.48780242", "text": "function calculateResourcePlenty() {\n for (i = 0; i < positions.length; i++) {\n var sum = 0;\n for (x = 0; x < positions[i].tiles.length; x++) {\n sum += positions[i].tiles[x].dotWeight\n }\n positions[i].resourcePlentyScore = sum\n }\n}", "title": "" }, { "docid": "b80a3e3a8352b4cf4daa3d08f4bb4407", "score": "0.48750964", "text": "countSkyscrapers(array, clue) {\n let lowestBuilding = 0;\n let count = 0;\n for (let i = 0; i < this.size; i++) {\n const el = array[i];\n if (el > lowestBuilding) {\n lowestBuilding = el;\n count++;\n if (count > clue) return count;\n }\n }\n return count;\n }", "title": "" }, { "docid": "1c5c2440fb75bd4ba14f52b234a44f10", "score": "0.487333", "text": "function getQuantityElements(heightElement) {\n return document.documentElement.clientHeight / heightElement + 1;\n}", "title": "" }, { "docid": "13ce78820f6b55e8daf7af6ef75f7440", "score": "0.4869054", "text": "function getSize(width, height, depth){\n let area = (2*width*height)+(2*height*depth) + (2*width*depth);\n let volume = width* height* depth;\n return [area, volume];\n }", "title": "" }, { "docid": "d95735688ec2a67572065d471b319a7a", "score": "0.48606703", "text": "function updateWater() {\n // animate water\n for (var i = 0; i < water.length; i++) {\n water[i].update();\n water[i].draw();\n }\n\n // remove water that has gone off screen\n if (water[0] && water[0].x < -platformWidth) {\n var w = water.splice(0, 1)[0];\n w.x = water[water.length-1].x + platformWidth;\n water.push(w);\n }\n }", "title": "" }, { "docid": "9ad784231864b168806e9864269c7212", "score": "0.48606592", "text": "function ray_total_count() {\n let s = w.rays.length;;\n for(let i=0;i<w.beams.length;++i) \n s += w.beams[i].brays.length;\n return s; \n}", "title": "" }, { "docid": "ab466870a6241961450728a7862f7706", "score": "0.48587567", "text": "function maxArea(height) {\n let area = 0, start = 0, end = height.length-1;\n while(start < end) {\n let newArea = Math.min(height[start], height[end]) * (end - start);\n area = Math.max(area, newArea);\n if(height[start] < height[end]) {\n start++;\n } else {\n end--;\n }\n }\n return area;\n}", "title": "" }, { "docid": "8d463010ffbfde8c3ca651cc07b36561", "score": "0.48552966", "text": "function heightTest(){\r\n let heightTotal = 4 + ((startHeight - 1) * 2)\r\n for(let i = 199; i > (20-heightTotal) * width; i--){\r\n let r = Math.random() * 2\r\n if (r < 1){\r\n let rcolor = Math.floor(Math.random()*theTetrominoes.length)\r\n squares[i].classList.add('taken')\r\n squares[i].classList.add('tetromino')\r\n squares[i].style.backgroundColor = colors[rcolor]\r\n squares[i].innerHTML = \"<img id=\\\"img_block\\\" src=\\\"blocks/\" + img_colors[rcolor] + \".png\\\" width=\\\"20\\\" height=\\\"20\\\">\"\r\n }\r\n }\r\n }", "title": "" }, { "docid": "43130c78bf44d644cdc0f56b159a0d95", "score": "0.48527762", "text": "function length(array)\n\t{\n\t\tif (array.height == 0)\n\t\t{\n\t\t\treturn array.table.length;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn array.lengths[array.lengths.length - 1];\n\t\t}\n\t}", "title": "" }, { "docid": "715f52dc4943bc9ab64eadaa53b66eb8", "score": "0.48522347", "text": "determineHeight()\n {\n // figure the min and max\n let min = Math.max(this.icePoint.height - this.searchRange, -this.totalRange),\n max = Math.min(this.icePoint.height + this.searchRange, this.totalRange);\n // pick a random int between those\n this.height = helper.getRandomIntegerBetween(min, max);\n // Make sure it's not the same as the icePoint\n if(this.height === this.icePoint.height)\n {\n if(this.height === this.totalRange)\n {\n // all we can do is shift it down\n this.height --;\n }\n else if (this.height === -this.totalRange)\n {\n // all we can do is shift it up\n this.height++;\n }\n else\n {\n // we can shift it either way\n let shift = helper.getRandomIntegerBetween(0, 1);\n this.height += shift?1:-1;\n }\n }\n }", "title": "" }, { "docid": "6a2478cbf217d983c5ef8c718827a8bb", "score": "0.48480096", "text": "function sol(heights) {\n // maintain increasing stack\n // all bars between i and j should be greater than or equal to heights[j]\n const n = heights.length;\n const stack = [];\n stack.push(-1);\n\n let max = 0;\n for (let i = 0; i < n; i++) {\n // make sure the stack is increasing\n // last two elements will the left and right borders of the current rectangle\n while (\n stack[stack.length - 1] !== -1 &&\n heights[stack[stack.length - 1]] >= heights[i]\n ) {\n // pop left borders while >= the next right border OR heights[i]\n max = Math.max(\n max,\n heights[stack.pop()] * (i - stack[stack.length - 1] - 1)\n );\n }\n\n // push the index of the right border\n stack.push(i);\n }\n\n while (stack[stack.length - 1] !== -1) {\n // after get increasing stack\n // calculate the area for current height * width(n = end of the rectangle - last start index of increasing region)\n max = Math.max(\n max,\n heights[stack.pop()] * (n - stack[stack.length - 1] - 1)\n );\n }\n\n return max;\n}", "title": "" }, { "docid": "88da22c93ea21d17e8cbf323375365a2", "score": "0.48442927", "text": "function getHeightData() {\n if (!wpdtEditor.allHeights) {\n wpdtEditor.allHeights = typeof (wpdtEditor.getSettings().rowHeights) == 'object' ? wpdtEditor.getSettings().rowHeights : [];\n }\n }", "title": "" }, { "docid": "d4a512c939e6cb9753d31f009d158973", "score": "0.4843079", "text": "function countShips(area, type, shiftY){\r\n\tvar shipSet=ENEMIES_SHIP_SETTINGS, shipHeight;\r\n\tfor(let i=0;i<shipSet.length;i++){\r\n\t\tif (shipSet[i].type==type){\r\n\t\t\tshipHeight=shipSet[i].height;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn Math.floor((area.canvas.height-shiftY*2)/(shipHeight+shiftY));\r\n}", "title": "" }, { "docid": "6db7843d82143aebaad5db66afd65793", "score": "0.48428974", "text": "function length(array)\n{\n\tif (array.height === 0)\n\t{\n\t\treturn array.table.length;\n\t}\n\telse\n\t{\n\t\treturn array.lengths[array.lengths.length - 1];\n\t}\n}", "title": "" } ]
702cb8472c331e920509063c7a615d48
This function hide the tooltip and reset the circle boundaries (stroke)
[ { "docid": "4674047a6096b64507eede79f5022d90", "score": "0.6440668", "text": "function hide_details(data, i, element) {\n d3.select(element).attr(\"stroke\", function(d) { return d3.rgb(fill_color(d.rate)).darker();} );\n tooltip.hideTooltip();\n }", "title": "" } ]
[ { "docid": "0185f1e883ce1abc6ecb0a5044c80010", "score": "0.75368667", "text": "function hide_tooltip() {\n cctooltip.classed({\"hidden\": true});\n }", "title": "" }, { "docid": "a1073eb6bf34c7f34750eb63e0f0538a", "score": "0.7309432", "text": "function tooltipOff() {\r\n d3.event.preventDefault();\r\n tooltip.style(\"opacity\", \"0\");\r\n }", "title": "" }, { "docid": "df0e93a23f96698953d9b462912346c2", "score": "0.71480924", "text": "function hideTooltip() {\n\td3.select(\"#tooltip-title\").html(\"\");\n\td3.select(\"#tooltip-author\").html(\"\");\n\td3.select(\"#tooltip-number-of-times\").html(\"\");\n}", "title": "" }, { "docid": "7be2ec0329a9b1b1fd78a8bfbb5f5731", "score": "0.7024348", "text": "function hideTooltip() {\n\t tooltippy.style(\"display\",\"none\");\n\t}", "title": "" }, { "docid": "1151a1cd6488783297cae6968fc00b35", "score": "0.6885031", "text": "function tipMouseout(d) {\n return tooltip.style(\"visibility\", \"hidden\");\n \n}", "title": "" }, { "docid": "2817b048c2c3ea4285301304880cca4d", "score": "0.6725493", "text": "function cvjs_hideToolTip(){\n\n\ttip[cvjs_active_floorplan_div_nr].hide();\n\n}", "title": "" }, { "docid": "3d5aedb094c295f5a7c56a5cc1541ee2", "score": "0.672515", "text": "function hide() {\n if (tooltip) {\n tooltip.parentNode.removeChild(tooltip);\n tooltip = null;\n }\n }", "title": "" }, { "docid": "3d5aedb094c295f5a7c56a5cc1541ee2", "score": "0.672515", "text": "function hide() {\n if (tooltip) {\n tooltip.parentNode.removeChild(tooltip);\n tooltip = null;\n }\n }", "title": "" }, { "docid": "3d5aedb094c295f5a7c56a5cc1541ee2", "score": "0.672515", "text": "function hide() {\n if (tooltip) {\n tooltip.parentNode.removeChild(tooltip);\n tooltip = null;\n }\n }", "title": "" }, { "docid": "60e73f3ab4c31e86f01f852f939f8901", "score": "0.671957", "text": "function tooltipHide() {\n\ttooltip.hidden(true);\n}", "title": "" }, { "docid": "00fdbace3b362578c94645fce734355a", "score": "0.6705094", "text": "function removeCircleTooltip(d, i) {\n d3.selectAll(\".circle-tooltip\").remove();\n}", "title": "" }, { "docid": "065ac18719857359bd97cb8e867d8771", "score": "0.665654", "text": "function removeTooltip(d) {\n\n\t//Save the circle element (so not the voronoi which is triggering the hover event)\n\t//in a variable by using the unique class of the voronoi (CountryCode)\n\tvar element = d3.selectAll(\".countries.\"+d.CountryCode);\n\t\n\t//Hide the tooltip\n\t$('.popover').each(function() {\n\t\t$(this).remove();\n\t}); \n\t\n\t//Fade out the bright circle again\n\telement.style(\"opacity\", opacityCircles);\n\t\n}//function removeTooltip", "title": "" }, { "docid": "987d71dae1e312fdda3fffc408861ab1", "score": "0.6638817", "text": "function hideall() {\n dots.attr(\"r\", 0)\n}", "title": "" }, { "docid": "2847b8109f8902bff88f5d6db377d628", "score": "0.66197234", "text": "function turnCircleOff() {\n\t$.circle.setBackgroundColor(\"transparent\");\n\t$.circle.setBorderWidth(0.5);\n\t$.cross.setImage(\"\");\n\tmarked = false;\n}", "title": "" }, { "docid": "33fe1c7238885a3d841111d4da1e149b", "score": "0.6611364", "text": "function hideTooltip(map,marker) {\n if( marker.overlay ) {\n marker.overlay.setOptions( normalPathOptions );\n }\n if( marker.scoredoverlay ) {\n marker.scoredoverlay.setMap( null )\n }\n if( map.og_currenttooltip ) {\n map.og_currenttooltip.setMap(null);\n map.og_currenttooltip = null;\n }\n\n if( marker.paths ) {\n marker.paths.forEach( function(p) {\n p.setOptions( normalPathOptions );\n });\n }\n\n map.og_currentmarker = null;\n}", "title": "" }, { "docid": "b64ca993c4f719232788c10495b3f881", "score": "0.6601258", "text": "function hideChartTooltip() {\n if (!ctrl.entity.ui[ctrl.chartObjName].tooltip.isHidden) {\n ctrl.entity.ui[ctrl.chartObjName].tooltip.hide();\n }\n }", "title": "" }, { "docid": "b64ca993c4f719232788c10495b3f881", "score": "0.6601258", "text": "function hideChartTooltip() {\n if (!ctrl.entity.ui[ctrl.chartObjName].tooltip.isHidden) {\n ctrl.entity.ui[ctrl.chartObjName].tooltip.hide();\n }\n }", "title": "" }, { "docid": "417f7c713b2e90a2e22bb5f6432a48e5", "score": "0.6570605", "text": "function mouseout() {\n svg.selectAll(\".turnedOn\").classed(\"turnedOn\", false);\n d3v4.select(\"#tooltip\").classed(\"hidden\", true);\n svg.selectAll(\".turnedOff\").classed(\"turnedOff\", false);\n }", "title": "" }, { "docid": "28eebdd642a49949409139d0c5cfdb4d", "score": "0.6562438", "text": "hideHighlightedDataPoint() {\n this.graphContainer.select('.highlight-datum')\n .style('display', 'none');\n this.graphContainer.select('.highlight-datum-outline')\n .style('display', 'none');\n }", "title": "" }, { "docid": "436dbddebfaeb3d205a4d5b4b0c23d24", "score": "0.6506764", "text": "function noHover(d) {\n if (d && centered !== d) {\n mapTip.hide(d);\n }\n }", "title": "" }, { "docid": "3e301a9bb35d17fcd43265d24959e352", "score": "0.64635766", "text": "hide() {\n this.opts.visualize = false;\n this.geometry.isVisible = false;\n this.setAttribute(\"position\", new Float32Array([]));\n this.setAttribute(\"color\", new Float32Array([]));\n }", "title": "" }, { "docid": "bb27360a9386d53412704d90af3fcf54", "score": "0.64477766", "text": "function noHover(d) {\n if (d && centered !== d) {\n mapTip.hide(d);\n }\n }", "title": "" }, { "docid": "5de700d9bd083a2ea4d0c1e2e6827a2f", "score": "0.6432202", "text": "function onMouseOutPie(d) {\n d3.select(this)\n return tooltip.style('visibility', 'hidden'),\n d3.select(this).attr('opacity', '1')\n \n }", "title": "" }, { "docid": "81fb25f440bfa0058f33564350c5a84b", "score": "0.6425753", "text": "clearStorytelling(){\n d3.selectAll('.highlighted').classed('highlighted', false);\n d3.select(\"#tooltip\").style('visibility', 'hidden');\n\n }", "title": "" }, { "docid": "fdf576b5886b3bce3723696aa427005c", "score": "0.63753957", "text": "function hideConnections(d) {\r\n //This unhighlights the node\r\n svg.selectAll(\"circle\")\r\n .attr(\"opacity\", 1);\r\n link.style(\"stroke-opacity\", 1);\r\n\t\tlink.style(\"stroke\", \"red\");\r\n tooltip.style(\"visibility\", \"hidden\")\r\n\r\n }", "title": "" }, { "docid": "5395d1b9f21b66ace04a88867a069597", "score": "0.63487935", "text": "custom(tooltip) {\r\n if (!tooltip) return;\r\n tooltip.displayColors = false;\r\n }", "title": "" }, { "docid": "7bc42b1884b9c9f51e855f48955db04e", "score": "0.63414365", "text": "function noStroke() {\n \tisStroke = false;\n }", "title": "" }, { "docid": "85bfb1909e064f124ff5b8543655466c", "score": "0.632379", "text": "function defocusTip(){\n\t$.tip.blur();\n}", "title": "" }, { "docid": "302cafff936262e298c41144f628d58d", "score": "0.6313293", "text": "function hide()\n\t{\n\t\tif (tooltip_div != null)\n\t\t{\n\t\t\ttooltip_div.remove();\n\t\t\ttooltip_div = null;\n\t\t}\n\t}", "title": "" }, { "docid": "c344c2ecbe640f0c4fb0da6a622af178", "score": "0.63119066", "text": "hide(){\n this._tippyInstance.hide();\n }", "title": "" }, { "docid": "bdc4fa0176332aba214b86d7fb62a134", "score": "0.62937284", "text": "function _hideOuterCircle() {\r\n NODES.loadOuterCircle.style.display = 'none';\r\n NODES.percents.style.display = 'none';\r\n }", "title": "" }, { "docid": "d5d72d5dedfa99901191eec3e5206cae", "score": "0.62718105", "text": "function mouseout(d, s) {\n var color = d3.select(s).attr(\"fill\");\n d3.select(s).attr(\"stroke\", color)\n .attr(\"stroke-width\", adj_pixel_stroke)\n return tooltip.style(\"visibility\", \"hidden\");\n }", "title": "" }, { "docid": "cf9def3972e2d53ed1c8d99b7969bfaf", "score": "0.6260861", "text": "function hideToolTipOnCalendarIcons () {\n $('.calendarIconTooltip').empty();\n}", "title": "" }, { "docid": "3420eaa4097264bdb091472fbf91d996", "score": "0.6258663", "text": "function hide_task_view(data, element) {\n taskCanvas.transition().duration(1000).attr(\"transform\", \"translate(0)scale(1)\");\n taskCanvas.on(\"click\", function () { })\n taskCanvas.select(\"g\").remove();\n taskCanvas.select(\"circle\")\n .transition().duration(1000)\n .attr(\"r\", data.radius)\n .attr(\"cx\", data.x)\n .attr(\"cy\", data.y)\n .attr(\"stroke-width\", 4)\n .each(\"end\", function () {\n taskCanvas.remove();\n d3.select(element).attr(\"opacity\", 1);\n vis.call(zoom);\n })\n }", "title": "" }, { "docid": "17c31561f05b80d8b2dac2a969f14d18", "score": "0.6238984", "text": "function mouseOut(){\r\n\t\t\td3.select(\"#tooltip\")\r\n\t\t\t\t.transition()\r\n\t\t\t\t.duration(400)\r\n\t\t\t\t.style(\"opacity\", 0); \r\n\t\t}", "title": "" }, { "docid": "1efe8adab20d2837daa73f5ed98e16c4", "score": "0.62106824", "text": "function hideTooltip(){\n\t$('#tooltip').hide(\"slow\");\n\tcurrentTooltipHistory = null;\n}", "title": "" }, { "docid": "948fec7d22b6dbb539b9731ab8f48402", "score": "0.6207194", "text": "function hide_highlight(){\n var tmpHandler = d3.selectAll(\".highlight-1\")\n .style(\"display\", \"none\")\n .style(\"pointer-events\", \"none\");\n}", "title": "" }, { "docid": "801419c5753a3d74460a045161a31561", "score": "0.6192685", "text": "function hideTooltip(){\r\n warlcTooltip.style.visibility = \"hidden\";\r\n mouseoverLink = null;\r\n}", "title": "" }, { "docid": "1e1be373e5d62742c04772bb2a3424ed", "score": "0.6133222", "text": "function circlebordernothover(){\n circle.attr('stroke', circle.color)\n}", "title": "" }, { "docid": "a13a99b2708c21293b650d2cfeee7a92", "score": "0.612372", "text": "function hideAxes() {\n statusShowAxes = false;\n}", "title": "" }, { "docid": "72fbbbd0788e0d1f29bffb36c2ea37a7", "score": "0.6108256", "text": "function hideTooltipSoon() {\n // Long delay needed for iOS safari, otherwise tooltip hides\n tooltipHideTimer = setTimeout(hideTooltip, isTouchDevice ? 500 : 50);\n}", "title": "" }, { "docid": "74231e87c1383582592f49e576abca91", "score": "0.609894", "text": "_hideFeedback() {\n if (this._savedStroke) {\n this.getShape().setStroke(this._savedStroke);\n this.ReplaceConnectorColor(this.getStartConnector(), this._savedStroke);\n this.ReplaceConnectorColor(this.getEndConnector(), this._savedStroke);\n this._savedStroke = null;\n }\n\n if (this._linkUnderlay) {\n this.removeChild(this._linkUnderlay);\n if (this._linkUnderlay.destroy) {\n this._linkUnderlay.destroy();\n }\n this._linkUnderlay = null;\n }\n }", "title": "" }, { "docid": "73e796cd979d74e093702570c6b7c458", "score": "0.60887456", "text": "function mouseout() {\n svg.selectAll(\".active\").classed(\"active\", false);\n svg.selectAll(\".hidden\").classed(\"hidden\", false);\n info.text(defaultInfo);\n }", "title": "" }, { "docid": "7c9687fee291f5ecdf6043d55b6c0df7", "score": "0.6066383", "text": "function clear_plot() {\n var elements = document.getElementsByClassName('d3-tip');\n while(elements.length > 0){\n elements[0].parentNode.removeChild(elements[0]);\n }\n document.getElementById(target).innerHTML = \"\";\n }", "title": "" }, { "docid": "7eb75b06a0ed04780ab32f970cdba2a4", "score": "0.60642666", "text": "function cleanTooltip() {\r\n if (!$el.find('.av-popover-help').length) return;\r\n $el.find('.av-popover-help').removeClass('ready active');\r\n $timeout(function () {\r\n $el.find('.av-popover-help').remove();\r\n }, 250);\r\n }", "title": "" }, { "docid": "8b12e7f7e0614e1e3bf7b0012c93a272", "score": "0.60610336", "text": "function hideHint() {\n\t\t\t$(\"#viewshedangles_toggle_checkbox_hint_container\").css({left: \"-99999px\", right: \"auto\"});\n\t\t\tif(!is_viewshed_angles_layer_displayed) {\n\t\t\t\t$(\"#viewshedangles_checkbox_unchecked\").css({opacity: 1});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "61a1500a2e69f4ce20f7636d36a07d32", "score": "0.60517395", "text": "onHideTooltipContainer() {\n this.tooltipContainer.style.zIndex = 0;\n }", "title": "" }, { "docid": "4f9b65ff58782b3e07a554db5c8b9b36", "score": "0.6050543", "text": "function hide(){\n canvas.selectAll(\"text.panelText\")\n .style(\"fill-opacity\", 0);\n }", "title": "" }, { "docid": "6e167bb7238c09fa77c4a2f54631013c", "score": "0.60495615", "text": "function removeNodeTooltip(d) {\n tooltip.transition().delay(100)\n .style('display', 'none');\n }", "title": "" }, { "docid": "b607448d288d33191445098399865078", "score": "0.6042553", "text": "function syncChartMouseOut() {\n\t\t\t\t\tChartElementService.hideFocusAndTooltip(mouseMoveElement, tooltip);\n\t\t\t\t}", "title": "" }, { "docid": "d063a8e2a597baed622a0b408c35f777", "score": "0.60335207", "text": "function clearTooltip(){\n if (tooltip.getContent()){\n tooltip.getContent().remove();\n }\n if (hoverTimeout){\n //Prevent 'sticky' hovers\n clearTimeout(hoverTimeout);\n }\n }", "title": "" }, { "docid": "de1dcf382d224fc40f4b55550f2859d9", "score": "0.60141397", "text": "function OCG_remove_corsshair()\n{\n\tOCG_config.plot.plot.clearCrosshair();\n}", "title": "" }, { "docid": "773b5c25661958c10810be1e4207dc63", "score": "0.60083836", "text": "function tooltipOnOff(tooltip, hidden) {\n\n // Find mouse position and unhide general tooltip\n d3.select(\"#tooltip\").classed(\"hidden\", hidden);\n\n // Define tooltip position\n if(d3.event.pageY > window.innerHeight-350){\n d3.select(\"#tooltip\")\n .style(\"top\", (d3.event.pageY) - 200 + \"px\")\n .style(\"left\", (d3.event.pageX) + 20 + \"px\")\n\n }\n else if(d3.event.pageX > window.innerWidth-350){\n d3.select(\"#tooltip\")\n .style(\"top\", (d3.event.pageY) + 20 + \"px\")\n .style(\"left\", (d3.event.pageX) - 350 + \"px\")\n }\n else{\n d3.select(\"#tooltip\")\n .style(\"top\", (d3.event.pageY) + 40 + \"px\")\n .style(\"left\", (d3.event.pageX) + 20 + \"px\")\n }\n\n // Unhide specific tooltip\n d3.select(tooltip).classed(\"hidden\", hidden);\n}", "title": "" }, { "docid": "c405b8144d83448e98ac973a8a67e64a", "score": "0.59984696", "text": "function hideHint() {\n\t\t\t$(\"#landmarks_toggle_checkbox_hint_container\").css({left: \"-99999px\", right: \"auto\"});\n\t\t\tif(!is_landmarks_layer_displayed) {\n\t\t\t\t$(\"#landmarks_checkbox_unchecked\").css({opacity:1});\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "29682a3dd887e77c33d9528e9e74c10a", "score": "0.5988863", "text": "function hidetooltip(){\n\t$(\".tooltiptext\").hide();\n\t$(\".tooltipload\").hide();\n}", "title": "" }, { "docid": "d673dd3ae69e458355a2a12808fc67e0", "score": "0.59863675", "text": "function circleborderhover(){\n circle.attr('stroke', 'black')\n}", "title": "" }, { "docid": "d89dc4ef50bc898f403b1df3217d7f05", "score": "0.59836876", "text": "turnEdgeTooltipOff() {\n this.setState({\n showEdgeTooltip: false,\n selectedEdge: null,\n originEdgeRef: null\n });\n }", "title": "" }, { "docid": "ae2cda7197cc9c23979ac7bbb7a322f3", "score": "0.59797394", "text": "function hideHint() {\n\t\t\t$(\"#station_point_mode_button_hint_container\").css({left: \"-99999px\", right: \"auto\"});\n\t\t\t$(\"#Mode_Button_One_Hover\").css({display: \"none\"});\t\n\t\t}", "title": "" }, { "docid": "43265d447fef122c25e1513973281f4b", "score": "0.59680116", "text": "function mouseoutHandler (d) {\n tooltip.transition().style('opacity', 0);\n }", "title": "" }, { "docid": "4be08543e44cea8a022055c6b231eb03", "score": "0.59587", "text": "turnNodeTooltipOff() {\n this.setState({\n showNodeTooltip: false,\n selectedNode: null\n });\n }", "title": "" }, { "docid": "8e2f655f9eda1d545ff0d91e0653bf04", "score": "0.5942471", "text": "function showCircle() {\n showAxis(xbeeAxisBar);\n \n g.selectAll('.fill-square')\n .transition()\n .duration(1000)\n .attr('opacity', 0);\n \n g.selectAll('circle')\n .transition()\n .duration(1000)\n .attr('opacity', 1);\n \n g.selectAll('.total-rating-treatment')\n .transition()\n .duration(1000)\n .attr('opacity', 0);\n\n g.selectAll('.total-rating-control')\n .transition()\n .duration(1000)\n .attr('opacity', 0);\n \n g.selectAll('.teachers-status')\n .transition()\n .duration(1000)\n .attr('opacity', 0);\n\n\n }", "title": "" }, { "docid": "7f91ab475dbb36c5e87409567ca03a56", "score": "0.5928851", "text": "function circleMouseOut() {\n\t\t$(popoverTarget[0][0]).popover('destroy');\n\t}", "title": "" }, { "docid": "918ae3480dc5c5edaef58b037ae06833", "score": "0.5927744", "text": "hide() {\n this.geometry.hide();\n }", "title": "" }, { "docid": "f4d32b28c7226dd005eee441715fa184", "score": "0.5924331", "text": "function info_hidePanelDatatip() {\n info_datatip.attr(\"class\", \"popup-panel-tooltip n hidden\");\n}", "title": "" }, { "docid": "f9bf0952f84f21957db04b8b7baecd7a", "score": "0.59101266", "text": "function leavePolygon(e) {\n var layer = e.target;\n ui.$tooltip.css('display', 'none');\n layer.setStyle({\n 'color': '#fff',\n 'weight': 1,\n 'opacity': .55,\n });\n }", "title": "" }, { "docid": "4cec9c019b0a66d6799c2ca94b593bb8", "score": "0.5904692", "text": "function mouseOutStain(currentStain){\n\n //Hide the tooltip\n d3.select(\"#hoverTooltip\")\n .style(\"visibility\", \"hidden\");\n\n //Revert the stroke-width\n d3.select(currentStain)\n .transition()\n .duration(eventDuration-50)\n .style(\"stroke-width\",\"0\")\n}", "title": "" }, { "docid": "3ee5b357a17ad2d6dbe09a79ec8082ff", "score": "0.5902134", "text": "function hideRect()\n{\n $(\"#shadow\").attr('x', 0).attr('y', 0).hide();\n $(\"#yCheck\").text(\"???\");\n $(\"#mCheck\").text(\"???\");\n}", "title": "" }, { "docid": "8e3fe2e503950032e5759691b1670c1e", "score": "0.58972496", "text": "function OCG_remove_tooltip()\n{\n\tjQuery(\"#tooltip\").remove();\n}", "title": "" }, { "docid": "50da1c3bb52d123c2088f7b9e17e8a81", "score": "0.5894963", "text": "function cleanContent(){\n tooltipBody.selectAll('text').remove();\n tooltipBody.selectAll('circle').remove();\n }", "title": "" }, { "docid": "bd9acb3f31b8093a8be4f8e683971e8e", "score": "0.58839554", "text": "function DontReveal(){\r\n document.getElementById(\"person_tip\").style.display = 'none';\r\n document.getElementById(\"total_tip\").style.display = 'none';\r\n }", "title": "" }, { "docid": "ac66ee73df5b728ec40ee083a4d16e82", "score": "0.5882815", "text": "hideHoverEffect() {\n this.getSelectionShape().hideHoverEffect();\n }", "title": "" }, { "docid": "ac66ee73df5b728ec40ee083a4d16e82", "score": "0.5882815", "text": "hideHoverEffect() {\n this.getSelectionShape().hideHoverEffect();\n }", "title": "" }, { "docid": "d0906d85f847b04545eceaaec10cfadd", "score": "0.5875477", "text": "function toolTip(selection) {\n svg.append('text')\n .attr('class', 'toolCircle')\n .attr('dy', -25) // hard-coded. can adjust this to adjust text vertical alignment in tooltip\n .html(toolTipHTML(state_map, 0)) // add text to the circle.\n .style('font-size', '12px')\n .style('text-anchor', 'middle');\n\n // add tooltip (svg circle element) when mouse enters label or slice\n selection.on('mouseenter', function (data) {\n d3.selectAll('.toolCircle').remove();\n svg.append('text')\n .attr('class', 'toolCircle')\n .attr('dy', -25) // hard-coded. can adjust this to adjust text vertical alignment in tooltip\n .html(toolTipHTML(data.data, 1)) // add text to the circle.\n .style('font-size', '12px')\n .style('text-anchor', 'middle'); // centres text in tooltip\n\n svg.append('circle')\n .attr('class', 'toolCircle')\n .attr('r', radius * 0.55) // radius of tooltip circle\n .style('fill', function() {\n var county = getFips(data);\n var val = document.getElementById(\"myRange\").value;\n if (move_dict.get(county))\n return quantize(move_dict.get(county)[val-1]);\n else\n return \"#979797\"; })\n // colour based on category mouse is over\n // .attr('fill', '#979797')\n .style('fill-opacity', 0.35);\n\n var fips_q = getFips(data);\n highlight_single(fips_q);\n });\n\n // remove the tooltip when mouse leaves the slice/label\n selection.on('mouseout', function () {\n unhighlight();\n d3.selectAll('.toolCircle').remove();\n svg.append('text')\n .attr('class', 'toolCircle')\n .attr('dy', -25) // hard-coded. can adjust this to adjust text vertical alignment in tooltip\n .html(toolTipHTML(state_map)) // add text to the circle.\n .style('font-size', '12px')\n .style('text-anchor', 'middle');\n });\n\n selection.on('click', function(data) {\n console.log(\"mouse click\");\n console.log(state);\n var fips_q = getFips(data);\n if (cases_dict.get(fips_q)) {\n $( \"#alertdiv\" ).hide();\n $( \"#barchartdiv\" ).show();\n displayBar(fips_q);\n }\n else {\n $( \"#barchartdiv\" ).hide( \"slow\" );\n // Capitalize each word of the county\n const upper = toTitleCase(county_dict.get(county))\n $( \"#alertdiv\" ).show();\n $( \"#alertdiv\" ).html(\"No case data for \" + upper);\n }\n })\n }", "title": "" }, { "docid": "2fdea4f75c8918bd946d688155f305fd", "score": "0.5869506", "text": "function hideTooltips() {\n setTimeout(function () {\n // tippy.hideAll();\n [...document.querySelectorAll('*')].forEach(node => {\n if (node._tippy) {\n node._tippy.disable();\n }\n });\n }, 15000);\n}", "title": "" }, { "docid": "a7664550aba8ff6972904a3e5c2bfe55", "score": "0.5861921", "text": "function undisplay (d) {\n d3.select(this)\n .attr(\"r\", 2)\n .style(\"stroke-width\", \"0\")\n annotationGroup.selectAll(\"text\").remove();\n }", "title": "" }, { "docid": "c8ef7db8f22093caf67463e32e1b2b14", "score": "0.5848712", "text": "onHideToolTip () {\n this.setState({showTooltip: false});\n }", "title": "" }, { "docid": "f1dd44a1d7dceff97b48cd8a613bf02c", "score": "0.58335376", "text": "function donutCleanup()\n{\n d3.select(\".tooltip\").style(\"visibility\", \"hidden\");\n d3.select(\"#donut-svg\").remove();\n removeCorpusButton();\n}", "title": "" }, { "docid": "538138a751d2f94de1e7ce6c6a80fba6", "score": "0.58292437", "text": "function remove_stars_info_from_canvas() {\n hide_type_from_canvas('star_info');\n}", "title": "" }, { "docid": "d5495f653036d8c6620131d263a8d7ee", "score": "0.5818881", "text": "static disableBlackAndWhite() {\n $('#black-and-white-checkbox-container').tooltip('destroy');\n }", "title": "" }, { "docid": "18f5e200eaed90d27109cd54941c477b", "score": "0.58168745", "text": "function hideLL() {\n\t\n\tdevTable.fnFilter(\" \");\n\n\t//hide the coordinates\n\t$(\"#coords\").hide(200);\n\t\n\t//clear clicks\n\t$(\"#snode\").removeClass(\"hovered\");\n\t$(\"#mnode\").removeClass(\"hovered\");\n\t$(\"#mterminal\").removeClass(\"hovered\");\n}", "title": "" }, { "docid": "468a7e9e7c5f0ef4ba1153e4e4165832", "score": "0.5816158", "text": "function hideMini() {\n reveal(\n 'clicktip', 10, 10,\n 0, clicktip.ctwidth +10, clicktip.ctheight + 10, 0,\n 60, 80, 120, 20, afterhide\n );\n}", "title": "" }, { "docid": "bef53663dc38fbcb34856dc9c8994f87", "score": "0.5810724", "text": "function removeToolTip() {\n // Remove Details\n $(\".tooltip-container\").removeClass(\"tooltip-container\");\n $(\".tooltip-text\").remove();\n}", "title": "" }, { "docid": "e491adf5040f998dad5c75a99b3b7873", "score": "0.5810579", "text": "function clrMarker(){\n \n if(point[count]){\n map.removeLayer(point[count]);\n }\n \n count = 1;\n}", "title": "" }, { "docid": "bd9743972acdb67dcc6b47088f1c1276", "score": "0.58100724", "text": "function UnTip()\n{\n\tvar fn = \"[tooltip.js UnTip()] \";\n\tjsu_log ( fn + JSU_LOG_FUN_START);\n jsu_log(fn + \"CURRENT tip_type=\" + tip_type);\n if (tip_type == TIP_TYPE.Fixed){\n \treturn jsu_log ( fn + \"Nothing to do: a TipFix is still displayed\" + JSU_LOG_FUN_END);\n }\n\ttt_init(); // init, if not already done\n\ttt_SetCfg(TIP_CFG_FLOATING);\n\ttt_OpReHref();\n\tif(tt_aV[DURATION] < 0 && (tt_iState & 0x2))\n\t\ttt_tDurt.Timer(\"tt_HideInit()\", -tt_aV[DURATION], true);\n\telse if(!(tt_aV[STICKY] && (tt_iState & 0x2)))\n\t\ttt_HideInit();\n\ttt_RestoreImgFixed(); // Restore previous Image Fixed if required\n\ttip_type = TIP_TYPE.NONE;\n\tjsu_log ( fn + JSU_LOG_FUN_END);\n}", "title": "" }, { "docid": "6886ef20ac7f471b3d76e2b1ec495b09", "score": "0.5805442", "text": "function showDensity(){\n drawLegend(color,den)\n svg.append('g').selectAll('path')\n .data(districts)\n .enter()\n .append('path')\n .attr('d',path)\n .style('fill',function(d){return color(d.properties.density)})\n .style('stroke', 'black')\n .on(\"mouseover\",function(d){//add tooltip when mouse in dot area\n tooltip.transition()//fade on\n .duration(\"200\")\n .style(\"opacity\",1);\n tooltip.html(//create tooltip table for data (five rows with two collumns)\n '<table width=\"100%\" height=\"100%\"><tr><th colspan=\"2\" style=\"text-right:center\">'+d.properties.NAME_1+'</th></tr>'\n +'<tr><td style=\"text-align:left\">'+ 'Population:'+'</td>'+\n '<td style=\"text-align:right\">'+d.properties.population+'</td></tr>'\n +'<tr><td style=\"text-align:left\">'+ 'Area:'+'</td>'+\n '<td style=\"text-align:right\">'+d.properties.area+' Km<sup>2</sup>'+'</td></tr>'\n +'<tr><td style=\"text-align:left\">'+ 'denisity:'+'</td>'+\n '<td style=\"text-align:right\">'+d.properties.density+'</td></tr></table>'\n )\n .style(\"left\",(d3.event.pageX)+\"px\")//set position to mouse x when entering the circle\n .style(\"top\",(d3.event.pageY-28)+\"px\");})//set position to mouse y when entering the circle\n .on(\"mouseout\",function(){//take away info when mouse not on a circle\n tooltip.transition()\n .duration(500)\n .style(\"opacity\",0);\n })\n}", "title": "" }, { "docid": "610a746f59cd1df22092d719b4977b72", "score": "0.58017707", "text": "function onMouseOut(d,i) {\n scheduleAnnimation();\n d3.selectAll(\".vz-halo-label\").remove();\n }", "title": "" }, { "docid": "44af59e728daaaa54b24deb1dbc55c36", "score": "0.5799752", "text": "function close_descriptions() {\n d3.selectAll(\"div.d3plus_tooltip_data_desc\").style(\"height\",\"0px\");\n d3.selectAll(\"div.d3plus_tooltip_data_help\").style(\"background-color\",\"#ccc\");\n}", "title": "" }, { "docid": "cf1818781afaa6f6500ade8752185df7", "score": "0.5798428", "text": "function unhighlightPoints() {\n\td3.selectAll(\".point\")\n\t\t.transition() \n .duration(200)\n\t\t.attr(\"opacity\", 0.0);\n\n}", "title": "" }, { "docid": "08b15e2f52cd92c35b1ed913f8a46796", "score": "0.57954353", "text": "function showToolTip(d,i){\n tooltip.classed('showthetooltip', true)\n }", "title": "" }, { "docid": "3c116b72a86ec7383da5455ae69856ac", "score": "0.5793186", "text": "function hideStatInfo()\n\t\t\t{\n var statinfo = this.children[0].id;\n var bar = this.children[1].children[1].id;\n\t\t\t\tdocument.getElementById(statinfo).style.top = '0px'\n\t\t\t\tdocument.getElementById(bar).className = \"gradient-bar\";\n\t\t\t\tsetupStat();\n\t\t\t}", "title": "" }, { "docid": "7431c24d09d159157edde35892248837", "score": "0.57926226", "text": "function tooltipMouseout() {\n tooltip.transition()\n .duration(100)\n .style(\"opacity\", 0);\n}", "title": "" }, { "docid": "2f5ad23ddb2577669b38a801f6402abd", "score": "0.57872534", "text": "dispose() {\n const { tooltip: e, container: n, offsetParent: s, options: o } = this, i = () => Cr(this, () => super.dispose());\n o.animation && e && St(e, n === s ? n : s) ? (this.options.delay = 0, this.onHideComplete = i, this.hide()) : i();\n }", "title": "" }, { "docid": "413f833ee5872752f5e6eb71ce9b46bf", "score": "0.5782343", "text": "function handleMouseOut(event, i) {\n //Cambiamos el color y el tamaño del punto a los originales \n d3.select(this)\n .attr(\"fill\",\"#69b3a2\")\n .attr(\"r\",radius);\n //Ocultamos el tooltip\n div.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\t\n }", "title": "" }, { "docid": "1a293d0ef09dfe9f9cd26a666be06835", "score": "0.57645947", "text": "function UnTipFix(){\n\tvar fn = \"[tooltip.js UnTipFix()] \";\n\t\n\tjsu_log ( fn + JSU_LOG_FUN_START);\n jsu_log(fn + \"CURRENT tip_type=\" + tip_type);\n\ttt_SetCfg(TIP_CFG_FLOATING);\n\ttt_OpReHref();\n\tif(tt_aV[DURATION] < 0 && (tt_iState & 0x2))\n\t\ttt_tDurt.Timer(\"tt_HideInit()\", -tt_aV[DURATION], true);\n\telse if(!(tt_aV[STICKY] && (tt_iState & 0x2)))\n\t\ttt_HideInit();\n\ttt_RestoreImgFixed(); // Restore previous Image Fixed if required\n\ttip_type = TIP_TYPE.NONE;\n\tif (tt_tipFix.tipImg != undefined){\n\t\ttt_tipFix.tipImg.bTipFixOpen = false; \n\t}\n\n\tjsu_log ( fn + JSU_LOG_FUN_END);\n\n}", "title": "" }, { "docid": "4fc2c44648cf4a24347be93aa1790c22", "score": "0.57615995", "text": "function hideAxis() {\n g.select('.x.axis')\n .transition().duration(500)\n .style('opacity', 0);\n }", "title": "" }, { "docid": "938b913b60d45843f43c74e6659bf92e", "score": "0.5759241", "text": "function mouseout(d){\n d3.select(this).style(\"cursor\",\"default\");\n tooltip.style(\"opacity\",0);\n //Undoing highlighting\n d3.select(this)\n .style(\"stroke-opacity\",0)\n .lower();\n}", "title": "" }, { "docid": "21fa120a1e48c17d6485aeb795ffd591", "score": "0.57560796", "text": "function hideTip() {\r\n $(this).parent().children().last().hide();\r\n }", "title": "" }, { "docid": "0ca167083dbf18b0b03da8a88414e491", "score": "0.5754746", "text": "_mouseoutHandler() {\n for (let param of ['_focusLine', '_focus', '_pointG', '_mouseHeightFocus', '_mouseHeightFocusLabel'])\n if (this[param]) {\n this[param].style('display', 'none');\n }\n }", "title": "" }, { "docid": "67e0795fdf34ecd7a3bf9e271e0a0083", "score": "0.57525325", "text": "function _hideTip()\n{\n\tif(!m_bShowingToolTip)\n\t\treturn true;\n\n\tif(!m_bMouseOnTip)\n\t\tif(window.event!=null)\t\n\t\t{\n\t\t if (m_elementShowingTip.contains(window.event.toElement)) \n\t\t \treturn true;\n\t\t\n\t\t if (window.event.toElement == m_oDivToolTip) \n\t\t \treturn true;\n\t\t}\n\t\t\n\tm_bShowingToolTip=false;\n\tm_elementShowingTip=null;\t\t\n\tm_oDivToolTip.style.display = \"none\";\n\t\n if(hTimeout!=null)\n {\n \tclearTimeout(hTimeout);\n \thTimeout=null;\n }\t\n}", "title": "" }, { "docid": "a0276260b378770644bfe1cf9bbc3d88", "score": "0.5751649", "text": "function hide_details(data, i, element) {\n d3.select(element).select(\"circle\").attr(\"stroke\", function (d) {\n return group[d.group].color.brush;\n });\n $scope.info = null;\n $scope.$apply();\n }", "title": "" } ]
ee0a75d352fd2fc2c95b864eda26d4a9
================================================================================= Language and Stemming =================================================================================
[ { "docid": "b1f0ff90c6019961f2f33718225ec186", "score": "0.0", "text": "function isStopWord(word) {\n\tvar stopWordsSet = isStopWord._stopWordsSet;\n\tif(stopWordsSet==undefined) {\n\t\tvar stopWordsArray = [\n\t\t\t\"a\",\n\t\t\t\"the\",\n\t\t\t\"by\",\n\t\t\t\"am\",\n\t\t\t\"an\",\n\t\t\t\"in\",\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"is\",\n\t\t\t\"was\",\n\t\t\t\"been\",\n\t\t\t\"were\"\n\t\t];\n\t\tvar stopWordsSet = {};\n\t\tvar numStopWords = stopWordsArray.length;\n\t\tfor(var i=0; i<numStopWords; i++) {\n\t\t\tstopWordsSet[stopWordsArray[i]] = true;\n\t\t}\n\t\tisStopWord._stopWordsSet = stopWordsSet;\n\t}\n\treturn (stopWordsSet[word]!=undefined); // if it's undefined, then it's not a stop word.\n}", "title": "" } ]
[ { "docid": "00369438e1ea703c750963e32251f063", "score": "0.6231878", "text": "function Word(langA, langB) { this.langA = langA; this.langB = langB }", "title": "" }, { "docid": "a2b50c7b3ab13967f442a1099ee8dba9", "score": "0.6001307", "text": "function set_sentence_language(language_of_sentence) {\n console.log('language set to ' + language_of_sentence);\n sentence.language_of_sentence = language_of_sentence;\n}", "title": "" }, { "docid": "27665e07291a06860bfc5adc4aef7960", "score": "0.59766984", "text": "createPhrases()\n {\n return [ new Phrase(\"This is a game\"), new Phrase(\"TeamTreeHouse JS exam\"), new Phrase(\"We will make it\"), new Phrase(\"This is a test app\"), new Phrase(\"Game show app\")]\n }", "title": "" }, { "docid": "a5803b5a1be03c3af58678bfb647f767", "score": "0.5968024", "text": "function WordParser () {}", "title": "" }, { "docid": "33d38796dd3cbf59b044cded68fe9467", "score": "0.59193724", "text": "function sml(hljs) {\n return {\n name: 'SML (Standard ML)',\n aliases: [ 'ml' ],\n keywords: {\n $pattern: '[a-z_]\\\\w*!?',\n keyword:\n /* according to Definition of Standard ML 97 */\n 'abstype and andalso as case datatype do else end eqtype ' +\n 'exception fn fun functor handle if in include infix infixr ' +\n 'let local nonfix of op open orelse raise rec sharing sig ' +\n 'signature struct structure then type val with withtype where while',\n built_in:\n /* built-in types according to basis library */\n 'array bool char exn int list option order real ref string substring vector unit word',\n literal:\n 'true false NONE SOME LESS EQUAL GREATER nil'\n },\n illegal: /\\/\\/|>>/,\n contains: [\n {\n className: 'literal',\n begin: /\\[(\\|\\|)?\\]|\\(\\)/,\n relevance: 0\n },\n hljs.COMMENT(\n '\\\\(\\\\*',\n '\\\\*\\\\)',\n {\n contains: [ 'self' ]\n }\n ),\n { /* type variable */\n className: 'symbol',\n begin: '\\'[A-Za-z_](?!\\')[\\\\w\\']*'\n /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */\n },\n { /* polymorphic variant */\n className: 'type',\n begin: '`[A-Z][\\\\w\\']*'\n },\n { /* module or constructor */\n className: 'type',\n begin: '\\\\b[A-Z][\\\\w\\']*',\n relevance: 0\n },\n { /* don't color identifiers, but safely catch all identifiers with ' */\n begin: '[a-z_]\\\\w*\\'[\\\\w\\']*'\n },\n hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'string',\n relevance: 0\n }),\n hljs.inherit(hljs.QUOTE_STRING_MODE, {\n illegal: null\n }),\n {\n className: 'number',\n begin:\n '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',\n relevance: 0\n },\n {\n begin: /[-=]>/ // relevance booster\n }\n ]\n };\n}", "title": "" }, { "docid": "33d38796dd3cbf59b044cded68fe9467", "score": "0.59193724", "text": "function sml(hljs) {\n return {\n name: 'SML (Standard ML)',\n aliases: [ 'ml' ],\n keywords: {\n $pattern: '[a-z_]\\\\w*!?',\n keyword:\n /* according to Definition of Standard ML 97 */\n 'abstype and andalso as case datatype do else end eqtype ' +\n 'exception fn fun functor handle if in include infix infixr ' +\n 'let local nonfix of op open orelse raise rec sharing sig ' +\n 'signature struct structure then type val with withtype where while',\n built_in:\n /* built-in types according to basis library */\n 'array bool char exn int list option order real ref string substring vector unit word',\n literal:\n 'true false NONE SOME LESS EQUAL GREATER nil'\n },\n illegal: /\\/\\/|>>/,\n contains: [\n {\n className: 'literal',\n begin: /\\[(\\|\\|)?\\]|\\(\\)/,\n relevance: 0\n },\n hljs.COMMENT(\n '\\\\(\\\\*',\n '\\\\*\\\\)',\n {\n contains: [ 'self' ]\n }\n ),\n { /* type variable */\n className: 'symbol',\n begin: '\\'[A-Za-z_](?!\\')[\\\\w\\']*'\n /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */\n },\n { /* polymorphic variant */\n className: 'type',\n begin: '`[A-Z][\\\\w\\']*'\n },\n { /* module or constructor */\n className: 'type',\n begin: '\\\\b[A-Z][\\\\w\\']*',\n relevance: 0\n },\n { /* don't color identifiers, but safely catch all identifiers with ' */\n begin: '[a-z_]\\\\w*\\'[\\\\w\\']*'\n },\n hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'string',\n relevance: 0\n }),\n hljs.inherit(hljs.QUOTE_STRING_MODE, {\n illegal: null\n }),\n {\n className: 'number',\n begin:\n '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',\n relevance: 0\n },\n {\n begin: /[-=]>/ // relevance booster\n }\n ]\n };\n}", "title": "" }, { "docid": "33d38796dd3cbf59b044cded68fe9467", "score": "0.59193724", "text": "function sml(hljs) {\n return {\n name: 'SML (Standard ML)',\n aliases: [ 'ml' ],\n keywords: {\n $pattern: '[a-z_]\\\\w*!?',\n keyword:\n /* according to Definition of Standard ML 97 */\n 'abstype and andalso as case datatype do else end eqtype ' +\n 'exception fn fun functor handle if in include infix infixr ' +\n 'let local nonfix of op open orelse raise rec sharing sig ' +\n 'signature struct structure then type val with withtype where while',\n built_in:\n /* built-in types according to basis library */\n 'array bool char exn int list option order real ref string substring vector unit word',\n literal:\n 'true false NONE SOME LESS EQUAL GREATER nil'\n },\n illegal: /\\/\\/|>>/,\n contains: [\n {\n className: 'literal',\n begin: /\\[(\\|\\|)?\\]|\\(\\)/,\n relevance: 0\n },\n hljs.COMMENT(\n '\\\\(\\\\*',\n '\\\\*\\\\)',\n {\n contains: [ 'self' ]\n }\n ),\n { /* type variable */\n className: 'symbol',\n begin: '\\'[A-Za-z_](?!\\')[\\\\w\\']*'\n /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */\n },\n { /* polymorphic variant */\n className: 'type',\n begin: '`[A-Z][\\\\w\\']*'\n },\n { /* module or constructor */\n className: 'type',\n begin: '\\\\b[A-Z][\\\\w\\']*',\n relevance: 0\n },\n { /* don't color identifiers, but safely catch all identifiers with ' */\n begin: '[a-z_]\\\\w*\\'[\\\\w\\']*'\n },\n hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'string',\n relevance: 0\n }),\n hljs.inherit(hljs.QUOTE_STRING_MODE, {\n illegal: null\n }),\n {\n className: 'number',\n begin:\n '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',\n relevance: 0\n },\n {\n begin: /[-=]>/ // relevance booster\n }\n ]\n };\n}", "title": "" }, { "docid": "ac73b8ad286728df92c0402aa89f21b9", "score": "0.5897236", "text": "constructor() { super(\"es\", words, accents, checksum); }", "title": "" }, { "docid": "edac8cbaf6081c16fb6db4f05474debc", "score": "0.5889931", "text": "function transformText(dir) {\n let result = [];\n fs.readdirSync(dir).forEach(file => { \n if(file == TEXTFILE){\n let filename = (dir + \"/\" + file);\n console.log(\"Processing file: \" + filename);\n\n let data = fs.readFileSync(filename, 'utf8');\n natural.LancasterStemmer.attach();\n result = data.tokenizeAndStem();\n\t //result = Array.from(new Set(tokens)); //unique items\n }\n });\n return result;\n}", "title": "" }, { "docid": "8a12f06012843f50ced151c7c2feb4cd", "score": "0.5869078", "text": "function helloworld (language) { \n if (language==\"german\") {\n return \"Hallo Welt\"\n }\n else if (language==\"spanish\") { \n return \"Hola Mundo\"\n }\n else {\n return \"Hello World\"\n }\n}", "title": "" }, { "docid": "80bc1adc122460e08abed9af9672555a", "score": "0.58311576", "text": "function tokeniseHtmlText(lang) {\n var html_editor = document.getElementById('html_editor');\n //console.log(html_editor);\n var html = html_editor.innerHTML;\n\n var xmllang = lang;\n if ( lang == \"en\" ) {\n\txmllang = \"en_US\";\n }\n if ( lang == \"nb\" ) {\n\txmllang = \"no\";\n }\n \n var ssml_header = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\"\\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\\n xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd\"\\nxml:lang=\"'+xmllang+'\">\\n';\n var ssml_footer = \"</speak>\";\n\n var ssml_content = filterToSSML(html);\n \n var ssml = ssml_header+ssml_content+ssml_footer;\n \n console.log(\"Tokenising:\\n\"+ssml);\n\n var params = {\n\t\"lang\": lang,\n\t\"input_type\": \"ssml\",\n\t\"input\": ssml\n }\n \n $.get(\n //'http://localhost/wikispeech/textprocessing',\n ws_host+'/textprocessing/',\n params,\n function(response) {\n\t console.log(response);\n\n\t if (response.hasOwnProperty(\"paragraphs\")) {\n\t\t//console.log(\"Found utt\");\n\t\t////addSentencesToSynthesisTab(data.sentences);\n\t\taddHtmlSentencesToSynthesisTab(lang);\n\t\t\n\t\tvar data = getSentenceAndTokens(response);\n\t\t\n\t\taddWordsToLexiconTab(data.words, lang);\n\n\t } else {\n\t\tconsole.log(\"ERROR: response is not an utt\");\n\t }\n }\n );\n}", "title": "" }, { "docid": "95e2fb1d841f640f6512859704abe4ee", "score": "0.5791397", "text": "createPhrases() {\n return [\n \"Arsenal\",\n \"Tottenham\",\n \"Chelsea\",\n \"Manchester City\",\n \"Liverpool\"\n ];\n }", "title": "" }, { "docid": "6b0aa6cdbfe14bccf98dce708fe242c4", "score": "0.57776344", "text": "function menutoshowlang(){\n}", "title": "" }, { "docid": "239d9a84b4bd887247fe961f9f09f00a", "score": "0.5770479", "text": "getTranslation(content, lang) {\n let multilanguage = {};\n let deflang = undefined;\n if(content.search(/\\[\\[\\w{2}\\]\\]/igm)>=0){\n let indexStartTag,indexEndTag;\n let tmpLang;\n indexStartTag=content.search(/\\[\\[\\w{2}\\]\\]/igm);\n do{\n indexStartTag+=2;// +2 due to [[\n tmpLang=content.substr(indexStartTag,2);\n if(!deflang) deflang = tmpLang\n indexEndTag=content.search(new RegExp(\"\\\\[\\\\[\\\\/\\\\\" + tmpLang + \"\\\\]\\\\]\",\"igm\"));\n multilanguage[tmpLang]=content.substring(indexStartTag+4,indexEndTag); //+4 due to xx]]\n content=content.substr(indexEndTag+7);// 7 due to [[/xx]]\n indexStartTag=content.search(/\\[\\[\\w{2}\\]\\]/igm) ;\n }while (indexStartTag>=0);\n \n }\n if(multilanguage[lang] && multilanguage[lang].length > 0)\n return multilanguage[lang];\n else if(multilanguage[deflang] && multilanguage[deflang].length)\n return multilanguage[deflang];\n else\n return content\n }", "title": "" }, { "docid": "bec0f9f46339e0ef59eb57e00722f41d", "score": "0.5743187", "text": "function genEnglish(senses) {\n return senses.map(s => s.english_definitions.join(', ')).join ('\\n');\n}", "title": "" }, { "docid": "07d147586c8730e48aec182a21ef165e", "score": "0.5733498", "text": "function translator(language){\n if(language.toLowerCase() === \"English\".toLowerCase())\n {\n console.log(\"Hello World\")\n }\n else if(language.toLowerCase() === \"Arabic\".toLowerCase())\n {\n console.log(\"مرحبا بالعالم\")\n }\n else if(language.toLowerCase() === \"French\".toLowerCase())\n {\n console.log(\"French\")\n }\n else \n console.log(\"sorry i don't know this language\")\n}", "title": "" }, { "docid": "2c5242145f6a89275ac517a8c1ea731b", "score": "0.5715882", "text": "function lemmatize($text) {\n\tvar text = $text;\n\tvar doc = nlp($text);\n\tvar verbs = doc.verbs().json();\n\tvar nouns = doc.nouns().json();\n\tvar nouns_ori = doc.nouns().toSingular().json();\n\n\t// verb\n\tverbs.forEach(obj => {\n\t\tlet now = obj.text;\n\t\tlet to = obj.conjugations.Infinitive;\n\n\t\t// do not change\n\t\tif (now === to) return;\n\t\tif (now === '') return;\t\t// e.g. there's will cause one empty entry\n\t\tif (now.indexOf(\"'\") >= 0) return;\t// e.g. didn't => not didn't\n\n\t\t// replace\n\t\tlet re = new RegExp(now, 'g');\n\t\ttext = text.replace(re, to);\n\t});\n\n\t// noun\n\tnouns.forEach((obj, i) => {\n\t\tlet now = obj.text;\n\t\tlet to = nouns_ori[i].text;\n\n\t\t// do not change\n\t\tif (now === to) return;\n\n\t\t// replace\n\t\tlet re = new RegExp(now, 'g');\n\t\ttext = text.replace(re, to);\n\t});\n\n\treturn text;\n}", "title": "" }, { "docid": "28fe6e1e28d048bcfb2339728f94e225", "score": "0.5698494", "text": "function processText(text){\n var lines, filtered, numbered, index, sounds, all_words, all_syls;\n\n // Tokenize each line into words, separating out all non-apostrophe punctuation\n lines = _.map(text,function(line){\n return line.match(/[\\w\\'’]+|[^\\w\\s\\'’]+/g);\n });\n\n // Remove all smart single-quotes\n lines = _.map(lines,function(s){\n return cleanSentence(s);\n });\n\n // Remove all non-apostrophe punctuation and other non-word noise\n filtered = _.map(lines,function(sentence){\n var words = _.filter(sentence,function(w){\n return w.match(/[\\w\\']{2,}|\\w+/);\n });\n return _.map(words,function(w){return w.toLowerCase();});\n });\n\n numbered = [];\n index = 0;\n\n // Number each sentence and word\n _.each(filtered,function(sentence){\n var s = [];\n _.each(sentence,function(word){\n s.push([word,index]);\n index++;\n });\n numbered.push(s);\n });\n\n // Lookup each word and transform it into a Phoword\n sounds = _.map(numbered, function(sentence,sentence_index){\n return _.map(sentence, function(s){\n var w = s[0],\n w_index = s[1];\n return lookup(w,sentence_index,w_index);\n });\n });\n\n // Flatten the sentences into an array of words\n all_words = _.flatten(sounds,true);\n\n // Filter out any falsy values (nulls, undefineds, etc)\n all_words = _.filter(all_words,function(w){return w;});\n\n all_syls = [];\n\n // Create a flat list of syllables\n _.each(all_words,function(word){\n _.each(word.pros,function(p){\n _.each(p,function(syl){\n all_syls.push(p);\n });\n });\n });\n\n return [sounds,all_syls,all_words];\n }", "title": "" }, { "docid": "6515fa8eafcf8c6a35db960729dbc73c", "score": "0.5683884", "text": "function termStemming(word) {\n var english = natural.PorterStemmer.stem(word);\n var russian = natural.PorterStemmerRu.stem(word);\n\n if(english && english != word) {\n return english;\n }\n\n return russian;\n}", "title": "" }, { "docid": "1dadca77804e0040fd1fdda4d3b3ded5", "score": "0.56775427", "text": "setDefaultWordlist(language) {\n bip39.setDefaultWordlist(language);\n }", "title": "" }, { "docid": "88026f6d481c5a68ed523b022d592ec5", "score": "0.56760603", "text": "function helloWorld(lang) {\n switch (lang) {\n case \"es\":\n return \"Hola mundo\";\n break;\n \n case \"ita\":\n return \"Ciao mondo\";\n break;\n \n case \"fr\":\n return \"Bonjour le mond\";\n break;\n \n case \"de\":\n return \"Hallo Wereld\";\n break;\n \n default:\n return \"Hello World\";\n break;\n }\n}", "title": "" }, { "docid": "ec304ae4684d771cbbdf328911518927", "score": "0.56007475", "text": "function handleText(textNode) \n{\n\n var v = textNode.nodeValue;\n if(analyze_word(v)){\n \n for (i = 0; i < word_list.length; i++) { \n \n var synonym = generate_synonym(v);\n synonym = synonym[0];\n v = v.replace(v, synonym);\n textNode.nodeValue = v;\n } \n }\n \n \n}", "title": "" }, { "docid": "d990e3a3466eb12706d71c4fa5aa8216", "score": "0.55971706", "text": "function helloWorld(lang) {\n\tif (lang == 'es') {\n\t\treturn 'Hola Mundo'; \n\t} else if (lang == 'de') {\n\t\treturn 'Hallo Welt';\n\t} else if (lang == 'en') {\n\t\treturn 'Hello, World';\n\t} else {\n\t\treturn 'Hello, World';\n\t} \n}", "title": "" }, { "docid": "c2e79b5d5d4c264bc0790323b8e5ed8c", "score": "0.559618", "text": "function translate(userPhrase) {\n \n let translatePhrase = \"\";\n \n for (let i=0; i<userPhrase.length; i++) {\n console.log(japanese[userPhrase[i]]);\n if (japanese[userPhrase[i]] !== undefined){\n translatePhrase += `${japanese[userPhrase[i]]}` + \" \"; \n } else {\n alert(\"I'm too busy learning javascript to work on my Japanese\");\n } \n } \n \n document.querySelector(\"#translationPhrase\").innerHTML = translatePhrase;\n }", "title": "" }, { "docid": "b1ac2b6084c82c315dc4a0e2565ade6d", "score": "0.55900073", "text": "function dotranslate(text)\r\n{\r\n text = text.replace(/(^|\\s)(www\\.\\w+[^\\s\\[\\]]+)/ig, \"$1[<--$2-->]\");\r\n text = text.replace(/(^|\\s)((http|https|news|ftp):\\/\\/\\w+[^\\s\\[\\]]+)/ig, \"$1[<--$2-->]\");\r\n \r\n var txtnew = \" \";\r\n var symb = 0;\r\n var subsymb = \"\";\r\n var trans = 1;\r\n for (kk=0;kk<text.length;kk++)\r\n {\r\n subsymb = text.substr(kk,1);\r\n if ((subsymb==\"[\") || (subsymb==\"<\"))\r\n {\r\n trans = 0;\r\n }\r\n if ((subsymb==\"]\") || (subsymb==\">\"))\r\n {\r\n trans = 1;\r\n }\r\n if (trans)\r\n {\r\n symb = transsymbtocyr(txtnew.substr(txtnew.length-1,1), subsymb);\r\n }\r\n else\r\n {\r\n symb = txtnew.substr(txtnew.length-1,1) + subsymb;\r\n }\r\n txtnew = txtnew.substr(0,txtnew.length-1) + symb;\r\n }\r\n txtnew = txtnew.replace(/(\\s)Åò/g, \"$1Ýò\");\r\n txtnew = txtnew.replace(/(\\s)åò/g, \"$1ýò\");\r\n txtnew = txtnew.replace(/(\\s):ûåñ:(\\s)/g, \"$1:yes:$2\");\r\n txtnew = txtnew.replace(/(\\s):íî:(\\s)/g, \"$1:no:$2\");\r\n txtnew = txtnew.replace(/(\\s):ìîë:(\\s)/g, \"$1:mol:$2\");\r\n txtnew = txtnew.replace(/(\\s):ëîë:(\\s)/g, \"$1:lol:$2\");\r\n txtnew = txtnew.replace(/(\\s):ï(\\s)/g, \"$1:p$2\");\r\n txtnew = txtnew.replace(/(\\s):øóôôëå:(\\s)/g, \"$1:shuffle:$2\");\r\n txtnew = txtnew.replace(/(\\s):î(\\s)/g, \"$1:o$2\");\r\n txtnew = txtnew.replace(/(\\s):ååê:(\\s)/g, \"$1:eek:$2\");\r\n txtnew = txtnew.replace(/(\\s):öîíôóñåä:(\\s)/g, \"$1:confused:$2\");\r\n txtnew = txtnew.replace(/(\\s):ðîëëåýñ:(\\s)/g, \"$1:rolleyes:$2\");\r\n txtnew = txtnew.replace(/(\\s):ùååï:(\\s)/g, \"$1:weep:$2\");\r\n txtnew = txtnew.replace(/(\\s):ìàä:(\\s)/g, \"$1:mad:$2\");\r\n txtnew = txtnew.replace(/(\\s):öîîë:(\\s)/g, \"$1:cool:$2\");\r\n txtnew = txtnew.replace(/(\\s):óìíèê:(\\s)/g, \"$1:umnik:$2\");\r\n txtnew = txtnew.replace(/(\\s):òåàïîò:(\\s)/g, \"$1:teapot:$2\");\r\n txtnew = txtnew.replace(/(\\s):áååð:(\\s)/g, \"$1:beer:$2\");\r\n txtnew = txtnew.replace(/(\\s):þìï:(\\s)/g, \"$1:jump:$2\");\r\n txtnew = txtnew.replace(/(\\s):ùàëë:(\\s)/g, \"$1:wall:$2\");\r\n txtnew = txtnew.replace(/(\\s):ìîä:(\\s)/g, \"$1:mod:$2\");\r\n txtnew = txtnew.replace(/(\\s):îê:(\\s)/g, \"$1:ok:$2\");\r\n txtnew = txtnew.replace(/(\\s):íîòå:(\\s)/g, \"$1:note:$2\");\r\n txtnew = txtnew.replace(/\\[<--/g, \"\");\r\n txtnew = txtnew.replace(/-->\\]/g, \"\");\r\n\r\n return txtnew;\r\n}", "title": "" }, { "docid": "339cae83dc00c0b97e34ac80d289b6df", "score": "0.55878335", "text": "_loadDefaultTextAndVars() {\n\n /**\n * @type {Array}\n */\n let cat;\n\n //go though all categories\n for (let category in this._texts) {\n if (this._texts.hasOwnProperty(category)) {\n cat = [];\n //go though all texts in a categorie\n for (let textKey in this._texts[category]) {\n if (this._texts[category].hasOwnProperty(textKey)) {\n //Copy Text to Default\n this._texts[category][textKey].default = this._texts[category][textKey].text;\n\n //Go through all Vars to load default descriptions\n let length = this._texts[category][textKey].vars.length;\n for (let i = 0; i < length; i++) {\n if (typeof this._texts[category][textKey].vars[i] === \"string\") {\n this._texts[category][textKey].vars[i] = {\n \"tag\": this._texts[category][textKey].vars[i],\n \"desc\": this._defaultDescriptions[this._texts[category][textKey].vars[i]]\n };\n }\n }\n\n cat.push({\n textKey: textKey,\n item: this._texts[category][textKey]\n });\n }\n }\n this._hogan.push({\n catKey: category,\n catName: this._catNames[category],\n texts: cat\n });\n }\n }\n\n // load custom texts after loading defaults and vars\n this._loadCustomTexts();\n }", "title": "" }, { "docid": "5ed1bff0fca337611434d8d4f915f5f6", "score": "0.5585526", "text": "function partOfSpeechTranslate(letters) {\r\n var lowerLetters = letters.toLowerCase();\r\n switch (lowerLetters) {\r\n case \"verb\":\r\n return \"v\";\r\n break;\r\n case \"noun\":\r\n return \"n\";\r\n break;\r\n case \"adjective\":\r\n return \"adj\";\r\n break;\r\n case \"adverb\":\r\n return \"adv\";\r\n break;\r\n case \"preposition\":\r\n return \"prep\";\r\n break;\r\n case \"suffix\":\r\n return \"sfx\";\r\n break;\r\n case \"prefix\":\r\n return \"pfx\";\r\n break;\r\n case \"interjection\":\r\n return \"int\";\r\n break;\r\n default:\r\n return letters;\r\n break;\r\n }\r\n}", "title": "" }, { "docid": "d66108d90349ca390f022edcf52e62bf", "score": "0.55803746", "text": "function translate(text, dictionary){\n\t// TODO: implementați funcția\n\t// TODO: implement the function\n}", "title": "" }, { "docid": "3a64d13bd32004a9245bd3dd310b32de", "score": "0.55788034", "text": "function Speak(libraries, moods, statements, segments) {\n 'use strict';\n // SpeechLibraries\n this.libraries = libraries || [\n new SpeechLibrary('sources', 's', 'context of origin', \n ['i', 'we', 'it', 'they', 'she', 'he']),\n new SpeechLibrary('possessors', 'p', 'possession claims', \n ['my', 'your', 'our', 'his', 'her', 'its', 'the', 'this']),\n new SpeechLibrary('subjects', 'sub', 'entities',\n ['her', 'him', 'me', 'this', 'it', 'that']),\n new SpeechLibrary('emotives', 'emo', 'n-time self-referencing',\n ['*', 'can', 'will', 'shall', 'might', 'should', 'could', 'would'],\n function (statement, position, mood, speak) {\n \t\tvar word = getRandomItem(this.list),\n \t\t\tlastWord = getLastWord(statement, position);\n\n if (word === '*') {\n \tif (lastWord === 'we' || lastWord === 'they') {\n \t\tword = 'are';\n \t} else if(lastWord === 'it' || lastWord === 'he' || lastWord === 'she') {\n \t\tword = 'is';\n \t} else {\n \t\tword = 'am';\n \t}\n }\n return word;\n }),\n new SpeechLibrary('conditionals', 'c', 'logical conditions',\n ['then', 'but', 'and', 'or']),\n new SpeechLibrary('reflections', 'ref', 'object-oriented self-referencing',\n ['is', 'was', 'will be'],\n function (statement, position, mood, speak) {\n \t\tvar word = getRandomItem(this.list),\n \t\t\tlastWord = getLastWord(statement, position);\n\t \n\t if (lastWord[lastWord.length - 1] === 's') {\n\t\t if (word === 'is') {\n\t\t word = 'are';\n\t\t } else if (word === 'was') {\n\t\t \tword = 'were';\n\t\t }\n\t }\n\t return word;\n\t }),\n new SpeechLibrary('actions', 'a', 'verbs',\n ['accept', 'care', 'could', 'enjoy', 'lead', 'open', 'reduce', 'settle', 'teach', 'account', 'carry', 'count', 'examine', 'hate', 'learn', 'order', 'refer', 'shake', 'tell', 'achieve', 'catch', 'cover', 'have', 'leave', 'ought', 'reflect', 'shall', 'tend', 'act', 'cause', 'create', 'expect', 'head', 'lend', 'own', 'refuse', 'share', 'test', 'add', 'change', 'cross', 'experience', 'hear', 'let', 'pass', 'regard', 'shoot', 'thank', 'admit', 'charge', 'cry', 'explain', 'help', 'lie', 'pay', 'relate', 'think', 'affect', 'check', 'cut', 'express', 'hide', 'like', 'perform', 'release', 'shout', 'throw', 'afford', 'choose', 'damage', 'extend', 'hit', 'limit', 'pick', 'remain', 'show', 'touch', 'agree', 'claim', 'dance', 'face', 'hold', 'link', 'place', 'remember', 'shut', 'train', 'aim', 'clean', 'deal', 'fail', 'hope', 'listen', 'plan', 'remove', 'sing', 'travel', 'allow', 'clear', 'decide', 'fall', 'hurt', 'live', 'play', 'repeat', 'sit', 'treat', 'answer', 'climb', 'deliver', 'fasten', 'identify', 'look', 'point', 'replace', 'sleep', 'try', 'appear with', 'close', 'demand', 'feed', 'imagine', 'lose', 'prefer', 'reply', 'smile', 'turn', 'apply', 'collect', 'deny', 'feel', 'improve', 'love', 'prepare', 'report', 'sort', 'understand', 'argue', 'come', 'depend', 'fight', 'include', 'make', 'present', 'represent', 'sound', 'use', 'arrange', 'commit', 'describe', 'fill', 'increase', 'manage', 'press', 'require', 'speak', 'used to', 'arrive', 'compare', 'design', 'find', 'indicate', 'mark', 'prevent', 'rest', 'stand', 'visit', 'ask', 'complain', 'destroy', 'finish', 'influence', 'matter', 'produce', 'result', 'start', 'vote', 'attack', 'complete', 'develop', 'fit', 'inform', 'may', 'promise', 'return', 'state', 'wait', 'avoid', 'concern', 'die', 'fly', 'intend', 'mean', 'protect', 'reveal', 'stay', 'walk', 'base', 'confirm', 'disappear', 'fold', 'introduce', 'measure', 'prove', 'ring', 'stick', 'want', 'connect', 'discover', 'follow', 'invite', 'meet', 'provide', 'rise', 'stop', 'warn', 'beat', 'consider', 'discuss', 'force', 'involve', 'mention', 'publish', 'roll', 'study', 'wash', 'become', 'consist', 'divide', 'forget', 'join', 'might', 'pull', 'run', 'succeed', 'watch', 'begin', 'contact', 'do', 'forgive', 'jump', 'mind', 'push', 'save', 'suffer', 'wear', 'believe', 'contain', 'draw', 'form', 'keep', 'miss', 'put', 'say', 'suggest', 'will', 'belong', 'continue', 'dress', 'found', 'kick', 'move', 'raise', 'see', 'suit', 'win', 'break', 'contribute', 'drink', 'gain', 'kill', 'must', 'reach', 'supply', 'wish', 'build', 'control', 'drive', 'get', 'knock', 'need', 'read', 'sell', 'support', 'wonder', 'burn', 'cook', 'drop', 'give', 'know', 'notice', 'realize', 'send', 'suppose', 'work', 'buy', 'copy', 'eat', 'go', 'last', 'obtain', 'receive', 'separate', 'survive', 'worry', 'call', 'correct', 'enable', 'grow', 'laugh', 'occur', 'recognize', 'serve', 'take', 'would', 'can', 'cost', 'encourage', 'handle', 'lay', 'offer', 'record', 'set', 'talk', 'write', 'sniff'],\n function (statement, position, mood, speak) {\n\t \t\tvar word = getRandomItem(this.list),\n\t \t\t\tlastWord = getLastWord(statement, position),\n\t \t\t\tlastLetter = word[word.length - 1];\n\t\n\t if (speak.getLibrary('meanings').list.indexOf(lastWord) !== -1 && lastWord.substr(lastWord.length - 2) == 'ly') {\n\t \tif (lastLetter === 'e') {\n\t \t\t//word = word.substr(0, word.length - 2);\n\t \t}\n\t \t//word = word + 'ing';\n\t } else if (lastWord === 'it' || lastWord === 'she' || lastWord === 'he') {\n\t \t//word = word + 's';\n\t }\n\t return word;\n\t } \n ),\n new SpeechLibrary('meanings', 'm', 'adverbs',\n ['just', 'also', 'very', 'even', 'still', 'never', 'really', 'over', 'always', 'often', 'however', 'almost', 'later', 'much', 'once', 'already', 'maybe', 'actually', 'probably', 'of course', 'perhaps', 'sometimes', 'finally', 'more', 'less', 'better', 'early', 'especially', 'either', 'quite', 'simply', 'nearly', 'certainly', 'quickly', 'recently', 'usually', 'thus', 'exactly', 'hard', 'particularly', 'pretty', 'clearly', 'indeed', 'rather', 'suddenly', 'best', 'instead', 'fast', 'eventually', 'directly']),\n new SpeechLibrary('descriptions', 'd', 'adjectives',\n ['so', 'different', 'used', 'important', 'every', 'large', 'available', 'popular', 'able', 'basic', 'known', 'various', 'difficult', 'several', 'united', 'historical', 'hot', 'useful', 'mental', 'scared', 'additional', 'emotional', 'old', 'political', 'similar', 'healthy', 'financial', 'medical', 'traditional', 'federal', 'entire', 'strong', 'actual', 'significant', 'successful', 'electrical', 'expensive', 'pregnant', 'intelligent', 'interesting', 'poor', 'happy', 'responsible', 'cute', 'helpful', 'recent', 'willing', 'nice', 'wonderful', 'impossible', 'serious', 'huge', 'rare', 'technical', 'typical', 'competitive', 'critical', 'electronic', 'immediate', 'whose', 'aware', 'educational', 'environmental', 'global', 'legal', 'relevant', 'accurate', 'capable', 'dangerous', 'dramatic', 'efficient', 'powerful', 'foreign', 'hungry', 'practical', 'psychological', 'severe', 'suitable', 'numerous', 'sufficient', 'unusual', 'consistent', 'cultural', 'existing', 'famous', 'pure', 'afraid', 'obvious', 'careful', 'latter', 'obviously', 'unhappy', 'acceptable', 'aggressive', 'distinct', 'eastern', 'logical', 'reasonable', 'strict', 'successfully', 'administrative', 'automatic', 'civil', 'former', 'massive', 'southern', 'unfair', 'visible', 'alive', 'angry', 'desperate', 'exciting', 'friendly', 'lucky', 'realistic', 'sorry', 'ugly', 'unlikely', 'anxious', 'comprehensive', 'curious', 'impressive', 'informal', 'inner', 'pleasant', 'sexual', 'sudden', 'terrible', 'unable', 'weak', 'wooden', 'asleep', 'confident', 'conscious', 'decent', 'embarrassed', 'guilty', 'lonely', 'mad', 'nervous', 'odd', 'remarkable', 'substantial', 'suspicious', 'tall', 'tiny', 'more', 'some', 'one', 'all', 'many', 'most', 'other', 'such', 'even', 'new', 'just', 'good', 'any', 'each', 'much', 'own', 'great', 'another', 'same', 'few', 'free', 'right', 'still', 'best', 'public', 'human', 'both', 'local', 'sure', 'better', 'general', 'specific', 'enough', 'long', 'small', 'less', 'high', 'certain', 'little', 'common', 'next', 'simple', 'hard', 'past', 'big', 'possible', 'particular', 'real', 'major', 'personal', 'current', 'left', 'national', 'least', 'natural', 'physical', 'short', 'last', 'single', 'individual', 'main', 'potential', 'professional', 'international', 'lower', 'open', 'according', 'alternative', 'special', 'working', 'true', 'whole', 'clear', 'dry', 'easy', 'cold', 'commercial', 'full', 'low', 'primary', 'worth', 'necessary', 'positive', 'present', 'close', 'creative', 'green', 'late', 'fit', 'glad', 'proper', 'complex', 'content', 'due', 'effective', 'middle', 'regular', 'fast', 'independent', 'original', 'wide', 'beautiful', 'complete', 'active', 'negative', 'safe', 'visual', 'wrong', 'ago', 'quick', 'ready', 'straight', 'white', 'direct', 'excellent', 'extra', 'junior', 'pretty', 'unique', 'classic', 'final', 'overall', 'private', 'separate', 'western', 'alone', 'familiar', 'official', 'perfect', 'bright', 'broad', 'comfortable', 'flat', 'rich', 'warm', 'young', 'heavy', 'valuable', 'correct', 'leading', 'slow', 'clean', 'fresh', 'normal', 'secret', 'tough', 'brown', 'cheap', 'deep', 'objective', 'secure', 'thin', 'chemical', 'cool', 'extreme', 'exact', 'fair', 'fine', 'formal', 'opposite', 'remote', 'total', 'vast', 'lost', 'smooth', 'dark', 'double', 'equal', 'firm', 'frequent', 'internal', 'sensitive', 'constant', 'minor', 'previous', 'raw', 'soft', 'solid', 'weird', 'amazing', 'annual', 'busy', 'dead', 'false', 'round', 'sharp', 'thick', 'wise', 'equivalent', 'initial', 'narrow', 'nearby', 'proud', 'spiritual', 'wild', 'adult', 'apart', 'brief', 'crazy', 'prior', 'rough', 'sad', 'sick', 'strange', 'external', 'illegal', 'loud', 'mobile', 'nasty', 'ordinary', 'royal', 'senior', 'super', 'tight', 'upper', 'yellow', 'dependent', 'funny', 'gross', 'ill', 'spare', 'sweet', 'upstairs', 'usual', 'brave', 'calm', 'dirty', 'downtown', 'grand', 'honest', 'loose', 'male', 'quiet', 'brilliant', 'dear', 'drunk', 'empty', 'female', 'inevitable', 'neat', 'ok', 'representative', 'silly', 'slight', 'smart', 'stupid', 'temporary', 'weekly', 'that', 'this', 'what', 'which', 'time', 'these', 'work', 'no', 'only', 'first', 'over', 'business', 'his', 'game', 'think', 'after', 'life', 'day', 'home', 'economy', 'away', 'either', 'fat', 'key', 'training', 'top', 'level', 'far', 'fun', 'house', 'kind', 'future', 'action', 'live', 'mean', 'stock', 'chance', 'beginning', 'upset', 'chicken', 'head', 'material', 'salt', 'car', 'appropriate', 'inside', 'outside', 'standard', 'medium', 'choice', 'north', 'square', 'born', 'capital', 'shot', 'front', 'living', 'plastic', 'express', 'mood', 'feeling', 'otherwise', 'plus', 'saving', 'animal', 'budget', 'minute', 'character', 'maximum', 'novel', 'plenty', 'select', 'background', 'forward', 'glass', 'joint', 'master', 'red', 'vegetable', 'ideal', 'kitchen', 'mother', 'party', 'relative', 'signal', 'street', 'minimum', 'sea', 'south', 'status', 'daughter', 'trick', 'afternoon', 'gold', 'mission', 'agent', 'corner', 'east', 'neither', 'parking', 'routine', 'swimming', 'winter', 'airline', 'designer', 'dress', 'emergency', 'evening', 'extension', 'holiday', 'horror', 'mountain', 'patient', 'proof', 'west', 'wine', 'expert', 'native', 'opening', 'silver', 'waste', 'plane', 'leather', 'purple', 'specialist', 'bitter', 'incident', 'motor', 'pretend', 'prize', 'resident', 'furious', 'bad', 'awful', 'terrible', 'horrible', 'big', 'huge', 'gigantic', 'giant', 'clean', 'spotless', 'cold', 'freezing', 'crowded', 'packed', 'dirty', 'filthy', 'funny', 'hilarious', 'good', 'wonderful', 'fantastic', 'excellent', 'hot', 'boiling', 'hungry', 'starving', 'interesting', 'fascinating', 'old', 'ancient', 'pretty', 'gorgeous', 'scary', 'terrifying', 'small', 'tiny', 'surprising', 'astounding', 'tired', 'exhausted', 'ugly', 'hideous'],\n\t function (statement, position, mood, speak) {\n\t\t \t\tvar word = getRandomItem(this.list),\n\t\t \t\t\tlastWord = getLastWord(statement, position);\n\t\t\n\t\t \t\tconsole.log(lastWord);\n\t\t if (speak.getLibrary('emotives').list.indexOf(lastWord) !== -1) {\n\t\t \tword = 'be ' + word;\n\t\t }\n\t\t return word;\n\t\t }\n ),\n new SpeechLibrary('objects', 'o', 'nouns',\n ['gypsy curse', 'moment of silence', 'sausage festival', 'honest cop with nothing left to lose', 'famine', 'flesh-eating bacteria', 'flying sex snake', 'shapeshifter', 'porn star', 'time travel paradox', 'authentic mexican cuisine', 'bling', 'consultant', 'crippling debt', 'daddy issues', 'donald trump seal of approval', 'former president george w. bush', 'full frontal nudity', 'hormone injections', 'public ridicule', 'boogers', 'inevitable heat death of the universe', 'miracle of childbirth', 'rapture', 'white privilege', 'wifely duties', 'hamburglar', 'axe body spray', 'blood of christ', 'batman', 'agriculture', 'robust mongoloid', 'natural selection', 'coat hanger abortion', 'michelle obama\\'s arms', 'world of warcraft', 'obesity', 'homoerotic volleyball montage', 'lockjaw', 'a mating display', 'testicular torsion', 'all-you-can-eat shrimp for $4.99', 'domino\\'s oreo dessert pizza', 'kanye west', 'hot cheese', 'raptor attack', 'smegma', 'alcoholism', 'middle-aged man on roller skates', 'care bear stare', 'oversized lollipop', 'self-loathing', 'children on leashes', 'half-assed foreplay', 'holy bible', 'german dungeon porn', 'teenage pregnancy', 'gandhi', 'uppercut', 'customer service representative', 'genitals', 'science', 'flightless birds', 'balanced breakfast', 'historically black colleges', 'make-a-wish foundation', 'clandestine butt scratch', 'passive-aggressive post-it notes', 'chinese gymnastics team', 'nocturnal emissions', 'jews', 'humps', 'powerful thighs', 'gentle caress of the inner thigh', 'sexual tension', 'forbidden fruit', 'skeletor', 'fancy feast', 'sweet, sweet vengeance', 'republicans', 'gassy antelope', 'natalie portman', 'kamikaze pilots', 'sean connery', 'homosexual agenda', 'hardworking mexican', 'falcon with a cap on its head', 'altar boys', 'kool-aid man', 'free samples', 'big hoopla about nothing', 'three-fifths compromise', 'lactation', 'world peace', 'robocop', 'chutzpah', 'justin bieber', 'oompa-loompas', 'puberty', 'ghosts', 'asymmetric boob job', 'vigorous jazz hands', 'gogurt', 'police brutality', 'john wilkes booth', 'preteens', 'darth vader', 'sad handjob', 'adderall', 'embryonic stem cells', 'tasteful sideboob', 'panda sex', 'icepick lobotomy', 'tom cruise', 'mouth herpes', 'sperm whales', 'homeless people', 'third base', 'incest', 'pac-man uncontrollably guzzling cum', 'mime having a stroke', 'hulk hogan', 'god', 'golden showers', 'emotions', 'pabst blue ribbon', 'placenta', 'spontaneous human combustion', 'friends with benefits', 'old-people smell', 'inner demons', 'super soaker full of cat pee', 'aaron burr', 'chronic', 'cockfights', 'friendly fire', 'ronald reagan', 'disappointing birthday party', 'sassy black woman', 'mathletes', 'tiny horse', 'william shatner', 'm. night shyamalan plot twist', 'jew-fros', 'mutually-assured destruction', 'pedophiles', 'yeast', 'catapults', 'poor people', 'hustle', 'force', 'intelligent design', 'loose lips', 'aids', 'pictures of boobs', 'Ubermensch', 'sarah palin', 'american gladiators', 'scientology', 'penis envy', 'frolicking', 'midgets shitting into a bucket', 'KKK', 'genghis khan', 'crystal meth', 'serfdom', 'stranger danger', 'bop it', 'shaquille o\\'neal\\'s acting career', 'prancing', 'vigilante justice', 'overcompensation', 'pixelated bukkake', 'lifetime of sadness', 'racism', 'dwarf tossing', 'sunshine and rainbows', 'monkey smoking a cigar', 'flash flooding', 'lance armstrong\\'s missing testicle', 'dry heaving', 'terrorists', 'britney spears at 55', 'attitude', 'leprosy', 'gloryholes', 'nipple blades', 'heart of a child', 'puppies', 'dental dams', 'toni morrison\\'s vagina', 'taint', 'ethnic cleansing', 'little engine that could', 'invisible hand', 'unfathomable stupidity', 'euphoria by calvin klein', 're-gifting', 'autocannibalism', 'erectile dysfunction', 'collection of high-tech sex toys', 'pope', 'white people', 'tentacle porn', 'too much hair gel', 'seppuku', 'same-sex ice dancing', 'charisma', 'keanu reeves', 'sean penn', 'nickelback', 'look-see', 'menstruation', 'kids with ass cancer', 'salty surprise', 'south', 'violation of our most basic human rights', 'necrophilia', 'centaurs', 'bill nye the science guy', 'black people', 'chivalry', 'lunchables', 'bitches', 'profoundly handicapped', 'heartwarming orphans', 'mechahitler', 'fiery poops', 'another goddamn vampire movie', 'tangled slinky', 'estrogen', 'zesty breakfast burrito', 'bleached asshole', 'michael jackson', 'cybernetic enhancements', 'guys who don\\'t call', 'smallpox blankets', 'masturbation', 'classist undertones', 'queefing', 'edible underpants', 'viagra', 'soup that is too hot', 'muhammad (praise be unto him)', 'surprise sex', 'five-dollar footlongs', 'dick fingers', 'multiple stab wounds', 'child abuse', 'anal beads', 'civilian casualties', 'robert downey, jr', 'horse meat', 'really cool hat', 'kim jong-il', 'stray pube', 'jewish fraternities', 'token minority', 'doin\\' it in the butt', 'can of whoop-ass', 'windmill full of corpses', 'count chocula', 'death ray', 'glass ceiling', 'cooler full of organs', 'american dream', 'keg stands', 'take-backsies', 'dead babies', 'foreskin', 'saxophone solos', 'italians', 'fetus', 'dick cheney', 'amputees', 'eugenics', 'relationship status', 'christopher walken', 'bees', 'harry potter erotica', 'college', 'nazis', '8 oz. of sweet mexican black-tar heroin', 'stephen hawking talking dirty', 'dead parents', 'object permanence', 'opposable thumbs', 'racially-biased sat questions', 'jibber-jabber', 'chainsaws for hands', 'nicolas cage', 'child beauty pageants', 'explosions', 'repression', 'roofies', 'vagina', 'assless chaps', 'murder most foul', 'trail of tears', 'goblins', 'hope', 'rev. dr. martin luther king, jr', 'micropenis', 'soul', 'hot mess', 'vikings', 'hot people', 'seduction', 'oedipus complex', 'geese', 'global warming', 'new age music', 'hot pockets', 'vehicular manslaughter', 'women\\'s suffrage', 'defective condom', 'judge judy', 'african children', 'virginia tech massacre', 'barack obama', 'asians who aren\\'t good at math', 'elderly japanese men', 'heteronormativity', 'arnold schwarzenegger', 'road head', 'spectacular abs', 'figgy pudding', 'mopey zoo lion', 'bag of magic beans', 'poor life choices', 'sex life', 'auschwitz', 'thermonuclear detonation', 'clitoris', 'big bang', 'land mines', 'friends who eat all the snacks', 'goats eating cans', 'dance of the sugar plum fairy', 'man meat', 'me time', 'underground railroad', 'poorly-timed holocaust jokes', 'sea of troubles', 'lumberjack fantasies', 'morgan freeman\\'s voice', 'women in yogurt commercials', 'natural male enhancement', 'genital piercings', 'passable transvestites', 'sexy pillow fights', 'balls', 'grandma', 'friction', 'party poopers', 'tempur-pedic swedish sleep system', 'hurricane katrina', 'gays', 'folly of man', 'men', 'amish', 'pterodactyl eggs', 'team-building exercises', 'brain tumor', 'fear itself', 'lady gaga', 'milk man', 'foul mouth', 'big black dick', 'beached whale', 'bloody pacifier', 'crappy little hand', 'low standard of living', 'nuanced critique', 'panty raids', 'passionate latino lover', 'rival dojo', 'web of lies', 'woman scorned', 'clams', 'appreciative snapping', 'neil patrick harris', 'shaft', 'bosnian chicken farmers', 'nubile slave boys', 'carnies', 'suicidal thoughts', 'dorito breath', 'enormous scandinavian women', 'gandalf', 'genetically engineered super-soldiers', 'george clooney\\'s musk', 'gladiatorial combat', 'good grammar', 'hipsters', 'historical revisionism', 'insatiable bloodlust', 'jafar', 'jean-claude van damme', 'just the tip', 'mad hacky-sack skills', 'media coverage', 'medieval times dinner and tournament', 'moral ambiguity', 'machete', 'one thousand slim jims', 'ominous background music', 'quiche', 'quivering jowls', 'revenge fucking', 'ryan gosling riding in on a white horse', 'santa claus', 'scrotum tickling', 'sexual humiliation', 'sexy siamese twins', 'slow motion', 'space muffins', 'statistically validated stereotypes', 'sudden poop explosion disease', 'boners of the elderly', 'economy', 'fanta girls', 'gulags', 'harsh light of day', 'hiccups', 'shambling corpse of larry king', 'four arms of vishnu', 'words, words, words', 'zeus\\'s sexual appetites'],\n\t function (statement, position, mood, speak) {\n\t \t\tvar word = getRandomItem(this.list),\n\t \t\t\tlastWord = getLastWord(statement, position),\n\t \t\t\tfirstLetter = word[0],\n\t \t\t\tlastLetter = word[word.length - 1];\n\t\n\t\t if (lastWord === 'was' || lastWord === 'is' || lastWord === 'were' || lastWord === 'are') {\n\t\t \tif(lastLetter === 's') {\n\t\t \t\tword = 'the ' + word;\n\t\t \t} else if (['a', 'e', 'i', 'o', 'u'].indexOf(firstLetter) !== -1) {\n\t\t \t\tword = 'an ' + word;\n\t\t \t} else {\n\t\t \t\tword = 'a ' + word;\n\t\t \t}\n\t\t }\n\t\t \n\t\t if(statement[position - 1] === '#') {\n\t\t \tword = word.replace(/\\s/g, '');\n\t\t }\n\t\t return word;\n\t\t } \n ),\n new SpeechLibrary('influencers', 'i', 'emotionally influential statements', [],\n function (statement, position, mood, speak) {\n return getRandomItem(mood.influencers);\n }),\n new SpeechLibrary('punctuations', 'punc', 'punctuation', [],\n function (statement, position, mood, speak) {\n return getRandomItem(mood.punctuations);\n }),\n new SpeechLibrary('emoticons', 'icon', 'emoticons', [],\n function (statement, position, mood, speak) {\n return getRandomItem(mood.emoticons);\n })\n ];\n\n // Moods\n this.moods = moods || [\n new Mood('anger', \n ['goddamnit', 'fuck', 'shit', 'argghhh', 'grrrrr'], \n ['.', '...', '!', '!!!', '?!?'], \n ['>:)', '>:(', '>:|'],\n function(statement) {\n \t\tif (getRandomRange(1, 100) <= 50) {\n \t\t\treturn statement.toUpperCase();\n \t\t}\n \t\treturn statement;\n \t}),\n new Mood('jealousy', \n ['hrmmm', 'oh yes', 'hey', 'oooooo'], \n ['.', '...', '!', '?', '!!!', '?!?'], \n [':)', ':(', ':d', '<3', ':c', 'c:', ':o', ':O', '.___.', '-___-', '-___-\\'']),\n new Mood('fear', \n ['oh god', 'no', 'well', 'ummmm'], \n ['.', '...', '!', '?', '!!!', '?!?'], \n [':(', ':C', 'D:', ':o', ':O', '-___-\\'']),\n new Mood('paranoia', \n ['wait', 'what', 'no'], \n ['.', '!', '?', '!!!', '?!?'], \n [':|', ':o', ':O', ':p', '<_<', '>_>', '-___-\\'']),\n new Mood('curiosity', \n ['ooooo', 'hey', 'wow', 'yes', 'yo', 'oh'], \n ['.', '...', '!', '?'], \n [':)', ':3', ':o', ':O', ':D', ';)']),\n new Mood('joyful', \n ['oh', 'yes', 'wow', 'oh boy'], \n ['!', '!!!'], \n [':)', ':D', ':3', '<3', 'C:', ':P']),\n new Mood('excited', \n ['oh', 'yay', 'wow'], \n ['!', '!!!', '?!?'], \n [':)', ':D', ':3', '<3', 'C:', ':P', ':O']),\n new Mood('calm', \n ['well'], \n ['.', '...'], \n [':|']),\n new Mood('ashamed', \n ['no', 'uhhh', 'ummmm', 'sorry'], \n ['...'], \n [':(', 'D:', ':C', ':L', '.___.', '-___-', '-___-\\'']),\n new Mood('apathetic', \n ['meh'], \n ['...'], \n [':|', '.___.', '-___-']),\n new Mood('logical', \n ['yes', 'no'], \n ['.'], \n [':|'])\n ];\n\n /// Statement templates to use \n this.statements = statements || [\n 'if %seg, %c %seg',\n '%seg%punc %seg',\n 'should %s %a %p? %o %c %m %a %p %d %o',\n '%i, %seg',\n '%seg',\n '%seg. %i',\n '%s %emo %d, %c? %seg',\n 'i don\\'t always %a, but when i do, it\\'s %o',\n 'maybe she\\'s born with it. maybe it\\'s %o',\n 'i got 99 problems but %o ain\\'t one',\n 'i drink to forget %p %o',\n '%seg. that\\'s how I want to die',\n 'for my next trick, I will pull %o out of %o',\n '%o is a slippery slope that leads to %o',\n '%seg%punc high five, bro',\n 'during sex, I like to think about %o',\n '%seg: kid-tested, mother-approved',\n '%o + %o = %o',\n 'science will never explain %o',\n 'my country, \\'tis of thee, sweet land of %o',\n '#%o',\n '%o.tumblr.com',\n '%o@%o.com',\n '%o. the other white meat',\n 'you\\'re not gonna believe this, but %seg',\n '%o ain\\'t nothin\\' to fuck wit\\'',\n 'I like %o, but %i, %a the %o already'\n ];\n\n // Standalone isomorphic sentences\n this.segments = segments || [\n '%s %emo %d',\n '%p? %o %ref? %d',\n '%p %o %ref %o',\n '%s %emo? %m? %a %sub, %o',\n '%s %emo? %m? %a %o',\n '%s %a %p %d? %o',\n '%o %ref %p %d? %o',\n '%s %emo %m? %a %p %d? %o',\n '%a %sub %m?',\n '%i',\n '%p? %d? %o',\n ];\n}", "title": "" }, { "docid": "bd97bfa7fb90f312962f79a37595938f", "score": "0.55458367", "text": "translate(text, target, callback){\n\t\t\t\t// Assume that our default language on every JS or HTML template is en_US\n\t\t\t\ttranslates('en_US', target, text, callback);\n\t\t\t}", "title": "" }, { "docid": "e73edd432fee184cdad472ba56e49db6", "score": "0.55439115", "text": "lang(lang) {\n return this.language(lang)\n }", "title": "" }, { "docid": "50f54fc9fd2d2acf1115c44ff8f200bb", "score": "0.55377775", "text": "createPhrases() {\n return [\n new Phrase(\"The plot thickens\"),\n new Phrase(\"Greased lightning\"),\n new Phrase(\"Jack of all trades\"),\n new Phrase(\"Jump the shark\"),\n new Phrase(\"My cup of tea\")\n ];\n }", "title": "" }, { "docid": "203663a1129aa479f6cd3be9aa617fe7", "score": "0.55333656", "text": "function greet(lang) {\n return langs[lang]||langs['english'];\n }", "title": "" }, { "docid": "caf0186ab5f783f3d65c388c290cf816", "score": "0.55333024", "text": "function setLanguage(lang) {\n\tif (lang == \"en\") {\n\t\tvar mechanicTexts = mechanicTextsEn;\n\t}\n\telse if (lang ==\"es\") {\n\t\tvar mechanicTexts = mechanicTextsEs;\n\t}\n}", "title": "" }, { "docid": "62e3f7dbe5ba65754e9b84fc63296e35", "score": "0.55305094", "text": "createPhrases(){\r\n const phrases = [\r\n new Phrase ('life is like a box of chocolates'), \r\n new Phrase ('there is no trying'),\r\n new Phrase ('may the force be with you'),\r\n new Phrase ('you have to see the matrix for yourself'),\r\n new Phrase ('you talking to me')];\r\n return phrases;\r\n }", "title": "" }, { "docid": "7d85dec50c3a73f9c0695230a97ad8c4", "score": "0.5529021", "text": "function getText(language){\n\treturn english;\n}", "title": "" }, { "docid": "7211f6c3ed4f2719e6e5e37c2f9ce144", "score": "0.5527089", "text": "static wordlist() {\n if (wordlist == null) {\n wordlist = new LangEs();\n }\n return wordlist;\n }", "title": "" }, { "docid": "529d025ae21d6fb33e923dce4a9af413", "score": "0.55204636", "text": "function setLanguage(lang) {\n selectedLanguageWords = extensionState.allWords[lang];\n }", "title": "" }, { "docid": "569ede6d2dfa837b5f71d3dcf66c50c7", "score": "0.55058765", "text": "function convertEnglishSetence(number) {\n \treturn \"English Sentence\";\n }", "title": "" }, { "docid": "76ec0cdbde89d48d527feada08f8ba50", "score": "0.55055803", "text": "function helloWorld(language){\n if (language === \"es\") {\n return \"Hola mundo!\"\n }\n else if (language === \"fr\") {\n return \"Bonjour le monde!\"\n }\n else if (language === \"ge\") {\n return \"Hallo welt!\"\n }\n else if(language === \"it\") {\n return \"Ciao mondo!\"\n }\n else {\n return \"Hello world!\"\n }\n}", "title": "" }, { "docid": "91d5c8c25513834cd3e0753a51bd3ca1", "score": "0.5504347", "text": "function greet2(languageCode) {\n switch (languageCode) {\n case 'en': return 'Hi!';\n case 'fr': return 'Salut!';\n case 'pt': return 'Olá!';\n case 'de': return 'Hallo!';\n case 'sv': return 'Hej!';\n case 'af': return 'Haai!';\n }\n}", "title": "" }, { "docid": "27cf5689180599154271a968ba358deb", "score": "0.5499056", "text": "function translate(text) {\n\n}", "title": "" }, { "docid": "a9b9eb568e784216672fa02ed51d79d4", "score": "0.5496955", "text": "function translatePhrase()\r\n{\r\n var _phrase = document.getElementById('phrase');\r\n var lang = glosbe_map[trans_lang]; //map the language\r\n if (_phrase)\r\n {\r\n if (_phrase.value.length > 0)\r\n {\r\n //calling en.glosbe.com/en/language/phrase\r\n var transFrom = 'http://en.glosbe.com/en/' + lang + '/' + _phrase.value.toLowerCase();\r\n //do it via YQL, as en.glosbe.com does not respond directly - same domain policy\r\n //YQL API accepts requests from anywhere \r\n var yql = 'http://query.yahooapis.com/v1/public/yql?q=';\r\n yql += encodeURIComponent('select * from html where url=\"' + transFrom + '\" and compat=\"html5\"');\r\n yql += '&format=xml';\r\n //fetch it!\r\n fetchTranslation(yql, _phrase);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "d2851b8a4b949fdb1e0de2ba6d69443b", "score": "0.5492561", "text": "function translate(transDict, origText) {\n if (transDict[0] == transDict[2]) { return origText }\n origText = origText.split(' ');\n var translation = \"\";\n var foreign;\n var eng;\n\n origText.forEach(word => {\n if (word == \"\" || word == \"\\s\") { \n translation += \" \"; \n return;\n }\n word = word.toLowerCase();\n eng;\n switch (transDict) {\n case \"g2s\":\n eng = g2e[word];\n foreign = e2s[eng]; \n break;\n case \"s2g\":\n eng = s2e[word];\n foreign = e2g[eng];\n break;\n default:\n foreign = eval(transDict)[word];\n }\n foreign = (foreign) ? foreign : \"?\";\n translation += foreign + ' ';\n })\n return translation;\n}", "title": "" }, { "docid": "426875c12079ed9ef02e768cdb70ef86", "score": "0.5489289", "text": "static getEnglishTranslation(input) {\n\t\tinput = ' '+input+' ';\n\t\tconst dictionary = Cedict.getDictionaryText();\n\t\tconst indexNeeded = dictionary.indexOf(input);\n\n\t\tif (indexNeeded !== -1) {\n\t\t\tconst startIndex = dictionary.substr(indexNeeded).indexOf('/')+indexNeeded+1;\n\t\t\tconst endIndex = dictionary.substr(startIndex).indexOf('/\\n')+startIndex;\n\t\t\treturn dictionary.substring(startIndex, endIndex);\n\t\t} else {\n\t\t\treturn 'No translation to show...';\n\t\t}\n\t}", "title": "" }, { "docid": "b80b2549d77214504c374abe220380c5", "score": "0.548508", "text": "function languageTranslates(item) {\n if (item == 'Text') {\n item = message['text'];\n } else if (item == 'Audio') {\n item = message['audio'];\n } else if (item == 'Video') {\n item = message['video'];\n } else if (item == 'Plugins') {\n item = message['plugins'];\n } else if (item == 'Image') {\n item = message['image'];\n }\n return item;\n}", "title": "" }, { "docid": "b80b2549d77214504c374abe220380c5", "score": "0.548508", "text": "function languageTranslates(item) {\n if (item == 'Text') {\n item = message['text'];\n } else if (item == 'Audio') {\n item = message['audio'];\n } else if (item == 'Video') {\n item = message['video'];\n } else if (item == 'Plugins') {\n item = message['plugins'];\n } else if (item == 'Image') {\n item = message['image'];\n }\n return item;\n}", "title": "" }, { "docid": "71e4b41109aa29eafd7fcb2faff74076", "score": "0.54840356", "text": "function helloWorld(lang) {\n switch (lang) {\n case \"en\":\n return \"Hello World!\";\n break;\n case \"es\":\n return \"Hola mundo!\";\n break;\n case \"de\":\n return \"Hallo Welt!\";\n break;\n default:\n return `Sorry I don't speak ${lang}.`;\n break;\n }\n}", "title": "" }, { "docid": "115dac2da3cd0d95a2c74104a8eecab0", "score": "0.54839045", "text": "async function translateTemplate(){\n\n // for (const locale of settings.locales) {\n // for (const text of titles) {\n // console.log(`Looking up ${text} for ${locale}`);\n // lookupText(text, locale);\n // }\n // }\n}", "title": "" }, { "docid": "b1ed0d76cd3204156933b730e785e5ce", "score": "0.5479419", "text": "function translateSwedish (text) {\n var dictionary = {\n 'merry': 'god',\n 'christmas': 'jul',\n 'and': 'och',\n 'happy': 'gott',\n 'new': 'nytt',\n 'year': 'år'\n }\n var aWords = text.split(' ')\n var translatedText = ''\n\n aWords.forEach( function(word) {\n if ( dictionary.hasOwnProperty(word) ) {\n translatedText+= dictionary[word] + ' '\n }\n })\n\n return translatedText;\n}", "title": "" }, { "docid": "48585898ae7aa5d0a631bd08b6176f3a", "score": "0.547346", "text": "function PortugueseStemmer() {\n var base = new BaseStemmer();\n /** @const */\n var a_0 = [\n [\"\", -1, 3],\n [\"\\u00E3\", 0, 1],\n [\"\\u00F5\", 0, 2]\n ];\n\n /** @const */\n var a_1 = [\n [\"\", -1, 3],\n [\"a~\", 0, 1],\n [\"o~\", 0, 2]\n ];\n\n /** @const */\n var a_2 = [\n [\"ic\", -1, -1],\n [\"ad\", -1, -1],\n [\"os\", -1, -1],\n [\"iv\", -1, 1]\n ];\n\n /** @const */\n var a_3 = [\n [\"ante\", -1, 1],\n [\"avel\", -1, 1],\n [\"\\u00EDvel\", -1, 1]\n ];\n\n /** @const */\n var a_4 = [\n [\"ic\", -1, 1],\n [\"abil\", -1, 1],\n [\"iv\", -1, 1]\n ];\n\n /** @const */\n var a_5 = [\n [\"ica\", -1, 1],\n [\"\\u00E2ncia\", -1, 1],\n [\"\\u00EAncia\", -1, 4],\n [\"logia\", -1, 2],\n [\"ira\", -1, 9],\n [\"adora\", -1, 1],\n [\"osa\", -1, 1],\n [\"ista\", -1, 1],\n [\"iva\", -1, 8],\n [\"eza\", -1, 1],\n [\"idade\", -1, 7],\n [\"ante\", -1, 1],\n [\"mente\", -1, 6],\n [\"amente\", 12, 5],\n [\"\\u00E1vel\", -1, 1],\n [\"\\u00EDvel\", -1, 1],\n [\"ico\", -1, 1],\n [\"ismo\", -1, 1],\n [\"oso\", -1, 1],\n [\"amento\", -1, 1],\n [\"imento\", -1, 1],\n [\"ivo\", -1, 8],\n [\"a\\u00E7a~o\", -1, 1],\n [\"u\\u00E7a~o\", -1, 3],\n [\"ador\", -1, 1],\n [\"icas\", -1, 1],\n [\"\\u00EAncias\", -1, 4],\n [\"logias\", -1, 2],\n [\"iras\", -1, 9],\n [\"adoras\", -1, 1],\n [\"osas\", -1, 1],\n [\"istas\", -1, 1],\n [\"ivas\", -1, 8],\n [\"ezas\", -1, 1],\n [\"idades\", -1, 7],\n [\"adores\", -1, 1],\n [\"antes\", -1, 1],\n [\"a\\u00E7o~es\", -1, 1],\n [\"u\\u00E7o~es\", -1, 3],\n [\"icos\", -1, 1],\n [\"ismos\", -1, 1],\n [\"osos\", -1, 1],\n [\"amentos\", -1, 1],\n [\"imentos\", -1, 1],\n [\"ivos\", -1, 8]\n ];\n\n /** @const */\n var a_6 = [\n [\"ada\", -1, 1],\n [\"ida\", -1, 1],\n [\"ia\", -1, 1],\n [\"aria\", 2, 1],\n [\"eria\", 2, 1],\n [\"iria\", 2, 1],\n [\"ara\", -1, 1],\n [\"era\", -1, 1],\n [\"ira\", -1, 1],\n [\"ava\", -1, 1],\n [\"asse\", -1, 1],\n [\"esse\", -1, 1],\n [\"isse\", -1, 1],\n [\"aste\", -1, 1],\n [\"este\", -1, 1],\n [\"iste\", -1, 1],\n [\"ei\", -1, 1],\n [\"arei\", 16, 1],\n [\"erei\", 16, 1],\n [\"irei\", 16, 1],\n [\"am\", -1, 1],\n [\"iam\", 20, 1],\n [\"ariam\", 21, 1],\n [\"eriam\", 21, 1],\n [\"iriam\", 21, 1],\n [\"aram\", 20, 1],\n [\"eram\", 20, 1],\n [\"iram\", 20, 1],\n [\"avam\", 20, 1],\n [\"em\", -1, 1],\n [\"arem\", 29, 1],\n [\"erem\", 29, 1],\n [\"irem\", 29, 1],\n [\"assem\", 29, 1],\n [\"essem\", 29, 1],\n [\"issem\", 29, 1],\n [\"ado\", -1, 1],\n [\"ido\", -1, 1],\n [\"ando\", -1, 1],\n [\"endo\", -1, 1],\n [\"indo\", -1, 1],\n [\"ara~o\", -1, 1],\n [\"era~o\", -1, 1],\n [\"ira~o\", -1, 1],\n [\"ar\", -1, 1],\n [\"er\", -1, 1],\n [\"ir\", -1, 1],\n [\"as\", -1, 1],\n [\"adas\", 47, 1],\n [\"idas\", 47, 1],\n [\"ias\", 47, 1],\n [\"arias\", 50, 1],\n [\"erias\", 50, 1],\n [\"irias\", 50, 1],\n [\"aras\", 47, 1],\n [\"eras\", 47, 1],\n [\"iras\", 47, 1],\n [\"avas\", 47, 1],\n [\"es\", -1, 1],\n [\"ardes\", 58, 1],\n [\"erdes\", 58, 1],\n [\"irdes\", 58, 1],\n [\"ares\", 58, 1],\n [\"eres\", 58, 1],\n [\"ires\", 58, 1],\n [\"asses\", 58, 1],\n [\"esses\", 58, 1],\n [\"isses\", 58, 1],\n [\"astes\", 58, 1],\n [\"estes\", 58, 1],\n [\"istes\", 58, 1],\n [\"is\", -1, 1],\n [\"ais\", 71, 1],\n [\"eis\", 71, 1],\n [\"areis\", 73, 1],\n [\"ereis\", 73, 1],\n [\"ireis\", 73, 1],\n [\"\\u00E1reis\", 73, 1],\n [\"\\u00E9reis\", 73, 1],\n [\"\\u00EDreis\", 73, 1],\n [\"\\u00E1sseis\", 73, 1],\n [\"\\u00E9sseis\", 73, 1],\n [\"\\u00EDsseis\", 73, 1],\n [\"\\u00E1veis\", 73, 1],\n [\"\\u00EDeis\", 73, 1],\n [\"ar\\u00EDeis\", 84, 1],\n [\"er\\u00EDeis\", 84, 1],\n [\"ir\\u00EDeis\", 84, 1],\n [\"ados\", -1, 1],\n [\"idos\", -1, 1],\n [\"amos\", -1, 1],\n [\"\\u00E1ramos\", 90, 1],\n [\"\\u00E9ramos\", 90, 1],\n [\"\\u00EDramos\", 90, 1],\n [\"\\u00E1vamos\", 90, 1],\n [\"\\u00EDamos\", 90, 1],\n [\"ar\\u00EDamos\", 95, 1],\n [\"er\\u00EDamos\", 95, 1],\n [\"ir\\u00EDamos\", 95, 1],\n [\"emos\", -1, 1],\n [\"aremos\", 99, 1],\n [\"eremos\", 99, 1],\n [\"iremos\", 99, 1],\n [\"\\u00E1ssemos\", 99, 1],\n [\"\\u00EAssemos\", 99, 1],\n [\"\\u00EDssemos\", 99, 1],\n [\"imos\", -1, 1],\n [\"armos\", -1, 1],\n [\"ermos\", -1, 1],\n [\"irmos\", -1, 1],\n [\"\\u00E1mos\", -1, 1],\n [\"ar\\u00E1s\", -1, 1],\n [\"er\\u00E1s\", -1, 1],\n [\"ir\\u00E1s\", -1, 1],\n [\"eu\", -1, 1],\n [\"iu\", -1, 1],\n [\"ou\", -1, 1],\n [\"ar\\u00E1\", -1, 1],\n [\"er\\u00E1\", -1, 1],\n [\"ir\\u00E1\", -1, 1]\n ];\n\n /** @const */\n var a_7 = [\n [\"a\", -1, 1],\n [\"i\", -1, 1],\n [\"o\", -1, 1],\n [\"os\", -1, 1],\n [\"\\u00E1\", -1, 1],\n [\"\\u00ED\", -1, 1],\n [\"\\u00F3\", -1, 1]\n ];\n\n /** @const */\n var a_8 = [\n [\"e\", -1, 1],\n [\"\\u00E7\", -1, 2],\n [\"\\u00E9\", -1, 1],\n [\"\\u00EA\", -1, 1]\n ];\n\n /** @const */\n var /** Array<int> */ g_v = [17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2];\n\n var /** number */ I_p2 = 0;\n var /** number */ I_p1 = 0;\n var /** number */ I_pV = 0;\n\n\n /** @return {boolean} */\n function r_prelude() {\n var /** number */ among_var;\n // repeat, line 36\n replab0: while (true) {\n var /** number */ v_1 = base.cursor;\n lab1: {\n // (, line 36\n // [, line 37\n base.bra = base.cursor;\n // substring, line 37\n among_var = base.find_among(a_0);\n if (among_var == 0) {\n break lab1;\n }\n // ], line 37\n base.ket = base.cursor;\n switch (among_var) {\n case 0:\n break lab1;\n case 1:\n // (, line 38\n // <-, line 38\n if (!base.slice_from(\"a~\")) {\n return false;\n }\n break;\n case 2:\n // (, line 39\n // <-, line 39\n if (!base.slice_from(\"o~\")) {\n return false;\n }\n break;\n case 3:\n // (, line 40\n // next, line 40\n if (base.cursor >= base.limit) {\n break lab1;\n }\n base.cursor++;\n break;\n }\n continue replab0;\n }\n base.cursor = v_1;\n break replab0;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_mark_regions() {\n // (, line 44\n I_pV = base.limit;\n I_p1 = base.limit;\n I_p2 = base.limit;\n // do, line 50\n var /** number */ v_1 = base.cursor;\n lab0: {\n // (, line 50\n // or, line 52\n lab1: {\n var /** number */ v_2 = base.cursor;\n lab2: {\n // (, line 51\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab2;\n }\n // or, line 51\n lab3: {\n var /** number */ v_3 = base.cursor;\n lab4: {\n // (, line 51\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab4;\n }\n // gopast, line 51\n golab5: while (true) {\n lab6: {\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab6;\n }\n break golab5;\n }\n if (base.cursor >= base.limit) {\n break lab4;\n }\n base.cursor++;\n }\n break lab3;\n }\n base.cursor = v_3;\n // (, line 51\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab2;\n }\n // gopast, line 51\n golab7: while (true) {\n lab8: {\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab8;\n }\n break golab7;\n }\n if (base.cursor >= base.limit) {\n break lab2;\n }\n base.cursor++;\n }\n }\n break lab1;\n }\n base.cursor = v_2;\n // (, line 53\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab0;\n }\n // or, line 53\n lab9: {\n var /** number */ v_6 = base.cursor;\n lab10: {\n // (, line 53\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab10;\n }\n // gopast, line 53\n golab11: while (true) {\n lab12: {\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab12;\n }\n break golab11;\n }\n if (base.cursor >= base.limit) {\n break lab10;\n }\n base.cursor++;\n }\n break lab9;\n }\n base.cursor = v_6;\n // (, line 53\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab0;\n }\n // next, line 53\n if (base.cursor >= base.limit) {\n break lab0;\n }\n base.cursor++;\n }\n }\n // setmark pV, line 54\n I_pV = base.cursor;\n }\n base.cursor = v_1;\n // do, line 56\n var /** number */ v_8 = base.cursor;\n lab13: {\n // (, line 56\n // gopast, line 57\n golab14: while (true) {\n lab15: {\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab15;\n }\n break golab14;\n }\n if (base.cursor >= base.limit) {\n break lab13;\n }\n base.cursor++;\n }\n // gopast, line 57\n golab16: while (true) {\n lab17: {\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab17;\n }\n break golab16;\n }\n if (base.cursor >= base.limit) {\n break lab13;\n }\n base.cursor++;\n }\n // setmark p1, line 57\n I_p1 = base.cursor;\n // gopast, line 58\n golab18: while (true) {\n lab19: {\n if (!(base.in_grouping(g_v, 97, 250))) {\n break lab19;\n }\n break golab18;\n }\n if (base.cursor >= base.limit) {\n break lab13;\n }\n base.cursor++;\n }\n // gopast, line 58\n golab20: while (true) {\n lab21: {\n if (!(base.out_grouping(g_v, 97, 250))) {\n break lab21;\n }\n break golab20;\n }\n if (base.cursor >= base.limit) {\n break lab13;\n }\n base.cursor++;\n }\n // setmark p2, line 58\n I_p2 = base.cursor;\n }\n base.cursor = v_8;\n return true;\n };\n\n /** @return {boolean} */\n function r_postlude() {\n var /** number */ among_var;\n // repeat, line 62\n replab0: while (true) {\n var /** number */ v_1 = base.cursor;\n lab1: {\n // (, line 62\n // [, line 63\n base.bra = base.cursor;\n // substring, line 63\n among_var = base.find_among(a_1);\n if (among_var == 0) {\n break lab1;\n }\n // ], line 63\n base.ket = base.cursor;\n switch (among_var) {\n case 0:\n break lab1;\n case 1:\n // (, line 64\n // <-, line 64\n if (!base.slice_from(\"\\u00E3\")) {\n return false;\n }\n break;\n case 2:\n // (, line 65\n // <-, line 65\n if (!base.slice_from(\"\\u00F5\")) {\n return false;\n }\n break;\n case 3:\n // (, line 66\n // next, line 66\n if (base.cursor >= base.limit) {\n break lab1;\n }\n base.cursor++;\n break;\n }\n continue replab0;\n }\n base.cursor = v_1;\n break replab0;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_RV() {\n if (!(I_pV <= base.cursor)) {\n return false;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_R1() {\n if (!(I_p1 <= base.cursor)) {\n return false;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_R2() {\n if (!(I_p2 <= base.cursor)) {\n return false;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_standard_suffix() {\n var /** number */ among_var;\n // (, line 76\n // [, line 77\n base.ket = base.cursor;\n // substring, line 77\n among_var = base.find_among_b(a_5);\n if (among_var == 0) {\n return false;\n }\n // ], line 77\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n return false;\n case 1:\n // (, line 92\n // call R2, line 93\n if (!r_R2()) {\n return false;\n }\n // delete, line 93\n if (!base.slice_del()) {\n return false;\n }\n break;\n case 2:\n // (, line 97\n // call R2, line 98\n if (!r_R2()) {\n return false;\n }\n // <-, line 98\n if (!base.slice_from(\"log\")) {\n return false;\n }\n break;\n case 3:\n // (, line 101\n // call R2, line 102\n if (!r_R2()) {\n return false;\n }\n // <-, line 102\n if (!base.slice_from(\"u\")) {\n return false;\n }\n break;\n case 4:\n // (, line 105\n // call R2, line 106\n if (!r_R2()) {\n return false;\n }\n // <-, line 106\n if (!base.slice_from(\"ente\")) {\n return false;\n }\n break;\n case 5:\n // (, line 109\n // call R1, line 110\n if (!r_R1()) {\n return false;\n }\n // delete, line 110\n if (!base.slice_del()) {\n return false;\n }\n // try, line 111\n var /** number */ v_1 = base.limit - base.cursor;\n lab0: {\n // (, line 111\n // [, line 112\n base.ket = base.cursor;\n // substring, line 112\n among_var = base.find_among_b(a_2);\n if (among_var == 0) {\n base.cursor = base.limit - v_1;\n break lab0;\n }\n // ], line 112\n base.bra = base.cursor;\n // call R2, line 112\n if (!r_R2()) {\n base.cursor = base.limit - v_1;\n break lab0;\n }\n // delete, line 112\n if (!base.slice_del()) {\n return false;\n }\n switch (among_var) {\n case 0:\n base.cursor = base.limit - v_1;\n break lab0;\n case 1:\n // (, line 113\n // [, line 113\n base.ket = base.cursor;\n // literal, line 113\n if (!(base.eq_s_b(\"at\"))) {\n base.cursor = base.limit - v_1;\n break lab0;\n }\n // ], line 113\n base.bra = base.cursor;\n // call R2, line 113\n if (!r_R2()) {\n base.cursor = base.limit - v_1;\n break lab0;\n }\n // delete, line 113\n if (!base.slice_del()) {\n return false;\n }\n break;\n }\n }\n break;\n case 6:\n // (, line 121\n // call R2, line 122\n if (!r_R2()) {\n return false;\n }\n // delete, line 122\n if (!base.slice_del()) {\n return false;\n }\n // try, line 123\n var /** number */ v_2 = base.limit - base.cursor;\n lab1: {\n // (, line 123\n // [, line 124\n base.ket = base.cursor;\n // substring, line 124\n among_var = base.find_among_b(a_3);\n if (among_var == 0) {\n base.cursor = base.limit - v_2;\n break lab1;\n }\n // ], line 124\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n base.cursor = base.limit - v_2;\n break lab1;\n case 1:\n // (, line 127\n // call R2, line 127\n if (!r_R2()) {\n base.cursor = base.limit - v_2;\n break lab1;\n }\n // delete, line 127\n if (!base.slice_del()) {\n return false;\n }\n break;\n }\n }\n break;\n case 7:\n // (, line 133\n // call R2, line 134\n if (!r_R2()) {\n return false;\n }\n // delete, line 134\n if (!base.slice_del()) {\n return false;\n }\n // try, line 135\n var /** number */ v_3 = base.limit - base.cursor;\n lab2: {\n // (, line 135\n // [, line 136\n base.ket = base.cursor;\n // substring, line 136\n among_var = base.find_among_b(a_4);\n if (among_var == 0) {\n base.cursor = base.limit - v_3;\n break lab2;\n }\n // ], line 136\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n base.cursor = base.limit - v_3;\n break lab2;\n case 1:\n // (, line 139\n // call R2, line 139\n if (!r_R2()) {\n base.cursor = base.limit - v_3;\n break lab2;\n }\n // delete, line 139\n if (!base.slice_del()) {\n return false;\n }\n break;\n }\n }\n break;\n case 8:\n // (, line 145\n // call R2, line 146\n if (!r_R2()) {\n return false;\n }\n // delete, line 146\n if (!base.slice_del()) {\n return false;\n }\n // try, line 147\n var /** number */ v_4 = base.limit - base.cursor;\n lab3: {\n // (, line 147\n // [, line 148\n base.ket = base.cursor;\n // literal, line 148\n if (!(base.eq_s_b(\"at\"))) {\n base.cursor = base.limit - v_4;\n break lab3;\n }\n // ], line 148\n base.bra = base.cursor;\n // call R2, line 148\n if (!r_R2()) {\n base.cursor = base.limit - v_4;\n break lab3;\n }\n // delete, line 148\n if (!base.slice_del()) {\n return false;\n }\n }\n break;\n case 9:\n // (, line 152\n // call RV, line 153\n if (!r_RV()) {\n return false;\n }\n // literal, line 153\n if (!(base.eq_s_b(\"e\"))) {\n return false;\n }\n // <-, line 154\n if (!base.slice_from(\"ir\")) {\n return false;\n }\n break;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_verb_suffix() {\n var /** number */ among_var;\n // setlimit, line 159\n var /** number */ v_1 = base.limit - base.cursor;\n // tomark, line 159\n if (base.cursor < I_pV) {\n return false;\n }\n base.cursor = I_pV;\n var /** number */ v_2 = base.limit_backward;\n base.limit_backward = base.cursor;\n base.cursor = base.limit - v_1;\n // (, line 159\n // [, line 160\n base.ket = base.cursor;\n // substring, line 160\n among_var = base.find_among_b(a_6);\n if (among_var == 0) {\n base.limit_backward = v_2;\n return false;\n }\n // ], line 160\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n base.limit_backward = v_2;\n return false;\n case 1:\n // (, line 179\n // delete, line 179\n if (!base.slice_del()) {\n return false;\n }\n break;\n }\n base.limit_backward = v_2;\n return true;\n };\n\n /** @return {boolean} */\n function r_residual_suffix() {\n var /** number */ among_var;\n // (, line 183\n // [, line 184\n base.ket = base.cursor;\n // substring, line 184\n among_var = base.find_among_b(a_7);\n if (among_var == 0) {\n return false;\n }\n // ], line 184\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n return false;\n case 1:\n // (, line 187\n // call RV, line 187\n if (!r_RV()) {\n return false;\n }\n // delete, line 187\n if (!base.slice_del()) {\n return false;\n }\n break;\n }\n return true;\n };\n\n /** @return {boolean} */\n function r_residual_form() {\n var /** number */ among_var;\n // (, line 191\n // [, line 192\n base.ket = base.cursor;\n // substring, line 192\n among_var = base.find_among_b(a_8);\n if (among_var == 0) {\n return false;\n }\n // ], line 192\n base.bra = base.cursor;\n switch (among_var) {\n case 0:\n return false;\n case 1:\n // (, line 194\n // call RV, line 194\n if (!r_RV()) {\n return false;\n }\n // delete, line 194\n if (!base.slice_del()) {\n return false;\n }\n // [, line 194\n base.ket = base.cursor;\n // or, line 194\n lab0: {\n var /** number */ v_1 = base.limit - base.cursor;\n lab1: {\n // (, line 194\n // literal, line 194\n if (!(base.eq_s_b(\"u\"))) {\n break lab1;\n }\n // ], line 194\n base.bra = base.cursor;\n // test, line 194\n var /** number */ v_2 = base.limit - base.cursor;\n // literal, line 194\n if (!(base.eq_s_b(\"g\"))) {\n break lab1;\n }\n base.cursor = base.limit - v_2;\n break lab0;\n }\n base.cursor = base.limit - v_1;\n // (, line 195\n // literal, line 195\n if (!(base.eq_s_b(\"i\"))) {\n return false;\n }\n // ], line 195\n base.bra = base.cursor;\n // test, line 195\n var /** number */ v_3 = base.limit - base.cursor;\n // literal, line 195\n if (!(base.eq_s_b(\"c\"))) {\n return false;\n }\n base.cursor = base.limit - v_3;\n }\n // call RV, line 195\n if (!r_RV()) {\n return false;\n }\n // delete, line 195\n if (!base.slice_del()) {\n return false;\n }\n break;\n case 2:\n // (, line 196\n // <-, line 196\n if (!base.slice_from(\"c\")) {\n return false;\n }\n break;\n }\n return true;\n };\n\n this.stem = /** @return {boolean} */ function() {\n // (, line 201\n // do, line 202\n var /** number */ v_1 = base.cursor;\n lab0: {\n // call prelude, line 202\n if (!r_prelude()) {\n break lab0;\n }\n }\n base.cursor = v_1;\n // do, line 203\n var /** number */ v_2 = base.cursor;\n lab1: {\n // call mark_regions, line 203\n if (!r_mark_regions()) {\n break lab1;\n }\n }\n base.cursor = v_2;\n // backwards, line 204\n base.limit_backward = base.cursor;\n base.cursor = base.limit;\n // (, line 204\n // do, line 205\n var /** number */ v_3 = base.limit - base.cursor;\n lab2: {\n // (, line 205\n // or, line 209\n lab3: {\n var /** number */ v_4 = base.limit - base.cursor;\n lab4: {\n // (, line 206\n // and, line 207\n var /** number */ v_5 = base.limit - base.cursor;\n // (, line 206\n // or, line 206\n lab5: {\n var /** number */ v_6 = base.limit - base.cursor;\n lab6: {\n // call standard_suffix, line 206\n if (!r_standard_suffix()) {\n break lab6;\n }\n break lab5;\n }\n base.cursor = base.limit - v_6;\n // call verb_suffix, line 206\n if (!r_verb_suffix()) {\n break lab4;\n }\n }\n base.cursor = base.limit - v_5;\n // do, line 207\n var /** number */ v_7 = base.limit - base.cursor;\n lab7: {\n // (, line 207\n // [, line 207\n base.ket = base.cursor;\n // literal, line 207\n if (!(base.eq_s_b(\"i\"))) {\n break lab7;\n }\n // ], line 207\n base.bra = base.cursor;\n // test, line 207\n var /** number */ v_8 = base.limit - base.cursor;\n // literal, line 207\n if (!(base.eq_s_b(\"c\"))) {\n break lab7;\n }\n base.cursor = base.limit - v_8;\n // call RV, line 207\n if (!r_RV()) {\n break lab7;\n }\n // delete, line 207\n if (!base.slice_del()) {\n return false;\n }\n }\n base.cursor = base.limit - v_7;\n break lab3;\n }\n base.cursor = base.limit - v_4;\n // call residual_suffix, line 209\n if (!r_residual_suffix()) {\n break lab2;\n }\n }\n }\n base.cursor = base.limit - v_3;\n // do, line 211\n var /** number */ v_9 = base.limit - base.cursor;\n lab8: {\n // call residual_form, line 211\n if (!r_residual_form()) {\n break lab8;\n }\n }\n base.cursor = base.limit - v_9;\n base.cursor = base.limit_backward; // do, line 213\n var /** number */ v_10 = base.cursor;\n lab9: {\n // call postlude, line 213\n if (!r_postlude()) {\n break lab9;\n }\n }\n base.cursor = v_10;\n return true;\n };\n\n /**@return{string}*/\n this['stemWord'] = function( /**string*/ word) {\n base.setCurrent(word);\n this.stem();\n return base.getCurrent();\n };\n }", "title": "" }, { "docid": "9c48083d307b86577274471c5f0adad0", "score": "0.5465059", "text": "function translate(){\n\t//Translate sentences\n\t$(\".TS\").each(function(){\n\t\tvar elementClass=$(this).attr('class');\n\t\tvar classes=elementClass.split(' ');\n\t\t\n\t\t//Determines the upper of the string (if applies)\n\t\tvar upper='';\n\t\tif($(this).hasClass('ucfirst')){\t//First letter upper\n\t\t\tupper='ucfirst';\n\t\t}\n\t\telse if($(this).hasClass('upper')){\t//All the sentence upper\n\t\t\tupper='upper';\n\t\t}\n\t\t\n\t\tif($(this).html()!=''){\n\t\t\t$(this).html(translateSentence(classes[1], upper, settings[\"language\"]));\n\t\t}\n\t\telse if($(this).val()!=''){\n\t\t\t$(this).val(translateSentence(classes[1], upper, settings[\"language\"]));\t\n\t\t}\n\t});\n\t\n\t//Translate words\n\t$(\".TW\").each(function(){\n\t\t//Determines the upper of the string (if applies)\n\t\tvar upper='';\n\t\tif($(this).hasClass('ucfirst')){\t//First letter upper\n\t\t\tupper='ucfirst';\n\t\t}\n\t\telse if($(this).hasClass('upper')){\t//All the sentence upper\n\t\t\tupper='upper';\n\t\t}\n\t\t\n\t\tif($(this).html()!=''){\n\t\t\t$(this).html(translateWord($(this).html(), upper, settings[\"language\"]));\n\t\t}\n\t\telse if($(this).val()!=''){\n\t\t\t$(this).val(translateWord($(this).val(), upper, settings[\"language\"]));\t\n\t\t}\n\t});\n}", "title": "" }, { "docid": "1555aa427bc9b03eebdeb1983bb82c6c", "score": "0.546389", "text": "function spEng(sentence) {\n //write your code here\n var eng = /english/gi;\n if (sentence.match(eng)) {\n return true;\n }\n return false;\n}", "title": "" }, { "docid": "357fa09af828216c8b5781e8414e42fd", "score": "0.5463189", "text": "function translate_sentence(sentence) {\n\tif (selected_language !== 'en') {\n\t\tif (hash_language[sentence] === null || typeof hash_language[sentence] === 'undefined') {return(sentence); }\n\t\telse { return (hash_language[sentence]); }\n\t} else { return(sentence); }\n}", "title": "" }, { "docid": "87c23dcb7ff2e9bacedb9c885303d9ea", "score": "0.54581994", "text": "function helloWorld(langCode){\n if (langCode == \"es\"){\n return \"Hola, mundo\";\n }else if (langCode == \"eo\"){\n return \"Saluton, mondo\";\n }else if (langCode == \"fr\"){\n return \"Bonjour, monde\";\n }else{\n return \"Hello, world\";\n }\n}", "title": "" }, { "docid": "f612ecde643a492fcf5f743243f2fc38", "score": "0.5457893", "text": "function helloWorld (language) {\n if (language=\"es\") cc(\"Hola\")\n else if (language=\"de\") cc(\"Hallo\")\n else cc(\"Hello\")\n}", "title": "" }, { "docid": "1551241f47d9b4e91c42dea6a9b7189b", "score": "0.5457738", "text": "function googleTTSLang(target) {\n if (target == \"dn\") {\n return \"nl\";\n }\n if (target == \"zs\") {\n return \"zh\";\n }\n return target;\n}", "title": "" }, { "docid": "f8af21e6ab442a44e35da45f452bbd42", "score": "0.54425836", "text": "function translate (keyword, lang, site) {\n var ref = site + '_' + (lang || 'en'); \n // pick the right dictionary\n var local = locales[ref];\n // loop through all the key hierarchy (if any)\n var target = local;\n var default_ref = site + '_en';\n var default_dict = locales[default_ref];\n var keys = keyword.split(\".\");\n keys.forEach(function (key){\n if (target[key]) {\n target = target[key];\n } else {\n target = default_dict[key];\n }\n });\n //output\n return target;\n}", "title": "" }, { "docid": "db3b717770eab8bb43906f3d782be90c", "score": "0.5435459", "text": "function Language(name, author, watchers, stars, forks) {\n this.name = name;\n this.author = author;\n this.watchers = watchers;\n this.stars = stars;\n this.forks = forks;\n}", "title": "" }, { "docid": "591d3629e299d7dde175cc75e9e04eca", "score": "0.5435339", "text": "async function getSingularAndPlural(word) {\n let definition = await getDefinition(word);\n if(definition != null && definition[\"inflexiones\"] != null) {\n let inflexiones = definition[\"inflexiones\"];\n inflexiones = inflexiones.trim();\n inflexiones = inflexiones.replace(\"\\n\", \"\");\n let items = inflexiones.split(\"Inflexiones de\");\n \n //first get singular\n let singular;\n for(let item of items) {\n //const reg = new RegExp(\"\\\\'(?[\\\\s\\\\S]*)\\\\'\", \"gm\");\n const regex = /'(?<sing>[\\s\\S]*)'/gi\n while ((result = regex.exec(item))) {\n if(result.groups != null && result.groups.sing != null) {\n singular = result.groups.sing;\n break;\n }\n }\n if (singular) break;\n }\n \n //After get plural\n let plurals = [];\n for(let item of items) {\n if(item.includes(\"pl: \")) {\n let temp = item.match(new RegExp(\"(?<=pl: ).*\", \"gm\"));\n if(temp != null && temp.length > 0) {\n temp = temp[0]\n if(temp.includes(\"Del verbo\")) {\n temp = temp.match(new RegExp(\".+?(?=Del verbo)\", \"gm\"));\n if(temp != null && temp.length > 0) temp = temp[0]\n } \n plurals.push(temp);\n }\n }\n }\n return {\n singular: singular || \"-\",\n plural: plurals[0] || \"-\"\n }\n } else return null;\n}", "title": "" }, { "docid": "1e45a12df1d0511b3fe09528647263fc", "score": "0.54245067", "text": "translat(text, wordDiffAndSpelling, titles) {\n const textLowerCase = text.toLowerCase();\n let translated;\n const timeRegex = /(([0-9]|0[0-9]|1[0-9]|2[0-3])(:|\\.)([0-5][0-9]))/g;\n\n // searching for Titles and replace them\n Object.entries(titles) //[ [key1, value1],[key1, value1] ]\n .map(([key, value]) => {\n if (textLowerCase.includes(key)) {\n translated = text.replace(new RegExp(key, \"gi\"), `<span class=\"highlight\">${this.capitalizeFirstLetter(value)}</span>`) || text;\n }\n })\n\n translated = translated || text; //make sure that translated not null || undefiend\n\n\n // change time format 12:15 <=> 12.15\n const changeTime = textLowerCase.match(timeRegex); //['12.15','11.15']\n if (changeTime) {\n changeTime.map(time => {\n translated = translated.replace(time, `<span class=\"highlight\">${time.replace(':', '.')}</span>`) || text;\n })\n }\n\n // replace words that are diffrent and check Spelling\n // a word can be in the middle or in the end of the string\n // 'ta' or 'ta!' or 'ta654' will translated to thank you *\n Object.entries(wordDiffAndSpelling)\n .map(([key, value]) => {\n if (new RegExp(`${key} `, \"gi\").test(textLowerCase) ||\n new RegExp(`${key}[^A-Za-z]`, \"gi\").test(textLowerCase) ||\n new RegExp(`${key}$`, \"gi\").test(textLowerCase)) {\n\n translated = translated.replace(new RegExp(key, \"gi\"), `<span class=\"highlight\">${value}</span>`) || text;\n }\n });\n\n return translated || text;\n }", "title": "" }, { "docid": "a8ba9d465bfcc2223ffd564f06e995b9", "score": "0.54219025", "text": "function tokenizeText() {\n\t registerContextChecker.call(this, 'latinWord');\n\t registerContextChecker.call(this, 'arabicWord');\n\t registerContextChecker.call(this, 'arabicSentence');\n\t return this.tokenizer.tokenize(this.text);\n\t}", "title": "" }, { "docid": "d063a0b19ab6956048982ffac45ed86f", "score": "0.5421221", "text": "function lalaLanguage(str) {\n let words = str.split(\" \");\n let result = []\n for (let i = 0; i < words.length; i++) {\n let word = words[i]\n if (word.length > 3) {\n let newWord = changeWord(word)\n result.push(newWord)\n } else {\n result.push(word)\n }\n }\n return result.join(\" \")\n}", "title": "" }, { "docid": "fa670f89b23d3f3ec68d2944142b4ff9", "score": "0.5420959", "text": "function tokenize($text) {\n\tvar tokens = [], lemmatokens = [];\n\tvar doc = nlp($text);\n\tvar sentences = doc.sentences().json();\n\t//console.log(sentences)\n\n\t// each sentence in semantic\n\tsentences.forEach(obj => {\n\t\tlet sentence = obj.text.replace(/[.]/g, '');\t// clear .\n\t\tlet subsentences = sentence.split(/[,?!:;()\\[\\]\"]/);\n\n\t\t// sub sentence (smallest unit for n-gram calculation)\n\t\tsubsentences.forEach(value => {\n\t\t\tlet subsentence = value.trim();\n\t\t\tif (subsentence === '') return;\n\n\t\t\t// normalize word\n\t\t\tlet normsentence = normalize(subsentence);\n\n\t\t\t// lemmatization\n\t\t\tlet lemmasubsentence = lemmatize(normsentence);\n\n\t\t\t// fin\n\t\t\ttokens.push(normsentence.split(' '));\n\t\t\tlemmatokens.push(lemmasubsentence.split(' '));\n\t\t});\n\t});\n\n\t//console.log(tokens);\n\t//console.log(lemmatokens);\n\treturn [tokens, lemmatokens];\n}", "title": "" }, { "docid": "43abcb8e598b03c73fd123d25b311d89", "score": "0.54099816", "text": "function reasonml(hljs) {\n function orReValues(ops) {\n return ops\n .map(function(op) {\n return op\n .split('')\n .map(function(char) {\n return '\\\\' + char;\n })\n .join('');\n })\n .join('|');\n }\n\n const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';\n const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';\n\n const RE_PARAM_TYPEPARAM = '\\'?[a-z$_][0-9a-z$_]*';\n const RE_PARAM_TYPE = '\\\\s*:\\\\s*[a-z$_][0-9a-z$_]*(\\\\(\\\\s*(' + RE_PARAM_TYPEPARAM + '\\\\s*(,' + RE_PARAM_TYPEPARAM + '\\\\s*)*)?\\\\))?';\n const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}';\n const RE_OPERATOR = \"(\" + orReValues([\n '||',\n '++',\n '**',\n '+.',\n '*',\n '/',\n '*.',\n '/.',\n '...'\n ]) + \"|\\\\|>|&&|==|===)\";\n const RE_OPERATOR_SPACED = \"\\\\s+\" + RE_OPERATOR + \"\\\\s+\";\n\n const KEYWORDS = {\n keyword:\n 'and as asr assert begin class constraint do done downto else end exception external ' +\n 'for fun function functor if in include inherit initializer ' +\n 'land lazy let lor lsl lsr lxor match method mod module mutable new nonrec ' +\n 'object of open or private rec sig struct then to try type val virtual when while with',\n built_in:\n 'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ',\n literal:\n 'true false'\n };\n\n const RE_NUMBER = '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)';\n\n const NUMBER_MODE = {\n className: 'number',\n relevance: 0,\n variants: [\n {\n begin: RE_NUMBER\n },\n {\n begin: '\\\\(-' + RE_NUMBER + '\\\\)'\n }\n ]\n };\n\n const OPERATOR_MODE = {\n className: 'operator',\n relevance: 0,\n begin: RE_OPERATOR\n };\n const LIST_CONTENTS_MODES = [\n {\n className: 'identifier',\n relevance: 0,\n begin: RE_IDENT\n },\n OPERATOR_MODE,\n NUMBER_MODE\n ];\n\n const MODULE_ACCESS_CONTENTS = [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_CONTENTS = [\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n relevance: 0,\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_MODE = {\n begin: RE_IDENT,\n end: '(,|\\\\n|\\\\))',\n relevance: 0,\n contains: [\n OPERATOR_MODE,\n {\n className: 'typing',\n begin: ':',\n end: '(,|\\\\n)',\n returnBegin: true,\n relevance: 0,\n contains: PARAMS_CONTENTS\n }\n ]\n };\n\n const FUNCTION_BLOCK_MODE = {\n className: 'function',\n relevance: 0,\n keywords: KEYWORDS,\n variants: [\n {\n begin: '\\\\s(\\\\(\\\\.?.*?\\\\)|' + RE_IDENT + ')\\\\s*=>',\n end: '\\\\s*=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: RE_IDENT\n },\n {\n begin: RE_PARAM\n },\n {\n begin: /\\(\\s*\\)/\n }\n ]\n }\n ]\n },\n {\n begin: '\\\\s\\\\(\\\\.?[^;\\\\|]*\\\\)\\\\s*=>',\n end: '\\\\s=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n relevance: 0,\n variants: [ PARAMS_MODE ]\n }\n ]\n },\n {\n begin: '\\\\(\\\\.\\\\s' + RE_IDENT + '\\\\)\\\\s*=>'\n }\n ]\n };\n MODULE_ACCESS_CONTENTS.push(FUNCTION_BLOCK_MODE);\n\n const CONSTRUCTOR_MODE = {\n className: 'constructor',\n begin: RE_MODULE_IDENT + '\\\\(',\n end: '\\\\)',\n illegal: '\\\\n',\n keywords: KEYWORDS,\n contains: [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'params',\n begin: '\\\\b' + RE_IDENT\n }\n ]\n };\n\n const PATTERN_MATCH_BLOCK_MODE = {\n className: 'pattern-match',\n begin: '\\\\|',\n returnBegin: true,\n keywords: KEYWORDS,\n end: '=>',\n relevance: 0,\n contains: [\n CONSTRUCTOR_MODE,\n OPERATOR_MODE,\n {\n relevance: 0,\n className: 'constructor',\n begin: RE_MODULE_IDENT\n }\n ]\n };\n\n const MODULE_ACCESS_MODE = {\n className: 'module-access',\n keywords: KEYWORDS,\n returnBegin: true,\n variants: [\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\" + RE_IDENT\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\(\",\n end: \"\\\\)\",\n returnBegin: true,\n contains: [\n FUNCTION_BLOCK_MODE,\n {\n begin: '\\\\(',\n end: '\\\\)',\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\{\",\n end: /\\}/\n }\n ],\n contains: MODULE_ACCESS_CONTENTS\n };\n\n PARAMS_CONTENTS.push(MODULE_ACCESS_MODE);\n\n return {\n name: 'ReasonML',\n aliases: [ 're' ],\n keywords: KEYWORDS,\n illegal: '(:-|:=|\\\\$\\\\{|\\\\+=)',\n contains: [\n hljs.COMMENT('/\\\\*', '\\\\*/', {\n illegal: '^(#,\\\\/\\\\/)'\n }),\n {\n className: 'character',\n begin: '\\'(\\\\\\\\[^\\']+|[^\\'])\\'',\n illegal: '\\\\n',\n relevance: 0\n },\n hljs.QUOTE_STRING_MODE,\n {\n className: 'literal',\n begin: '\\\\(\\\\)',\n relevance: 0\n },\n {\n className: 'literal',\n begin: '\\\\[\\\\|',\n end: '\\\\|\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n {\n className: 'literal',\n begin: '\\\\[',\n end: '\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n CONSTRUCTOR_MODE,\n {\n className: 'operator',\n begin: RE_OPERATOR_SPACED,\n illegal: '-->',\n relevance: 0\n },\n NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n PATTERN_MATCH_BLOCK_MODE,\n FUNCTION_BLOCK_MODE,\n {\n className: 'module-def',\n begin: \"\\\\bmodule\\\\s+\" + RE_IDENT + \"\\\\s+\" + RE_MODULE_IDENT + \"\\\\s+=\\\\s+\\\\{\",\n end: /\\}/,\n returnBegin: true,\n keywords: KEYWORDS,\n relevance: 0,\n contains: [\n {\n className: 'module',\n relevance: 0,\n begin: RE_MODULE_IDENT\n },\n {\n begin: /\\{/,\n end: /\\}/,\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n MODULE_ACCESS_MODE\n ]\n };\n}", "title": "" }, { "docid": "43abcb8e598b03c73fd123d25b311d89", "score": "0.54099816", "text": "function reasonml(hljs) {\n function orReValues(ops) {\n return ops\n .map(function(op) {\n return op\n .split('')\n .map(function(char) {\n return '\\\\' + char;\n })\n .join('');\n })\n .join('|');\n }\n\n const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';\n const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';\n\n const RE_PARAM_TYPEPARAM = '\\'?[a-z$_][0-9a-z$_]*';\n const RE_PARAM_TYPE = '\\\\s*:\\\\s*[a-z$_][0-9a-z$_]*(\\\\(\\\\s*(' + RE_PARAM_TYPEPARAM + '\\\\s*(,' + RE_PARAM_TYPEPARAM + '\\\\s*)*)?\\\\))?';\n const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}';\n const RE_OPERATOR = \"(\" + orReValues([\n '||',\n '++',\n '**',\n '+.',\n '*',\n '/',\n '*.',\n '/.',\n '...'\n ]) + \"|\\\\|>|&&|==|===)\";\n const RE_OPERATOR_SPACED = \"\\\\s+\" + RE_OPERATOR + \"\\\\s+\";\n\n const KEYWORDS = {\n keyword:\n 'and as asr assert begin class constraint do done downto else end exception external ' +\n 'for fun function functor if in include inherit initializer ' +\n 'land lazy let lor lsl lsr lxor match method mod module mutable new nonrec ' +\n 'object of open or private rec sig struct then to try type val virtual when while with',\n built_in:\n 'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ',\n literal:\n 'true false'\n };\n\n const RE_NUMBER = '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)';\n\n const NUMBER_MODE = {\n className: 'number',\n relevance: 0,\n variants: [\n {\n begin: RE_NUMBER\n },\n {\n begin: '\\\\(-' + RE_NUMBER + '\\\\)'\n }\n ]\n };\n\n const OPERATOR_MODE = {\n className: 'operator',\n relevance: 0,\n begin: RE_OPERATOR\n };\n const LIST_CONTENTS_MODES = [\n {\n className: 'identifier',\n relevance: 0,\n begin: RE_IDENT\n },\n OPERATOR_MODE,\n NUMBER_MODE\n ];\n\n const MODULE_ACCESS_CONTENTS = [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_CONTENTS = [\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n relevance: 0,\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_MODE = {\n begin: RE_IDENT,\n end: '(,|\\\\n|\\\\))',\n relevance: 0,\n contains: [\n OPERATOR_MODE,\n {\n className: 'typing',\n begin: ':',\n end: '(,|\\\\n)',\n returnBegin: true,\n relevance: 0,\n contains: PARAMS_CONTENTS\n }\n ]\n };\n\n const FUNCTION_BLOCK_MODE = {\n className: 'function',\n relevance: 0,\n keywords: KEYWORDS,\n variants: [\n {\n begin: '\\\\s(\\\\(\\\\.?.*?\\\\)|' + RE_IDENT + ')\\\\s*=>',\n end: '\\\\s*=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: RE_IDENT\n },\n {\n begin: RE_PARAM\n },\n {\n begin: /\\(\\s*\\)/\n }\n ]\n }\n ]\n },\n {\n begin: '\\\\s\\\\(\\\\.?[^;\\\\|]*\\\\)\\\\s*=>',\n end: '\\\\s=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n relevance: 0,\n variants: [ PARAMS_MODE ]\n }\n ]\n },\n {\n begin: '\\\\(\\\\.\\\\s' + RE_IDENT + '\\\\)\\\\s*=>'\n }\n ]\n };\n MODULE_ACCESS_CONTENTS.push(FUNCTION_BLOCK_MODE);\n\n const CONSTRUCTOR_MODE = {\n className: 'constructor',\n begin: RE_MODULE_IDENT + '\\\\(',\n end: '\\\\)',\n illegal: '\\\\n',\n keywords: KEYWORDS,\n contains: [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'params',\n begin: '\\\\b' + RE_IDENT\n }\n ]\n };\n\n const PATTERN_MATCH_BLOCK_MODE = {\n className: 'pattern-match',\n begin: '\\\\|',\n returnBegin: true,\n keywords: KEYWORDS,\n end: '=>',\n relevance: 0,\n contains: [\n CONSTRUCTOR_MODE,\n OPERATOR_MODE,\n {\n relevance: 0,\n className: 'constructor',\n begin: RE_MODULE_IDENT\n }\n ]\n };\n\n const MODULE_ACCESS_MODE = {\n className: 'module-access',\n keywords: KEYWORDS,\n returnBegin: true,\n variants: [\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\" + RE_IDENT\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\(\",\n end: \"\\\\)\",\n returnBegin: true,\n contains: [\n FUNCTION_BLOCK_MODE,\n {\n begin: '\\\\(',\n end: '\\\\)',\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\{\",\n end: /\\}/\n }\n ],\n contains: MODULE_ACCESS_CONTENTS\n };\n\n PARAMS_CONTENTS.push(MODULE_ACCESS_MODE);\n\n return {\n name: 'ReasonML',\n aliases: [ 're' ],\n keywords: KEYWORDS,\n illegal: '(:-|:=|\\\\$\\\\{|\\\\+=)',\n contains: [\n hljs.COMMENT('/\\\\*', '\\\\*/', {\n illegal: '^(#,\\\\/\\\\/)'\n }),\n {\n className: 'character',\n begin: '\\'(\\\\\\\\[^\\']+|[^\\'])\\'',\n illegal: '\\\\n',\n relevance: 0\n },\n hljs.QUOTE_STRING_MODE,\n {\n className: 'literal',\n begin: '\\\\(\\\\)',\n relevance: 0\n },\n {\n className: 'literal',\n begin: '\\\\[\\\\|',\n end: '\\\\|\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n {\n className: 'literal',\n begin: '\\\\[',\n end: '\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n CONSTRUCTOR_MODE,\n {\n className: 'operator',\n begin: RE_OPERATOR_SPACED,\n illegal: '-->',\n relevance: 0\n },\n NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n PATTERN_MATCH_BLOCK_MODE,\n FUNCTION_BLOCK_MODE,\n {\n className: 'module-def',\n begin: \"\\\\bmodule\\\\s+\" + RE_IDENT + \"\\\\s+\" + RE_MODULE_IDENT + \"\\\\s+=\\\\s+\\\\{\",\n end: /\\}/,\n returnBegin: true,\n keywords: KEYWORDS,\n relevance: 0,\n contains: [\n {\n className: 'module',\n relevance: 0,\n begin: RE_MODULE_IDENT\n },\n {\n begin: /\\{/,\n end: /\\}/,\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n MODULE_ACCESS_MODE\n ]\n };\n}", "title": "" }, { "docid": "43abcb8e598b03c73fd123d25b311d89", "score": "0.54099816", "text": "function reasonml(hljs) {\n function orReValues(ops) {\n return ops\n .map(function(op) {\n return op\n .split('')\n .map(function(char) {\n return '\\\\' + char;\n })\n .join('');\n })\n .join('|');\n }\n\n const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';\n const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';\n\n const RE_PARAM_TYPEPARAM = '\\'?[a-z$_][0-9a-z$_]*';\n const RE_PARAM_TYPE = '\\\\s*:\\\\s*[a-z$_][0-9a-z$_]*(\\\\(\\\\s*(' + RE_PARAM_TYPEPARAM + '\\\\s*(,' + RE_PARAM_TYPEPARAM + '\\\\s*)*)?\\\\))?';\n const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}';\n const RE_OPERATOR = \"(\" + orReValues([\n '||',\n '++',\n '**',\n '+.',\n '*',\n '/',\n '*.',\n '/.',\n '...'\n ]) + \"|\\\\|>|&&|==|===)\";\n const RE_OPERATOR_SPACED = \"\\\\s+\" + RE_OPERATOR + \"\\\\s+\";\n\n const KEYWORDS = {\n keyword:\n 'and as asr assert begin class constraint do done downto else end exception external ' +\n 'for fun function functor if in include inherit initializer ' +\n 'land lazy let lor lsl lsr lxor match method mod module mutable new nonrec ' +\n 'object of open or private rec sig struct then to try type val virtual when while with',\n built_in:\n 'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ',\n literal:\n 'true false'\n };\n\n const RE_NUMBER = '\\\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +\n '0[oO][0-7_]+[Lln]?|' +\n '0[bB][01_]+[Lln]?|' +\n '[0-9][0-9_]*([Lln]|(\\\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)';\n\n const NUMBER_MODE = {\n className: 'number',\n relevance: 0,\n variants: [\n {\n begin: RE_NUMBER\n },\n {\n begin: '\\\\(-' + RE_NUMBER + '\\\\)'\n }\n ]\n };\n\n const OPERATOR_MODE = {\n className: 'operator',\n relevance: 0,\n begin: RE_OPERATOR\n };\n const LIST_CONTENTS_MODES = [\n {\n className: 'identifier',\n relevance: 0,\n begin: RE_IDENT\n },\n OPERATOR_MODE,\n NUMBER_MODE\n ];\n\n const MODULE_ACCESS_CONTENTS = [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_CONTENTS = [\n {\n className: 'module',\n begin: \"\\\\b\" + RE_MODULE_IDENT,\n returnBegin: true,\n end: \"\\.\",\n relevance: 0,\n contains: [\n {\n className: 'identifier',\n begin: RE_MODULE_IDENT,\n relevance: 0\n }\n ]\n }\n ];\n\n const PARAMS_MODE = {\n begin: RE_IDENT,\n end: '(,|\\\\n|\\\\))',\n relevance: 0,\n contains: [\n OPERATOR_MODE,\n {\n className: 'typing',\n begin: ':',\n end: '(,|\\\\n)',\n returnBegin: true,\n relevance: 0,\n contains: PARAMS_CONTENTS\n }\n ]\n };\n\n const FUNCTION_BLOCK_MODE = {\n className: 'function',\n relevance: 0,\n keywords: KEYWORDS,\n variants: [\n {\n begin: '\\\\s(\\\\(\\\\.?.*?\\\\)|' + RE_IDENT + ')\\\\s*=>',\n end: '\\\\s*=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: RE_IDENT\n },\n {\n begin: RE_PARAM\n },\n {\n begin: /\\(\\s*\\)/\n }\n ]\n }\n ]\n },\n {\n begin: '\\\\s\\\\(\\\\.?[^;\\\\|]*\\\\)\\\\s*=>',\n end: '\\\\s=>',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'params',\n relevance: 0,\n variants: [ PARAMS_MODE ]\n }\n ]\n },\n {\n begin: '\\\\(\\\\.\\\\s' + RE_IDENT + '\\\\)\\\\s*=>'\n }\n ]\n };\n MODULE_ACCESS_CONTENTS.push(FUNCTION_BLOCK_MODE);\n\n const CONSTRUCTOR_MODE = {\n className: 'constructor',\n begin: RE_MODULE_IDENT + '\\\\(',\n end: '\\\\)',\n illegal: '\\\\n',\n keywords: KEYWORDS,\n contains: [\n hljs.QUOTE_STRING_MODE,\n OPERATOR_MODE,\n {\n className: 'params',\n begin: '\\\\b' + RE_IDENT\n }\n ]\n };\n\n const PATTERN_MATCH_BLOCK_MODE = {\n className: 'pattern-match',\n begin: '\\\\|',\n returnBegin: true,\n keywords: KEYWORDS,\n end: '=>',\n relevance: 0,\n contains: [\n CONSTRUCTOR_MODE,\n OPERATOR_MODE,\n {\n relevance: 0,\n className: 'constructor',\n begin: RE_MODULE_IDENT\n }\n ]\n };\n\n const MODULE_ACCESS_MODE = {\n className: 'module-access',\n keywords: KEYWORDS,\n returnBegin: true,\n variants: [\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\" + RE_IDENT\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\(\",\n end: \"\\\\)\",\n returnBegin: true,\n contains: [\n FUNCTION_BLOCK_MODE,\n {\n begin: '\\\\(',\n end: '\\\\)',\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n {\n begin: \"\\\\b(\" + RE_MODULE_IDENT + \"\\\\.)+\\\\{\",\n end: /\\}/\n }\n ],\n contains: MODULE_ACCESS_CONTENTS\n };\n\n PARAMS_CONTENTS.push(MODULE_ACCESS_MODE);\n\n return {\n name: 'ReasonML',\n aliases: [ 're' ],\n keywords: KEYWORDS,\n illegal: '(:-|:=|\\\\$\\\\{|\\\\+=)',\n contains: [\n hljs.COMMENT('/\\\\*', '\\\\*/', {\n illegal: '^(#,\\\\/\\\\/)'\n }),\n {\n className: 'character',\n begin: '\\'(\\\\\\\\[^\\']+|[^\\'])\\'',\n illegal: '\\\\n',\n relevance: 0\n },\n hljs.QUOTE_STRING_MODE,\n {\n className: 'literal',\n begin: '\\\\(\\\\)',\n relevance: 0\n },\n {\n className: 'literal',\n begin: '\\\\[\\\\|',\n end: '\\\\|\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n {\n className: 'literal',\n begin: '\\\\[',\n end: '\\\\]',\n relevance: 0,\n contains: LIST_CONTENTS_MODES\n },\n CONSTRUCTOR_MODE,\n {\n className: 'operator',\n begin: RE_OPERATOR_SPACED,\n illegal: '-->',\n relevance: 0\n },\n NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n PATTERN_MATCH_BLOCK_MODE,\n FUNCTION_BLOCK_MODE,\n {\n className: 'module-def',\n begin: \"\\\\bmodule\\\\s+\" + RE_IDENT + \"\\\\s+\" + RE_MODULE_IDENT + \"\\\\s+=\\\\s+\\\\{\",\n end: /\\}/,\n returnBegin: true,\n keywords: KEYWORDS,\n relevance: 0,\n contains: [\n {\n className: 'module',\n relevance: 0,\n begin: RE_MODULE_IDENT\n },\n {\n begin: /\\{/,\n end: /\\}/,\n skip: true\n }\n ].concat(MODULE_ACCESS_CONTENTS)\n },\n MODULE_ACCESS_MODE\n ]\n };\n}", "title": "" }, { "docid": "4ef892113c6dd0c34637ac8ffdd585a8", "score": "0.54078335", "text": "function translate(phrase){\n\n\t// Store words into an initialized array\n\tvar words = phrase.toLowerCase().split(' ');\n\n\t// Initialize an array to store a translated word\n\tvar translatedWord = [];\n\t// Initialize an array to store the collection of translated words\n\tvar translatedWords = [];\n\n\t// Loop index i through length of words array\n\tfor(var i in words){\n\t\t// Clear translatedWord array\n\t\ttranslatedWord = [];\n\n\t\t// Check if word is long enough to translate normally\n\t\tif(words[i].length >= 3){\n\t\t\t// Add the secound to last letter of a word to the empty translated word array\n\t\t\ttranslatedWord.push(words[i][words[i].length-2]);\n\t\t\t// Add the last letter of a word to the word array\n\t\t\ttranslatedWord.push(words[i][words[i].length-1]);\n\t\t\t// Add the remaining letters of a word to the end of the tranlated word \n\t\t\ttranslatedWord.push(words[i].slice(0,words[i].length-2));\n\t\t}\n\n\t\t// Add 'ay' to the end of the translated word to complete the pig laten translation algorithm\n\t\ttranslatedWord.push(\"ay\");\n\n\t\t// Add the translated word to the end of the collection of translated words\n\t\ttranslatedWords.push(translatedWord.join(''));\n\t}\n\n\t// Capitilize the first letter of the first translated word in the collection by spliting it into a character array,... \n\ttranslatedWords[0] = translatedWords[0].split('');\n\t// capitilizing the first character of that array... \n\ttranslatedWords[0][0] = translatedWords[0][0].toUpperCase();\n\t// and joining the character array back into a string.\n\ttranslatedWords[0] = translatedWords[0].join('');\n\n\t// Return the collection of translated words as a singular string\n\treturn translatedWords.join(' ');\n}", "title": "" }, { "docid": "cfac3143d133a61ecffb4eb64f7af937", "score": "0.53913116", "text": "function describe(){\n description = \"I see\";\n \n // apply English grammar rules to construct a sentence\n if (detections.length){\n var counted = getCountedObjects(detections);\n var names = Object.keys(counted);\n var pluraleTantum = [\n \"scissors\",\"pants\",\"trousers\",\"glasses\",\n \"spectacles\",\"panties\",\"jeans\",\"chopsticks\",\n \"shorts\",\"boxers\",\"briefs\",\"tights\",\"pyjamas\",\n \"pliers\",\"tongs\",\"tweezers\",\"binoculars\",\n \"goggles\",\"sunglasses\",\"contact lenses\",\n \"headphones\",\"earphones\",\"earbuds\",\"earmuffs\",\n \"skis\",\n ];\n var irregularPlural = { // just some common ones\n mouse:\"mice\",louse:\"lice\",ox:\"oxen\",axis:\"axes\",\n goose:\"geese\",tooth:\"teeth\",foot:\"feet\",child:\"children\",\n dice:\"dice\",die:\"dice\",potato:\"potatoes\",tomato:\"tomatoes\",\n deer:\"deer\",swine:\"swine\",sheep:\"sheep\",moose:\"moose\"\n }\n for (var i = 0; i < names.length; i++){\n var name = names[i];\n var n = counted[name];\n var numeral;\n if (n == 1){\n numeral = \"a\";\n if (!pluraleTantum.includes(name)){\n if (['a','e','i','o','u'].includes(name[0])){\n if (name.startsWith(\"uni\") || name.startsWith(\"eu\")){\n }else{\n numeral += \"n\";\n }\n }\n }else{\n name = \"pair of \"+name;\n }\n }else{\n numeral = [\n \"zero\",\"one\",\"two\",\"three\",\"four\",\"five\",\"six\",\n \"seven\",\"eight\",\"nine\",\"ten\",\"eleven\",\"twelve\"\n ][n] || \"many\";\n if (irregularPlural[name]){\n name = irregularPlural[name];\n }else if (pluraleTantum.includes(name)){\n name = \"pairs of \"+name;\n }else{\n if (['x','s','z'].includes(name[name.length-1])\n || name.endsWith('sh') || name.endsWith('ch')\n ){\n name += \"e\";\n }\n if (name.endsWith('f')||name.endsWith('fe')){\n name = name.slice(0,name.length-1-name.endsWith('fe'))+\"ve\";\n }\n if (name[name.length-1]==\"y\" && !['a','e','i','o','u'].includes(name[name.length-2])){\n name = name.slice(0,name.length-1)+\"ie\";\n }\n name += \"s\";\n if (name.endsWith('mans')){\n name = name.slice(0,name.length-4)+\"men\";\n }\n }\n }\n description += (i != 0 && i == names.length-1) ? \" and \": \" \";\n description += numeral + \" \" + name;\n description += (i == names.length-1) ? \".\" : \",\";\n }\n }else{\n description += \" nothing.\"\n }\n print(description);\n \n // synthesize with text to speech.\n // currently, the utterance is skipped if there's already something being voiced.\n // see below for alternative behaviors:\n \n // uncomment the line below to interrupt previous utterance\n // speechSynthesis.cancel();\n \n // comment out the if condition to queue up the utterance\n if (!speechSynthesis.pending){\n speechSynthesis.speak(new SpeechSynthesisUtterance(description));\n }\n}", "title": "" }, { "docid": "555df9ff3dd8cb8dbdd6685308584e73", "score": "0.53869766", "text": "function handleText(textNode) \n{\n\n\tvar v = textNode.nodeValue;\n\tvar word_list = ['Etymology'];\n\t\n\tvar c = document.body.innerHTML;\n\tconsole.log(c)\n\t\n\tfor (i = 0; i < word_list.length; i++) { \n\t\t// console.log(word_list[i])\n\t\tvar synonym = replace_word(word_list[i])\n\t\tv = v.replace(word_list[i], synonym);\n\t\ttextNode.nodeValue = v;\n\t}\n}", "title": "" }, { "docid": "585351214bdc2df018ebd595373fd6c9", "score": "0.5383439", "text": "function RecognitionLanguagesData() {\n }", "title": "" }, { "docid": "8168859893cc4d03d5051c9f63cbe43e", "score": "0.5382361", "text": "function applyTemplate(step) {\n // TODO: allow for variation within the templates.\n let sentence = \"\";\n let tokens = step.split(\" \");\n\n if (tokens.length == 2) {\n // Length 2: simple swap of subject and verb\n let verb = applyVerbTense(\"PRESENT\", tokens[0]);\n sentence += \"The \" + tokens[1] + \" \" + verb;\n }\n else if (tokens.length == 3) {\n // Length 3: subject, verb, direct object\n let verb = applyVerbTense(\"PRESENT\", tokens[0]);\n sentence += \"The \" + tokens[1] + \" \" + verb + \" the \" + tokens[2];\n }\n return sentence;\n}", "title": "" }, { "docid": "bad7c074530443cf5bc3b15ab93a8234", "score": "0.53722197", "text": "function translate() {\r\n\r\n $('#final-text').empty();\r\n\r\n /* VARIABLES\r\n ========================================================================================= */\r\n var original = $('#sentence').val();\r\n var sentenceArray = original.split(\" \");\r\n var trumpDictionary = {};\r\n var newArray = [];\r\n var replacementMade = false;\r\n var connotationCount = 0;\r\n var connotationWord = 0;\r\n var fakeNews = false;\r\n\r\n /* =======================================================================================\r\n ====================================================================================== */\r\n\r\n /* TRUMP DEFINITIONS\r\n ========================================================================================= */\r\n\r\n /* CONNOTATION - VALUES\r\n =========================================================================================\r\n\r\n 0 ---> NO CONNOTATION\r\n 1 ---> BAD CONNOTATION\r\n 2 ---> GOOD CONNOTATION\r\n 3 ---> FAKE NEWS\r\n\r\n ==========================================================================================\r\n */\r\n\r\n trumpDictionary.love = [\"absolutely love\", 2];\r\n trumpDictionary.good = [\"fantastic\", 2];\r\n trumpDictionary.hillary = [\"Crooked Hillary\", 1];\r\n trumpDictionary.putin = [\"my friend, Vlad\", 0];\r\n trumpDictionary.russia = [\"my friends in Russia\", 0];\r\n trumpDictionary.big = [\"yuge\", 0];\r\n trumpDictionary.huge = [\"yuge\", 0];\r\n trumpDictionary.giant = [\"massive\", 0];\r\n trumpDictionary.large = [\"massive\", 0];\r\n trumpDictionary.enormous = [\"yuge\", 0];\r\n trumpDictionary.china = [\"Ghina\", 0];\r\n trumpDictionary.bad = [\"horrible\", 1];\r\n trumpDictionary.amazing = [\"tremendous\", 2];\r\n trumpDictionary.caucus = [\"freedom causus\", 0];\r\n trumpDictionary.failed = [\"disgraced\", 1];\r\n trumpDictionary.failure = [\"disgrace\", 1];\r\n trumpDictionary.years = [\"solid years, bigly\", 0];\r\n trumpDictionary.country = [\"great country\", 2];\r\n trumpDictionary.media = [\"FAKE NEWS\", 3];\r\n trumpDictionary.news = [\"FAKE NEWS\", 3];\r\n trumpDictionary.cnn = [\"FAKE NEWS\", 3];\r\n trumpDictionary.buzzfeed = [\"FAKE NEWS\", 3];\r\n trumpDictionary.obamacare = [\"awful Obamacare\", 1];\r\n trumpDictionary.people = [\"PEOPLE\", 0];\r\n trumpDictionary.attack = [\"terrorist attack\", 0];\r\n trumpDictionary.working = [\"working hard\", 0];\r\n trumpDictionary.war = [\"massive war\", 0];\r\n trumpDictionary.took = [\"grabbed\", 0];\r\n trumpDictionary.hate = [\"hate\", 1];\r\n trumpDictionary.protests = [\"hateful protests\", 1];\r\n trumpDictionary.melania = [\"my sweet Melania\", 2];\r\n trumpDictionary.ivanka = [\"Ivanka (who is gorgeous, might I add)\", 2];\r\n trumpDictionary.administration = [\"Empire\", 2];\r\n trumpDictionary.like = [\"like\", 2];\r\n trumpDictionary.enjoy = [\"really enjoy, and I mean it,\", 2];\r\n\r\n trumpDictionary.ending_Sad = \"Sad!\";\r\n trumpDictionary.ending_Good = \"Tremendous!\";\r\n trumpDictionary.ending_News = \"Fake news is the enemy of the American people!\";\r\n\r\n /* =======================================================================================\r\n ========================================================================================= */\r\n\r\n /* PSEUDOCODE -- MAIN PROCESS\r\n\r\n --- MAIN PROCESS ---\r\n 1. Split sentence into seperate words in array using the native .split() method.\r\n 2. Go through each word in array and check against every word in the trumpDictionary.\r\n 3. If the word in the array matches what is in the dictionary, then it will put the replaced word into a new array.\r\n 4. If that word is punctuated, the punctuation will not be included in the replacement.\r\n 5. If a replacement has been made, the loop is broken out of.\r\n 6. If a replacement cannot be made, then the original word is added to the array.\r\n 7. Finally, the final array is put together into a String and added to the layout.\r\n\r\n --- OTHER FEATURES ---\r\n 1. Replacement - Replace \"Trump-Trigger\" words with the language that Trump would use.\r\n 2. Connotation - Detect connotation and wording of sentence and add endings depending on sentence's connotation.\r\n 3. Capitalization - Code is structured to change capital letters to properly display sentence.\r\n\r\n --- TO-DO ---\r\n 1. Fix start of sentence with lowercase.\r\n 2. Add more words.\r\n\r\n */\r\n\r\n /* PROGRAM'S MAIN LOOP -- GREG DAVIDSON SEGMENT\r\n ========================================================================================= */\r\n for (var i = 0; i < sentenceArray.length; i++) {\r\n\r\n for (key in trumpDictionary) {\r\n\r\n var value = trumpDictionary[key];\r\n\r\n if (sentenceArray[i].includes(key) || (sentenceArray[i].toLowerCase()).includes(key)) {\r\n\r\n if (sentenceArray[i].length > key.length) {\r\n\r\n newArray.push(sentenceArray[i].replace(sentenceArray[i].substring(0, key.length), value[0]));\r\n\r\n }\r\n else {\r\n\r\n newArray.push(sentenceArray[i].replace(sentenceArray[i], value[0]));\r\n\r\n }\r\n\r\n replacementMade = true;\r\n\r\n if (value[1] == 3) {\r\n\r\n fakeNews = true;\r\n connotationWord += 1;\r\n\r\n }\r\n else {\r\n\r\n connotationCount += value[1];\r\n\r\n if (value[1] != 0) {\r\n\r\n connotationWord += 1;\r\n\r\n }\r\n\r\n }\r\n\r\n break;\r\n\r\n }\r\n\r\n }\r\n\r\n if (!replacementMade) {\r\n\r\n newArray.push(sentenceArray[i]);\r\n\r\n }\r\n\r\n replacementMade = false;\r\n\r\n }\r\n\r\n /* =======================================================================================\r\n ====================================================================================== */\r\n\r\n /* CONNOTATION - PROCESS -- GREG DAVIDSON SEGMENT\r\n ========================================================================================= */\r\n if (fakeNews) {\r\n\r\n newArray.push(trumpDictionary.ending_News);\r\n\r\n }\r\n else {\r\n\r\n if (connotationWord > 0) {\r\n\r\n var connotationAverage = connotationCount / connotationWord;\r\n\r\n if (connotationAverage > 1.5) {\r\n\r\n newArray.push(trumpDictionary.ending_Good);\r\n\r\n }\r\n else {\r\n\r\n newArray.push(trumpDictionary.ending_Sad);\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n /* =======================================================================================\r\n ====================================================================================== */\r\n\r\n /* PUT TOGETHER AND DISPLAY FINAL STRING -- POOJA KOTAK SEGMENT\r\n ========================================================================================= */\r\n var finalString = \"\";\r\n\r\n var firstWord = newArray[0].split(' ');\r\n finalString += \"<span class=\\\"cap\\\">\" + firstWord[0] + \"</span> \";\r\n\r\n /* === ONLY FOR FIRST WORD === */\r\n for (var i = 1; i < firstWord.length; i++) {\r\n\r\n finalString += firstWord[i] + \" \";\r\n\r\n }\r\n\r\n if (newArray.length > 1) {\r\n\r\n finalString += newArray[1] + \" \";\r\n\r\n /* === FOR ALL OTHER WORDS === */\r\n for (var i = 2; i < newArray.length; i++) {\r\n\r\n if (newArray[i - 1].substring(newArray[i - 1].length - 1, newArray[i - 1].length) == '.' ) {\r\n\r\n var word = newArray[i].split(' ');\r\n finalString += \"<span class=\\\"cap\\\">\" + word[0] + \"</span> \";\r\n\r\n for (var j = 1; j < word.length; j++) {\r\n\r\n finalString += word[j] + \" \";\r\n\r\n }\r\n\r\n }\r\n else if (newArray[i - 1].substring(newArray[i - 1].length - 1, newArray[i - 1].length) == '!' ) {\r\n\r\n var word = newArray[i].split(' ');\r\n finalString += \"<span class=\\\"cap\\\">\" + word[0] + \"</span> \";\r\n\r\n for (var j = 1; j < word.length; j++) {\r\n\r\n finalString += word[j] + \" \";\r\n\r\n }\r\n\r\n }\r\n else if (newArray[i - 1].substring(newArray[i - 1].length - 1, newArray[i - 1].length) == '?' ) {\r\n\r\n var word = newArray[i].split(' ');\r\n finalString += \"<span class=\\\"cap\\\">\" + word[0] + \"</span> \";\r\n\r\n for (var j = 1; j < word.length; j++) {\r\n\r\n finalString += word[j] + \" \";\r\n\r\n }\r\n\r\n }\r\n else {\r\n\r\n finalString += newArray[i] + \" \";\r\n\r\n }\r\n }\r\n\r\n }\r\n\r\n $('<h1>' + finalString + '</h1>').appendTo('#final-text');\r\n\r\n }", "title": "" }, { "docid": "3bc77ce4425abf253ea09396690b77f4", "score": "0.5370704", "text": "function Word(id, list, language1, language2, comment, answers) {\n this.id = id;\n this.language1 = language1;\n this.language2 = language2;\n this.comment = comment;\n this.list = list;\n\n this.answers = [];\n // convert JSON-parsed answers into Answer objects\n for (var i = 0; i < answers.length; i++) {\n this.answers.push(new QueryAnswer(answers[i].word, answers[i].correct, answers[i].type, answers[i].direction, answers[i].id, answers[i].time));\n }\n}", "title": "" }, { "docid": "ecb1591f8e0857c8c9dd512ba98d97d6", "score": "0.5360802", "text": "function makeTeaser(body, terms) {\n var TERM_WEIGHT = 40;\n var NORMAL_WORD_WEIGHT = 2;\n var FIRST_WORD_WEIGHT = 8;\n var TEASER_MAX_WORDS = 30;\n\n var stemmedTerms = terms.map(function (w) {\n return elasticlunr.stemmer(w.toLowerCase());\n });\n var termFound = false;\n var index = 0;\n var weighted = []; // contains elements of [\"word\", weight, index_in_document]\n\n // split in sentences, then words\n var sentences = body.toLowerCase().split(\". \");\n\n for (var i in sentences) {\n var words = sentences[i].split(\" \");\n var value = FIRST_WORD_WEIGHT;\n\n for (var j in words) {\n var word = words[j];\n\n if (word.length > 0) {\n for (var k in stemmedTerms) {\n if (elasticlunr.stemmer(word).startsWith(stemmedTerms[k])) {\n value = TERM_WEIGHT;\n termFound = true;\n }\n }\n weighted.push([word, value, index]);\n value = NORMAL_WORD_WEIGHT;\n }\n\n index += word.length;\n index += 1; // ' ' or '.' if last word in sentence\n }\n\n index += 1; // because we split at a two-char boundary '. '\n }\n\n if (weighted.length === 0) {\n return body;\n }\n\n var windowWeights = [];\n var windowSize = Math.min(weighted.length, TEASER_MAX_WORDS);\n // We add a window with all the weights first\n var curSum = 0;\n for (var i = 0; i < windowSize; i++) {\n curSum += weighted[i][1];\n }\n windowWeights.push(curSum);\n\n for (var i = 0; i < weighted.length - windowSize; i++) {\n curSum -= weighted[i][1];\n curSum += weighted[i + windowSize][1];\n windowWeights.push(curSum);\n }\n\n // If we didn't find the term, just pick the first window\n var maxSumIndex = 0;\n if (termFound) {\n var maxFound = 0;\n // backwards\n for (var i = windowWeights.length - 1; i >= 0; i--) {\n if (windowWeights[i] > maxFound) {\n maxFound = windowWeights[i];\n maxSumIndex = i;\n }\n }\n }\n\n var teaser = [];\n var startIndex = weighted[maxSumIndex][2];\n for (var i = maxSumIndex; i < maxSumIndex + windowSize; i++) {\n var word = weighted[i];\n if (startIndex < word[2]) {\n // missing text from index to start of `word`\n teaser.push(body.substring(startIndex, word[2]));\n startIndex = word[2];\n }\n\n // add <em/> around search terms\n if (word[1] === TERM_WEIGHT) {\n teaser.push(\"<b>\");\n }\n startIndex = word[2] + word[0].length;\n teaser.push(body.substring(word[2], startIndex));\n\n if (word[1] === TERM_WEIGHT) {\n teaser.push(\"</b>\");\n }\n }\n teaser.push(\"…\");\n return teaser.join(\"\");\n}", "title": "" }, { "docid": "bc3f350bae08bd5725ee61c4412c4269", "score": "0.5355596", "text": "function createPhrases() {\n console.log('Estudar é muito bom')\n console.log('Paciência e persistência')\n console.log('Revisão é a mãe do aprendizado')\n}", "title": "" }, { "docid": "919a54d883af21bbda643e1a2412202f", "score": "0.5355153", "text": "function minimal_french_stemmer(w) {\n var len = w.length;\n \n if (len < 5) {\n // do nothing\n } else if (w[len - 1] === 'x') {\n len--;\n if (w[len - 2] === 'a' && w[len - 1] === 'u') len--;\n } else {\n if (w[len - 1] === 's') len--;\n if (w[len - 1] === 'r') len--;\n if (w[len - 1] === 'e') len--;\n if (w[len - 1] === 'e') len--; // for ée\n if (w[len - 1] === w[len - 2]) len--;\n }\n return len < w.length ? w.slice(0, len) : w;\n}", "title": "" }, { "docid": "bb148034df6b181ed121f8662e3fa1c1", "score": "0.5350526", "text": "function saySSML(assistant) {\n let text_to_speech = '<speak>'\n + 'Here are <say-as interpret-as=\"characters\">SSML</say-as> samples. '\n + 'I can pause <break time=\"3\"/>. '\n + 'I can play a sound <audio src=\"https://www.example.com/MY_WAVE_FILE.wav\">your wave file</audio>. '\n + 'I can speak in cardinals. Your position is <say-as interpret-as=\"cardinal\">10</say-as> in line. '\n + 'Or I can speak in ordinals. You are <say-as interpret-as=\"ordinal\">10</say-as> in line. '\n + 'Or I can even speak in digits. Your position in line is <say-as interpret-as=\"digits\">10</say-as>. '\n + 'I can also substitute phrases, like the <sub alias=\"World Wide Web Consortium\">W3C</sub>. '\n + 'Finally, I can speak a paragraph with two sentences. '\n + '<p><s>This is sentence one.</s><s>This is sentence two.</s></p>'\n + '</speak>'\n assistant.tell(text_to_speech);\n}", "title": "" }, { "docid": "377252d645aeefd7d9b54ac0ea230994", "score": "0.53477013", "text": "function helloWorld(language) {\r\n if (language === 'fr') {\r\n return 'Bonjour tout le monde';\r\n }\r\n else if (language === 'es') {\r\n return 'Hola, Mundo';\r\n }\r\n else (language === '') {\r\n return 'Hello, World';\r\n }\r\n}", "title": "" }, { "docid": "8481de42ecf0bc56ce7ad5069019b32d", "score": "0.534148", "text": "function translateWord(phoword,parsed_syls){\n var raw_word = phoword.word,\n num_syls = parsed_syls.length,\n vowels = /[aeiouy]/i,\n vowel_indices = [],\n chunked_vowels = [],\n last_vowel = -2,\n syl_vowels;\n\n var isVowel = function(c){\n return c.match(/[aeiouy]/g);\n };\n\n var isCons = function(c){\n return c.match(/[^aeiou]/g);\n };\n\n var consume = function(hopper,segment,syl,next_syl,sufflen){\n var hopper_chrs,next_vowel;\n\n if(hopper.length < 1){\n // If there's no hopper left, we are done\n return [hopper,segment];\n } else if(sufflen < 1 && _.contains([\"EY\",\"AY\",\"IY\"],destress(syl.vowel)) && hopper[0].match(/y/i)){\n segment = segment + hopper[0];\n hopper = hopper.slice(1);\n return consume(hopper,segment,syl,next_syl,sufflen);\n } else if(sufflen < 1 && _.contains([\"EY\",\"AY\",\"IY\"],destress(syl.vowel)) && hopper[0].match(/r/i) && hopper[1] && hopper[1].match(/e/i)){\n return [hopper,segment];\n } else if(_.isEqual(syl.suffix,[\"L\"]) && segment.slice(-2).match(/le/i) && destress(syl.vowel) === \"AH\"){\n return [hopper,segment];\n } else if(sufflen < 1 && isVowel(hopper[0]) && next_syl.prefix.length === 0){\n // If there's no suffix, but the hopper starts on a vowel and so does the next syl, we are done\n return [hopper,segment];\n } else if(sufflen < 1 && isVowel(hopper[0]) && next_syl.prefix.length > 0){\n // If there's no suffix, but the hopper starts on a vowel and the next syl doesn't, consume until cons\n var next_cons = _.findIndex(hopper.split(\"\"),isCons);\n segment = segment + hopper.slice(0,next_cons);\n hopper = hopper.slice(next_cons);\n return [hopper,segment];\n } else if(sufflen < 1 && ! isVowel(hopper[0]) && next_syl.prefix.length === 0){\n // If there's no suffix and the hopper doesn't start on a vowel, consume cons until vowel, assuming they are silent\n hopper_chrs = hopper.split(\"\");\n next_vowel = _.findIndex(hopper_chrs, function(c,i){return isVowel(c) && ! (c.match(/u/i) && hopper_chrs[i-1] && hopper_chrs[i-1] == \"q\");});\n segment = segment + hopper.slice(0,next_vowel);\n hopper = hopper.slice(next_vowel);\n return [hopper,segment];\n } else if(sufflen < 1 && ! isVowel(hopper[0]) && next_syl.prefix.length > 0){\n // If there's no suffix and the hopper and next_syl both start on cons, we are done\n if (hopper.slice(0,2).match(/gh/i)){\n segment = segment + hopper.slice(0,2);\n hopper = hopper.slice(2);\n }\n return [hopper,segment];\n } else if(sufflen >= 1 && isVowel(hopper[0])){\n // If there's a suffix left, but the hopper is starting on a vowel, we haven't eaten enough vowels\n segment = segment + hopper[0];\n hopper = hopper.slice(1);\n return consume(hopper,segment,syl,next_syl,sufflen);\n } else if(sufflen >= 1 && ! isVowel(hopper[0]) && next_syl.prefix.length === 0){\n // If there's a suffix left and the hopper has consonants left but the next_syl has no prefix, consume til vowel\n hopper_chrs = hopper.split(\"\");\n next_vowel = _.findIndex(hopper_chrs, function(c,i){return isVowel(c) && ! (c.match(/u/i) && hopper_chrs[i-1] && hopper_chrs[i-1] == \"q\");});\n segment = segment + hopper.slice(0,next_vowel + 1);\n hopper = hopper.slice(next_vowel + 1);\n return [hopper,segment];\n } else if(sufflen >= 1 && ! isVowel(hopper[0]) && next_syl.prefix.length > 0){\n // If there's a suffix left and the consonants have to be divided get trickier\n if(syl.suffix.join(\"\").match(/ks/i) && hopper[0].match(/x/i)){\n segment = segment + hopper[0];\n hopper = hopper.slice(1);\n return consume(hopper,segment,syl,next_syl,sufflen-2);\n } else if (_.contains(syl.suffix, \"CH\") && hopper.slice(0,2) == \"ch\" || \n _.contains(syl.suffix, \"TH\") && hopper.slice(0,2) == \"th\" ||\n _.contains(syl.suffix, \"DH\") && hopper.slice(0,2) == \"th\"){\n segment = segment + hopper.slice(0,2);\n hopper = hopper.slice(2);\n return consume(hopper,segment,syl,next_syl,sufflen-2);\n } else {\n segment = segment + hopper[0];\n hopper = hopper.slice(1);\n return consume(hopper,segment,syl,next_syl,sufflen-1);\n }\n }\n\n };\n\n var split = _.reduce(parsed_syls,function(m,syl,i){\n var hopper = m[0],\n output_syls = m[1],\n prelen = syl.prefix.length,\n sufflen = syl.suffix.length,\n vowel = destress(syl.vowel),\n hopper_chrs = hopper.split(\"\"),\n next_possible_vowel = _.findIndex(hopper_chrs, function(c,i){return isVowel(c) && ! (c.match(/u/i) && hopper_chrs[i-1] && hopper_chrs[i-1] == \"q\");}),\n next_syl,\n segment = \"\";\n if(prelen > next_possible_vowel){\n console.log(\"WARNING\", \"Too many cons\",raw_word);\n }\n if(i === (parsed_syls.length - 1)){\n return [\"\",output_syls.concat([hopper])];\n } else {\n next_syl = parsed_syls[i+1];\n }\n\n if(hopper[0].match(/s/i) && hopper[1] && hopper[1].match(/m/i) && _.isEqual(syl.prefix, [\"S\"]) && _.isEqual(syl.suffix, [\"M\"])){\n output_syls.push(\"sm\");\n return [hopper.slice(2),output_syls];\n } else if (hopper[0].match(/s/i) && hopper[1] && hopper[1].match(/m/i) && _.isEqual(syl.prefix, [\"S\"]) && _.isEqual(syl.suffix, []) && next_syl.sounds[0].match(/m/i)){\n output_syls.push(\"s\");\n return [hopper.slice(1),output_syls];\n }\n\n segment = segment + hopper.slice(0,next_possible_vowel + 1);\n hopper = hopper.slice(next_possible_vowel + 1);\n if(vowel === \"ER\" && hopper[0].match(/r/i)){\n segment = segment + hopper.slice(0,1);\n hopper = hopper.slice(1);\n }\n var division = consume(hopper,segment,syl,next_syl,sufflen);\n output_syls.push(division[1]);\n return [division[0],output_syls];\n\n },[phoword.word,[]]);\n\n return split;\n }", "title": "" }, { "docid": "5ed19ef50894c7d6374696b04abac93f", "score": "0.5339943", "text": "function SetSoundAndWord() {\n\tvar sound : String = \"Audio/Kanas/\" + kana;\n\tswitch(kana){\n\tcase \"あ\":\n\t\tsound = \"Audio/Kanas/a\";\n\t\tword = \"あり\";\n\tbreak;\n\t\n\tcase \"い\":\n\t\tsound = \"Audio/Kanas/i\";\n\t\tword = \"いなずま\";\n\tbreak;\n\t\n\tcase \"う\":\n\t\tsound = \"Audio/Kanas/u\";\n\t\tword = \"うさぎ\";\n\tbreak;\n\t\n\tcase \"え\":\n\t\tsound = \"Audio/Kanas/e\";\n\t\tword = \"えん\";\n\tbreak;\n\t\n\tcase \"お\":\n\t\tsound = \"Audio/Kanas/o\";\n\t\tword = \"おす\";\n\tbreak;\n\t\n\tcase \"か\":\n\t\tsound = \"Audio/Kanas/ka\";\n\t\tword = \"かたな\";\n\tbreak;\n\t\n\tcase \"き\":\n\t\tsound = \"Audio/Kanas/ki\";\n\t\tword = \"きりかぶ\";\n\tbreak;\n\t\n\tcase \"く\":\n\t\tsound = \"Audio/Kanas/ku\";\n\t\tword = \"くさり\";\n\tbreak;\n\t\n\tcase \"け\":\n\t\tsound = \"Audio/Kanas/ke\";\n\t\tword = \"ける\";\n\tbreak;\n\t\n\tcase \"こ\":\n\t\tsound = \"Audio/Kanas/ko\";\n\t\tword = \"こぶし\";\n\tbreak;\n\t\n\tdefault:\n\t\tsound = \"Audio/Kanas/\" + kana;\n\t\tword = \"\";\n\t}\n\t//sound = \"Audio/Kanas/a\";\n\taudio.clip = Resources.Load(sound, AudioClip);\n\tif(audio.clip == null) {\n\t\taudio.clip = Resources.Load(\"Audio/Misc/silence\", AudioClip);\n\t\tword = \"\";\n\t}\n}", "title": "" }, { "docid": "36b38df0185616ffe4f8a7eb4ee2dbd9", "score": "0.5338181", "text": "function translate (phrase) {\n var newPhrase = \" \";\n for (var count = 0; count < phrase.length; count++) {\n var letter = phrase[count];\n if (cleanerIsVowel(letter) || letter === \" \") {\n newPhrase += letter;\n } else {\n newPhrase += letter + \"o\" + letter;\n }\n return newPhrase;\n}\n\n translate(\"these are some words\");\n}", "title": "" }, { "docid": "be3bf671c704a5779c92dc269c02ed7b", "score": "0.53349614", "text": "function greetEnglish(firstname, lastname) {\n greet(firstname, lastname, 'en');\n}", "title": "" }, { "docid": "fbf4a5cbe936e929186d693b6501a8c5", "score": "0.533062", "text": "async function tokenizing (text) {\n let split = text.split(/[\\[\\]<>.,\\/#!$%\\^&\\*;:{}=_()?@\\s\\'\\-\\\"]/g);\n let newSplit = sw.removeStopwords(split);\n let newText = \"\";\n let count = 0;\n for( let tmp of newSplit){\n let word = tmp.replace(/[\\d+]/g,\"\"); // remove digits\n if(word.length==0){\n continue;\n }\n try {\n if(spellChecker.isMisspelled(word)){\n let arr = await spellChecker.getCorrectionsForMisspelling(word);\n if(arr.length>0){\n word = arr[0];\n }\n }\n } catch (error) {\n console.log(error)\n }\n word = stemmer(word); // stem words\n word = word.toLowerCase();\n newText = newText+ word+' ';\n count++;\n }\n\n if(count<3){ // index elimination\n return \"\";\n }\n return newText;\n}", "title": "" }, { "docid": "d6d5e9df2ea43e7a063583b13d320c4d", "score": "0.5330245", "text": "function lux(){\n world.spell('A tiny wisp of light appears out of thin air and illuminates the surroundings');\n}", "title": "" }, { "docid": "4e92519f328405ca2d5e9485b79dc72b", "score": "0.532852", "text": "function multigreeting(name, language) {\n language = language.toLowerCase() \n if (language === 'en') { return `Hello, ${name}!`}\n if (language === 'es') { return `¡Hola, ${name}!`}\n if (language === 'fr') { return `Bonjour, ${name}!`}\n if (language === 'eo') { return `Saluton, ${name}!`}\n }", "title": "" }, { "docid": "64a770bb00f627b1a968c773cf66ddaf", "score": "0.53257716", "text": "function helloWorld(lang) {\n //conditional statment checking to see if the argument is es\n if(lang===\"es\"){\n //returns hello world in es\n return \"Hola Mundo\"\n }else if(lang===\"en\"){\n //conditional statment checking to see if the argment is en\n //returns hello World in en\n return \"Hello World\"\n //conditional statment checking to see if the argment is de\n }else if(lang===\"de\"){\n //returns hello world in de\n return \"Hallo Welt\"\n }else{\n //catch all to other arguments\n return \"Hello World\"\n }\n}", "title": "" }, { "docid": "47448e4fba38a4c58a2898e6561c10e4", "score": "0.5315341", "text": "function setLanguage(domain){\r\n t['left'] = 'left'; // For right-to-left languages... defaults to left-to-right\r\n // Until we have translations for all the languages\r\n t['Clear'] = 'Clear';\r\n t['Vassal Villages'] = 'Vassal Villages';\r\n t['Archive'] = 'Archive';\r\n t['Start loading messages'] = 'Start loading messages';\r\n t['Stop loading messages'] = 'Stop loading messages';\r\n t['Invert'] = 'Invert';\r\n t['Reload date format'] = 'Reload date format';\r\n switch (domain){\r\n default: // English\r\n\tt['Turn filter on'] = 'Turn filter on';\r\n\tt['Turn filter off'] = 'Turn filter off';\r\n\tt['View messages'] = 'View messages';\r\n\tt['Clear'] = 'Clear';\r\n\tt['Vassal Villages'] = 'Vassal Villages';\r\n\tt['Archive'] = 'Archive';\r\n\tt['Start loading messages'] = 'Start loading messages';\r\n\tt['Stop loading messages'] = 'Stop loading messages';\r\n\tt['Invert'] = 'Invert';\r\n\tt['Reload date format'] = 'Reload date format';\r\n\tbreak;\r\n case 'ae': // Arabic\r\n\tt['left'] = 'right';\r\n\tt['Turn filter on'] = 'التصفية لاتعمل';\r\n\tt['Turn filter off'] = 'التصفية تعمل';\r\n\tt['View messages'] = 'عرض الرسائل';\r\n\tt['Clear'] = 'إغلاق رسائل ';\r\n\tbreak;\r\n case 'ba': // Bosnian\r\n\tt['Turn filter on'] = 'Uključi filter';\r\n\tt['Turn filter off'] = 'Isključi filter';\r\n\tt['View messages'] = 'Pogledaj poruke';\r\n\tbreak;\r\n case 'cz': // Czech\r\n\tt['Turn filter on'] = 'Zapnout filtr';\r\n\tt['Turn filter off'] = 'Vypnout filtr';\r\n\tt['View messages'] = 'Prohlídnout zprávy';\r\n\tbreak;\r\n case 'nl': // Dutch\r\n\tt['Turn filter on'] = 'Filter activeren';\r\n\tt['Turn filter off'] = 'Filter de-activeren';\r\n\tt['View messages'] = 'Berichten bekijken';\r\n\tt['Clear'] = 'Wissen';\r\n\tbreak;\r\n case 'de': // German\r\n\tt['Turn filter on'] = 'Filter aktivieren';\r\n\tt['Turn filter off'] = 'Filter deaktivieren';\r\n\tt['View messages'] = 'Zeige nachrichten';\r\n\tbreak;\r\n case 'co': // Hebrew\r\n\tt['left'] = 'right';\r\n\tt['Turn filter on'] = 'הפעל מסנן';\r\n\tt['Turn filter off'] = 'כבה מסנן';\r\n\tt['View messages'] = 'בדוק הודעות';\r\n\tbreak;\r\n case 'it': // Italian\r\n\tt['Turn filter on'] = 'Attiva i filtri';\r\n\tt['Turn filter off'] = 'Disattiva i filtri';\r\n\tt['View messages'] = 'Guarda i messaggi';\r\n\tt['Clear'] = 'Ripulisci';\r\n\tt['Vassal Villages'] = 'Villaggi vassalli';\r\n\tt['Archive'] = 'Archivio';\r\n\tbreak;\r\n case 'lt': // Lithuanian\r\n\tt['Turn filter on'] = 'Įjungti filtrą';\r\n\tt['Turn filter off'] = 'Išjungti filtrą';\r\n\tt['View messages'] = 'Peržiūrėti žinutes';\r\n\tt['Clear'] = 'Išvalyti';\r\n\tt['Vassal Villages'] = 'Vasalinės Gyvenvietės';\r\n\tt['Archive'] = 'Archyvas';\r\n\tt['Start loading messages'] = 'Užkrauti žinutes';\r\n\tt['Stop loading messages'] = 'Stabdyti žinučių korvimą';\r\n\tt['Invert'] = 'Apversti';\r\n\tt['Reload date format'] = 'Perkrauti datą';\r\n\tbreak;\r\n case 'pl': // Polish\r\n\tt['Turn filter on'] = 'Włącz filtr';\r\n\tt['Turn filter off'] = 'Wyłącz filtr';\r\n\tt['View messages'] = 'Pokaż wiadomości';\r\n\tt['Clear'] = 'Wyczyść';\r\n\tt['Vassal Villages'] = 'Osady dłużników';\r\n\tt['Archive'] = 'Archiwum';\r\n\tt['Start loading messages'] = 'Zacznij ładować wiadomości';\r\n\tt['Stop loading messages'] = 'Zatrzymaj ładowanie wiadomości';\r\n\tt['Invert'] = 'Odwróć';\r\n\tbreak;\r\n case 'pt': // Portuguese\r\n case 'br':\r\n\tt['Turn filter on'] = 'Ligar o filtro';\r\n\tt['Turn filter off'] = 'Desligar o filtro';\r\n\tt['View messages'] = 'Ver mensagens';\r\n\tbreak;\r\n case 'ro': // Romanian\r\n\tt['Turn filter on'] = 'Activează Filtru';\r\n\tt['Turn filter off'] = 'Dezactivează Filtru';\r\n\tt['View messages'] = 'Citește Mesaje'; \r\n\tbreak;\r\n case 'ru': // Russian\r\n\tt['Turn filter on'] = 'Включить фильтр';\r\n\tt['Turn filter off'] = 'Выключить фильтр';\r\n\tt['View messages'] = 'Просмотр его сообщений';\r\n\tt['Clear'] = 'Очистить';\r\n\tbreak;\r\n case 'rs': // Serbian\r\n\tt['Turn filter on'] = 'Укључи филтер';\r\n\tt['Turn filter off'] = 'Искључи филтер';\r\n\tt['View messages'] = 'Погледај поруке';\r\n\tbreak;\r\n case 'sk': // Slovak\r\n\tt['Turn filter on'] = 'Zapnúť filter';\r\n\tt['Turn filter off'] = 'Vypnúť filter';\r\n\tt['View messages'] = 'Pozrieť správy';\r\n\tbreak;\r\n case 'si': // Slovenian\r\n\tt['Turn filter on'] = 'Vklopi filter';\r\n\tt['Turn filter off'] = 'Izklopi filter';\r\n\tt['View messages'] = 'Pregled sporočil';\r\n \tt['Clear'] = 'Počisti';\r\n \tt['Vassal Villages'] = 'Nekaj kar ti plačuje';\r\n \tt['Archive'] = 'Arhiv';\r\n \tt['Start loading messages'] = 'Začni nalagat (s)poročila';\r\n \tt['Stop loading messages'] = 'Končaj z nalaganjem (s)poročil';\r\n \tt['Invert'] = 'Obrni';\r\n\tbreak;\r\n case 'es': // Spanish Spain\r\n case 'ar': // Spanish Argentina \r\n case 'cl': // Spanish Chile \r\n case 'mx': // Spanish Mexico \r\n\tt['Turn filter on'] = 'Activar filtro';\r\n\tt['Turn filter off'] = 'Desactivar filtro';\r\n\tt['View messages'] = 'Ver mensajes';\r\n\tbreak;\r\n case 'se': // Swedish\r\n\tt['Turn filter on'] = 'Starta filtret';\r\n\tt['Turn filter off'] = 'Stäng av filtret';\r\n\tt['View messages'] = 'Se meddelande';\r\n\tt['Clear'] = 'Radera';\r\n\tt['Vassal Villages'] = 'Vasall stad';\r\n\tbreak;\r\n }\r\n}", "title": "" }, { "docid": "c13eeae5caf308ccbb12ace402cf6284", "score": "0.5313237", "text": "function translateToMeowish(str) {\n if (str.length === 0) {\n return 'Meow!';\n }\n\n const re = /[^\\r\\n.!?]+(:?(:?\\r\\n|[\\r\\n]|[.!?])+|$)/gi;\n const sentenceArray = str.trim().match(re);\n\n function meowifyWords(str) {\n return str\n .trim()\n .split(' ')\n .map(word => {\n const letters = [['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], ['i', 'k', 'l', 'm', 'n', 'o', 'p', 'q'], ['r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']];\n if (letters[0].some(char => word.charAt(0).toLowerCase().indexOf(char) >= 0)) {\n return 'meow';\n } else if (letters[1].some(char => word.charAt(0).toLowerCase().indexOf(char) >= 0)) {\n return 'miau';\n } else if (letters[2].some(char => word.charAt(0).toLowerCase().indexOf(char) >= 0)) {\n return 'purr';\n } else {\n return word;\n }\n })\n .join(' ');\n }\n\n return sentenceArray\n .map(sentence => {\n const punctuation = ['.', '?', '!'];\n if (punctuation.some(char => sentence.charAt(sentence.length - 1).indexOf(char) >= 0)) {\n return meowifyWords(sentence) + sentence.charAt(sentence.length - 1);\n } else {\n return meowifyWords(sentence);\n }\n })\n .join(' ');\n}", "title": "" }, { "docid": "dda557517ef9bb550482881ed76df010", "score": "0.5310769", "text": "function helloWorld( languageCode){\r\n if( languageCod === 'fr'){\r\n return 'Bonjour tout le monde';\r\n }\r\n else if( languageCod === 'es'){\r\n return 'hola, Mundo';\r\n }\r\n else{\r\n return 'Hello, World';\r\n }\r\n}", "title": "" }, { "docid": "cc30e787eeeccd52fedd60992f8cc0c7", "score": "0.53082967", "text": "[LANG_INIT](state, json) {\n state.content = new Function(`return ${JSON.stringify(json)}`); // pour éviter de parser deux fois.\n state.languages = Object.keys(json);\n\n let language = localStorage.language;\n\n if (!language)\n language = navigator.language || 'en';\n\n state.code = Object.keys(json).includes(language) ? language : 'en'; // langue de base: anglais\n\n // on stocke cette info dans le local storage\n localStorage.language = state.code;\n }", "title": "" }, { "docid": "adf8b5ed8127e6c46b2ce5ad8eb03f49", "score": "0.5307437", "text": "function greet(lang) {\n if (lang === \"en\") {\n en(); return;\n }\n if (lang === 'es') {\n es(); return;\n }\n console.log('Namaskara..in KA');\n}", "title": "" }, { "docid": "3d1526b2da72b38e9823a286668c7969", "score": "0.53042036", "text": "function nonsenseWord() {\n var word = chance.word({syllables: 3});\n return word;\n}", "title": "" }, { "docid": "3ccbcb96e2e8ccc49cf9a335756ed68e", "score": "0.53028387", "text": "function changeText() {\n for (let i = 0; i < translations.length; i++) {\n let prop = translations[i].id;\n if (language === 'langheb') {\n translations[i].classList.add('hebrew');\n } else {\n if(translations[i].classList.contains('hebrew')){\n translations[i].classList.remove('hebrew');\n }\n }\n translations[i].textContent = languages[language][prop];\n }\n}", "title": "" }, { "docid": "08fab3a460fede0d568194eb12561ecf", "score": "0.5297634", "text": "function getLanguageNames() {\n return {\"af\":\"Afrikaans\",\"sq\":\"Albanian\",\"am\":\"Amharic\",\"ar\":\"Arabic\",\"hy\":\"Armenian\",\"az\":\"Azeerbaijani\",\"eu\":\"Basque\",\"be\":\"Belarusian\",\"bn\":\"Bengali\",\"bs\":\"Bosnian\",\"bg\":\"Bulgarian\",\"ca\":\"Catalan\",\"ceb\":\"Cebuano\",\"ny\":\"Chichewa\",\"zh\":\"Chinese (Simplified)\",\"zh-TW\":\"Chinese (Traditional)\",\"co\":\"Corsican\",\"hr\":\"Croatian\",\"cs\":\"Czech\",\"da\":\"Danish\",\"nl\":\"Dutch\",\"en\":\"English\",\"eo\":\"Esperanto\",\"et\":\"Estonian\",\"tl\":\"Filipino\",\"fi\":\"Finnish\",\"fr\":\"French\",\"fy\":\"Frisian\",\"gl\":\"Galician\",\"ka\":\"Georgian\",\"de\":\"German\",\"el\":\"Greek\",\"gu\":\"Gujarati\",\"ht\":\"Haitian Creole\",\"ha\":\"Hausa\",\"haw\":\"Hawaiian\",\"iw\":\"Hebrew\",\"hi\":\"Hindi\",\"hmn\":\"Hmong\",\"hu\":\"Hungarian\",\"is\":\"Icelandic\",\"ig\":\"Igbo\",\"id\":\"Indonesian\",\"ga\":\"Irish\",\"it\":\"Italian\",\"ja\":\"Japanese\",\"jw\":\"Javanese\",\"kn\":\"Kannada\",\"kk\":\"Kazakh\",\"km\":\"Khmer\",\"ko\":\"Korean\",\"ku\":\"Kurdish\",\"ky\":\"Kyrgyz\",\"lo\":\"Lao\",\"la\":\"Latin\",\"lv\":\"Latvian\",\"lt\":\"Lithuanian\",\"lb\":\"Luxembourgish\",\"mk\":\"Macedonian\",\"mg\":\"Malagasy\",\"ms\":\"Malay\",\"ml\":\"Malayalam\",\"mt\":\"Maltese\",\"mi\":\"Maori\",\"mr\":\"Marathi\",\"mn\":\"Mongolian\",\"my\":\"Burmese\",\"ne\":\"Nepali\",\"no\":\"Norwegian\",\"ps\":\"Pashto\",\"fa\":\"Persian\",\"pl\":\"Polish\",\"pt\":\"Portuguese\",\"ma\":\"Punjabi\",\"ro\":\"Romanian\",\"ru\":\"Russian\",\"sm\":\"Samoan\",\"gd\":\"Scots Gaelic\",\"sr\":\"Serbian\",\"st\":\"Sesotho\",\"sn\":\"Shona\",\"sd\":\"Sindhi\",\"si\":\"Sinhala\",\"sk\":\"Slovak\",\"sl\":\"Slovenian\",\"so\":\"Somali\",\"es\":\"Spanish\",\"su\":\"Sundanese\",\"sw\":\"Swahili\",\"sv\":\"Swedish\",\"tg\":\"Tajik\",\"ta\":\"Tamil\",\"te\":\"Telugu\",\"th\":\"Thai\",\"tr\":\"Turkish\",\"uk\":\"Ukrainian\",\"ur\":\"Urdu\",\"uz\":\"Uzbek\",\"vi\":\"Vietnamese\",\"cy\":\"Welsh\",\"xh\":\"Xhosa\",\"yi\":\"Yiddish\",\"yo\":\"Yoruba\",\"zu\":\"Zulu\"};\n}", "title": "" }, { "docid": "813b297a6a5f0975d41d8e8e958154cf", "score": "0.52973205", "text": "function encodeText(text) {\n\n let split_text = text.split(\" \")\n let newText = \"\";\n\n for(word of split_text){\n if(word.endsWith(\".\"))\n {\n\n console.log(\"In period\");\n let no_punc = word.slice(0,-1);\n newText += no_punc = encodeWord(no_punc) + \".\"; \n\n }\n\n else if(word.endsWith(\"?\")){\n \n console.log(\"In question mark\");\n let no_punc = word.slice(0,-1);\n newText += no_punc = encodeWord(no_punc) + \"?\"; \n }\n\n else if(word.endsWith(\"!\")){\n \n console.log(\"In exclamation mark\");\n let no_punc = word.slice(0,-1);\n newText += no_punc = encodeWord(no_punc) + \"!\"; \n }\n\n \n else{\n \n newText += newText = encodeWord(word) + \" \";\n } \n \n }\n\n return newText; // replace this!\n}", "title": "" }, { "docid": "c09fd9f42965fcd8ade9ca088cbb6a2d", "score": "0.529492", "text": "static define(parser, config = {}) {\n let languageData = Facet.define({\n combine: config.languageData ? values => values.concat(config.languageData) : undefined\n });\n return new LezerSyntax(parser.withProps(languageDataProp.add({ [parser.topType.name]: languageData })), config.dialect || \"\", languageData);\n }", "title": "" }, { "docid": "b887cf0e9cba90b2e7c1b143ce1b9a24", "score": "0.5293883", "text": "function $l(key,text) {\r\n\tvar string, l;\r\n\tif (lang[language][key]) { string = lang[language][key]; l = language; }\r\n\telse { string = lang['en'][key]; l = 'en'}\r\n\tif (text) { string = string.replace('%s', text); }\r\n\treturn string; // + ' [' + l + ']';\r\n}", "title": "" }, { "docid": "494b6ce309c55757aa4dfafc1f75aabc", "score": "0.52863604", "text": "function add_to_defns(word, data) {\n var meanings = [];\n var sentences = [];\n // Traverse Glosbe's JSON return value; extract meanings\n for (var t in data.tuc) {\n for (var m in data.tuc[t].meanings) {\n var defn = data.tuc[t].meanings[m];\n if (defn.language == \"eng\") {\n meanings.push(defn.text.toLowerCase());\n }\n }\n }\n\n for (var e in data.examples) {\n sentences.push(data.examples[e].first + \"<br>\");\n sentences.push(\"(<i>\" + data.examples[e].second + \"</i>)<br><br>\");\n }\n\n // Remove duplicate meanings\n var unique_meanings = [];\n $.each(meanings, function(i, el){\n if($.inArray(el, unique_meanings) === -1) unique_meanings.push(el);\n });\n\n var numbered_meanings = [];\n $.each(unique_meanings, function(i, el) {\n if (i==0) {\n numbered_meanings.push(\"1. <strong>\" + el.replace(/,+$/, \"\") + \"</strong><br>\");\n } else {\n numbered_meanings.push(i+1 + \". \" + el.replace(/,+$/, \"\") + \"<br>\");\n }\n })\n\n word_list[word] = numbered_meanings.join(\"\");\n word_list[word.hashCode()] = sentences.join(\"\");\n\n}", "title": "" }, { "docid": "bd7f2855e369b55c58ff59560d03a2a0", "score": "0.5283271", "text": "function und() {\n return singleLanguageTuples('und');\n}", "title": "" }, { "docid": "baab0456f57ec0add2bbd3650653e087", "score": "0.5279718", "text": "function VF_MULTI_LoadTextStrings_JPN()\n{\n \n /* Dereference the system array for easier and faster access */\n\n//#ifscript\n var arraystrText = VF_System.arraystrMultilingualText; \n//#else\n//# var arraystrText : String[] = VF_System.arraystrMultilingualText; \n//#endif \n \n /* ================== */ \n /* Define the strings */ \n /* ================== */ \n\n /* arraystrText[nnn] = \"Text string\" */\n\n arraystrText[0] = \"技術サポート...\"; \n arraystrText[1] = \"Visual LANSA フレームワーク\"; \n arraystrText[2] = \"ロードできませんでした\"; \n arraystrText[3] = \"不明な理由のためにロードできませんでした\"; \n arraystrText[4] = \"致命的エラーウィンドウ\"; \n arraystrText[5] = \"ツリービュー\"; \n arraystrText[6] = \"リストビュー\"; \n arraystrText[7] = \"システムスタートアップの間、サーバーシステムに接続することはできません\"; \n arraystrText[8] = \"ビジー\"; \n arraystrText[9] = \"レディ\"; \n arraystrText[10] = \"致命的なエラー\"; \n arraystrText[11] = \"ファンクションで致命的エラーが見つかりました \"; \n arraystrText[12] = \"エラーの明細 :\"; \n arraystrText[13] = \"\"; \n arraystrText[14] = \"システムは’閉じる’か’サインオフ’の要求によってクローズしました。\"; \n arraystrText[15] = \"システムはメインウィンドウを閉じるか、別のサイトに移動することにより、クローズされました。’閉じる’メニューオプションを使用してください(可能な場合).\"; \n arraystrText[16] = \"サーバーシステムに接続することができなかったため、システムは終了しました\"; \n arraystrText[17] = \"システム再スタート\"; \n arraystrText[18] = \"このウィンドウを閉じる\"; \n arraystrText[19] = \"サーバーからシステム定義の明細をロードしています\"; \n arraystrText[20] = \"サーバーシステムとの初期接続を確立しています\"; \n arraystrText[21] = \"ユーザーインターフェースを作成しています\"; \n arraystrText[22] = \"システムを初期化しています\"; \n arraystrText[23] = \"初期化が正しく完了しました\"; \n arraystrText[24] = \"サーバーシステムでリクエストを実行しています\"; \n arraystrText[25] = \"リクエストをサーバーシステムへ送信しました\"; \n arraystrText[26] = \"リモートサーバーシステムへサインオンしなかったため、システムは終了しました。\"; \n arraystrText[27] = \"リモートサーバーシステムへのサインオンが失敗しました。指定されたユーザープロファイル/パスワードは無効です。\"; \n arraystrText[28] = \"サインオンしなかったため、システムは終了しました。\"; \n arraystrText[29] = \"リモートサーバーシステムへサインオンしています。\"; \n arraystrText[30] = \"リモートサーバーシステムへサインオンします\"; \n arraystrText[31] = \"ユーザー\"; \n arraystrText[32] = \"パスワード\"; \n arraystrText[33] = \"サインオン\"; \n arraystrText[34] = \"キャンセル\"; \n arraystrText[35] = \"現行のWEBEVENTフィルタまたはコマンドハンドラで問題が見つかりました。 この問題には多くの原因があります。\\r(1). フィルタまたはコマンドハンドラの実行に失敗し、Webサーバー上で異常終了しました。\\r(2). フィルタまたはコマンドハンドラは正しくセットアップされませんでした。\\r詳細はオンラインガイドのトラブルシューティングを参照し、問題解決チェックリストを確認してください。\\r簡単なチェックリストを示します:\\r=> ファンクションがオプション*DIRECTと*WEBEVENTを使用。.\\r=> 最初のコマンドは Include Process(*Direct) Function(VFSTART)を含む。\\r=> 最後から2番目のコマンドは Include Process(*Direct) Function(VFEND)を含む。\\r=> 実行される最後のコマンドはDISPLAYかREQUEST。 \\r=> DISPLAY/REQUESTコマンドは1つのみ。\\r=> Include Process(*Direct) Function(VFSTART)は一度のみ実行。\\r=> Include Process(*Direct) Function(VFEND)は一度のみ実行。\\r=> 全てのVF_とFP_組込み関数はInclude Process(*Direct) Function(VFSTART) と Include Process(*Direct) Function(VFEND)の間で実行する。前や後ろは不可。.\\r=> DISPLAY/REQUESTコマンドのフィールドはラベルか記述が識別される。欄見出しは使用しない。 \\r=> DISPLAY/REQUESTコマンドではDESIGN(*DOWN)を使用。\\r=> コマンドハンドラまたはフィルタが属するプロセスは開発者のコンソールで正しくセットアップされている(例:LANSA for the Webスケルトンは所有するプロセスで正しく作成されている)。\\r=> 全てのオブジェクト割当とロックはファンクション完了時に開放された。 \\r=> 全てのデータベースの変更はファンクション完了時にコミットされた。 \\r=>VF_TRACEAVALUEとVF_TRACENVALUE組込関数を使用して出力される追加ユーザートレース明細を作るために、トレースモードでフィルタまたはコマンドハンドラを実行してみてください。\"; \n arraystrText[36] = \"トレース明細のクリア\"; \n arraystrText[37] = \"クライアント側トレース明細は青で表示。\"; \n arraystrText[38] = \"サーバー側トレース明細は赤で表示。\"; \n arraystrText[39] = \"メッセージは緑で表示。\"; \n arraystrText[40] = \"時間\"; \n arraystrText[41] = \"時\"; \n arraystrText[42] = \"分\"; \n arraystrText[43] = \"秒\"; \n arraystrText[44] = \"値 \"; \n arraystrText[45] = \" 無効\"; \n arraystrText[46] = \" リセットされた\"; \n arraystrText[47] = \"日付\"; \n arraystrText[48] = \"January\"; \n arraystrText[49] = \"February\"; \n arraystrText[50] = \"March\"; \n arraystrText[51] = \"April\"; \n arraystrText[52] = \"May\"; \n arraystrText[53] = \"June\"; \n arraystrText[54] = \"July\"; \n arraystrText[55] = \"August\"; \n arraystrText[56] = \"September\"; \n arraystrText[57] = \"October\"; \n arraystrText[58] = \"November\"; \n arraystrText[59] = \"December\";\n\n/* These strings are used as the Day headers in Modal Calendar. You could use only one letter, eg M T W, etc */\n \n arraystrText[60] = \"月\"; \n arraystrText[61] = \"火\"; \n arraystrText[62] = \"水\"; \n arraystrText[63] = \"木\"; \n arraystrText[64] = \"金\"; \n arraystrText[65] = \"土\"; \n arraystrText[66] = \"日\";\n\n/* */\n arraystrText[67] = \"利用可能なメッセージがありません\";\n arraystrText[68] = \"メッセージ\";\n\n arraystrText[69] = \"ツールバー上に表示\";\n\n arraystrText[70] = \"**SPARE**\";\n \n arraystrText[71] = \"JAN\"; /* Do not Translate */\n arraystrText[72] = \"FEB\"; /* Do not Translate */\n arraystrText[73] = \"MAR\"; /* Do not Translate */\n arraystrText[74] = \"APR\"; /* Do not Translate */\n arraystrText[75] = \"MAY\"; /* Do not Translate */\n arraystrText[76] = \"JUN\"; /* Do not Translate */\n arraystrText[77] = \"JUL\"; /* Do not Translate */\n arraystrText[78] = \"AUG\"; /* Do not Translate */\n arraystrText[79] = \"SEP\"; /* Do not Translate */\n arraystrText[80] = \"OCT\"; /* Do not Translate */\n arraystrText[81] = \"NOV\"; /* Do not Translate */\n arraystrText[82] = \"DEC\"; /* Do not Translate */\n\n arraystrText[83] = \"月曜日\"; \n arraystrText[84] = \"火曜日\"; \n arraystrText[85] = \"水曜日\"; \n arraystrText[86] = \"木曜日\"; \n arraystrText[87] = \"金曜日\"; \n arraystrText[88] = \"土曜日\"; \n arraystrText[89] = \"日曜日\"; \n\n arraystrText[90] = \"月\"; \n arraystrText[91] = \"火\"; \n arraystrText[92] = \"水\"; \n arraystrText[93] = \"木\"; \n arraystrText[94] = \"金\"; \n arraystrText[95] = \"土\"; \n arraystrText[96] = \"日\"; \n\n arraystrText[97] = \"サーバーシステムはアクセスを拒否しました。\"; \n arraystrText[98] = \"使用しているフレームワークはブラウザベースアプリケーションとして使用可能となっていません。\"; \n arraystrText[99] = \"リモートサーバーシステムへのサインオンが失敗しました。指定されたパスワードは正しくありません。\"; \n arraystrText[100] = \"リモートサーバーシステムへのサインオンが失敗しました。このアプリケーションフレームワークを使用する権限を持っていません。詳細はシステム管理者へ問い合わせてください。\"; \n arraystrText[101] = \"リモートサーバーシステムへのサインオンが失敗しました。アプリケーションフレームワークセキュリティが使用可能になっていますが、使用されたユーザープロファイルがアプリケーションフレームワークセキュリティシステムで定義されていません。.\"; \n\n arraystrText[102] = \"戻る/進むキーは無視されました。\"; \n arraystrText[103] = \" トレース明細の印刷 \"; \n arraystrText[104] = \"時間\"; \n arraystrText[105] = \"トレースイベント\"; \n\n arraystrText[106] = \"上へ\"; \n arraystrText[107] = \"下へ\"; \n arraystrText[108] = \"カレンダー\"; \n arraystrText[109] = \"XMLデータアイランド(もしくは同等のスクリプト)が見つからないか、無効です。 この問題には多くの原因があります。 原因のいくつかを示します。: (1). 無効または存在しない物理/バーチャルディレクトリ名が管理者コンソールで指定された。 (2). SSIサポートの設定がWebサーバーで正しく構成されていない。 (3). コードページ変換が無効なXMLを作成する原因となっている。 (4). 他の原因: 詳細は製品ドキュメントを参照してください。\"; \n\n arraystrText[110] = \"入力値は指定された長さに切り捨てられます\"; \n arraystrText[111] = \"長さ、小数点の数、値が無効です\"; \n\n arraystrText[112] = \"コピー\"; \n arraystrText[113] = \"貼り付け\"; \n\n arraystrText[114] = \"ダウンロード\"; \n arraystrText[115] = \"アップロード\"; \n arraystrText[116] = \"ファイルサイズが許可された最大数より大きい\"; \n arraystrText[117] = \"アップロードされないファイル\"; \n arraystrText[118] = \"ファイルが見つからない\"; \n\n arraystrText[119] = \"警告: サーバーからダウンロード(または以前のキャッシュ)されるサーバーソフトウエアとクライアントソフトウエアはビルド番号が異なります。 サーバーソフトウエアビルド番号 \"; \n arraystrText[120] = \". ダウンロードされたクライアントソフトウエアビルド番号 \"; \n arraystrText[121] = \". この警告メッセージを表示させないためには、ブラウザのキャッシュをクリアしてこのアプリケーションを再スタートしてください。それでもこの警告が表示される場合はアプリケーションプロバイダへこの警告メッセージを報告してください。\"; \n\n arraystrText[122] = \"このアプリケーションは使用中にロックされました。 \"; \n arraystrText[123] = \"のみ \"; \n arraystrText[124] = \" このアプリケーションをアンロックできます。 \"; \n arraystrText[125] = \"もしユーザーの場合 \"; \n arraystrText[126] = \" このアプリケーションの使用を続けるためにパスワードを再度入力してクリックしてください。 \"; \n arraystrText[127] = \"このアプリケーションを終了するためにはキャンセルをクリックしてください。\"; \n arraystrText[128] = \"レジューム\"; \n arraystrText[129] = \"不活動でタイムアウトしたため、システムは自動的にクローズされます。\"; \n\n arraystrText[130] = \"警告: フォームレイアウトの変更は保存されませんでした。\";\n arraystrText[131] = \"フォームレイアウトの変更を保存したい \";\n arraystrText[132] = \"OKをクリックするとフォームレイアウトの変更が保存されます、キャンセルをクリックすると変更の保存は回避されます\";\n arraystrText[133] = \"フォームレイアウトの変更はファイルに保存されます \";\n arraystrText[134] = \"ファイルシステムオブジェクトのインスタンスを作成することができない。\";\n arraystrText[135] = \"ファイルオープン時にエラーが発生したため、フォームレイアウトの変更は保存することができません\";\n\n arraystrText[136] = \"UB_XXXXX プッシュボタン\";\n arraystrText[137] = \"全体のボタンエリア <TD>\";\n arraystrText[138] = \"利用できないプロパティ\";\n arraystrText[139] = \"フォーム名\";\n arraystrText[140] = \"エレメント名\";\n arraystrText[141] = \"エレメントタイプ\";\n arraystrText[142] = \"利用できない記述\";\n arraystrText[143] = \"保存\";\n arraystrText[144] = \"全体のフィールドエリア <TD>\";\n arraystrText[145] = \"全体のブラウズリストエリア <TD>\";\n arraystrText[146] = \"位置決め\";\n arraystrText[147] = \"入力フィールド\";\n arraystrText[148] = \"フィールドラベル\";\n arraystrText[149] = \"出力フィールド\";\n arraystrText[150] = \"フィールドとラベルテーブル列 <TR>\";\n arraystrText[151] = \"フォームタイトル\";\n arraystrText[152] = \"説明行\";\n arraystrText[153] = \"注意行\";\n arraystrText[154] = \"仕切り\";\n arraystrText[155] = \"ファストパーツ\";\n arraystrText[156] = \"ファストパーツ ラベル\";\n arraystrText[157] = \"再表示\";\n\n arraystrText[158] = \"全体のブラウズリスト <TABLE>\";\n arraystrText[159] = \"全体の欄見出し行 <TR>\";\n arraystrText[160] = \"個々の欄見出し <TH>\";\n arraystrText[161] = \"全体のデータ行 <TR>\";\n arraystrText[162] = \"個々のデータ行 セル/カラム <TD>\";\n arraystrText[163] = \"入力フィールド <INPUT>\";\n arraystrText[164] = \"出力フィールド及び他のDHTMLエレメント\";\n\n arraystrText[165] = \"DHTML タグタイプ\";\n arraystrText[166] = \"** 未定義 **\";\n arraystrText[167] = \"全体のフォーム <TABLE>\";\n arraystrText[168] = \"全体のフォーム <DIV>\";\n arraystrText[169] = \"全体のボタンエリア <TR>\";\n arraystrText[170] = \"全体のフィールドエリア <TR>\";\n arraystrText[171] = \"全体のブラウズリストエリア <TR>\";\n arraystrText[172] = \"全てのプロパティ\";\n arraystrText[173] = \"他のDHTMLエレメント及びWebコンポーネント\";\n arraystrText[174] = \"HTML表示\";\n arraystrText[175] = \"外部HTML\";\n arraystrText[176] = \"再度フォームをクリックしてオープンする時、ウィンドウをクローズすることを回避します。\";\n arraystrText[177] = \"カラーテーブル\";\n arraystrText[178] = \"DHTMLプロパティヘルプ\";\n arraystrText[179] = \"Go\";\n arraystrText[180] = \"FileSystemObjectメソッド使用はエラーで失敗しました\";\n\n arraystrText[181] = \"フィルタもしくはコマンドハンドラ \";\n arraystrText[182] = \" 応答が失敗 \";\n\n arraystrText[183] = \"待つ\";\n arraystrText[184] = \"シャットダウン\";\n arraystrText[185] = \"チェック\";\n\n arraystrText[186] = \" レスポンスの秒数。\";\n arraystrText[187] = \"フレームワークからサインオフ。\";\n arraystrText[188] = \"Webサーバーのエラー情報。\";\n\n arraystrText[189] = \"現行WAM(Webアプリケーションモジュール)フィルタもしくはコマンドハンドラでエラーが見つかりました。 この問題には多くの原因があります。 (1). フィルタまたはコマンドハンドラの実行に失敗し、Webサーバー上で異常終了しました。 (2). フィルタまたはコマンドハンドラは正しくセットアップされませんでした。 このタイプの問題の詳細についてはオンラインガイドのトラブルシューティングセクションを参照してください。\";\n arraystrText[190] = \"システムはレスポンスの無いフィルタもしくはコマンドハンドラによって強制的にシャットダウンされました。\"; \n\n arraystrText[191] = \"全体のフォーム <BODY>\";\n\n arraystrText[192] = \"コードテーブルがこのフレームワークで定義されていないため、コードテーブル名の参照は無効です。 コードテーブル名 \";\n\n arraystrText[193] = \"電卓\";\n\n\t\t/* These are the postfixes for the day in the date that appears in the status bar. */\n\t\t/* For example, in English, the first of the month will would be 1 followed by arraystrText[194] */\n\t\t/* resulting in 1st. Note that your language might only use one postfix in which case you must */\n\t\t/* still modify the four strings. */\n\t\t/* If you don't want postfixes at all then use a blank space between the quotes */\n\n arraystrText[194] = \"\"; /* used for the first day of the month, 21 and 31 */\n arraystrText[195] = \"\"; /* used for the second day of the month and 22 */\n arraystrText[196] = \"\"; /* used for the thrid day of the month and 23 */\n arraystrText[197] = \"\"; /* used for all the rest of the days of the month */\n arraystrText[198] = \"詳細の情報はWebサイトを参照してください\"; /* default for IntroUrlCaption */\n\n arraystrText[199] = \"自動選択\"; \n \n /* FP_RCALC - Calculator Buttons */\n arraystrText[200] = \"Bksp\";\t\n arraystrText[201] = \"CE\";\t\t\n arraystrText[202] = \"C\";\t\n arraystrText[203] = \"Sqrt\";\t\n arraystrText[204] = \"MC\";\t\t\n arraystrText[205] = \"MR\";\t\t\n arraystrText[206] = \"MS\";\t\t\n arraystrText[207] = \"M+\";\n \n /* Stats */\n\n arraystrText[208] = \"全体(秒)\";\t\t\n arraystrText[209] = \"クライアント-サイド(秒)\";\t\t\n arraystrText[210] = \"サーバー-サイド(秒)\";\t\t\n arraystrText[211] = \"合計\";\t\t\n arraystrText[212] = \"平均\";\t\t\n arraystrText[213] = \"最小\";\t\t\n arraystrText[214] = \"最大\";\t\t\n arraystrText[215] = \"活動\";\t\t\n arraystrText[216] = \"イベント\";\t\t\n arraystrText[217] = \"表示された値 <TD>\";\n arraystrText[218] = \" 秒。どうしますか ?\";\n\n arraystrText[219] = \"最大化\";\n arraystrText[220] = \"復元\";\n \n /* More FLA texts */\n arraystrText[221] = \"Internet Explorerのセキュリティ設定でサーバーへレイアウト変更を書き出すために必須となるActive-Xコントロールを許可しないため、問題が発生します。\";\n arraystrText[222] = \"推奨する解決案はInternet Explorerの信頼されたサイトリストに開発サーバーのIPアドレスおよびホスト名を追加することです。\";\n arraystrText[223] = \"閉じる\";\n\n arraystrText[224] = \"サインオンの失敗の回数が制限を越えました。ユーザーは使用不可となりました\";\n arraystrText[225] = \"サーバーシステムで利用可能な追加情報を確認してください\";\n arraystrText[226] = \"続ける場合はOKをクリックしてください\";\n \n arraystrText[227] = \"無効な値が入力されました。前回の値が復元されます。\";\n arraystrText[228] = \"RAMP\"; \n arraystrText[229] = \"サーバーシステムに接続していません\"; \n arraystrText[230] = \"の最大数に達しました\";\n arraystrText[231] = \"ブラウザに許可されたRAMPセッション\";\n arraystrText[232] = \"返されたユーザ情報が不正です - このメッセージを製品ベンダーに送ってください\";\n arraystrText[233] = \"初期化中\";\n arraystrText[234] = \"フレームワーク作成中\";\n arraystrText[235] = \"セッション割り当て開始中\";\n arraystrText[236] = \"フレームワーク作成継続中\";\n arraystrText[237] = \"コードテーブル作成中\";\n arraystrText[238] = \"初期設定の除去中\";\n arraystrText[239] = \"ユーザーインターフェース作成中\";\n arraystrText[240] = \"Webサーバーからのセッション割り当ての応答を待機中\";\n arraystrText[241] = \"Webサーバーによってセッションが割り当てられました - Webサーバーにサインオン\";\n arraystrText[242] = \"Webサーバーへのサインオンが完了しました\";\n arraystrText[243] = \"実行環境の構築中\";\n arraystrText[244] = \"スタートアップアプリケーションへ切替中\";\n arraystrText[245] = \"System Available\";\n arraystrText[246] = \"RAMPノードとスクリプトのXML定義は以下に保管されます\";\n arraystrText[247] = \"最後に保存された \"; \n arraystrText[248] = \"に\"; \n arraystrText[249] = \" (アプリケーション設計者として使用しているとき、XMLに基づく定義はRAMPセッションをコントロールします). このRAMPセッションで使用される実行時JavaScriptは、保存されたXMLファイルから生成されました。\";\n arraystrText[250] = \" (アプリケーションエンドユーザーとして使用しているとき、実行時JavaScriptはRAMPセッションをコントロールします). このメッセージは、実行時JavaScriptセッションが古く最新のXMLから再生成する必要があるかもしれない、ということを意味します。\"; \n\n/* Following MTXTs are used for the User Details */\n\n arraystrText[251] = \"キャプション\"; \n arraystrText[252] = \"保存\"; \n arraystrText[253] = \"このユーザーが属するグループ\";\n arraystrText[254] = \"選択されたユーザープロフィールを削除する場合はOKをクリックしてください\";\n arraystrText[255] = \"ユーザープロフィール\";\n arraystrText[256] = \"新しいパスワード\";\n arraystrText[257] = \"PCの一時ディレクトリ\";\n arraystrText[258] = \"e-mail アドレス\";\n arraystrText[259] = \"非活動ログオンタイムアウト\"; \n arraystrText[260] = \"新しいパスワードの確認\";\n arraystrText[261] = \"(分)\";\n arraystrText[262] = \"設定\";\n arraystrText[263] = \"非活動ログオフタイムアウト\";\n arraystrText[264] = \"管理ユーザー\";\n arraystrText[265] = \"ユーザーは使用不可\";\n arraystrText[266] = \"newlookユーザー\";\n arraystrText[267] = \"newlookパスワード(任意、めったに使用しない)\";\n arraystrText[268] = \"newlookセッションのユーザー詳細が異なる場合にのみ使用\";\n arraystrText[269] = \"このユーザーが属するグループ\";\n arraystrText[270] = \"内部識別子\";\n arraystrText[271] = \"新しいパスワード、新しいパスワードが同じでないことを確認\";\n arraystrText[272] = \"現在定義されたグループはありません\";\n arraystrText[273] = \"全て選択\";\n arraystrText[274] = \"全て選択解除\";\n arraystrText[275] = \"このグループは1つまたはそれ以上のユーザーに使用されているため、削除できません\"; \n arraystrText[276] = \"ユーザープロフィール桁数エラー\"; \n arraystrText[277] = \"パスワードを(再)指定してください\";\n arraystrText[278] = \"警告: パスワードを再入力してください \"; \n arraystrText[279] = \"のユーザープロパティ\"; \n arraystrText[280] = \" (インスタンスキャプションは指定されていません)\"; \n arraystrText[281] = \"無効な数値\"; \n arraystrText[282] = \"選択/選択解除 をクリック\"; \n arraystrText[283] = \"カスタムプロパティが存在しません\"; \n arraystrText[284] = \"保存して閉じる\"; \n arraystrText[285] = \"保存して次を作成\"; \n \n/* END MTXTs for User Details */\n\n arraystrText[286] = \"webサーバーによる応答でエラーが検出されました。\\r\\rアプリケーション終了前に詳細な問題分析情報を表示しますか?\"; \n arraystrText[287] = \"サーバーセッション割り当てエラーが発生しました。最も考えられる原因は、サーバーが現在利用不可であるか、またはサーバー構成の問題でこの時セッションを割り当てられなかった、ということです。\"; \n arraystrText[288] = \"サーバーでの情報交換時に、内部エラーが検出されました。 最も考えられる原因は、サーバーが利用不可になったか、またはプログラムの実行がサーバーで失敗した、ということです。\"; \n\n arraystrText[289] = \"パスワードの保存\";\n\n arraystrText[290] = \"ローカル タイム\";\n arraystrText[291] = \"GMT タイム\";\n arraystrText[292] = \"アプリケーション\";\n arraystrText[293] = \"<BUSOBJ>検索\";\n arraystrText[294] = \"あなたの要求を処理するためにシステムが現在ビジーです。後でもう一度試みてください。\";\n arraystrText[295] = \"データ読み込み中...\";\n arraystrText[296] = \"より多くのメッセージがあります - 全てのメッセージを見るために'メッセージ'ボタンを押してください\";\n arraystrText[297] = \"ユーザー設定を省略値へ戻す\";\n arraystrText[298] = \"次回のアプリケーション スタート時に、ユーザ設定は省略値に戻されます\";\n\n arraystrText[299] = \"Webサーバーからの応答でエラーが検出されました。\";\n arraystrText[300] = \"詳細の表示\";\n arraystrText[301] = \"システムが致命的エラーを受け取りました。シャットダウンする必要があります。ウィンドウを閉じる前にエラーの詳細を見ることができます。\";\n\n arraystrText[302] = \"クイック検索...\";\n arraystrText[303] = \"タイプ検索ストリング\";\n arraystrText[304] = \"最近の使用\";\n arraystrText[305] = \"検索結果\";\n \n arraystrText[306] = \"リストのクリア\";\n arraystrText[307] = \"リストを表示するナビゲーションペインを変更する\";\n arraystrText[308] = \"ツリーを表示するナビゲーションペインを変更する\";\n\n arraystrText[309] = \"共有テンプレート パッケージを作成\";\n arraystrText[310] = \"全選択\";\n arraystrText[311] = \"選択を解除\";\n arraystrText[312] = \"パッケージ名:\";\n arraystrText[313] = \"出力先フォルダー:\";\n arraystrText[314] = \"パッケージ作成\";\n arraystrText[315] = \"キャンセル\";\n arraystrText[316] = \"リストに入力がありません\";\n arraystrText[317] = \"パッケージに生成が成功しました。\\nパッケージをアップロードしてください:\\n\";\n arraystrText[318] = \"\";\n arraystrText[319] = \" からのウィンドウを作成しようとした時にエラーが検出されました。このサイトに対してポップアップ ブロッカーを停止、またはこのサイトを信頼済みサイトに登録する必要があるかもしれません。このエラーはこの後の処理を妨げるものではありません。OK をクリックして進めてください。\";\n arraystrText[320] = \"IBM i パスワードの変更\";\n arraystrText[321] = \"古いパスワード\"; \n arraystrText[322] = \"変更\"; \n arraystrText[323] = \"IBM i パスワード変更に成功しました。\"; \n arraystrText[324] = \"IBM i パスワード変更エラー\"; \n arraystrText[325] = \"実行が正常に終了しました。成功のコールバッグ ファンクション呼び出し中に致命的なエラーが発生しました。エラー: \"; \n arraystrText[326] = \"実行がエラーで終了しました。さらに、 エラーのコールバッグ ファンクション呼び出し中に致命的なエラーが発生しました。エラー: \"; \n arraystrText[327] = \"実行がエラーで終了しましたが、コールバッグ ファンクションが提供されませんでした。\"; \n arraystrText[328] = \" エラーで終了: \"; \n arraystrText[329] = \"実行が正常に終了しましたが、コールバッグ ファンクションが提供されませんでした。\"; \n \n//#ifnet\n//# // ======================================= \n//# // Update the maximum text number assigned \n//# // ======================================= \n//# //\n//# VF_System.iMultilingualTextHighestIndex = 329;\n//# //\n//#endif \n \n /* Finished */ \n \n//#ifnet\n//# return \"ja-JP\";\n//#endif \n}", "title": "" } ]
bf15b603a9d07165e8f2a9b7a2b670a9
Helper method for defining associations. This method is not a part of Sequelize lifecycle. The `models/index` file will call this method automatically.
[ { "docid": "cd0bec29d7496a2afab053b289aebc80", "score": "0.0", "text": "static associate(models) {\n models.classes.belongsToMany(models.spell, {through: \"spellJoin\", foreignKey: \"classesId\"})\n models.classes.hasMany(models.storedChar)\n }", "title": "" } ]
[ { "docid": "71e5e96d14fbeaedc1c5013cfcf70baf", "score": "0.7373904", "text": "static associate(models) {\n // define association here\n\n /*this.belongsTo(models.estados, { foreignKey: 'estado', as: 'estado'\n })/*, \n this.belongsTo(models.documentos, { foreignKey: 'tipo_identificacion', as: 'identificacion'\n })*/\n }", "title": "" }, { "docid": "3efc5daf5ee79f962e02d128ec7bf63d", "score": "0.7371848", "text": "static associate(models) {\n // define association here\n this.belongsTo(models.Person);\n }", "title": "" }, { "docid": "f9ca2a28e23ffd4e632c7ae032576465", "score": "0.7333677", "text": "static associate(models) {\n // Booking.hasMany(models.User);\n this.belongsTo(models.User);\n // this.belongsTo(models.Address);\n this.belongsTo(models.Provider);\n // this.belongsTo(models.Specialty);\n this.belongsTo(models.Service);\n this.belongsTo(models.Status, {\n foreignKey: {\n allowNull: false,\n }\n });\n // define association here\n }", "title": "" }, { "docid": "b1779617bc13d9ef407c4520fb2e1ab4", "score": "0.7323069", "text": "static associate(models) {\n // define association here\n Todo.hasMany(models.TodoItem, {\n foreignKey: 'todoId',\n as: 'todoItems',\n });\n }", "title": "" }, { "docid": "06e1afc3180bf23bdf5ea14ddc9bebb4", "score": "0.7320052", "text": "static associate(models) {\n // define association here\n Articulo.belongsTo(models.Categoria, { as: \"categoria\", foreignKey: \"id_categoria\" });\n Articulo.hasMany(models.DetallePreparado, { as: \"detallepreparados\", foreignKey: \"id_articulo\" })\n Articulo.belongsTo(models.UnidadMedida, { as: \"unidadmedidas\", foreignKey: \"id_unidad\" })\n }", "title": "" }, { "docid": "5f1782bcc360873c8fb85e4e4cf35278", "score": "0.73078763", "text": "static associate (models) {\n // define association here\n }", "title": "" }, { "docid": "95028f77f00df73a9b9c41d5c60f6bb2", "score": "0.7296079", "text": "static associate(models) {\n this.belongsTo(models.Category, {\n foreignKey: {\n allowNull: false,\n }\n });\n this.belongsTo(models.User, {\n foreignKey: {\n allowNull: false,\n }\n });\n // define association here\n }", "title": "" }, { "docid": "74a127cffdac4c347d214f0baa24ea74", "score": "0.72778916", "text": "static associate(models) {\n this.belongsTo(models.organizations, {\n foreignKey: 'organization_id',\n as: 'organizationLink'\n });\n this.hasMany(models.master_events, {foreignKey: 'organization_client_id'})\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" }, { "docid": "9d8c32e09146456c6bb661824baaa27c", "score": "0.7260307", "text": "static associate(models) {\n // define association here\n }", "title": "" } ]
d338f583037e2410cc5de3ddae8f0fcb
uniqueId generator function memoizes previous values in closure
[ { "docid": "b8a48052ba33190f7f34e0fb61db3a6a", "score": "0.59463024", "text": "function uniqueIdFactory(retryLimit = _RETRY_LIMIT) {\n const hist = {};\n return (size = _SMP_SZ, charset = _CHARSET) => {\n let retryCounter = retryLimit;\n while (retryCounter > 0) {\n const r = generateId(size, charset);\n if (r in hist) {\n retryCounter--;\n } else {\n hist[r] = true;\n return r;\n }\n }\n return null;\n };\n}", "title": "" } ]
[ { "docid": "34ce315a0f0b25f8b0910476cd7962c4", "score": "0.692495", "text": "nextId() {\n this.uniqueId = this.uniqueId || 0\n this.uniqueId += 1\n return this.uniqueId\n }", "title": "" }, { "docid": "a1ac3d3974c7d512be67aa64123bb453", "score": "0.6828786", "text": "function id_gen () {\n id_generator ++;\n return id_generator;\n}", "title": "" }, { "docid": "0add5f9c947b939ff8a22c72b5c37aea", "score": "0.6695248", "text": "function makeUniqueID() {\n uniqueID++;\n return uniqueID;\n}", "title": "" }, { "docid": "9097dc97ad64796006a2a2a280c733f3", "score": "0.66180336", "text": "function uniqueId() {\n return id++;\n}", "title": "" }, { "docid": "4829bf1d7a046c6abac8d1335c6da303", "score": "0.6499909", "text": "function uniqueId()\n{\n\treturn uniqueId.nextId++;\n}", "title": "" }, { "docid": "4829bf1d7a046c6abac8d1335c6da303", "score": "0.6499909", "text": "function uniqueId()\n{\n\treturn uniqueId.nextId++;\n}", "title": "" }, { "docid": "912a829ad087f87a8a9ca58f5d606774", "score": "0.6498863", "text": "genId() {\n let left = Math.floor(Math.random() * 1000000000).toString();\n let right = Math.floor(Math.random() * 100000).toString();\n let genID = left.concat(\".\").concat(right);\n // console.log(parseFloat(genID).toFixed(4));\n genID = parseFloat(genID).toFixed(4);\n\n for (let i in this.dataStore) {\n if (genID === this.dataStore[i].id) {\n console.log(\"Getting unique id...\");\n this.genId();\n }\n }\n return genID;\n }", "title": "" }, { "docid": "d85877c7a33d13f50f2eb3e670403558", "score": "0.64182943", "text": "nextId(){\n\t\t\tthis.uniqueId = this.uniqueId || 0\n\t\t\treturn this.uniqueId++; \n\t\t}", "title": "" }, { "docid": "1e34f77f886fbf1f59e4e06cae079f10", "score": "0.63454354", "text": "idGenerator(idx) {\r\n const date = new Date();\r\n return idx + date.getTime();\r\n }", "title": "" }, { "docid": "8407e130fcbb654ec44b26326c21ce8d", "score": "0.6310428", "text": "function user_id_generator()\n{\n user_count++;\n return user_count;\n}", "title": "" }, { "docid": "66737b93422ad4ccc9f13ce566bffc8c", "score": "0.6303008", "text": "function newId() {\n return nextId++\n}", "title": "" }, { "docid": "cfc9dd28a8813a2fb4b34595f0057d0a", "score": "0.6266193", "text": "getNewUniqueID() {\n\n const possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let usedIDs = this.getAllUsedIDs();\n\n while (true) {\n let newID = \"\";\n for (let i = 0; i < 7; i++) {\n newID += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n\n // make sure that the ID is new before sending it back\n if (usedIDs.indexOf(newID) < 0) {\n return newID;\n }\n }\n }", "title": "" }, { "docid": "0b61e99d0074b7eba7bf7916f56fff05", "score": "0.625643", "text": "sequentialUUID() {\n let counterDiv;\n let counterRem;\n let id = \"\";\n counterDiv = this.counter;\n /* tslint:disable no-constant-condition */\n while (true) {\n counterRem = counterDiv % this.dictLength;\n counterDiv = Math.trunc(counterDiv / this.dictLength);\n id += this.dict[counterRem];\n if (counterDiv === 0) {\n break;\n }\n }\n /* tslint:enable no-constant-condition */\n this.counter += 1;\n return id;\n }", "title": "" }, { "docid": "87b6d9374c75325bdea09bf80e29924d", "score": "0.62465245", "text": "function id() {\r\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\r\n // append a 'a' because neo gets mad\r\n newId = \"a\" + newId;\r\n // ensure not already used\r\n if (!cache[newId]) {\r\n cache[newId] = true;\r\n return newId;\r\n }\r\n return id();\r\n}", "title": "" }, { "docid": "87b6d9374c75325bdea09bf80e29924d", "score": "0.62465245", "text": "function id() {\r\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\r\n // append a 'a' because neo gets mad\r\n newId = \"a\" + newId;\r\n // ensure not already used\r\n if (!cache[newId]) {\r\n cache[newId] = true;\r\n return newId;\r\n }\r\n return id();\r\n}", "title": "" }, { "docid": "520507e24dfdb6341586fd0460fceedd", "score": "0.62425095", "text": "function id() {\n var newId = ('0000' + ((Math.random() * Math.pow(36, 4)) << 0).toString(36)).slice(-4);\n // append a 'a' because neo gets mad\n newId = \"a\" + newId;\n // ensure not already used\n if (!cache[newId]) {\n cache[newId] = true;\n return newId;\n }\n return id();\n}", "title": "" }, { "docid": "5c67c08d3ef82982ad8d387badda6fc5", "score": "0.6241295", "text": "function id() {\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\n // append a 'a' because neo gets mad\n newId = \"a\" + newId;\n // ensure not already used\n if (!cache[newId]) {\n cache[newId] = true;\n return newId;\n }\n return id();\n}", "title": "" }, { "docid": "5c67c08d3ef82982ad8d387badda6fc5", "score": "0.6241295", "text": "function id() {\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\n // append a 'a' because neo gets mad\n newId = \"a\" + newId;\n // ensure not already used\n if (!cache[newId]) {\n cache[newId] = true;\n return newId;\n }\n return id();\n}", "title": "" }, { "docid": "0ba37f1d5f8d95ea12739082f984f745", "score": "0.6193578", "text": "generateId() {\n return Math.round(Math.random() * 100000000)\n }", "title": "" }, { "docid": "3635f1e1979eaff896d7fe09c5eeef29", "score": "0.61757964", "text": "function generateUniqueId() {\r\n //generates a unique ID to be assigned for each circle\r\n return Math.random().toString(36).substring(2) +\r\n (new Date()).getTime().toString(36);\r\n }", "title": "" }, { "docid": "3cb8242d2b08d00879b861ff0f19a0f7", "score": "0.616626", "text": "function uniqueNum() {\r\n uniqueNum.counter += 1;\r\n return uniqueNum.counter;\r\n }", "title": "" }, { "docid": "e5c509063bbf305b5e4b706e4b97cd18", "score": "0.6145615", "text": "function make_unique() {\n make_id_unique($(this),maxRowId);\n }", "title": "" }, { "docid": "6a5e4a643982002d6e8c8cb161ab3356", "score": "0.6143694", "text": "function uniqueInteger(){\r\n\treturn uniqueInteger.counter++;\r\n}", "title": "" }, { "docid": "88227854206e61cb7068696120757842", "score": "0.6131396", "text": "function getUniqueID() {\n return uniqid()\n}", "title": "" }, { "docid": "1f47b0e6d45b52e762c2d3c9e55ef6af", "score": "0.61031973", "text": "generateUniqueId() {\n return parseInt(Math.random() * 100000000000, 10);\n }", "title": "" }, { "docid": "08c0c9a123aeb1e19f47600f380f9d2b", "score": "0.6094463", "text": "function uniqueId() {\n\t\t return id++;\n\t\t}", "title": "" }, { "docid": "c6e5dbe18020ef0a9fb03ba550351474", "score": "0.60853654", "text": "generateId() {\n while (this.idCounter == 0 || this.queue[this.idCounter]) {\n this.idCounter++;\n }\n\n return this.idCounter;\n }", "title": "" }, { "docid": "127fc54a37f3342dc9c4ce3c4d04f7f4", "score": "0.6068666", "text": "_generateId() {\n let timestamp = Date.now();\n let uniqueNumber = 0;\n\n (() => {\n // If created at same millisecond as previous\n if (timestamp <= uniqueNumber) {\n timestamp = ++uniqueNumber;\n } else {\n uniqueNumber = timestamp;\n }\n })();\n\n return 'T' + timestamp;\n }", "title": "" }, { "docid": "a4ca0c3abdd99e0b0fd4a75da8a486ed", "score": "0.6040715", "text": "function generateUniqueID() {\n return Date.now();\n}", "title": "" }, { "docid": "2a83c987c07f390531033e6ca2258300", "score": "0.603447", "text": "function getNewId() {\n return Math.floor(1000 + Math.random() * 9000).toString();\n}", "title": "" }, { "docid": "0cbecf4d50c45383ee5d9496c200164e", "score": "0.60331064", "text": "function generateNewId() {\r\n x = Date.now();\r\n return x;\r\n}", "title": "" }, { "docid": "45ea2bf86fc8f2b7bd0f7439b2583ce2", "score": "0.6028201", "text": "function getUniqueId() {\n uniqueIdcounter++;\n return uniqueIdcounter;\n }", "title": "" }, { "docid": "dd552a0fb21c0a224a2d4fbd38acdee6", "score": "0.6023455", "text": "getUniqueId() {\n return -++this.idCounter;\n }", "title": "" }, { "docid": "bef970b6ddcce1c1d1f81fe699dced51", "score": "0.6020294", "text": "function uniqueID() {\n\treturn Math.floor(Math.random() * Date.now());\n}", "title": "" }, { "docid": "7e399a5235e1e707e0918b9aef950799", "score": "0.6006745", "text": "function fnGenID () {\n var d = new Date().getTime(); \n var randID = ( d + Math.random() * 1000000 ) % 1000000 | 0;\n return randID;\n}", "title": "" }, { "docid": "f9fdb5e9690d536c1c210ca9bbb95d64", "score": "0.6000427", "text": "function generateId() {\n return (new Date()).getTime() - 1283136075795 + (_generateCounter++);\n }", "title": "" }, { "docid": "ab24ed39f7641bf7b70deb23e3d15cc8", "score": "0.5981653", "text": "function uniqueId() {\r\n\treturn (new Date).getTime()\r\n}", "title": "" }, { "docid": "3dfa6d6f898b7373ae72af8f4f3260c5", "score": "0.59656423", "text": "function generateId () {\n return Math.random () * 999999;\n}", "title": "" }, { "docid": "45586eb1e05103894402f6ab7dbb0de6", "score": "0.5965506", "text": "getOrGenerateUniqueIdentifier(name) {\n if (!this.uniqueIdentifiers) {\n this.uniqueIdentifiers = new Map();\n }\n\n let id = this.uniqueIdentifiers.get(name);\n if (!id) {\n const { scope } = this.node.path;\n this.uniqueIdentifiers.set(name, id = scope.generateUidIdentifier(name));\n }\n return id;\n }", "title": "" }, { "docid": "7c8280d01494fdab838c94e7c6981773", "score": "0.5955186", "text": "function resetGenerator() {\n n = 0;\n generate = function generate() {\n return '' + n++;\n };\n}", "title": "" }, { "docid": "7c8280d01494fdab838c94e7c6981773", "score": "0.5955186", "text": "function resetGenerator() {\n n = 0;\n generate = function generate() {\n return '' + n++;\n };\n}", "title": "" }, { "docid": "5656e55a21cf2146de768f2fbb458833", "score": "0.5954564", "text": "function generateId(){ return Math.floor((1 + Math.random()) * 0x100000000000).toString(16); }", "title": "" }, { "docid": "c2661267d55f123e3c4935e9aa865c0e", "score": "0.5936114", "text": "function uniqueId() {\n return (new Date).getTime()\n}", "title": "" }, { "docid": "c2661267d55f123e3c4935e9aa865c0e", "score": "0.5936114", "text": "function uniqueId() {\n return (new Date).getTime()\n}", "title": "" }, { "docid": "3f70fcec758dbbb304b401dc789e4ae1", "score": "0.5933289", "text": "function resetGenerator() {\n n = 0;\n generate = function generate() {\n return '' + n++;\n };\n}", "title": "" }, { "docid": "daf0a13c680fa57dcd3c228ca3093394", "score": "0.5931052", "text": "function Generator(ns, exports) {\n\nvar m_assert = Object(__WEBPACK_IMPORTED_MODULE_1__assert_js__[\"a\" /* default */])(ns);\nvar m_print = Object(__WEBPACK_IMPORTED_MODULE_2__intern_print_js__[\"a\" /* default */])(ns);\n\nvar _next = 1;\nvar _unique_counter = 0;\nvar _unique_name_counters = {};\n\nvar _hash_buffer_in = new Float64Array(1);\nvar _hash_buffer_out = new Uint32Array(_hash_buffer_in.buffer);\n\n/**\n * Compose unique name based on given name.\n */\nexports.unique_name = function(name_base) {\n if (!_unique_name_counters[name_base])\n _unique_name_counters[name_base] = 0;\n\n var name = name_base + _unique_name_counters[name_base];\n _unique_name_counters[name_base]++;\n return name;\n}\n\nexports.cleanup = function() {\n _unique_counter = 0;\n _unique_name_counters = {};\n}\n\n/**\n * Compose unique string ID.\n */\nexports.unique_id = function() {\n _unique_counter++;\n return _unique_counter.toString(10);\n}\n\nexports.gen_color_id = function(counter) {\n\n // black reserved for background\n counter++;\n\n if (counter > 51 * 51 * 51)\n m_print.error(\"Color ID pool depleted\");\n\n // 255 / 5 = 51\n var r = Math.floor(counter / (51 * 51));\n counter %= (51 * 51);\n var g = Math.floor(counter / 51);\n counter %= 51;\n var b = counter;\n\n var color_id = new Float32Array([r/51, g/51, b/51]);\n\n return color_id;\n}\n\n/** get random number */\nexports.rand = function() {\n _next = (_next * 69069 + 5) % Math.pow(2, 32);\n return (Math.round(_next/65536) % 32768)/32767;\n}\n\n/** store seed */\nexports.srand = function(seed) {\n _next = seed;\n}\n\n/**\n * Calculate id for strongly typed variables (batch, render, slink, ...).\n * init_val parameter is a sort of seed.\n */\nexports.calc_variable_id = function(a, init_val) {\n return hash_code(a, init_val);\n}\n\nexports.hash_code = hash_code;\nfunction hash_code(a, init_val) {\n var hash = init_val;\n\n switch (typeof a) {\n case \"object\":\n if (a) {\n // NOTE: some additional props could be added to GL-type objs\n // so don't build hash code for them\n switch (a.constructor) {\n case Object:\n for (var prop in a)\n hash = hash_code(a[prop], hash);\n break;\n case Int8Array:\n case Uint8Array:\n case Uint8ClampedArray:\n case Int16Array:\n case Uint16Array:\n case Int32Array:\n case Uint32Array:\n case Float32Array:\n case Float64Array:\n for (var i = 0; i < a.length; i++)\n hash = hash_code_number(a[i], hash);\n break;\n case Array:\n for (var i = 0; i < a.length; i++)\n hash = hash_code(a[i], hash);\n break;\n case WebGLUniformLocation:\n case WebGLProgram:\n case WebGLShader:\n case WebGLFramebuffer:\n case WebGLRenderbuffer:\n case WebGLTexture:\n case WebGLBuffer:\n hash = hash_code_number(0, hash);\n break;\n default:\n m_assert.panic(\"Wrong object constructor:\", a.constructor);\n break;\n }\n } else\n hash = hash_code_number(0, hash);\n\n return hash;\n case \"number\":\n return hash_code_number(a, hash);\n case \"boolean\":\n return hash_code_number(a | 0, hash);\n case \"string\":\n return hash_code_string(a, hash);\n case \"function\":\n case \"undefined\":\n return hash_code_number(0, hash);\n }\n}\n\nfunction hash_code_number(num, init_val) {\n var hash = init_val;\n _hash_buffer_in[0] = num;\n\n hash = (hash<<5) - hash + _hash_buffer_out[0];\n hash = hash & hash;\n hash = (hash<<5) - hash + _hash_buffer_out[1];\n hash = hash & hash;\n\n return hash;\n}\n\n/**\n * Implementation of Java's String.hashCode().\n */\nfunction hash_code_string(str, init_val) {\n var hash = init_val;\n\n for (var i = 0; i < str.length; i++) {\n var symbol = str.charCodeAt(i);\n hash = ((hash<<5) - hash) + symbol;\n hash = hash & hash; // convert to 32 bit integer\n }\n return hash;\n}\n\n}", "title": "" }, { "docid": "ea4b219e0a5df70c069ab8d1a91786d4", "score": "0.591252", "text": "function generateId() {\n BASE_ID += 1;\n return BASE_ID;\n }", "title": "" }, { "docid": "53bbdc4df24ba5763c2af3079404af52", "score": "0.59098256", "text": "function get(prefix){\n//Generate unique numbers, starting at 1\n\n //var id = uniqueIds.get(prefix) or 0\n var id = uniqueIds.get(prefix) || 0;\n\n //id += 1\n id += 1;\n\n //uniqueIds.set prefix, id\n uniqueIds.set(prefix, id);\n\n //return id\n return id;\n }", "title": "" }, { "docid": "84db84c4ac959aacb37b0f2b7620d7e9", "score": "0.5909073", "text": "generate_id() {\r\n var min = 1; \r\n var max = 100000;\r\n return Math.floor(Math.random() * (+max - +min)) + +min; \r\n }", "title": "" }, { "docid": "148534df49b066cd088e4e020d71d5a9", "score": "0.5901619", "text": "function generateUniqueId() {\n\tfunction s4() {\n\t\treturn Math.floor((1 + Math.random()) * 100000);\n\t}\n\tlet timestamp = new Date().getTime();\n\treturn Number(s4().toString() + timestamp.toString());\n}", "title": "" }, { "docid": "6bae07679679e9615c9e3ca1dc6511c9", "score": "0.58796185", "text": "function UniqueId() {\n var max = Math.max.apply(null, ids);\n var next = max + 1;\n\n return next;\n }", "title": "" }, { "docid": "7465629782764e6facb0fa66aa9d845d", "score": "0.58767945", "text": "generateNewId(){\n let maxQuote = this.props.quoteLength;\n let maxStyle = this.props.styleLength;\n let min = 0;\n let quoteItem;\n let styleItem;\n do {\n quoteItem = Math.floor(Math.random() * (maxQuote - min) + min);\n } while (quoteItem == this.props.qItem);\n do{\n styleItem = Math.floor(Math.random() * (maxStyle - min) + min);\n } while(styleItem == this.props.sItem)\n this.props.getNewItem(quoteItem, styleItem);\n }", "title": "" }, { "docid": "562cbe69ef531409f81fb0f03dd87165", "score": "0.58456576", "text": "function generateId() {\n return Math.random * 99999;\n}", "title": "" }, { "docid": "d5c5ce102e86a4ba3b4a9f0463613349", "score": "0.5835997", "text": "function generateId() {\n return Math.round(Math.random() * 1000000000);\n}", "title": "" }, { "docid": "26a9d3c2204ef88b0eb00c34a6ca3e6b", "score": "0.58027273", "text": "function generateId() {\n // Math.floor give the greatest interger which is less than or equal to its numberic agruments\n return Math.floor(Math.random() * 100000000)\n}", "title": "" }, { "docid": "38179a5655dd761bd1f8ab30e16dc0e8", "score": "0.57721525", "text": "generateId() {\n let result = '';\n let charactersLength = this.idCharacters.length;\n for (let i = 0; i < this.idLength; i++) {\n result += this.idCharacters.charAt(Math.floor(Math.random() * charactersLength));\n }\n\n let generatedIds = JSON.parse(localStorage.getItem('ids'));\n\n if (generatedIds === null) {\n localStorage.setItem('ids', JSON.stringify([result]));\n\n return result;\n } else {\n for (let i = 0; i < generatedIds.length; i++) {\n if (generatedIds[i] === result) {\n return this.generateId();\n }\n }\n\n generatedIds.push(result);\n localStorage.setItem('ids', JSON.stringify(generatedIds));\n\n return result;\n }\n }", "title": "" }, { "docid": "9a8e31d6df294487ab5ea1406c5da16b", "score": "0.57595557", "text": "function initGenerator() {\n return Helpers.createKeyGenerator(0,(key) => {\n return ++key;\n });\n}", "title": "" }, { "docid": "42695e5968d48e3e0be6e7314ab3628b", "score": "0.5757819", "text": "id_generate(){\n return `${this.gen_id()}-${this.gen_id()}-${this.gen_id()}-${this.gen_id()}- `\n }", "title": "" }, { "docid": "a0d3f80d304f2fd92c82525adf1ee5dc", "score": "0.5755205", "text": "function nextId() {\n\t\t\treturn new Date().getTime().toString();\n\t\t}", "title": "" }, { "docid": "f30f805a5f91bce269caf037b80cfab9", "score": "0.57469004", "text": "function uniqueNumber() {\n const date = Date.now();\n if (date <= uniqueNumber.previous) {\n date = ++uniqueNumber.previous;\n } else {\n uniqueNumber.previous = date;\n }\n return date;\n\n}", "title": "" }, { "docid": "baa4879517d5e5c1f2023130c2db1d57", "score": "0.57356066", "text": "function createSomeUniqueString() {\n createSomeUniqueString.counter = createSomeUniqueString.counter || 0;\n createSomeUniqueString.counter++;\n return \"someId_\" + createSomeUniqueString.counter;\n}", "title": "" }, { "docid": "baa4879517d5e5c1f2023130c2db1d57", "score": "0.57356066", "text": "function createSomeUniqueString() {\n createSomeUniqueString.counter = createSomeUniqueString.counter || 0;\n createSomeUniqueString.counter++;\n return \"someId_\" + createSomeUniqueString.counter;\n}", "title": "" }, { "docid": "77619e60b32b54d2f2b33d16c4b5e0bd", "score": "0.5727356", "text": "function uniqid() {\n\n var newDate = new Date;\n\n var partOne = newDate.getTime();\n\n var partTwo = 1 + Math.floor((Math.random()*32767));\n\n var partThree = 1 + Math.floor((Math.random()*32767));\n\n var id = partOne + '_' + partTwo + '_' + partThree;\n\n return id;\n\n}", "title": "" }, { "docid": "8fd5bd0d2f1833f6a80b0a5806650f51", "score": "0.57223487", "text": "function getUniqueId() {\n\tif (typeof getUniqueId.id === 'undefined') {\n\t\tgetUniqueId.id = 0;\n\t}\n\n\treturn 'new' + (getUniqueId.id++).toString();\n}", "title": "" }, { "docid": "112d2c8ce292ea88f7e8eefabaef1fc2", "score": "0.5719392", "text": "function _get_next_id(){\n var r = id;\n id ++;\n return r;\n }", "title": "" }, { "docid": "62098d0746958760bbd0f78db8f1f335", "score": "0.5711865", "text": "function makeId() {\n\tvar uniqueId = Math.random().toString(36).substring(2) + (new Date()).getTime().toString(36);\n\treturn uniqueId;\n}", "title": "" }, { "docid": "b296df3c5ec848e2aa1c2396831949de", "score": "0.5711565", "text": "generateId() { \n\t return '_' + Math.random().toString(36).substr(2, 9);\n\t}", "title": "" }, { "docid": "d2a28353db9566a0bff412f1ad313ae4", "score": "0.57113624", "text": "function uniqueHash(result, key) {\r\n\tif (key.length == 0) {\r\n\t\treturn result\r\n\t}\r\n\r\n\tfor (i = 0; i < key.length; i++) {\r\n\t\tif (result == key[i]) {\r\n\t\t\tresult = randomGenerator(32);\r\n\t\t\ti = 0;\r\n\t\t}\t\r\n\t}\r\n\treturn result;\r\n}", "title": "" }, { "docid": "04e956bbd395077bd919985f7f5c5a1a", "score": "0.56975496", "text": "id() {\r\n return Math.floor(Math.random() * 200000) + 200000;\r\n }", "title": "" }, { "docid": "0eeb996fd82e350d6d26066163b6bd11", "score": "0.5695713", "text": "generateId() {\n return this._idGenerator.generate();\n }", "title": "" }, { "docid": "f98b42905745394191b9358301734e2a", "score": "0.56929064", "text": "function genId(){\n a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'\n r = ''\n\n for(let i=0; i<30; i++){\n r+=a[parseInt(Math.random()*a.length)]\n }\n\n return r\n}", "title": "" }, { "docid": "0db1a5d6b96dbd401725a9e159f29fd0", "score": "0.56829864", "text": "function nextId(ids){\n //this will be awesome!\n return 0;\n}", "title": "" }, { "docid": "d18d903e07e84f8ed4ee4e4c9d52efa1", "score": "0.566764", "text": "function generateNewId() {\r\n return '$id_' + Template.prototype.idCount++;\r\n}", "title": "" }, { "docid": "c52dd6cf56666ec5662fb8bd1f3ff5cd", "score": "0.5663958", "text": "function getUniqueId () {\n //return 'private-' + Math.random().toString(36).substr(2, 9);\n return 'private-' + \"5y0jlx0sc\";\n }", "title": "" }, { "docid": "1c11061988771ca53c7fb883eb599da7", "score": "0.5663398", "text": "function getid(){\n return(Math.random())\n}", "title": "" }, { "docid": "1c11061988771ca53c7fb883eb599da7", "score": "0.5663398", "text": "function getid(){\n return(Math.random())\n}", "title": "" }, { "docid": "e68504efa4b1ac0156c300a5743bc9c5", "score": "0.56619704", "text": "function genUniqueID() {\n return Math.random()\n .toString(36)\n .substr(2, 9);\n}", "title": "" }, { "docid": "12918a97460eaaa2791a4c89af9cb941", "score": "0.5660557", "text": "function generator(input) {\n // its a closure function\n return function () {\n return input * 2;\n };\n}", "title": "" }, { "docid": "bc4b78c0b567a712fd9e1b234f72b387", "score": "0.5659885", "text": "function generateId(){return Math.random().toString(36).substr(2,9)}", "title": "" }, { "docid": "7d5980a67f7ffa18bba0d66836d80ab0", "score": "0.5657414", "text": "_generate_uniform_next(): number {\n let u: number = 0;\n while (u === 0 || u === 1) {\n u = prng.next();\n }\n\n return u;\n }", "title": "" }, { "docid": "069504a5f262da1d9aefba2d871683d5", "score": "0.5641905", "text": "id() {\r\n return Math.floor(Math.random() * 200000)\r\n }", "title": "" }, { "docid": "51bfc4ae9bab9b3be2a3e927949bd4ed", "score": "0.56307894", "text": "function makeId() {\n return Math.random().toString(36).slice(-8);\n}", "title": "" }, { "docid": "e76b7a6010eb0089e2a99661e09141cd", "score": "0.56210625", "text": "function fibonacciMaster(){\n // add result to 'cache' hash table\n let cache = {};\n // closures\n return function fib(n){\n // calculations++;\n // if parameter is the same, we check in the cache first for the result\n if (n in cache){\n return cache[n]\n } else {\n if (n < 2) {\n return n;\n } else {\n cache[n] = fib(n - 1) + fib(n - 2);\n return cache[n];\n }\n }\n }\n}", "title": "" }, { "docid": "7d8e6af7606def673f9920c4fb524a32", "score": "0.559883", "text": "function guidGenerator() {\n var S4 = function() {\n return (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n };\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "title": "" }, { "docid": "e3314769a2b0c47e27d317dcd595de5a", "score": "0.55986005", "text": "@memoizeOne\n _getId() {\n return `${SEARCH_COLUMN_ID}${uniqueId()}`;\n }", "title": "" }, { "docid": "c8804ef0b362d085f093e65355b29ddd", "score": "0.55932546", "text": "function generateUniqueId() {\n return \"__ac-\" + Shared.UUID.generate();\n}", "title": "" }, { "docid": "2226ea97140abbc91d2932f7d2cbd4ec", "score": "0.5587225", "text": "function get_id()\n{\n return \"a\"+Math.floor(Math.random() * 9999999999).toString();\n}", "title": "" }, { "docid": "c35d898e86493c903b72deb060b53f49", "score": "0.55836755", "text": "function generateUniqueID() {\n var d = new Date().getTime();\n if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {\n d += window.performance.now(); // use high-precision timer if available\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n}", "title": "" }, { "docid": "385b3ef473576344ca06eaca8101a41d", "score": "0.55833226", "text": "getUniqueKey() {\n return this.k++\n }", "title": "" }, { "docid": "98c95acd1cb63165c697cd55ec07a878", "score": "0.5582562", "text": "function nextId(){\n return ++_idCount;\n }", "title": "" }, { "docid": "74dde5b920e2792375c9e02de7417f35", "score": "0.55801", "text": "_generateCode() {\n return Math.floor(1000 + Math.random() * 9000).toString();\n }", "title": "" }, { "docid": "983cbc1b0baa8c638122a69f769d2792", "score": "0.55788696", "text": "function GeneratorFunction() {}", "title": "" }, { "docid": "983cbc1b0baa8c638122a69f769d2792", "score": "0.55788696", "text": "function GeneratorFunction() {}", "title": "" }, { "docid": "983cbc1b0baa8c638122a69f769d2792", "score": "0.55788696", "text": "function GeneratorFunction() {}", "title": "" }, { "docid": "d11310622324e15d2fcfe2899336e044", "score": "0.557613", "text": "makeIdValue() {\n return this.props.id || this.uniqueId;\n }", "title": "" }, { "docid": "9b5200fda7d32c72a25b3147fdfcd6bb", "score": "0.5569867", "text": "function memoizedAddTo80Closure() {\n let cache = {}\n return function (n) {\n if (n in cache) {\n return cache[n];\n } else {\n console.log(\"long time\");\n cache[n] = n + 80;\n return cache[n];\n }\n }\n}", "title": "" }, { "docid": "a45189c1a0e4a8f535bf3accf6363eb4", "score": "0.55681556", "text": "function getUniqueID() {\n let id = crypto.randomBytes(6).toString(\"base64\");\n while (id.includes('/') || id.includes('+')) {\n id = crypto.randomBytes(6).toString(\"base64\");\n }\n\n return id;\n}", "title": "" }, { "docid": "08f129d649352f70abfc15c50870029c", "score": "0.556256", "text": "function genID() {\n return getDOMLife() + Math.floor(Math.random() * 100000001);\n}", "title": "" }, { "docid": "b9272974eec7c9d30074f0670f1e12b0", "score": "0.5560176", "text": "function _generator() {\n return (Math.floor(Math.random() * 0xFFFF)).toString(16).padStart(4, '0');\n}", "title": "" }, { "docid": "ede69bb65e65dc696b04a257dec04399", "score": "0.5557706", "text": "*fastGen() { return this; }", "title": "" } ]
9fedbef7e60b0751a665f713004ee5a4
Validate each of the form fields.
[ { "docid": "ebe0e588b8db9d249907ccf67ebc6e4f", "score": "0.0", "text": "function validateFormFields()\n{\n var phoneTitle = document.getElementById(\"phoneTitle\").value;\n var phoneCategory = document.getElementById(\"phoneCategory\").value;\n var phoneDescription = document.getElementById(\"phoneDescription\").value;\n \n var alertText = \"\";\n if(phoneTitle.length == 0)\n alertText += \"Please enter a phone title.\\n\";\n if(phoneCategory == \"\")\n alertText += \"Please select a category.\\n\";\n// if(phoneDescription == \"\")\n// alertText += \"Please enter a description.\\n\";\n \n if(alertText != \"\")\n {\n alert(alertText);\n return false;\n }\n \n return true;\n}", "title": "" } ]
[ { "docid": "22a74253eaaacff358b646a702cb5d9f", "score": "0.71840394", "text": "function checkForm () {\n markEmptyFields()\n validateName()\n validateCar()\n validateDate()\n validateDays()\n validateCard()\n validateCVV()\n validateExpiration()\n}", "title": "" }, { "docid": "7c2133e868ac36d7ab12b6001c26b32e", "score": "0.70189404", "text": "validateForm(fieldsError) {\n // check if any error in fields\n let allValid = true;\n for (let fieldKey in fieldsError) {\n if (fieldsError.hasOwnProperty(fieldKey) && fieldsError[fieldKey].length > 0) {\n allValid = false;\n break;\n }\n }\n return allValid;\n }", "title": "" }, { "docid": "22ba6dc744ec08db305675b1d08e34fb", "score": "0.6968251", "text": "formValidate() {\n\t\tconst allValid = [\n\t\t\t...this.template.querySelectorAll('lightning-input, lightning-combobox, lightning-textarea')\n\t\t].reduce((validSoFar, inputCmp) => {\n\t\t\tinputCmp.reportValidity();\n\t\t\treturn validSoFar && inputCmp.checkValidity();\n\t\t}, true);\n\t\treturn allValid;\n }", "title": "" }, { "docid": "aa71f9c6cd3085cdcb661fdd9e351db6", "score": "0.69659173", "text": "validateFormFields() {\n ['emails'].forEach((formControl) => {\n // Skip valid fields\n if (this.$scope.forms.members_form[formControl].$dirty && this.$scope.forms.members_form[formControl].$valid) return;\n\n // Mark all fields as dirty because that will trigger validation\n this.$scope.forms.members_form[formControl].$dirty = true;\n this.$scope.forms.members_form[formControl].$pristine = false;\n });\n\n this.submitted = true;\n }", "title": "" }, { "docid": "708c55a9b24fa1820e9262d64fc35594", "score": "0.68700635", "text": "function formValid()\n{\n out = true\n out &= $('#months').valid()\n out &= $('#cpg').valid()\n\n // price and mpg inputs are dynamically created, so the validator\n // may not have been \"told\" they are required yet.\n for (i=1; i<=mpg_count; i++)\n {\n\tmpg = $(`#mpg_${i}`)\n\tmpg.rules('add', 'required')\n\tout &= mpg.valid()\n }\n for (j=1; j<=price_count; j++)\n {\n\tprice = $(`#price_${j}`)\n\tprice.rules('add', 'required')\n\tout &= price.valid()\n }\n \n return out\n}", "title": "" }, { "docid": "82d4194294bc052991189f01125520f2", "score": "0.6834057", "text": "function formValidation(myForm) {\n let valid = true;\n\n // On submit i check every field and run functions as needed\n for (let i = 0; i < myForm.length; i++) {\n //Singular fields\n switch (myForm[i].name) {\n case \"title\":\n fields.title = isRequired(myForm[i]);\n if (fields.title == true) {\n fields.title = isOtherChecked(myForm[i]);\n }\n break;\n case \"surname\":\n fields.surname = isRequired(myForm[i]);\n if (fields.surname == true) {\n fields.surname = isCharactersOnly(myForm[i]);\n }\n break;\n case \"firstname\":\n fields.firstName = isRequired(myForm[i]);\n if (fields.firstName == true) {\n fields.firstName = isCharactersOnly(myForm[i]);\n }\n break;\n case \"dateofbirth\":\n fields.dateOfBirth = isRequired(myForm[i]);\n if (fields.dateOfBirth == true) {\n fields.dateOfBirth = isDate(myForm[i]);\n }\n\n break;\n case \"postaladdress\":\n fields.postalAddress = isCharactersOnly2(myForm[i]);\n\n break;\n\n case \"suburb\":\n fields.suburb = isCharactersOnly(myForm[i]);\n\n break;\n case \"postcode\":\n fields.postcode = isPostCode(myForm[i]);\n\n break;\n case \"daytimephone\":\n fields.daytimephone = isPhone(myForm[i]);\n atLeastOnePhone[0] = isThereAPhone(myForm[i]);\n break;\n case \"mobile\":\n fields.mobile = isMobile(myForm[i]);\n atLeastOnePhone[1] = isThereAPhone(myForm[i]);\n break;\n case \"work\":\n fields.work = isPhone(myForm[i]);\n atLeastOnePhone[2] = isThereAPhone(myForm[i]);\n fields.work = checkForPhone(myForm[i]);\n break;\n case \"email\":\n fields.email = isEmail(myForm[i]);\n\n break;\n }\n }\n\n //Here, i created an array containing all the values of the object fields\n const fieldsValues = Object.values(fields);\n //Then i check every value before validating the whole form\n for (let i = 0; i < fieldsValues.length; i++) {\n if (fieldsValues[i] == false) {\n valid = false;\n }\n }\n return valid;\n}", "title": "" }, { "docid": "ddf1e26d609e28723cae62f0573c51fa", "score": "0.6777664", "text": "function fieldsFilled(){\n\t\t\t$('input').each(function(){\n\t\t\t\tif ($(this).val() == ''){\n\t\t\t\t\t$('.form-error-message').html('All fields are mandatory');\n\t\t\t\t}\n\t\t\t});\n\t\t}", "title": "" }, { "docid": "58e1c99c36d43199a4e3b6fa2570a910", "score": "0.675469", "text": "checkValueFields(){\n for(let field in this.valueFields){\n let params = this.valueFields[field];\n let value = this.form[field];\n if(!value) continue;\n\n if(params.minLength && value.length < params.minLength){\n this.errors.push(`Length must be greater than ${minLength}`);\n }else if(params.maxLength && value.length > params.maxLength){\n this.errors.push(`Length must be lower than ${maxLength}`);\n }else if(params.possibleValues && params.possibleValues.indexOf(value) === -1){\n this.errors.push(`The value: '${value}' is not authorized for ${field}`);\n }\n }\n }", "title": "" }, { "docid": "e1e2ac3d9b7c8c9d55365ccde109b4b2", "score": "0.67493254", "text": "function validate(fields) { // fields = failed elements\n\t\t\t\t\t$.each(fields, function(i, ele) {\n\t\t\t\t\t \t$(ele).addClass(o.classes.error).removeClass(o.classes.filled); // add classes\n\t\t\t\t\t\n\t\t\t\t\t\t// if the field has a data-error attribute, set it as the value but ONLY IF the field has no user entered information\n\t\t\t\t\t\tif ($(ele).attr('data-error') && ele.value == \"\" || ele.value == interim(ele,true) || ele.value == $(ele).attr('placeholder')) {$(ele).val($(ele).attr('data-error'));}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(ele).bind('keyup blur change', function(e) { // add value monitoring for live validation feedback\n\t\t\t\t\t\t\tif ((AF5.validation.validate( ele.value , ele.getAttribute('type')))) {\n\t\t\t\t\t\t\t\t$(ele).removeClass(o.classes.error).addClass(o.classes.filled); // remove error class\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$(ele).addClass(o.classes.error).removeClass(o.classes.filled); // re-add error class\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}", "title": "" }, { "docid": "2fe528477378b156f8c52155935e1669", "score": "0.67158073", "text": "function validateFields() {\n\n\t\tif (!validateCreditCard()){\n\t\t\tsetCreditCardNum(0);\n\t\t} \n\t\telse {\n\t\t\tsetCreditCardNum(1);\n\t\t}\n\t\n\t\tif (!validateCVV()) {\n\t\t\tsetCVVNum(0);\n\t\t}\n\t\telse {\n\t\t\tsetCVVNum(1);\n\t\t}\n\n\t\tif (!validateExpiry()) {\n\t\t\tsetExpiryDate(0);\n\t\t}\n\t\telse {\n\t\t\tsetExpiryDate(1);\n\t\t}\n\n\t\tif(!validateCreditCard() || !validateCVV() || !validateExpiry()) {\n\t\t\tsetIsDisabled(true);\n\t\t}\n\t\telse {\n\t\t\tsetIsDisabled(false);\n\t\t}\n\n\t}", "title": "" }, { "docid": "c497100e048f45a555a2e4daedf2256d", "score": "0.66921216", "text": "function validateFields(v) {\n var nm = v.name,\n msg = $form + ' .msg-invalid-' + nm,\n id = '#' + (v.id || nm),\n emval;\n $(id).on('keyup input change blur paste focus', function () {\n switch (v.type) {\n\n // once the user starts to type, email/zip/tel will be sent through a validator and a\n // message will be displayed to warn user about invalid input\n // message will disappear once input is valid\n case 'email':\n emval = $(this).val();\n if (emval.length > 0) {\n _validator.email(emval) ? ($(msg).nosSlideUp(), $(this).alterClass('nos-invalid-email', 'nos-valid-email')) : ($(msg).nosSlideDown(), $(this).alterClass('nos-valid-email', 'nos-invalid-email'));\n }\n emval === '' && ($(msg).nosSlideUp(), $(this).removeClass('nos-invalid-email nos-valid-email'));\n break;\n\n case 'zip':\n emval = $(this).val();\n if (emval.length > 0) {\n _validator.zipcode(emval) ? ($(msg).nosSlideUp(), $(this).alterClass('nos-invalid-zip', 'nos-valid-zip')) : ($(msg).nosSlideDown(), $(this).alterClass('nos-valid-zip', 'nos-invalid-zip'));\n }\n emval === '' && ($(msg).nosSlideUp(), $(this).removeClass('nos-invalid-zip nos-valid-zip'));\n break;\n\n case 'tel':\n emval = $(this).val();\n if (emval.length > 0) {\n _validator.phone(emval) ? ($(msg).nosSlideUp(), $(this).alterClass('nos-invalid-tel', 'nos-valid-tel')) : ($(msg).nosSlideDown(), $(this).alterClass('nos-valid-tel', 'nos-invalid-tel'));\n }\n emval === '' && ($(msg).nosSlideUp(), $(this).removeClass('nos-invalid-tel nos-valid-tel'));\n break;\n\n }\n }).on('blur change', function () {\n $(this).removeClass('nos-valid-email nos-valid-zip nos-valid-tel');\n });\n }", "title": "" }, { "docid": "fef52f2a7ba7c87f2dad457398d4c9c6", "score": "0.6663405", "text": "function validateForm() {\n /*Assigns the values of each input based on the name that links each individual set of inputs into variables*/\n var formValidation1 = document.forms[\"myForm\"][\"size\"].value;\n var formValidation2 = document.forms[\"myForm\"][\"color\"].value;\n var formValidation3 = document.forms[\"myForm\"][\"style\"].value;\n var formValidation4 = document.forms[\"myForm\"][\"amount\"].value;\n /*If loop checks to see if any of the inputs are empty when submit button is clicked*/\n if (formValidation1 == \"\" || formValidation2 == \"\" || formValidation3 == \"\" || formValidation4 == \"\") {\n /*Induce an alert message if one of the inputs are empty*/\n alert(\"All fields must be filled before submission\");\n /*Return false*/\n return false;\n } else {\n /*Return true */\n return true;\n }\n }", "title": "" }, { "docid": "75055f24f44b14b0b16899e3e33ef3a7", "score": "0.66503245", "text": "function validateFields() {\n\t// hide all previous warnings\n\thideAllWarnings();\n\t\t\n\tvar err = false;\n\t\t\n\tvar textTypeFields = new Array('name','company','telephone','city');\n\t\n\t// Check if text fields have content\n\tfor( var i = 0; i < textTypeFields.length; i++ ) {\n\t\tif( $( \"#\" + textTypeFields[i] ).val().length == 0 ) {\n\t\t\t$( \"#\" + textTypeFields[i] + \"_msg\" ).toggle();\n\t\t\terr = true;\n\t\t}\n\t}\n\t\t\n\t// Check if there is a valid email address\n\tif( !checkEmail( $(\"#email\").val() ) ) {\n\t\t$(\"#email_msg\").toggle();\n\t\terr = true;\n\t}\n\t\t\n\t\n\treturn err;\n}", "title": "" }, { "docid": "71d872786bcee84aa95f220094664674", "score": "0.66500205", "text": "function allFieldsValid() {\r\n\tvar allValid = true;\r\n\t$(\".GeMHaToBeValidated, .locallyRequired\").each(\r\n\t\t\tfunction() {\r\n\t\t\t\tif ( ! fieldIsValid(this.id)) {\r\n\t\t\t\t\tallValid = false;\r\n\t\t\t\t\treturn; // break out of traversal\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\treturn allValid;\r\n}", "title": "" }, { "docid": "1a1b26e141f4f8f6eb3f708818e955be", "score": "0.66134477", "text": "function validForm() {\n const [fullName, email, adr, country, state, zip, cardName, cardNumber, cardExpm, cardExpy, cardCcv] = formInputs();\n const isInputValidArr = [\n checkLength(fullName, 1),\n validateEmail(email),\n checkLength(adr, 1),\n checkLength(country, 1),\n checkLength(state, 1),\n checkLength(zip, 1),\n checkLength(cardName, 1),\n checkLength(cardNumber, 1),\n checkLength(cardExpm, 1),\n checkLength(cardExpy, 1),\n checkLength(cardCcv, 1),\n ];\n\n // if n (in this case, the array objects) === true, it will return true, otherwise no return.\n function isTrue(n) {\n return n === true;\n }\n\n // every object in the array gets passed through the 'isTrue' function, return boolean ? true:false\n const isFormValid = isInputValidArr.every(isTrue);\n return isFormValid;\n}", "title": "" }, { "docid": "89f4d2186973a2e627bddbc8d385ea1d", "score": "0.65900594", "text": "function validateRequiredFields() {\n $(reqInput).each(function (i) {\n var field = reqInput[i],\n msg = $form + ' .msg-required-' + field.name;\n field.value = _validator.sanitize(field.value);\n if ($(field).val().length < 1) {\n $(msg).nosSlideDown();\n $(this).on('keyup keydown change blur paste input', function () {\n if (this.value.length > 0) $(msg).nosSlideUp();\n if (this.value.length < 1) $(msg).nosSlideDown();\n });\n }\n\n });\n }", "title": "" }, { "docid": "272311c4ea54fe2d4a60dd5ed9afeaf7", "score": "0.65609306", "text": "setValidations(form) {\r\n\t\tform.querySelectorAll(\"input, textarea, datalist, label\").forEach(input => {\r\n\t\t\tthis.validatorBuilder(input, this.defaultMessages);\r\n\t\t});\r\n\t}", "title": "" }, { "docid": "272311c4ea54fe2d4a60dd5ed9afeaf7", "score": "0.65609306", "text": "setValidations(form) {\r\n\t\tform.querySelectorAll(\"input, textarea, datalist, label\").forEach(input => {\r\n\t\t\tthis.validatorBuilder(input, this.defaultMessages);\r\n\t\t});\r\n\t}", "title": "" }, { "docid": "7b6b8538a4c0969af0ce03602cf878a2", "score": "0.6555545", "text": "validations() {\n for (let [name, value] of Object.entries(this.state.patient)) {\n this.ruleValid(name, value);\n }\n }", "title": "" }, { "docid": "9484ee567d50fd08d2e48c5c848d6645", "score": "0.6536302", "text": "function checkInputs() {\n //check with the input values\n const nameVal = name.value;\n const emailVal = mail.value;\n let errors = [];\n if (nameVal === '') {\n errors += 1;\n setErrorFor(name, 'Name cannot be blank - please insert a username')\n } else {\n setSuccessFor(name);\n }\n if (emailVal === '' || !mailVal(mail)) {\n setErrorFor(mail, 'Email is not valid');\n errors += 1;\n } else {\n setSuccessFor(mail);\n }\n\n if (!activitiesVal(activities)) {\n errors += 1;\n setErrorFor(activities, 'At least one actitvity must be selected')\n } else {\n setSuccessFor(activities);\n }\n if (paymentOption[1].selected) {\n if (!(/^(\\d{13}|\\d{16})$/.test(ccNum.value))) {\n errors += 1;\n setErrorFor(ccNum, 'Please insert correct card details!')\n } else {\n setSuccessFor(ccNum);\n }\n if (!(/^\\d{5}$/.test(zipCode.value))) {\n errors += 1;\n setErrorFor(zipCode, 'It seems that your zip Code is not in the right format!');\n } else {\n setSuccessFor(zipCode);\n }\n if (!(/^\\d{3}$/.test(cvv.value))) {\n errors += 1;\n setErrorFor(cvv, 'It seems that your CVV is not in the right format!');\n } else {\n setSuccessFor(cvv);\n }\n }\n if(errors.length === 0){\n form.submit();\n };\n }", "title": "" }, { "docid": "9faddbe65bc0e1e2e41bd55f204a37b9", "score": "0.653109", "text": "checkRequiredFields(){\n for(let field in this.requiredFields){\n let fieldConf = this.requiredFields[field];\n let isRequired = (fieldConf.condition && fieldConf.condition(this.form)) \n || (!fieldConf.condition);\n \n if(!isRequired){\n continue;\n }\n\n //Check if required\n if(isRequired && !this.form[field]){\n this.errors.push(`The field ${field} is required`);\n //Check the type\n }else if(fieldConf.type && typeof this.form[field] !== fieldConf.type){\n this.errors.push(`Incorrect type for the field ${field}, ${typeof this.form[field]} instead of ${fieldConf.type}`);\n }\n }\n }", "title": "" }, { "docid": "782198907f1e7eaa579094071763226d", "score": "0.6526999", "text": "function validateFileFields() {\n $(fileField).each(function (i) {\n var field = fileField[i];\n var msg = $form + ' .msg-required-' + field.name;\n var filelist = (document.getElementById(field.id || field.name).files || document.getElementById(field.id || field.name).value); // ie8 doesn't support 'files'\n if (filelist.length === 0 && $(field).attr('required', true)) {\n $(msg).nosSlideDown();\n $(this).off('change').on('change', function () {\n if ($(this).val() !== '') $(msg).nosSlideUp();\n if ($(this).val() === '') $(msg).nosSlideDown();\n });\n }\n formdata[field.name] = filelist;\n });\n }", "title": "" }, { "docid": "c6818fab6c9c64811d9fde6ea5927616", "score": "0.6525417", "text": "function validateForm() {\n let valid = true;\n let tabs = document.getElementsByClassName(\"tab\");\n let fields = $(tabs[currentTab]).find(\"input, select, textarea\");\n console.log(fields);\n $(fields).each((index, field) => {\n // If a field is empty...\n\n if ($(field).val() === \"\" && $(field).prop('required')) {\n // add an \"invalid\" class to the field:\n $(field).addClass(\"invalid\");\n // and set the current valid status to false:\n valid = false;\n } else {\n $(field).removeClass(\"invalid\");\n }\n });\n return valid; // return the valid status\n}", "title": "" }, { "docid": "b1d3201961f44b416fc3f748f8444784", "score": "0.651054", "text": "function onValidate() {\n setIsValidating(true);\n var newErrors = {};\n Object.keys(validations).forEach(function (key) {\n var fieldErrorsArr = _validate(values[key], validations[key]);\n\n if (fieldErrorsArr.length > 0) {\n newErrors[key] = fieldErrorsArr;\n }\n });\n\n _setErrors(newErrors);\n\n setIsValidating(false);\n }", "title": "" }, { "docid": "b248c4b39d5425cfc3a563b00ce8926a", "score": "0.64789206", "text": "_checkInputsError() {\n this._removeInputErrorClasses();\n const errorsKey = Object.keys(this.errors) || [];\n\n errorsKey.forEach((inputName) => {\n try {\n const input = this._form.querySelector(`[name=\"${inputName}\"]`);\n const inputWrapper = this._getWrapperElement(input);\n this._addInputErrorClass(inputWrapper);\n this._showErrorMessage(inputWrapper, inputName);\n } catch (e) {\n console.log(e);\n console.error(`The ${inputName} field does not exist on this form`);\n }\n })\n\n }", "title": "" }, { "docid": "66ab3b7f7d6a5cfac376e299a89bc171", "score": "0.64676106", "text": "function validation(){\n //Check all the names\n var errors = 0;\n var nameRegex = /^[a-zA-Z]{2,}$/;\n errors =+ CheckFields(\".name\", nameRegex);\n\n //Check all the Email\n var emailRegex = /^[0-9a-zA-Z._-]{3,}@{1}[0-9a-zA-Z._-]{3,}\\.[a-zA-Z]{2,4}$/;\n errors =+ CheckFields(\".email\", emailRegex);\n\n //Check all the phone\n var phoneRegex = /^[0-9]{10}$/;\n errors =+ CheckFields(\".phone\", phoneRegex);\n\n return errors;\n}", "title": "" }, { "docid": "afd44281b4e1bb978a50ac3f48a167c5", "score": "0.64568436", "text": "function validateForm(idOfElementWithChildrenToValidate) {\t\n\t\t\t\t\n\t\t\t\tvar noFieldsBlank = 'True';\n\t\t\t\t$('#forFeildsBlankError').remove();\n\t\t\t\t\n\t\t\t\t$(idOfElementWithChildrenToValidate + ' .mustValidate').each(function(currentEl){\n\t\t\t\t\t\n\t\t\t\t\t//radio button check\n\t\t\t\t\tif ($(this).is(':radio')) {\n\t\t\t\t\t\t if (! $('input[name='+ $(this).attr('name') +']:checked').length) {\n\t\t\t\t\t\t\t\t//so it doesnt repeat\n\t\t\t\t\t\t\t\tif(! $('#radio'+$(this).attr('name')).length){\n\t\t\t\t\t\t\t\t\t//from bootstrap\n\t\t\t\t\t\t\t\t $( \"<div class='radioErrors errors' id='radio\"+ $(this).attr('name')+\"' style='display:none'>Please choose one of the options below</div>\" ).insertBefore('label[for=\"'+$(this).attr('id')+'\"]');\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t $('#radio'+$(this).attr('name')).slideDown( 1000, function(){ \t\n\t\t\t\t\t\t\t\t\t\t$('#radio'+$(this).attr('name')).slideUp( 1000, function(){ \t\n\t\t\t\t\t\t\t\t\t\t\t$('#radio'+$(this).attr('name')).remove();\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\t //no radio buttons was checked\n\t\t\t\t\t\t\t\t noFieldsBlank = 'False';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t }else{ \n\t\t\t\t\t\t\t $('#radio'+$(this).attr('name')).slideUp( 1000, function(){ \t\n\t\t\t\t\t\t\t\t$('#radio'+$(this).attr('name')).remove();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//checkbox button check\n\t\t\t\t\tif ($(this).is(':checkbox')) {\n\t\t\t\t\t\t//NEEDS WORK \n\t\t\t\t\t\tif (! ($(\".\"+ $(this).attr('class') +\":checked\").length > 0)) {\n\t\t\t\t\t\t //no checkbox buttons was checked\n\t\t\t\t\t\t //from bootstrap\n\t\t\t\t\t\t$( \"<div class='checkboxErrors errors' id='checkbox\"+ $(this).attr('name')+\"'>Please choose at least one option</div>\" ).insertBefore('label[for=\"'+$(this).attr('id')+'\"]');\n\t\t\t\t\t\t noFieldsBlank = 'False';\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//all other inputs\n\t\t\t\t\tif(!$(this).val() || $(this).val() == \"doNotPassErrorCheck\")\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(this).addClass('input-error');\n\t\t\t\t\t\tnoFieldsBlank = 'False';\n\t\t\t\t\t\t\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$(this).removeClass('input-error');\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t\tif(noFieldsBlank == 'True'){\n\t\t\t\t\t//$(idOfElementWithChildrenToValidate).find('.errors').slideUp(1000);\t\n\t\t\t\t\treturn true\n\t\t\t\t}else{\n\t\t\t\t\t// $(idOfElementWithChildrenToValidate).find('.errors').slideDown( 1000, function(){ \t\n\t\t\t\t\t// \t$(idOfElementWithChildrenToValidate).find('.errors').delay(4000).slideUp(1000);\t\n\t\t\t\t\t// });\n\t\t\t\t\twindow.scrollTo(0, 0);\t\n\t\t\t\t\t\n\t\t\t\t\t$(idOfElementWithChildrenToValidate + ' .mustValidate:first').each(function(currentEl){\n\t\t\t\t\t\t$(this).before( \"<div class='errors' id='forFeildsBlankError' style='display:none;'><i class='fa fa-exclamation-triangle'></i> Please fill out all mandatory feilds</div>\" )\n\t\t\t\t\t });\n\t\t\t\t\t $('#forFeildsBlankError').slideDown( 1000, function(){ \t\n\t\t\t\t\t\t$('#forFeildsBlankError').delay(4000).slideUp( 1000, function(){ \t\n\t\t\t\t\t\t\t$('#forFeildsBlankError').remove();\n\t\t\t\t\t\t});\n\t\t\t\t\t });\n\t\t\t\t\t event.preventDefault();\n\t\t\t\t\t return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "title": "" }, { "docid": "2fc5cfc0b787ed2b69c1ff9c08d7cd2b", "score": "0.645127", "text": "validate(formFieldObj) {\n const {element, errorElement} = formFieldObj;\n const value = element.value.trim();\n resetValidity(element, errorElement);\n\n formFieldObj.validatorNames.forEach((name) => {\n const isValid = validators[name][0](value);\n if (!isValid) {\n this.valid = false;\n setInvalid(formFieldObj, validators[name][1]);\n }\n })\n }", "title": "" }, { "docid": "f2bcea008b292559ee7717f12223c3f3", "score": "0.64499277", "text": "function validateAll(theform) {\n console.log(theform);\n //selects\n var selects = theform.find('select.wrap-register100');\n selects.each(function() {\n if ($(this).val().trim() == '') {\n $(this).addClass('alert-validate-selects');\n }\n });\n\n //inputs\n var inputs = theform.find('.validate-input .register100');\n var check = true;\n\n for (var i = 0; i < inputs.length; i++) {\n if ($(inputs).val().trim() == '') {\n showValidate(inputs[i]);\n check = false;\n }\n }\n\n inputs.each(function() {\n $(this).focus(function() {\n hideValidate(this);\n });\n });\n\n return check;\n }", "title": "" }, { "docid": "febd8f1f0b4030316967fabf196cf401", "score": "0.6446882", "text": "function validateAll() {\r\n\t$(\"input[type=text].GeMHaToBeValidated\").each(validateNumericValForElement);\r\n\t\r\n\tcheckCanGenerate();\r\n}", "title": "" }, { "docid": "be90b63b1007cd84b72efbecdea8fd3a", "score": "0.6444631", "text": "function validateForm() {\n\tvar hasNullField = false;\n\t// var notRequired =\n\t// ['acc_city','address1','acc_zip','address2','fax','reqion','acc_territory','acc_budget','acc_tax_id','acc_revenue','testRealValue','acc_no_of_employees','description'];\n\tvar notRequired = [ 'address1', 'address2', 'acc_city', 'acc_zip',\n\t\t\t'acc_country', 'acc_state', 'phone1', 'fax', 'acc_industry',\n\t\t\t'reqion', 'acc_territory', 'acc_no_of_employees', 'acc_tax_id',\n\t\t\t'acc_stock_symbol', 'description', 'acc_revenue' ];\n\t$(':input', '#acc_form')\n\t\t\t.each(\n\t\t\t\t\tfunction() {\n\n\t\t\t\t\t\tif ((this.value === '' || this.value === '-1' || this.value == null)\n\t\t\t\t\t\t\t\t&& notRequired.indexOf(this.id) < 0) {\n\t\t\t\t\t\t\tif (this.id === 'vendorType') {\n\t\t\t\t\t\t\t\tif ($('#account_type').val() === '5') {\n\t\t\t\t\t\t\t\t\thasNullField = true;\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thasNullField = false;\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\tif (hasNullField) {\n\t\tconsole.log('nil');\n\t\t$('#succMessage').html('');\n\t\t$('#resultMessage').html(\n\t\t\t\t'<span>You Must Complete All required Fields *</span>');\n\t\t$('#errorMessage').html(\n\t\t\t\t'<span>You Must Complete All required Fields *</span>');\n\t} else if (!hasNullField) {\n\t\t$('#resultMessage').html('');\n\t\t$('#errorMessage').html('');\n\t}\n\tif (revenueFlag == false || nOEFlag == false) {\n\t\t// alert(\"in if false flag\")\n\t\t// $('#resultMessage').html('<span>Invalid data present in the\n\t\t// fields!</span>');\n\t\treturn false;\n\t}\n\tdocument.getElementById(\"addaccountsave\").disabled = true;\n\treturn !hasNullField;\n}", "title": "" }, { "docid": "90896516b8969b2b2653b2233e4765a1", "score": "0.64336425", "text": "function checkAll (){\n let setFormStatus; \n const validationFuncs = [firstNameValidation(), lastNameValidation(), usersEmailValidation(), phoneNumberValidation()]\n for (let i = 0; i < validationFuncs.length; i++) {\n console.log(validationFuncs[i])\n // Return true = invalid \n if(validationFuncs[i] === true){\n // Form is not complete or invalid input(s)\n setFormStatus = false\n }\n }\n return setFormStatus\n }", "title": "" }, { "docid": "d03d0cb8322522de23be71499e6fd249", "score": "0.6432857", "text": "function checkall(){\n if(validateApr() && validateTerm() && validateForm()) {\n getValues();\n }\n}", "title": "" }, { "docid": "263a62a9d15e2b7203281a9fa6d62195", "score": "0.6423774", "text": "function checkValues(...fields) {\n\t\t// function to be used in conditional, so set boolean to return\n\t\tlet allGood = false,\n\t\t klass = 'error';\n\n\t\t// add error classes and set conditional boolean\n\t\tfields.map(field => {\n\t\t\tselector.forEach(function (value, key) {\n\t\t\t\tif (key.includes(field)) {\n\t\t\t\t\tif (value.value === '' || value.value === undefined || value.value === null) {\n\t\t\t\t\t\tvalue.classList.add(klass);\n\t\t\t\t\t\tallGood = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue.classList.remove(klass);\n\t\t\t\t\t\tallGood = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t// set field to focus for better UX\n\t\tfor (let [key, value] of selector) {\n\t\t\tif (value.classList.value.includes(klass)) {\n\t\t\t\tvalue.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// return boolean for conditional statement\n\t\treturn allGood;\n\t}", "title": "" }, { "docid": "381a8d38959af48d9df5803c03de1e5a", "score": "0.6411021", "text": "function validateForm() {\n if(!validateObjects()){return false};\n if(!validateFunds()){return false};\n return true;\n\n }", "title": "" }, { "docid": "536d099da64f1e47a43b1037b08496e1", "score": "0.63829", "text": "function allFieldsFilled() {\n let fieldsFilled = true;\n inputs.forEach(function(input) {\n if (!input.value.trim()) {\n fieldsFilled = false;\n }\n });\n return fieldsFilled;\n}", "title": "" }, { "docid": "50e21114b782adbbe98728fc3a983486", "score": "0.6372905", "text": "function validate() {\n requiredFields = SELECTOR.find('[data-required]');\n var i = 0, length = requiredFields.length, valid = true, type, formElement, matches = [];\n for (; i < length; i++) {\n formElement = requiredFields[i];\n type = formElement.type;\n // Check if any fields are empty\n if (type === 'text' || type === 'textarea' || type === 'password' || type === 'number') {\n if (formElement.value === '') {\n showError(formElement);\n valid = false;\n } else {\n hideError(formElement);\n }\n // Check if email is valid\n }\n if (formElement.hasAttribute('data-email')) {\n if (!validateEmail(formElement.value)) {\n showError(formElement);\n valid = false;\n } else {\n hideError(formElement);\n }\n }\n // Check if a dropdown item has been selected\n if (formElement.hasAttribute('data-select')) {\n if (formElement.value === 'null' || formElement.value === '') {\n showError(formElement, true);\n valid = false;\n } else {\n hideError(formElement, true);\n }\n }\n if (formElement.hasAttribute('data-match')) {\n // Push all values we want to match into an array\n matches.push(formElement.value);\n }\n if (formElement.hasAttribute('data-ni')) {\n if (!validateNI(formElement.value) && formElement.value.length !== 9) {\n showError(formElement);\n valid = false;\n } else {\n hideError(formElement)\n }\n }\n if (formElement.hasAttribute('data-sort-code')) {\n if (!validateSortCode(formElement.value)) {\n showError(formElement);\n valid = false;\n } else {\n hideError(formElement);\n }\n }\n }\n // After the loop, compare the array items you would like to match\n var k = 0, length = matches.length;\n for (; k < length; k++) {\n if (matches[k] !== matches[0] || matches[k] === '') {\n showError(SELECTOR.find('[data-match]'));\n valid = false;\n } else {\n hideError(SELECTOR.find('[data-match]'));\n }\n }\n return valid;\n }", "title": "" }, { "docid": "7ffc08987fe41a811bcbf1731fb45bb1", "score": "0.63686705", "text": "function validate() {\n var fields = [document.getElementById('cust'), document.getElementById('adr'), document.getElementById('city'), document.getElementById('phone')];\n const error = 0;\n\n //loop through input fields to check if empty, if empty return false\n for(var i = 0; i < fields.length; i++) {\n if(fields[i].value === \"\") {\n fields[i].style.background = \"red\";\n err++;\n }\n }\n if(error === 0) {\n return true;\n } else {\n alert(\"please fill out all of the fields\");\n return false;\n }\n}", "title": "" }, { "docid": "ad9aaa326bae29bed8fd239f5a827b7c", "score": "0.63674694", "text": "function validateForm()\n {\n var submit = true;\n\n // Iterate through form elements\n for (var i = 0; i < inputs.length; i++)\n {\n // Validate each element\n var validElement = validateElement(inputs[i]);\n\n // If invalid, set form submit to false\n if (!validElement)\n {\n showError(inputs[i]);\n submit = false;\n }\n // If valid, make sure errors aren't showing\n else hideError(inputs[i]);\n }\n\n // Show success message if everything was valid\n if (submit)\n document.getElementById(\"success\").classList.add(\"show\");\n\n // Return false so the form doesn't actually submit\n return false;\n }", "title": "" }, { "docid": "a29a6eccc9e3d8513c8361b37a154493", "score": "0.6362655", "text": "validate() {\n let valid = true\n\n // Run each of the subfields' validators\n Object.values(this.object).forEach(field => field.validate())\n\n // Run this field's validators\n if (this.validators.length > 0) {\n for (const validator of this.validators) {\n if (!validator.validate(this.value)) {\n for (const [fieldName, error] of Object.entries(validator.error)) {\n const field = this.object[fieldName]\n\n // Add a field error whilst maintaining any existing ones\n field.errors = error\n\n // Re-render the widget to show the error\n field.widget.refreshErrorState(field.errors)\n }\n }\n }\n }\n\n // Make all of the subfields' errors available to this field\n for (let key of Object.keys(this.object)) {\n let field = this.object[key]\n if (field.errors.length) {\n this._errors[key] = field.errors\n valid = false\n }\n }\n\n return valid\n }", "title": "" }, { "docid": "b3772a0bc097bcae7988aedcf857e7d4", "score": "0.6358506", "text": "function checkErrors() {\n nameErrorsCheck(\"#firstname\", 2);\n nameErrorsCheck(\"#lastname\", 2);\n validEmail(\"#email\");\n validTitle(\"#title\");\n validZha(\"#zha\");\n validPhone(\"#phone\");\n}", "title": "" }, { "docid": "6b8fe07d1f82425101ba44214bc0bef6", "score": "0.63543695", "text": "function validation(event) {\n var input_field = document.getElementsByClassName('text_field'); // Fetching all inputs with same class name text_field and an html tag textarea.\n\n // For loop to count blank inputs.\n\n for (var i = input_field.length; i > count; i--) {\n if (input_field[i - 1].value == '') {\n count = count + 1;\n } else {\n count = 0;\n }\n }\n if (count != 0) {\n alert(\"*All Fields are mandatory*\"); // Notifying validation\n event.preventDefault();\n } else {\n return true;\n }\n}", "title": "" }, { "docid": "cf2bf7e66b8c66433176ab3f8bfd81a3", "score": "0.63481265", "text": "function validateForm() {\r\n let input = steps[currentTab].querySelectorAll(inputClasses),\r\n valid = true;\r\n for (let i = 0; i < input.length; i++) {\r\n if (input[i].value == \"\") {\r\n if (!input[i].classList.contains(\"invalid\")) {\r\n input[i].classList.add(\"invalid\");\r\n }\r\n valid = false;\r\n }\r\n if (!input[i].value == \"\") {\r\n if (input[i].classList.contains(\"invalid\")) {\r\n input[i].classList.remove(\"invalid\");\r\n }\r\n }\r\n }\r\n return valid;\r\n }", "title": "" }, { "docid": "6e13e2ab28e3b80f615f97182d8fccb9", "score": "0.63438505", "text": "validateFields() {\n //using arrow function\n this.template.querySelectorAll('lightning-input').forEach(element => {\n \n if(!element.reportValidity())\n {\n console.log('Not valid?'+!element.reportValidity());\n this.validForm = false;\n }\n else \n {\n if(element.name==\"Term\")\n {\n console.log('Search Term'+element.value);\n this.searchTerm =element.value;\n }\n if(element.name==\"Limit\")\n this.limit=element.value\n\n }\n });\n }", "title": "" }, { "docid": "401bd412e83d58c484d233fc036ee4fb", "score": "0.6324901", "text": "function validateSteps(){\n\t\tvar FormErrors = false;\n\t\tfor(var i = 1; i < fieldsetCount; ++i){\n\t\t\tvar error = validateStep(i);\n\t\t\tif(error == -1)\n\t\t\t\tFormErrors = true;\n\t\t}\n\t\t$('#form1').data('errors',FormErrors);\n\t}", "title": "" }, { "docid": "481a842d65ebb4d77aabca508ca38a89", "score": "0.63115555", "text": "function checkFields() {\n\tif ($(\".myWarning\").length > 0) {\n\t\t$(\".myWarning\").remove();\n\t}\n\n\tlet filledOut = true;\n\n\t$.each($(\".myInput\"), function() {\n\t\tif (this.value == undefined || this.value == \"\") {\n\t\t\tfilledOut = false;\n\t\t\t$(this).parent().append(`\n\t\t\t\t<span class=\"myWarning text-warning myP\">Please fill out this field.</span>\n\t\t\t`);\n\t\t}\n\t});\n\n\tif (filledOut) {\n\t\t$(\"#submit\").click();\n\t}\n}", "title": "" }, { "docid": "20bbaa3ef221bbb90f6363247b58a25e", "score": "0.63110787", "text": "function checkFields() {\n let model = campusModel.getCurrentObj();\n\n // Check if name is empty\n if (sharedHelpersInstance.isEmpty(model.name)) {\n sharedHelpersInstance.showErrorInput(\n document.getElementById(\"campus_name\"),\n strings.campusNotEmpty\n );\n return;\n }\n\n hideError();\n // If all the fields are valid, add the campus\n submitAddCampus();\n }", "title": "" }, { "docid": "7b9dc54e90036be0be685202392403a5", "score": "0.63094205", "text": "function handleValidation (values){\n \n //let fields caused an issue with refreshing and not inputting data\n //let fields = this.values.fields;\n let errors = {};\n let formIsValid = true;\n\n //---Name---\n if(values.name =='' || values.name==null){\n formIsValid = false;\n errors[\"name\"] = \"Cannot be empty\";\n setNameError(\"Name cannot be empty.\");\n }else{\n \n if(!values.name.match(/^[a-zA-Z\\s]*$/)){\n formIsValid = false;\n errors[\"name\"] = \"Only letters\";\n setNameError(\"Name can only contain letters.\");\n }\n if(!values.name.match(/^[a-zA-Z '.-]*$/)){\n formIsValid = false;\n errors['name'] = 'Not full name';\n setNameError(\"Please enter your first and last names\");\n }\n\n if (values.name.length > 50) {\n formIsValid = false;\n errors['name'] = 'Is too long';\n setNameError(\"Name has to be shorter than 50 characters.\");\n } \n }\n \n \n\n //---Address 1---\n if(values.address =='' || values.address==null){\n formIsValid = false;\n errors[\"address\"] = \"Cannot be empty\";\n setAddressError(\"Address Line 1 cannot be empty.\");\n }else{\n \n if(!values.address.match(/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/)){\n formIsValid = false;\n errors[\"address\"] = \"Only letters and numbers\";\n setAddressError(\"Address Line 1 can only contain letters and numbers.\");\n }\n if (values.address.length > 100) {\n formIsValid = false;\n errors[\"address\"] = 'Is too long';\n setAddressError(\"Address Line 1 has to be shorter than 100 characters.\");\n } \n if (values.address.length < 4){\n formIsValid = false;\n errors[\"address\"]= 'Is too short';\n setAddressError(\"Address Line 1 has to be longer than 4 characters\");\n } \n }\n\n //---Address 2---\n /* if(values.address2 =='' || values.address2==null){\n formIsValid = false;\n errors[\"address2\"] = \"Cannot be empty\";\n // setAddress2Error(\"Address Line 2 cannot be empty.\");\n }else{*/\n if(values.address2 != null && values.address2!=''){\n if(!values.address2.match(/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/)){\n formIsValid = false;\n errors[\"address2\"] = \"Only letters\";\n setAddress2Error(\"Address Line 2 can only contain letters and numbers.\");\n }\n if (values.address2.length > 100) {\n formIsValid = false;\n errors[\"address2\"] = 'Is too long';\n setAddress2Error(\"Address Line 2 has to be shorter than 100 characters.\");\n }\n if (values.address2.length < 4){\n formIsValid = false;\n errors[\"address2\"] = 'Is too short';\n setAddress2Error(\"Address Line 2 has to be longer than 4 characters\");\n } \n }\n // }\n\n //----City----\n if(values.city =='' || values.city==null){\n formIsValid = false;\n errors[\"city\"] = \"Cannot be empty\";\n setCityError(\"City cannot be empty.\");\n }else{\n \n if(!values.city.match(/^[a-zA-Z]+$/)){\n formIsValid = false;\n errors[\"city\"] = \"Only letters\";\n setCityError(\"City can only contain letters.\");\n }\n if (values.city.length > 100) {\n formIsValid = false;\n errors[\"city\"] = 'Is too long';\n setCityError(\"City has to be shorter than 100 characters.\");\n } \n }\n\n //----State----\n if(values.state =='' || values.state==null){\n formIsValid=false;\n errors[\"state\"] = \"Cannot be empty\";\n setStateError(\"State cannot be empty.\");\n }\n\n if(!values.state.match(/^[a-zA-Z\\s]*$/)){\n formIsValid=false;\n errors[\"state\"] = \"Only letters\";\n setStateError(\"State can only contain letters.\");\n }\n\n //----Zipcode---\n if(values.zipcode =='' || values.zipcode==null){\n formIsValid = false;\n errors[\"zipcode\"] = \"Cannot be empty\";\n setZipcodeError(\"Zipcode cannot be empty.\");\n }else{\n if(!values.zipcode.match(/^[0-9]([0-9]|-(?!-))+$/)){\n formIsValid = false;\n errors[\"zipcode\"] = \"Only numbers\";\n setZipcodeError(\"Zipcode can only contain numbers.\");\n }\n if (values.zipcode.replace(/[^0-9]/g,\"\").length > 9) {\n errors[\"zipcode\"] = 'Is too long';\n formIsValid=false;\n setZipcodeError(\"Zipcode has to be shorter than 9 digits.\");\n } \n if(values.zipcode.length < 5){\n errors[\"zipcode\"] = \"Is too short\";\n formIsValid=false;\n setZipcodeError(\"Zipcode has to be at least 5 digits.\");\n }\n if(!values.zipcode.match(/(^\\d{5}$)|(^\\d{5}-\\d{4}$)/)){\n errors[\"zipcode\"] = \"Wrong format\";\n formIsValid=false;\n setZipcodeError(\"Zipcode must be in format 00000 or 00000-0000\");\n }\n }\n return (formIsValid);\n }", "title": "" }, { "docid": "e70e093a6c727f83750a60c8bf35a9fa", "score": "0.63052267", "text": "function validatorFields(frm) {\n let ky = 0;\n frm.find('.required').each(function () {\n if ($(this).val() == '' || $(this).val() == 0) {\n $(this).addClass('textbox-alert');\n $(this)\n .parent()\n .children('.textAlert')\n .css({ visibility: 'visible' });\n\n ky = 1;\n }\n });\n return ky;\n}", "title": "" }, { "docid": "61a0536e28d175446b2b2eef4e9ab182", "score": "0.62948865", "text": "validateAllFormFields(formGroup) {\n Object.keys(formGroup.controls).forEach(field => {\n const control = formGroup.get(field);\n if (control instanceof _angular_forms__WEBPACK_IMPORTED_MODULE_6__[\"FormControl\"]) {\n control.markAsTouched({ onlySelf: true });\n }\n else if (control instanceof _angular_forms__WEBPACK_IMPORTED_MODULE_6__[\"FormGroup\"]) {\n this.validateAllFormFields(control);\n }\n else if (control instanceof _angular_forms__WEBPACK_IMPORTED_MODULE_6__[\"FormArray\"]) {\n control.controls.forEach(control => {\n if (control instanceof _angular_forms__WEBPACK_IMPORTED_MODULE_6__[\"FormControl\"]) {\n control.markAsTouched({ onlySelf: true });\n }\n else if (control instanceof _angular_forms__WEBPACK_IMPORTED_MODULE_6__[\"FormGroup\"]) {\n this.validateAllFormFields(control);\n }\n });\n }\n });\n }", "title": "" }, { "docid": "fcccc478763d2c46b6b3fc04171ce8f4", "score": "0.6288507", "text": "function validateFields(section) {\n console.log('validateSection(' + section + ')');\n var errors = 0;\n $('#' + section + ' input[type=text]').each(function(){\n var fieldValue = $(this).val();\n if (fieldValue === \"\"){\n errors++;\n }\n });\n $('#' + section + ' input[type=number]').each(function(){\n var fieldValue = $(this).val();\n if (fieldValue === \"\"){\n errors++;\n }\n });\n if ($(\"#\" + section + \" input:radio\").length && $(\"#\" + section + \" input:radio\").is(':checked') != true)\n errors++;\n $('#' + section + ' input[type=email]').each(function(){\n var fieldValue = $(this).val();\n if (fieldValue === \"\"){\n errors++;\n }\n });\n $('#' + section + ' option:selected').each(function(){\n var fieldValue = $(this).val();\n if (fieldValue === \"Select\"){\n errors++;\n }\n });\n console.log('errors: ' + errors); \n return errors;\n }", "title": "" }, { "docid": "2e22d1c8cc10be72a660722febdbe698", "score": "0.62849194", "text": "function isAllElementsValidate(elements) {\n let valuedInputs = 0;\n const fieldsCount = elements.length;\n\n elements.forEach(item => {\n if(item.value.length > 0 && item.classList.contains('valid')) {\n valuedInputs++;\n } else {\n valuedInputs--;\n }\n });\n isSubmitButtonVisible(valuedInputs, fieldsCount);\n }", "title": "" }, { "docid": "c34452a91a2f275b3ed2d3ca1589bfec", "score": "0.6283245", "text": "function validateFields (event) {\n let body = JSON.parse(event.body);\n let errors = {\n email: null,\n username: null,\n password: null,\n password2: null,\n type: null\n };\n let noErrors = 0;\n\n if (body === null || body === undefined ) {\n body = {};\n }\n\n const { email, username, password, password2, type } = body;\n const trimmedUsername = ( username === undefined? '' : username.trim());\n\n // Validate the inputs\n if (!validator.validateEmail(email)) {\n errors['email'] = \"A valid email address needs to be entered.\";\n noErrors++;\n }\n if (!validator.validateUsername(trimmedUsername)) {\n errors['username'] = \"Username has to be 6 - 30 characters and can contain your email address.\";\n noErrors++;\n }\n if (!validator.validatePassword(password)) {\n errors['password'] = \"Your password needs to be 6 - 20 characters long and must contain at least one number.\";\n noErrors++;\n }\n if ( !errors['password2'] && password !== password2) {\n errors['password2'] = \"Your passwords must match.\";\n noErrors++;\n }\n if (!validator.validateUserType(type)) {\n errors['type'] = \"The user type must be between 1 and 3.\";\n noErrors++;\n }\n\n return { noErrors, errors, email, username: trimmedUsername, password, type };\n\n }", "title": "" }, { "docid": "f5e37747f0ffcc4e9aab05107c10736d", "score": "0.6281216", "text": "function formValidation(){\n\n if (nameValidation() &&\n paymentValidation() &&\n workshopValidation() &&\n cvvValidation() &&\n zipValidation() &&\n validCreditCard() &&\n emailValidation()) {\n\n $(\"#success\").slideDown(350);\n\n } else {\n highlightErrors();\n $(\"#infoError\").slideDown(350);\n }\n\n }", "title": "" }, { "docid": "367f901c47f86c754c90363298e0b458", "score": "0.6279206", "text": "function validateSteps(){\r\n\t\tvar FormErrors = false;\r\n\t\tfor(var i = 1; i < fieldsetCount; ++i){\r\n\t\t\tvar error = validateStep(i);\r\n\t\t\tif(error == -1) FormErrors = true;\r\n\t\t}\r\n\t\t$('#formElem').data('errors',FormErrors);\t\r\n\t}", "title": "" }, { "docid": "b510f2aa35c46c2aca689afcc4bcd655", "score": "0.6235455", "text": "function validateInputs() {\n const validationErrorClass = 'validation-error';\n\n for (let i = 0;i < validatedInputs.length;i++) {\n let input = validatedInputs[i];\n\n function checkValidity (options) {\n const insertError = options.insertError;\n const parent = input.parentNode;\n const error = parent.querySelector('.' + validationErrorClass)\n || document.createElement('div');\n const label = input.previousElementSibling.textContent.toLowerCase();\n\n // If field is not valid, display error message, else remove error classes\n if (!input.validity.valid) {\n const message = label + getCustomMessage(input.type, input.validity) || input.validationMessage;\n\n error.className = validationErrorClass;\n error.textContent = message;\n\n // Insert error to page, scroll to error.\n // In case of multiple errors, it will scroll to top most\n if (insertError) {\n parent.insertBefore(error, input.nextSibling);\n parent.scrollIntoView();\n }\n\n } else {\n // If form is valid, remove errors.\n error.remove();\n }\n }\n \n // We can only update the error or hide it on input.\n // Otherwise it will show when typing.\n input.addEventListener('input', function () {\n \n checkValidity({insertError: false});\n });\n\n // We can also create the error in invalid.\n input.addEventListener('invalid', function (e) {\n // prevent showing the default error\n e.preventDefault();\n\n checkValidity({insertError: true});\n });\n }\n}", "title": "" }, { "docid": "414d606701446ae3d76033776f7f31fa", "score": "0.62254524", "text": "function validateForm () {\n checkForm()\n for (const child of formObject.children) {\n if (child.classList.contains('input-invalid')) {\n return false\n }\n }\n return true\n}", "title": "" }, { "docid": "97d6beaf0cb991fbd56b1f700ac051f8", "score": "0.622407", "text": "function formHasErrors()\n{\n\thideErrors();\n\t\n\tvar error = false;\n\tvar currentError = 99;\n\tfor (var i = 0; i < fields.length; i++) \n\t{\n\n\t\tvar inputId = fields[i];\n\t\tvar field = document.getElementById(inputId);\n\n\t\tif(!field || !field.value || !field.value.trim())\n\t\t{\n\t\t\terror = true;\n\t\t\tshowError(inputId);\n\t\t} else\n\t\t{\n\t\t\tvar value = field.value.trim();\n\t\t\tif(inputId == \"inputPhone\" && (value.length != 10 || isNaN(value)))\n\t\t\t{\n\t\t\t\terror = true;\n\t\t\t\tshowError(inputId,true)\n\t\t\t} else if( inputId == \"inputEmail\" && (!isEmailValid(value)))\n\t\t\t{\n\t\t\t\terror = true;\n\t\t\t\tshowError(inputId,true)\n\t\t\t}\n\t\t\t\n\t\t} \n\n\t\tif(error == true && currentError > i)\n\t\t{\n\t\t\tcurrentError = i;\n\t\t\tfield.focus();\n\t\t\tfield.select();\t\n\t\t}\n\t\t\n\t}\n\n\treturn error;\n}", "title": "" }, { "docid": "f2623f90f04f6a9b9511bca18efd6571", "score": "0.6222507", "text": "function validateForm(name){\n //remove classes\n $(name + ' input').removeClass('error').removeClass('valid');\n var fields = $(name + ' input[type=text]');\n var error = 0;\n \n fields.each(function(){\n var value = $(this).val();\n if( $(this).hasClass('required') && (value.length<2 || value==\"\") && !$(this).attr('disabled') ) {\n $(this).addClass('error');\n $(this).effect(\"pulsate\", { times:3 }, 500);\n error++;\n } else {\n if($(this).hasClass('correo') && !$(this).attr('disabled')){\n if(!validateEmail(value)){\n $(this).addClass('error');\n $(this).effect(\"pulsate\", { times:3 }, 500);\n error++;\n }\n } else {\n $(this).addClass('valid'); }\n }\n });\n \n $(name + ' select').removeClass('error').removeClass('valid');\n var fields = $(name + ' select');\n \n fields.each(function(){\n var value = $(this).val();\n if( $(this).hasClass('required') && (value.length<1 || value==\"\") && !$(this).attr('disabled') ) {\n $(this).addClass('error');\n $(this).effect(\"pulsate\", { times:3 }, 500);\n error++;\n } else {\n $(this).addClass('valid'); \n }\n });\n \n if(error>0)\n { return false;}\n else { return true; }\n \n}", "title": "" }, { "docid": "2c45d5460c4ec12c4de48c8b8a855588", "score": "0.6220688", "text": "function validateForm(form) {\n var requiredFields = ['firstName', 'lastName', 'address1', 'city', 'state', 'zip', 'birthdate'];\n\tif (form.elements['occupation'].value === 'other') { //if other is selected\n \trequiredFields.push('occupationOther');\n }\n var idx;\n var formValid = true;\n for (idx = 0; idx < requiredFields.length; ++idx) {\n \tformValid &= validateRequiredField(form.elements[requiredFields[idx]]); //formValid is true if all fields are valid\n }\n return formValid;\n}", "title": "" }, { "docid": "56ade90facc42e3d86b78fdf2eaca30e", "score": "0.6220159", "text": "inputsValidation() {\n let regex = /^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$/;\n this.inputsValid = true;\n \n for (let property in this.user) {\n if ((property == \"_firstName\" || property == '_lastName') && this.user[property].length < 2) {\n this.showAlert(property);\n this.inputsValid = false;\n } else if (property == \"_email\" && !regex.test(this.user[property])) {\n this.showAlert(property);\n this.inputsValid = false;\n } else if (property == \"_quantity\" && this.user[property].length < 1) {\n this.showAlert(property);\n this.inputsValid = false;\n } else if (property == \"_birthdate\" && this.user[property].length == \"\") {\n this.showAlert(property);\n this.inputsValid = false;\n }\n }\n }", "title": "" }, { "docid": "4bf3342144d912f43c9d4e55b1fed019", "score": "0.6218309", "text": "function checkAll (){\n let setFormStatus; \n const validationFuncs = [comName(), comLocation(), positionName(), startDate(), endDate()]\n for (let i = 0; i < validationFuncs.length; i++) {\n console.log(validationFuncs[i])\n // Return true = invalid \n if(validationFuncs[i] === true){\n // Form is not complete or invalid input(s)\n setFormStatus = false\n }\n }\n return setFormStatus\n }", "title": "" }, { "docid": "695507ac65d709694f5b37ab2edc3685", "score": "0.62113327", "text": "function validateForm() {\n\n //boolean indicating if fields have been filled out\n var isValid = true;\n\n //check if name or photo fields are empty\n $(\".aboutYou\").each(function() {\n if ($(this).val() === \"\") {\n isValid = false;\n }\n });\n \n //check if any of the questions are not answered\n $(\".question\").each(function() {\n if ($(this).val() === \"\") {\n isValid = false;\n }\n });\n \n return isValid;\n }", "title": "" }, { "docid": "4d150c0804761f27ee94049215043422", "score": "0.6209881", "text": "validateForm(errors)\n {\n let valid = true;\n Object.values(errors).forEach(val => val.length > 0 && (valid = false));\n return valid;\n }", "title": "" }, { "docid": "43367363065ffaaae3665dff5d027d2e", "score": "0.62094223", "text": "function validate(values){\n const errors={}\n _.each(FIELDS, (type, field) =>{\n if (!values[field]){\n errors[field] =`enter a $(field)`\n }\n })\n return errors\n}", "title": "" }, { "docid": "3e0687bd11f4451923f2ae9a1050f481", "score": "0.61954826", "text": "function parseForm(fields, body) {\n for (var key in body) {\n var field = fields.find(field => field.name === key);\n if (field) {\n var value = body[key];\n if (value !== null && value.length)\n field.value = value;\n }\n }\n fields.forEach(field => {\n if (field.required && field.value == null) field.error = \"required\";\n });\n return !fields.some(field => field.error);\n}", "title": "" }, { "docid": "595ec1ae8a8eafc8e69fd6bbe72b0a5b", "score": "0.6187534", "text": "function validate(form) {\n\n\t//should return a list of inputfields\n\tinputs = form.getElementsByTagName('input');\n\t\n\t//for every field, check if it is empty\n\tisFilled = true;\n\tfor ( i=0; i<inputs.length-1; ++i) {\t\t\n\t\tif (inputs[i].value == \"\" || inputs[i].value == null) {\n\t\t\tisFilled = false;\n\t\t\tredborder(inputs[i]);\n\t\t}\n\t} \n\t\n\treturn isFilled;\n}", "title": "" }, { "docid": "73002e6d0096383401d57951d8d1ca00", "score": "0.6171745", "text": "function formValidation(form) {\n //check proprities to avoid breaking the code\n ['first', 'last', 'email', 'psw', 'username'].forEach(el => {\n if (form.hasOwnProperty(el) === false)\n console.error(new Error('Invalide form'));\n })\n}", "title": "" }, { "docid": "7376a7bf8fa6d847cfea646c8ea7f797", "score": "0.6153541", "text": "function validForms(){ \n //get all forms \n var arrForms = {};\n $(\"form\").each(function () { arrForms[$(this).attr('name')] = {}; });\n\n //check if all forms has values and are valid\n for (var key in arrForms) { \n arrForms[key].hasValue = false;\n arrForms[key].valid = $scope[key].$valid; //AngularJS $scope\n \n //If form and a prime form are valid\n if (arrForms[key].valid && $scope.formItems.$valid) {\n return true;\n } else { //if for is not valid but has values\n $('form[name=' + key + '] input').each(function () {\n if ($(this).val() != '') {\n arrForms[key].hasValue = true;\n }\n });\n\n if (arrForms[key].hasValue) { \n return false;\n } else { //if form has no values, set prime form validation\n return $scope.formItems.$valid;\n }\n } \n };\n }", "title": "" }, { "docid": "750a13429d137988e6b871406aea49f3", "score": "0.614518", "text": "function validationInputs(formName, fieldName)\n{\n\tvar objForm = document.forms[formName];\n\tvar objValue = objForm.elements[fieldName];\n\tvar bReturned = true;\n\tif(objValue != null)\n\t{\n\t\t//arrFieldsInformation is in inputs-validation.js and\n\t\t//initialized by inputs-validation.xsl\n\t\tvar maxsize = arrFieldsInformation[fieldName][\"size\"];\n\t\tmaxsize = parseInt(maxsize);\n\t\tvar format = arrFieldsInformation[fieldName][\"format\"];\n\t\tvar formatUpperCase = format.toUpperCase();\n\t\tvar type = arrFieldsInformation[fieldName][\"type\"];\n\t\tvar typeUpperCase = type.toUpperCase();\n\t\tvar decimal = arrFieldsInformation[fieldName][\"decimal\"];\n\t\tvar bIsEnum = arrFieldsInformation[fieldName][\"isEnum\"];\n\t\tvar required = arrFieldsInformation[fieldName][\"required\"];\n\t\t//don't work on any enumeration fields\n\t\tif(!bIsEnum)\n\t\t{\n\t\t\t//all validation funcrions are in inputs-validation.js\n\t\t\t//check integer\n\t\t\tif(typeUpperCase==\"JAVA.LANG.INTEGER\")\n\t\t\t{\n\t\t\t\tif(!validationIntegerOrSmallint(objValue, true))\n\t\t\t\t\tbReturned = false;\n\t\t\t}\n\t\t\t//check numeric\n\t\t\telse if(typeUpperCase==\"JAVA.LANG.DOUBLE\" || typeUpperCase==\"JAVA.LANG.FLOAT\")\n\t\t\t{\n\t\t\t\tif(!validationNumeric(objValue,decimal, true))\n\t\t\t\t\tbReturned = false;\n\t\t\t}\n\n\t\t\t//check UPPERALPHANUM\n\t\t\tif(formatUpperCase==\"UPPERALPHANUM\")\n\t\t\t{\n\t\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\t\tif(!validationUPPERALPHANUMString(objValue))\n\t\t\t\t\tbReturned = false;\n\t\t\t}\n\t\t\t//check UPPERALPHA\n\t\t\telse if(formatUpperCase==\"UPPERALPHA\")\n\t\t\t{\n\t\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\t\tif(!validationUPPERALPHAString(objValue))\n\t\t\t\t\tbReturned = false;\n\t\t\t}\n\t\t\telse if(formatUpperCase==\"UPPER\")\n\t\t\t{\n\t\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\t}\n\t\t\t//check maxsize(skip date and time fields)\n\t\t\tif(typeUpperCase!= \"JAVA.SQL.DATE\" && typeUpperCase!= \"JAVA.SQL.TIME\")\n\t\t\t{\n\t\t\t\tif(!validationDataMaxSize(objValue, arrFieldsInformation[fieldName]))\n\t\t\t\t\tbReturned = false;\n\t\t\t}\n\t\t\t//check required fields\n\t\t\tif(!validationRequiredField(objValue, required))\n\t\t\t\tbReturned = false;\n\t\t}\n\t}\n\treturn bReturned;\n}", "title": "" }, { "docid": "f8e083bfe45e8811a361dc08403dd88b", "score": "0.6144193", "text": "function validate_form(form_class) {\n var is_valid = true;\n $(form_class).each(function() {\n if ($(this).val() === \"\") is_valid = false;\n });\n if (is_valid === false) {\n alert(\"Please fill in all fields.\");\n }\n return is_valid;\n}", "title": "" }, { "docid": "e2808a4e838522e4faedfc1f855961f2", "score": "0.6142235", "text": "function is_form_empty(form, numOfFields) {\n var valid = 0;\n\n function markEmptyFields() {\n if ($(this).val() != \"\") {\n valid++;\n $(this).removeClass(\"border border-danger\")\n } else {\n $(this).addClass(\"border border-danger\");\n }\n }\n $(form).find('input[type=text]')\n .each(markEmptyFields);\n $(form).find('input[type=password]')\n .each(markEmptyFields);\n $(form).find('input[type=email]')\n .each(markEmptyFields);\n $(form).find('input[type=address]')\n .each(markEmptyFields);\n if (valid >= numOfFields) {\n return false;\n } else {\n return true;\n }\n}", "title": "" }, { "docid": "25b6c09c70ea0612a78984000ee1edb4", "score": "0.61410993", "text": "function validationInputs(n)\n{\n\tvar objForm = document.forms[afmInputsFormName];\n\tvar strField = objForm.elements['field'+n].value;\n\tvar objValue = objForm.elements['values'+n];\n\tvar bReturned = true;\n\n\tif(strField == \"\")\n\t{\n\t\t//set values input to empty\n\t\tobjValue.value = \"\";\n\t}\n\telse if(objValue.value != \"\")\n\t{\n\t\t//validation\n\t\tvar maxsize = arrFieldsInformation[strField][\"size\"];\n\t\tmaxsize = parseInt(maxsize);\n\t\tvar format = arrFieldsInformation[strField][\"format\"];\n\t\tvar formatUpperCase = format.toUpperCase();\n\t\tvar type = arrFieldsInformation[strField][\"type\"];\n\t\tvar typeUpperCase = type.toUpperCase();\n\t\tvar decimal = arrFieldsInformation[strField][\"decimal\"];\n\n\t\t//check integer\n\t\tif(typeUpperCase==\"JAVA.LANG.INTEGER\")\n\t\t{\n\t\t\tif(!validationIntegerOrSmallint(objValue, true))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\t//check numeric\n\t\telse if(typeUpperCase==\"JAVA.LANG.DOUBLE\" || typeUpperCase==\"JAVA.LANG.FLOAT\")\n\t\t{\n\t\t\tif(!validationNumeric(objValue,decimal, true))\n\t\t\t\tbReturned = false;\n\t\t}\n\n\t\t//check UPPERALPHANUM\n\t\tif(formatUpperCase==\"UPPERALPHANUM\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\tif(!validationUPPERALPHANUMString(objValue))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\t//check UPPERALPHA\n\t\telse if(formatUpperCase==\"UPPERALPHA\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t\tif(!validationUPPERALPHAString(objValue))\n\t\t\t\tbReturned = false;\n\t\t}\n\t\telse if(formatUpperCase==\"UPPER\")\n\t\t{\n\t\t\tobjValue.value = (objValue.value).toUpperCase();\n\t\t}\n\n\t\t//check maxsize(skip date and time fields)\n\t\tif(typeUpperCase!= \"JAVA.SQL.DATE\" && typeUpperCase!= \"JAVA.SQL.TIME\")\n\t\t{\n\t\t\tif(!validationDataMaxSize(objValue, arrFieldsInformation[strField]))\n\t\t\t\tbReturned = false;\n\t\t}\n\t}\n\treturn bReturned;\n}", "title": "" }, { "docid": "74709f1d46f6092660b5c5504852b59d", "score": "0.61399066", "text": "function validateValues() {\n\n\t \tif (!name || !name.length) {\n\n\t \t\t$(\"#name\").focus();\n\t \t\t$(\"#name\").css('border', '1px solid rgb(210, 20, 20)');\n\n\t \t} else if (!surname || !surname.length) {\n\n\t \t\t$(\"#surname\").focus();\n\t \t\t$(\"#name\").css('border', 'none');\n\t \t\t$(\"#surname\").css('border', '1px solid rgb(210, 20, 20)');\n\n\t \t} else if (!email || !email.length) {\n\n\t \t\t$(\"#email\").focus();\n\t \t\t$(\"#surname\").css('border', 'none');\n\t \t\t$(\"#email\").css('border', '1px solid rgb(210, 20, 20)');\n\n\t \t} else if (!username || !username.length) {\n\n\t \t\t$(\"#username\").focus();\n\t \t\t$(\"#email\").css('border', 'none');\n\t \t\t$(\"#username\").css('border', '1px solid rgb(210, 20, 20)');\n\n\t \t} else if (!password || !password.length) {\n\n\t \t\t$(\"#password\").focus();\n\t \t\t$(\"#username\").css('border', 'none');\n\t \t\t$(\"#password\").css('border', '1px solid rgb(210, 20, 20)');\n\n\t \t}\n\n\t \treturn name && surname && email && username && password && name.length && surname.length && email.length && username.length && password.length;\n\t }", "title": "" }, { "docid": "bcb76e53f17a296ffc610f3a6cab6a0d", "score": "0.6127016", "text": "function validateSelectFields() {\n $(reqSR).each(function (i) {\n var sfield = reqSR[i],\n msg = $form + ' .msg-required-' + sfield.name;\n if ($(sfield).val() === '') {\n $(msg).nosSlideDown();\n $(this).off('change').on('change', function () {\n if ($(this).val() !== '') $(msg).nosSlideUp();\n if ($(this).val() === '') $(msg).nosSlideDown();\n });\n }\n });\n }", "title": "" }, { "docid": "c268176a3a89bd228f744fd4d55cf7d1", "score": "0.6126418", "text": "function validateFields() {\n $('#edit-submitted-about-me-email').on('input', function () {\n emailVal = mainForm[0][6].value\n if (emailVal != '') {\n if (emailReg.test(emailVal)) {\n errAlert[0].innerHTML = ''\n $(mainForm[0][6]).css(removeBorder)\n } else {\n errAlert[0].innerHTML = 'Please enter a valid e-mail'\n $(errAlert).appendTo($('.input-email'))\n $(mainForm[0][6]).css(addBorder)\n }\n } else {\n errAlert[0].innerHTML = ''\n $(mainForm[0][6]).css(removeBorder)\n }\n enableSubmit(emailVal, phoneVal, zipVal)\n })\n $('#edit-submitted-about-me-phone').on('input', function () {\n // removing special characters on phone number\n phoneVal = mainForm[0][7].value.replace(/[^A-Z0-9]+/gi, '')\n if (phoneVal != '') {\n if (phoneReg.test(phoneVal)) {\n errAlert[0].innerHTML = ''\n $(mainForm[0][7]).css(removeBorder)\n } else {\n errAlert[0].innerHTML = 'Please enter a valid phone number'\n $(errAlert).appendTo($('.input-phone'))\n $(mainForm[0][7]).css(addBorder)\n }\n } else {\n errAlert[0].innerHTML = ''\n $(mainForm[0][7]).css(removeBorder)\n }\n enableSubmit(emailVal, phoneVal, zipVal)\n })\n $('#edit-submitted-about-me-zipcode').on('input', function () {\n zipVal = mainForm[0][8].value\n if (zipVal != '') {\n if (zipReg.test(zipVal)) {\n errAlert[0].innerHTML = ''\n $(mainForm[0][8]).css(removeBorder)\n } else {\n errAlert[0].innerHTML = 'Please enter a valid zip-code'\n $(errAlert).appendTo($('.input-zip'))\n $(mainForm[0][8]).css(addBorder)\n }\n } else {\n errAlert[0].innerHTML = ''\n $(mainForm[0][8]).css(removeBorder)\n }\n enableSubmit(emailVal, phoneVal, zipVal)\n })\n}", "title": "" }, { "docid": "f2ce1a7097196e23f0fa2a99a8402a23", "score": "0.61169755", "text": "function validate(values){\n const errors={};\n{/*/title, categories, content should match to the name of the field we gave, so that respective errors propagate at that place\n*/}\n if(!values.title)\n errors.title=\"Enter a title!\";\n if(!values.categories)\n errors.categories=\"Enter some categories\";\n if(!values.content)\n errors.content=\"enter some content please\";\n{/* if errors is empty the form is fine to submit*/}\n return errors;\n}", "title": "" }, { "docid": "2a0d29a1e5f967f2fd0d46172ce95c32", "score": "0.6112813", "text": "validateFields(errors) {\n this.validateFieldsImpl(errors);\n for (let e of Object.entries(errors)) {\n if (e[1] != null) {\n console.log(`Validation error: [${e[1]}]`);\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "0352322d26f88cf605e293f3a0d35fcb", "score": "0.6111865", "text": "function isAddFormValid(){\r\n return(AddField.isValid() && MailField.isValid() && TitleField.isValid()&& LNameField.isValid() && FNameField.isValid() && TelephoneField.isValid() && MobileField.isValid());\r\n }", "title": "" }, { "docid": "b0d63ad9d5a44bbc9ce10830d41900bb", "score": "0.6100831", "text": "function validateForm() {\n return fields.email.length > 0 && fields.password.length > 0;\n }", "title": "" }, { "docid": "b0d63ad9d5a44bbc9ce10830d41900bb", "score": "0.6100831", "text": "function validateForm() {\n return fields.email.length > 0 && fields.password.length > 0;\n }", "title": "" }, { "docid": "b6e19e587349d10e1a19b961908e2101", "score": "0.60865134", "text": "validateFieldsOnSubmit() {\n this.setValidationMsgs();\n // Disable the form submit if form is in invalid state. For delete operation, do not check the validation.\n if (this.operationType !== 'delete' && (this.validationtype === 'html' || this.validationtype === 'default')\n && this.ngform && this.ngform.invalid) {\n if (this.ngform.invalid) {\n if (this.validationtype === 'default') {\n this.highlightInvalidFields();\n }\n // Find the first invalid untoched element and set it to touched.\n // Safari does not form validations. this will ensure that error is shown for user\n const eleForm = findInvalidElement(this.$element, this.ngform);\n const $invalidForm = eleForm.ngForm;\n let $invalidEle = eleForm.$ele;\n $invalidEle = $invalidEle.parent().find('[focus-target]');\n if ($invalidEle.length) {\n // on save click in page layout liveform, focus of autocomplete widget opens full-screen search.\n if (!$invalidEle.hasClass('app-search-input')) {\n $invalidEle.focus();\n }\n const ngEle = $invalidForm && $invalidForm.controls[$invalidEle.attr('formControlName') || $invalidEle.attr('name')];\n if (ngEle && ngEle.markAsTouched) {\n ngEle.markAsTouched();\n }\n $appDigest();\n return true;\n }\n return true;\n }\n return false;\n }\n return false;\n }", "title": "" }, { "docid": "2f92122f974411beb8dcaea81e50a334", "score": "0.6084394", "text": "function finalValidation() {\n if (!nameflag) {\n var ref = $(\".name\").parents('.form-group');\n var f = $(\".error\");\n $(ref).find(f).text(\"please correct the name\").show();\n }\n if (!emailflag) {\n var ref = $(\".email\").parents('.form-group');\n var f = $(\".error\");\n $(ref).find(f).text(\"invalid email\").show();\n }\n if (!dobflag) {\n var ref = $(\".dob\").parents('.form-group');\n var f = $(\".error\");\n $(ref).find(f).text(\"invalid dob\").show();\n }\n if (!phoneflag) {\n var ref = $(\".ph\").parents('.form-group');\n var f = $(\".error\");\n $(ref).find(f).text(\"invalid phone number\").show();\n }\n if (nameflag && dobflag && phoneflag && emailflag) {\n var values = new Array();\n var table = $(\"#myTable\");\n $(\"form#form1 input\").each(function (i) {\n values[i] = $(this).val(); // inserting each input value to array\n });\n table.append(\"<tr class='text-justify'><td >\" + values[0] + \"</td><td >\" + values[1] + \"</td><td >\" + values[2] + \"</td><td >\" + values[3] + \"</td><td>\" + values[4] + \"</td></tr>\");\n document.getElementById(\"form1\").reset();\n values = []; // resetting array\n // resetting the flags\n nameflag = 0;\n dobflag = 0;\n phoneflag = 0;\n emailflag = 0;\n }\n}", "title": "" }, { "docid": "db9f143ee44a1e2c71c135c02a3acbaa", "score": "0.6079339", "text": "function validate(){\r\n\t\r\n\tvar submitForm = true;\r\n\t\t\t\r\n\tvar validateArray = [validateName('first'), validateMiddleName(), validateName('last'),\r\n\t\t\t\t\t\tvalidateEmail(), validatePhone(), validatePassword(), validateDOB(),\r\n\t\t\t\t\t\tvalidateAddress('current'), validateAddress('permanent'), validateSelectField('country'),\r\n\t\t\t\t\t\tvalidateSelectField('state'), validateSelectField('city'),validateCaptcha(), validateGender()];\r\n\r\n\tfor(i = 0 ; i < validateArray.length ; i++){\r\n\t\t\tsubmitForm = submitForm && validateArray[i];\r\n\t\t\tif(submitForm === false){\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t//returns true only when all functions returns true\r\n\treturn (submitForm); \r\n\r\n}", "title": "" }, { "docid": "48bde6dedd60451d78aa6403e1644f0e", "score": "0.607877", "text": "function validate() {\n var isValid = validateRequiredFields() && validateDateFields();\n\n\n return true;\n }", "title": "" }, { "docid": "353d753426754590edca65bac196f874", "score": "0.6077352", "text": "function validateForm(Name, Assignedto, Description, DueDate, Status){\n //get the values retrieved on the click event and check valid \n //assigned by and to are > 0 and < 20\n //description is technically meant to be > 20 (over 10 for testing)\n //due date is supplied\n //status is supplied\n //test all the info supplied and return true or false\n\n let isAllValid = false\n\n if (((Name.length > 0) && (Name.length < 20)) \n && ((Assignedto.length > 0) && (Assignedto.length < 20)) && \n ((Description.length > 0) && (Description.length < 40)) && (DueDate) && (Status)) {\n isAllValid = true\n return isAllValid;\n }\n}", "title": "" }, { "docid": "eb04defdea6919f1a9ad3533f9162318", "score": "0.6076062", "text": "function validate(event) {\n event.preventDefault();\n\n var valide = true;\n resetErrors();\n\n\n if (!checkFirst()) {\n displayError(firstForm);\n border(firstForm, \"red\");\n valide = false;\n }\n\n if (!checkLast()) {\n displayError(lastForm);\n border(lastForm, \"red\");\n valide = false;\n }\n\n if (!checkEmail()) {\n displayError(emailForm);\n border(emailForm, \"red\");\n valide = false;\n }\n\n if (!checkBirthdate()) {\n displayError(birthdateForm);\n border(birthdateForm, \"red\");\n valide = false;\n }\n\n if (!checkQuantity()) {\n displayError(quantityForm);\n border(quantityForm, \"red\");\n valide = false;\n }\n\n if (!checkLocation()) {\n displayError(locationForm[1]);\n borderRadio(\"red\");\n valide = false;\n }\n\n if (!checkCondition()) {\n displayError(conditionForm);\n border(condiCheckbox, \"red\");\n valide = false;\n }\n\n if (valide) {\n showConfirm();\n }\n\n}", "title": "" }, { "docid": "a99ab7d4a5f7ce66854edfe4cad9dad6", "score": "0.6066502", "text": "function allAreValid(){\n return (isNameValid() && isEmailValid() && isMessageValid());\n }", "title": "" }, { "docid": "0f36600fe5d04a59fb5dff8b212e1db2", "score": "0.60657257", "text": "function checkInputs() {\n // trim to remove the whitespaces\n const firstnameValue = firstname.value.trim();\n const lastnameValue = lastname.value.trim();\n const emailValue = email.value.trim();\n const addressValue = address.value.trim();\n const zipcodeValue = zipcode.value.trim();\n\n // Get the value where whitespaces are allowed\n const cityValue = city.value;\n\n let validation = true;\n\n // Test of all the imput for invalid imput or empty field\n if (!isNotDigit(firstnameValue)) {\n setErrorFor(firstname, \"Prénom erroné\");\n validation = false;\n } else {\n setSuccessFor(firstname);\n }\n\n if (!isNotDigit(lastnameValue)) {\n setErrorFor(lastname, \"Nom erroné\");\n validation = false;\n } else {\n setSuccessFor(lastname);\n }\n\n if (!isEmail(emailValue)) {\n setErrorFor(email, \"Votre adresse mail n'est pas valide\");\n validation = false;\n } else {\n setSuccessFor(email);\n }\n\n if (!isZipcode(zipcodeValue)) {\n setErrorFor(zipcode, \"Code postal erroné\");\n validation = false;\n } else {\n setSuccessFor(zipcode);\n }\n\n setSuccessFor(city);\n setSuccessFor(address);\n\n document.querySelectorAll('input').forEach(input => {\n if (!input.value.length) {\n setErrorFor(input, 'Saisie obligatoire')\n }\n })\n if (validation)\n return true\n return false\n}", "title": "" }, { "docid": "703a3bc358ab7be956ab16ce5e87f186", "score": "0.6063108", "text": "function submitEvent(event) {\n event.preventDefault();\n let errors = document.querySelectorAll('.error');\n \n // if there is at least one error, clear all\n if (errors[0]) {\n errors.forEach( function(err) {\n err.remove();\n });\n }\n \n // Create an instance of the CheckValidity class for each input except Country\n let validateName = new CheckValidity(nameField, 'text');\n let validateEmail = new CheckValidity(emailField, 'email');\n let validateAddress = new CheckValidity(addressField, 'text');\n let validateCity = new CheckValidity(cityField, 'text');\n let validateState = new CheckValidity(stateField, 'text');\n let validateZipCode = new CheckValidity(zipCodeField, 'text');\n \n const validateArray = [validateName, validateEmail, validateAddress, \n validateCity, validateState, validateZipCode];\n let counter = 0;\n \n // loop through all inputs and check for errors\n for (let i = 0; i < validateArray.length; i++) { \n // Store this classes error messages\n let errorMessages = validateArray[i].getMessages();\n\n \n // If there are errors,\n if (errorMessages.length > 0) { \n \n errorMessages.forEach( (err) => {\n fieldArray[i].insertAdjacentHTML('afterend', '<p class=\"error\">' + err + '</p>');\n });\n }\n \n else {\n // If the input field passes validation, add to counter\n counter++;\n // If all fields pass validation, show completed order\n if (counter === validateArray.length) {\n \n // show completed screen\n showCompletion();\n }\n }\n }\n}", "title": "" }, { "docid": "b466e6fa713c99f8d368a20723ddd033", "score": "0.6062736", "text": "function validateAddFirmInputs(obj) {\r\n\r\n if (validateEmptyField(document.getElementById(\"firmName\").value, \"Please enter Firm Name!\") == false ||\r\n validateAlphaNumWithSpace(document.getElementById(\"firmName\").value, \"Accept only alpha or numeric characters or with space character!\") == false) {\r\n document.getElementById(\"firmName\").focus();\r\n return false;\r\n }\r\n else if (validateEmptyField(document.getElementById(\"firmRegNo\").value, \"Please enter Registration Number!\") == false\r\n //|| validateNum(document.getElementById(\"firmRegNo\").value, \"Accept only numeric without space character!\") == false comment to accept all values by @AUTHOR: SANDY25JAN14\r\n ) {\r\n document.getElementById(\"firmRegNo\").focus();\r\n return false;\r\n }\r\n else if (validateSelectField(document.getElementById(\"firmType\").value, \"Please select Firm Type!\") == false) {\r\n document.getElementById(\"firmType\").focus();\r\n return false;\r\n }\r\n else if (validateSelectField(document.getElementById(\"firmOwner\").value, \"Please select Firm Owner!\") == false) {\r\n document.getElementById(\"firmOwner\").focus();\r\n return false;\r\n }\r\n return true;\r\n}", "title": "" }, { "docid": "889aa148f6b1ffaa18b7c1600e9b9d5f", "score": "0.60604405", "text": "function istareaFormValid(){\t \n\t var v1 = hallazgoField.isValid();\n\t var v2 = tareaField.isValid();\n\t var v3 = responsablesCombo.isValid();\n\t var v4 = fechaField.isValid();\n\t var v5 = herramientasCombo.isValid();\n\t var v6 = tareaCriticidadRadios.isValid();\n// var v7 = tareaRevisionRadios.isValid();\n\t return( v1 && v2 && v3 && v4 && v5 && v6);// && v7);\n }", "title": "" }, { "docid": "ac948d33f9f69c09ddd9534ae5f7a0f3", "score": "0.6057656", "text": "function checkFormAllFields(frmName)\r\n{\r\n\tvar strSubmit = true;\r\n\tvar currElmVal;\r\n\tvar currI = -1;\r\n\tfor(i=0; i<frmName.elements.length; i++)\r\n\t{\r\n\t\tcurrElement = frmName.elements[i];\r\n\t\tswitch(currElement.type)\r\n\t\t{\r\n\t\t\tcase 'text':\r\n\t\t\tcase 'select-one':\r\n\t\t\tcase 'password':\r\n\t\t\tcase 'textarea':\r\n\t\t\tcase 'checkbox':\r\n\t\t\tcurrElmVal = currElement.value;\r\n\t\t\tcurrElmVal = trim(currElmVal);\r\n\t\t\tif(escape(currElmVal) == \"\")\r\n\t\t\t{\r\n\t\t\t\tif(strSubmit == true)\r\n\t\t\t\t{\r\n\t\t\t\t\tcurrI = i;\r\n\t\t\t\t}\r\n\t\t\t\tstrSubmit = false;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tif(strSubmit == false)\r\n\t{\r\n\t\talert('No field can be left blank.');\r\n\t\tcurrElement = frmName.elements[currI];\r\n\t\tcurrElement.focus();\r\n\t}\r\n\treturn strSubmit;\r\n}", "title": "" }, { "docid": "f3a1bdd8767b1983bea667e6034b95f2", "score": "0.60552377", "text": "function validateAll() {\n validated = true;\n validateFullName();\n validateEmail();\n validateUsername();\n validatePassword();\n console.log(\"validated = \" + validated);\n}", "title": "" }, { "docid": "dd37e72f2e832b23b74a11c708a1218a", "score": "0.60536456", "text": "function Validate(controlsToValidate) {\r\n valid = true;\r\n \r\n var message = \"Warning:\\n\\n\";\r\n \r\n for(var i = 0;i < controlsToValidate.length;i++) {\r\n if(controlsToValidate[i].required == 1) {\r\n //Validate that a value has been entered\r\n if(ContainsValue(controlsToValidate[i].elementid) == false) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is required.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].maxlength != -1) {\r\n //Validate that the value is not over max\r\n if(IsOverMaxLength(controlsToValidate[i].elementid, controlsToValidate[i].maxlength) == true) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is to long.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].minlength != -1) {\r\n \r\n //Validate that the value is not under min\r\n if(IsUnderMinLength(controlsToValidate[i].elementid, controlsToValidate[i].minlength) == true) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is to short.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].email == 1) {\r\n //Validate that the value is an email\r\n if(IsEmail(document.getElementById(controlsToValidate[i].elementid)) == false) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is not a valid email address.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].decimal == 1) {\r\n //Validate that the value is decimal\r\n if(IsDecimal(document.getElementById(controlsToValidate[i].elementid)) == false) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is not a decimal.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].nonnegdecimal == 1) {\r\n //Validate that the value is decimal\r\n if(IsNonNegDecimal(document.getElementById(controlsToValidate[i].elementid)) == false) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is not a positive decimal.\\n\";\r\n }\r\n }\r\n \r\n if(controlsToValidate[i].ipaddress == 1) {\r\n //Validate that the value is decimal\r\n if(IsIpAddress(document.getElementById(controlsToValidate[i].elementid)) == false) {\r\n valid = false;\r\n message += document.getElementById(controlsToValidate[i].elementid).name + \" is not an IP Address.\\n\";\r\n }\r\n }\r\n }\r\n \r\n if (valid == false) {\r\n alert(message);\r\n }\r\n return valid;\r\n}", "title": "" }, { "docid": "90446fbd91f77750ec8c6e05876c7da7", "score": "0.6047372", "text": "function validateForm(objForm)\n{\n var bolResult = true;\n var obj = objForm;\n if (typeof obj.name == \"undefined\") {\n alert(\"Form is not defined!\");\n return false;\n }\n x = \"\";\n total = obj.elements.length;\n for (i = 0; i < total; i++) {\n el = obj.elements[i];\n if (!el.disabled && !el.readonly) {\n if (el.type != \"submit\" && el.type != \"reset\" && el.type != \"button\" && el.type != \"hidden\" && el.type != \"checkbox\" && el.type != \"radio\") {\n strClass = el.className;\n if (strClass == \"numeric\") {\n // cek apakah angka, kosong atau tidak\n if (isNaN(el.value) || el.value == \"\") {\n alert(\"Error numeric data!!!\");\n el.focus();\n return false;\n }\n } else if (strClass == \"numeric-empty\") {\n // cek apakah angka, kosong atau tidak\n if (isNaN(el.value) && el.value != \"\") {\n alert(\"Error numeric data!!!\");\n el.focus();\n return false;\n }\n } else if (strClass == \"string\") {\n // cek kosong atau tidak\n if (el.value == \"\") {\n alert(\"Error string data! {empty}\");\n el.focus();\n return false;\n }\n } else if (strClass == \"string-empty\") {\n // nothing\n } else if (strClass == \"date\") {\n if (!validDate(el.value)) {\n alert(\"Error date data!\");\n el.focus();\n return false;\n }\n } else if (strClass == \"date-empty\") {\n if (el.value != \"\") {\n if (!validDate(el.value)) {\n alert(\"Error date data!\");\n el.focus();\n return false;\n }\n }\n } else if (strClass == \"time\") {\n if (!validTime(el.value, el)) {\n alert(\"Error time data!\");\n el.focus();\n return false;\n }\n } else if (strClass == \"time-empty\") {\n if (el.value != \"\") {\n if (!validTime(el.value, el)) {\n alert(\"Error time data!\");\n el.focus();\n return false;\n }\n }\n } else {\n // nothing\n }\n\n }\n }\n }\n\n //alert(\"OK\" + x);\n return true;\n} // validateForm", "title": "" }, { "docid": "7a67c4b40f0adb89894153024ac07541", "score": "0.60432637", "text": "function validate(values){\n const errors = {};\n\n _.each(FIELDS, (type,field) => {\n if(!values[field]){\n errors[field] = `Enter a ${field}`;\n }\n })\n // if(!values.title){\n // errors.title = \"Enter a title\";\n // }\n // if(!values.categories){\n // errors.categories = \"Enter a Category\";\n // }\n // if(!values.content){\n // errors.content = \"Enter appropriate content\";\n // }\n return errors;\n}", "title": "" }, { "docid": "c02b166d3cec0702a53351f980176144", "score": "0.60349166", "text": "validateElements(){\n let schema = this.Form.getSchema();\n let Elements = schema.elements || null;\n if(Elements==null){\n console.error('Schema not have elements');\n return false;\n }\n if(typeof Elements !='object'){\n console.error('Elements of schema is not object');\n return false;\n }\n let valid = true;\n for(let ElementID in Elements){\n let typeElement = Elements[ElementID].type || null;\n if(typeElement==null){\n console.error('Element \"'+ElementID+'\" not have type');\n return false;\n }\n switch (typeElement) {\n case 'input':\n valid = this.validate_input(ElementID,Elements[ElementID]);\n break;\n case 'submit':\n valid = this.validate_submit(ElementID,Elements[ElementID]);\n break;\n case 'image':\n valid = this.validate_image(ElementID,Elements[ElementID]);\n break;\n case 'file':\n valid = this.validate_file(ElementID,Elements[ElementID]);\n break;\n case 'textarea':\n valid = this.validate_textarea(ElementID,Elements[ElementID]);\n break;\n case 'select':\n valid = this.validate_select(ElementID,Elements[ElementID]);\n break;\n case 'tinymce':\n valid = this.validate_tinymce(ElementID,Elements[ElementID]);\n break;\n case 'static':\n valid = this.validate__static(ElementID,Elements[ElementID]);\n break;\n case 'datepicker':\n valid = this.validate_datepicker(ElementID,Elements[ElementID]);\n break;\n case 'radioButtons':\n valid = this.validate_radioButtons(ElementID,Elements[ElementID]);\n break;\n case 'checkBoxes':\n valid = this.validate_checkBoxes(ElementID,Elements[ElementID]);\n break;\n default:\n break;\n }\n }\n return valid;\n }", "title": "" }, { "docid": "f8f9696170e8e18383d129d06ecf693c", "score": "0.6030298", "text": "function validate(values) {\n // This errors object is how we communicate validation errors to redux form\n const errors = {};\n\n // These specific names like \"title\" must correlate with the Field properties\n if (!values.title || values.title.length < 3) {\n errors.title = \"Enter a title that is at least 3 characters!\";\n }\n\n if (!values.categories) {\n errors.categories = \"Enter some categories!\";\n }\n\n if (!values.content) {\n errors.content = \"Fill out some content!\";\n }\n\n // If errors is empty, the form is fine to submit\n // If errors has any properties, redux form will not submit the form\n return errors\n}", "title": "" }, { "docid": "49271396cdc13b97ff32f72edd9e2103", "score": "0.60280496", "text": "function dataValidate(obj)\n{\n\tformobj = {};\n\t$(obj).find('input').each(function(){\n\t\tvar c = $(this).attr(\"name\");\n\t\tvar v = $(this).val();\n\t\tformobj[c] = v;\n\t});\n\tfor(var cl in formobj)\n\t{\n\t\tvar sel = '.dataAddForm input[name=\"'+cl+'\"]'; \n\t\tswitch (cl){\n\t\t\tcase 'dataFormWeight':\n\t\t\t\tif(formobj[cl] === '' || isNaN(formobj[cl]))\n\t\t\t\t{\n\t\t\t\t\t$(sel).addClass('error').focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(sel).removeClass('error');\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'dataFormWater':\n\t\t\tcase 'dataFormSleep':\n\t\t\t\tif(formobj[cl] === '' || isNaN(formobj[cl]))\n\t\t\t\t{\n\t\t\t\t\t$(sel).addClass('error').focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(sel).removeClass('error');\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'dataFormMeals':\n\t\t\t\tif(formobj[cl] === '' || isNaN(formobj[cl]) || !isInt(formobj[cl]))\n\t\t\t\t{\n\t\t\t\t\t$(sel).addClass('error').focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(sel).removeClass('error');\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'dataFormStartDate':\n\t\t\tcase 'dataFormEndDate':\n\t\t\t\tif(formobj[cl] === '' || !isDate(formobj[cl]))\n\t\t\t\t{\n\t\t\t\t\t$(sel).addClass('error').focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(sel).removeClass('error');\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'dataFormStartTime':\n\t\t\tcase 'dataFormEndTime':\n\t\t\t\tif(formobj[cl] === '' || !isTime(formobj[cl]))\n\t\t\t\t{\n\t\t\t\t\t$(sel).addClass('error').focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(sel).removeClass('error');\n\t\t\t\t\tif(cl === 'dataFormEndTime')\n\t\t\t\t\t{\n\t\t\t\t\t\tvar code = '';\n\t\t\t\t\t\tcurrentDate = window.reschedulestr;\n\t\t\t\t\t\tfor (var i in window.datelistobj)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(window.datelistobj[i]['date'] === currentDate)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcode = window.datelistobj[i]['code'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\taddSessionData(formobj,window.userEmail,code);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1fa990cc2060767a7f7bcc1ad3476cfc", "score": "0.6027678", "text": "validateFields() {\n debugLog(\"Validating fields for Prompt \" + this.getID());\n // Iterate all fields and check their validity.\n const error_messages = [];\n this.prompt_fields.forEach((prompt_field) => {\n // Check if the field has parsing errors.\n const parsing_errors = prompt_field.getParsingErrors();\n for (const parsing_error of parsing_errors) {\n // This field has parsing error(s).\n error_messages.push(`'${prompt_field.getTitle()}': ` + parsing_error);\n }\n // Check other validity.\n if (!prompt_field.validate()) {\n // This field failed to validate.\n // TODO: Change this so that the message will come from prompt_field.validate().\n error_messages.push(`'${prompt_field.getTitle()}' needs to be filled.`);\n }\n });\n // Return the result.\n if (0 === error_messages.length) {\n return Promise.resolve();\n }\n else {\n return Promise.reject(error_messages);\n }\n }", "title": "" } ]
72bd77242157789b5c5c49ee726f8aed
Get a new TensorList containing a copy of the underlying tensor container.
[ { "docid": "76ec30d1bb99c6964528a1577d0ec561", "score": "0.83399034", "text": "copy() {\n return new TensorList([...this.tensors], this.elementShape, this.elementDtype);\n }", "title": "" } ]
[ { "docid": "1ae2e8d5fcc486d291e4361b658922a3", "score": "0.8262933", "text": "copy() {\n return new TensorList([...this.tensors], this.elementShape, this.elementDtype);\n }", "title": "" }, { "docid": "3b2fb8eb13cd9b2683506ec1d856c8ae", "score": "0.6179637", "text": "function cloneTensor(tensor) {\n return tensor.kept ? tensor : (0, _tfjsCore.clone)(tensor);\n}", "title": "" }, { "docid": "888d73296065a31e78aa98ba919ad76c", "score": "0.5962307", "text": "function cloneTensor(tensor) {\n return tensor.kept ? tensor : Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"clone\"])(tensor);\n}", "title": "" }, { "docid": "7d8f2798e105137a93ba097b34ffaf6d", "score": "0.5944872", "text": "function cloneListForMapAndSample(original, excludeDimensions) {\n var allDimensions = original.dimensions;\n var list = new List(\n map(allDimensions, original.getDimensionInfo, original),\n original.hostModel\n );\n // FIXME If needs stackedOn, value may already been stacked\n transferProperties(list, original);\n\n var storage = list._storage = {};\n var originalStorage = original._storage;\n\n // Init storage\n for (var i = 0; i < allDimensions.length; i++) {\n var dim = allDimensions[i];\n if (originalStorage[dim]) {\n // Notice that we do not reset invertedIndicesMap here, becuase\n // there is no scenario of mapping or sampling ordinal dimension.\n if (indexOf(excludeDimensions, dim) >= 0) {\n storage[dim] = cloneDimStore(originalStorage[dim]);\n list._rawExtent[dim] = getInitialExtent();\n list._extent[dim] = null;\n }\n else {\n // Direct reference for other dimensions\n storage[dim] = originalStorage[dim];\n }\n }\n }\n return list;\n }", "title": "" }, { "docid": "18791b5bea585367f0077338be1920c0", "score": "0.57673955", "text": "get copy() {\n let copy = FudgeCore.Recycler.get(Vector3);\n copy.data.set(this.data);\n return copy;\n }", "title": "" }, { "docid": "0810ba22b8ac9ad0588e8555b28f41d0", "score": "0.57079995", "text": "function cloneListForMapAndSample(original, excludeDimensions) {\n var allDimensions = original.dimensions;\n var list = new List(zrUtil.map(allDimensions, original.getDimensionInfo, original), original.hostModel); // FIXME If needs stackedOn, value may already been stacked\n\n transferProperties(list, original);\n var storage = list._storage = {};\n var originalStorage = original._storage; // Init storage\n\n for (var i = 0; i < allDimensions.length; i++) {\n var dim = allDimensions[i];\n\n if (originalStorage[dim]) {\n // Notice that we do not reset invertedIndicesMap here, becuase\n // there is no scenario of mapping or sampling ordinal dimension.\n if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {\n storage[dim] = cloneDimStore(originalStorage[dim]);\n list._rawExtent[dim] = getInitialExtent();\n list._extent[dim] = null;\n } else {\n // Direct reference for other dimensions\n storage[dim] = originalStorage[dim];\n }\n }\n }\n\n return list;\n}", "title": "" }, { "docid": "cb4122a12d9b543c7b1399111ddbf326", "score": "0.5704187", "text": "function cloneListForMapAndSample(original, excludeDimensions) {\n\t var allDimensions = original.dimensions;\n\t var list = new List(zrUtil.map(allDimensions, original.getDimensionInfo, original), original.hostModel); // FIXME If needs stackedOn, value may already been stacked\n\n\t transferProperties(list, original);\n\t var storage = list._storage = {};\n\t var originalStorage = original._storage;\n\t var rawExtent = zrUtil.extend({}, original._rawExtent); // Init storage\n\n\t for (var i = 0; i < allDimensions.length; i++) {\n\t var dim = allDimensions[i];\n\n\t if (originalStorage[dim]) {\n\t if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {\n\t storage[dim] = cloneDimStore(originalStorage[dim]);\n\t rawExtent[dim] = getInitialExtent();\n\t } else {\n\t // Direct reference for other dimensions\n\t storage[dim] = originalStorage[dim];\n\t }\n\t }\n\t }\n\n\t return list;\n\t}", "title": "" }, { "docid": "0407451610c589c364dad091ce34ed87", "score": "0.5684537", "text": "function cloneListForMapAndSample(original, excludeDimensions) {\n var allDimensions = original.dimensions;\n var list = new List(\n zrUtil.map(allDimensions, original.getDimensionInfo, original),\n original.hostModel\n );\n // FIXME If needs stackedOn, value may already been stacked\n transferProperties(list, original);\n\n var storage = list._storage = {};\n var originalStorage = original._storage;\n\n // Init storage\n for (var i = 0; i < allDimensions.length; i++) {\n var dim = allDimensions[i];\n if (originalStorage[dim]) {\n // Notice that we do not reset invertedIndicesMap here, becuase\n // there is no scenario of mapping or sampling ordinal dimension.\n if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {\n storage[dim] = cloneDimStore(originalStorage[dim]);\n list._rawExtent[dim] = getInitialExtent();\n list._extent[dim] = null;\n }\n else {\n // Direct reference for other dimensions\n storage[dim] = originalStorage[dim];\n }\n }\n }\n return list;\n}", "title": "" }, { "docid": "1e59bdd7ebe768c403e34a278d25a048", "score": "0.5664071", "text": "function fromTensor(tensor, elementShape, elementDtype) {\n const dtype = tensor.dtype;\n if (tensor.shape.length < 1) {\n throw new Error(`Tensor must be at least a vector, but saw shape: ${tensor.shape}`);\n }\n if (tensor.dtype !== elementDtype) {\n throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${elementDtype}`);\n }\n const outputShape = tensor.shape.slice(1);\n Object(_tensor_utils__WEBPACK_IMPORTED_MODULE_1__[\"assertShapesMatchAllowUndefinedSize\"])(outputShape, elementShape, 'TensorList shape mismatch: ');\n const tensorList = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"unstack\"])(tensor);\n return new TensorList(tensorList, elementShape, dtype);\n}", "title": "" }, { "docid": "cfe2fa55aad336b3bf078af9f9b7de5e", "score": "0.5638736", "text": "clone(){\n let copy = new NeuralNetwork(this.inputNodes,this.outputNodes,this.hiddenLayers,this.hiddenLayerSize);\n copy.network = Array.from(this.network);\n return copy;\n }", "title": "" }, { "docid": "5cdce4f27b3bde29f19e8477e156adac", "score": "0.5579817", "text": "copy() {\r\n return Vec.from(this)\r\n }", "title": "" }, { "docid": "2407d0f0c114af827177533387f80a88", "score": "0.55668926", "text": "function copyList(l){\n let arr = l.slice();\n return arr\n}", "title": "" }, { "docid": "c95cb537e478608b525bbdfbd4c692dd", "score": "0.55335057", "text": "copy() {\n return new Pointer(this.container, this.index);\n }", "title": "" }, { "docid": "3f9bc962a49279c2bc0504042fb1d588", "score": "0.5523237", "text": "function copyList(array){\n return newArray = array.slice()\n}", "title": "" }, { "docid": "4f17e0c6e0cc7b55d9b5fbb08c8c2dec", "score": "0.5431317", "text": "function clone() {\n var arr = [];\n this.each(function(el) {\n arr.push(el.cloneNode(true));\n });\n return this.air(arr);\n}", "title": "" }, { "docid": "b7f2f19f5362542efe6f63cf0d09f80e", "score": "0.53836906", "text": "copy() {\r\n return new NeuralNetwork(this);\r\n }", "title": "" }, { "docid": "96fc52264586d01e9e221bd9b3798f93", "score": "0.53736705", "text": "copy() {\r\n let result = new Matrix(this.rows, this.cols);\r\n result.data = this.data.slice(0);\r\n return result;\r\n }", "title": "" }, { "docid": "2b8cf747a2ced38f774d5054a67b7e09", "score": "0.5349656", "text": "function cloneToLView(list) {\n if (LVIEW_EMPTY === undefined)\n LVIEW_EMPTY = new LViewArray();\n return LVIEW_EMPTY.concat(list);\n}", "title": "" }, { "docid": "4e7202e72a8d706040eb2235eed0cfc3", "score": "0.5347343", "text": "copy () {\n return new NeuralNetwork(this);\n }", "title": "" }, { "docid": "58fe1af688bea7aa431649f0c910bcce", "score": "0.5335385", "text": "pushBack(tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n Object(_tensor_utils__WEBPACK_IMPORTED_MODULE_1__[\"assertShapesMatchAllowUndefinedSize\"])(tensor.shape, this.elementShape, 'TensorList shape mismatch: ');\n if (this.maxNumElements === this.size()) {\n throw new Error(`Trying to push element into a full list.`);\n }\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"keep\"])(tensor);\n this.tensors.push(tensor);\n }", "title": "" }, { "docid": "a24e0da7bd79a7efc529ec91b393bc34", "score": "0.53045607", "text": "clone(x) {\n const y = this.makeTensorFromDataId(x.dataId, x.shape, x.dtype);\n const inputs = { x };\n const grad = (dy) => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = { x: dy };\n const attrs = { dtype };\n return ENGINE.runKernelFunc(backend => backend.cast(dy, dtype), gradInputs, null /* grad */, _kernel_names__WEBPACK_IMPORTED_MODULE_3__[\"Cast\"], attrs);\n }\n });\n const saved = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "9368c00e6c6d2d59dc131a527e0add72", "score": "0.5300045", "text": "function cloneToTViewData(list) {\n if (TVIEWDATA_EMPTY === undefined)\n TVIEWDATA_EMPTY = new TViewData();\n return TVIEWDATA_EMPTY.concat(list);\n}", "title": "" }, { "docid": "fe00faf6f023499ca96c81d7e2163185", "score": "0.5238997", "text": "clone(x) {\n const y = ENGINE.runKernel(_kernel_names.Identity, {\n x\n });\n const inputs = {\n x\n };\n\n const grad = dy => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = {\n x: dy\n };\n const attrs = {\n dtype\n };\n return ENGINE.runKernel(_kernel_names.Cast, gradInputs, // tslint:disable-next-line: no-unnecessary-type-assertion\n attrs);\n }\n });\n\n const saved = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }", "title": "" }, { "docid": "0e8ab043fe5db758102ed032b3790cd2", "score": "0.51779336", "text": "function getSafeCopy(list){\n return list.map(function(arr) {\n return arr.slice();\n });\n }", "title": "" }, { "docid": "ab6822a5f86388436c81741fd58fd995", "score": "0.51579624", "text": "function reserve(elementShape, elementDtype, numElements) {\n return new TensorList([], elementShape, elementDtype, numElements);\n}", "title": "" }, { "docid": "41d8fff3c04ced54fafb53bee257e437", "score": "0.51518625", "text": "copy() {\n const m = this.matrix;\n const copyM = JSON.parse(JSON.stringify(m));\n return new Matrix(copyM);\n }", "title": "" }, { "docid": "64e450fef2f9d74339fb5c0061fe6d41", "score": "0.5142002", "text": "pushBack(tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n\n (0, _tensor_utils.assertShapesMatchAllowUndefinedSize)(tensor.shape, this.elementShape, 'TensorList shape mismatch: ');\n\n if (this.maxNumElements === this.size()) {\n throw new Error(`Trying to push element into a full list.`);\n }\n\n (0, _tfjsCore.keep)(tensor);\n this.tensors.push(tensor);\n }", "title": "" }, { "docid": "f3ecbb966fcca907204561064b717044", "score": "0.51412094", "text": "copy() {\n this._listing.copy();\n }", "title": "" }, { "docid": "c30ff650a3be4cfb60bb455a5d02b601", "score": "0.5126862", "text": "dup() {\n return new Matrix(this.elements);\n }", "title": "" }, { "docid": "e06f900cd78f13596e3b0c5a634ddb7b", "score": "0.51140505", "text": "getUnderlyingList() {\n\n let head = new ListNode(this.items[0]);\n let currentItem = head;\n\n for (let i = 1; i < this.items.length; i++) {\n let newNode = new ListNode(this.items[i]);\n currentItem.next = newNode;\n currentItem = newNode;\n }\n \n return head;\n \n }", "title": "" }, { "docid": "b6367cf46eed56bb9d319161ab2b5697", "score": "0.5106672", "text": "function reserve(elementShape, elementDtype, numElements) {\n return new TensorList([], elementShape, elementDtype, numElements);\n}", "title": "" }, { "docid": "9dad73e1e20f0dd181ddb84b43413e38", "score": "0.5070217", "text": "function cloneListObject(originalList, objectId) {\n const list = originalList ? originalList.slice() : [] // slice() makes a shallow clone\n const conflicts = (originalList && originalList[CONFLICTS]) ? originalList[CONFLICTS].slice() : []\n const elemIds = (originalList && originalList[ELEM_IDS]) ? originalList[ELEM_IDS].slice() : []\n Object.defineProperty(list, OBJECT_ID, {value: objectId})\n Object.defineProperty(list, CONFLICTS, {value: conflicts})\n Object.defineProperty(list, ELEM_IDS, {value: elemIds})\n return list\n}", "title": "" }, { "docid": "33bbe12fa42197305e27b7617ec3e204", "score": "0.5068139", "text": "clone() {\n\t\treturn new Vector3(this.x, this.y, this.z);\n\t}", "title": "" }, { "docid": "60f0d0901511a142236cebe2b050d5f0", "score": "0.504865", "text": "clone() {\n const matrix = new Matrix();\n matrix.copyFrom(this);\n return matrix;\n }", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "f783668598b87e41dccf43c360a888f3", "score": "0.50449395", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n}", "title": "" }, { "docid": "fa2daf6262b5e123859e04ef0f683e1e", "score": "0.5026377", "text": "clone() {\n let newMatrix = new this.constructor(this.height(), this.width());\n for (let i = 0; i < this.height(); i++) {\n for (let j = 0; j < this.width(); j++) {\n newMatrix.put(i, j, this.get(i, j));\n }\n }\n return newMatrix;\n }", "title": "" }, { "docid": "4e2bf1c9b9e7dbf8ece4aca50653cecf", "score": "0.5015432", "text": "clone() {\n let m = new Matrix(this.metrixElements);\n return m;\n }", "title": "" }, { "docid": "4a9427242fc484ca4ca05d207b3a4962", "score": "0.49684772", "text": "copy() {\n return new Vector(this.x, this.y);\n }", "title": "" }, { "docid": "41d2a4003e81dda429abd99eb456d2f3", "score": "0.49612436", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n }", "title": "" }, { "docid": "41d2a4003e81dda429abd99eb456d2f3", "score": "0.49612436", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n }", "title": "" }, { "docid": "41d2a4003e81dda429abd99eb456d2f3", "score": "0.49612436", "text": "function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n }", "title": "" }, { "docid": "a7a9afbadb729e1afc61a0e6aadc2e4a", "score": "0.49523082", "text": "function copy(f, t) {\r\n t.i = f.i;\r\n t.j = f.j;\r\n t.S = f.S.slice();\r\n return t;\r\n }", "title": "" }, { "docid": "acd685fea9dcbf9bc6044111c31571b9", "score": "0.4949963", "text": "function vectorToList(vector) {\n return Immutable.List(vector.toArray());\n}", "title": "" }, { "docid": "de50b001218b8aa27919752543ebabd4", "score": "0.49420148", "text": "clearList(){\n this.length = 0;\n this.head.setPointer(this.tail);\n return this;\n }", "title": "" }, { "docid": "968097e3f182a5e8eb2779b8888ddd24", "score": "0.4939784", "text": "clone() {\n // this class should not be cloned since it wraps\n // around a given array. The calling function should check\n // whether the wrapped array is null and supply a new array\n // (from the clone).\n return this.nodes = null;\n }", "title": "" }, { "docid": "968097e3f182a5e8eb2779b8888ddd24", "score": "0.4939784", "text": "clone() {\n // this class should not be cloned since it wraps\n // around a given array. The calling function should check\n // whether the wrapped array is null and supply a new array\n // (from the clone).\n return this.nodes = null;\n }", "title": "" }, { "docid": "968097e3f182a5e8eb2779b8888ddd24", "score": "0.4939784", "text": "clone() {\n // this class should not be cloned since it wraps\n // around a given array. The calling function should check\n // whether the wrapped array is null and supply a new array\n // (from the clone).\n return this.nodes = null;\n }", "title": "" }, { "docid": "968097e3f182a5e8eb2779b8888ddd24", "score": "0.4939784", "text": "clone() {\n // this class should not be cloned since it wraps\n // around a given array. The calling function should check\n // whether the wrapped array is null and supply a new array\n // (from the clone).\n return this.nodes = null;\n }", "title": "" }, { "docid": "6a6c5c9800e04ce68a9467a3df8f0612", "score": "0.49346653", "text": "copy() {\n const copy = new Grid(this.size);\n copy.grid = copyBoard(this.grid);\n return copy;\n }", "title": "" }, { "docid": "eeb2deceda84d4253943449e3fbb54c3", "score": "0.4930764", "text": "copy ()\n {\n return new Vector(this.x, this.y);\n }", "title": "" }, { "docid": "c75db9ca11a2237980254af24cc05862", "score": "0.49258184", "text": "function shallowClone(data){\n\t\t\t\treturn data.map(function(el) { return el; });\n\t\t\t\t// return data.map(el => el);\n\t\t\t}", "title": "" }, { "docid": "0ed81bc835f00c529293030d5975eb11", "score": "0.49117106", "text": "static clone2D(a) {\n return a.map(o => [ ...o ]);\n }", "title": "" }, { "docid": "cdb50a5371c56741814caa178f4ccbaf", "score": "0.49111384", "text": "clone(){\n let out = new matrix4();\n for(var column = 0; column < 4; column++){\n for(var row = 0; row < 4; row++){\n out.matArray[column][row] = this.matArray[column][row];\n }\n }\n return out;\n }", "title": "" }, { "docid": "e98a16d9b5a8eac86f05a91808ebba2f", "score": "0.49034986", "text": "clone() {\n\n let clone = new NeuralNet(this.inputs, this.hiddens, this.outputs);\n\n clone.hiddensInputs = this.hiddensInputs.clone();\n clone.hiddenshiddens = this.hiddenshiddens.clone();\n clone.hiddensOutputs = this.hiddensOutputs.clone();\n\n return clone;\n }", "title": "" }, { "docid": "8634731323da5a08916aa9a27a743c3c", "score": "0.48931712", "text": "function clone(input) {\n const output = dataset();\n for (const quad of input) {\n output.add(quad);\n }\n return output;\n}", "title": "" }, { "docid": "344bce43e1c284a02b7dd7c6644ea157", "score": "0.4884557", "text": "map(_function) {\n let copy = FudgeCore.Recycler.get(Vector3);\n copy.data = this.data.map(_function);\n return copy;\n }", "title": "" }, { "docid": "a323fd600fb31c596b6b36227b730823", "score": "0.48805726", "text": "cloneListing() {\n const clone = this.clone();\n clone.unset('slug');\n clone.unset('hash');\n clone.guid = this.guid;\n clone.lastSyncedAttrs = {};\n return clone;\n }", "title": "" }, { "docid": "cac9d83f70acff510811136b345735f7", "score": "0.48738304", "text": "function clone(input) {\n const output = dataset();\n\n for (const quad of input) {\n output.add(quad);\n }\n\n return output;\n}", "title": "" }, { "docid": "b610aea0cbfb9196028314a6d2223ba7", "score": "0.4857484", "text": "reverse(){\n const newList = new LinkedList();\n this.forEach(node => void newList.addFirst(node));\n this.head = newList.head;\n return this;\n }", "title": "" }, { "docid": "6ff19cdeff6656202562b56998b82ffe", "score": "0.48552907", "text": "function getMutableClone(node) {\n var clone = getSynthesizedClone(node);\n clone.pos = node.pos;\n clone.end = node.end;\n clone.parent = node.parent;\n return clone;\n }", "title": "" }, { "docid": "7bb9eb626a8d9bba01ae22a8da051ed7", "score": "0.48411936", "text": "function nonMutatingPush(original, newItem) {\n return original.concat(newItem);\n}", "title": "" }, { "docid": "7bb9eb626a8d9bba01ae22a8da051ed7", "score": "0.48411936", "text": "function nonMutatingPush(original, newItem) {\n return original.concat(newItem);\n}", "title": "" }, { "docid": "7bb9eb626a8d9bba01ae22a8da051ed7", "score": "0.48411936", "text": "function nonMutatingPush(original, newItem) {\n return original.concat(newItem);\n}", "title": "" }, { "docid": "7bb9eb626a8d9bba01ae22a8da051ed7", "score": "0.48411936", "text": "function nonMutatingPush(original, newItem) {\n return original.concat(newItem);\n}", "title": "" }, { "docid": "820f34580bcb1f48b956e0dbc565118e", "score": "0.48334336", "text": "getStateTensor() {\n return tf.tensor2d([[this.x, this.xDot, this.theta, this.thetaDot]]);\n }", "title": "" }, { "docid": "820f34580bcb1f48b956e0dbc565118e", "score": "0.48334336", "text": "getStateTensor() {\n return tf.tensor2d([[this.x, this.xDot, this.theta, this.thetaDot]]);\n }", "title": "" }, { "docid": "68192441b75a891baf377c3cce192daf", "score": "0.4809219", "text": "clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }", "title": "" }, { "docid": "e64e4598404df7983591d971625ed126", "score": "0.4796689", "text": "function copyList(arr){\n var copiedArr = [];\n \n for(var i = 0; i < arr.length; i++) {\n copiedArr[i] = arr[i];\n }\n \n return copiedArr;\n}", "title": "" }, { "docid": "990f417109e2204d95a9a736616658eb", "score": "0.47948104", "text": "copy() {\n return new CartesianVector(this.x, this.y);\n }", "title": "" }, { "docid": "f4d872494d33f48b167d6deb5cda9856", "score": "0.47761568", "text": "concat(elementDtype, elementShape) {\n if (!!elementDtype && elementDtype !== this.elementDtype) {\n throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${elementDtype}`);\n }\n\n (0, _tensor_utils.assertShapesMatchAllowUndefinedSize)(this.elementShape, elementShape, 'TensorList shape mismatch: ');\n const outputElementShape = (0, _tensor_utils.inferElementShape)(this.elementShape, this.tensors, elementShape);\n\n if (this.size() === 0) {\n return (0, _tfjsCore.tensor)([], [0].concat(outputElementShape));\n }\n\n return (0, _tfjsCore.tidy)(() => {\n const tensors = this.tensors.map(t => (0, _tfjsCore.reshape)(t, outputElementShape));\n return (0, _tfjsCore.concat)(tensors, 0);\n });\n }", "title": "" }, { "docid": "0fe596adcefd39ab6afff41a8d5f1976", "score": "0.47734785", "text": "clone() {\n return new Vector3(this.x, this.y, this.z);\n }", "title": "" }, { "docid": "2c528bf471aaa85581018c173cbc331c", "score": "0.47682568", "text": "copy() {\n let cp = new CoreCardSet(this._cards.map(c => c.copy()));\n cp._props = {...this._props};\n\n return cp;\n }", "title": "" }, { "docid": "a5cdf920746bcf18e75e5d60223b9c28", "score": "0.4763683", "text": "clone () {\n\n var newBoard = new GameBoard(this.size);\n\n var i,j;\n\n for (i=0; i<this.size; i++) {\n\n for (j=0; j<this.size; j++) {\n\n newBoard.set(this.get(i, j), i, j);\n }\n }\n\n return newBoard;\n }", "title": "" }, { "docid": "eab0dae94fb25209e48b9304234032e2", "score": "0.47612828", "text": "static newVCopy(it) { \r\n\t\tvar res = new mVec3(); \r\n\t\tres.copy(it.x, it.y, it.z); \r\n\t\treturn res; \r\n\t}", "title": "" }, { "docid": "2b12ab4a889f232a14f41e610ab4f01b", "score": "0.47597048", "text": "cloneNode() {\n const that = this;\n\n if (!that.$.listBox) {\n return;\n }\n\n let clone = HTMLElement.prototype.cloneNode.apply(that, Array.prototype.slice.call(arguments, 0, 1));\n\n //Set only those properties that have reflectToAttribute set to false.\n clone.dataSource = that.dataSource;\n return clone;\n }", "title": "" }, { "docid": "4d3a52dbf62ad5ead478daa8f9369047", "score": "0.47587028", "text": "clone() {\n new Matrix2D(this.a, this.b, this.c, this.d, this.tx, this.ty);\n }", "title": "" }, { "docid": "d96734641538875003ce7418e2db51c7", "score": "0.47482798", "text": "concat(dtype) {\n if (!!dtype && dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${dtype}`);\n }\n if (this.size() === 0) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tensor\"])([], [0].concat(this.elementShape));\n }\n const indices = [];\n for (let i = 0; i < this.size(); i++) {\n indices.push(i);\n }\n // Collect all the tensors from the tensors array.\n const tensors = this.readMany(indices);\n Object(_tensor_utils__WEBPACK_IMPORTED_MODULE_1__[\"assertShapesMatchAllowUndefinedSize\"])(this.elementShape, tensors[0].shape, `TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${tensors[0].shape})`);\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"concat\"])(tensors, 0);\n }", "title": "" } ]
0e07834032c72730e89f69623bd2095d
(For IE <=9) Removes the event listeners from the currentlytracked element, if any exists.
[ { "docid": "e1f85cce3f44d044926dfd9bc9e881c6", "score": "0.0", "text": "function stopWatchingForValueChange() {\n if (!activeElement) {\n return;\n }\n activeElement.detachEvent('onpropertychange', handlePropertyChange);\n activeElement = null;\n activeElementInst = null;\n}", "title": "" } ]
[ { "docid": "3f0891cbd4c7083609def3719a29887f", "score": "0.70854056", "text": "function removeListeners() {\n\t\t\t$element.unbind(START_EV, touchStart);\n\t\t\t$element.unbind(CANCEL_EV, touchCancel);\n\t\t\t$element.unbind(MOVE_EV, touchMove);\n\t\t\t$element.unbind(END_EV, touchEnd);\n\t\t\t\n\t\t\t//we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n\t\t\tif(LEAVE_EV) { \n\t\t\t\t$element.unbind(LEAVE_EV, touchLeave);\n\t\t\t}\n\t\t\t\n\t\t\tsetTouchInProgress(false);\n\t\t}", "title": "" }, { "docid": "168c9704f48732ae1543091e26d09b2e", "score": "0.7047412", "text": "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if(LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "title": "" }, { "docid": "168c9704f48732ae1543091e26d09b2e", "score": "0.7047412", "text": "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if(LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "title": "" }, { "docid": "94636fa05ce6b3ee04d5d38469dd102a", "score": "0.70443636", "text": "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if (LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "title": "" }, { "docid": "026d6d0ee2f03f2ea670117c6b3856bb", "score": "0.7013583", "text": "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if (LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "title": "" }, { "docid": "026d6d0ee2f03f2ea670117c6b3856bb", "score": "0.7013583", "text": "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if (LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "title": "" }, { "docid": "4b3d44f8d7c2e70c97c9589d866f2503", "score": "0.7012159", "text": "function removeListeners(_elem) {\n $(_elem)\n .off('mouseup mouseover mousedown mouseout touchstart', addEventListeners)\n .removeClass('addPointer');\n $(_elem).removeClass('addPointer');\n }", "title": "" }, { "docid": "3c6a5581cd799475718d626c95820dda", "score": "0.6944182", "text": "function purgeListeners() {\n var element, entry;\n for (var i in Event.cache) {\n entry = Event.cache[i];\n Event.stopObserving(entry.element);\n entry.element = null;\n }\n }", "title": "" }, { "docid": "5b3088680b9852ad88c3d41019dda50a", "score": "0.6896538", "text": "removeEventListeners() {\n const { listener } = this.context;\n if( listener ){\n listener.remove('mousemove', this.handleMouseMove);\n listener.remove('resize', this.handleResize);\n } else {\n window.removeEventListener('mousemove', this.handleMouseMove);\n window.removeEventListener('resize', this.handleResize);\n }\n this.listening = false;\n }", "title": "" }, { "docid": "42b182b04f8293ea4a72316fabfe3265", "score": "0.6887412", "text": "removeAllEventListeners() {\n this._attachedDocumentEvents.forEach(evt => {\n document.removeEventListener(evt.event, evt.fn);\n });\n\n this._attachedCanvasEvents.forEach(evt => {\n this._canvas.removeEventListener(evt.event, evt.fn);\n });\n }", "title": "" }, { "docid": "fcd0f0ea660b8f71b5676df395bb973f", "score": "0.6871126", "text": "function clearListeners() {\n if(moveHandlerId !== null) {\n unregisterPointerMoveHandler(moveHandlerId);\n }\n _body.removeEventListener('mouseup', mouseupHandler);\n _body.removeEventListener('touchend', mouseupHandler);\n _body.removeEventListener('dragstart', _cancelEvent);\n _body.removeEventListener('selectstart', _cancelEvent);\n moveHandlerId = null;\n }", "title": "" }, { "docid": "66cd983b5044e837d21252a2434f6daf", "score": "0.68665624", "text": "removeListeners()\r\n {\r\n this.ticker.remove(this.tickerFunction)\r\n this.div.removeEventListener('wheel', this.wheelFunction)\r\n }", "title": "" }, { "docid": "e1e26fa2ac0f087995f767a01461b4f3", "score": "0.6852797", "text": "_clearAllEventListeners() {\n for (let i = this._listeners.length; i > 0; i--) {\n let { target, event, fn } = this._listeners.pop();\n\n target.removeListener(event, fn);\n }\n }", "title": "" }, { "docid": "a8c1303f0e53e5ee62ebd52202bc9956", "score": "0.68317187", "text": "detach() {\n if (!this.attached) {\n return;\n }\n this.attached = false;\n // this.observer.disconnect();\n for (let eventKey in this.eventListeners) {\n var eventInfo = this.parseEventKey(eventKey);\n var eventName = eventInfo.eventName;\n var capture = eventInfo.capture;\n this.window.document.removeEventListener(eventName, this.eventListeners[eventKey], capture);\n }\n delete this.eventListeners;\n }", "title": "" }, { "docid": "e1712eb11a2940f62c62ddad8f4bf908", "score": "0.68206227", "text": "removeEventListeners_() {\n this.elem.off(\"click\", this.onInteraction);\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "0d1c155eaa5094eefc437316c7c0478e", "score": "0.67966807", "text": "_removeTriggerEvents() {\n if (this._triggerElement) {\n pointerDownEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n if (this._pointerUpEventsRegistered) {\n pointerUpEvents.forEach((type) => {\n this._triggerElement.removeEventListener(type, this, passiveEventOptions);\n });\n }\n }\n }", "title": "" }, { "docid": "9517b9d12b4464eef7cf289bc568f9f4", "score": "0.67439115", "text": "function removeEventListeners() {\n\n\t\teventsAreBound = false;\n\n\t\tdocument.removeEventListener( 'keydown', onDocumentKeyDown, false );\n\t\twindow.removeEventListener( 'hashchange', onWindowHashChange, false );\n\t\twindow.removeEventListener( 'resize', onWindowResize, false );\n\n\t\tdom.wrapper.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tdom.wrapper.removeEventListener( 'touchmove', onTouchMove, false );\n\t\tdom.wrapper.removeEventListener( 'touchend', onTouchEnd, false );\n\n\t\tif( window.navigator.msPointerEnabled ) {\n\t\t\tdom.wrapper.removeEventListener( 'MSPointerDown', onPointerDown, false );\n\t\t\tdom.wrapper.removeEventListener( 'MSPointerMove', onPointerMove, false );\n\t\t\tdom.wrapper.removeEventListener( 'MSPointerUp', onPointerUp, false );\n\t\t}\n\n\t\tif ( config.progress && dom.progress ) {\n\t\t\tdom.progress.removeEventListener( 'click', onProgressClicked, false );\n\t\t}\n\n\t\tif ( config.controls && dom.controls ) {\n\t\t\t[ 'touchstart', 'click' ].forEach( function( eventName ) {\n\t\t\t\tdom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } );\n\t\t\t\tdom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } );\n\t\t\t\tdom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } );\n\t\t\t\tdom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } );\n\t\t\t\tdom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } );\n\t\t\t\tdom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } );\n\t\t\t} );\n\t\t}\n\n\t}", "title": "" }, { "docid": "530a8cea7d0b5a63a714146d81395242", "score": "0.6729568", "text": "removeListeners() {\n this.controller.removeEventListener(\"mouseup\", this.handleMouseUp);\n this.controller.removeEventListener(\"mousemove\", this.handleMouseMove);\n }", "title": "" }, { "docid": "b0974cb5332325de9243f21d3ec23cdd", "score": "0.6726841", "text": "function removeEvents() {\n document.body.removeEventListener('click', sendInteractionEvent);\n window.removeEventListener('scroll', sendInteractionEvent);\n }", "title": "" }, { "docid": "9d07cbbb06ef14ac736927f2a9d3d808", "score": "0.6720383", "text": "removeAllEventListeners() {\n allOff(this._emitter);\n }", "title": "" }, { "docid": "4853f93796f42dd0c45ecd6c95cc1acc", "score": "0.6714896", "text": "removeAll() {\n this.listeners_.forEach(\n listener => EventTracker.removeEventListener(listener));\n this.listeners_ = [];\n }", "title": "" }, { "docid": "53636902b66c93e5da3c5d481c0f95e9", "score": "0.6702597", "text": "removeAllEventListeners() {\r\n for (var i in elemArray) {\r\n if (!elemArray.hasOwnProperty(i)) continue;\r\n var elem = elemArray[i];\r\n\r\n removeAllEventListeners(elem);\r\n\r\n };\r\n }", "title": "" }, { "docid": "d988704e7a9861076c9d433180d778fd", "score": "0.66881984", "text": "function removeListeners() {\n\t\t$(document).off(EVENT_NAME_KEYPRESS);\n\t\t$(document).off(EVENT_NAME_KEYUP);\n\t\t$(document).off(EVENT_NAME_LOAD);\n\t\t$(document).off(EVENT_NAME_BLUR);\n\t}", "title": "" }, { "docid": "77eed61fca4300cdb9803e1831477644", "score": "0.668042", "text": "removeAllListeners() {\n while ( this.listeners.length > 0 ) {\n this.removeListener( this.listeners[ 0 ] );\n }\n }", "title": "" }, { "docid": "51ca953cb3d34457a6b32c73e1ca3e1c", "score": "0.6628096", "text": "function clearListeners() {\n\tif (isBandW)\n\t{\n\t\tfor (let i = gridNodes.length - 1; i >= 0; i--)\n\t\t{\n\t\t\tgridNodes[i].removeEventListener(\"mouseover\", handlers[i]);\n\t\t\thandlers.pop();\n\t\t}\n\t}\n\telse\n\t{\t\n\t\tfor (let i = gridNodes.length - 1; i >= 0; i--)\n\t\t{\n\t\t\tgridNodes[i].removeEventListener(\"mouseover\", handlers[i]);\n\t\t\thandlers.pop();\t\n\t\t}\n\t}\n}", "title": "" }, { "docid": "663b6d14e9cb07c8805e55bb2c4281ea", "score": "0.66242385", "text": "function removePreviousListeners() {\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < listeners.length; ++i) {\n\t\t\t\tvar reg = listeners[i];\n\t\t\t\tvar el = reg[0];\n\t\t\t\tvar type = reg[1];\n\t\t\t\tvar func = reg[2];\n\t\t\t\tel.removeEventListener(func, type);\n\t\t\t}\n\n\t\t\tlisteners = [];\n\t\t}", "title": "" }, { "docid": "4f971ab8e32c56f0f925b2541c3d3db3", "score": "0.6605957", "text": "removeAllListeners() {\n const listeners = this.eventListeners;\n let i, thisObj;\n\n for (const event in listeners) {\n const bucket = listeners[event];\n\n // We iterate backwards since we call removeListener which will splice out of\n // this array as we go...\n for (i = bucket.length; i-- > 0; /* empty */) {\n const cfg = bucket[i];\n\n this.removeListener(event, cfg);\n\n thisObj = cfg.thisObj;\n\n if (thisObj && thisObj.untrackDetachers) {\n thisObj.untrackDetachers(this);\n }\n }\n }\n }", "title": "" }, { "docid": "98a52d876478cd6e92d8b06d8744456d", "score": "0.65946263", "text": "detach() {\n for (let eventKey in AllowedEvents) {\n var eventInfo = this.parseEventKey(eventKey);\n var eventName = eventInfo.eventName;\n\n window.removeEventListener(eventName, this.eventListeners[eventName], true);\n }\n\n this.eventListeners = [];\n }", "title": "" }, { "docid": "392a1274f8abd78472fc0ae5cd06b905", "score": "0.6574136", "text": "function clearListener(elementId) {\n\t\tvar element = document.getElementById(elementId);\n\t\tif (element) {\n\t\t\telement.replaceWith(element.cloneNode(true));\n\t\t}\n\t}", "title": "" }, { "docid": "d54ddc5e949ecfa2a22851294a83ca82", "score": "0.6563275", "text": "remove () {\n\t\tthis.__removeEventListeners()\n\t\tthis.__raycaster = null\n\t}", "title": "" }, { "docid": "4808633557d36f1ff3e509ad38e55ef5", "score": "0.65420496", "text": "removeAllListeners() {}", "title": "" }, { "docid": "4808633557d36f1ff3e509ad38e55ef5", "score": "0.65420496", "text": "removeAllListeners() {}", "title": "" }, { "docid": "7cc1756cb364e0dc519e9b263714aea3", "score": "0.65318674", "text": "function removeEventListeners() {\n\n document.removeEventListener('keydown', keyDown)\n document.removeEventListener('keyup', keyUp)\n\n }", "title": "" }, { "docid": "8d99f809a338b9caf93d0b8e9cc48620", "score": "0.65259045", "text": "_removeGlobalEvents() {\n const document = this._document;\n document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);\n document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);\n document.removeEventListener('touchend', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);\n const window = this._getWindow();\n if (typeof window !== 'undefined' && window) {\n window.removeEventListener('blur', this._windowBlur);\n }\n }", "title": "" }, { "docid": "8d99f809a338b9caf93d0b8e9cc48620", "score": "0.65259045", "text": "_removeGlobalEvents() {\n const document = this._document;\n document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);\n document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);\n document.removeEventListener('touchend', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);\n const window = this._getWindow();\n if (typeof window !== 'undefined' && window) {\n window.removeEventListener('blur', this._windowBlur);\n }\n }", "title": "" }, { "docid": "5a340ae2d94047b8ec2a82d622915e3a", "score": "0.65137964", "text": "function removeMoveEventListener(){\r\n document.removeEventListener(\"keydown\", _keyboardEvent);\r\n arrowUpElement.removeEventListener(\"click\", _upEvent);\r\n arrowLeftElement.removeEventListener(\"click\", _leftEvent);\r\n arrowDownElement.removeEventListener(\"click\", _downEvent);\r\n arrowRightElement.removeEventListener(\"click\", _rightEvent);\r\n}", "title": "" }, { "docid": "51b02deb6ed9b6ab4a353a53135cc2a7", "score": "0.6513105", "text": "function removeListener () {\n // Removes event listener\n ELEMENTS.displayButton.removeEventListener(lastId)\n\n // Renews text\n ELEMENTS.messageText.textContent = 'No active event listeners!'\n ELEMENTS.displayButton.textContent = \"I'm useless now...\"\n ELEMENTS.controlButton.textContent = 'Add event listener'\n\n // Reassigns state bool\n isListenerAdded = false\n}", "title": "" }, { "docid": "f05b5d91e80b2b05b868e702f57b7ae3", "score": "0.6510222", "text": "removeEventListeners() {\n const pointer = ns.game.userPointer;\n if (this.onMoveCallback) {\n pointer.remove('move', this.onMoveCallback);\n this.onMoveCallback = undefined;\n }\n }", "title": "" }, { "docid": "a0a89a7181f72f1c883ea28b1d372bca", "score": "0.6496272", "text": "removeEvents() {}", "title": "" }, { "docid": "4a179ab9150bc9dea990d21366c9f07e", "score": "0.64470106", "text": "detach() {\n\t\tthis._targetEl.removeEventListener(this._type, this._callback);\n\t\tthis._attached = false;\n\t}", "title": "" }, { "docid": "8090bd0c759686f6aba20df06a8f4cd2", "score": "0.6439247", "text": "function clearEventListeners(elemId) {\n var elem = document.getElementById(elemId);\n if (elem == null) {console.log(\"ERR: Could not find element for: \" + elemId); return null;}\n var newElem = elem.cloneNode(true);\n elem.parentNode.replaceChild(newElem, elem);\n return newElem;\n}", "title": "" }, { "docid": "03a6a69f85ab8f288be0f3cf722398c1", "score": "0.6426114", "text": "function removeListeners() {\n if ( right !== \"none\") {\n document.getElementById(right + \"Link\").removeEventListener(\"click\", slamLeft);\n }\n if ( left !== \"none\") {\n document.getElementById(left + \"Link\").removeEventListener(\"click\", runRight);\n }\n if ( down !== \"none\") {\n document.getElementById(down + \"Link\").removeEventListener(\"click\", blastUp);\n }\n if ( up !== \"none\") {\n document.getElementById(up + \"Link\").removeEventListener(\"click\", knockDown);\n }\n let jumpToPort = document.getElementById(\"jumpToPort\");\n if (jumpToPort !== null) {\n jumpToPort.removeEventListener(\"click\", portAnimation());\n }\n let jumpToPort2 = document.getElementById(\"jumpToPort2\");\n if (jumpToPort2 !== null) {\n jumpToPort2.removeEventListener(\"click\", portAnimation());\n }\n let jumpToContacts = document.getElementById(\"jumpToContacts\");\n if (jumpToContacts !== null) {\n jumpToContacts.removeEventListener(\"click\", contactAnimation());\n }\n}", "title": "" }, { "docid": "88f52ce0165c1f0584fb627d15aae833", "score": "0.6391061", "text": "function cleanupInteractiveMouseListeners() {\n document.body.removeEventListener('mouseleave', scheduleHide);\n document.removeEventListener('mousemove', debouncedOnMouseMove);\n mouseMoveListeners = mouseMoveListeners.filter(function (listener) {\n return listener !== debouncedOnMouseMove;\n });\n }", "title": "" }, { "docid": "16b87720f1cc113b2af5a7fac0903937", "score": "0.638759", "text": "removeAllAddedListeners() {\n this.progressListeners_ = [];\n this.advanceListeners_ = [];\n this.previousListeners_ = [];\n this.tapNavigationListeners_ = [];\n }", "title": "" }, { "docid": "41f9c7c44ebb3e6dfa199827d4482064", "score": "0.6385567", "text": "function removeAllListeners(container,opt) {\n\t\t\tcontainer.children().each(function() {\n\t\t\t try{ $(this).die('click'); } catch(e) {}\n\t\t\t try{ $(this).die('mouseenter');} catch(e) {}\n\t\t\t try{ $(this).die('mouseleave');} catch(e) {}\n\t\t\t try{ $(this).unbind('hover');} catch(e) {}\n\t\t\t})\n\t\t\ttry{ $container.die('click','mouseenter','mouseleave');} catch(e) {}\n\t\t\tclearInterval(opt.cdint);\n\t\t\tcontainer=null;\n\n\n\n\t\t}", "title": "" }, { "docid": "9b420969aeb191dae6567a64b8870559", "score": "0.6370472", "text": "function cleanupInteractiveMouseListeners() {\n document.body.removeEventListener('mouseleave', scheduleHide);\n document.removeEventListener('mousemove', debouncedOnMouseMove);\n mouseMoveListeners = mouseMoveListeners.filter(function (listener) {\n return listener !== debouncedOnMouseMove;\n });\n }", "title": "" }, { "docid": "b815412af5456e90a71e2e43c8b1fc69", "score": "0.6364078", "text": "removeListeners(event) {\n event.target.removeEventListener(\"mousemove\", this.dragElement);\n event.target.removeEventListener(\"touchmove\", this.dragElement);\n event.target.removeEventListener(\"mouseup\", this.stopDragging);\n event.target.removeEventListener(\"touchend\", this.stopDragging);\n event.target.removeEventListener(\"mouseout\", this.stopDragging);\n }", "title": "" }, { "docid": "c82447de2d5c81c027384c2b2863be69", "score": "0.63572335", "text": "function removeCanvasListeners(_elem) {\n $(_elem).off('mousemove mousedown mouseout touchstart', canvasEvents);\n $(_elem).removeClass('addPointer');\n }", "title": "" }, { "docid": "1d0751696737351d54dfd48dc89c138c", "score": "0.6348516", "text": "remove() {\n this.unobserveAllElements();\n }", "title": "" }, { "docid": "78cd70a798ede1326e4532d7685c5d1a", "score": "0.6343528", "text": "function removeGameListeners() {\n\tdocument.getElementById(\"gameGrid\").removeEventListener(\"click\", flipCard);\n\n\tclearInterval(checkGameFocusIntervalID);\n}", "title": "" }, { "docid": "f32dca099542d4d065c5ac0fcb017095", "score": "0.63388747", "text": "remove() {\n this._events = this._events.filter(event => {\n return (event.el || this.dom.el).removeEventListener(event.name, event.fn, true);\n });\n this.dom.el.parentNode.removeChild(this.dom.el);\n this.dom = this.options = null;\n }", "title": "" }, { "docid": "3be8da9c37dab87de378947fa2ba4b4c", "score": "0.633214", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t window.cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "51fd429b2466c738f535725e84157d7c", "score": "0.63320124", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "e85314b641bfe35d727b6b38f7f92c70", "score": "0.6331016", "text": "function cleanupOldMouseListeners() {\n document.body.removeEventListener('mouseleave', prepareHide);\n document.removeEventListener('mousemove', debouncedOnMouseMove);\n }", "title": "" }, { "docid": "6bd0432d82e0be4fe8b5cb0e5196de96", "score": "0.6329644", "text": "removeEventListeners () {\n\t\tconst {childRefCurrent, containerRef} = this;\n\n\t\tif (containerRef.current && containerRef.current.removeEventListener) {\n\t\t\tcontainerRef.current.removeEventListener('wheel', this.onWheel);\n\t\t\tcontainerRef.current.removeEventListener('keydown', this.onKeyDown);\n\t\t\tcontainerRef.current.removeEventListener('mousedown', this.onMouseDown);\n\t\t}\n\n\t\tif (childRefCurrent.containerRef.current && childRefCurrent.containerRef.current.removeEventListener) {\n\t\t\tchildRefCurrent.containerRef.current.removeEventListener('scroll', this.onScroll, {capture: true, passive: true});\n\t\t}\n\n\t\tif (this.props.removeEventListeners) {\n\t\t\tthis.props.removeEventListeners(childRefCurrent.containerRef);\n\t\t}\n\n\t\tif (window) {\n\t\t\twindow.removeEventListener('resize', this.handleResizeWindow);\n\t\t}\n\t}", "title": "" }, { "docid": "16b6bf0a51f7b79e6f729fe2eab12505", "score": "0.6322444", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "d2e783d6b357222d38e9e12722ca79e3", "score": "0.63190234", "text": "function removesEventListener() {\n cells.forEach((cell) => {\n cell.removeEventListener(\"click\", clicked);\n cell.removeEventListener(\"click\", clickedBefore);\n });\n}", "title": "" }, { "docid": "d2e783d6b357222d38e9e12722ca79e3", "score": "0.63190234", "text": "function removesEventListener() {\n cells.forEach((cell) => {\n cell.removeEventListener(\"click\", clicked);\n cell.removeEventListener(\"click\", clickedBefore);\n });\n}", "title": "" }, { "docid": "aadc986391995be869edc479077d37dc", "score": "0.6315549", "text": "unbind(el) {\n let div = el.getElementsByTagName('DIV')[0];\n div.removeEventListener('mouseover', mouseOverHandler);\n div.removeEventListener('mouseout', mouseOutHandler);\n div.removeEventListener('touchstart', mouseOverHandler);\n div.removeEventListener('touchend', mouseOutHandler);\n }", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "fed8a50d5856f0bca8ab76da434283a4", "score": "0.6314994", "text": "function disableEventListeners() {\n\t if (this.state.eventsEnabled) {\n\t cancelAnimationFrame(this.scheduleUpdate);\n\t this.state = removeEventListeners(this.reference, this.state);\n\t }\n\t}", "title": "" }, { "docid": "b49f3d8700388278c72eb2bff137dabb", "score": "0.6303766", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "82536e67f61ce72ee027d61b6d18b8c0", "score": "0.6301197", "text": "function disableEventListeners() {\r\n if (this.state.eventsEnabled) {\r\n cancelAnimationFrame(this.scheduleUpdate);\r\n this.state = removeEventListeners(this.reference, this.state);\r\n }\r\n }", "title": "" }, { "docid": "72984b64d894806f012caf526c20ec1d", "score": "0.6296473", "text": "function removeEventListeners (ref) { // `ref` is always `scrollContentRef`.\n\t\tutilEvent('focusin').removeEventListener(ref, handleFocus);\n\t}", "title": "" }, { "docid": "25f1fb5eb15146c99cf2388ac5f38d78", "score": "0.62874526", "text": "unbind() {\n if (!this._listener) {\n return;\n }\n this.el.removeEventListener('click', this._listener);\n delete this._listener;\n }", "title": "" }, { "docid": "25f1fb5eb15146c99cf2388ac5f38d78", "score": "0.62874526", "text": "unbind() {\n if (!this._listener) {\n return;\n }\n this.el.removeEventListener('click', this._listener);\n delete this._listener;\n }", "title": "" }, { "docid": "dd6df66a14c8ab57f56b47662589fdad", "score": "0.6284259", "text": "removeDragListeners() {\n document.removeEventListener('mousemove', this.onMouseMove, { passive: false });\n document.removeEventListener('mouseup', this.stopDragging, false);\n document.removeEventListener('touchmove', this.onTouchMove, { passive: false });\n document.removeEventListener('touchend', this.stopDragging, false);\n }", "title": "" }, { "docid": "cd0887a32106666977c9b2668e2d0ed7", "score": "0.6283336", "text": "static removeInputEventListeners() {\n const inputs = document.querySelectorAll('input, textarea, select');\n\n Array.from(inputs).forEach((input) => {\n input.removeEventListener('change', Forms.handleInputChange);\n });\n }", "title": "" }, { "docid": "8f50bb840dae9c0963da3f9ef221d650", "score": "0.62812424", "text": "unbindEvents()\n {\n // @ifdef DEBUG\n debug.ASSERT(this._eventsBound, 'unbindEvents called when events were not bound.');\n\n this._eventsBound = false;\n // @endif\n\n const dom = this.renderer.gl.canvas;\n\n if (window.PointerEvent)\n {\n dom.removeEventListener('pointerdown', this._boundHandleEvent);\n dom.removeEventListener('pointermove', this._boundHandleEvent);\n dom.removeEventListener('pointerout', this._boundHandleEvent);\n window.removeEventListener('pointerup', this._boundHandleEvent);\n }\n else\n {\n dom.removeEventListener('mousedown', this._boundHandleEvent);\n dom.removeEventListener('mousemove', this._boundHandleEvent);\n dom.removeEventListener('mouseout', this._boundHandleEvent);\n window.removeEventListener('mouseup', this._boundHandleEvent);\n\n dom.removeEventListener('touchstart', this._boundHandleEvent);\n dom.removeEventListener('touchmove', this._boundHandleEvent);\n dom.removeEventListener('touchcancel', this._boundHandleEvent);\n window.removeEventListener('touchend', this._boundHandleEvent);\n }\n\n dom.removeEventListener('wheel', this._boundHandleEvent);\n }", "title": "" }, { "docid": "8d0796153834f03bdadd64672cc818ab", "score": "0.62704355", "text": "onRemoveOutsideListener_() {\n var doc = getDocument();\n unlisten(doc, GoogEventType.MOUSEDOWN, this.onClick_, true, this);\n unlisten(doc, GoogEventType.POINTERDOWN, this.onClick_, true, this);\n }", "title": "" }, { "docid": "3304fb889e0b098d5e9e53a5a49c65bf", "score": "0.62591964", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "fd7331c4cbf17e335f920bbe78a3be9c", "score": "0.62548226", "text": "function _removeEventListeners(target) {\n\t for (var i in this._eventOutput.listeners) {\n\t target.removeEventListener(i, this.eventForwarder);\n\t }\n\t }", "title": "" }, { "docid": "244661b0f2d10ee31a882351d013e3fb", "score": "0.6252197", "text": "function removeListener(object, eventType, listener, capture )\n\t{\n\t\tif(IE)\n\t\t{\n\t\t\tobject.detachEvent( \"on\"+eventType , listener );\n\t\t}\n\t\telse // Mozilla, Netscape, Firefox\n\t\t{\n\t\t\tobject.removeEventListener(eventType, listener, capture);\n\t\t}\n\t}", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "da7cb9a8abe318acc021093642fc5ac5", "score": "0.62444174", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n }", "title": "" }, { "docid": "47628a73009b1950d6d57a45a5ee6531", "score": "0.62254906", "text": "detachEventHandlers() {\n this.$element.off('spatialChanged', this.spatialChangedHandler);\n this.$boundingElement.off('resize', this.spatialChangedHandler);\n }", "title": "" }, { "docid": "10ba734023e5f933aa87d4daa17579a2", "score": "0.62202924", "text": "detached() {\n this.isAttached = false;\n this.element.removeEventListener('focus', this.focusListener);\n this.element.removeEventListener('blur', this.blurListener);\n }", "title": "" }, { "docid": "28f4b71f512f7e34b972b4ccba114f66", "score": "0.62190294", "text": "function clearEventListeners() {\n document.onclick = () => {};\n document.onkeydown = () => {};\n document.onkeypress = () => {};\n document.onkeyup = () => {};\n document.onmouseover = () => {};\n}", "title": "" }, { "docid": "b23170d4bb0128ad3e0d8e7e532eba00", "score": "0.6218446", "text": "function unbindMoveEvents() {\n var iter,\n total,\n event;\n\n for (iter = 0, total = this.boundEvents.length; iter < total; iter++) {\n event = this.boundEvents[iter];\n\n event.element.removeEventListener(event.name, event.handler);\n }\n delete this.boundEvents;\n }", "title": "" }, { "docid": "dcb0b5d4f04e67b0ee3e8f40727405be", "score": "0.6216345", "text": "unregisterEventListener() {\n\t\tthis.eventService.unregisterEventListener(this);\n\t}", "title": "" }, { "docid": "83eaff1f6ac02fa4b5a2fe528906b1fb", "score": "0.6216163", "text": "unbindEvents() {}", "title": "" }, { "docid": "ec98e65308b8f425e565e17930e51bca", "score": "0.6215568", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}", "title": "" }, { "docid": "ec98e65308b8f425e565e17930e51bca", "score": "0.6215568", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}", "title": "" }, { "docid": "ec98e65308b8f425e565e17930e51bca", "score": "0.6215568", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}", "title": "" }, { "docid": "ec98e65308b8f425e565e17930e51bca", "score": "0.6215568", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}", "title": "" }, { "docid": "ec98e65308b8f425e565e17930e51bca", "score": "0.6215568", "text": "function disableEventListeners() {\n if (this.state.eventsEnabled) {\n window.cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}", "title": "" }, { "docid": "a6a9dbd7220d27d6a0c65c1e91e9941c", "score": "0.621264", "text": "removeAllListeners(eventName) {\n this.getEventsByName(eventName).clear();\n }", "title": "" }, { "docid": "8e1b977b0058e126b4eb1a5d2e03c1c8", "score": "0.6205358", "text": "function disableEventListeners() {\r\n if (this.state.eventsEnabled) {\r\n cancelAnimationFrame(this.scheduleUpdate);\r\n this.state = removeEventListeners(this.reference, this.state);\r\n }\r\n}", "title": "" } ]
cc55f997bcf2be75988ee6a4f34e0c9f
========================================================= FIX CALCULATION BUTTON ===================================================
[ { "docid": "9cab721e0ff4f952b8aa154457a2eedb", "score": "0.0", "text": "function fix_bal_paid_calculation()\r\n{\r\n var loan_id = $('[name=\"loan_id\"]').val();\r\n\r\n $.ajax({\r\n url : \"../../../Profiles/Profiles_controller/ajax_update_bal_paid/\" + loan_id,\r\n type: \"POST\",\r\n dataType: \"JSON\",\r\n success: function(data)\r\n {\r\n location.reload();\r\n },\r\n error: function (jqXHR, textStatus, errorThrown)\r\n {\r\n alert('Error get data from ajax');\r\n }\r\n });\r\n}", "title": "" } ]
[ { "docid": "9f5958709802de4e6845e55a12921ae2", "score": "0.62369305", "text": "function btnRecal_Click(){\n\tvar answer = confirm (\"Do you want to recalculate the current Unit Closing Data?\\nIf Yes, existing data will be overwritten.\");\n\tif (answer) {\n\t dojo.io.bind({\n\t formNode: document.user_closing_form,\n\t content: {act:'recalculate', UnitNumber:_REQUEST[\"UnitNumber\"]},\n\t mimetype: \"text/plain\",\n\t load: btnRecal_Callback,\n\t error: function(type, error){tool.dialog.errorDialog(error.message);}\n\t });\n\t}\n}", "title": "" }, { "docid": "77bed22b74611a0d086bb7ea9fb4a3d5", "score": "0.5898197", "text": "function calculate1Click() {\n calculateClick(true);\n }", "title": "" }, { "docid": "d3143362df6248960a258568e7962e96", "score": "0.5851954", "text": "function ie7CalculatorButtonFix(value) {\n //Upgraded to jQuery 2.x so don't need this anymore - someone delete kthx\n return value;\n }", "title": "" }, { "docid": "d6ad819aaf24d7d52cfb2c9932411c21", "score": "0.584508", "text": "function calc() {\n // Invoked by the button. Resets the system, gets the values, calculates change, and ultimately converts it into a string\n reset();\n getValues(all);\n checkCashRegister(pri, cas, cid);\n openclosed();\n}", "title": "" }, { "docid": "23ec550c4a7f8280058d1952428a6136", "score": "0.5786907", "text": "function buttonClicked(event) {\n const buttonValue = event.target.value;\n\n // if the user want to clear the value\n if (buttonValue === \"C\") {\n display.value = null;\n\n // if the user want to get the result of the sum\n } else if (buttonValue === \"=\") {\n display.value = results(display.value);\n lastresult = results(display.value);\n\n // when the user still putting his equation\n } else {\n if (display.value == 0) {\n display.value = null;\n }\n\n if (display.value == lastresult && numbers.includes(buttonValue)) {\n display.value = null;\n }\n // checking if there is 2 sums on row\n display.value += buttonValue;\n\n // splitting the display\n let displayArr = display.value.split(\" \").filter((item) => item != \"\");\n\n if (displayArr.length == 4) {\n display.value = results(display.value) + buttonValue;\n }\n if (operatorsArr.includes(displayArr[0])) {\n displayArr[1] = displayArr[0];\n displayArr[0] = 0;\n display.value = displayArr[0] + \" \" + displayArr[1] + \" \";\n }\n if (checkingIfTwoOperatorsInRow(displayArr)) {\n displayArr[1] = null;\n displayArr[1] = displayArr[2];\n display.value = displayArr[0] + \" \" + displayArr[1] + \" \";\n }\n }\n}", "title": "" }, { "docid": "c5ca18f091e4c5499a91c473dcac5382", "score": "0.5750244", "text": "function fv() {\n close();\n hide();\n $('.calculator-icon').addClass('active');\n $('#calculator').css('display', 'flex');\n }", "title": "" }, { "docid": "e0f19f556a201c74a28f1b3426cf768c", "score": "0.57402974", "text": "function buttonSolver() { //JUST FOR BUTTON\n\t\t\n\tif (!isBlank) {\n\t\tfullSolve(\"blue\"); //the solve button solves in blue\n\t}\n\t\n}", "title": "" }, { "docid": "3a3193960e3ca775dae84d4f0f189ce6", "score": "0.57247835", "text": "function shippingCalcUpdates(flag){\r\n \t\t$('#form_Shipping').change(function(e)\r\n\t\t{\r\n\t\t\tvar element = e.originalEvent.srcElement;\r\n\r\n\t\t\tif($(element).attr('name') == 'shipping_method')\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tcalculate_shipping();\r\n\t\t});\r\n \t\tif(flag)$('.next_button').fadeIn().position({ my: \"right bottom\", at: \"right top\", of: \"#form_categories\"});\r\n \t\t//add the handlers\r\n \t\treviewButtonHandler();\r\n \t\tcloseReviewWindowHandler();\r\n \t\tapplyManagerDiscountHandler();\r\n \t\tcountrySelectorHandler();\t\r\n \t\tprepayToPctHandler();\r\n \t\tcontractTermHandler();\r\n \t\trentCheckboxHandler();\r\n \t}", "title": "" }, { "docid": "40102e080212842d4665739a454e4b2e", "score": "0.56792915", "text": "function setCalcButtonState() {\n var totalBetAmount = 0.00;\n jQuery('input.bet-value').each(function () {\n totalBetAmount += parseFloat(jQuery(this).val() ? jQuery(this).val() : 0);\n });\n jQuery('div.calculator-buttons a, a.calculator-buttons').toggleClass('disabled', (totalBetAmount <= 0));\n setFlexi(calculatorModel.getNumberOfCombinations(), totalBetAmount);\n if (changeNotificationCallback) {\n changeNotificationCallback();\n };\n }", "title": "" }, { "docid": "bdee50851bec9051f0bcdd4d1536beb6", "score": "0.56422937", "text": "function buyInquireBtnClicked()\n{\n\t$(\"#invoice_popup_new_inquire\").show();\n\t\n\t$(\"#supplier_ctrls\").hide();\n\t\n\t$(\"#buyer_ctrls\").hide();\n\t\n\t$(\"#inquire_ctrls\").show();\n\t\n\taction = \"Update\";\n}", "title": "" }, { "docid": "c5916fb5d41e6c473680ce26c4e3d243", "score": "0.56346977", "text": "function clickCashGivenValid() {\n clearHandler()\n\n if(Number(CashAmount.value) >= Number(billAmount.value))\n {\n //calling calculate function\n calculateChange();\n }\n else\n {\n message.style.display = 'block'\n message.innerText = 'Do you want to wash plates'\n }\n\n }", "title": "" }, { "docid": "49983435cea238b7c91d83660826fa43", "score": "0.5601131", "text": "function mkdfInitQuantityButtons() {\n \n $(document).on( 'click', '.mkdf-quantity-minus, .mkdf-quantity-plus', function(e) {\n e.stopPropagation();\n \n var button = $(this),\n inputField = button.siblings('.mkdf-quantity-input'),\n step = parseFloat(inputField.attr('step')),\n max = parseFloat(inputField.attr('max')),\n minus = false,\n inputValue = parseFloat(inputField.val()),\n newInputValue;\n \n if (button.hasClass('mkdf-quantity-minus')) {\n minus = true;\n }\n \n if (minus) {\n newInputValue = inputValue - step;\n if (newInputValue >= 1) {\n inputField.val(newInputValue);\n } else {\n inputField.val(0);\n }\n } else {\n newInputValue = inputValue + step;\n if ( max === undefined ) {\n inputField.val(newInputValue);\n } else {\n if ( newInputValue >= max ) {\n inputField.val(max);\n } else {\n inputField.val(newInputValue);\n }\n }\n }\n \n inputField.trigger( 'change' );\n });\n }", "title": "" }, { "docid": "ee2c78fd14072a0db4c334bbdea61c77", "score": "0.5596402", "text": "appraised_amount(frm, cdt, cdn) {\n // console.log(\"test\");\n\t\tfrm.trigger('set_totals');\n }", "title": "" }, { "docid": "f4b813a286d1e58a8260b8882e4c9ca7", "score": "0.55742335", "text": "function onOprPress() {\n var view = document.getElementById(\"view\");\n calc.curOpr = this.id;\n calc.operationClicked = true;\n if (calc.prevNum === null) {\n calc.calculating = false;\n }\n else {\n calc.calculating = true;\n }\n calc.resetCur = true;\n if (calc.calculating) {\n var ans = calculate();\n view.innerText = ans;\n calc.calculating = false;\n calc.curNum = ans;\n calc.prevNum = calc.curNum;\n }\n calc.prevOpr = calc.curOpr;\n }", "title": "" }, { "docid": "6e0280eab0e813ce654cae277f3eb18f", "score": "0.55570096", "text": "function update_referral_points(value) {\n\t\t\t\tconst subheader = jQuery3(\"#my_points_subheader\");\n\t\t\t\t// prepare modal data\n\t\t\t\tjQuery3(\"#points_available\").html(value);\n\t\t\t\tjQuery3(\"#points_to_spend\").val(\"0\");\n\t\t\t\tjQuery3(\"#points_to_spend\").prop(\"max\", value);\n\t\t\t\tjQuery3(\"#referral_geodes\").html(\"No\");\n\t\t\t\tjQuery3(\"#referral_geodes_plural\").html(\"s\");\n\t\t\t\tjQuery3(\"#referral_gems\").html(\"No\");\n\t\t\t\tjQuery3(\"referral_gems_plural\").html(\"s\");\n\t\t\t\tjQuery3(\"#points_selected\").html(\"0\");\n\t\t\t\tlet points_html = ``;\n\t\t\t\tif(value > 0) {\n\t\t\t\t\tpoints_html += `${value} &dash; Referral Point${value > 1? 's': ''} Available`;\n\t\t\t\t\tif(value >= 10) {\n\t\t\t\t\t\t// prepare the button\n\t\t\t\t\t\tpoints_html += `<br/><input id=\"my_points_btn\" type=\"button\" onclick=\"window.location = '#use_points_modal'\" value=\"Use Referral Points\"/>`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsubheader.html(points_html);\n\t\t\t}", "title": "" }, { "docid": "34cf1df3983e0a69b6eff353669c1a20", "score": "0.5549193", "text": "function qodefInitQuantityButtons() {\n $(document).on('click', '.qodef-spec-quantity-minus, .qodef-spec-quantity-plus', function (e) {\n e.stopPropagation();\n\n var button = $(this),\n inputField = button.siblings('.qodef-spec-quantity-input'),\n step = parseFloat(inputField.data('step')),\n max = parseFloat(inputField.data('max')),\n minus = false,\n inputValue = parseFloat(inputField.val()),\n newInputValue;\n\n if (button.hasClass('qodef-spec-quantity-minus')) {\n minus = true;\n }\n\n if (minus) {\n newInputValue = inputValue - step;\n if (newInputValue >= 1) {\n inputField.val(newInputValue);\n } else {\n inputField.val(0);\n }\n } else {\n newInputValue = inputValue + step;\n if (max === undefined) {\n inputField.val(newInputValue);\n } else {\n if (newInputValue >= max) {\n inputField.val(max);\n } else {\n inputField.val(newInputValue);\n }\n }\n }\n });\n }", "title": "" }, { "docid": "aa08e50647f29ad4b4c797872a01754c", "score": "0.5543351", "text": "function nextPopup(){\n\t\t\tif(vm.totalFee == 0){\n\t\t\tdocument.getElementById('totalFee').focus();\n\t\t\ttoastr.warning(\"Tổng chi phí phải lớn hơn 0\"); \n\t\t\t\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tif(!vm.validator.validate()){\n\t\t\t\t$(\"#totalFee\").focus();\n\t\t\t\t\n\t\t\t\treturn;\n\t\t\t}else{\n\n\t\t\t\tvm.showTabOne = false;\n\t\t\t\ttachbanghi();\n\t\t\t}\n\t\t\tfillData2Table([]);\n\t\t}", "title": "" }, { "docid": "d591a71cc5a3267dad7600f2f0c61ec4", "score": "0.55297107", "text": "function mkdfInitQuantityButtons() {\n\t\t$(document).on('click', '.mkdf-quantity-minus, .mkdf-quantity-plus', function (e) {\n\t\t\te.stopPropagation();\n\t\t\t\n\t\t\tvar button = $(this),\n\t\t\t\tinputField = button.siblings('.mkdf-quantity-input'),\n\t\t\t\tstep = parseFloat(inputField.data('step')),\n\t\t\t\tmax = parseFloat(inputField.data('max')),\n\t\t\t\tminus = false,\n\t\t\t\tinputValue = parseFloat(inputField.val()),\n\t\t\t\tnewInputValue;\n\t\t\t\n\t\t\tif (button.hasClass('mkdf-quantity-minus')) {\n\t\t\t\tminus = true;\n\t\t\t}\n\t\t\t\n\t\t\tif (minus) {\n\t\t\t\tnewInputValue = inputValue - step;\n\t\t\t\tif (newInputValue >= 1) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tinputField.val(0);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewInputValue = inputValue + step;\n\t\t\t\tif (max === undefined) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tif (newInputValue >= max) {\n\t\t\t\t\t\tinputField.val(max);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tinputField.trigger('change');\n\t\t});\n\t}", "title": "" }, { "docid": "a41e4ea43721ffbbc4fecfeb92944f03", "score": "0.5526204", "text": "function qodefInitQuantityButtons() {\n\t\t$(document).on('click', '.qodef-quantity-minus, .qodef-quantity-plus', function (e) {\n\t\t\te.stopPropagation();\n\t\t\t\n\t\t\tvar button = $(this),\n\t\t\t\tinputField = button.siblings('.qodef-quantity-input'),\n\t\t\t\tstep = parseFloat(inputField.data('step')),\n\t\t\t\tmax = parseFloat(inputField.data('max')),\n\t\t\t\tminus = false,\n\t\t\t\tinputValue = parseFloat(inputField.val()),\n\t\t\t\tnewInputValue;\n\t\t\t\n\t\t\tif (button.hasClass('qodef-quantity-minus')) {\n\t\t\t\tminus = true;\n\t\t\t}\n\t\t\t\n\t\t\tif (minus) {\n\t\t\t\tnewInputValue = inputValue - step;\n\t\t\t\tif (newInputValue >= 1) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tinputField.val(0);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewInputValue = inputValue + step;\n\t\t\t\tif (max === undefined) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tif (newInputValue >= max) {\n\t\t\t\t\t\tinputField.val(max);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tinputField.trigger('change');\n\t\t});\n\t}", "title": "" }, { "docid": "86073e37c57c61078ebff84f38530180", "score": "0.5493601", "text": "function button(ticketClass,buttonCase){\n let flightClassNumber = stringToNumber(ticketClass)\n let upDownNumber = 0;\n if(buttonCase == true){\n upDownNumber = flightClassNumber +1;\n }\n else if(buttonCase == false && flightClassNumber > 0){\n upDownNumber = flightClassNumber -1;\n }\n let ticketCostTotal = 0;\n\n if(ticketClass == \"FirstClass\"){\n ticketCostTotal = 150*upDownNumber;\n }\n else{\n ticketCostTotal = 100*upDownNumber;\n }\n document.getElementById(ticketClass+\"-Cost\").value=\"$\"+ticketCostTotal;\n document.getElementById(ticketClass+\"-Center-Input\").value=upDownNumber;\n calculator();\n}", "title": "" }, { "docid": "a8765c64bee5ddf757393184919586c8", "score": "0.54704154", "text": "function buttonClick(btn) {\n var value = btn.value;\n var display = document.querySelector(\"#display\")\n if (value >=0 && value <= 9) {\n displayMemory = displayMemory + value\n display.value = displayMemory\n\n }\n if (value == \"clr\") {\n displayMemory = \"\"\n storeNum = \"\"\n display.value = displayMemory\n }\n if (value == \"+\") {\n operation = value \n calculate (operation)\n \n }\n if (value == \"-\") {\n operation = value \n calculate (operation)\n }\n if (value == \"*\") {\n operation = value \n calculate (operation)\n }\n if (value == \"/\") {\n operation = value \n calculate (operation)\n }\n if (value == \"equal\") {\n calculate (operation)\n }\n}", "title": "" }, { "docid": "6408f19c103e1b0437d2b63bb6c6fcd0", "score": "0.5460753", "text": "function quickRecalculate (quickRecalculationQty, salesTotal,salesMarginValue) {\r\n///wchodze z poziomu nowejkalkualcji ilości....\r\n// FIX: this doesn't get the salesTotal and the salesMarginValue recalculated properly with the new qty provided by user. As a result sales Total stays constant but unit price changes because qty changes in order_calculation_show_qty\r\n/*\r\n\r\nTODO: either make a function that would evaluate on calculation load the new qty with provided by user with the qty saved and trigger change qty event handler\r\nor\r\nfind where in code is the orderqty taken to calculate sales etc\r\n\r\n*/\r\n\r\n\r\n // if the qty new hidden field is populated meaning the user has entered a new order qty for quick recalculation than proceed\r\n //TODO: bulshit again doubled code, its already qty_new variable\r\n // get the order_qty_new once more from hidded field\r\n var quickRecalculationQty_Verification = parseFloat(document.occ.order_qty_new.value).toFixed(0);\r\n // get the current oc_id from html field\r\n var oc_id = parseFloat(document.occ.oc_id.value);\r\n // get the current recalculated name of the qty new like order_qty... where ... is and integer number\r\n var qty_name = document.occ.order_qty_name.value;\r\n // get the recalculated margin in percentage\r\n var margin_new = document.occ.margin_new.value;\r\n // get the recalculated marigin in PLN\r\n var margin_pln_new = document.occ.margin_pln_new.value;\r\n // check if the current recalculated qty is over 0 and if its equal to ... FUCK SHIT BULLSHIT doubled code\r\n\r\n if ((quickRecalculationQty_Verification > 0) && (quickRecalculationQty_Verification === quickRecalculationQty)) {\r\n // close the recalculation window fast and open the order_calculation_show_qty window in its place while passing recalculated values in GET variable that will be used to populate html input field in order_calculation_show_qty and saved to db to order_calculation_datas\r\n window.location = './order_calculation_show_qty.php?action=save_qty&oc_id=' + oc_id + '&back=show&qty_name=' + qty_name + '&qty_new=' + quickRecalculationQty_Verification + '&margin_new=' + margin_new + '&margin_pln_new=' + margin_pln_new + '&sales=' + salesTotal + '&margin=' + salesMarginValue;\r\n } else {\r\n // display an error message a\r\n window.location = './order_calculation_show_qty.php?action=show&oc_id=' + oc_id + '&back=show&error=wrong_qty';\r\n document.getElementById(\"div_calculate\").style.display = \"\";\r\n document.getElementById(\"input_save_input\").disabled = true;\r\n }\r\n// TODO: what does this part do???\r\n ///wchodze z liczenia ceny podczas zamiana wiądacej ilośc nakład....\r\n var qty_change = document.occ.order_qty_change.value;\r\n if (qty_change) {\r\n setTimeout(function() {\r\n var myButton = document.getElementById(\"input_save_input\");\r\n myButton.click();\r\n }, TimeOut);\r\n }\r\n}", "title": "" }, { "docid": "936e4ef3de6bf9304832007f607624b1", "score": "0.54249704", "text": "function setHazFee(){\n var labelElem = document.getElementById(\"id_hazardous_container\");\n if (labelElem != null) {\n if (checkIsChem()){\n labelElem.style.display=\"initial\";\n }\n else {\n labelElem.style.display=\"none\";\n var inputElem = labelElem.firstChild.nextSibling.nextSibling;\n inputElem.value=0;\n }\n }\n}", "title": "" }, { "docid": "105c6f2ef20bb90840bdfb3a1210733f", "score": "0.5413476", "text": "function buttonClick(e) {\r\n //The line below creates a variable with the name of calcValue. This variable is then assinged the value of the value attribute of the element with an id of calcWindows. \r\n var calcValue = document.getElementById(\"calcWindow\").value;\r\n //The line below creates a variable with the name of calcDecimal. This variable is then assigned the value of the value attribute of the element with an id of decimals.\r\n var calcDecimal = document.getElementById(\"decimals\").value;\r\n //The line below creates a variable with the name of buttonValue. This variable is then assigned the value of the value attribute of the event object target\r\n var buttonValue = e.target.value;\r\n //The switchcase below creates a series of responses to certain clicks on the calculator. This will tell he calculator how to deal with certain functions. It also sets a default case that will be run if none of the other cases are run. \r\n switch (buttonValue) {\r\n case \"del\":\r\n calcValue = \"\";\r\n break;\r\n case \"bksp\":\r\n calcValue = eraseChar(calcValue);\r\n break;\r\n case \"enter\":\r\n calcValue += \" = \" + evalEq(calcValue, calcDecimal) + \"\\n\";\r\n break;\r\n case \"prev\":\r\n calcValue += \" = \" + lastEq(calcValue);\r\n break;\r\n default:\r\n calcValue += buttonValue;\r\n break;\r\n }\r\n //The line below states that the value attribute of the element with the id of calcWindow will be set to the value of the calcValue variable. \r\n document.getElementById(\"calcWindow\").value = calcValue;\r\n //The line below allows for the user to click onto the element with an id of calcWindows\r\n document.getElementById(\"calcWindow\").focus();\r\n}", "title": "" }, { "docid": "00e3095a966df13e849d04d573e4d193", "score": "0.5399427", "text": "function handleOnButtonClick(asBtn) {\r\n switch (asBtn) {\r\n case 'ADD_FTE':\r\n addFte();\r\n break;\r\n case 'CALCULATE':\r\n calculateTotalFte();\r\n break;\r\n case 'DEL_FTE':\r\n deleteFte();\r\n break;\r\n }\r\n}", "title": "" }, { "docid": "1f0a4626d6c566dc1ad292c2d33e8505", "score": "0.5397172", "text": "function decrementApple(){\r\n\tif(document.getElementById(\"btnInp1\").value==0)\r\n\t{\t\r\n\t}else{\r\n\t\tq1=--document.querySelector(\"#btnInp1\").value;\r\n\t}\r\n\ttotalAmount();\r\n}", "title": "" }, { "docid": "343d9d19573f4d866e8092d4f446d95f", "score": "0.5376606", "text": "function equalSignPressed() {\n setMessage('');\n // when ther are all requirements\n if (getFirstOperand() !== null &&\n getSecondOperand() !== null &&\n getOperator() !== null) {\n let result = operate(getFirstOperand(), getSecondOperand(), getOperator());\n firstNums = [];\n secondNums = [];\n operator = null;\n setFirstOperand(result);\n isOperated = true;\n isEqualClicked = true;\n } else {\n return;\n }\n}", "title": "" }, { "docid": "40066af4e30eb5bb56a863c1f2dcb2f3", "score": "0.5374483", "text": "function UpdateQuoterForecastValue(txtForecastAmt,qtr)\n{\n if( txtForecastAmt.originalText != txtForecastAmt.value)\n {\n var txtQPerc ;\n var txtQForecast;\n var mode;\n switch (qtr)\n {\n case 1:\n txtQPerc='txtQ1Perc';\n txtQForecast='txtQ1Forecast';\n mode ='Q1';\n break;\n case 2:\n txtQPerc='txtQ2Perc';\n txtQForecast='txtQ2Forecast';\n mode ='Q2';\n break;\n case 3:\n txtQPerc='txtQ3Perc';\n txtQForecast='txtQ3Forecast';\n mode ='Q3';\n break;\n case 4:\n txtQPerc='txtQ4Perc';\n txtQForecast='txtQ4Forecast';\n mode ='Q4';\n break;\n default : txtQPerc='txtQ1Perc';\n }\n \n var newForeCastAmt = txtForecastAmt.value;\n var catNo = document.getElementById(txtForecastAmt.id.replace(txtQForecast,'hidCatNo')).innerText; \n var arrHeader = SalesForeCasting.UpdateQuoterForecastValues(catNo,newForeCastAmt,mode).value \n \n if(arrHeader)\n {\n // Update Header values\n document.getElementById(\"Q1ForecastTotal\").innerText = arrHeader[0];\n \n document.getElementById(\"Q2ForecastTotal\").innerText = arrHeader[1];\n document.getElementById(\"Q3ForecastTotal\").innerText = arrHeader[2];\n document.getElementById(\"Q4ForecastTotal\").innerText = arrHeader[3]; \n document.getElementById(\"AnnualForecastTotal\").innerText = arrHeader[4]; \n \n document.getElementById(\"Q1AddTotal\").value = arrHeader[5]; \n document.getElementById(\"Q2AddTotal\").value = arrHeader[6]; \n document.getElementById(\"Q3AddTotal\").value = arrHeader[7]; \n document.getElementById(\"Q4AddTotal\").value = arrHeader[8]; \n document.getElementById(\"AddAnnualTotal\").value = arrHeader[9]; \n document.getElementById(\"hidAnnuTot\").value = arrHeader[9]; \n \n document.getElementById(\"lblDiffTotal\").innerText = arrHeader[10]; \n \n // Update Grid Row values \n document.getElementById(txtForecastAmt.id.replace(txtQForecast,'txtAnnPerc')).value = arrHeader[12];\n document.getElementById(txtForecastAmt.id.replace(txtQForecast,\"dglblAnnualForecastlbs\")).innerText = arrHeader[13];\n document.getElementById(txtForecastAmt.id.replace(txtQForecast,\"dglblPctDiff\")).innerText = arrHeader[14];\n document.getElementById(txtForecastAmt.id.replace(txtQForecast,txtQPerc)).value = arrHeader[15];\n \n // Update the Origianl vale attribut to avoid update on annual pct field onblur event\n document.getElementById(txtForecastAmt.id.replace(txtQForecast,txtQPerc)).originalText = arrHeader[15];\n document.getElementById(txtForecastAmt.id.replace(txtQForecast,'txtAnnPerc')).originalText = arrHeader[12];\n txtForecastAmt.originalText = txtForecastAmt.value;\n window.opener.location.reload();\n }\n else\n DisplayError();\n }\n}", "title": "" }, { "docid": "d9e25ef3f0dd61f67b8748b7b101033f", "score": "0.53617716", "text": "function fc_onClick_Fila(rowid) {\n var rowDataCodigo = $(grilla).jqGrid('getRowData', rowid).codigo;\n var rowDataNombre = $(grilla).jqGrid('getRowData', rowid).nombre;\n var rowDataFlag = $(grilla).jqGrid('getRowData', rowid).flag;\n\n if (rowDataFlag == \"F\") {\n $(\"#delOpcion\").val(\"Restaurar\");\n } else { $(\"#delOpcion\").val(\"Eliminar\"); }\n\n $('#MtxtCodigo').val(rowDataCodigo);\n $('#MtxtCodigo').attr(\"disabled\", \"disabled\"); \n $('#MtxtNombre').val(rowDataNombre);\n\n $('#addOpcion').css({ display: \"none\" });\n $('#modOpcion').css({ display: \"inline\" });\n $('#delOpcion').css({ display: \"inline\" });\n $('#cancelOpcion').css({ display: \"inline\" });\n}", "title": "" }, { "docid": "e90f6720425d39afa70e7a7ec3d4e616", "score": "0.5358601", "text": "function mathButPress(operator){\n // check if result doesn't have a value\n if(!resultVal){\n // if there is no result then prev value is the new value\n prevVal = newVal;\n } else{\n // if there is result previous value is the result value\n prevVal = resultVal;\n }\n // reset new value\n newVal = \"\";\n // reset decimal cliked flag\n decimalClicked = false;\n // set math operator variable\n mathOperator = operator;\n // reset results value\n resultVal = \"\";\n // set entry space to empty\n document.getElementById(\"entry\").value = \"\";\n}", "title": "" }, { "docid": "1aa098a1b8bf4eb0c8e6f594f08c5a12", "score": "0.5357573", "text": "function initCalculator(id) {\n\n registerUpdateNotification(function () {});\n\n jQuery(\"div#\" + id + \" button.reset\").click(function (e) {\n e.preventDefault();\n jQuery(\"div#\" + id + \" input.bet-value\").val(\"0.00\").change();\n setCalcButtonState();\n });\n jQuery(\"div#\" + id + \" button\").not(\".reset\").click(function (e) {\n e.preventDefault();\n var target = jQuery(\"div#\" + id + \" input.bet-value\");\n var buttonValue = ie7CalculatorButtonFix(jQuery(this).val());\n var newVal = (parseFloat(target.val() ? target.val() : 0) + parseFloat(buttonValue));\n var maxAmount = target.attr('max');\n\n if (maxAmount) {\n var max = parseFloat(maxAmount);\n if (newVal > max) {\n newVal = max;\n }\n }\n\n target.val(newVal.toFixed(2)).change();\n setCalcButtonState();\n });\n }", "title": "" }, { "docid": "2683895adccd9038b0b9629471ee1152", "score": "0.5353292", "text": "function EditManualPremium()\n{\n if (document.getElementById('REQUESTCODE').value.substring(8,11) == 'ADD' || document.getElementById('REQUESTCODE').value.substring(8,11) == 'CHG')\n {\n if (document.getElementById(\"SA15_TOTALORIG\").value.substring(0,1) == \"-\" )\n {\n\tvar yesno = confirm('Caution: Premium entered as a credit. Please click Ok to continue.');\n\tif(yesno == false)\n { \n document.getElementById(\"SA15_TOTALORIG\").focus();\n return 0;\n\t }\n }\t\n\t \n UnFormatFields();\n document.forms[0].submit();\n set_busy_icon();\t\n } \n else\n {\n \tif(confirm(\"Are you sure you want to delete ?\"))\n\t{\t\n \t\tUnFormatFields();\n \t\tdocument.forms[0].submit();\n\t\tset_busy_icon();\n\t}\n } \n}", "title": "" }, { "docid": "33ec1adadd99429c7be8cca2151fbe61", "score": "0.53517556", "text": "function change() {\r\n document.querySelector('#btn-change').textContent = 'Check Out';\r\n document.querySelector('#exampleModalLongTitle').innerHTML = 'Check Out';\r\n document.querySelector('#input_div').innerHTML = 'Total : R' + total;\r\n\r\n document.querySelector('#m-footer').innerHTML = '<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\" onclick=\"reload()\">CheckOut</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Home</button>';\r\n\r\n}", "title": "" }, { "docid": "fc73fd5e7c2537342609f1b93e376f1c", "score": "0.5336394", "text": "function calculator(value,spanid,enable)\n{\n \n\n if(value == \"C\")\n {\n $('#'+spanid).val('');\n }\n else if(enable == 'discount')\n {\n var inputElementIs = document.getElementById(spanid);\n inputElementIs.value = inputElementIs.value + value;\n\n var totalinput=document.getElementById(spanid).value;\n }\n else\n {\n var inputElementIs = document.getElementById(spanid);\n inputElementIs.value = inputElementIs.value + value;\n\n var totalinput=document.getElementById(spanid).value;\n\n if(enable == 1)\n {\n bal_amount(totalinput);\n \n }\n\n \n }\n\n }", "title": "" }, { "docid": "df42087ef04e0705ea2b4fb3d2dc1f41", "score": "0.53207856", "text": "function Calculate(S_value){\n document.getElementById('calculate').addEventListener(\"click\", (e) =>{\n var percent = document.getElementById('discountpercent').value;\n var parsepercent = parseFloat(percent, 10).toFixed(2);\n var calcpercent = parseFloat(100 - parsepercent, 10).toFixed(2);\n var temp = S_value.textContent;\n var parsetemp = parseFloat(temp, 10).toFixed(2);\n discount = (parsetemp/100)*parsepercent;\n newprice = (parsetemp/100)*calcpercent;\n S_value.textContent = newprice.toFixed(2);\n totalprice -= discount;\n console.log(totalprice);\n modal_Edit.style.display=\"none\";\n });\n}", "title": "" }, { "docid": "e7baa7a8d9c352aaab5112c29a09eb9e", "score": "0.53195244", "text": "_renderCalc() {\n output.innerHTML = 0;\n\n // prettier-ignore\n this.#args = ['AC', '+/-', '%', '√', '7', '8', '9', '/', '4', '5', '6', 'x', '1', '2', '3', '-', '0', '.', '+'];\n\n for (let i = 0; i < this.#args.length; i++) {\n btnContainer.insertAdjacentHTML(\n \"beforeend\",\n `<div class=\"calc-btn\" data-calc=\"${\n this.#args[i] === \"x\" ? \"*\" : this.#args[i]\n }\">${this.#args[i]}</div>`\n );\n }\n\n // Apply different button width for \"0\"\n const btnZero = document.querySelector(\"[data-calc='0']\");\n btnZero.style.width = \"50%\";\n }", "title": "" }, { "docid": "52a194a5e37d862a416529a82d1734de", "score": "0.53162235", "text": "function computation() { //this computation is only temporary if we want to successively continue to input numbers. and not by clicking the equal symbol\r\n if (prevOperation === 'X'){\r\n res = res * parseFloat(dis_2); //in my reference he uses -> res = parseFloat(res) * parseFloat(dis_2). I realized the the value of element 'res' is already parsefloated.\r\n } //if encountered any problem. try to check by changing the code like above this.\r\n else if (prevOperation === '+'){\r\n res = res + parseFloat(dis_2);\r\n }\r\n else if (prevOperation === '-'){\r\n res = res - parseFloat(dis_2);\r\n }\r\n else if (prevOperation === '/'){\r\n res = res / parseFloat(dis_2);\r\n }\r\n else if (prevOperation === '%'){\r\n res = res % parseFloat(dis_2);\r\n }\r\n}", "title": "" }, { "docid": "05325f206b5f4c87ec657974b3cbfc5c", "score": "0.5316106", "text": "function calculatorHandler( event ){\n\t // Get value of tapped tile\n\t calDisplay = $(this).html();\n\t // If it is Clear, clear the input field\n\t if (calDisplay === \"Clear\") {\n\t\t $( \"#KeypadDisplay\" ).val(\"\");\n\t } else {\n\t\t // Limit the entry to 3-digit number\n\t\t if ($( \"#KeypadDisplay\" ).val() < 100){\n\t\t\t$( \"#KeypadDisplay\" ).val( $( \"#KeypadDisplay\" ).val()+calDisplay);\n\t\t }\n\t };\n}", "title": "" }, { "docid": "2dd17478aba9809118ac85804652f736", "score": "0.5309855", "text": "function handelEventOfDoneButton() {\n // sold out button action\n $(\".btn-done\").click(function () {\n var _this = this;\n // get product key\n var key_product = $(_this).parents(\":eq(1)\").attr(\"class\");\n $(_this).css(\"background-color\") == \"rgb(153, 153, 153)\"\n ? markAsDone(_this, key_product) // activate 'Done' button\n : markAsNotDone(_this, key_product); // deactivate 'Don' button\n });\n }", "title": "" }, { "docid": "98f70679955bb2ecf70a2a29e5ad9ec5", "score": "0.5308748", "text": "function suppInquireBtnClicked()\n{\n\t$(\"#invoice_popup_new_inquire\").show();\n\t\n\t$(\"#supplier_ctrls\").hide();\n\t\n\t$(\"#inquire_ctrls\").show();\n\t\n\taction = \"Inquire\";\n}", "title": "" }, { "docid": "fda11c7f91d9b14aa151f96197367f1f", "score": "0.53075576", "text": "function showResolveButton(flag)\n {\n // TODO: If the button was an independent component, we should not know its class\n var button = $('.perc-lmg-alert-info').find('.perc-lmg-resolve');\n if (flag)\n {\n button.removeClass('hidden');\n }\n else\n {\n button.addClass('hidden');\n }\n }", "title": "" }, { "docid": "ef24f9faa1d870a3b7796d5b0c1b1dc0", "score": "0.52924544", "text": "function orderCancelClick(){\n var $popupMessage = $('.popupMessage');\n $('.btn-order-cancel').click(function(){\n openElementMask($popupMessage);\n xBtnClick($popupMessage);\n });\n}", "title": "" }, { "docid": "0a77c03b323c8b2b68788f072a735ce8", "score": "0.5292087", "text": "function changePoTotalPriceInUSD() {\n var currencySelectedForUSD = new Array();\n currencySelectedForUSD = getCurrency();\n\n var totalCurrPriceInUSD = new Array();\n totalCurrPriceInUSD = getTotalCurrPriceInUSD(currencySelectedForUSD);\n\n var totalPoPriceInUSD = 0;\n var val = 0;\n\n for(j=0; j<currencySelectedForUSD.length; j++)\n {\n \tval = totalCurrPriceInUSD[j]*1; \t\n \ttotalPoPriceInUSD += val*1; \n }\n totalPoPriceInUSD = totalPoPriceInUSD.toFixed(4);\n $('orderTotalInUSD').value = totalPoPriceInUSD;\n \n if ($v(\"poFinancialApprovalRequired\") == \"Y\") {\n \tvar allowPOFinancialConfirmaiton = $v(\"allowPOFinancialConfirmaiton\");\n \tif (window['submitConfirmLink']) {\t\t \n \t $('submitConfirmLink').style.display = 'none';\n \t}\n \tif ($v(\"allowPOFinancialConfirmaiton\") == 'Y') {\n \t\tif (window['financialapprovallink'] ) {\n\t \t\t$('financialapprovallink').style.display = '';\n \t\t}\n\t }\n }\n else {\n \tif (window['submitConfirmLink']) {\t\t \n \t $('submitConfirmLink').style.display = '';\n \t}\n }\n}", "title": "" }, { "docid": "345c1d36764fb7aeb125ff32edc40a21", "score": "0.52871954", "text": "function display(e){\n //get id of the clicked button\n var id = e.target.id;\n\n //when equals button is pushed, calculate the answer\n if (id === \"=\"){\n displayAnswer()\n }\n //when AC/clear button is pushed, clear contents\n else if (id === \"clear\"){\n clear()\n }\n //when anything else is pushed, display button pushed and full equation\n else{\n document.getElementById(\"calc-screen\").innerHTML = id\n equation.push(id)\n displayEquation()\n }\n}//end display function", "title": "" }, { "docid": "11a869e30fed4f7a822eb33d2046e8f6", "score": "0.52843046", "text": "function clearCalc(){\n\n display.innerText=0;\n currentNum=display.innerText;\n operator=undefined;\n prevNum=undefined;\n decimal.disabled=false;\n backspace.disabled=true;\n equal.disabled=true;\n prevClick=\"click\";\n\n}", "title": "" }, { "docid": "d8c4712459503b58253d0a32ef571123", "score": "0.52752143", "text": "billsEnterConfirm() {\n this.billsModalCloser();\n this.calcSavingsDisplay();\n }", "title": "" }, { "docid": "3cc0b24129d541a7ca858b1f447eaea1", "score": "0.5270537", "text": "function onClickHint() {\n if (cellSelected !== -1) {\n _fillCell(cellSelected, solvedArray[cellSelected])\n }\n }", "title": "" }, { "docid": "92aab7dd46f57fd5d581a3ba457535bf", "score": "0.5251364", "text": "function calculatePrice(btnId, quantity, price, subTotal, total,tax) {\n document.getElementById(btnId).addEventListener('click', function () {\n var currentQuantity = parseInt(quantity.value)\n var updateQuantity\n var fixedPrice\n var updatePrice\n var currentSubTotal\n var updateSubtotal\n var updateTax\n var updateTotal\n if (btnId == 'phonePlusBtn' || btnId == 'casingPlusBtn') {\n //quantity calculate\n updateQuantity = ++currentQuantity\n //product price calculate\n fixedPrice = (parseFloat(price.innerText) / (--currentQuantity))\n updatePrice = fixedPrice * updateQuantity\n //subtotal calculate\n currentSubTotal = parseFloat(subTotal.innerText)\n updateSubtotal = currentSubTotal + fixedPrice\n updateTax=parseFloat((updateSubtotal*0.1).toFixed(2))\n updateTotal=updateSubtotal+updateTax\n } else {\n if (quantity.value > 1) {\n //quantity calculate\n updateQuantity = --currentQuantity\n //product price calculate\n fixedPrice = (parseFloat(price.innerText) / (++currentQuantity))\n updatePrice = fixedPrice * updateQuantity\n //subtotal calculate\n currentSubTotal = parseFloat(subTotal.innerText)\n updateSubtotal = currentSubTotal - fixedPrice\n updateTax=parseFloat((updateSubtotal*0.1).toFixed(2))\n updateTotal=updateSubtotal+updateTax\n }\n }\n //check any change then update\n if (updateQuantity > 0) {\n //quantity update\n quantity.value = updateQuantity\n //update price\n price.textContent = updatePrice\n //update subtotal\n subTotal.textContent = updateSubtotal\n //update tax\n tax.textContent=updateTax\n //update total\n total.textContent = updateTotal\n }else{\n alert('quantity is not possible zero')\n }\n })\n}", "title": "" }, { "docid": "34d735fcc98d69d7c86fb3aac1c57089", "score": "0.52477694", "text": "function clearButPress(){\r\n prevVal = \"\";\r\n newVal = \"\";\r\n resultVal = \"\";\r\n mathOperator = \"\";\r\n decimalClicked = false;\r\n document.getElementById(\"entry\").value = \"0\";\r\n}", "title": "" }, { "docid": "64f93fe34017ed81ac567ade67fa613d", "score": "0.5246665", "text": "function setAmountClicked() {\n const theInput = this.parentElement.querySelector(\"input\");\n if (this.classList.contains(\"minus\") && theInput.value >= 1) {\n theInput.value--;\n } else if (this.classList.contains(\"plus\")) {\n theInput.value++;\n document.querySelector(\"#order p\").classList.remove(\"error\");\n }\n}", "title": "" }, { "docid": "839727aeb39c2d48dd248751351f4a35", "score": "0.5242947", "text": "function recalc() {\r\n let procentaActual = 0;\r\n let total_price_budget = document.getElementById(\"total_price_budget\");\r\n let error_block = document.getElementById(\"error_block\");\r\n\r\n for (let i = 0; i < cryptos_checked.length; i++) {\r\n\r\n console.log(\"cryptos checked length je \" + cryptos_checked.length + \" jsme uvnitr recalc funkce, zrovna volam get element by id \" + cryptos_checked[i].short + input_postfix);\r\n\r\n // show error\r\n if (isNaN(document.getElementById(cryptos_checked[i].short + input_postfix).value)) {\r\n console.log(\"nastala chyba\");\r\n document.getElementById(cryptos_checked[i].short + input_postfix).style.border = \"1px solid red\";\r\n error_block.style.display = \"block\";\r\n break;\r\n } else {\r\n console.log(\"nenastala chyba radek 1\");\r\n document.getElementById(cryptos_checked[i].short + input_postfix).style.border = \"1px solid transparent\";\r\n console.log(\"nenastala chyba radek 2\");\r\n document.getElementById(cryptos_checked[i].short + input_postfix).style.borderBottom = \"1px solid #555\";\r\n error_block.style.display = \"none\";\r\n }\r\n procentaActual = Number(procentaActual) + Number(document.getElementById(cryptos_checked[i].short + input_postfix).value);\r\n }\r\n\r\n // zobrazit vysledek (zda % odpovidaji)\r\n clearForm(input_postfix);\r\n\r\n if (procentaActual < 100) {\r\n total_price_budget.innerHTML = (100 - procentaActual) + '% to go';\r\n } else {\r\n if (procentaActual > 100) {\r\n total_price_budget.innerHTML = procentaActual + '% thats too much';\r\n total_price_budget.style.backgroundColor = \"red\";\r\n } else {\r\n total_price_budget.style.backgroundColor = \"transparent\";\r\n total_price_budget.innerHTML = 'Allright';\r\n \r\n // vypočítat jednotlivé hodnoty\r\n fiatInputterBudget();\r\n }\r\n }\r\n}", "title": "" }, { "docid": "d3b0781b03471ea4cb124bf51eb00af8", "score": "0.5241491", "text": "function performCalculation() {\r\n if(calculator.firstNumber == null || calculator.operator == null) {\r\n alert('nilai awal atau operator belum diterapkan');\r\n return;\r\n }\r\n\r\n let result = 0;\r\n // fungsi untuk operator penjumlahan dan pengurangan, harus diubah dulu menjadi integer\r\n if(calculator.operator === \"+\") {\r\n result = parseInt(calculator.firstNumber) + parseInt(calculator.displayNumber);\r\n } else if (calculator.operator === \"X\") {\r\n result = parseInt(calculator.firstNumber) * parseInt(calculator.displayNumber);\r\n } else if (calculator.operator === \":\") {\r\n result = parseInt(calculator.firstNumber) / parseInt(calculator.displayNumber);\r\n } else {\r\n result = parseInt(calculator.firstNumber) - parseInt(calculator.displayNumber);\r\n }\r\n calculator.displayNumber = result;\r\n}", "title": "" }, { "docid": "18cdbcdd073ab9edc5a5643225e9b079", "score": "0.5225417", "text": "function product_category_cancel_button() {\n\t$('#product_category').trigger(\"reset\");\n\tupdate_id=\"\";\n\tbutton_create(1);\n\tcategory_datatable_function();\n}", "title": "" }, { "docid": "ec6c3c22ad1506b22572b14d5a07daae", "score": "0.5214074", "text": "function calculateAllClick() {\n calculateClick(false);\n }", "title": "" }, { "docid": "e365797a7f0027ff5b31e54989ba41eb", "score": "0.5212697", "text": "function calcButton(btnValue) {\n if (btnValue == 'C') {\n document.getElementById('screen').value = '';\n }else{\n\t\t document.getElementById('screen').value += btnValue;\n\t }\n}", "title": "" }, { "docid": "336cc9b2d2511be8824637987964a889", "score": "0.5211776", "text": "function setTipDec(){\r\n var tipC=Number(getTip());\r\n tipC =tipC-1;\r\n document.getElementById(\"tip\").value=tipC;\r\n calculate();\r\n }", "title": "" }, { "docid": "91e079604360984958a0d86b1ecd2d3e", "score": "0.52050227", "text": "function manualcalculator(value)\n{\n var spanid=$('#hiddenvalueforfocus').val();\n\n\n\n if(value == \"C\")\n {\n $('#'+spanid).val('');\n }\n \n else\n {\n var inputElementIs = document.getElementById(spanid);\n inputElementIs.value = inputElementIs.value + value;\n\n var totalinput=document.getElementById(spanid).value;\n }\n\n }", "title": "" }, { "docid": "cfca5a5a730a2d06d93898e444aba22b", "score": "0.52022713", "text": "function updateDisplay(event, solved, buttonValue, isOperator) {\n if(!isOperator) {\n console.log(isOperator)\n if(buttonValue !== \"Backspace\") {\n if(!solved) {\n displayValue += buttonValue;\n display.innerHTML = displayValue; \n } else {\n replace(buttonValue);\n }\n } else {\n if(displayValue.length > 1) {\n displayValue = displayValue.slice(0, displayValue.length - 1);\n updateDisplay(event, solved, \"\");\n } else {\n clear();\n }\n }\n }\n}", "title": "" }, { "docid": "eb9d7dbb0d05f7bf72bfce4c173b2a91", "score": "0.51959527", "text": "function Calculator() {\n handleSubmit();\n}", "title": "" }, { "docid": "46a9d04d2ad2d5aeb90d6cf8c05e0931", "score": "0.5194454", "text": "function addIngredientButton() {\n if ($(\"#quicksIngred\").length < 1) {\n $(\"#marketIngredientSell\").parent().after('<div class=\"center\"><input id=\"quicksIngred\" value=\"Quick Sell\" type=\"button\"></div>');\n }\n\n $('#quicksIngred').click(function() {\n var sPrice = $('#modal2Content').find($('.marketListings')).find('tbody tr:nth-child(1) td:nth-child(2)').eq(0).text().replace(/\\D+/g, '');\n var amount = $('#modal2Content').find('div:first').text().replace(/\\D+/g, '');\n $('#marketPrice').val($('#marketPrice').val() + (sPrice - 1));\n $('#marketIngredientAmount').val($('#marketIngredientAmount').val() + amount);\n $(\"#marketIngredientSell\").click();\n });\n}", "title": "" }, { "docid": "bdc8a590007360bc14ef53a9999a6db2", "score": "0.51832634", "text": "function handleResetBtn() {\n var dt = s.widgets.table.dataTable;\n if (dt.page.info().recordsTotal > dt.page.info().recordsDisplay) {\n if (!$(c.FILTER.BUTTONS.RESET).length) {\n $(c.FILTER.BUTTONS.CONTAINER).append('<button id=\"cats-reset\" class=\"btn btn-default\"><i class=\"fa fa-refresh\"></i></button>')\n }\n } else {\n $(c.FILTER.BUTTONS.RESET).remove();\n }\n }", "title": "" }, { "docid": "11e478bc46184989348120bcc7f5a6ad", "score": "0.5179059", "text": "function _applyPromoCode(){\r\n //$(\"#coderequest_promotional_code\").val(\"Enter promotional or gift code\");\r\n //$('#coderequest_promotional_code').parent().removeClass('input-text input-text-active active-input input-text-error');\r\n //$('#coderequest_promotional_code').parent().addClass('input-text');\r\n $('#coderequest_promotional_code').val('');\r\n $('#coderequest_promotional_code').parent().removeClass('input-text-error-empty');\r\n blur_element(document.getElementById('coderequest_promotional_code'));\r\n $('#get_promo_code_popup').show();\r\n $('#verify_button').show();\r\n $('#beta-loader-img').hide();\r\n button = document.getElementById('verify_button');\r\n button.className = \"apply-button-active rfloat\";\r\n //button.disabled=\"disabled\";\r\n\t\r\n $(\"#verify_button\").unbind('click').bind('click', function(){\r\n if(validateEmptyDiscount()){ }\r\n else {\r\n $(\"#beta-loader-img\").show();\r\n $(\"#verify_button\").hide();\r\n showBlockShadow();\r\n $(\"#discount_form\").submit();\r\n }\r\n });\r\n}", "title": "" }, { "docid": "5655acd718a80256635538562d0565a0", "score": "0.51752037", "text": "function checkUpdateControlTotals(){\r\n\tvar hash_items = document.getElementById('hash_items').value;\r\n\tvar entered_items = document.getElementById('entered_items').value;\r\n\tvar diff_items = hash_items - entered_items;\r\n\tvar hash_quantity = document.getElementById('hash_quantity').value;\r\n\tvar entered_quantity = document.getElementById('entered_quantity').value;\r\n\tvar diff_quantity = hash_quantity - entered_quantity;\r\n\tvar proceed = true;\r\n\r\n\tif(diff_items != 0){\r\n\t\talert('Check Items Difference!');\r\n\t\tdocument.getElementById('hash_items').focus();\r\n\t\tproceed = false;\r\n\t} else if(diff_quantity != 0){\r\n\t\talert('Check Quantity Difference!');\r\n\t\tdocument.getElementById('hash_quantity').focus();\r\n\t\tproceed = false;\r\n\t}\r\n\r\n\tif(proceed == true){\r\n\t\tdocument.po_entry_form.submit();\r\n\t}\r\n}", "title": "" }, { "docid": "9022c595d08223c766d41657a6900254", "score": "0.5174196", "text": "function displayTotal() {\n calcArray.push(currentDisplay.textContent);\n let operator = \"\";\n let answer = \"\";\n for (i = 0; i < calcArray.length; i++) {\n if (calcArray[i] === \"+\" || calcArray[i] === \"-\" || calcArray[i] === \"/\" || calcArray[i] === \"x\") {\n operator = calcArray[i];\n } else {\n if (answer == \"\") {\n answer = calcArray[i];\n } else if (calcArray[i] == 0 && operator === \"/\") {\n return currentDisplay.textContent = \"Fatality by Zero\";\n } else {\n answer = operate(answer, calcArray[i], operator);\n }\n }\n }\n answer = checkAnswerSize(answer);\n answer = Math.round(answer * 100000000000) / 100000000000;\n if ((answer.toString().length) > 13) {\n answer = answer.toExponential(7);\n };\n currentDisplay.textContent = answer;\n operatorDisplay.textContent = \"=\";\n calcArray = [];\n}", "title": "" }, { "docid": "e41c009bee05722471c1b04ff9e7d991", "score": "0.5173425", "text": "function calculate(event) {\r\n var btnNumberValue = event.target.value;\r\n result.disabled = \"false\";\r\n\r\n if(btnNumberValue === \"=\") {\r\n if(result.value != '') {\r\n result.value = eval(result.value);\r\n }\r\n } else if(btnNumberValue === \"AC\") {\r\n result.value = '';\r\n } else {\r\n result.value += btnNumberValue;\r\n }\r\n}", "title": "" }, { "docid": "6e380d90244f5bc326b301e7ce046378", "score": "0.5166658", "text": "function perform_budget_logic() {\n // obtain adjustment \n var adjustment = Number($('.budget-table-2-values-adjustments').val());\n // name of resource that was changed \n var adjusted_resource_name = previous_resource_name;\n // update budget breakdown\n update_budget_breakdown(adjusted_resource_name, adjustment);\n // update the rows on the popup table\n render_rows();\n // remove previous event handler for the rows\n remove_row_handler();\n // add event handlers for the new rows\n add_row_handler();\n // update google pie chart\n createGooglePieChart();\n }", "title": "" }, { "docid": "a76af9cc81020f508aafd4e25fe91930", "score": "0.5161722", "text": "function solveEquation(){\n\n currentNum=operate(operator, prevNum, currentNum);//solve problem\n if(currentNum<=MAX_NUM)\n display.innerText=currentNum;\n else{\n display.innerText=\"Overflow\";\n return;\n }\n \n\n operator=null;\n prevClick=null;\n equal.disabled=true;//disable equal button\n prevClick=\"equal\";\n \n}", "title": "" }, { "docid": "f9bbf6b6d8507d7d75d35430ed88b3b6", "score": "0.51600873", "text": "function fullButtonClick() {\r\n\t\tcommonClick();\r\n\t\t$(\".mid_right_box.change_properties\").removeClass(\"change_properties\");\r\n\t\t$(\".form_edit_panel\").show();\r\n\t\t$(\".editButton\").show();\r\n\t\t$(this).attr(\"id\", \"present\");\r\n\t\t$('.editButton .content_textbox input:text').val($(this).find('input:submit').val());\r\n\t\tif (pageScroll != 1) {\r\n\t\t\t$(\"#content-2\").mCustomScrollbar('scrollTo', $('.mid_right_box').last());\r\n\t\t};\r\n\t}", "title": "" }, { "docid": "77c05545e8da467024a9a91d6efbfe52", "score": "0.5159386", "text": "function chooseThis( which_one ) { \n var btns = document.getElementsByName('dec-pt');\n var totDec = Number(document.getElementById(\"btmDec\").value) + Number(document.getElementById(\"topDec\").value);\n for( i = 0; i < btns.length; i++ ) {\n var att = \"andsp\" + i;\n if( i === which_one ) {\n btns[i].childNodes[0].nodeValue=\".\";\n btns[i].setAttribute( att,'.');\n var markedDec = 7 - i;\n if( totDec === markedDec ) {\n btns[i].style.color=\"black\";\n } else {\n btns[i].style.color=\"red\";\n upDateErrCount();\n }\n document.getElementById(\"dpPos\").setAttribute('value', i );\n } else {\n btns[i].childNodes[0].nodeValue=\"_\";\n btns[i].setAttribute( att,'');\n btns[i].style.color=\"#FAF3E4\"; // hide \"_\" with background color\n }\n }\n\n if( totDec === 0 || ( which_one !== 7 && btns[which_one].style.color === \"black\") ||\n Number(document.getElementById(\"bdx\").value) < Number(document.getElementById(\"lastbox\").value - 1 )) { \n document.getElementById(\"decRmdr\").style.color=\"#FAF3E4\";\n } else {\n document.getElementById(\"decRmdr\").style.color = \"red\";\n }\n}", "title": "" }, { "docid": "05770cd13b06e4f1f49f7da034869416", "score": "0.51585716", "text": "function calculate(operation) {\n operation();\n document.getElementById(\"answer\").value = answer.toFixed(2);\n}", "title": "" }, { "docid": "8fd2d0c37c222d86b25f8ee24f729d8b", "score": "0.51527596", "text": "function calTotal(message){\r\n var AcheckButton1 = isButtonChecked(\"answer1\")\r\n\t var AcheckButton2 = isButtonChecked(\"answer2\")\r\n var AcheckButton3 = isButtonChecked(\"answer3\")\r\n\t var AcheckButton4 = isButtonChecked(\"answer4\")\r\n\t var AcheckButton5 = isButtonChecked(\"answer5\")\r\n\t var AcheckButton6 = isButtonChecked(\"answer6\")\r\n\t var AcheckButton7 = isButtonChecked(\"answer7\")\r\n\t var AcheckButton8 = isButtonChecked(\"answer8\")\r\n\t var AcheckButton9 = isButtonChecked(\"answer9\")\r\n\t var AcheckButton10 = isButtonChecked(\"answer10\")\r\n\t//alert(\" AcheckButton1: \"+AcheckButton1+\" AcheckButton2: \"+AcheckButton2)\r\n\tif ((message == \"submit\") && (AcheckButton1 !== -1)&& (AcheckButton2 !== -1)&&(AcheckButton3 !== -1)&&(AcheckButton4 !== -1)&&(AcheckButton5 !== -1)&&(AcheckButton6 !== -1)&&(AcheckButton7 !== -1)&&(AcheckButton8 !== -1)&&(AcheckButton9 !== -1)&&(AcheckButton10 !== -1)) {\r\n\t\tvar Rtotal=Rcount1+Rcount2+Rcount3+Rcount4+Rcount5+Rcount6+Rcount7+Rcount8+Rcount9+Rcount10;\r\n//alert(Rtotal);\r\ndocument.body.style.backgroundColor=\"#f3f5f8\";\r\ndocument.fgColor=\"red\";\r\ndocument.write(\"<h3 align='center'>You got: \", Rtotal, \" correct answers out of total of 10 questions</h3>\");\r\nif (Rtotal < 8) {\r\n\tdocument.fgColor=\"red\";\r\n\tdocument.body.style.backgroundColor=\"#f3f5f8\";\r\n\tdocument.write(\"<h3 align='center'>Your score is: \", Rtotal, \"0%, you probably are not ready for this class yet.<h3>\")\r\ndocument.write(\"<h3 align='center'>You can review the questions here: <a href='mathtest_result1.html'> answer sheet</a><h3>\")\r\n} else {\r\n\tdocument.fgColor=\"red\";\r\n\tdocument.body.style.backgroundColor=\"#f3f5f8\";\r\n\tdocument.write(\"<h3 align='center'>Your score is: \", Rtotal, \"0%, THIS IS COULD BE THE CLASS FOR YOU.<h3>\")\r\n\tdocument.write(\"<h3 align='center'>Return to homepage: <a href='index.html'> Go Home</a><h3>\")\r\n}\r\n\t} else {\r\n\t\tif (AcheckButton1 == -1)\r\n\t\talert(\"You have not answered question 1, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton2 == -1)\r\n\t\talert(\"You have not answered question 2, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton3 == -1)\r\n\t\talert(\"You have not answered question 3, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton4 == -1)\r\n\t\talert(\"You have not answered question 4, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton5 == -1)\r\n\t\talert(\"You have not answered question 5, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton6 == -1)\r\n\t\talert(\"You have not answered question 6, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton7 == -1)\r\n\t\talert(\"You have not answered question 7, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton8 == -1)\r\n\t\talert(\"You have not answered question 8, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton9 == -1)\r\n\t\talert(\"You have not answered question 9, please answer it and resubmit the form\")\r\n\t\tif (AcheckButton10 == -1)\r\n\t\talert(\"You have not answered question 10, please answer it and resubmit the form\")\r\n\t}\r\n}", "title": "" }, { "docid": "cce8924bf91f98d2b8862bf592915967", "score": "0.5150886", "text": "function calculator(button){\r\n if(button.type==\"number\"){\r\n data.operation.push(button.symbol);\r\n data.formula.push(button.formula);\r\n\r\n }else if (button.type ==\"key\"){\r\n if(button.name ==\"clear\"){\r\n data.operation =[];\r\n dta.formula =[]; \r\n updateOutputResult(0);\r\n\r\n }else if (button.name == \"delete\"){\r\n data.operation.pop();\r\n data.formula.pop();\r\n\r\n }else if (button.name ==\"rad\"){\r\n RADIAN = true;\r\n angleToggler();\r\n }else if (button.name == \"deg\"){\r\n RADIAN=false;\r\n angleToggler();\r\n }\r\n }\r\n}", "title": "" }, { "docid": "5a88a217353fcfb3cff279696ca0e619", "score": "0.51495135", "text": "function modal_row_clac(e)\n\t{\n\t\tvar $target_parent = $(e.target).parent('.sale-item-name'),\n\t\t\tquantity = $target_parent.find('.frm-quantity').val(),\n\t\t\tup = $target_parent.find('.frm-up').val(),\n\t\t\t$cash = $target_parent.find('.frm-cash');\n\t\tif($.isNumeric(quantity) && $.isNumeric(up))\n\t\t{\n\t\t\t$cash.val(quantity * up);\n\t\t}\n\t}", "title": "" }, { "docid": "52ac1e51c1fa8dc4c11dc13f7f0d30ab", "score": "0.5140907", "text": "function calculatorPushToInput(){\n\n}", "title": "" }, { "docid": "388359fb9047b26156fdaac4bde4668c", "score": "0.5137748", "text": "function payAction() {\r\n modal.style.display = 'none';\r\n array.length = 0;\r\n array2.length = 0;\r\n array3.length = 0;\r\n Total_p = 0;\r\n x = 0;\r\n}", "title": "" }, { "docid": "b3b7e67c77ad998081ea93aea0b129c7", "score": "0.5137554", "text": "function triggerCartSubmit() {\n jQuery('#uc-cart-view-form #edit-update:first').trigger('click');\n}", "title": "" }, { "docid": "a6a72fd96c11c7479d3a3bbfd6126128", "score": "0.5136394", "text": "function _updateModalQty() {\n $(\".add-to-cart\").on(\"click\", function () {\n var qtyValue = $(\".numeric-stepper > input\").val();\n $(\".js-product-qty\").text(qtyValue);\n });\n }", "title": "" }, { "docid": "b035658221fdc288c33dd39ad75b78c2", "score": "0.5134851", "text": "function fcfsClick() {\n clearClick()\n showZero();\n algorithmFCFS(readProcesses(readUserInput()))\n}", "title": "" }, { "docid": "3800bf93c4707787d0ddddf2ae807869", "score": "0.5129281", "text": "function editButtonClicked()\n{\n\t$(\"#buyer_ctrls\").hide();\n\t\n\t$(\"#invoice_update\").show();\n\t\n\tvar popupItems = parseInt($(\"#items_count\").val());\n\t\n\t\n\t// This is used to enable the delete button\n\tfor( var i=1;i<popupItems+1;i++ )\n\t{\n\t\t\t\t\n\t\t$(\"#del_btn_\"+i).show();\n\t\t\n\t\t$('#popup_item_desc'+i).prop('disabled', false);\n\t\t\n\t\t$('#popup_part_no'+i).prop('disabled', false);\n\t\t\n\t\t\n\t\t$('#popup_quantity_ordered'+i).prop('disabled', false);\n\t\t\n\t\t$(\"#popup_quantity_ordered_unit\" + i).click(showQuantityUnits);\n\t\t\n\t\t\n\t\t$('#popup_quantity_shipped'+i).prop('disabled', false);\n\t\t\n\t\t$(\"#popup_quantity_shipped_unit\" + i).click(showQuantityUnits);\n\t\t\n\t\t\n\t\t$('#popup_price'+i).prop('disabled', false);\n\t\t\n\t\t$(\"#currency\"+i).click(showCurrencyList);\n\t}\n\t\n\t$(\"#popup_add_item_btn\").show();\n\t\n\t $(\"#popup_carrier\").removeAttr(\"disabled\");\n\t\t\n\t $(\"#popup_freight_weight\").removeAttr(\"disabled\");\n\t\n\t $(\"#popup_quantity_freight_unit\").removeAttr(\"disabled\");\n\t\n\t $(\"#popup_date_shipped\").removeAttr(\"disabled\");\n\t\n\t $(\"#popup_bill_of_land\").removeAttr(\"disabled\");\n}", "title": "" }, { "docid": "33203b796d9b10520f14f119e2adbcc8", "score": "0.5127237", "text": "function plusButtonHandler(myclass, isIncrease) {\n const myclassTicket = document.getElementById(myclass + 'TicketQuantity');\n const myclassTicketQuantity = myclassTicket.value;\n let myclassTicketAmount = parseInt(myclassTicketQuantity);\n if (isIncrease == true) {\n myclassTicketAmount = myclassTicketAmount + 1;\n }\n if (isIncrease == false && myclassTicketAmount > 0) {\n myclassTicketAmount = myclassTicketAmount - 1;\n }\n\n myclassTicket.value = myclassTicketAmount;\n}", "title": "" }, { "docid": "11e9f001ba4a73ef4e0d6ec68e0b997d", "score": "0.51185817", "text": "function clearCleanButton(){\n\tclearCleanConsole(); \n\tnumbers = [0,0];\n\toperandSign = [\" \",\" \"]\n\twhichNumber = 0; \n}", "title": "" }, { "docid": "afcf112de7abc2e8df49f316d77f9bcf", "score": "0.511835", "text": "function onCustomAmountFocus() {\n for (var i = 0; i < donateForm.length; i++) {\n if (donateForm[i].type == 'radio') {\n donateForm[i].onclick = function () {\n customAmount.value = '';\n }\n }\n if (donateForm[i].type == 'radio' && donateForm[i].checked == true) {\n checkedInd = i;\n donateForm[i].checked = false;\n }\n }\n }", "title": "" }, { "docid": "cd8f0ca170bac618c2aa988fda444dc5", "score": "0.5118019", "text": "function calculativeFixedValue()\n{\t\t\t\n\t$('input[name^=\"fixed_value[]\"]').keyup(function(e) \n\t{\t\t\t\t\t\t\n\t\tvar fixedValue = $(this).val();\t\n\t\t\t\n\t\tif(fixedValue)\n\t\t{\n\t\t\t$(this).closest('span').find('input[name=\"calculative_value[]\"]').val(fixedValue);\n\t\t} \n\t\t\n\t\tgrossTotal();\n\t\t\n\t});\n}", "title": "" }, { "docid": "d6f4302fe9d597a82dc41369e863b193", "score": "0.51166445", "text": "function updateLintasanX() {\n $('.reset_u').click();\n $('.updateLintasan').hide();\n $('.tabelLintasan').fadeIn();\n}", "title": "" }, { "docid": "b6b5b33e901bcd177540ad94d86cb260", "score": "0.51116145", "text": "function editTheQuantity(event) {\n var Qinputelement = event.target;\n if (isNaN(Qinputelement.value) || Qinputelement.value <= 0) {\n Qinputelement.value = 1;\n }\n updatefoodcart();\n}", "title": "" }, { "docid": "88f72a1b5ea59cab177a7500fe7f0f7a", "score": "0.51051605", "text": "function perform_budget_logic() {\n // obtain adjustment \n var adjustment = Number($('.budget-table-2-values-adjustments').val());\n // name of resource that was changed \n var adjusted_resource_name = previous_resource_name;\n // update budget breakdown\n update_budget_breakdown(adjusted_resource_name, adjustment);\n // update the rows on the popup table\n render_rows();\n // remove previous event handler for the rows\n remove_row_handler();\n // add event handlers for the new rows\n add_row_handler();\n // update google pie chart\n createGooglePieChart();\n }", "title": "" }, { "docid": "88f72a1b5ea59cab177a7500fe7f0f7a", "score": "0.51051605", "text": "function perform_budget_logic() {\n // obtain adjustment \n var adjustment = Number($('.budget-table-2-values-adjustments').val());\n // name of resource that was changed \n var adjusted_resource_name = previous_resource_name;\n // update budget breakdown\n update_budget_breakdown(adjusted_resource_name, adjustment);\n // update the rows on the popup table\n render_rows();\n // remove previous event handler for the rows\n remove_row_handler();\n // add event handlers for the new rows\n add_row_handler();\n // update google pie chart\n createGooglePieChart();\n }", "title": "" }, { "docid": "a23c90a3c78e7b348c3450c255ab0fd2", "score": "0.51050967", "text": "function amountClick(){\n var amountNow = 0, $amountShow = $('.amountShow'), max = (($amountShow.attr('data-max') != undefined) ? parseInt($amountShow.attr('data-max'),10): 10);\n $('.calBtn').click(function(){\n amountNow = parseInt($amountShow.html());\n if ($(this).find('>div').hasClass('add') && amountNow < max){\n amountNow++;\n }\n else if($(this).find('>div').hasClass('minus')){\n if (amountNow != 1) amountNow--;\n }\n $amountShow.html(amountNow)\n });\n}", "title": "" }, { "docid": "ff7e0bf2560125cee00e4fdb381d27c4", "score": "0.5098363", "text": "function handleOnButtonClick(btn) {\r\n switch (btn) {\r\n case 'Close':\r\n commonOnSubmit('saveCheckClearingReminder', true, true, true);\r\n // Disable Close button after submit\r\n if (hasObject('PM_CLEARING_REMINDER_CLOSE')) {\r\n getObject('PM_CLEARING_REMINDER_CLOSE').disabled = true;\r\n }\r\n\r\n break;\r\n }\r\n\r\n return true;\r\n}", "title": "" }, { "docid": "f5f5c5da21226c01c8a04d3ae6560909", "score": "0.50966465", "text": "function BS_Show_FedEx_Popup() {\n if (document.getElementById('bsp_shippingCost_dialog') != null) {\n var containerName = 'behrooz';\n var tent;\n if (document.getElementById(containerName) == null) {\n tent = document.createElement('div');\n tent.setAttribute('id', containerName);\n tent.style.position = 'fixed';\n tent.style.top = '0';\n tent.style.left = '0';\n tent.style.zIndex = 1000;\n } else {\n tent = document.getElementById(containerName);\n tent.innerHTML = '';\n }\n\n document.getElementById('bsp_shippingCost_dialog').parentElement.style.padding = '3px';\n //debugger;\n document.getElementById('bsp_shippingCost_dialog').parentElement.style.backgroundColor = 'darkgray';\n document.getElementById('bsp_shippingCost_dialog').style.backgroundColor = 'white';\n document.getElementById('bsp_shippingCost_dialog').parentElement.style.padding = '5px';\n var tabArray = document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li');\n for (var x = 0; x < tabArray.length; x++) {\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].style.backgroundColor = 'lightblue';\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].style.padding = '5px';\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].addEventListener('click', function (x) {\n var colorTabArray = document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li');\n for (var ix = 0; ix < colorTabArray.length; ix++) {\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[ix].style.backgroundColor = 'lightblue';\n }\n this.style.backgroundColor = 'white';\n });\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].getElementsByTagName('a')[0].style.textDecoration = 'none';\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].style.display = 'inline';\n document.getElementById('bsp_shippingCost_dialog').parentElement.getElementsByTagName('li')[x].parentElement.style.height = '23px'\n }\n document.getElementById('bsp_shippingCost_dialog').previousElementSibling.getElementsByTagName('span')[0].style.color = 'white';\n document.getElementById('bsp_shippingCost_dialog').previousElementSibling.getElementsByTagName('button')[0].style.borderRadius = '25px';\n document.getElementById('bsp_shippingCost_dialog').previousElementSibling.getElementsByTagName('button')[0].style.backgroundColor = 'white';\n document.getElementById('bsp_shippingCost_dialog').previousElementSibling.getElementsByTagName('button')[0].style.display = 'none';\n document.getElementById('bsp_shippingCost_dialog').previousElementSibling.getElementsByTagName('span')[0].parentElement.style.height = '30px';\n\n tent.appendChild(document.getElementById('bsp_shippingCost_dialog').parentElement);\n\n document.body.appendChild(tent);\n }\n\n}", "title": "" }, { "docid": "dd8494faa06b9df9cddae5c78441d136", "score": "0.5093407", "text": "function clearCalculator(option) {\n total = '';\n firstValue = '';\n secondValue = '';\n currentValue = 'first'\n currentOperation = '';\n percentileActive = false;\n opBtns.forEach(btn => btn.style.backgroundColor = \"#fe9505\");\n opBtns.forEach(btn => btn.style.color = \"white\");\n if (option !== 'keepDisplay') {\n primaryDisplay.textContent = '';\n secondaryDisplay.textContent = '';\n }\n}", "title": "" }, { "docid": "d84b6fe10a04d1d594d21f3758540d5e", "score": "0.5091922", "text": "function computehandler() {\n let cost = Number(costEle.value);\n let isRoundUp = roundUpEle.checked;\n let tipRate = Number(tipRateEle.options[tipRateEle.selectedIndex].value);\n\n if (!valid(cost)) {\n logMessage(`Please enter a price larger then zero`);\n return 0;\n }\n\n let tip = computeTip(cost, isRoundUp, tipRate);\n\n showTipResults(`You should leave a tip of $${tip.toFixed(2)} for a total of $${(tip + cost).toFixed(2)}.`);\n}", "title": "" }, { "docid": "b018bdc434c00991b318ac136781ac81", "score": "0.5087373", "text": "function defaultView() {\n $('.guide-column').show();\n var no_search_text = true;\n updateTotals(no_search_text);\n }", "title": "" }, { "docid": "5a65696553cf991a02ca6df7b6c4528f", "score": "0.5085829", "text": "function sendCalcInfo() {\n\n let package = { ops: operation, readable: readableOperation()};\n\n // send the calculation request to the server\n $.ajax( {url: \"/calculation\", type: \"POST\", data: package}).then(refreshHistory);\n clear();\n}", "title": "" }, { "docid": "8b5ea221ec0d47d4573847d633064fc3", "score": "0.5085454", "text": "function anotherTransaction(){\n\n var addMoneyRadio=document.getElementById(\"boxCheckedForTransaction\").checked;\n var resumeTranastion=document.getElementById(\"boxNotCheckedForTransaction\").checked;\n\n if (addMoneyRadio!=0){\n // alert(\"hi\");\n document.getElementById(\"submit50\").style.display=\"inline-block\";\n document.getElementById(\"repeatTransactionForFill\").style.display=\"none\";\n document.getElementById(\"addedValueInATM\").innerHTML=\"\";\n }\n else if (resumeTranastion!=0) {\n document.getElementById(\"inputForMaxAmount\").style.display=\"block\";\n document.getElementById(\"repeatTransactionForFill\").style.display=\"none\"\n document.getElementById(\"addedValueInATM\").innerHTML=\"\";\n };\n}", "title": "" }, { "docid": "a19d49910f0971afc7f3ec90ee7b2120", "score": "0.50829196", "text": "function changeDisplay(newNum){\r\n // check if there already is an operator in the object, and if an operator was pressed again.\r\n // if true, calculate and show the new sum.\r\n if (operatorArray.includes(calculatorInfo.inputOperator) && operatorArray.includes(newNum)){\r\n calculate();\r\n calculatorInfo.inputNumber1 = String(calculatorInfo.currentSum);\r\n calculatorInfo.inputNumber2 = \"\";\r\n calculatorInfo.inputOperator = newNum;\r\n // check if the operator is empty, if it is, add . to inputnumber1 and update decimal1 to be true, so they can't add another.\r\n } else if (newNum === \".\" && calculatorInfo.inputOperator === \"\" && calculatorInfo.decimal1 === false){\r\n calculatorInfo.inputNumber1 += \".\";\r\n displayNum.textContent = calculatorInfo.inputNumber1;\r\n calculatorInfo.decimal1 = true;\r\n // if inputoperator is not empty, add . to inputnumber 2 and change decimal2 to true, this time.\r\n } else if (newNum === \".\" && calculatorInfo.inputOperator !== \"\" && calculatorInfo.decimal2 === false){\r\n calculatorInfo.inputNumber2 += \".\";\r\n displayNum.textContent = calculatorInfo.inputNumber2;\r\n calculatorInfo.decimal2 = true;\r\n // check if the operator has a value, if true, the button pressed goes to inputnumber2\r\n } else if (numberArray.includes(parseFloat(newNum)) && operatorArray.includes(calculatorInfo.inputOperator)){\r\n calculatorInfo.inputNumber2 += newNum;\r\n calculatorInfo.currentSum = operate(calculatorInfo.inputOperator, parseFloat(calculatorInfo.inputNumber1), parseFloat(calculatorInfo.inputNumber2));\r\n displayNum.textContent = calculatorInfo.inputNumber2;\r\n // Check if it's the first number pressed.\r\n } else if (numberArray.includes(parseFloat(newNum))){\r\n calculatorInfo.inputNumber1 += newNum;\r\n calculatorInfo.currentSum = parseFloat(calculatorInfo.inputNumber1);\r\n displayNum.textContent = calculatorInfo.inputNumber1;\r\n // Check if the button pressed is an operator.\r\n // set inputnumber1 to currentSum, so you can use the sum after pressing equals. \r\n } else if (operatorArray.includes(newNum)){\r\n calculatorInfo.inputNumber1 = String(calculatorInfo.currentSum);\r\n calculatorInfo.inputOperator = newNum;\r\n displayNum.textContent = calculatorInfo.inputOperator;\r\n };\r\n}", "title": "" }, { "docid": "99d5d871e70030747d6c5425a7ac6064", "score": "0.50785804", "text": "function updatesrow(btn, srem, sqty) {\n var qa = Number(srem) + Number(sqty);\n let quantity = $tr.find(\".qty_hidden\").val();\n if (Number(qa) < Number(quantity)) {\n $tr.find(\".qty_hidden\").val(qa);\n alert(\"Maximun Quantity available for Selection is \" + qa);\n }\n if (Number(quantity) <= 0.9999999) {\n $tr.find(\".qty_hidden\").val(1);\n alert(\"Minimun Quantity Selected is 1\");\n } else {\n $tr = $(btn).closest(\"tr\");\n let newqty = $tr.find(\".qty_hidden\").val();\n let newdiscount = $tr.find(\".discount_hidden\").val();\n let price = $tr.find(\".price_text\").text();\n\n // calculate sub total\n let netdiscount = Number(price) * Number(newdiscount);\n netdiscount = netdiscount / 100;\n let net_price = Number(price) - Number(netdiscount);\n var subtotal = net_price * Number(newqty);\n subtotal = subtotal.toFixed(1);\n\n\n //assign values\n $tr.find(\".qty_hidden\").attr(\"value\", newqty);\n $tr.find(\".discount_hidden\").attr(\"value\", newdiscount);\n $tr.find(\".netprice_hidden\").attr(\"value\", net_price);\n $tr.find(\".qty_text\").text(newqty);\n $tr.find(\".discount_text\").text(newdiscount);\n $tr.find(\".netprice_text\").text(net_price);\n $tr.find(\".subtotal_text\").text(subtotal);\n\n // re calculate grand total\n var table = $(\"table tbody\");\n var t_quantity = 0;\n var f_total = 0;\n var count = 0;\n table.find(\"tr\").each(function(i) {\n count++;\n var $tds = $(this).find(\"td\"),\n Quantity = $tds.eq(1).text(),\n subtotal = $tds.eq(5).text();\n // do something with productId, product, Quantity\n (t_quantity = t_quantity + Number(Quantity)),\n (f_total = f_total + Number(subtotal));\n });\n $(\"#f_total\").html(\" \" + f_total);\n $(\"#t_quantity\").html(t_quantity.toCurrency());\n $(\"#t_items\").html(count);\n $('input[name=\"total_amount\"]').val(f_total);\n $('input[name=\"t_amount\"]').val(f_total);\n $('input[name=\"total_samount\"]').val(f_total);\n\n $tr.find(\".qty_text\").toggle();\n $tr.find(\".qty_hidden\").toggle();\n $tr.find(\".discount_hidden\").toggle();\n $tr.find(\".discount_text\").toggle();\n $tr.find(\".btn-info\").toggle();\n $tr.find(\".btn-danger\").toggle();\n $tr.find(\".btn-secondary\").toggle();\n\n $(\"#updatebtn\").removeAttr(\"hidden\");\n\n }\n}", "title": "" }, { "docid": "cb0ae20039c1d4b3fb4f5ccddf1e6a0c", "score": "0.5076211", "text": "function modalPre(input) {\n document.querySelectorAll('.modal-prev')[input].addEventListener('click', function () {\n if (input > 0) {\n document.querySelectorAll('.modal-container')[input].style.display = 'none';\n document.querySelectorAll('.modal-container')[input-1].style.display = 'block';\n } else {\n document.querySelectorAll('.modal-container')[input].style.display = 'none';\n document.querySelectorAll('.modal-container')[totalBios-1].style.display = 'block';\n }\n });\n}", "title": "" }, { "docid": "2294715634a8dd4d3f951b7d4ac3659a", "score": "0.50759983", "text": "function toggleMembook() {\n \n totalCost +=\n ($(\"#membook\").is( \":checked\" )) ? 250 : -250;\n $(\"#estimate\").html( \"$\" + totalCost );\n}", "title": "" }, { "docid": "be549ddd8cdfc5386d75c14f8e8d0874", "score": "0.50736344", "text": "updateDisplay() {\n this.currentOperandTextElement.innerText = this.getDisplayNumber(this.currentOperand);\n // displays '3 + ' as previous\n if(this.operation != null){\n this.previousOperandTextElement.innerText = `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`;\n } else{\n this.previousOperandTextElement.innerText = '';\n }\n }", "title": "" }, { "docid": "7905003ac1e4206447e9c82999143713", "score": "0.50680774", "text": "function ReturnClick() {\n ChangeButtonPatchView('ReturnBill', 'btnPatchAttributeSettab', 'Return');\n notyConfirm('Are you sure to return?', 'ReturnToCompany()', '', 'Yes,return it!');\n $(\"#InvNo\").attr(\"disabled\", \"disabled\");\n $(\"#InvDate\").attr(\"disabled\", \"disabled\");\n $(\"#CName\").attr(\"disabled\", \"disabled\");\n $(\"#CAddress\").attr(\"disabled\", \"disabled\");\n $(\"#CPhoneNo\").attr(\"disabled\", \"disabled\");\n $(\"#SName\").attr(\"disabled\", \"disabled\");\n $(\"#SAddress\").attr(\"disabled\", \"disabled\");\n $(\"#SPhoneNo\").attr(\"disabled\", \"disabled\");\n $(\"#SEmail\").attr(\"disabled\", \"disabled\");\n $(\"#CEmail\").attr(\"disabled\", \"disabled\");\n $(\"#CGstIn\").attr(\"disabled\", \"disabled\");\n $(\"#SGstIn\").attr(\"disabled\", \"disabled\");\n $(\"#CPanNo\").attr(\"disabled\", \"disabled\");\n $(\"#SPanNo\").attr(\"disabled\", \"disabled\");\n $(\"#Remarks\").attr(\"disabled\", \"disabled\");\n $(\".DeleteLink\").hide();\n}", "title": "" } ]
3a1d29b959f2d5a657ee4e1109355ae1
METODO PARA AGREGAR UN CLIENTE
[ { "docid": "c1dc1f31f7eb1e01727782d5c75d2449", "score": "0.0", "text": "addClientes(req, res, next) {\n models.client.create({\n cliName: req.body.cliName,\n cliContactName: req.body.cliContactName,\n cliContactEmail: req.body.cliContactEmail,\n cliHolisticManagerName: req.body.cliHolisticManagerName,\n cliHolisticManagerEmail: req.body.cliHolisticManagerEmail\n\n })\n .then((clientes) => {\n message = properties.get('message.client.res.okCreated');\n type = \"success\";\n res.status(HttpStatus.OK).json(clientes);\n }, (err) => {\n console.dir(err);\n message = properties.get('message.res.errorInternalServer');\n res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(message);\n next(err);\n });\n }", "title": "" } ]
[ { "docid": "55596e65d2f45578a2231232f5deabbf", "score": "0.60379237", "text": "function CliBase() {}", "title": "" }, { "docid": "2403bb5d3234cad2020c8d640a30c55a", "score": "0.60188633", "text": "function Cli() {}", "title": "" }, { "docid": "bc149bd39dd662be2266f93b44cfdc11", "score": "0.6002713", "text": "function ejecutarOrdenAscendente() {\n let personajesOrdenados = OrdenarDescendente(todosLosPersonajes);\n showCards(personajesOrdenados);\n \n }", "title": "" }, { "docid": "cea5400031e33c364581732bf54f81e9", "score": "0.598353", "text": "constructor(cliente, agencia) {\n super(0, cliente, agencia); // medoto para chamar as class herdeiras do extends\n ContaCorrente.numeroDeContas += 1; // metodo contador\n }", "title": "" }, { "docid": "297243663f8d46c473975accb8a23478", "score": "0.5825292", "text": "function exec(){\n const saudacao = 'Fala' // escopo 2 (outro endereco de memoria)\n return saudacao\n}", "title": "" }, { "docid": "2b5cd72398e54aeab1cb84980c32c283", "score": "0.5797924", "text": "caminaEncapuchado (){\n \n }", "title": "" }, { "docid": "4dbd4d341b956625f4a3e55da077418d", "score": "0.5788076", "text": "function main(){\r\n\t//esta funcion se debe mandar a llamar antes sino crea un bug en donde parece que choca antes de llegar al cuerpo del objeto\r\n\tchoquecuerpo();\r\n\tchoquepared();\r\n\tdibujar();\r\n\tmovimiento();\r\n\t//metodo choque que esta en la clase padre de ambas\r\n\t//si cabeza colisiona con comida\r\n\tif(cabeza.choque(comida)){\r\n\t\t//comida sera colocada aleatoriamente mediante el metodo colocar\r\n\t\tcomida.colocar();\r\n\t\t//al colisionar, cabeza metera el siguiente\r\n\t\tcabeza.meter();\r\n\t}\r\n}", "title": "" }, { "docid": "9d32fef07a9e9cc02332070e932d4829", "score": "0.5779045", "text": "function ejecutarTercerPunto() {\n limpiarFormulario();\n limpiarEntradas();\n leerDatos();\n recibirDatos();\n llenarDatos();\n crearTablaTotal(dirSubred - 1);\n \n\n}", "title": "" }, { "docid": "70b8c209dffb84ef8fa331840ac43171", "score": "0.57550424", "text": "function init(){ // función que se llama así misma para indicar que sea lo primero que se ejecute\n\n }", "title": "" }, { "docid": "ed39a07f0edfef656bbc85f2ffb526c2", "score": "0.5754511", "text": "function funzione_avvio() {\n\tcambia_da_cartolina(\"c7694-119\");\n\tcambia_edizione();\n}", "title": "" }, { "docid": "99701b049e17348882fcdabf9986c22f", "score": "0.5730161", "text": "function iniciar() {\n\tcrearEscena();\n\tcrearCohete();\n\tcrearCabina();\n\tcrearCamara();\n\tcrearLuces();\n\tcrearMundo();\t\n\tciclo();\n}", "title": "" }, { "docid": "0922d6e0ea22ea0f00ce55f00d94aa37", "score": "0.57113194", "text": "function init(){ // función que se llama así misma para indicar que sea lo primero que se ejecute\n carreraCtrl.carreras = administradorService.getCarreras();\n }", "title": "" }, { "docid": "1e741df0647e16c5bb4bb29de2a52928", "score": "0.56921744", "text": "function precioAscendente() {\n if (buscarActivo == false){\n cargarInmuebles('Ascendente');\n } else {\n buscar('Ascendente');\n } \n}", "title": "" }, { "docid": "b4b1ac5782172905c14f55af18defd7c", "score": "0.56785977", "text": "function mostrarProgreso() {}", "title": "" }, { "docid": "7ce405de33b93a13d883d8cf8105567f", "score": "0.565786", "text": "function limpiarPoligonos()\n{\n\n}", "title": "" }, { "docid": "ddb86a7fe1105daaa9fb089f5dd6b078", "score": "0.5649826", "text": "function menu() {\n var Diagram = require('cli-diagram');\n var myHeadPy = new Diagram()\n .box(\" Lenguaje Python \");\n console.log(myHeadPy.draw());\n var myOptions = new Diagram()\n .box(\" OPCIONES \\n[1] Ver Tipos\\n[2] Ver Comandos\\n[3] Salir\");\n console.log(myOptions.draw());\n var option = readKey.questionInt(\"Introduzca la opcion: \");\n validateOp(option);\n}", "title": "" }, { "docid": "cdbdb4232cded09f72a658e158142176", "score": "0.5603227", "text": "function menuInicial() {\n console.log(' o que deseja fazer?');\n \n resposta = read.question('[1] Cadastrar bichano\\n[2] Administrar bichano\\n[3] Sair');\n \n /* Dados do infoPacote:\n donoNome, donoCPF, donoFone, donoEmail\n gatoNome, gatoSexo, gatoIdade, gatoPelo, tipoRacao\n dataEntrada, dataSaida\n necessVet, isCastrado, isVermifugado, familiares\n */\n\n switch (resposta) {\n case '1':\n infoPacote = cadastro();\n eval(\"const gato_\" + infoPacote['gatoNome'] + \" = new Gato(infoPacote);\");\n const gato_tonin = new Gato(infoPacote);\n // ^ eval() funciona como devido\n gatosLista.push(infoPacote['gatoNome']);\n donosLista.push(infoPacote['donoNome']);\n // ^ push funcionando como devido\n break;\n case '2':\n escolhaGato(gatosLista);\n break;\n case '3':\n sair();\n break;\n default:\n console.log('Dado inválido. Informe novamente');\n menuInicial();\n break;\n }\n }", "title": "" }, { "docid": "fad8dccc4d8b3181bc1bd02cbe102c80", "score": "0.560193", "text": "function ejecutarCiclo(){\n\taddPersona();\n\tmodificarSaludYHambreDeTodosLosAnimales();\n\tlog(\"Ciclo ejecutado!!\");\n}", "title": "" }, { "docid": "61b32ec90d17b736302077cca721eb7a", "score": "0.5598951", "text": "function Inicio() {\n Mostrar();\n CargarDistrito();\n}", "title": "" }, { "docid": "228f8378c219696e736bd7715932490c", "score": "0.5572843", "text": "function rodaAplicacao() {// cria uma funcao para o metodo \"rodaAplicacao\"\n const eventos = carregarEventosPreviamenteCadastrados();//cria a variavel \"eventos\" que recebe a funçao \"carregarEventosPreviamenteCadastrados\"\n let opcao; //cria a variavel \"opcao\"\n\n while (true) {//enquanto (verdadeiro) loop infinito \n opcao = lerOpcaoDoMenu();//a variavel opcao recebe os valores de \"lerOpcaoDoMenu\"\n const opcaoParaInt = parseInt(opcao)//cria uma variavel \"opcaoParaInt\" para receber o valor de \"opcao\" e passa-lo para int\n if (opcaoParaInt === 0) {// se a opçao selecionada for 0 (valor e tipagem) entao execute :\n const evento = cadastrarEvento();//cria a variavel \"evento\" que recebe os dados do metodo \"cadastrarEvento\" \n if (evento) {//se (evento) 'evento !== undefined'\n console.log(\"Evento: \" + JSON.stringify(evento));//Escreva: + exiba os dados armazenados em (evento)\n eventos.push(evento);//envia os valores ao array \"eventos\" que foram recebidos pela variavel \"evento\"\n }//else {nao faz nada porque nao teve evento retornado}\n\n } else if (opcaoParaInt === 1) {// se a opçao selecionada for 1 (valor e tipagem) entao execute :\n const evento = selecionarEvento(eventos);//cria a variavel \"evento\" que recebe o metodo \"selecionarEvento\" com os valores da variavel \"eventos\"\n if (evento) {// se evento execute:\n const inscricao = inscreverNoEvento();//cria a variavel inscricao que recebe o parametro \"inscreverNoEvento\"\n if (inscricao) {// se inscricao\n console.log(\"Inscrição: \" + JSON.stringify(inscricao));//Escreva: + exiba os dados armazenados em (inscricao)\n evento.inscritos.push(inscricao);//envia novos valores ao array \"evento\" que foram recebidos pela variavel \"inscriçao\" e salva no bloco de \"inscritos\" dentro do array\n }\n\n }\n } else if (opcaoParaInt === 2) {// se a opçao selecionada for 2 (valor e tipagem) entao execute :\n const evento = selecionarListaEvento(eventos);//cria a variavel \"evento\" que recebe o metodo \"selecionarListaEvento\" com os valores da variavel \"eventos\" \n if (evento) {//se evento execute\n const inscricoes = evento.inscritos;//cria a variavel \"inscricoes\" que recebe o valor de \"inscritos\" contido em \"evento\"\n console.log(\"Inscrições: \" + JSON.stringify(inscricoes));//escreva: + exiba os dados armazenados em (inscricoes)\n }\n\n } else if (opcaoParaInt === 3) {// se a opçao selecionada for 3 (valor e tipagem) entao execute :\n return;//retrona, neste caso encerra a aplicaçao\n\n } else {// se a opçao selecionada for diferente das acima entao execute :\n\n console.log(\"Opção invalida\");//escreva:\n }\n } \n\n}", "title": "" }, { "docid": "7eb5713646d31ae9b7f3aedb96acfa8a", "score": "0.556957", "text": "constructor(cliente, agencia){\n super(0, cliente, agencia); //Ele acessa o construtor dentro da classe \"Conta\" Ele herda a classe extendida.\n ContaCorrente.numeroDeContas += 1; //Jeito de chamar um atributo estático.\n }", "title": "" }, { "docid": "7cbf99a163378c2251c7f3cef2aa3b9c", "score": "0.5560494", "text": "function interfaz(arr){\n console.clear();\n console.log(' ');\n console.log(\n \"LISTA DE ESPERA - Restaurante Floridas' Hollywood\"\n );\n console.log(\"========================================\");\n console.log(' ');\n console.log(\"1. Agregar nuevo cliente a la lista.\");\n console.log(\"2. Siguiente cliente ocupa mesa.\");\n console.log(\"3. Borrar ciente impaciente.\");\n console.log(\"4. Ver turno de cliente\");\n console.log(\"5. Ver estado de la lista de espera\");\n console.log(\"6. Guardar la lista de espera.\");\n console.log(\"7. Recuperar la lista de espera.\");\n console.log(\"8. Salir del programa.\")\n let opc= readlineSync.questionInt('¿Qué opción desea elegir? Escriba el número de su opción (1-8): ');\n opcionInterfaz(opc,arr);\n}", "title": "" }, { "docid": "de15d41393ed678d34504ec3bca2d0c3", "score": "0.55505556", "text": "function funcionesEstudiante(){\n llenarSelectCarreras(); \n}", "title": "" }, { "docid": "40ded5bca57980f5e3ffc58f8074d420", "score": "0.5547441", "text": "function cargarCapa(){\n traerCapa(url_capa_boca_de_subtes,accionDespuesDeTraerCapa);\n}", "title": "" }, { "docid": "a7a70c0e2689cac68add32f406e2cc20", "score": "0.55414677", "text": "constructor(cliente, agencia){\r\n super(0, cliente, agencia); \r\n Conta_Corrente.numeroDeContas += 1;\r\n }", "title": "" }, { "docid": "fb4eee22215033bc6018c6d444d95802", "score": "0.55404204", "text": "function soltaClique(){\n\tif(estadoAtual == estados.jogando){\n\t\tif(personagem.move == 0){\n\t\t\tplataforma.cria = 0;\n\t\t\tplataforma.rotaciona = 1;\t\n\t\t}\n\t}\n\telse{\n\t\testadoAtual = estados.jogando;\n\t\tpersonagem.reset();\n\t\tplataforma.reset();\n\t\tplataforma.limpa();\n\t\tobstaculos.limpa();\n\t\tposicao = 0;\n\t\tnovoRecord = 0;\n\t}\n}", "title": "" }, { "docid": "9dbdfae19f8b1d2965aa14e60a8909c2", "score": "0.5536623", "text": "function cargarpuntoControl(idPunto){\n\t//consultar demas datos en BD\n\tlet datos = {'opc': 'cargarDatosPunto', 'idPunto': idPunto};\n\tejecutarAjax(datos, cargarpuntoControlRespuesta);\n}", "title": "" }, { "docid": "1023ec71fe7be4f92cb02b844ae8bc83", "score": "0.55174494", "text": "function consultarCriaderos() {\n\t//enviar parametros para que realize la consulta de los criaderos y desps sean cargados al html\n\tvar parametros = { \"opc\" : 1 };\n\tejecutarAjax(parametros,cargarDropDown);\n}", "title": "" }, { "docid": "cf3a39a62cb435d06a33c60422112473", "score": "0.5489326", "text": "function ejecutarCiclo() {\n\tconsole.log(\"Aforo: \" + zoo.aforo + \" número visitantes: \" + zoo.numeroVisitantes + \" caja: \" + zoo.caja)\n\n\tmoverVisitantesANuevoRecinto();\n\n\t//addPersona();\n\taddPersonas();\n\n\tenfermeria.tratarAnimales();\n\n\tmodificarSaludATodosLosAnimales();\n\n\tagregarHambreATodosLosAnimales();\n\n//\tconsole.log(\"Ciclo ejecutado\");\n\tconsole.log(\"===================\");\n}", "title": "" }, { "docid": "128c1191f962230318f9d6e5e7b70140", "score": "0.54886913", "text": "constructor(cliente, agencia){\n super(0 ,cliente, agencia ); //Pra fazer a referencia desse contrutor com o da class mãe que é Conta;\n ContaCorrente.numeroDeContas += 1; //chama contaCorrente pq ele busca esse numero na class completa\n }", "title": "" }, { "docid": "15f461bf08fd7f46c329cb34760a3c6a", "score": "0.5479676", "text": "apagaTudo() {\n this._listaTitulos.venderTudo();\n }", "title": "" }, { "docid": "2cf5409c24d48b765750ab47edf04c67", "score": "0.54785806", "text": "function iniciarApp() {\n // console.log('iniciando App...');\n\n // resalta el div actual segun el div que se presiona\n mostrarSeccion();\n\n // oculta o muestra una seccion segun el tab alq ue se presiona \n cambiarSeccion();\n\n paginaSiguiente();\n\n paginaAnterior();\n\n //comprueba la pagina actual para ocultar o mostrar\n botonesPaginador();\n\n // muestra el resumen de la cita o mensaje de error en caso de no pasar la validacion\n mostrarResumen();\n\n\n // funcion para almacenar el nombre de la cita en el objeto\n nombreCita();\n\n //funcion para almacenar el numero del telefono\n numeroTelefono();\n\n // almacena la fecha en la cita del objeto\n fechaCita();\n\n // deshabilita dias pasados\n deshabilitarFechaAnterior();\n\n // almacena la hora de la cita en el objecto\n horaCita();\n}", "title": "" }, { "docid": "77e9a1d6d2d8c7ec139d00371244b7ad", "score": "0.54727966", "text": "ejecutarCiclo(miBiblioteca) {\n\n for (let i = this._libros.length - 1; i >= 0; i--) {\n let libroSocio = this._libros[i];\n miBiblioteca.devolverLibro(libroSocio);\n this._libros.splice(i, 1);\n }\n\n let numeroDeLibrosACoger = Utilidades.generarNumeroAleatorioEntre(1, 3);\n for (let i = 0; i < numeroDeLibrosACoger; i++) {\n let libro = miBiblioteca.dameLibroAleatorio();\n this._libros.push(libro);\n }\n }", "title": "" }, { "docid": "2488c2f4f2c71e6dba6e94dbb7d4295d", "score": "0.5471045", "text": "function ocultaerrorCrearCli() {\n\n\t\t\tvar element = document.getElementById(\"errorCreaCli\");\n\t\t\telement.classList.add(\"d-none\");\n\t\t\tvar element2 = document.getElementById(\"okCreaCli\");\n\t\t\telement2.classList.add(\"d-none\");\n\t\t}", "title": "" }, { "docid": "e9a28c8b6e8223d48e61738f8484fb1c", "score": "0.5468035", "text": "function init(){ // función que se llama así misma para indicar que sea lo primero que se ejecute\n administradorCtrl.carreras = administradorService.getCarreras();\n }", "title": "" }, { "docid": "c386473ad6d7ada08ae8440035019a4f", "score": "0.5466402", "text": "function precioDescendente() {\n if (buscarActivo == false){\n cargarInmuebles('Descendente');\n } else {\n buscar('Descendente');\n } \n}", "title": "" }, { "docid": "28f5e4ffb53df6b84d1abb1cc233d562", "score": "0.54644716", "text": "function limpiarControles(){ //REVISAR BIEN ESTO\n clearControls(obtenerInputsIdsTransaccion());\n htmlValue('inputEditar', 'CREACION');\n htmlDisable('btnAgregarNuevo', true);\n}", "title": "" }, { "docid": "950a10fac09f6662748755a1a8601935", "score": "0.54491234", "text": "function comenzarTrazo() {\n banderaDibujo = true;\n}", "title": "" }, { "docid": "387a18a556b37a042a6e5f279ba17542", "score": "0.5448719", "text": "function Jogo_para_dois_jogadores() {\n \n Preencher_Tela();\n \n}", "title": "" }, { "docid": "3480f4ce77166e2e8db62440b439c3a4", "score": "0.5436923", "text": "function f1() {\n id = prompt(\"dime el id\");\n nombre = prompt(\"dime el nombre\");\n precio = prompt(\"dime el precio\");\n descripcion = prompt(\"dime la descripción\");\n\n articulo = new Articulo(id, nombre, precio, descripcion); \n miCarrito.anyadeCarrito(articulo);\n}", "title": "" }, { "docid": "23ac1c1771922358aee51d4f453dbbcd", "score": "0.5436527", "text": "function dibujarComida() {\r\n\tcomida.dibujar(ctx);\r\n}", "title": "" }, { "docid": "c504cd40ebb8513c36df2dc666484242", "score": "0.5417098", "text": "function clique(){\n\tif(estadoAtual == estados.jogando){\t\n\t\tif(personagem.move == 0){\t\n\t\t\tplataforma.cria = 1;\n\t\t\tplataforma.rotaciona = 0;\n\t\t}\t\n\t}\t\n}", "title": "" }, { "docid": "ae7f9d112c97d8bfec2b0e6385f747a5", "score": "0.5412617", "text": "function pararNumero() {\n pintarLineas = false;\n\n let arrayLienzo = [];\n lienzo.forEach((dato) => {\n arrayLienzo = arrayLienzo.concat(dato);\n });\n\n run = new runIa(arrayLienzo);\n console.log(\"Lienzo de pararNumero\", lienzo);\n document.getElementById(\"res\").innerHTML = `\n <p id=\"resul1\">Resultados:</p>\n <b>${run[0]}</b>\n <p id=\"resul2\">Tambien puede ser un:</p>\n <b>${run[1]}</b>\n `;\n}", "title": "" }, { "docid": "d870bc5c65f09279307e5db60e8adb51", "score": "0.5406459", "text": "function volver_a_consultar(){//1001830082\n\n\t\t\t\t\t\t\t\t\tvar comando = 'node colombia.js \"'+arrays[1]+'\" \"'+arrays[2]+'\" ';\n\t\t\t\t\t\t\t\t\tconst { exec } = require('child_process');\n\t\t\t\t\t\t\t\t\texec(comando, (error, stdout, stderr) => {\n\t\t\t\t\t\t\t\t\t\tif (!error) {\n\t\t\t\t\t\t\t\t\t\t\tvar test = stdout.split(\"\\n\").join(\"\");\n\t\t\t\t\t\t\t\t\t\t\tvar teh = test.split(\"_\");\n\n\t\t\t\t\t\t\t\t\t\t\tconsole.log(\"salto a buscarlo\");\n\t\t\t\t\t\t\t\t\t\t\trequire('child_process').exec(`killall chrome`);\n\t\t\t\t\t\t\t\t\t\t\tresolve([true, teh, comando]);\n\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t}", "title": "" }, { "docid": "d16decd23fbf79419fd0593396295759", "score": "0.5387621", "text": "function activarCampos()\r\n{\r\n if ($('#e').get(0).value > 0)\r\n {\r\n botones.push({name: 'Nuevo', bclass: 'add', onpress : nuevo});\r\n botones.push({separator: true});\r\n }\r\n if($('#d').get(0).value>0){\r\n botones.push({name: 'Delete', bclass: 'delete', onpress : Delect});\r\n botones.push({separator: true});\r\n }\r\n if($('#l').get(0).value>0)\r\n {\r\n// botones.push({name: 'Excel', bclass: 'export', onpress : Exportar});\r\n// botones.push({separator: true});\r\n// botones.push({name: 'PDF', bclass: 'exportPdf', onpress : Exportar});\r\n// botones.push({separator: true});\r\n }\r\n}", "title": "" }, { "docid": "568de0e352087ab35215c5c708878f12", "score": "0.5382411", "text": "constructor(nombre,apellido,altura){ \n super(nombre,apellido,altura); //Esto srive para llamar al constructor de la clase padre.\n /* Esto es justamento lo que hace SUPER de la linea de arriba.\n this.nombre = nombre;\n this.apellido = apellido; \n */\n }", "title": "" }, { "docid": "ef50909adc27c83406ab98ea4d4c1165", "score": "0.53745675", "text": "function inicializar() {\n getElementos()\n .then(montarEsqueletoPagina)\n .then(carregarDadosDoBanco);\n //.finally(configurarFloatingLabels);\n\n //$('option').mousedown(function (e) {\n // e.preventDefault();\n\n // var select = this;\n // var scroll = select.scrollTop;\n\n // e.target.selected = !e.target.selected;\n\n // setTimeout(function () { select.scrollTop = scroll; }, 0);\n // Graficos.ddlChange(select.parentElement.id)\n // $(select).focus();\n //}).mousemove(function (e) { e.preventDefault() });\t\t\t\n\n }", "title": "" }, { "docid": "2f33fd0ae1f15ced2e8e374b1f58e675", "score": "0.5369916", "text": "ruido() {\n //y esta es la forma simplificada de crear metodos, sin \" : function \"\n console.log(\"ruidazo\");\n }", "title": "" }, { "docid": "083a762b66ab9069c087558d845857c8", "score": "0.53673023", "text": "function inicio(){\n\tmostrarCabecera();\n}", "title": "" }, { "docid": "c60ae077d45e5574c5b7e50dfc593432", "score": "0.5363571", "text": "function vistaPrevia() {\n // escondo elementos - funcion en main.js\n mostEsconComponet(document.getElementById('frame'), esconder);\n mostEsconComponet(document.getElementById('bars'), esconder);\n mostEsconComponet(document.getElementById('foot-subir'), esconder);\n // muestro elementos\n mostEsconComponet(document.getElementById('video-frame'), mostrar);\n mostEsconComponet(document.getElementById('firstTitle'), mostrar);\n\n return;\n}", "title": "" }, { "docid": "7d98b7a1b3db621f90ff7c9225cd8e67", "score": "0.53617436", "text": "function metodoRecursivo(){\n\n metodoRecursivo()\n}", "title": "" }, { "docid": "86b7cc078cf5b0ad06ab302fd4750ecd", "score": "0.5361373", "text": "function carritoUI(productos){\n //CAMBIAR INTERIOR DEL INDICADOR DE CANTIDAD DE PRODUCTOS;\n $('#carritoCantidad').html(productos.length);\n //VACIAR EL INTERIOR DEL CUERPO DEL CARRITO;\n $('#carritoProductos').empty();\n for (const producto of productos) {\n $('#carritoProductos').append(registroCarrito(producto));\n }\n //----------Agrego eventos a los botones de agregar, restar y eliminar\n $('.btn-delete').on('click', eliminarCarrito);\n $('.btn-add').on('click', agregraCarrito);\n $('.btn-sub').on('click', restarCarrito);\n\n}", "title": "" }, { "docid": "606e143ae4ea544df183cb692bb65473", "score": "0.5346914", "text": "crtajGlavnu(){\n let btnSnimi = kreirajEl(\"btnSnimi btn-secondary btn-sm\",\"button\",\"Snimi u .csv formatu\",this.container);\n btnSnimi.onclick = ev => this.snimiUFajl();\n this.crtajTabelu(this.container);\n let side = document.querySelector(\".side\");\n this.crtajPretragu(side);\n\n let dodajK = kreirajEl(\"dodajK btn btn-link\",\"button\",\"Dodaj kontakt\",side);\n dodajK.onclick = ev => {\n\n this.updateujTipove();\n\n let meni = document.querySelector(\".meniD\");\n if (meni.style.display == \"none\")\n meni.style.display = \"\";\n else\n meni.style.display = \"none\";\n }\n this.meniDodaj(side);\n\n let dodajB = kreirajEl(\"dodajB btn btn-link\",\"button\",\"Dodaj broj postojećem kontaktu\",side);\n dodajB.onclick = ev => {\n\n let meni = document.querySelector(\".meniBroj\");\n let select = meni.querySelector(\".sKontakt\");\n let opcije = this.nizZaBr();\n\n while (select.firstChild) {\n select.removeChild(select.lastChild);\n }\n\n opcije.forEach(opcija =>{\n kreirajEl(\"opcijaBr\",\"option\",opcija,select);\n })\n\n if (meni.style.display == \"none\")\n meni.style.display = \"\";\n else{\n meni.style.display = \"none\";\n }\n }\n this.meniDodajBroj(side);\n }", "title": "" }, { "docid": "ee17c90467b1030f2078f59327f40599", "score": "0.53460276", "text": "function runCLI() {\n inquirer\n // Prompt the user asking them what they want to do\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\n \"Add departments, roles, or employees\",\n \"View dapartments, roles, or employees\",\n \"Update employee roles\",\n \"Exit\"\n ]\n })\n // Depending on their answer, initiate a particular function\n .then(function(answer) {\n switch (answer.action) {\n case \"Add departments, roles, or employees\":\n add();\n break;\n\n case \"View dapartments, roles, or employees\":\n view();\n break;\n\n case \"Update employee roles\":\n updateRoles();\n break;\n\n case \"Exit\":\n connection.end();\n break;\n }\n });\n}", "title": "" }, { "docid": "f54f613dd07970e409017641cc207139", "score": "0.5345032", "text": "function iniciarBotones(){\n //EVENTO AL PRESIONAR EL BOTON DE CANCELAR\n $(\"#CancelarSorteo\").click(function(){\n limpiar();\n });\n //EVENTO AL PRESIONAR EL BOTON DE GUARDAR\n $(\"#GuardarSorteo\").click(function(){\n dialog = dialogNotificador();\n if( $(\"#txtIdsorteo\").val() == \"\"){\n \tif(validarCamposObligatorios()){\n \tdialog.open();\n \tguardarSorteo();\n \t}\n }else{\n \tif(validarCamposObligatorios()){\n \t dialog.open();\n \t actualizarSorteo()\n \t}\n }\n });\n\n }", "title": "" }, { "docid": "80fb804526a3912b4a17f9b4d6dbdf6d", "score": "0.53446996", "text": "function comprueba(){\ncompruebaVertical();\ncompruebaHorizontal();\ncompruebaOblicuoBaja();\ncompruebaOblicuoSube();\n\nquedanHuecos();\n}", "title": "" }, { "docid": "e24e3513ac0974320078c0a40f097c66", "score": "0.53445905", "text": "function construirRutina(){\n let sRutinaCliente = this.dataset.cedula;\n setcliente(sRutinaCliente);\n construirRutinaCliente();\n\n}", "title": "" }, { "docid": "6c7244d96dfbbfcf7dd5b4d6a4b7901d", "score": "0.5343337", "text": "function Client(){\n\tthis.run = function(){\n\t\t//Referencia al procedimiento anterior, solo como ilustacion\n\t\tvar old_interface = new Adaptee();\n\t\tvar costo = old_interface.request(\"1234\",\"321\",12.45);\n\t\tprint(costo);\n\n\t\tvar credents = \"user/pass\";\n\t\tvar adapter = new Adapter(credents);\n\t\t//utilizamos el nuevo, de la misma manera que el viejo\n\t\tvar new_cost = adapter.request(\"1234\",\"321\",12.45);\n\t\tprint(new_cost);\n\t}\n}", "title": "" }, { "docid": "deeaa4348822fa6651326e5178c13c58", "score": "0.5338151", "text": "function comprarCurso (e){\n e.preventDefault();\n //Delegation para agregar-carrito\n if(e.target.classList.contains('agregar-carrito')){\n const curso = e.target.parentElement.parentElement;\n //Enviamos el curso selecionado para leer sus datos\n leerDatosCurso(curso);\n }\n }", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "478a66caad7377a2ac53237514e2584f", "score": "0.5336915", "text": "function UI() {}", "title": "" }, { "docid": "b46da6c3d5a9040b42d81049b1c9cc03", "score": "0.5336502", "text": "constructor(titulo,descricao,remuneracao){\n this.titulo = titulo,\n this.descricao = descricao,\n this.remuneracao = remuneracao\n }", "title": "" }, { "docid": "c802a7105271b4350584f237125d75c7", "score": "0.53361505", "text": "constructor() {\n this.commands = this.getCommands(commands);\n }", "title": "" }, { "docid": "149f991d701ed22a79ff6810a500aad3", "score": "0.5330808", "text": "function ANTRemoteUI() {}", "title": "" }, { "docid": "a2cac9879ee6b14f17a92b914b7564e5", "score": "0.53307194", "text": "function inhabilitarControles(objName, deshabilitar){\r\n var obj = document.getElementById(objName); \r\n ejecutarFuncionRecursiva(obj, 0, deshabilitar);\r\n }", "title": "" }, { "docid": "b10fb3e701ea9be310e2f8555fdfb4ab", "score": "0.53238666", "text": "if ( argumentos . comprimento ) {\n\t\t\t opções de retorno === indefinido ?\n\t\t\t\teste :\n\t\t\t\tisso . cada ( função ( i ) {\n\t\t\t\t\tjQuery . deslocamento . setOffset ( this , options , i ) ;\n\t\t\t\t} ) ;", "title": "" }, { "docid": "e9f1f59941734ddddc1f0ae907689612", "score": "0.53229874", "text": "function exec() {\n var saudacao = \"fala bebe\"; //contexto lexo 2\n\n return saudacao;\n} //objeto sao grupos aninhados de pares e valores", "title": "" }, { "docid": "0592c035d60a6034d497d460c927e6c0", "score": "0.53214204", "text": "constructor(){\n this.sexo\n this.pais\n this.idioma\n }", "title": "" }, { "docid": "6599e2ad90b8c1545b49f7f6720fba02", "score": "0.53206766", "text": "function ocultar(){\r\n \r\n}", "title": "" }, { "docid": "4b197495d3790d938e729755fc3d4c1f", "score": "0.5319163", "text": "function GrabaCliente(){\n\n\tvar ListaCamposIDs='inNif+inNombre+inNacionalidad+inPaisOrigen+inFecha+inPaisDomicilio+inPoblacion+inDireccion+inPortal+inEmail+inTelefono+inMovil+inEstadoCivil+inRegimenEconomico+inProfesion+inCodigoCliente+inEntidad+inOficina+inDc+inCuenta+inLatitud+inLongitud';\n\tvar ListaParametros='xNIF=&xNombre=&xNacionalidad=&xPaisOrigen=&xFecha=&xPaisDomicilio=&xPoblacion=&xDIRECCION=&xPortal=&xemail=&xTelefono=&xmovil=&xEstadoCivil=&xRegimenEconomico=&xProfesion=&xCodigoCliente=&xEntidad=&xOficina=&xDC=&xCuenta=&xLatitud=&xLongitud=';\n\tvar ArrayParametros=ListaParametros.split('&');\n\tvar url_parametros='';\n\tvar xTipoAlta=document.getElementById(\"inTipoTercero\").value;\n\n\tdocument.getElementById(\"Cancelar\").style.visibility='hidden';\n\tdocument.getElementById(\"Grabar\").style.visibility='hidden';\n\t\n\t// Invocar a grabar\n\tActivaInterfazGrabando();\n\t\n\tArrayValores=PutFormInCursor(ListaCamposIDs);\n\n\t\n\tfor (x=0; x<=(ArrayValores.length-1); x++)\n\t{\n\t\turl_parametros+=ArrayParametros[x]+ArrayValores[x]+'&';\n\t}\n\t//alert(url_parametros);\n\t\n\t// Alta o modificación de los datos del cliente\n\tif(xTipoAlta=='N')\n\t PutData('Redmoon_php/ClienteAltaModifica.php', url_parametros);\n\t \n\t// Sujeto de un expediente podrá tener los siguientes valores\n\t// [T]itular [C]onyuge [S]ocio [A]valista\n\t// Titular del expediente creando el expediente\n\tif(xTipoAlta=='T')\n\t PutData('Redmoon_php/AltaExpeHipo.php', url_parametros);\n\t\n\tif((xTipoAlta=='C') || (xTipoAlta=='S') || (xTipoAlta=='A'))\n\t {\n\t\t url_parametros+=xIDExpe+'='+document.getElementById(\"inIDExpe\").value+'&xTipoTercero='+xTipoAlta;\n\t\t PutData('Redmoon_php/AddTerceroExpe.php', url_parametros);\n \t }\n\n\treturn true;\n\t\n}", "title": "" }, { "docid": "1914d70d963f6111a29be12792f254e1", "score": "0.5301471", "text": "function cargarCgg_soporte_tecnicoCtrls(){\nif(inRecordCgg_soporte_tecnico){\ntxtCsote_codigo.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_CODIGO'));\ntxtCsote_asunto.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_ASUNTO'));\ntxtCsote_numero.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_NUMERO'));\ntxtCsote_descripcion.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_DESCRIPCION'));\ntxtCsote_contacto.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_CONTACTO'));\nnumCsote_atendido.setValue(inRecordCgg_soporte_tecnico.get('CSOTE_ATENDIDO'));\nisEdit = true;\nhabilitarCgg_soporte_tecnicoCtrls(true);\n}}", "title": "" }, { "docid": "18642e92bd869c89f36ec4b544dcbaea", "score": "0.5300433", "text": "construirViaje(pasajeroDestino) {\n let esenario = this.siatuacionPasajero(pasajeroDestino);\n if (esenario === dondeEsta.FUERA) {\n return this.recomendarEstacion(pasajeroDestino, esenario);\n }\n if (esenario === dondeEsta.ESTACION) {\n return this.avisarArriboTren(pasajeroDestino, esenario);\n }\n if (esenario === dondeEsta.VIAJE) {\n return this.crearViaje(pasajeroDestino, esenario); //armar el viaje\n }\n\n }", "title": "" }, { "docid": "593181458a0838a1ef42806410165b50", "score": "0.5299604", "text": "function jugarIA(){\r\n\tdestruirMenu();\r\n\tmodoDeJuego = 1;\r\n\ttexto2 = \"Bienvenido a gato master 2000\";\r\n\t// La funcion esta en el archivo TicTacToe.js\r\n\t//jugar(modoDeJuego);\r\n}", "title": "" }, { "docid": "6bcaf5c4c628e96caf31304a3fac4041", "score": "0.5287601", "text": "function irNuevoRegistro(){\n\t\n\t//mostrar modulo de Nuevo Registro de Acta de Celebracion\n\tfnRegistrarCita();\n\t//fnCargarContenido(\"cargarRegistroActa.htm\", null, \"#contenido\");\n\t\n}", "title": "" }, { "docid": "f299315f35601971e6afddebe2ba9157", "score": "0.5285234", "text": "loadCommands(){\n\n var enfin= axios.get('http://localhost:3001/offers').then(response => response.data.data)\n .then(data => {\n data.forEach(function (d) {\n users.push(d.Title)\n console.log(d.Title)\n })\n this.ch+=users.join();\n console.log(this.ch);\n return users.join();\n }\n );\n console.log(enfin);\n let internets=\"\"\n internets= enfin.then(function(value) {\n console.log(value);\n });\n //console.log(Promise.resolve(enfin));\n //console.log(JSON.stringify(users));\n let Artyom = this._artyom;\n let TypesOfServices=\"which of services internet or communication ?\";\n let InternetOffers=\"500 Mega octet internet cost 30 dollar per day, 1 gega octet cost 50 dolar per day, you are welcome\";\n let communicationOffers=\"24 hour cost 50 dollar ,1 hour cost 10 dollar, you are welcome\";\n // Here you can load all the commands that you want to Artyom\n return Artyom.addCommands([\n {\n indexes: [\"Offers\", \"I want Offers\"],\n action: () => {\n Artyom.say(TypesOfServices);\n }\n },\n {\n indexes: [\"internet\",\"i want internet offers\"],\n action: () => {\n Artyom.say(InternetOffers);\n }\n },\n {\n indexes: [\"communication\",\"i want communication offers\"],\n action: () => {\n Artyom.say(communicationOffers);\n }\n },\n {\n indexes: [\"what is your name\",\"name\"],\n action: () => {\n Artyom.say(\"I am SFM boot nice to meet you\");\n }\n },\n {\n indexes: [/How are you/, /Regular expressions supported/],\n smart: true,\n action: () => {\n Artyom.say(\"I'm fine, thanks for asking !\");\n }\n },\n {\n indexes: [\"Generate reports of * of this year\"],\n smart: true,\n action: (i, month) => {\n let year = new Date().getFullYear();\n\n Artyom.say(`Generating reports of ${month} ${year} `);\n\n Artyom.say(\"Ready ! What were you expecting? write some code you lazy bear !\");\n }\n },\n ]);\n }", "title": "" }, { "docid": "abdff9f338df542ab6c66b94ff962fb2", "score": "0.5276935", "text": "function appelerMenu1(id,no){\n\t\taction=prompt(\"A1,A2 pour attaquer | S pour sacrifier\");\n\t\tnoAtt= action.substring(1);\n\t\tconsole.log(\"-----------------------MEN1\");\n\t\tconsole.log(\"EN ATT:\"+noAtt);\n\t\tconsole.log(\"Carte no: \"+(no-1));\n\t\tc = jeu_me[no-1];\n\t\tconsole.log(\"CARTE: \"+c.id_div);\n\t\t\n\t\tswitch(action){\n\t\t\tcase \"A1\":\n\t\t\tcase \"A2\":\n\t\t\t\tif (cim.length<c.cout){\n\t\t\t\t\talert(\">>pas assez de créatures ds le cimetière !!!\");\n\t\t\t\t}else{\n\t\t\t\t\t//récupére no ATT\n\t\t\t\t\tnoAtt= action.substring(1);\n\t\n\t\t\t\t\t//placer la carte en ATT\n\t\t\t\t\tif (att_me[noAtt-1]== 0){\n\t\t\t\t\t\tc.etat = (noAtt==1?ETAT_ATT1:ETAT_ATT2);\n\t\t\t\t\t\tatt_me[noAtt-1] = c;\n\t\t\t\t\t\tplacerCarteEnAttaque(id,noAtt);\n\t\t\t\t\t\t//retirer des cartes en jeu\n\t\t\t\t\t\tjeu_me[no-1]='undefined';\n\t\t\t\t\t}else{\n\t\t\t\t\t\talert(\">>Attaque déjà occupée !\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.log(\"APS ATT1 ou ATT2------------\");\n\t\t\t\tafficherJeux();\n\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase \"S\":\n\t\t\t\tc.etat= ETAT_CIM;\n\t\t\t\tposerCarteDansCimetiere(c);\n\t\t\t\t//effacement carte\n\t\t\t\t$(id).hide(2000);\n\t\t\t\t\n\t\t\t\tjeu_me[no-1]=\"undefined\";\n\t\t\t\t\n\t\t\t\tconsole.log(\"APS SACRICFICE------------\");\n\t\t\t\t\n\t\t\t\tafficherJeux();\n\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t}\n\t}", "title": "" }, { "docid": "7af65dfd2119cd17ecf17d45cf66afc7", "score": "0.5276104", "text": "imprimirDatosCamioneta(){\n this.imprimirDatos();\n console.log(`-----Turbado => ${this.turbo}-----`);\n }", "title": "" }, { "docid": "0c35bf3ac9ebacabf63db2ab06cd9b22", "score": "0.5271405", "text": "function ingresar_auto(){\n \nauto1.ingresar_datos();\n}", "title": "" }, { "docid": "73a738767b12468197267beeb8d84a77", "score": "0.5265063", "text": "function CConstanciaFideicomiso(){\n var wfide = new WFideicomiso();\n var ruta = Conn.URL + \"militar/pace/consultarbeneficiario/\" + $(\"#txtcedula\").val();\n CargarAPI(ruta, \"GET\", wfide, wfide);\n}", "title": "" }, { "docid": "4d9812537ddac41109011e5dcf61a93f", "score": "0.52634275", "text": "constructor() {\n this.initalizeCliOptions()\n this.initalizeSpecialCharacterMapping()\n }", "title": "" }, { "docid": "f0fbaac4cce9f5c4ca579c50b02f81e9", "score": "0.52633744", "text": "function carritoUI(productos){\n\t$('#carritoCantidad').html(productos.length);\n\t$('#carritoProductos').empty();\n\tfor (const producto of productos) {\n\t $('#carritoProductos').append(registroCarrito(producto));\n\t}\n\t//AGREGAR TOTAL\n\t$('#carritoProductos').append(`TOTAL <span class=\"badge badge-warning\">${totalCarrito(carrito)}</span>`)\n\t//ASOCIO LOS EVENTOS A LA INTERFAZ GENERADA\n\t$('.btn-delete').on('click', eliminarCarrito);\n\t$('.btn-add').click(addCantidad);\n\t$('.btn-sub').click(subCantidad);\n }", "title": "" }, { "docid": "2d86ba4f147bb619fba685ef3fa27b96", "score": "0.5263191", "text": "function Interfaz(){}", "title": "" }, { "docid": "2431255a73fba8233a26e6a0d54dcf38", "score": "0.52630585", "text": "function reativarRechamar(){\n ativar('bt_chamar_voz, bt_rechamar, bt_iniciar_atendimento, bt_cancelar');\n reativaRechamar();\n}", "title": "" }, { "docid": "67a726880b561815ddf3b05d4b01af10", "score": "0.5257566", "text": "function controleur(){\r\n\r\n\t//vérifions qu'il n'y a qu'un calque sélectionné \r\n\t if (app.project.activeItem.selectedLayers.length == 1) {\r\n\t\t\t// début de groupe d'annulation\r\n\t\t\tapp.beginUndoGroup(\"Duik - Controleur \" + app.project.activeItem.selectedLayers[0].name);\r\n\t\t\taddController(app.project.activeItem.selectedLayers[0]);\r\n\t\t\t//fin du groupe d'annulation\r\n\t\t\tapp.endUndoGroup();\r\n\t\t} else { alert(getMessage(11)); }\r\n\r\n}", "title": "" }, { "docid": "69e5ab6c833d416cb2d977d15faa68f4", "score": "0.5256216", "text": "init () {\n // TODO: Iron out this abstraction in vanilla js\n // https://github.com/inversify/inversify-vanillajs-helpers\n if (this.cmd in TOP_COMMANDS) {\n // this.container\n }\n }", "title": "" }, { "docid": "18ae810295110d5bc18f3aaeb8065b50", "score": "0.5255712", "text": "function notificar_cargado() {\n const funcionNotificadora = krpano.get('notificar')\n if(funcionNotificadora){\n funcionNotificadora()\n }\n }", "title": "" }, { "docid": "4a3bd67bc2611f6f5bae23e6d7e42207", "score": "0.5249977", "text": "function voltarAoInicio(){\n console.log(\"DIRECIONANDO O USUÁRIO PARA A VIEW PRINCIPAL\");\n $JSView.goToView('home');\n \n carregarConteudo();\n \n procMenu(1);\n\n \n}", "title": "" }, { "docid": "0df0f989476e6bf2ba035be9e9400834", "score": "0.52484906", "text": "initConsoles() {\r\n var consolaEventos = Consola_1.Consola.getConsola('consolaEventos');\r\n consolaEventos.init('consolaEventos');\r\n var consolaEstadosMentales = Consola_1.Consola.getConsola('consolaEstadosMentales');\r\n consolaEstadosMentales.init('consolaEstadosMentales');\r\n }", "title": "" }, { "docid": "951395e9f6f930989eb91c04aafec1d3", "score": "0.52483314", "text": "function mostrarMascota(id) {\n cargarDatos(miServidor + 'mascotaById/' + id, false);\n}", "title": "" }, { "docid": "ba489b8bb134cec5cd905b12ac54ec55", "score": "0.5248073", "text": "function UI(){}", "title": "" }, { "docid": "ba489b8bb134cec5cd905b12ac54ec55", "score": "0.5248073", "text": "function UI(){}", "title": "" }, { "docid": "ba489b8bb134cec5cd905b12ac54ec55", "score": "0.5248073", "text": "function UI(){}", "title": "" }, { "docid": "734dea6a6c06cc4d3bef5fcbaa7aa3b8", "score": "0.5244661", "text": "constructor(marca, modelo, pulgadas) {\n this.marca = marca;\n this.modelo = modelo;\n this.pulgadas = pulgadas;\n }", "title": "" }, { "docid": "42d64163d40e48a965ca56de0b07de6b", "score": "0.5239691", "text": "function distribuirEasy(){\n\tvar pregunta = comprobarPregunta();\n\tvar respuestaSelecionada;\n\taugIntentos();\n\n\tif (pregunta === \"f\" || pregunta === \"m\") {\n\t\trespuestaSelecionada = comprobarSexo(\"selecionada\");\n\t\tescribirPreguntas(pregunta, respuestaSelecionada);\n\t\tcomprobarRestantes(\"sexo\", respuestaSelecionada, pregunta);\n\t}\n\telse if (pregunta === \"moreno\" || pregunta === \"castanyo\" || pregunta === \"rubio\") {\n\t\trespuestaSelecionada = comprobarPelo(\"selecionada\");\n\t\tescribirPreguntas(pregunta, respuestaSelecionada);\n\t\tcomprobarRestantes(\"pelo\", respuestaSelecionada, pregunta);\n\t}\n\telse if (pregunta === \"si\" || pregunta === \"no\") {\n\t\trespuestaSelecionada = comprobarGafas(\"selecionada\");\n\t\tescribirPreguntas(pregunta, respuestaSelecionada);\n\t\tcomprobarRestantes(\"gafas\", respuestaSelecionada, pregunta);\n\t}\t\n}", "title": "" }, { "docid": "3de8ec0dd2324d98dc0f9b57dbff050d", "score": "0.5239126", "text": "function mostrarLibrosCT(respuesta){\n\tlistaFiltro=true;\n\trespuestaLibros(respuesta);\n}", "title": "" }, { "docid": "205470e002d48cfb275e2dd79252c212", "score": "0.523734", "text": "function extrasCredito(tipoCredito) {\n\n if (tipoCredito == 'Credioro') {\n\n pantallaCredioro.style.display = 'flex';\n //Se define el pais del giro a enviar\n for (let index = 0; index < credioro.length; index++) {\n credioro[index].addEventListener('click', () => {\n extrasTramite = credioro[index].value;\n enviarDatosCliente();\n pantallaCredioro.style.display = 'none';\n pantallaCreditos.style.display = 'none';\n });\n }\n } else {\n extrasTramite = 'Ningun extra';\n pantallaCredioro.style.display = 'none';\n pantallaCreditos.style.display = 'none';\n enviarDatosCliente();\n }\n}", "title": "" }, { "docid": "829f1526c44a30bbc3372ca89d7bd08a", "score": "0.523035", "text": "function newComunicazione(chi) {\n var tipo = $(chi).attr(\"value\");\n var destinatario = $(chi).parents('li').find('a').attr(\"href\").substr(1);\n $('body').css('cursor', 'wait');\n PT.VIEW.getInstanceSubjectView().fireEvent(\"NuovaChiamata\", {destinatario: destinatario, tipo: tipo});\n}", "title": "" } ]
d53aa39458639cd6a147539ea8b9b480
Event listener for when playback ends.
[ { "docid": "d0a8a0f5be4dc90fdc18406d075f07a9", "score": "0.7214389", "text": "onEnded () {\n this.emit('stop');\n\n this.isPlaying = false;\n }", "title": "" } ]
[ { "docid": "3f89be262a89c5476982f4b3287d8c4b", "score": "0.75345105", "text": "_onEnd() {\n var player = this;\n player.ended = true;\n player.isPlaying = false;\n player.$.replay.style.opacity = 1; // display Replay icon\n // Dispatch 'Ended' event to GA\n if (!!player.gaId) this._dispatchGAEvent('Ended');\n }", "title": "" }, { "docid": "91cfef6eedf7aa6aca55bf179a8beca3", "score": "0.75332046", "text": "function onFinish() {\n\t\t\t\t\t\t\t$f(playerID).addEvent('finish',\n\t\t\t\t\t\t\tfunction(data) {\n\t\t\t\t\t\t\t\tonVideoEndTrigger();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}", "title": "" }, { "docid": "c80f45ceaccd0e92b155cb42f97f3ccd", "score": "0.7131491", "text": "onEnded() {\n\t\tthis.Splide.emit( 'video:ended', this );\n\t\tthis.state.set( IDLE );\n\t}", "title": "" }, { "docid": "4f616c3bfc42a416a039694b7cdddd94", "score": "0.7102411", "text": "function onEnded () {\n\n isSongFinished = true;\n\n // Ensures that the sound wave shows 'Play' when the song ends & also that the variable musicPlaying is changed to the boolean false\n // at the end of the song\n // stopAnimations();\n\n if (enableLogging === true) {\n console.log(`Song finished playing ${isSongFinished}`);\n console.log('Now we have the choice between playing another song or replaying this one');\n }\n\n}", "title": "" }, { "docid": "c4090b33545f719c9f08b7b166ae37e0", "score": "0.699326", "text": "function _videoEnded(event) {\n console.log('videoEnded', self.loop, event);\n sendEvent('complete');\n }", "title": "" }, { "docid": "db2df30e2c23e22a267f46296da31db4", "score": "0.6848999", "text": "function bindSongEnded(){_config2.default.audio.removeEventListener(\"ended\",_ended2.default.handle);_config2.default.audio.addEventListener(\"ended\",_ended2.default.handle)}", "title": "" }, { "docid": "86e61d8c433609078504b6be2859844e", "score": "0.670286", "text": "function _onEnd() {\n if (queueSongs.length) {\n autoPlayNextInQueue();\n } else if (playList.length) {\n autoPlayNextInPlayList();\n }\n }", "title": "" }, { "docid": "fbc4e691a98a35c331115cdb87a84f3a", "score": "0.65975463", "text": "endSeek() {\r\n if (this.isSeeking && this.wasPlaying === true)\r\n this.play();\r\n this.wasPlaying = false;\r\n this.isSeeking = false;\r\n }", "title": "" }, { "docid": "4c99c7f8edeed3c9ccb43edd58f18099", "score": "0.6595318", "text": "function onSoundEnd(){\n\t\tpassedGameSound.removeEventListener('ended', onSoundEnd, false);\n\t\t//set to true when sound is done playing\n\t\tsoundEnded = true;\n\t\t//calls the check assets so that it runs the rest of teh code of the next level image function\n\t\tcheckAssets();\n\t}", "title": "" }, { "docid": "3862f3842e8070b3fe35e91ad8724a5a", "score": "0.6592118", "text": "function bindSongEnded() {\n config.audio.removeEventListener(\"ended\", Ended.handle);\n config.audio.addEventListener(\"ended\", Ended.handle);\n }", "title": "" }, { "docid": "c1fc8792f9a42d05127c274939d0071c", "score": "0.6551411", "text": "function end_trial() {\n\n\t\t\t// stop the audio file if it is playing\n\t\t\t// remove end event listeners if they exist\n\t\t\tif(context !== null){\n\t\t\t\tsource.stop();\n\t\t\t\tsource.onended = function() { }\n\t\t\t} else {\n\t\t\t\taudio.pause();\n\t\t\t\taudio.removeEventListener('ended', end_trial);\n\t\t\t}\n\n // kill any remaining setTimeout handlers\n jsPsych.pluginAPI.clearAllTimeouts();\n\n // gather the data to store for the trial\n var trial_data = {\n \"rt\": response.rt,\n \"stimulus\": trial.stimulus\n };\n\n // clear the display\n display_element.innerHTML = '';\n\n // move on to the next trial\n jsPsych.finishTrial(trial_data);\n }", "title": "" }, { "docid": "bcbdfe2bef4b944ae2a32352945417ed", "score": "0.6539969", "text": "$mediaplayerEnded() {\n console.log(\"$mediaplayerEnded\")\n }", "title": "" }, { "docid": "45258778daca0bd387e04b560c6078bb", "score": "0.6527897", "text": "function onEndPlayList() {\r\n if (sequenciador.activeLoop && (!sequenciador.stopFlag) && (!sequenciador.activePause)) {\r\n\r\n sequenciador.activePlay = false;\r\n sequenciador.play();\r\n } else {\r\n\r\n if (sequenciador.activePause) {\r\n sequenciador.activePlay = false;\r\n $('#buttonPause').addClass(\"active\");\r\n $('#buttonPlay').removeClass(\"active\");\r\n } else {\r\n sequenciador.activePlay = false;\r\n sequenciador.unPause();\r\n controlPainel.releasePanel();\r\n $('#buttonStop').addClass(\"active\");\r\n $('#buttonPlay').removeClass(\"active\");\r\n $('#buttonPause').removeClass(\"active\");\r\n }\r\n }\r\n}", "title": "" }, { "docid": "7eadda5603ca4975224fc4b37e333b92", "score": "0.65004903", "text": "endTrial() {\n this.stopRecorder();\n if (this.get('endAudioSources').length) {\n $('#player-endaudio')[0].play();\n } else {\n this.send('finish');\n }\n }", "title": "" }, { "docid": "3198650d837058e6a7cb1e00b4e21465", "score": "0.64967245", "text": "function end_trial() {\r\n\r\n\t\t\t// stop the audio file if it is playing\r\n\t\t\t// remove end event listeners if they exist\r\n\t\t\tif(context !== null){\r\n\t\t\t\tsource.stop();\r\n\t\t\t\tsource.onended = function() { }\r\n\t\t\t} else {\r\n\t\t\t\taudio.pause();\r\n\t\t\t\taudio.removeEventListener('ended', end_trial);\r\n\t\t\t}\r\n\r\n // kill any remaining setTimeout handlers\r\n jsPsych.pluginAPI.clearAllTimeouts();\r\n\r\n // gather the data to store for the trial\r\n var trial_data = {\r\n \"rt\": response.rt,\r\n \"stimulus\": trial.stimulus,\r\n \"button_pressed\": response.button\r\n };\r\n\r\n // clear the display\r\n display_element.innerHTML = '';\r\n\r\n // move on to the next trial\r\n jsPsych.finishTrial(trial_data);\r\n }", "title": "" }, { "docid": "4cca60f93ca6998465cffba7e1e2e946", "score": "0.649012", "text": "function ended(session) {\n\t\t\t\t set_icon('facetime-video');\n\t\t\t\t img_out.innerHTML = '';\n\t\t\t\t sounds.play('sound/goodbye');\n\t\t\t\t console.log(\"Bye!\");\n\t\t\t\t}", "title": "" }, { "docid": "f3296598c8462a82c22fc1601702056f", "score": "0.6481841", "text": "function finish() {\n\taudioTrack.currentTime = 0;\n\t$(playButton).removeClass(\"pause-btn\");\n\t$(playButton).addClass(\"play-btn\");\n}", "title": "" }, { "docid": "fe259449575c8443be35a7ebdceed50e", "score": "0.6471928", "text": "onVideoEnded () {\n\t\tthis.wrapperPlayer.classList.replace('v-playing', 'v-paused')\n\t\tthis.wrapperPlayer.classList.add('v-firstStart')\n\t\tthis.wrapperPlayer.querySelector('.v-poster').classList.add('v-active')\n\n\t\tif (this.options.controls) {\n\t\t\tthis.wrapperPlayer.querySelector('.v-progressSeek').style.width = '0%'\n\t\t\tthis.wrapperPlayer.querySelector('.v-progressInput').setAttribute('value', 0)\n\t\t\tthis.wrapperPlayer.querySelector('.v-currentTime').innerHTML = '00:00'\n\t\t}\n\t}", "title": "" }, { "docid": "54618512a229065c42a79fc786da0ff7", "score": "0.6451074", "text": "end (event) {\n }", "title": "" }, { "docid": "0826ecc5c282f0c925e119cc6eec3208", "score": "0.6433029", "text": "function endVideo() {\r\n\tvideoSession.close();\r\n}", "title": "" }, { "docid": "0826ecc5c282f0c925e119cc6eec3208", "score": "0.6433029", "text": "function endVideo() {\r\n\tvideoSession.close();\r\n}", "title": "" }, { "docid": "6df8ee93c0265c4067c46eb1320d9fc1", "score": "0.6420917", "text": "function onStreamEnd() {\n this.end = true;\n this.queue.concurrency = 1;\n }", "title": "" }, { "docid": "c5a219c3b2519ce641ab20c5ac9be21e", "score": "0.6417117", "text": "end() {\n console.log('[PLAY] end')\n\n this.sound.play('explosion')\n this.registry.destroy()\n this.events.off()\n game.scene.switch('play', 'end')\n this.cursors.right.isDown = false\n this.cursors.left.isDown = false\n\n console.log('[PLAY] CURSORS OFF')\n this.scene.stop()\n }", "title": "" }, { "docid": "8818a08aaedb57ea2d708ea87c37f5bf", "score": "0.64107037", "text": "function endSound (e) {\n const key = document.querySelector(`.key[data-key=\"${e.keyCode}\"]`);\n if(!key) return;\n key.classList.remove('playing');\n }", "title": "" }, { "docid": "61f2ee45406df611e3b1fa3272d98c41", "score": "0.6398298", "text": "function videoDone() {\n // clearInterval(intervalID);\n // console.log(\"video done called\");\n}", "title": "" }, { "docid": "6878052b6a039d9b732c0190e3f21f58", "score": "0.6396653", "text": "function end_music() {\n //console.log('END MUSIC!');\n $('#end_music').trigger('play');\n}", "title": "" }, { "docid": "1d1cc0c6d29ba71baf314391a6acf987", "score": "0.637653", "text": "function onTouchEnd(touchEvt) {\n thisGame._playerManager.onTouchEnd(touchEvt);\n }", "title": "" }, { "docid": "75534d3bc8f47ce6dece57f2585eddbc", "score": "0.6376365", "text": "function mediaended() {\n // clean up after we end the recording\n $('#listen')\n .removeClass('on')\n .text('Listen');\n }", "title": "" }, { "docid": "5336198dd4fd715c6ce80215f5665ee6", "score": "0.6350639", "text": "function onEnd() {\n\t\t\tthis.logger.info('[receiver-service][onSubscribe > onEnd] Receiver data stream stopped');\n\t\t}", "title": "" }, { "docid": "766744bf2fe0f5ba7d567c3aa26f1209", "score": "0.6347677", "text": "onChangeEnd() {\n // They just let go of the seek bar, so cancel the timer and manually\n // call the event so that we can respond immediately.\n this.seekTimer_.tickNow();\n this.controls.setSeeking(false);\n\n if (this.wasPlaying_) {\n this.video.play();\n }\n }", "title": "" }, { "docid": "ea5d522a366a62a4b378339cb95ccdd5", "score": "0.63319427", "text": "function ended(session) {\n clearInterval(thumbnail.ival);\n thumbnail.ival = 0;\n set_icon('facetime-video');\n img_out.innerHTML = '';\n \n $(\".contacts\").addClass(\"display-none\");\n $(\"#chat_view\").addClass(\"display-none\");\n\n sounds.play('sound/goodbye');\n console.log(\"ended\");\n}", "title": "" }, { "docid": "b64bbb930f8b2a4f1ceb2efe617e44fc", "score": "0.6325447", "text": "function stop() {\n if (track.readyState === 'ended') {\n log.debug('Track already ended.');\n return;\n }\n\n track.stop();\n /**\n * Treat stopping the track the same as it being ended.\n * Normally, onended is not triggered when `stop` is called, only when it is\n * \"remotely ended\".\n */\n track.onended();\n }", "title": "" }, { "docid": "ac0c1a4e2273c60c65e8d25291547e59", "score": "0.63230896", "text": "function end_trial() {\n\n\t\t\t// stop the audio file if it is playing\n\t\t\t// remove end event listeners if they exist\n audio.pause();\n audio.onended = null;\n \n // kill any remaining setTimeout handlers\n jsPsych.pluginAPI.clearAllTimeouts();\n\n // gather the data to store for the trial\n var trial_data = {\n \"rt\": response.rt,\n \"stimulus\": JSON.stringify(trial.stimulus),\n \"button_pressed\": response.button,\n \"play_history\": JSON.stringify(play_history)\n };\n\n // clear the display\n display_element.innerHTML = '';\n\n // move on to the next trial\n jsPsych.finishTrial(trial_data);\n }", "title": "" }, { "docid": "036dd0ed2fab26e86ef08a68a2a14562", "score": "0.63108665", "text": "end(event) { }", "title": "" }, { "docid": "e61642fbbe6e2c4013fe90b9c71186a4", "score": "0.6306741", "text": "onSpeechEnd(event) {\n if (this.keepAlive) {\n this.speech.start();\n } else {\n this.isRunning = false;\n this.removeAttribute('listening');\n this.dispatchEvent(event);\n }\n }", "title": "" }, { "docid": "14c0bbddea75a18ab7e9e713eaee95d9", "score": "0.6303208", "text": "stopPlaying() {\n if(this.ended) {\n return;\n }\n this.ended = true;\n if(this.current && this.current.timeout) {\n clearTimeout(this.current.timeout);\n this.current.timeout = null;\n }\n this.current = null;\n this.piper.stop();\n this.piper.resetPackets();\n\n this.setSpeaking(this.playing = false);\n\n /**\n * Fired when the shared stream finishes playing a stream\n * @event SharedStream#end\n */\n this.emit(\"end\");\n }", "title": "" }, { "docid": "ced463fc79e281198ee2104ddcf00878", "score": "0.6275823", "text": "end() {\n\n this.ended = true;\n\n console.log(\"Game End\");\n\n this.updateWinner();\n\n }", "title": "" }, { "docid": "92b845c184ff6b0ca257566dad87a2e5", "score": "0.626002", "text": "end (event) {\n \n\n\n }", "title": "" }, { "docid": "64f6f81600c45b4fc75b2b93830a3c67", "score": "0.62571055", "text": "function endAudioStream() {\n if (context.state != \"closed\") {\n context.close();\n }\n}", "title": "" }, { "docid": "a23257c942909098dd7fd26df6aadd59", "score": "0.62470925", "text": "function onend() {\n\t\tif (didOnEnd) { return; }\n\n\t\tdidOnEnd = true;\n\t\tdest.end();\n\t}", "title": "" }, { "docid": "dc0167c848486549c6380ff002db6fd4", "score": "0.6215583", "text": "function onEnd() {\n\t\tthis.queue( null );\n\t}", "title": "" }, { "docid": "bd3e19cce73cf3e0f32d2d3eb3fb5ec8", "score": "0.6214275", "text": "endGame() {\n this.players.forEach(player => player.handleGameEnd());\n }", "title": "" }, { "docid": "9f43dedba3534e68243ff4b0a2a40f37", "score": "0.6178728", "text": "function stopRepeat() {\n playCount = 0;\n player.removeEventListener('ended');\n }", "title": "" }, { "docid": "aec546a26f749a390ed554a20c9f6fec", "score": "0.6176002", "text": "function onPlayerStateChange(event) {\r\r\n if (event.data == YT.PlayerState.ENDED ) {\r\r\n event.target.stopVideo();\r\r\n }\r\r\n}", "title": "" }, { "docid": "a6dd240570053086711d9e20eba3a1be", "score": "0.6153873", "text": "onEndOfSpeech(handler) {\n this.eosHandler = handler;\n }", "title": "" }, { "docid": "c70bd15ac615976da08bf1b8adcc13c9", "score": "0.6093051", "text": "finish() {\n const self = this;\n this.log.log(\"finishing replay\");\n if (this.getStatus() === ReplayState.STOPPED) {\n return;\n }\n this.updateStatus(ReplayState.STOPPED);\n this.pause();\n this.time = new Date().getTime() - this.startTime;\n this.record.stopRecording();\n // save the recorded replay execution\n setTimeout(() => {\n var _a;\n const replayEvents = self.record.getEvents();\n const scriptId = self.scriptId;\n if (params_1.RingerParams.params.replay.saveReplay &&\n scriptId &&\n replayEvents.length > 0) {\n (_a = self.scriptServer) === null || _a === void 0 ? void 0 : _a.saveScript(\"replay \" + scriptId, replayEvents, scriptId, \"\");\n self.log.log(\"saving replay:\", replayEvents);\n }\n }, 1000);\n setTimeout(() => {\n if (self.cont) {\n self.cont(self);\n }\n }, 0);\n }", "title": "" }, { "docid": "2805aa283a0a72cd98da2d210f93eef0", "score": "0.60929793", "text": "get ended() {\n return this.playback.ended\n }", "title": "" }, { "docid": "da63a8aa4dba361b8d67730d880be8d9", "score": "0.60767573", "text": "_animationDoneListener(event) {\n this._animationEnd.next(event);\n }", "title": "" }, { "docid": "da63a8aa4dba361b8d67730d880be8d9", "score": "0.60767573", "text": "_animationDoneListener(event) {\n this._animationEnd.next(event);\n }", "title": "" }, { "docid": "83a54d812e277f08dcbb5d1e23c8000a", "score": "0.60639024", "text": "function videoEndHandler0(e) {\n creative.dom.video0.vid.currentTime = 21;\n creative.dom.video0.vid.pause();\n creative.isClick0 = true;\n}", "title": "" }, { "docid": "da717bc965413a21f0d8d4dde8ace08d", "score": "0.6060274", "text": "function onEndPlayNext(){\n\t\t\tif(!setReplay&&currentListTrack<(listArray.length-1)){\n\t\t\t\tif(!setShuffle){\t\t\t\t\t\n\t\t\t\t\tcurrentListTrack++;\t\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\tshuffleNumber();\n\t\t\t\t}\n\t\t\t\t replaceSounds(currentListTrack);\n\t\t\t\t createTextPlayer(currentListTrack);\t\t\t\t \n\t\t\t\t audioPlayer.load();\n\t\t\t\t \n\t\t\t}\n\t\t\tif(setReplay){\n\t\t\t\tif(!setShuffle){\n\t\t\t\t\tif(currentListTrack<(listArray.length-1)){\n\t\t\t\t\t\tcurrentListTrack++;\n\t\t\t\t\t}else{\t\t\t\t\t\n\t\t\t\t\t\tcurrentListTrack=0;\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tshuffleNumber();\n\t\t\t\t}\n\t\t\t\t replaceSounds(currentListTrack);\n\t\t\t\t createTextPlayer(currentListTrack);\t\t\t\t \n\t\t\t\t audioPlayer.load();\n\t\t\t\t \n\t\t\t}\n\t\t}", "title": "" }, { "docid": "ef6ed9f999ef49257975a938fd22e010", "score": "0.6019114", "text": "end() {\n this.ended = true;\n // Mark all pendingStreams as ended.\n for (const pendingStream of this.pendingStreams.allStreams) {\n pendingStream.push(null);\n }\n }", "title": "" }, { "docid": "fc7bdd5cb627d99683415b28d80b3108", "score": "0.6011917", "text": "function onAudioProgressEvent(){\r\n\t\t\taudioObject.removeEventListener(\"ended\", onAudioProgressEvent);\r\n\t\t\tif(increment<$scope.audioArray.length-1){\r\n\t\t\t\taudioLoadingCompleted();\r\n\r\n\t\t\t}else{\r\n\t\t\t\tsharedService.broadcastItem('triggerAudioPlayer');\r\n\t\t\t\tsharedService.broadcastItem('audioCompleted')\r\n\t\t\t\tsharedService.isPlaying=false;\r\n\t\t\t}\r\n\r\n\t\t}", "title": "" }, { "docid": "4bc76b214b9c490018b62c84ff353837", "score": "0.6010768", "text": "function onPlayerReady(event) {\n event.target.stopVideo();\n }", "title": "" }, { "docid": "b79bf6f197d2dba308735372e5a588e1", "score": "0.5997977", "text": "function endAudio() {\r\n\t// Close down connection to network.\r\n\taudioSession.close();\r\n}", "title": "" }, { "docid": "a93dda3e4e13d6df06c57632e7ebaf74", "score": "0.59955925", "text": "function stop() {\r\n if (_state === self.PLAYING) {\r\n _source.noteOff(0);\r\n _source = null;\r\n }\r\n _offset += (_ctx.currentTime - _startTime);\r\n\r\n clearTimeout(_finishEvent);\r\n }", "title": "" }, { "docid": "76e9269dcb2be979452fecd4e97db70a", "score": "0.59806323", "text": "function onEnd() {\n recognitionObject.onend = function () {\n if (recognitionOn) {\n recognitionObject.start();\n }\n };\n}", "title": "" }, { "docid": "0bd4d9ac65715548ad399a649d937f1a", "score": "0.5979537", "text": "function myFunctionEnd1() {\n alert(\"The audio has ended, please move along.\");\n}", "title": "" }, { "docid": "f0eba6935e50efaacb46b57fbde45282", "score": "0.5960483", "text": "detached() {\n this.mediaPlaylist.removeEventListener('currentitemchanged', this.onItemChanged.bind(this))\n this.mediaPlayer.close();\n }", "title": "" }, { "docid": "2cef634edf12dd2f6a6353d85030b678", "score": "0.59441864", "text": "static onEndPlayTurn(event) {\n Utils.updateActivePlayerBox(party.currentPlayer.number, party.nextPlayer.number);\n Utils.resetGameActionBox(party.nextPlayer);\n\n // avancer au joueur suivant (party.currentPlayer = nextplayer...)\n party.shiftToNextPlayer();\n }", "title": "" }, { "docid": "50781272fb2a6e7302dd9042cef40411", "score": "0.5939355", "text": "checkForGameEnd(){\n this.log('checkForGameEnd')\n if(this.player.game_over){\n this.setResponse({message: this.response.message + '\\n' + this.rom.info.outro_text})\n this.actions.die()\n }\n }", "title": "" }, { "docid": "79831c0d0864ae4c3d32573ee044d5f4", "score": "0.59306633", "text": "onRecordingStop() {}", "title": "" }, { "docid": "bde7346469818535da5bba93c65b65bd", "score": "0.5915614", "text": "function _handleEnd(event) {\n\t if (!this._down) return;\n\t\n\t this._eventOutput.emit('end', this._payload);\n\t this._prevCoord = undefined;\n\t this._prevTime = undefined;\n\t this._down = false;\n\t this._move = false;\n\t this._positionHistory = [];\n\t }", "title": "" }, { "docid": "5d4019d8af53b9167fe62bdfe7f74bba", "score": "0.59081155", "text": "function onPlayerStateChange(event) {\n //0 when video ends\n if (event.data === 0) {\n queueToPlayer();\n }\n}", "title": "" }, { "docid": "639b687795291c7a597dbd9858aa5a15", "score": "0.59045154", "text": "ended() {\n clearInterval(this.state.intervalId);\n this.setState({\n intervalId: null,\n started: false,\n startTime: null, currWord: -1,\n currentDuration: parseFloat(0),\n playing: false\n });\n this.index = 0;\n this.lineIndex = 0;\n this.wordIndex = 0;\n this.line = [];\n this.videoRef.current.pause();\n }", "title": "" }, { "docid": "085fb690846835a9576b811de76d25d4", "score": "0.5898484", "text": "function onScriptEnding() {\n if (ui.isOpen) {\n onClosed();\n }\n\n Messages.unsubscribe(MESSAGE_CHANNEL_NAME);\n Messages.messageReceived.disconnect(onMessageReceived);\n }", "title": "" }, { "docid": "2ef1358b03ccfbf58a3e7a2067c8fbff", "score": "0.58954084", "text": "static onTrackEnded (track) {\n\t\tpm.incrementTrackPlaycount(track.id, (err, res) => {\n\t\t\tif (err) console.error(err)\n\t\t})\n\t}", "title": "" }, { "docid": "34b3deeda88c5f400da339d7446d17c2", "score": "0.58928", "text": "endTimer() {\n if(this.timer) {\n clearTimeout(this.timer);\n this.listeners.length = 0;\n }\n }", "title": "" }, { "docid": "78bf826bfe6d8eff06c4b11c6e2ad8da", "score": "0.5879103", "text": "function end_recording(session_id) {\n if (session_id) {\n let session = sessions.get(session_id);\n if (session && session.isRecording) {\n session.isRecording = false;\n logger.info(`Capture ended: ${session_id}`); \n // write out the buffers if not empty, but only up to where the cursor is\n\n let pos_writer = session.writers.pos;\n if (pos_writer.cursor > 0) {\n let path = getCapturePath(session_id, session.recordingStart, 'pos');\n let wstream = fs.createWriteStream(path, { flags: 'a' });\n wstream.write(pos_writer.buffer.slice(0, pos_writer.cursor));\n wstream.close();\n pos_writer.cursor = 0;\n }\n let int_writer = session.writers.int;\n if (int_writer.cursor > 0) {\n let path = getCapturePath(session_id, session.recordingStart, 'int');\n let wstream = fs.createWriteStream(path, { flags: 'a' });\n wstream.write(int_writer.buffer.slice(0, int_writer.cursor));\n wstream.close();\n int_writer.cursor = 0;\n }\n \n // write the capture end event to database\n if (pool) {\n let capture_id = session_id+'_'+session.recordingStart;\n pool.query(\n \"UPDATE captures SET end = ? WHERE capture_id = ?\", [Date.now(), capture_id],\n (err, res) => {\n if (err != undefined) {\n logger.error(`Error writing recording end event to database: ${err} ${res}`);\n }\n }\n );\n }\n\n } else if (session && !session.isRecording) {\n logger.warn(`Requested to end session capture, but capture is already ended: ${session_id}`)\n } else {\n logger.warn(`Error ending capture for session: ${session_id}`);\n }\n }\n }", "title": "" }, { "docid": "8fdc9cbfcb7626e9fc43ac27492695e7", "score": "0.5869517", "text": "onUnload() {\n localStream.getVideoTracks()[0].stop();\n }", "title": "" }, { "docid": "d8ebeb9de28c8aa64f885d90bb250105", "score": "0.5865548", "text": "sourceEndedCallback() {\n console.log('mediaSource readyState: ' + this.readyState);\n }", "title": "" }, { "docid": "00c48b31336cd3795069cc735bab697d", "score": "0.58627206", "text": "function endGame() {\n clearInterval(intervalId);\n setTimeout(afterEndGameEvents, 100);\n }", "title": "" }, { "docid": "625cf975341fc5d0dbdcaa1a9549fbe6", "score": "0.585839", "text": "onEnd() {\n }", "title": "" }, { "docid": "6370e52b7cbc0912b9f8d9f7f2e50ebe", "score": "0.58311373", "text": "function onPlayerStateChange(event) {\n if (event.data == YT.PlayerState.PLAYING && !done) {\n setTimeout(stopVideo, 6000);\n done = true;\n }\n}", "title": "" }, { "docid": "e73d8ead19cbd9eef9ba5b7d4e9bfd08", "score": "0.58217305", "text": "stop() {\n if (!this.player) {\n return;\n }\n this.player.stop();\n }", "title": "" }, { "docid": "ba197c226554453da8c3faad6274631c", "score": "0.5816357", "text": "function endTick() {\r\n\r\n // Add 1 to endFrames\r\n end_frames += 1;\r\n\r\n // After 2 seconds, start fading in title/play ending swell and stop timer\r\n if ( end_frames === 120 ) {\r\n PS.statusFade( 300 ); // Fade in text over 5 seconds\r\n PS.statusColor( COLOR_LIGHT_GRAY ); // Fade text to light gray and make visible\r\n PS.audioPlay( \"end_01\", { path : \"sounds/\", lock : true, volume : SFX_VOLUME } ); // Play swell\r\n PS.timerStop( end_timer ); // Stop end_timer\r\n }\r\n\r\n }", "title": "" }, { "docid": "523ea0ed46a01bfb6ad8e73c2833e9ad", "score": "0.5812369", "text": "_onPlayStop() {\n if (this._isAutoUpdating) {\n Timer_1.Timer.shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n }", "title": "" }, { "docid": "f80613dab7a74fb055b78a68f69cf913", "score": "0.58102196", "text": "endTurn() {\n this._stopListeningForMoveOptions();\n this._stopListeningForAttack();\n this._stopListeningForPosition();\n }", "title": "" }, { "docid": "a0ea5790639b2d61e87033404cd01d13", "score": "0.58043", "text": "_onPlayStop()\n {\n if (this._isAutoUpdating)\n {\n Ticker.shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n }", "title": "" }, { "docid": "e01fcaf6f0a35b1c441037833aa16710", "score": "0.5798759", "text": "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n runHandlers('end', ev);\n\n lastPointer = pointer;\n pointer = null;\n }", "title": "" }, { "docid": "8bc60ec72d8b81da1472ebe883a2e00e", "score": "0.57930017", "text": "async leave() {\n this.skipAll();\n if (this.musicServer.voiceChannel) {\n await this.musicServer.voiceChannel.leave();\n }\n this.musicServer.connection = null;\n this.musicServer.voiceChannel = null;\n }", "title": "" }, { "docid": "135e3d8f93dddd95ce31d34cf5a4340e", "score": "0.5792722", "text": "function gestureEnd(ev) {\n\t if (!pointer || !typesMatch(ev, pointer)) return;\n\t\n\t updatePointerState(ev, pointer);\n\t pointer.endTime = +Date.now();\n\t\n\t runHandlers('end', ev);\n\t\n\t lastPointer = pointer;\n\t pointer = null;\n\t }", "title": "" }, { "docid": "dcb0be14ae3e53efe72241723bf4cbc8", "score": "0.57913953", "text": "function implementOnEndedHandling(stream) {\n var originalStop = stream.stop;\n stream.stop = function () {\n originalStop.apply(stream);\n if (!stream.ended) {\n stream.ended = true;\n stream.onended();\n }\n };\n}", "title": "" }, { "docid": "a8eb771d90cda0c6c7e9cc07f7ce6d14", "score": "0.57910913", "text": "function onEnded (e) {\n state.video.isPaused = true\n }", "title": "" }, { "docid": "9a7dff22fcddc9d01ebb003bdd00505d", "score": "0.5785291", "text": "function end() {\n console.log(\"End Of Stream\");\n}", "title": "" }, { "docid": "eb7d089417d9b2e55d9ab97dc4cadf26", "score": "0.5783844", "text": "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n runHandlers('end', ev);\n\n lastPointer = pointer;\n pointer = null;\n }", "title": "" }, { "docid": "eb7d089417d9b2e55d9ab97dc4cadf26", "score": "0.5783844", "text": "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n runHandlers('end', ev);\n\n lastPointer = pointer;\n pointer = null;\n }", "title": "" }, { "docid": "eb7d089417d9b2e55d9ab97dc4cadf26", "score": "0.5783844", "text": "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n runHandlers('end', ev);\n\n lastPointer = pointer;\n pointer = null;\n }", "title": "" }, { "docid": "8b57e6106d25c6de46f86c76b3490e59", "score": "0.5762257", "text": "function endgame() {\n finished = true;\n mobile ? removeSwipeListener() : removeKeyListener();\n speedInput = false;\n speedUp = false;\n speedDown = false;\n hudFadeOut();\n overlayDark(1000);\n (distanceRemain > 0) ? makeEndgameBox('You Lose!') : (makeEndgameBox('You Win!'), makeHarder());\n endgamePopIn();\n playButtonAppear(p1, 'playButton', 'More?', 'yellow', 500, replay);\n }", "title": "" }, { "docid": "cb4b404ad71b5931ad01ed4f919236d9", "score": "0.5759701", "text": "function timeUpdateHandler() {\n\t\t\t\t// Note: >= rather than == important for IE\n\t\t\t\tif (video.currentTime >= video.duration) {\n\t\t\t\t\tendHandler();\n\t\t\t\t\tvideo.removeEventListener('timeupdate', timeUpdateHandler);\n\t\t\t\t}\n\t\t\t}", "title": "" }, { "docid": "5aadd724340c02f13626f58951a5aec0", "score": "0.57537705", "text": "function gameEnd() {\n // update the last played games\n updateHistory();\n }", "title": "" }, { "docid": "62eaef692bc82895c5e8ef1a276f3bad", "score": "0.575015", "text": "function gestureEnd(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n pointer.endTime = +Date.now();\n\n if (ev.type !== 'pointercancel') {\n runHandlers('end', ev);\n }\n\n lastPointer = pointer;\n pointer = null;\n }", "title": "" }, { "docid": "8dccb23a656fa89c8209dd769b914602", "score": "0.57474923", "text": "function endStream() {\n if (ended) return\n ended = true\n recognizers.delete(user)\n pino.trace(\n { activeRecognizers: recognizers.size },\n `Ended stream for ${user}.`\n )\n transcribe()\n }", "title": "" }, { "docid": "16e4f060a3a6a901b7232b97b8875bff", "score": "0.57432765", "text": "function ending(){\r\n if(!end){\r\n ears.start(true, false);\r\n } else {\r\n voice.speak(\"Goodbye\");\r\n }\r\n}", "title": "" }, { "docid": "c2fa6bf1f1ac807ae00e63dfaa21e499", "score": "0.5741963", "text": "function stop() {\n getTracks().forEach(track => {\n track.stop();\n });\n emitter.emit('media:stopped', this.id);\n }", "title": "" }, { "docid": "20828573a7e9f891810531264d690850", "score": "0.57391983", "text": "_onPlaying() {\n var player = this;\n player.ended = false;\n player.isPlaying = true;\n player.$.replay.style = ''; // remove Replay inline styling\n player._startProgressTimer();\n }", "title": "" }, { "docid": "7b3d10d42edadf8ce009253accc37c40", "score": "0.57338023", "text": "onPlayPause(playerState){\n \n }", "title": "" }, { "docid": "b128e9ee6b9b50d039d62af15c917a5e", "score": "0.5731749", "text": "endCallbackAnimationReelsEvent (data)\n {\n this.setEvent('endAnimationReels', data);\n }", "title": "" }, { "docid": "948c875a02f872c2d221d814451b569e", "score": "0.57283217", "text": "endAudio() {\n this.set('completedAudio', true);\n this.notifyPropertyChange('readyToStartCalibration');\n }", "title": "" }, { "docid": "b3df2500f18d5bbe7cf772ebc7028bf3", "score": "0.5715268", "text": "function onFinishVideo(){\n\tTweenLite.set('#rePlayBttnV2', {alpha: 1, y: -3});\n\n\tTweenLite.set('#rePlayBttnV2', {rotation:0, transformOrigin:\"50% 50%\"});\n\tTweenLite.to('#rePlayBttnV2', 0.5, {rotation:360, transformOrigin:\"50% 50%\"});\n\tTweenLite.to('#muteBttn', 0.5, {alpha: 0},'-=0.5');\n\n\tTweenLite.set('#playBttn', {alpha: 0, y: -40});\n\tTweenLite.set('#pauseBttn', {alpha: 0, y: -40});\n\n\n\n\tdocument.getElementById(\"playBttn\").removeEventListener('click', ytpPlayVideo, false);\n\tdocument.getElementById(\"pauseBttn\").removeEventListener('click', ytpPauseVideo, false);\n\tdocument.getElementById(\"rePlayBttnV2Div\").addEventListener('click', ytpRePlayeVideo, false);\n\tdocument.getElementById(\"rePlayBttnV2Div\").addEventListener('mouseover', rotateReplayBttn, false);\n\tdocument.getElementById('disclaimerID').addEventListener('click', displayTerms, false);\n\tdocument.getElementById('termsCloseBtnID').addEventListener('click', hideTerms, false);\n\n\t//document.getElementById(\"tagLineID\").removeEventListener('click', mainExit, false);\n\t//document.getElementById(\"tagLineID\").addEventListener('click', function(){playVideo('thumb01ID')}, false);\n\n\t// hideVideo2();\n\t//console.log('hidden video 2');\n\n\tEnabler.counter(currentVideoName+' Completed');\n\n\n\tvideoWatched +=\" - \"+currentVideoName;\n\t//console.log(videoWatched);\n\n\tcompletedVideoName=currentVideoName;\n}", "title": "" } ]
77d2010bd06fa626cb70ddefb2311aeb
Below this point lie methods used to build the individual pieces. Top.
[ { "docid": "78b427bfa53e71b883689bca7b86b98e", "score": "0.0", "text": "function createSelectDataSourceControls() {\n var dataSelectControls = jQuery('<div/>');\n var n;\n\n hideBoxButton = new SticiToggleButton({\n trueLabel: 'Hide Box',\n falseLabel: 'Show Box',\n value: true\n });\n\n var showSources = true;\n if (options.sources != \"all\") {\n n = 0;\n var oldRSource = rSource;\n rSource = {};\n jQuery.each(oldRSource, function(k, v) {\n if (options.sources.indexOf(k) >= 0 ||\n options.sources.indexOf(v) >= 0) {\n rSource[k] = v;\n n += 1;\n }\n });\n if (n <= 1)\n showSources = false;\n }\n sourceChoice = new SticiComboBox({\n label: \"Sample from: \",\n options: rSource,\n selected: \"Box\"\n });\n if (showSources)\n dataSelectControls.append(sourceChoice);\n replaceCheck = new SticiCheck({\n label: ' with replacement',\n value: options.replace,\n readonly: !options.replaceControl\n });\n if (!options.replaceControl && !options.replace)\n replaceCheck.label(' without replacement');\n takeSampleButton = jQuery('<button id=\"takeSample\"/>').text('Take Sample');\n dataSelectControls.append(takeSampleButton);\n dataSelectControls.append(replaceCheck);\n dataSelectControls.append(hideBoxButton);\n return dataSelectControls;\n }", "title": "" } ]
[ { "docid": "2f74b8d9268defef002773fe2567590d", "score": "0.63042736", "text": "function addPieces() {\n\t\tvar bitmap;\n\t\t// blue pieces\n\t\tbitmap = drawPieces(\"blue1\", 508, 249, 55, 550, false);\n\t\tbitmap = drawPieces(\"blue1\", 508, 249, 55, 550, false);\n\t\tbitmap = drawPieces(\"blue2\", 559, 249, 55, 570, false);\n\t\tbitmap = drawPieces(\"blue2\", 559, 249, 55, 570, false);\n\t\tbitmap = drawPieces(\"blue3\", 610, 249, 55, 590, false);\n\t\tbitmap = drawPieces(\"blue3\", 610, 249, 55, 590, false);\n\n\t\t// pink and orange pieces\n\t\tbitmap = drawPieces(\"pink1\", 740, 249, 112, 550, false);\n\t\tbitmap = drawPieces(\"pink1\", 740, 249, 112, 550, false);\n\t\tbitmap = drawPieces(\"orange2\", 740, 312, 112, 570, false);\n\t\tbitmap = drawPieces(\"orange2\", 740, 312, 112, 570, false);\n\n\t\t// green pieces\n\t\tbitmap = drawPieces(\"green1\", 508, 312, 112, 590, false);\n\t\tbitmap = drawPieces(\"green1\", 508, 312, 112, 590, false);\n\t\tbitmap = drawPieces(\"green1\", 508, 312, 112, 590, false);\n\t\tbitmap = drawPieces(\"green2\", 559, 312, 55, 610, false);\n\t\tbitmap = drawPieces(\"green2\", 559, 312, 55, 610, false);\n\t\tbitmap = drawPieces(\"green2\", 559, 312, 55, 610, false);\n\t\tbitmap = drawPieces(\"green3\", 610, 312, 112, 610, false);\n\t\tbitmap = drawPieces(\"green3\", 610, 312, 112, 610, false);\n\t\tbitmap = drawPieces(\"green4\", 662, 312, 55, 630, false);\n\t\tbitmap = drawPieces(\"green4\", 662, 312, 55, 630, false);\n\n\t\t// corner pieces\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\t\tbitmap = drawPieces(\"cornerblue\", 499, 466, 175, 565, false);\n\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\t\tbitmap = drawPieces(\"cornerred\", 583, 466, 255, 565, false);\n\n\t\t// loop and tunnels\n\t\tbitmap = drawPieces(\"loop\", 708, 398, 345, 570, false);\n\t\tbitmap = drawPieces(\"tunnelred\", 672, 443, 0, 0, false);\n\t\tbitmap = drawPieces(\"tunnelpurple\", 672, 465, 0, 0, false);\n\t\t\n\t\t// start and end\n\t\tbitmap = drawPieces(\"start\", 499, 371, 0, 0, false);\n\t\tbitmap = drawPieces(\"end\", 583, 371, 0, 0, false);\n\t}", "title": "" }, { "docid": "cae1eeaae79eb3aa2efc4f7bd84d3375", "score": "0.6186672", "text": "initPieces() {\n\n let theme = this.themes[this.selectedTheme];\n\n // Init Main Board\n this.board = new MyBoard(this,\n theme.boardGraph,\n theme.playableTileGraph,\n theme.nonPlayableTileGraph);\n\n // Init Bonus Board\n this.bonusBoard = new MyAuxiliarBoard(this,\n theme.bonusBoardGraph,\n theme.nonPlayableTileGraph, 0, -3.675, 1, 8, 7);\n\n // Init Pieces Board\n this.piecesBoard = new MyAuxiliarBoard(this,\n theme.piecesBoardGraph,\n theme.nonPlayableTileGraph, -3.15, -3.675, 7, 8, -10);\n\n // Init Points Marker\n this.marker = new MyMarker(this, theme.markerGraph);\n\n // Init Timer\n this.timer = new MyTimer(this, theme.timerGraph);\n\n // Init Player Pieces\n let piecePickId = 53;\n let offsetX = -13.15;\n let offsetZ;\n\n for (let x = 0; x < 7; x++) {\n offsetZ = -3.675;\n for (let z = 0; z < ((x == 0) ? 4 : 8); z++) {\n let playerPiece = new MyPlayerPiece(this, theme.playerGraph, 'white', piecePickId);\n playerPiece.moveTo(offsetX + x, 0.27, offsetZ + z);\n playerPiece.setInitPosition();\n this.playerPieces.push(playerPiece);\n\n offsetZ += 0.05;\n piecePickId++;\n }\n offsetX += 0.05;\n }\n\n }", "title": "" }, { "docid": "3bf71538e69215bb58001780d7e00e50", "score": "0.6129708", "text": "function init_pieces() {\n var row_index,\n col_index,\n pawn,\n \n white_king_index = [7, 4],\n black_king_index = [0, 4],\n \n white_queen_index = [7, 3],\n black_queen_index = [0, 3],\n\n white_bishop_1_index = [7, 2],\n black_bishop_1_index = [0, 2],\n white_bishop_2_index = [7, 5],\n black_bishop_2_index = [0, 5],\n\n white_knight_1_index = [7, 1],\n black_knight_1_index = [0, 1],\n white_knight_2_index = [7, 6],\n black_knight_2_index = [0, 6],\n\n white_rook_1_index = [7, 0],\n black_rook_1_index = [0, 0],\n white_rook_2_index = [7, 7],\n black_rook_2_index = [0, 7],\n\n piece;\n\n // Init black pawns\n row_index = 1;\n pawn = piece_factory(CONSTANTS.PIECES.PAWN, CONSTANTS.COLOURS.BLACK);\n for (col_index = 0; col_index < 8; col_index++) {\n piece = $(pawn).clone();\n $('[data-row_index=\"' + row_index + '\"][data-col_index=\"' + col_index + '\"]').append(piece);\n make_piece_draggable(piece);\n }\n\n // Init white pawns\n row_index = 6;\n pawn = piece_factory(CONSTANTS.PIECES.PAWN, CONSTANTS.COLOURS.WHITE);\n for (col_index = 0; col_index < 8; col_index++) {\n piece = $(pawn).clone();\n $('[data-row_index=\"' + row_index + '\"][data-col_index=\"' + col_index + '\"]').append(piece);\n make_piece_draggable(piece);\n }\n\n // Init Kings\n piece = piece_factory(CONSTANTS.PIECES.KING, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_king_index[0], white_king_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KING, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_king_index[0], black_king_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Queens\n piece = piece_factory(CONSTANTS.PIECES.QUEEN, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_queen_index[0], white_queen_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.QUEEN, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_queen_index[0], black_queen_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Bishops\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_bishop_1_index[0], white_bishop_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_bishop_1_index[0], black_bishop_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_bishop_2_index[0], white_bishop_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.BISHOP, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_bishop_2_index[0], black_bishop_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Knights\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_knight_1_index[0], white_knight_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_knight_1_index[0], black_knight_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_knight_2_index[0], white_knight_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.KNIGHT, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_knight_2_index[0], black_knight_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n // Init Rooks\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_rook_1_index[0], white_rook_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_rook_1_index[0], black_rook_1_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.WHITE);\n $(SQUARE.get_square_at(white_rook_2_index[0], white_rook_2_index[1])).append(piece);\n make_piece_draggable(piece);\n\n piece = piece_factory(CONSTANTS.PIECES.ROOK, CONSTANTS.COLOURS.BLACK);\n $(SQUARE.get_square_at(black_rook_2_index[0], black_rook_2_index[1])).append(piece);\n make_piece_draggable(piece);\n}", "title": "" }, { "docid": "2b92c74cc8d1814c7574ccbd382d12ff", "score": "0.5994411", "text": "function BuildFirstSection()\n{\t\n\t//floor\n\tPlatforms.push(new Platform(-300, 1930, 498));\n\t\n\t//slanted platform\n\tPlatforms.push(new SlantedPlatform(81, 498, 365, 215));\n\tBaddies.push(new Baddie(104, 300, \"patrol\"));\n\t\n\t//blocks above the slanted platform\n\t//AddCube(242,130,\"Crimson\")\n\tAddCube(242, 130, \"Crimson\")\n\tAddCube(202, -70, \"Gold\", \"cookie\")\n\tAddCube(242, -270, \"Crimson\")\n\tAddCube(202, -470, \"Gold\")\n\tAddCube(242, -670, \"Crimson\", \"cookie\")\n\t\n\t// platform to the right of the title\n\tPlatforms.push(new Platform(922, 1305, 340));\n\tBaddies.push(new Baddie(980, 200, \"chase\", \"cookie\"));\n\tBaddies.push(new Baddie(1848, 400, \"chase\", \"cookie\"));\n\tBaddies.push(new Baddie(1220, 200, \"patrol\"));\n\t\n\t//hovering baddie to the right of that\n\tBaddies.push(new Baddie(1464, 200, \"hover\"));\n\t\n\t//series of eight blocks above that platform\n\tvar i = 0;\n\tfor(i = 0; i < 8; i++)\n\t{\n\t\tx = 980 + 38 * i;\n\t\ty = 140;\n\t\t\n\t\titem = \"\";\n\t\tif(i < 4) color = \"RoyalBlue\";\n\t\telse color = \"GhostWhite\";\n\t\tif(i == 7) item = \"tracksuit\";\n\t\tif(i == 3 || i == 5) item = \"cookie\";\n\t\t\n\t\tCubes.push(new Cube(x,y,color,item));\n\t}\n\tPlatforms.push(new Platform(980 - 18, 1284 - 18, 140 - 18));\n\tBaddies.push(new Baddie(1000, 62, \"patrol\"));\n}", "title": "" }, { "docid": "d1e7830b6e00ae1c9b8783f00d960015", "score": "0.5987863", "text": "function CreatePieces() {\n //Creates White pieces\n //new piece = name, row(y), col(x), status, img name location\n var whiteLRook = new Piece(\"whiteLRook\", 0, 0, 'IN_PLAY', 'whiteRook.png', 'Rook');\n var whiteRRook = new Piece(\"whiteRRook\", 0, 7, 'IN_PLAY', 'whiteRook.png', 'Rook');\n\n var whiteLKnight = new Piece(\"whiteLKnight\", 0, 1, 'IN_PLAY', 'whiteKnight.png', 'Knight');\n var whiteRKnight = new Piece(\"whiteRKnight\", 0, 6, 'IN_PLAY', 'whiteKnight.png', 'Knight');\n\n var whiteLBishop = new Piece(\"whiteLBishop\", 0, 2, 'IN_PLAY', 'whiteBishop.png', 'Bishop');\n var whiteRBishop = new Piece(\"whiteRBishop\", 0, 5, 'IN_PLAY', 'whiteBishop.png', 'Bishop');\n\n var whiteQueen = new Piece(\"whiteQueen\", 0, 3, 'IN_PLAY', 'whiteQueen.png', 'Queen');\n var whiteKing = new Piece(\"whiteKing\", 0, 4, 'IN_PLAY', 'whiteKing.png', 'King');\n\n var whitePawn1 = new Piece(\"whitePawn1\", 1, 0, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn2 = new Piece(\"whitePawn2\", 1, 1, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn3 = new Piece(\"whitePawn3\", 1, 2, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn4 = new Piece(\"whitePawn4\", 1, 3, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn5 = new Piece(\"whitePawn5\", 1, 4, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn6 = new Piece(\"whitePawn6\", 1, 5, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn7 = new Piece(\"whitePawn7\", 1, 6, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n var whitePawn8 = new Piece(\"whitePawn8\", 1, 7, 'IN_PLAY', 'whitePawn.png', 'Pawn');\n\n //Creates Black pieces\n var blackLRook = new Piece(\"blackLRook\", 7, 0, 'IN_PLAY', 'blackRook.png', 'Rook');\n var blackRRook = new Piece(\"blackRRook\", 7, 7, 'IN_PLAY', 'blackRook.png', 'Rook');\n\n var blackLKnight = new Piece(\"blackLKnight\", 7, 1, 'IN_PLAY', 'blackKnight.png', 'Knight');\n var blackRKnight = new Piece(\"blackRKnight\", 7, 6, 'IN_PLAY', 'blackKnight.png', 'Knight');\n\n var blackLBishop = new Piece(\"blackLBishop\", 7, 2, 'IN_PLAY', 'blackBishop.png', 'Bishop');\n var blackRBishop = new Piece(\"blackRBishop\", 7, 5, 'IN_PLAY', 'blackBishop.png', 'Bishop');\n\n var blackQueen = new Piece(\"blackQueen\", 7, 3, 'IN_PLAY', 'blackQueen.png', 'Queen');\n var blackKing = new Piece(\"blackKing\", 7, 4, 'IN_PLAY', 'blackKing.png', 'King');\n\n var blackPawn1 = new Piece(\"blackPawn1\", 6, 0, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn2 = new Piece(\"blackPawn2\", 6, 1, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn3 = new Piece(\"blackPawn3\", 6, 2, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn4 = new Piece(\"blackPawn4\", 6, 3, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn5 = new Piece(\"blackPawn5\", 6, 4, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn6 = new Piece(\"blackPawn6\", 6, 5, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn7 = new Piece(\"blackPawn7\", 6, 6, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n var blackPawn8 = new Piece(\"blackPawn8\", 6, 7, 'IN_PLAY', 'blackPawn.png', 'Pawn');\n\n //pushes all created pieces to white or black team\n WHITE_TEAM.push(whiteLRook, whiteRRook, whiteLKnight, whiteRKnight, whiteLBishop, whiteRBishop, whiteQueen, whiteKing, whitePawn1, whitePawn2, whitePawn3, whitePawn4, whitePawn5, whitePawn6, whitePawn7, whitePawn8);\n\n BLACK_TEAM.push(blackLRook, blackRRook, blackLKnight, blackRKnight, blackLBishop, blackRBishop, blackQueen, blackKing, blackPawn1, blackPawn2, blackPawn3, blackPawn4, blackPawn5, blackPawn6, blackPawn7, blackPawn8);\n\n }", "title": "" }, { "docid": "8f9e48eaaa5ac1ff296309f291cd03ae", "score": "0.5916236", "text": "logic() {\n if (this.hvacApplication.getCurrentBuilding() == null) return;\n var ctx = this.beginDraw(this.canvas, this.hvacApplication.viewAngle, this.hvacApplication.viewScale);\n\n //Draw above and below floors\n var floorList = this.hvacApplication.getCurrentBuilding().getFloorList();\n var currentFloor = this.hvacApplication.getCurrentFloorPlan();\n var currentFloorIndex = floorList.indexOf(currentFloor);\n\n //Checks if there exists a floor underneath the current floor. If so, show it on the canvas.\n if (currentFloorIndex > 0) {\n var underneathFloor = floorList[currentFloorIndex - 1];\n for (var j = 0; j < underneathFloor.getWallList().length; j++) {\n var wall = underneathFloor.getWallList()[j];\n wall.drawDotted(ctx, true);\n }\n }\n\n //Checks if there exists a floor above the current floor. If so, show it on the canvas.\n if (currentFloorIndex < floorList.length - 1) {\n var aboveFloor = floorList[currentFloorIndex + 1];\n for (var j = 0; j < aboveFloor.getWallList().length; j++) {\n var wall = aboveFloor.getWallList()[j];\n wall.drawDotted(ctx, false);\n }\n }\n\n var closePointArray = [];\n\n //Checks if in Create Wall mode and mouse is on the canvas to see if the mouse is close to a wall to snap to it\n if (this.allowCreatingWalls && this.mouseIsOnCanvas) {\n closePointArray.push(new Point2D({x: this.rotatedCanvasMouseX, y: this.rotatedCanvasMouseY}));\n }\n\n //Checks if in Edit Point mode and mouse is on the canvas to see if the mouse is close to a wall to snap to it\n if (this.allowEditingPoints && this.mouseIsOnCanvas) {\n if (this.currentEditPointSelectedWall != null) {\n if (this.currentEditPointSelectedWallPoint == WALL_POINT_ONE) {\n closePointArray.push(new Point2D({x: this.currentEditPointSelectedWall.getPoint1X(),\n y: this.currentEditPointSelectedWall.getPoint1Y()}));\n }\n if (this.currentEditPointSelectedWallPoint == WALL_POINT_TWO) {\n closePointArray.push(new Point2D({x: this.currentEditPointSelectedWall.getPoint2X(),\n y: this.currentEditPointSelectedWall.getPoint2Y()}));\n }\n }\n }\n\n /**\n * Iterates through the wall list and draws the perpendicular ones while also checking if the mouse is close to\n * one.\n */\n for (var i = 0; i < this.hvacApplication.getCurrentWallList().length; i++) {\n var wall = this.hvacApplication.getCurrentWallList()[i];\n wall.drawPerpendicular(ctx, closePointArray);\n }\n\n /**\n * Iterates through the rest of the walls to draw them and determines if the mouse is close enough to highlight\n * each wall.\n */\n for (var i = 0; i < this.hvacApplication.getCurrentWallList().length; i++) {\n var wall = this.hvacApplication.getCurrentWallList()[i];\n\n var highlight = false;\n if (this.allowCornerEditing) {\n if (this.currentEditCornerSelectedCornerPoints.length == 0) {\n highlight = this.highlightedCorners.indexOf(wall) != -1;\n } else {\n for (var j = 0; j < this.currentEditCornerSelectedCornerPoints.length; j++) {\n var corner = this.currentEditCornerSelectedCornerPoints[j];\n if (corner.getWall() == wall) highlight = true;\n }\n }\n }\n if (this.allowEditingPoints && wall == this.highlightedPoint) {\n highlight = true;\n }\n if (this.allowDeletingWalls && wall == this.highlightedDeleteWall) {\n highlight = true;\n }\n\n wall.draw(ctx, highlight);\n }\n\n //Draw create mode starting point\n if (this.allowCreatingWalls && this.mouseIsOnCanvas) {\n var point = snapPointToWalls(this.rotatedCanvasMouseX, this.rotatedCanvasMouseY,\n this.hvacApplication.getCurrentWallList(), []);\n\n ctx.fillStyle = \"rgb(150,200,255)\";\n ctx.beginPath();\n ctx.arc(point.getX(), point.getY(), 5, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (this.allowCreatingWalls && this.currentCreateWall != null) {\n var canvasWidth = this.canvas.width;\n var canvasHeight = this.canvas.height;\n this.currentCreateWall.drawLength(ctx, new Point2D({x: canvasWidth / 2, y: canvasHeight / 2}),\n 0.0, this.hvacApplication.viewScale);\n }\n\n if (this.allowEditingPoints && this.currentEditPointSelectedWall != null) {\n var canvasWidth = this.canvas.width;\n var canvasHeight = this.canvas.height;\n this.currentEditPointSelectedWall.drawLength(ctx, new Point2D({x: canvasWidth/2, y: canvasHeight/2}),\n this.viewAngle, this.viewScale);\n }\n\n this.endDraw(ctx);\n }", "title": "" }, { "docid": "6d61b76b27ec8af6b4e0d41a99b2a69f", "score": "0.5916196", "text": "render(pieces, func) {\n // Clear board\n this.board.selectAll(\"circle, image, rect\").remove();\n\n this.board.append(\"image\")\n .attr(\"xlink:href\", \"/img/wood.jpg\")\n .attr(\"x\", 0)\n .attr(\"y\", 0)\n .attr(\"height\", 800)\n .attr(\"width\", 800);\n\n this.board.append(\"rect\")\n .attr(\"x\", 40)\n .attr(\"y\", 40)\n .attr(\"height\", \"720\")\n .attr(\"width\", \"720\")\n .attr(\"fill\", \"transparent\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2\")\n .attr(\"stroke-dasharray\", \"720 0 0 720 0 720 720 0\");\n\n for (var y = 40; y < 800; y += 40) {\n for (var x = 40; x < 800; x += 40) {\n if (x < 760 && y < 760) {\n // Create squares\n this.board.append(\"rect\")\n .attr(\"x\", x)\n .attr(\"y\", y)\n .attr(\"height\", \"40\")\n .attr(\"width\", \"40\")\n .attr(\"fill\", \"transparent\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", \"2\")\n .attr(\"stroke-dasharray\", \"0 40 40 0 40 0 0 40\");\n }\n \n var r = y / 40;\n var c = x / 40;\n\n if (this.stars.includes(r) && this.stars.includes(c)) {\n this.board.append(\"circle\")\n .attr(\"cx\", x)\n .attr(\"cy\", y)\n .attr(\"r\", \"4\")\n .attr(\"fill\", \"black\");\n }\n\n // Highlight new piece\n if (pieces[r][c] != this.pieces[r][c] && (pieces[r][c] == 1 || pieces[r][c] == 2)) {\n this.board.append(\"circle\")\n .attr(\"cx\", x)\n .attr(\"cy\", y)\n .attr(\"r\", \"19.5\")\n .attr(\"fill\", \"green\")\n .attr(\"filter\", \"url(#highlight)\");\n }\n\n // Create circular pieces\n var circ = this.board.append(\"circle\");\n circ\n .attr(\"cx\", x)\n .attr(\"cy\", y)\n .attr(\"r\", \"19\")\n .attr(\"fill\", \"transparent\")\n .on(\"click\", func);\n\n if (pieces[r][c] == 1 || pieces[r][c] == 2) {\n circ.attr(\"fill\", \"#\" + (0xffffff * (pieces[r][c] - 1)).toString(16));\n }\n\n }\n }\n \n this.pieces = JSON.parse(JSON.stringify(pieces));\n }", "title": "" }, { "docid": "c02891b7463737fb58f1b72db2752ba4", "score": "0.5882714", "text": "function figureTrackPieces() {\n\trrTrackPieces.length = 0;\t// start with an empty array in which to store the track pieces to be generated\n\tvar trackWidth = rrTrackLayout[ 0 ].trackWidth;\n\t// ( at this stage, we ignore Y components which will be added when the track piece elevations are figured out later\n\t// var trackThickness = rrTrackLayout[ 0 ].trackThickness;\n\t// // The separation of vertices from \"top\" to \"bottom\" is the track thickness in the -Y direction\n\t// var downVector = new THREE.Vector3( 0, -1, 0 );\n\t// downVector.multiplyScalar( trackThickness );\n\tvar previousPiecePathFinishPoint = new THREE.Vector3();\n\tvar previousPiecePathFinishDirection = new THREE.Vector3();\n\tvar yAxisDirection = new THREE.Vector3( 0, 1, 0 );\n\t// Start with the track path origin point and direction acting as the \"finish\" items of the \"previous section\"\n\tpreviousPiecePathFinishPoint.copy( rrTrackLayout[ 1 ].location );\n\tpreviousPiecePathFinishDirection.copy( rrTrackLayout[ 1 ].direction );\n\t// starting past the characteristics and origin entries, traverse the layout array and process each section\n\tfor( sectionIndex = 2; sectionIndex < rrTrackLayout.length; sectionIndex++ ) {\n\t\t// Record the piece index where this section begins\n\t\trrTrackLayout[ sectionIndex ].beginPieceIndex = rrTrackPieces.length;\n\t\tswitch( rrTrackLayout[ sectionIndex ].sectionType ) {\n\t\t\tcase \"straight\":\n\t\t\t\t// Full pieces are the configured number of millimeters in length\n\t\t\t\tvar fullPieceCount = Math.floor( rrTrackLayout[ sectionIndex ].length / rrTrackLayout[ 0 ].targetTrackPieceLength );\n\t\t\t\t// Last piece is whatever it takes to make up the actual given length\n\t\t\t\tvar lastPieceLength = rrTrackLayout[ sectionIndex ].length - ( fullPieceCount * rrTrackLayout[ 0 ].targetTrackPieceLength );\n\t\t\t\t// Traverse the straight section making each small piece\n\t\t\t\t// ( if the length of the odd-sized last piece is too close to zero, ignore that piece )\n\t\t\t\tfor( var currentPiece = 0; currentPiece < ( fullPieceCount + 1 ); currentPiece++ ) {\n\t\t\t\t\tvar currentPieceLength;\n\t\t\t\t\tif( currentPiece == fullPieceCount ) {\n\t\t\t\t\t\t// This is the odd-sized last piece...\n\t\t\t\t\t\tcurrentPieceLength = lastPieceLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is just another full size piece\n\t\t\t\t\t\tcurrentPieceLength = rrTrackLayout[ 0 ].targetTrackPieceLength;\n\t\t\t\t\t}\n\t\t\t\t\t// Screen out overly small last pieces\n\t\t\t\t\tif( currentPieceLength > 0.001 ) {\n\t\t\t\t\t\t// Make the object representing the current piece of straight track section\n\t\t\t\t\t\tvar thisPiece = new Object();\n\t\t\t\t\t\tthisPiece.pieceType = \"straight\";\n\t\t\t\t\t\tthisPiece.pieceLength = currentPieceLength;\n\t\t\t\t\t\t// The path start point and direction are those of the previous piece's end point\n\t\t\t\t\t\tthisPiece.piecePathStartPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartPoint.copy( previousPiecePathFinishPoint );\n\t\t\t\t\t\tthisPiece.piecePathStartDirection = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartDirection.copy( previousPiecePathFinishDirection );\n\t\t\t\t\t\t// The path finish point for a full straight piece is one millimeter from the start point in the direction of the piece\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathSpan = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathSpan.copy( previousPiecePathFinishDirection );\t// get the direction of this piece\n\t\t\t\t\t\tthisPiece.piecePathSpan.normalize();\n\t\t\t\t\t\tthisPiece.piecePathSpan.multiplyScalar( currentPieceLength );\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint.addVectors( thisPiece.piecePathStartPoint, thisPiece.piecePathSpan );\t// add it to the start point\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection.copy( thisPiece.piecePathStartDirection );\t// for straight pieces, the direction never changes\n\t\t\t\t\t\t// Make the eight vertices of this small piece of straight track\n\t\t\t\t\t\tthisPiece.startRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\t// forwardVector.subVectors( thisPiece.piecePathStartPoint - thisPiece.piecePathFinishPoint );\n\t\t\t\t\t\t// The separation of vertices \"left\" and \"right\" is taken one at a time from the center-located path points\n\t\t\t\t\t\t// ... the direction of these is the piece direction rotated 90 degrees either way about the Y axis and\n\t\t\t\t\t\t// ... the length of each is half the track width.\n\t\t\t\t\t\tvar leftwardVector = new THREE.Vector3();\n\t\t\t\t\t\tvar rightwardVector = new THREE.Vector3();\n\t\t\t\t\t\tleftwardVector.copy( thisPiece.piecePathStartDirection );\n\t\t\t\t\t\trightwardVector.copy( thisPiece.piecePathStartDirection );\n\t\t\t\t\t\tleftwardVector.normalize();\n\t\t\t\t\t\trightwardVector.normalize();\n\t\t\t\t\t\tleftwardVector.multiplyScalar( rrTrackLayout[ 0 ].trackWidth / 2 );\n\t\t\t\t\t\trightwardVector.multiplyScalar( rrTrackLayout[ 0 ].trackWidth / 2 );\n\t\t\t\t\t\tleftwardVector.applyAxisAngle( yAxisDirection, Math.PI / 2 );\n\t\t\t\t\t\trightwardVector.applyAxisAngle( yAxisDirection, -Math.PI / 2 );\n\t\t\t\t\t\t// Now place the piece vertices\n\t\t\t\t\t\tthisPiece.startRightTopVertex.addVectors( thisPiece.piecePathStartPoint, rightwardVector );\n\t\t\t\t\t\tthisPiece.finishRightTopVertex.addVectors( thisPiece.piecePathFinishPoint, rightwardVector );\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex.addVectors( thisPiece.piecePathFinishPoint, leftwardVector );\n\t\t\t\t\t\tthisPiece.startLeftTopVertex.addVectors( thisPiece.piecePathStartPoint, leftwardVector );\n\t\t\t\t\t\t// ( just copy the top vectors to the bottom vectors and ignore the vertical quantities for now...)\n\t\t\t\t\t\tthisPiece.startRightBottomVertex.copy( thisPiece.startRightTopVertex );\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex.copy( thisPiece.finishRightTopVertex );\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex.copy( thisPiece.finishLeftTopVertex );\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex.copy( thisPiece.startLeftTopVertex );\n\t\t\t\t\t\t// Push the completed piece onto the list of pieces\n\t\t\t\t\t\trrTrackPieces.push( thisPiece );\n\t\t\t\t\t\t// Update the \"previous\" path items so we can process the next small piece\n\t\t\t\t\t\tpreviousPiecePathFinishPoint.copy( thisPiece.piecePathFinishPoint );\n\t\t\t\t\t\tpreviousPiecePathFinishDirection.copy( thisPiece.piecePathFinishDirection );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"curveRight\":\n\t\t\t\t// Get the radius of this section of curved track\n\t\t\t\tvar currentPieceRadius = rrTrackLayout[ sectionIndex ].radius;\n\t\t\t\t// Figure the piece angle that will give the configured piece length at the given radius\n\t\t\t\tvar fullPieceRadianAngle = ( rrTrackLayout[ 0 ].targetTrackPieceLength / currentPieceRadius );\n\t\t\t\t// Full pieces are the configured number of millimeters in arc length\n\t\t\t\tvar fullPieceCount = Math.floor( ( rrTrackLayout[ sectionIndex ].degreeAngle * Math.PI / 180 ) / fullPieceRadianAngle );\n\t\t\t\t// Last piece is whatever it takes to make up the actual given curve angle\n\t\t\t\tvar lastPieceRadianAngle = ( rrTrackLayout[ sectionIndex ].degreeAngle * Math.PI / 180 ) - ( fullPieceCount * fullPieceRadianAngle );\n\t\t\t\tfor( var currentPiece = 0; currentPiece < ( fullPieceCount + 1 ); currentPiece++ ) {\n\t\t\t\t\tvar currentPieceRadianAngle;\n\t\t\t\t\tif( currentPiece == fullPieceCount ) {\n\t\t\t\t\t\t// This is the odd-sized last piece\n\t\t\t\t\t\tcurrentPieceRadianAngle = lastPieceRadianAngle;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is just another full, one mm piece\n\t\t\t\t\t\tcurrentPieceRadianAngle = fullPieceRadianAngle;\n\t\t\t\t\t}\n\t\t\t\t\t// Screen out overly small last pieces\n\t\t\t\t\tif( currentPieceRadianAngle > 0.001 ) {\n\t\t\t\t\t\t// Make the object representing the current piece of track curve\n\t\t\t\t\t\tvar thisPiece = new Object();\n\t\t\t\t\t\tthisPiece.pieceType = \"curveRight\";\n\t\t\t\t\t\tthisPiece.radianAngle = currentPieceRadianAngle;\n\t\t\t\t\t\tthisPiece.radius = currentPieceRadius;\n\t\t\t\t\t\t// Copy start point and direction from the previous piece's finish point and direction\n\t\t\t\t\t\tthisPiece.piecePathStartPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartPoint.copy( previousPiecePathFinishPoint );\n\t\t\t\t\t\tthisPiece.piecePathStartDirection = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartDirection.copy( previousPiecePathFinishDirection );\n\t\t\t\t\t\t// Create the center point of the curve for this piece\n\t\t\t\t\t\tvar centerPoint = new THREE.Vector3();\n\t\t\t\t\t\t// - make a vector from the start point to the center point\n\t\t\t\t\t\tvar centerOffsetVector = new THREE.Vector3();\n\t\t\t\t\t\tcenterOffsetVector.copy( thisPiece.piecePathStartDirection );\t// get the piece's start direction\n\t\t\t\t\t\tcenterOffsetVector.normalize();\t// make it one unit long\n\t\t\t\t\t\tcenterOffsetVector.applyAxisAngle( yAxisDirection, -Math.PI / 2 );\t// rotate it 90 degrees clockwise = direction from path start point to center point\n\t\t\t\t\t\tcenterOffsetVector.multiplyScalar( thisPiece.radius ); // give it a length equal to the distance from the center point to all points on the path\n\t\t\t\t\t\tcenterPoint.addVectors( thisPiece.piecePathStartPoint, centerOffsetVector );\t// set the center point at the sum of the start point location vector and the offset we just made\n\t\t\t\t\t\t// Create spoke vectors from the center point to points of interest on this piece ( midpoint vertex and path finish point )\n\t\t\t\t\t\tvar startSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar middleSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar finishSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar middleSpokeEndpoint = new THREE.Vector3();\n\t\t\t\t\t\tvar spokeWorkingVector = new THREE.Vector3();\n\t\t\t\t\t\t// \"start spoke\" is from the curve center point to the piece's path start point\n\t\t\t\t\t\tstartSpokeDirection.copy( centerOffsetVector );\t// get a copy of the vector from the path start point to the curve center point\n\t\t\t\t\t\tstartSpokeDirection.normalize();\t// normalize it to a length of 1\n\t\t\t\t\t\tstartSpokeDirection.multiplyScalar( -1.0 );\t// reverse it so it's pointing from the center point to the path start point\n\t\t\t\t\t\t// \"middle spoke\" is from the curve center point to the extra vertex at the midpoint of the left side\n\t\t\t\t\t\tmiddleSpokeDirection.copy( startSpokeDirection );\t// copy the start spoke direction to the middle spoke\n\t\t\t\t\t\tmiddleSpokeDirection.applyAxisAngle( yAxisDirection, -( currentPieceRadianAngle / 2 ) );\t// rotate it clockwise through half the curve angle\n\t\t\t\t\t\t// \"finish spoke\" is from the curve center point to the piece's path finish point\n\t\t\t\t\t\tfinishSpokeDirection.copy( startSpokeDirection );\t// copy the start spoke direction to the finish spoke\n\t\t\t\t\t\tfinishSpokeDirection.applyAxisAngle( yAxisDirection, -currentPieceRadianAngle );\t// rotate it clockwise through the curve angle\n\t\t\t\t\t\t// Locate an end point for middle spoke that's the midpoint of the left side\n\t\t\t\t\t\tspokeWorkingVector.copy( middleSpokeDirection );\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( Math.cos( currentPieceRadianAngle / 2 ) * ( currentPieceRadius - ( trackWidth / 2 ) ) );\t// middle spoke direction with length to get from center to midpoint between vertex 1 and vertex 2\n\t\t\t\t\t\tmiddleSpokeEndpoint.addVectors( centerPoint, spokeWorkingVector );\n\t\t\t\t\t\t// Calculate this piece's finish point and direction\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection = new THREE.Vector3();\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( currentPieceRadius );\t// finish spoke direction from center point with length of curve radius\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint.addVectors( centerPoint, spokeWorkingVector );\n\t\t\t\t\t\t// ... the finish direction is the start direction rotated clockwise (right curve) by the piece's angle\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection.copy( thisPiece.piecePathStartDirection );\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection.applyAxisAngle( yAxisDirection, -thisPiece.radianAngle );\n\t\t\t\t\t\t// Make the ten vertices of this small piece of right curve track\n\t\t\t\t\t\tthisPiece.startRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.midpointLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.midpointLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\t// Vertex 0 = start right top\n\t\t\t\t\t\tspokeWorkingVector.copy( startSpokeDirection );\t// make a vector that reaches from the center to vertex 0\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius - ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.startRightTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 0\n\t\t\t\t\t\t// Vertex 1 = finish right top\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\t// make a vector that reaches from the center to vertex 1\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius - ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.finishRightTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 1\n\t\t\t\t\t\t// Vertex 2 = finish left top\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\t// make a vector that reaches from the center to vertex 2\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius + ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 2\n\t\t\t\t\t\t// Vertex 3 = midpoint left top\n\t\t\t\t\t\tspokeWorkingVector.copy( middleSpokeDirection );\t// make a vector that reaches from the center to vertex 3\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( Math.cos( currentPieceRadianAngle / 2 ) * ( thisPiece.radius + ( trackWidth / 2 ) ) );\n\t\t\t\t\t\tthisPiece.midpointLeftTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 3\n\t\t\t\t\t\t// Vertex 4 = start left top\n\t\t\t\t\t\tspokeWorkingVector.copy( startSpokeDirection );\t// make a vector that reaches from the center to vertex 4\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius + ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.startLeftTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 4\n\t\t\t\t\t\t// (ignore the vertical differences for now...)\n\t\t\t\t\t\t// Vertex 5 = start right bottom\n\t\t\t\t\t\tthisPiece.startRightBottomVertex.copy( thisPiece.startRightTopVertex );\n\t\t\t\t\t\t// Vertex 6 = finish right bottom\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex.copy( thisPiece.finishRightTopVertex );\n\t\t\t\t\t\t// Vertex 7 = finish left bottom\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex.copy( thisPiece.finishLeftTopVertex );\n\t\t\t\t\t\t// Vertex 8 = midpoint left bottom\n\t\t\t\t\t\tthisPiece.midpointLeftBottomVertex.copy( thisPiece.midpointLeftTopVertex );\n\t\t\t\t\t\t// Vertex 9 = start left bottom\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex.copy( thisPiece.startLeftTopVertex );\n\t\t\t\t\t\t// Push the completed piece onto the list of pieces\n\t\t\t\t\t\trrTrackPieces.push( thisPiece );\n\t\t\t\t\t\t// Update the \"previous\" path items so we can process the next small piece\n\t\t\t\t\t\tpreviousPiecePathFinishPoint.copy( thisPiece.piecePathFinishPoint );\n\t\t\t\t\t\tpreviousPiecePathFinishDirection.copy( thisPiece.piecePathFinishDirection );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"curveLeft\":\n\t\t\t\t// Get the radius of this section of curved track\n\t\t\t\tvar currentPieceRadius = rrTrackLayout[ sectionIndex ].radius;\n\t\t\t\t// Figure the piece angle that will give the configured piece length at the given radius\n\t\t\t\tvar fullPieceRadianAngle = ( rrTrackLayout[ 0 ].targetTrackPieceLength / currentPieceRadius );\n\t\t\t\t// Full pieces are the configured number of millimeters in arc length\n\t\t\t\tvar fullPieceCount = Math.floor( ( rrTrackLayout[ sectionIndex ].degreeAngle * Math.PI / 180 ) / fullPieceRadianAngle );\n\t\t\t\t// Last piece is whatever it takes to make up the actual given curve angle\n\t\t\t\tvar lastPieceRadianAngle = ( rrTrackLayout[ sectionIndex ].degreeAngle * Math.PI / 180 ) - ( fullPieceCount * fullPieceRadianAngle );\n\t\t\t\tfor( var currentPiece = 0; currentPiece < ( fullPieceCount + 1 ); currentPiece++ ) {\n\t\t\t\t\tvar currentPieceRadianAngle;\n\t\t\t\t\tif( currentPiece == fullPieceCount ) {\n\t\t\t\t\t\t// This is the odd-sized last piece\n\t\t\t\t\t\tcurrentPieceRadianAngle = lastPieceRadianAngle;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is just another full, one mm piece\n\t\t\t\t\t\tcurrentPieceRadianAngle = fullPieceRadianAngle;\n\t\t\t\t\t}\n\t\t\t\t\t// Screen out overly small last pieces\n\t\t\t\t\tif( currentPieceRadianAngle > 0.001 ) {\n\t\t\t\t\t\t// Make the object representing the current piece of track curve\n\t\t\t\t\t\tvar thisPiece = new Object();\n\t\t\t\t\t\tthisPiece.pieceType = \"curveLeft\";\n\t\t\t\t\t\tthisPiece.radianAngle = currentPieceRadianAngle;\n\t\t\t\t\t\tthisPiece.radius = currentPieceRadius;\n\t\t\t\t\t\t// Copy start point and direction from the previous piece's finish point and direction\n\t\t\t\t\t\tthisPiece.piecePathStartPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartPoint.copy( previousPiecePathFinishPoint );\n\t\t\t\t\t\tthisPiece.piecePathStartDirection = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathStartDirection.copy( previousPiecePathFinishDirection );\n\t\t\t\t\t\t// Create the center point of the curve for this piece\n\t\t\t\t\t\tvar centerPoint = new THREE.Vector3();\n\t\t\t\t\t\t// - make a vector from the start point to the center point\n\t\t\t\t\t\tvar centerOffsetVector = new THREE.Vector3();\n\t\t\t\t\t\tcenterOffsetVector.copy( thisPiece.piecePathStartDirection );\t// get the piece's start direction\n\t\t\t\t\t\tcenterOffsetVector.normalize();\t// make it one unit long\n\t\t\t\t\t\tcenterOffsetVector.applyAxisAngle( yAxisDirection, Math.PI / 2 );\t// rotate it 90 degrees counter-clockwise = direction from path start point to center point\n\t\t\t\t\t\tcenterOffsetVector.multiplyScalar( thisPiece.radius ); // give it a length equal to the distance from the center point to all points on the path\n\t\t\t\t\t\tcenterPoint.addVectors( thisPiece.piecePathStartPoint, centerOffsetVector );\t// set the center point at the sum of the start point location vector and the offset we just made\n\t\t\t\t\t\t// Create spoke vectors from the center point to points of interest on this piece ( midpoint vertex and path finish point )\n\t\t\t\t\t\tvar startSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar middleSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar finishSpokeDirection = new THREE.Vector3();\n\t\t\t\t\t\tvar middleSpokeEndpoint = new THREE.Vector3();\n\t\t\t\t\t\tvar spokeWorkingVector = new THREE.Vector3();\n\t\t\t\t\t\t// \"start spoke\" is from the curve center point to the piece's path start point\n\t\t\t\t\t\tstartSpokeDirection.copy( centerOffsetVector );\t// get a copy of the vector from the path start point to the curve center point\n\t\t\t\t\t\tstartSpokeDirection.normalize();\t// normalize it to a length of 1\n\t\t\t\t\t\tstartSpokeDirection.multiplyScalar( -1.0 );\t// reverse it so it's pointing from the center point to the path start point\n\t\t\t\t\t\t// \"middle spoke\" is from the curve center point to the extra vertex at the midpoint of the left side\n\t\t\t\t\t\tmiddleSpokeDirection.copy( startSpokeDirection );\t// copy the start spoke direction to the middle spoke\n\t\t\t\t\t\tmiddleSpokeDirection.applyAxisAngle( yAxisDirection, ( currentPieceRadianAngle / 2 ) );\t// rotate it clockwise through half the curve angle\n\t\t\t\t\t\t// \"finish spoke\" is from the curve center point to the piece's path finish point\n\t\t\t\t\t\tfinishSpokeDirection.copy( startSpokeDirection );\t// copy the start spoke direction to the finish spoke\n\t\t\t\t\t\tfinishSpokeDirection.applyAxisAngle( yAxisDirection, currentPieceRadianAngle );\t// rotate it clockwise through the curve angle\n\t\t\t\t\t\t// Locate an end point for middle spoke that's the midpoint of the left side\n\t\t\t\t\t\tspokeWorkingVector.copy( middleSpokeDirection );\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( Math.cos( currentPieceRadianAngle / 2 ) * ( currentPieceRadius - ( trackWidth / 2 ) ) );\t// middle spoke direction with length to get from center to midpoint between vertex 1 and vertex 2\n\t\t\t\t\t\tmiddleSpokeEndpoint.addVectors( centerPoint, spokeWorkingVector );\n\t\t\t\t\t\t// Calculate this piece's finish point and direction\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection = new THREE.Vector3();\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( currentPieceRadius );\t// finish spoke direction from center point with length of curve radius\n\t\t\t\t\t\tthisPiece.piecePathFinishPoint.addVectors( centerPoint, spokeWorkingVector );\n\t\t\t\t\t\t// ... the finish direction is the start direction rotated counter-clockwise (left curve) by the piece's angle\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection.copy( thisPiece.piecePathStartDirection );\n\t\t\t\t\t\tthisPiece.piecePathFinishDirection.applyAxisAngle( yAxisDirection, thisPiece.radianAngle );\n\t\t\t\t\t\t// Make the ten vertices of this small piece of right curve track\n\t\t\t\t\t\tthisPiece.startRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.midpointRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftTopVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.midpointRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex = new THREE.Vector3();\n\t\t\t\t\t\t// Vertex 0 = start right top\n\t\t\t\t\t\tspokeWorkingVector.copy( startSpokeDirection );\t// make a vector that reaches from the center to vertex 0\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius + ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.startRightTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 0\n\t\t\t\t\t\t// Vertex 1 = midpoint right top\n\t\t\t\t\t\tspokeWorkingVector.copy( middleSpokeDirection );\t// make a vector that reaches from the center to vertex 1\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( Math.cos( currentPieceRadianAngle / 2 ) * ( thisPiece.radius + ( trackWidth / 2 ) ) );\n\t\t\t\t\t\tthisPiece.midpointRightTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 1\n\t\t\t\t\t\t// Vertex 2 = finish right top\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\t// make a vector that reaches from the center to vertex 2\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius + ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.finishRightTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 2\n\t\t\t\t\t\t// Vertex 3 = finish left top\n\t\t\t\t\t\tspokeWorkingVector.copy( finishSpokeDirection );\t// make a vector that reaches from the center to vertex 3\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius - ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.finishLeftTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 3\n\t\t\t\t\t\t// Vertex 4 = start left top\n\t\t\t\t\t\tspokeWorkingVector.copy( startSpokeDirection );\t// make a vector that reaches from the center to vertex 4\n\t\t\t\t\t\tspokeWorkingVector.normalize();\n\t\t\t\t\t\tspokeWorkingVector.multiplyScalar( thisPiece.radius - ( trackWidth / 2 ) );\n\t\t\t\t\t\tthisPiece.startLeftTopVertex.addVectors( centerPoint, spokeWorkingVector );\t// place vertex 4\n\t\t\t\t\t\t// (ignore vertical distances for now...)\n\t\t\t\t\t\t// Vertex 5 = start right bottom\n\t\t\t\t\t\tthisPiece.startRightBottomVertex.copy( thisPiece.startRightTopVertex );\n\t\t\t\t\t\t// Vertex 6 = midpoint right bottom\n\t\t\t\t\t\tthisPiece.midpointRightBottomVertex.copy( thisPiece.midpointRightTopVertex );\n\t\t\t\t\t\t// Vertex 7 = finish right bottom\n\t\t\t\t\t\tthisPiece.finishRightBottomVertex.copy( thisPiece.finishRightTopVertex );\n\t\t\t\t\t\t// Vertex 8 = finish left bottom\n\t\t\t\t\t\tthisPiece.finishLeftBottomVertex.copy( thisPiece.finishLeftTopVertex );\n\t\t\t\t\t\t// Vertex 9 = start left bottom\n\t\t\t\t\t\tthisPiece.startLeftBottomVertex.copy( thisPiece.startLeftTopVertex );\n\t\t\t\t\t\t// Push the completed piece onto the list of pieces\n\t\t\t\t\t\trrTrackPieces.push( thisPiece );\n\t\t\t\t\t\t// Update the \"previous\" path items so we can process the next small piece\n\t\t\t\t\t\tpreviousPiecePathFinishPoint.copy( thisPiece.piecePathFinishPoint );\n\t\t\t\t\t\tpreviousPiecePathFinishDirection.copy( thisPiece.piecePathFinishDirection );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\talert( \"I should not be here ( figureTrackPieces()-switch-default )\" );\n\t\t\t\tbreak;\n\t\t}\n\t\t// Record the piece index where this section ends\n\t\trrTrackLayout[ sectionIndex ].endPieceIndex = rrTrackPieces.length - 1;\n\t}\n}", "title": "" }, { "docid": "676fa8145242402d9c3fdd7ae6ebe0c2", "score": "0.5800728", "text": "theHill(base) {\n const positions = this._positionsCross();\n const parts = [];\n positions.forEach((position) => {\n const hull = base();\n parts.push({ hull, position });\n });\n const size = ASTEROID_SIZE * 2;\n const onHit = [{ effect: \"break\" }];\n return { parts, size, onHit };\n }", "title": "" }, { "docid": "8df83387f50ac1173a1646558ff60ad2", "score": "0.5733355", "text": "function placePiece() {\n if (currentPiece) {\n $.each(currentPieceCoords, function (key, value) {\n\n if ((value[0] + currentPieceY) >= 0){\n board[value[0] + currentPieceY][value[1] + currentPieceX] = value[2];\n }\n\n });\n\n currentPiece = false;\n }\n }", "title": "" }, { "docid": "6b84409a84421ec8daf61c8c8bf7bae1", "score": "0.5733243", "text": "function placePieces() {\r\n clearBoard();\r\n for (i = 0; i < 8; i++) {\r\n for (j = 0; j < 8; j++) {\r\n if (!pieces[i][j]) {\r\n continue;\r\n }\r\n let curPiece = document.createElement(\"img\");\r\n curPiece.className = \"Piece\";\r\n let pname = pieceName[pieces[i][j].piece];\r\n curPiece.id = pname + i + j;\r\n curPiece.src = \"Images/\" + colorName[pieces[i][j].color] + \"-\" + pname + \".png\";\r\n squares[i][j].appendChild(curPiece);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "9657775b4ab12d3185bc6b10a7476673", "score": "0.57318753", "text": "function drawPieces(elem, xPos, yPos, xHint, yHint, pNum) {\n\t\tvar bmp, iSrc;\n\t\t\tiSrc = imgurl + \"thumb/\" + elem + \".png\";\n\n\t\t\tbmp = new createjs.Bitmap(iSrc);\n\t\t\tbmp.regX = bmp.regY = 303;\n\t\t\tbmp.x = bmp.originX = xPos;\n\t\t\tbmp.y = bmp.originY = yPos;\n\t\t\tbmp.set({\n\t\t\t\tname: elem,\n\t\t\t\tcursor: \"pointer\",\n\t\t\t\tisDragging: false,\n\t\t\t\tisLegitPlacement: false,\n\t\t\t\tisThumb: true,\n\t\t\t\tisInFooter: false,\n\t\t\t\tfooterX: xHint,\n\t\t\t\tfooterY: yHint,\n\t\t\t\tstoreRotation: 0,\n\t\t\t\tstoreFlip: 1,\n\t\t\t\tisPostNum: pNum\n\t\t\t})\n\n\t\t\tbmp.image.onload = function() {\n\t\t\t\tstage.addChild(bmp);\n\t\t\t\tstage.update();\n\t\t\t}\n\n\t\t\tbmp.on(\"mousedown\", function(e) {\n\t\t\t\tthis.offset = { x: this.x - e.stageX, y: this.y - e.stageY };\n\t\t\t});\n\n\t\t\tbmp.on(\"mouseover\", function(e) {\n\t\t\t\tif (!this.isThumb && !this.isInFooter) {\n\t\t\t\t\tthis.image = preload.getResult(\"ov_\" + this.name);\n\t\t\t\t\tstage.update();\n\t\t\t\t}\n\t\t\t})\n\t\t\tbmp.on(\"mouseout\", function(e) {\n\t\t\t\tif (!this.isThumb && !this.isInFooter) {\n\t\t\t\t\tthis.image = preload.getResult(this.name);\n\t\t\t\t\tstage.update();\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// pressmove event will run while mouse moves until released\n\t\t\tbmp.on(\"pressmove\", function(e) {\n\t\t\t\tvar piece = this;\n\n\t\t\t\tif (stageOne || piece.isPostNum == true) { dragPiece(piece, e); }\n\t\t\t\t\n\t\t\t\tstage.update(); \n\t\t\t});\n\n\t\t\tbmp.on(\"pressup\", function(e) {\n\t\t\t\tvar piece = this;\n\t\t\t\t\n\t\t\t\tif (stageOne || piece.isPostNum == true) { dropPiece(piece); }\n\t\t\t\telse { containPiece(piece); }\n\n\t\t\t\tstage.update();\n\t\t\t})\n\n\t\treturn bmp;\n\t}", "title": "" }, { "docid": "8928df018907b64ba571531ec1fd834d", "score": "0.5726951", "text": "function placedBlockParams(pos_x, pos_y){\r\n\r\n\tif(placedPieces.length==0){\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t//console.log(\"mouse pos : \"+pos_x+\":\"+pos_y);\r\n\r\n\tvar posx;\r\n\tvar posy;\r\n\r\n\tfor(var i=0;i<placedPieces.length;i++){\r\n\tpiece=placedPieces[i];\r\n\tvar divw = (layout.width/canvas.width);\r\n\tvar divh = (layout.height/canvas.height);\r\n\tposx = Math.trunc(piece.posx*divw);\r\n\tposy = Math.trunc(piece.posy*divh);\r\n\tif(posx>pos_x*divw+3 || posx<pos_x*divw-3 || posy>pos_y*divh+3 || posy<pos_y*divh-3 || piece.posz != current_layer){\r\n\t continue;\r\n\t}\r\n\tvar position = piecePosition(piece.orientation, posx, posy, piece.sizex, piece.sizey);\r\n\r\n\tposx=position.posx;\r\n\tposy=position.posy;\r\n\tvar sizex=position.sizex;\r\n\tvar sizey=position.sizey;\r\n\r\n\t//console.log(\"pos : \"+posx+\":\"+posy+\"size : \"+sizex+\":\"+sizey);\r\n\r\n\tposx=posx*(canvas.width/layout.width);\r\n\tposy=posy*(canvas.height/layout.height);\r\n\r\n\tif(posx<=pos_x && posx+(sizex*(canvas.width/layout.width))>=pos_x && posy<=pos_y && posy+(sizey*(canvas.height/layout.height))>=pos_y){\r\n\t\treturn({index : i, posx: posx, posy: posy, sizex: sizex, sizey: sizey, posz: piece.posz});\r\n\t}\r\n}\r\n\r\n\treturn 0;\r\n}", "title": "" }, { "docid": "6e93eba08989a1a4f3ce0eefd670386b", "score": "0.5721163", "text": "function addPiece(){\n checkBlocks(currBlock.tetromino, currBlock.x, currBlock.y, currBlock.rotateForm, function(x,y){\n setBlock(x, y, currBlock.tetromino);\n });\n }", "title": "" }, { "docid": "ec6831ec09e94135f3f9d15685da96d4", "score": "0.5708115", "text": "function drawPieces() {\n\tfor (var row = 0; row < 8; row ++) {\n\t\tfor (var col = 0; col < 8; col ++) {\n\t\t\tif (chess.board[row][col]) {\n\t\t\t\tdrawPiece(chess.board[row][col], row, col);\n\t\t\t}\n\t\t}\n\t}\n\t// Apply rotation if needed\n\tif (chess.options.whiteOnTop) updateTransform();\n}", "title": "" }, { "docid": "abee57961dbe53a410cf7906d1b3fe76", "score": "0.5705912", "text": "function buildSideFaces() {\n\n\t \t\tvar layeroffset = 0;\n\t \t\tsidewalls( contour, layeroffset );\n\t \t\tlayeroffset += contour.length;\n\n\t \t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t \t\t\tahole = holes[ h ];\n\t \t\t\tsidewalls( ahole, layeroffset );\n\n\t \t\t\t//, true\n\t \t\t\tlayeroffset += ahole.length;\n\n\t \t\t}\n\n\t \t}", "title": "" }, { "docid": "8429c7d70ff58c8914fc490807eb802f", "score": "0.5703797", "text": "setStartPieces() {\n\t\tthis.renewPiece(1);\n\t\tthis.renewPiece(2);\n\t\tthis.dispensers = [[], []];\n\t\tfor (const key in this.pieces) {\n\t\t\tif (key == 1 || key == 2) { //Dispenser pieces\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst piece = this.pieces[key];\n\t\t\tif (!piece) continue;\n\t\t\tif (piece.color === 1) {\n\t\t\t\tthis.dispensers[0].push(piece);\n\t\t\t} else if (piece.color === 2) {\n\t\t\t\tthis.dispensers[1].unshift(piece);\n\t\t\t}\n\t\t}\n\t\tthis.removePieceToDispenser(1);\n\t\tthis.removePieceToDispenser(2);\n\t}", "title": "" }, { "docid": "36b49cfeded7157c566851846470c3e5", "score": "0.56881773", "text": "function buildSideFaces() {\r\n\t\r\n\t\t\tvar layeroffset = 0;\r\n\t\t\tsidewalls( contour, layeroffset );\r\n\t\t\tlayeroffset += contour.length;\r\n\t\r\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\t\r\n\t\t\t\tahole = holes[ h ];\r\n\t\t\t\tsidewalls( ahole, layeroffset );\r\n\t\r\n\t\t\t\t//, true\r\n\t\t\t\tlayeroffset += ahole.length;\r\n\t\r\n\t\t\t}\r\n\t\r\n\t\t}", "title": "" }, { "docid": "36b49cfeded7157c566851846470c3e5", "score": "0.56881773", "text": "function buildSideFaces() {\r\n\t\r\n\t\t\tvar layeroffset = 0;\r\n\t\t\tsidewalls( contour, layeroffset );\r\n\t\t\tlayeroffset += contour.length;\r\n\t\r\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\t\r\n\t\t\t\tahole = holes[ h ];\r\n\t\t\t\tsidewalls( ahole, layeroffset );\r\n\t\r\n\t\t\t\t//, true\r\n\t\t\t\tlayeroffset += ahole.length;\r\n\t\r\n\t\t\t}\r\n\t\r\n\t\t}", "title": "" }, { "docid": "fdbdecb728d936366cad21a1d109b5db", "score": "0.5683524", "text": "function placePieces() {\r\n let board = id('board').children;\r\n for (let i = 0; i < 8; i += 7) {\r\n let blackrook = document.createElement(\"img\");\r\n blackrook.classList.add('piece');\r\n blackrook.src = \"sources/rook-black.png\";\r\n blackrook.alt = \"rook-black\";\r\n board[i].appendChild(blackrook);\r\n movePiece(-1, i, blackrook.alt);\r\n }\r\n\r\n for (let i = 1; i < 8; i +=5) {\r\n let knight = document.createElement(\"img\");\r\n knight.classList.add('piece');\r\n knight.src = \"sources/knight-black.png\"\r\n knight.alt = \"knight-black\";\r\n board[i].appendChild(knight);\r\n movePiece(-1, i, knight.alt);\r\n }\r\n\r\n for (let i = 2; i < 8; i += 3) {\r\n let bishop = document.createElement(\"img\");\r\n bishop.classList.add('piece');\r\n bishop.src = \"sources/bishop-black.png\"\r\n bishop.alt = \"bishop-black\";\r\n board[i].appendChild(bishop);\r\n movePiece(-1, i, bishop.alt);\r\n }\r\n\r\n for (let i = 8; i < 16; i++) {\r\n let pawn = document.createElement('img');\r\n pawn.classList.add('piece');\r\n pawn.src = \"sources/pawn-black.png\";\r\n pawn.alt = \"pawn-black\";\r\n board[i].appendChild(pawn);\r\n movePiece(-1, i, pawn.alt);\r\n }\r\n\r\n let queen = document.createElement('img');\r\n queen.classList.add('piece');\r\n queen.src = \"sources/queen-black.png\";\r\n queen.alt = \"queen-black\";\r\n board[3].appendChild(queen);\r\n movePiece(-1, 3, queen.alt);\r\n\r\n let king = document.createElement('img');\r\n king.classList.add('piece');\r\n king.src = \"sources/king-black.png\";\r\n king.alt = \"king-black\";\r\n board[4].appendChild(king);\r\n movePiece(-1, 4, king.alt);\r\n\r\n //same as black pieces but in reverse\r\n for (let i = 63; i > 63-8; i -= 7) {\r\n let rook = document.createElement(\"img\");\r\n rook.classList.add('piece');\r\n rook.src = \"sources/rook-white.png\";\r\n rook.alt = \"rook-white\";\r\n board[i].appendChild(rook);\r\n movePiece(-1, i, rook.alt);\r\n }\r\n for (let i = 62; i > 62-8; i -=5) {\r\n let knight = document.createElement(\"img\");\r\n knight.classList.add('piece');\r\n knight.src = \"sources/knight-white.png\"\r\n knight.alt = \"knight-white\";\r\n board[i].appendChild(knight);\r\n movePiece(-1, i, knight.alt);\r\n }\r\n for (let i = 63-2; i > 63-8; i -= 3) {\r\n let bishop = document.createElement(\"img\");\r\n bishop.classList.add('piece');\r\n bishop.src = \"sources/bishop-white.png\"\r\n bishop.alt = \"bishop-white\";\r\n board[i].appendChild(bishop);\r\n movePiece(-1, i, bishop.alt);\r\n }\r\n\r\n for (let i = 63-8; i > 63-16; i--) {\r\n let pawn = document.createElement('img');\r\n pawn.classList.add('piece');\r\n pawn.src = \"sources/pawn-white.png\";\r\n pawn.alt = \"pawn-white\";\r\n board[i].appendChild(pawn);\r\n movePiece(-1, i, pawn.alt);\r\n }\r\n\r\n let whitequeen = document.createElement('img');\r\n whitequeen.classList.add('piece');\r\n whitequeen.src = \"sources/queen-white.png\";\r\n whitequeen.alt = \"queen-white\";\r\n board[63-4].appendChild(whitequeen);\r\n movePiece(-1, 63-4, whitequeen.alt);\r\n\r\n let whiteking = document.createElement('img');\r\n whiteking.classList.add('piece');\r\n whiteking.src = \"sources/king-white.png\";\r\n whiteking.alt = \"king-white\";\r\n board[63-3].appendChild(whiteking);\r\n movePiece(-1, 63-3, whiteking.alt);\r\n }", "title": "" }, { "docid": "e6d16031b9a09d2c09de718ad4a4f5b7", "score": "0.56604105", "text": "function buildSideFaces() {\n\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\t\t}", "title": "" }, { "docid": "1529ca22b1a64462f04c75957991c605", "score": "0.5650717", "text": "async addElectronicParts (electronic, general) {\n let board // parent of all electronics which are covers\n if (Object.keys(electronic).length !== 0) {\n board = new BABYLON.AbstractMesh('parent', this.scene)\n\n for (let i = 0; i < electronic.length; i++) {\n const engineData = electronic[i].engine[0]\n \n for (let j = 0; j < engineData.length; j++) {\n const comp = engineData[j]\n\n for (let k = 0; k < comp.length; k++) {\n const parts = comp[k]\n\n if (parts.transform.display === 1) {\n this.elecShowOnly.push(parts)\n }\n }\n }\n }\n \n for (let i = 0; i < this.elecShowOnly.length; i++) {\n this.elecShowOnly[i].elem = await this.importElecPart(this.elecShowOnly[i], board)\n const kids = this.elecShowOnly[i].elem.getChildren()\n const body = kids.find(obj => {\n return obj.name === 'Body'\n })\n \n const decal = body.getChildren()[0]\n decal.isPickable = false\n\n // const _this = this\n body.actionManager = new BABYLON.ActionManager(this.scene)\n body.actionManager.registerAction(\n new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLeftPickTrigger, () => {\n alert('Denied. Not interractable')\n }))\n }\n }\n\n if (Object.keys(general).length !== 0) {\n if (this.items.length === 0 || !this.items[0].electronic) {\n return\n }\n\n this.coverHoles = general.coverHoles\n this.items[0].meta = { cur: 0, opos: 1, axis: 'z' }\n this.items[1].meta = { cur: 1, opos: 0, axis: 'z' }\n this.items[2].meta = { cur: 2, opos: 3, axis: 'x' }\n this.items[3].meta = { cur: 3, opos: 2, axis: 'x' }\n this.items[4].meta = { cur: 4, opos: 5, axis: 'y' }\n this.items[5].meta = { cur: 5, opos: 4, axis: 'y' }\n\n for (let i = 0; i < 6; i++) {\n this.addHoleToTheBox(i)\n }\n\n this.updateCover()\n }\n \n console.log('Import box cover directly with dimenions from general scene')\n return\n /*\n // console.log(pos, size)\n // let elec = null\n let coverElect = []\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].electronic) {\n // elec = this.items[i]\n coverElect.push(this.items[i])\n }\n }\n console.log(coverElect)\n \n if (coverElect.length !== 0) {\n coverElect[0].scaling = new BABYLON.Vector3(size.x, size.y, 0.1)\n coverElect[0].meta = { cur: 0, opos: 1, axis: 'z' }\n coverElect[1].scaling = new BABYLON.Vector3(size.x, size.y, 0.1)\n coverElect[1].meta = { cur: 1, opos: 0, axis: 'z' }\n coverElect[2].scaling = new BABYLON.Vector3(0.1, size.y, size.z)\n coverElect[2].meta = { cur: 2, opos: 3, axis: 'x' }\n coverElect[3].scaling = new BABYLON.Vector3(0.1, size.y, size.z)\n coverElect[3].meta = { cur: 3, opos: 2, axis: 'x' }\n coverElect[4].scaling = new BABYLON.Vector3(size.x, 0.1, size.z)\n coverElect[4].meta = { cur: 4, opos: 5, axis: 'y' }\n coverElect[5].scaling = new BABYLON.Vector3(size.x, 0.1, size.z)\n coverElect[5].meta = { cur: 5, opos: 4, axis: 'y' }\n\n coverElect[0].position = new BABYLON.Vector3(0, size.y / 2, size.z / 2 - 0.05)\n coverElect[1].position = new BABYLON.Vector3(0, size.y / 2, -size.z / 2 + 0.05)\n coverElect[2].position = new BABYLON.Vector3(size.x / 2 - 0.05, size.y / 2, 0)\n coverElect[3].position = new BABYLON.Vector3(-size.x / 2 + 0.05, size.y / 2, 0)\n coverElect[4].position = new BABYLON.Vector3(0, 0.05, 0)\n coverElect[5].position = new BABYLON.Vector3(0, size.y - 0.05, 0)\n await this.gizmoCallbacks()\n }*/\n /*\n // if cover is not already loaded\n else {\n // add box cover based on electronic pcb\n await this.import3dModel({\"url\":\"user-6f7326715bc046f9a6aec22563a2fe4f.glb\",\"transform\":{\"position\":[0, 0, 0],\"rotation\":[0,0,0],\"scale\":[1, 1, 1],\"color\":\"#6d0253\", \"electronic\":true}})\n \n this.getData()\n \n // get cover again\n for (let i = 0; i < this.items.length; i++) {\n // console.log(i, this.items[i])\n if (this.items[i].electronic) {\n // box = this.items[i]\n coverElect.push(this.items[i])\n }\n }\n\n // this.selected = box\n // this.selected.position = new BABYLON.Vector3(pos.x, pos.y, pos.z)\n // this.selected.scaling = new BABYLON.Vector3(size.x, size.y, size.z)\n \n coverElect[0].scaling = new BABYLON.Vector3(size.x, size.y, 0.1)\n coverElect[0].meta = { cur: 0, opos: 1, axis: 'z' }\n coverElect[1].scaling = new BABYLON.Vector3(size.x, size.y, 0.1)\n coverElect[1].meta = { cur: 1, opos: 0, axis: 'z' }\n coverElect[2].scaling = new BABYLON.Vector3(0.1, size.y, size.z)\n coverElect[2].meta = { cur: 2, opos: 3, axis: 'x' }\n coverElect[3].scaling = new BABYLON.Vector3(0.1, size.y, size.z)\n coverElect[3].meta = { cur: 3, opos: 2, axis: 'x' }\n coverElect[4].scaling = new BABYLON.Vector3(size.x, 0.1, size.z)\n coverElect[4].meta = { cur: 4, opos: 5, axis: 'y' }\n coverElect[5].scaling = new BABYLON.Vector3(size.x, 0.1, size.z)\n coverElect[5].meta = { cur: 5, opos: 4, axis: 'y' }\n\n coverElect[0].position = new BABYLON.Vector3(0, size.y / 2, size.z / 2 - 0.05)\n coverElect[1].position = new BABYLON.Vector3(0, size.y / 2, -size.z / 2 + 0.05)\n coverElect[2].position = new BABYLON.Vector3(size.x / 2 - 0.05, size.y / 2, 0)\n coverElect[3].position = new BABYLON.Vector3(-size.x / 2 + 0.05, size.y / 2, 0)\n coverElect[4].position = new BABYLON.Vector3(0, 0.05, 0)\n coverElect[5].position = new BABYLON.Vector3(0, size.y - 0.05, 0)\n await this.gizmoCallbacks()\n }*/\n /*\n // for csg - bellow\n const _this = this\n setTimeout (async () => {\n \n const kids = _this.selected.getDescendants(false)\n let boxCover = kids[kids.length - 1]\n const screwCovers = _this.addScrewCovers(electronic[0])\n boxCover = _this.mergeScrewCovers(boxCover, screwCovers)\n\n boxCover.setVerticesData(BABYLON.VertexBuffer.UVKind, [])\n console.log(boxCover)\n let meshes = []\n \n for (let i = 0; i < _this.scene.meshes.length; i++) {\n // this.scene.meshes[i].showBoundingBox = true\n if (_this.scene.meshes[i].name === 'Body') { // check intersection only with body of electronics\n if (boxCover.intersectsMesh(_this.scene.meshes[i], true)) {\n // console.log(i, this.scene.meshes[i].name, this.scene.meshes[i])\n\n // HERE CREATE ONLY THE BOXES FOR INTERSECTIONS // TODO: IF THERE ARE CYLINDERS\n const bbinfo = _this.scene.meshes[i].getBoundingInfo().boundingBox\n const box = new BABYLON.Mesh.CreateBox('box', 1, _this.scene)\n box.position = bbinfo.centerWorld\n box.scaling = bbinfo.extendSizeWorld.scale(2.03)\n // console.log(box)\n meshes.push(box)\n }\n }\n }\n\n for (let i = meshes.length - 1; i >= 0; i--) {\n boxCover = await _this.subtractElectronics(meshes[i], boxCover)\n \n // reparent boxCover to glb parent\n boxCover.setParent(_this.selected.getChildren()[0])\n boxCover.position = BABYLON.Vector3.Zero()\n boxCover.scaling = new BABYLON.Vector3(1, -1, -1)\n }\n\n this.addActionsToMesh(boxCover, this.selected)\n console.log('box cover ', boxCover)\n }, 100)\n */\n }", "title": "" }, { "docid": "ff7152409a4cdd8f8b92d204907dbbc3", "score": "0.56322396", "text": "function SetUpBuildings(){\n\t/******* Generate buildings ********/\n\t// Building 1: 1 X 3 X 1, centered at (1.5, 1.5, 0.0)\n\tvar building1 = GenerateBlock(1,2,0,3,-0.5,0.5);\n\tpoints = points.concat(building1);\n\t\n\t//Building 2: 1 X 1.5 X 1, centered at (-1.5, 0.75, 0.0)\n\tvar building2 = GenerateBlock(-2,-1,0,1.5,-0.5,0.5);\n\tpoints = points.concat(building2);\n\t\n\t//Building 3: 2 X 1 X 1, centered at (0.0, 0.5, 1.5)\n\tvar building3 = GenerateBlock(-1,1,0,1,1,2);\n\tpoints = points.concat(building3);\n\t\n\t//Building 4: 2 X 1 X 1, centered at (0.0, 0.5, -1.5) \n\tvar building4 = GenerateBlock(-1,1,0,1,-2,-1);\n\tpoints = points.concat(building4);\n\t\n}", "title": "" }, { "docid": "a5e6b194ab37cc1a3cf08ad1fb255e89", "score": "0.56254524", "text": "initPieces() {\n\t\tthis.pieces = [];\n\t\tfor (let i = 1; i <= 13; i++) {\n\t\t\tfor (let j = 1; j <= 13; j++) {\n\t\t\t\tif (j === 1 || j === 13 || i === 1 || i === 13) {\n\t\t\t\t\tthis.pieces[Game.calculateId(i, j)] = new Piece(this.scene, 3, i, j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "7864bc04c8d44c6ea4d47a5aec304b2f", "score": "0.5617187", "text": "addPiece() {\r\n this.pieces.push(new Piece(this.pieces.length, this.getPlayer(), this.displayObject.getPosition().x, this.displayObject.getSize().width, this.displayObject.getSize().height, this.scene))\r\n }", "title": "" }, { "docid": "ca3fd15f2dc16ee90f700df2f6e9fbc9", "score": "0.5608925", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "6a729475d5a77cda10571427b71f2a47", "score": "0.56009144", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "6a729475d5a77cda10571427b71f2a47", "score": "0.56009144", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "6a729475d5a77cda10571427b71f2a47", "score": "0.56009144", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "6a729475d5a77cda10571427b71f2a47", "score": "0.56009144", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "6a729475d5a77cda10571427b71f2a47", "score": "0.56009144", "text": "function buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}", "title": "" }, { "docid": "82eeb1d3e1202f35acbdd5b62f00966d", "score": "0.55922633", "text": "function main(params) {\r\n var _w = params.drawer_width + params.house_tolerance * 2 + params.house_thickness * 2;\r\n var _d = params.drawer_depth + params.house_tolerance + params.house_thickness;\r\n var _h = params.drawer_height + params.house_tolerance * 2 + params.house_thickness * 2;\r\n\r\n var _sw = _w * params.house_h_count - ((params.house_h_count - 1) * params.house_thickness);//stack total width\r\n var _sh = _h * params.house_v_count - ((params.house_v_count - 1) * params.house_thickness);//stack total height\r\n\r\n var body = cube({ size: [_w, _d, _h], center: true });\r\n body = makeMainCavity(body);\r\n body = makeSidesWindowCavity(body);\r\n body = makeBackWindowCavity(body);\r\n body = createStack(body);\r\n body = addTopCover(body);\r\n body = addLugs(body);\r\n\r\n return [body.rotateX(-90).translate([0, 0, _d / 2])];\r\n //return [body.translate([0,0,0])];\r\n //return [body.translate([0,0,_sh/2])];\r\n\r\n function addLugs(body) {\r\n var longSideLen = params.house_lugLongSideLen;\r\n var shortSideLen = params.house_lugShortSideLen;\r\n var innerHoleLen = params.house_lugInnerHoleLen;\r\n var thick = params.house_lugThickness;\r\n var sidesLugsOffset = 3;\r\n var gapTolerance = 0.3;\r\n var lug = difference(\r\n polygon([\r\n [-shortSideLen, 0], [0, 0],\r\n [0, -longSideLen], [-shortSideLen, -shortSideLen]]),\r\n polygon([\r\n [0, 0], [innerHoleLen, 0],\r\n [innerHoleLen, -innerHoleLen], [0, -innerHoleLen]])\r\n .translate([(-shortSideLen - innerHoleLen) / 2, -(shortSideLen - innerHoleLen) / 2, 0]));\r\n\r\n lug = linear_extrude({ height: thick }, lug);\r\n\r\n if (params.house_top_lug) {\r\n var topLugs = lug.rotateY(90).rotateZ(180).translate([thick / 2, -longSideLen, 0]);\r\n var topLugsRight = topLugs.translate([_sw / 2 - thick / 2 - thick - sidesLugsOffset - gapTolerance, _d / 2, _sh / 2]);\r\n var topLugsLeft = topLugs.translate([-_sw / 2 + thick / 2 + thick + sidesLugsOffset + gapTolerance, _d / 2, _sh / 2]);\r\n topLugsRight = union(topLugsRight, topLugsRight.translate([0, -_d + longSideLen, 0]));\r\n topLugsLeft = union(topLugsLeft, topLugsLeft.translate([0, -_d + longSideLen, 0]));\r\n body = union(body, topLugsRight, topLugsLeft);\r\n }\r\n if (params.house_bottom_lug) {\r\n var bottomLugs = lug.rotateY(-90).rotateZ(180).translate([-thick / 2, -longSideLen, -_sh]);\r\n var bottomLugsRight = bottomLugs.translate([_sw / 2 - thick / 2 - sidesLugsOffset, _d / 2, _sh / 2]);\r\n var bottomLugsLeft = bottomLugs.translate([-_sw / 2 + thick / 2 + sidesLugsOffset, _d / 2, _sh / 2]);\r\n bottomLugsRight = union(bottomLugsRight, bottomLugsRight.translate([0, -_d + longSideLen, 0]));\r\n bottomLugsLeft = union(bottomLugsLeft, bottomLugsLeft.translate([0, -_d + longSideLen, 0]));\r\n body = union(body, bottomLugsRight, bottomLugsLeft);\r\n }\r\n if (params.house_left_lug) {\r\n var offset = thick / 2 + thick + sidesLugsOffset + gapTolerance;\r\n var leftLugs = lug.rotateX(180).translate([0, -longSideLen, thick / 2]);\r\n var leftLugsTop = leftLugs.translate([-_sw / 2, _d / 2, _sh / 2 - offset]);\r\n var leftLugsBottom = leftLugs.translate([-_sw / 2, _d / 2, -_sh / 2 + offset]);\r\n leftLugsTop = union(leftLugsTop, leftLugsTop.translate([0, -_d + longSideLen, 0]));\r\n leftLugsBottom = union(leftLugsBottom, leftLugsBottom.translate([0, -_d + longSideLen, 0]));\r\n body = union(body, leftLugsTop, leftLugsBottom);\r\n\r\n var cornerSupport = polygon([[0, 0], [longSideLen + offset + thick / 2, 0], [0, longSideLen + offset + thick / 2]]);\r\n cornerSupport = linear_extrude({ height: params.house_thickness }, cornerSupport);\r\n cornerSupport = cornerSupport.rotateY(90).rotateZ(180).translate([-_sw / 2 + params.house_thickness, _d / 2, _sh / 2]);\r\n cornerSupport = union(cornerSupport, cornerSupport.mirroredY());\r\n cornerSupport = union(cornerSupport, cornerSupport.mirroredZ());\r\n body = union(body, cornerSupport);\r\n }\r\n if (params.house_right_lug) {\r\n var offset = thick / 2 + sidesLugsOffset;\r\n var rightLugs = lug.rotateY(180).rotateX(180).translate([0, -longSideLen, -thick / 2]);\r\n var rightLugsTop = rightLugs.translate([_sw / 2, _d / 2, _sh / 2 - offset]);\r\n var rightLugsBottom = rightLugs.translate([_sw / 2, _d / 2, -_sh / 2 + offset]);\r\n rightLugsTop = union(rightLugsTop, rightLugsTop.translate([0, -_d + longSideLen, 0]));\r\n rightLugsBottom = union(rightLugsBottom, rightLugsBottom.translate([0, -_d + longSideLen, 0]));\r\n body = union(body, rightLugsTop, rightLugsBottom);\r\n\r\n var cornerSupport = polygon([[0, 0], [longSideLen + offset + thick / 2, 0], [0, longSideLen + offset + thick / 2]]);\r\n cornerSupport = linear_extrude({ height: params.house_thickness }, cornerSupport);\r\n cornerSupport = cornerSupport.rotateY(90).rotateZ(180).translate([_sw / 2, _d / 2, _sh / 2]);\r\n cornerSupport = union(cornerSupport, cornerSupport.mirroredY());\r\n cornerSupport = union(cornerSupport, cornerSupport.mirroredZ());\r\n body = union(body, cornerSupport);\r\n }\r\n\r\n return body;\r\n }\r\n\r\n function addTopCover(body) {\r\n var topCoverThick = 0.8;\r\n var topCover = cube({ size: [_sw, _d, topCoverThick], center: true });\r\n return union(body, topCover.translate([0, 0, _sh / 2 - topCoverThick / 2]));\r\n }\r\n\r\n function createStack(body) {\r\n var w = _w - params.house_thickness;\r\n var h = _h - params.house_thickness;\r\n var stack = difference(cube(), cube());//empty object\r\n\r\n for (var i = 0; i < params.house_v_count; i++) {\r\n for (var j = 0; j < params.house_h_count; j++) {\r\n stack = union(stack, body.translate([j * w, 0, i * h]));\r\n }\r\n }\r\n\r\n return stack.translate([_w / 2, 0, _h / 2])\r\n .translate([-_sw / 2, 0, -_sh / 2]);\r\n }\r\n\r\n function makeBackWindowCavity(body) {\r\n var w = _w - params.house_thickness * 2;\r\n var h = _h - params.house_thickness * 2;\r\n var x = Math.min(Math.min(w, h) / 2, 5);\r\n\r\n var c = polygon([[-w / 2 + x, h / 2], [w / 2 - x, h / 2], [w / 2, h / 2 - x], [w / 2, -h / 2 + x],\r\n [w / 2 - x, -h / 2], [-w / 2 + x, -h / 2], [-w / 2, -h / 2 + x], [-w / 2, h / 2 - x]]);\r\n c = linear_extrude({ height: params.house_thickness, center: true }, c)\r\n .rotateX(90)\r\n .translate([0, _d / 2 - params.house_thickness / 2, 0]);\r\n\r\n body = difference(body, c);\r\n\r\n return body;\r\n }\r\n\r\n function makeSidesWindowCavity(body) {\r\n var cw = (_w - params.house_thickness * 2) * params.house_window_w_prcnt;\r\n var cd = (_d - params.house_thickness) * params.house_window_d_prcnt;\r\n var ch = (_h - params.house_thickness * 2) * params.house_window_h_prcnt;\r\n\r\n if (cw > 0 && cd > 0) {\r\n body = difference(body, cube({ size: [cw, cd, _h], center: true })\r\n .translate([0, -params.house_thickness / 2, 0]));\r\n }\r\n if (ch > 0 && cd > 0) {\r\n body = difference(body, cube({ size: [_w, cd, ch], center: true })\r\n .translate([0, -params.house_thickness / 2, 0]));\r\n }\r\n return body;\r\n }\r\n\r\n function makeMainCavity(body) {\r\n var cw = _w - params.house_thickness * 2;\r\n var ch = _h - params.house_thickness * 2;\r\n\r\n body = difference(body, cube({ size: [cw, _d, ch], center: true })\r\n .translate([0, -params.house_thickness, 0]));\r\n\r\n return body;\r\n }\r\n\r\n}", "title": "" }, { "docid": "67b79e7612677f6081ec98d5d820d378", "score": "0.5583988", "text": "function draw(){\r\n\r\n\t\t\t\tfor(var i=0; i<size; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar marge = getMarge(i);\r\n\t\t\t\t\t$(\".piece-\"+i,$game).css({\r\n\t\t\t\t\t\tmarginLeft : marge.x+\"px\",\r\n\t\t\t\t\t\tmarginTop : marge.y+\"px\"\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t}", "title": "" }, { "docid": "ba66e8b7351818227f66e3c3c5a5aecc", "score": "0.55827975", "text": "function buildPartsArea() {\n debug && console.log( \"WorkOrderHistoryReview.buildPartsArea: Building the parts content display.\" );\n\n workOrderHistoryReviewPage.append( new EJS({url: 'templates/workorderhistorypartsheader'}).render() );\n var partLocation = \"\";\n\n // scan all work order lines\n for( var line in workOrderLines ) {\n if ( workOrderLines[line].inventoryId ) {\n partLocation = JSONData.getInventoryLocationString( line.inventoryId() );\n } else {\n partLocation = JSONData.getInventoryLocationString( null );\n }\n workOrderHistoryReviewPage.append( new EJS({url: 'templates/workorderhistorypart'}).render({\n line: workOrderLines[line],\n location: partLocation\n }));\n }\n }", "title": "" }, { "docid": "5849146412feac1696372668591d0739", "score": "0.55774105", "text": "execute () {\n // Set the new position for the piece.\n this.state.setPieceAtPosition({ piece: this.piece, x: this.x, y: this.y })\n // Tween the graphics.\n return this.piece.tween({ x: this.x, y: this.y })\n }", "title": "" }, { "docid": "b3a53b058a619cb6a4edc6a7ff71a605", "score": "0.55770445", "text": "function drawPieces() {\n for (var i = 0; i < PIECESNR; i++) {\n var position = positionArray[i];\n var piece = positionArray[i].piece;\n var movingPiece;\n\n if (fromPiece != i) {\n context.drawImage(image, piece.x, piece.y, pieceWidth, pieceHeight,\n position.x, position.y, pieceWidth, pieceHeight);\n } else {\n movingPiece = piece;\n }\n\n if (solved == false) {\n drawBorder();\n }\n\n if (movingPiece != null) {\n var centerX = mouseX - pieceWidth / 2;\n var centerY = mouseY - pieceHeight / 2;\n context.drawImage(image, movingPiece.x, movingPiece.y, pieceWidth, pieceHeight,\n centerX, centerY, pieceWidth, pieceHeight);\n }\n }\n}", "title": "" }, { "docid": "f01df0b5ae1b6719064cab966e072b64", "score": "0.5569624", "text": "function buildSideFaces() {\n\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "ea7f88b31740ffbd35b2796d6b1178c7", "score": "0.5559066", "text": "function initPieces() {\n for (let i = 0; i < pieces.length; ++i) { \n\n //disable native drag event\n pieces[i].ondragstart = function() {\n return false;\n };\n pieces[i].ontouchstart = function(event) {\n let currSquare = maxOverlap(this, potentialDrops(this));\n let validMoves = getValidMoves(this);\n\n if (event.touches.length > 1) {\n event.preventDefault();\n onTouchUp();\n return;\n }\n this.style.position = 'absolute';\n this.style.zIndex = 1;\n document.body.append(this);\n\n moveAt(event.touches[0].pageX, event.touches[0].pageY, pieces[i]);\n\n window.addEventListener('touchend', onTouchUp);\n document.addEventListener('touchmove', onTouchMove);\n \n function onTouchMove(event) {\n moveAt(event.touches[0].pageX, event.touches[0].pageY, pieces[i]);\n }\n \n function onTouchUp() {\n dropPiece(pieces[i], currSquare, validMoves);\n document.removeEventListener('touchmove', onTouchMove);\n window.removeEventListener('touchend', onTouchUp);\n }\n \n highlightValidMoves(this);\n };\n //create event handlers for custom drag events\n pieces[i].onmousedown = function(event) {\n this.style.position = 'absolute';\n this.style.zIndex = 1;\n this.style.cursor = 'grabbing';\n document.body.append(this);\n \n moveAt(event.pageX, event.pageY, pieces[i]);\n \n window.addEventListener('mouseup', onMouseUp);\n document.addEventListener('mousemove', onMouseMove);\n \n let currSquare = maxOverlap(this, potentialDrops(this));\n let validMoves = getValidMoves(this);\n \n function onMouseMove(event) {\n moveAt(event.pageX, event.pageY, pieces[i]);\n }\n \n function onMouseUp() {\n pieces[i].style.cursor = 'grab';\n dropPiece(pieces[i], currSquare, validMoves);\n document.removeEventListener('mousemove', onMouseMove);\n window.removeEventListener('mouseup', onMouseUp);\n }\n \n highlightValidMoves(this);\n };\n }\n}", "title": "" }, { "docid": "0406ff19f8aca1ce0ab8586777264bd0", "score": "0.55578965", "text": "function buildSideFaces() {\n\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "0406ff19f8aca1ce0ab8586777264bd0", "score": "0.55578965", "text": "function buildSideFaces() {\n\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "0406ff19f8aca1ce0ab8586777264bd0", "score": "0.55578965", "text": "function buildSideFaces() {\n\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "0406ff19f8aca1ce0ab8586777264bd0", "score": "0.55578965", "text": "function buildSideFaces() {\n\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "5c6557be8b09342ecd4658fae3b8d466", "score": "0.5544411", "text": "function pieces(data) {\n // Creates the top arrow\n arrowTop = $('<img>').addClass('arrowTop').attr('src', 'assets/images/arrowTop.png').appendTo(`.content-slider`);\n\n // Stores puzzle id \n let getPuzzleId;\n // Based on the id of the puzzle, gets data from Json file\n for (let i = 0; i < puzzles.length; i++) {\n if (puzzleId === puzzles[i].id) {\n getPuzzleId = i;\n // Gets data from JSON file\n // Stores slide's length in a variable\n numSlides = puzzles[i].length;\n // Stores all images in an array\n for (var h = 0; h < numSlides; h++) {\n let imgAddress = puzzles[i].pieces[h];\n // Stores all images address in an array\n pieceImage.push(imgAddress);\n }\n }\n }\n\n // Stores the first piece image address length in a variable\n let firstPieceLength = puzzles[getPuzzleId].pieces[0].length;\n // Creates pieces and adds them to their relative slide\n for (let i = 0; i < numSlides; i++) {\n // Gets random image from the array\n let randomPieceImg = getRandomElement(pieceImage);\n // Gets the image Id\n let imageId;\n // As The number embeded in the images address is going to be used the address length matters\n if (randomPieceImg.length === firstPieceLength) {\n imageId = randomPieceImg.charAt(randomPieceImg.length - 5);\n } else if (randomPieceImg.length === (firstPieceLength + 1)) {\n imageId = randomPieceImg.substring(randomPieceImg.length - 6, randomPieceImg.length - 4);\n }\n\n // Creates slide\n slide = $('<li></li>').addClass(`slide${i}`).addClass(\"slideC\").appendTo('.content-slider');\n // Gets the piece's image address\n let imgAddress = randomPieceImg;\n // Creates the image element and assigns it to the slide\n puzzlePiece = $('<img>').addClass(`piece${imageId}Img`).css({\n \"width\": \"6vw\",\n \"padding\": \"14px\"\n }).attr('src', `${imgAddress}`).appendTo(`.slide${i}`);\n\n // Makes the piece draggable\n puzzlePiece.draggable();\n\n //SABINE EDIT\n //push the ENTIRE OBJECT to the pieceInSlide array\n piecesInSlide.push(puzzlePiece);\n\n // Removes the image used from the array so that it won't be picked again\n removeImageAfterAssignment(randomPieceImg);\n\n // Displays only the first four pieces\n if (i > numSlidesToShow) {\n $(`.slide${i}`).hide();\n }\n }\n\n // Creates spots on the puzzle template to place the pieces\n spotsToPositionPieces(data);\n // Makes bottom arrow\n arrowBottom = $('<img>').addClass('arrowBottom').attr('src', 'assets/images/arrowBottom.png').appendTo(`.content-slider`);\n // On click, moves the slides up or down\n arrowTop.on('click', goNext);\n arrowBottom.on('click', goPrev);\n}", "title": "" }, { "docid": "a66b7e656290998ce4f46ca9d9ab593d", "score": "0.5526365", "text": "fill() {\n // For white, pawns go in rank 2, others in rank 1.\n var kingRank = \"1\",\n pawnRank = \"2\",\n playerColor = \"W\";\n for (var i = 0; i < 2; i++) {\n this.addPiece(new Rook(\"a\" + kingRank, playerColor));\n this.addPiece(new Knight(\"b\" + kingRank, playerColor));\n this.addPiece(new Bishop(\"c\" + kingRank, playerColor));\n this.addPiece(new Queen(\"d\" + kingRank, playerColor));\n this.addPiece(new King(\"e\" + kingRank, playerColor));\n this.addPiece(new Bishop(\"f\" + kingRank, playerColor));\n this.addPiece(new Knight(\"g\" + kingRank, playerColor));\n this.addPiece(new Rook(\"h\" + kingRank, playerColor));\n for (var j = 1; j < 9; j++) {\n this.addPiece(new Pawn(toLetter(j) + pawnRank, playerColor));\n }\n // For black, pawns go in rank 7, others in rank 8.\n kingRank = \"8\";\n pawnRank = \"7\";\n playerColor = \"B\";\n }\n // Debugging\n console.log(\"Successfully created \" + this.pieces.length + \" pieces.\");\n console.log(this.pieces);\n }", "title": "" }, { "docid": "9ebdad3f999f695961d246567830ee95", "score": "0.5523782", "text": "function buildSideFaces() {\n\n\t\t\t\tvar start = verticesArray.length / 3;\n\t\t\t\tvar layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}", "title": "" }, { "docid": "9ebdad3f999f695961d246567830ee95", "score": "0.5523782", "text": "function buildSideFaces() {\n\n\t\t\t\tvar start = verticesArray.length / 3;\n\t\t\t\tvar layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}", "title": "" }, { "docid": "fe8923a429b4ea60be51bef8c473b1ec", "score": "0.55205935", "text": "function rookClicked(){\n /*making sure it's the corrent turn*/\n if ($(this).hasClass(\"movable\")){\n /*lastClicked = tile\n as classArray = lastClicked classes, i get the coordinates of the image*/\n lastClicked = $(this).closest(\"div\");\n console.log(\"rook clicked!\");\n /*go to pieceClicked for more info on this function*/\n pieceClicked();\n \n /*rooks bio:\n √ they move horizontally/vertically \n √ the extent they can move depends whether there's a piece in the way of their path\n - if it's a black piece, they have the ability to eat it\n - if it's a white piece, they are just blocked.\n - they have a special move with the king called castling*/\n currentMoves = [\".\"+classArray[1], \".\"+classArray[2]];\n /*if they didn't have to mind pieces on their path:\n for (var i=0;i<2;i++){\n $(currentMoves[i]).toggleClass(\"special\");}*/\n\n /*NORMAL MOVES:\n while loops were used here as i felt i had more control, see below for more.\n q = all four possible directions\n i = all blocks in that specific direction*/\n for (q=0;q<4;q++){\n var i=1\n while (i<8){\n /*this is kind of confusing to understand but basically these are the four directions, where...\n x=+ve, y=+ve, x=-ve and y=-ve\n to loop through all these directions, yet cover all blocks:\n - the q loop chooses which direction.\n - the i loop looks at all the blocks.\n the i loop breaks when the coordinate identifies a piece, but the q loop remains, so it changes the direction*/\n var anythingYpluscoords = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i] + \".\"+classArray[2];\n var anythingXpluscoords = \".\"+classArray[1]+\".\"+(parseInt(classArray[2])+i);\n var anythingYnegcoords = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i] + \".\"+classArray[2];\n var anythingXnegcoords = \".\"+classArray[1]+\".\"+(parseInt(classArray[2])-i);\n \n var anything = [anythingYpluscoords, anythingXpluscoords, anythingYnegcoords, anythingXnegcoords];\n\n /*if a img hasn't been identified at that coordinate...*/\n if ($(anything[q]).find(\"img\").length==0){\n /*...highlight the coordinate and continue loop i*/\n $(anything[q]).addClass(\"special\");\n i++;\n }\n\n /*if a img HAS been identified... \n ...it's either an blocking piece or edible piece, depending whether it's a piece of opposition or not\n\n if the rook clicked a white piece...*/\n else if ($(this).hasClass(\"whitePiece\")){\n /*...and a white piece blocks the way, it won't be able to get on that coordinate*/\n if ($(anything[q]).find(\".whitePiece\").length==1){\n break;\n }\n /*...and a black piece blocks the way, it can get on that coordinate by eating it\n but can't move any further*/\n else if ($(anything[q]).find(\".blackPiece\").length==1){\n $(anything[q]).addClass(\"eat\");\n break;\n }\n }\n /*if the rook clicked a black piece...*/\n else if ($(this).hasClass(\"blackPiece\")){\n /*...and a black piece blocks the way, it won't be able to get on that coordinate*/\n if ($(anything[q]).find(\".blackPiece\").length==1){\n break;\n }\n /*...and a white piece blocks the way, it can get on that coordinate by eating it\n but can't move any further*/\n else if ($(anything[q]).find(\".whitePiece\").length==1){\n $(anything[q]).addClass(\"eat\");\n break;\n }\n }\n }\n console.log(\"checking next direction\");\n /*once finishing all of i in this q loop, the q loop continues until it's done\n\n NORMAL MOVES: END*/\n }\n\n /*SPECIAL CASTLING MOVE:\n - only activated when clicking on king*/\n\n /*END*/\n }\n}", "title": "" }, { "docid": "a83def1d323911ab6f07280da64b571e", "score": "0.5518416", "text": "function drawPieces(ctx){\r\n\tfor (var i = 0;i<32;i++){\r\n\t\tvar coords = getCoordinatesByLocation(i);\r\n\t\tif (board.state[i]!=\" \"){ // empty spaces don't need anything.\r\n\t\t\tdrawPiece(coords[0]+board.offsetX,coords[1]+board.offsetY,board.state[i]);\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "14ee67e9bedb428e963a7d8225fa8331", "score": "0.5504885", "text": "function bishopClicked() {\n /*making sure it's the corrent turn*/\n if ($(this).hasClass(\"movable\")){\n /*lastClicked = tile\n as classArray = lastClicked classes, i get the coordinates of the image*/\n lastClicked = $(this).closest(\"div\");\n console.log(\"bishop clicked!\");\n /*go to pieceClicked for more info on this function*/\n pieceClicked();\n\n /*bishop bio:\n √ they're like the rook, but move diagionally on all sides \n √ the extent they can move depends whether there's a piece in the way of their path\n - if it's a black piece, they have the ability to eat it\n - if it's a white piece, they are just blocked.\n\n unlike the rooks, it's a little harder to find coordinates diagional from the piece\n however, it's pretty much the same tactic, i made it easier to read using currentMoves1, 2, 3 and 4, then pushing it all to the main currentMoves\n this is important since if i did it without this order, I wouldn't be able to explore all the coordinates in that one direction.*/\n currentMoves1 = [];\n currentMoves2 = [];\n currentMoves3 = [];\n currentMoves4 = [];\n\n for (var i=1;i<8;i++) {\n currentMoves1.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i]+\".\"+(parseInt(classArray[2])+i)));\n currentMoves2.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i]+\".\"+(parseInt(classArray[2])+i)));\n currentMoves3.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i]+\".\"+(parseInt(classArray[2])-i)));\n currentMoves4.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i]+\".\"+(parseInt(classArray[2])-i)));\n }\n currentMoves = [currentMoves1, currentMoves2, currentMoves3, currentMoves4];\n\n /*for more info, check rooks*/\n for (var q=0;q<4;q++){\n var i=0;\n while (i<8){\n\n /*movable coordinates*/\n if ($((currentMoves[q])[i]).find(\"img\").length==0){\n console.log(\"found space! \"+i);\n $((currentMoves[q])[i]).addClass(\"special\");\n i++;\n }\n /*if it's a white piece*/\n else if ($(this).hasClass(\"whitePiece\")){\n console.log(\"it's a white bishop!\");\n\n if ($((currentMoves[q])[i]).find(\".whitePiece\").length==1){\n console.log(\"saw white piece! \"+i);\n break;\n }\n /*edible coordinate*/\n else if ($((currentMoves[q])[i]).find(\".blackPiece\").length==1){\n console.log(\"saw black piece \"+i);\n $((currentMoves[q])[i]).addClass(\"eat\");\n break;\n }\n }\n /*if it's a black piece*/\n else if ($(this).hasClass(\"blackPiece\")){\n console.log(\"it's a black bishop!\");\n\n if ($((currentMoves[q])[i]).find(\".blackPiece\").length==1){\n console.log(\"saw black piece \"+i);\n break;\n }\n /*edible coordinate*/\n else if ($((currentMoves[q])[i]).find(\".whitePiece\").length==1){\n console.log(\"saw white piece! \"+i);\n $((currentMoves[q])[i]).addClass(\"eat\");\n break;\n }\n }\n /*move onto next loop*/\n console.log(\"finding other moves conditions\");\n }\n }\n /*END*/\n }\n}", "title": "" }, { "docid": "fdb958666cefd0f7eb5c93fad3f366b2", "score": "0.5500795", "text": "function newPiece(segment, feature, previousPiece, isLastPiece){\n\t\t//initial conditions of the piece\n\t\tvar piece = {\n\t\t\t//the relative position (from 0-1000) of the start of the piece and the id of the segment this is a piece of, used for error reporting\n\t\t\tPOnSeg: 0,//assume first piece on segment (i.e. no feature) until told otherwise\n\t\t\tseg: segment.id,\n\t\t\t\n\t\t\t\n\t\t\t//the geographical distance along the segment that the piece is located at\n\t\t\tstartPosOnSeg: 0,//assume first piece on segment until told otherwise\n\t\t\t\n\t\t\t//variables used in tests. all pieces have all variables, features determine which ones differ from the previous piece\n\t\t\tlen: 0,//length is calculated after all pieces are created. This is because the piece's end is unknown until the next piece is created.\n\t\t\tloc: 0,//loc is calculated with lengths\n\t\t\tspeedLimit: previousPiece.speedLimit,\n\t\t\tcurvature: segment.gradient, \n\t\t\tnLanes: previousPiece.nLanes,\n\t\t\ttaperLength: 0,//is only not 0 if the feature is a merge\n\t\t\tfriction: 0.9,//friction of bitumen road\n\t\t\tsuperelevation: segment.superElevation,\n\t\t\ttype: 'segment'//type of feature that starts the piece\n\t\t};\n\t\t//since the end of the piece is the end of the segment we can subtract startPosOnSeg from the total length\n\t\tpiece.len = parseInt(segment.abstractLength) - piece.startPosOnSeg;\n\t\t//if the piece is being created with a feature\n\t\tif(feature != null){\n\t\t\tpiece.POnSeg = findPositionOnSegment(segment, feature);\n\t\t\tpiece.startPosOnSeg = segment.abstractLength * (findPositionOnSegment(segment, feature)/1000);\n\t\t\t\n\t\t\tpiece.type = feature.type;\n\n\t\t\t//determine and apply changes\n\t\t\tif(feature.type === 'speed'){ piece.speedLimit = parseInt(feature.speed);\t}\n\n\t\t\tif(feature.type === 'laneEnd'){ piece.nLanes = piece.nLanes - parseInt(feature.numberOfLanes); piece.taperLength = feature.taperLength; }\n\t\t\n\t\t\tif(feature.type ==='laneAdd'){ piece.nLanes = piece.nLanes + parseInt(feature.numberOfLanes); }\n\t\t\n\t\t\tif(feature.type === 'offRamp' && feature.lane == false){ piece.nLanes = piece.nLanes - 1; }\n\t\t}\n\t\treturn piece;\n\t}", "title": "" }, { "docid": "93920864c24ea14c4863f1a44456df3d", "score": "0.5498711", "text": "function composition(side)\n{\n this.ps= new Array(10)\n this.cms = new Object()\n this.side = side\n for (var i=0; i<this.ps.length; ++i)\n {\n this.ps[i] = new Array(9)\n }\n\n this.getUiPos = function(x,y)\n {\n if (this.side === \"black\")\n {\n x = 8 - x;\n y = 9 - y;\n }\n return {x:x, y:y}\n }\n\n this.deployChessman = function (type, x, y)\n {\n var ts = this.cms[type]\n if (ts == null)\n {\n ts = new Array()\n this.cms[type] = ts\n }\n\n var pos = this.getUiPos(x, y)\n x = pos.x\n y = pos.y\n\n var id = ts.length\n var cm = new cchessman(id, type)\n this.ps[y][x] = cm\n ts[id] = cm\n cm.x = x\n cm.y = y\n }\n\n this.deploy = function (map)\n {\n for (var p in map)\n {\n curx = map[p].x\n for (var cm in map[p].cms)\n {\n this.deployChessman(map[p].cms[cm], curx, map[p].y)\n if (map[p].s != undefined)\n {\n curx += map[p].s\n }\n else\n {\n ++curx\n }\n }\n }\n }\n\n // Begin deploy chessman, with or without a specified map of \n // chessmans's location\n this.begin = function(map)\n {\n if (!map)\n {\n map = [\n { x:0 ,y:0, cms:[\"bju\", \"bma\", \"bxiang\", \"bshi\", \"bjiang\", \"bshi\", \"bxiang\", \"bma\", \"bju\"]},\n { x:1 ,y:2, s:6, cms:[\"bpao\", \"bpao\"]},\n { x:0 ,y:3, s:2, cms:[\"bzhu\", \"bzhu\", \"bzhu\", \"bzhu\", \"bzhu\"]},\n { x:0 ,y:6, s:2, cms:[\"rbing\", \"rbing\", \"rbing\", \"rbing\", \"rbing\"]},\n { x:1 ,y:7, s:6, cms:[\"rpao\", \"rpao\"]},\n { x:0 ,y:9, cms:[\"rju\", \"rma\", \"rxiang\", \"rshi\", \"rshuai\", \"rshi\", \"rxiang\", \"rma\", \"rju\"]}\n ]\n }\n\n this.deploy(map)\n }\n\n} //end of composition", "title": "" }, { "docid": "b93a49fcb9aaadbfc491736cfb7c11d4", "score": "0.54977524", "text": "function pieceClick(event)//Lit the worthy blocks with green or red colour\r\n{\r\n var targetBlockId, targetBlock;\r\n pieceSelector=event.target;\r\n var divId= pieceSelector.parentNode.id;\r\n squareRemover();\r\n var upPerm= true, downPerm= true, rightPerm= true, leftPerm= true, upperLeftPerm= true, upperRightPerm= true, lowerLeftPerm= true, lowerRightPerm= true; \r\n \r\n ////////////////////////////////////WHITE PAWNS//////////////////////////////////////\r\n if(event.target.id==\"wp\")\r\n { \r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML!= \"\")\r\n downPerm= false;\r\n else\r\n targetBlock.appendChild(greenSqArray[0]);\r\n //Second upper block used on the first move\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])+2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlockId[0]<8 && targetBlock.innerHTML== \"\" && downPerm && divId[0] == \"1\")\r\n targetBlock.appendChild(greenSqArray[1]);\r\n //Lower left block\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML!= \"\" && targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[1]); \r\n } \r\n }\r\n //Lower right block\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId= targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[0]); \r\n } \r\n }\r\n }\r\n\r\n ////////////////////////////////////BLACK PAWNS//////////////////////////////////////\r\n else if(event.target.id==\"bp\") \r\n { \r\n //Upper block\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML!= \"\")\r\n upPerm= false;\r\n else\r\n targetBlock.appendChild(greenSqArray[0]);\r\n //Second upper block used on the first move\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])-2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlockId[0]>0 && targetBlock.innerHTML== \"\" && upPerm && divId[0] == \"6\")\r\n targetBlock.appendChild(greenSqArray[1]);\r\n //Upper left block\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML!= \"\" && targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[1]); \r\n } \r\n }\r\n //Upper right block\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId= targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[0]); \r\n } \r\n }\r\n }\r\n\r\n ////////////////////////////////////ROOKS////////////////////////////////////////////\r\n else if(event.target.id==\"wr\" || event.target.id==\"br\")\r\n { \r\n for(i=0; i<28; i++)\r\n { \r\n //All lower blocks\r\n if(i<7 && (parseInt(divId[0])+i+1)>=0 && (parseInt(divId[0])+i+1)<8 && downPerm)\r\n {\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])+i+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n downPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n downPerm= false;\r\n }\r\n //All upper blocks\r\n else if(i>=7 && i<14 && (parseInt(divId[0])-(i-6))>=0 && (parseInt(divId[0])-(i-6))<8 && upPerm)\r\n { \r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])-(i-6));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upPerm= false;\r\n }\r\n //All right blocks\r\n else if(i>=14 && i<21 && (parseInt(divId[2])+(i-13))>=0 && (parseInt(divId[2])+(i-13))<8 && rightPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+(i-13));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n rightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n rightPerm= false;\r\n }\r\n //All left blocks\r\n else if(i>=21 && i<28 && (parseInt(divId[2])-(i-20))>=0 && (parseInt(divId[2])-(i-20))<8 && leftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-20));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")//If the block is empty\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n leftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n leftPerm= false;\r\n }\r\n }\r\n }\r\n \r\n ////////////////////////////////////BISHOPS//////////////////////////////////////////\r\n else if(event.target.id==\"wb\" || event.target.id==\"bb\")\r\n { \r\n for(i=0; i<28; i++)\r\n { \r\n //All lower right blocks\r\n if(i<7 && (parseInt(divId[0])+i+1)>=0 && (parseInt(divId[0])+i+1)<8 && (parseInt(divId[2])+i+1)>=0 && (parseInt(divId[2])+i+1)<8 && lowerRightPerm)\r\n {\r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+i+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+i+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n lowerRightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n lowerRightPerm= false;\r\n }\r\n //All upper right blocks\r\n else if(i>=7 && i<14 && (parseInt(divId[0])-(i-6))>=0 && (parseInt(divId[0])-(i-6))<8 && (parseInt(divId[2])+(i-6))>=0 && (parseInt(divId[2])+(i-6))<8 && upperRightPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+(i-6));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-(i-6));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upperRightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upperRightPerm= false;\r\n }\r\n //All lower left blocks\r\n else if(i>=14 && i<21 && (parseInt(divId[0])+(i-13))>=0 && (parseInt(divId[0])+(i-13))<8 && (parseInt(divId[2])-(i-13))>=0 && (parseInt(divId[2])-(i-13))<8 && lowerLeftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-13));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+(i-13));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n lowerLeftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n lowerLeftPerm= false;\r\n }\r\n //All upper left blocks\r\n else if(i>=21 && i<28 && (parseInt(divId[0])-(i-20))>=0 && (parseInt(divId[0])-(i-20))<8 && (parseInt(divId[2])-(i-20))>=0 && (parseInt(divId[2])-(i-20))<8 && upperLeftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-20));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-(i-20));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upperLeftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upperLeftPerm= false;\r\n }\r\n }\r\n }\r\n ////////////////////////////////////QWEENS///////////////////////////////////////////\r\n else if(event.target.id==\"wq\" || event.target.id==\"bq\")\r\n { \r\n for(i=0; i<56; i++)\r\n { \r\n //All lower right blocks\r\n if(i<7 && (parseInt(divId[0])+i+1)>=0 && (parseInt(divId[0])+i+1)<8 && (parseInt(divId[2])+i+1)>=0 && (parseInt(divId[2])+i+1)<8 && lowerRightPerm)\r\n {\r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+i+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+i+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n lowerRightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n lowerRightPerm= false;\r\n }\r\n //All upper right blocks\r\n else if(i>=7 && i<14 && (parseInt(divId[0])-(i-6))>=0 && (parseInt(divId[0])-(i-6))<8 && (parseInt(divId[2])+(i-6))>=0 && (parseInt(divId[2])+(i-6))<8 && upperRightPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+(i-6));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-(i-6));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upperRightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upperRightPerm= false;\r\n }\r\n //All lower left blocks\r\n else if(i>=14 && i<21 && (parseInt(divId[0])+(i-13))>=0 && (parseInt(divId[0])+(i-13))<8 && (parseInt(divId[2])-(i-13))>=0 && (parseInt(divId[2])-(i-13))<8 && lowerLeftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-13));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+(i-13));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n lowerLeftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n lowerLeftPerm= false;\r\n }\r\n //All upper left blocks\r\n else if(i>=21 && i<28 && (parseInt(divId[0])-(i-20))>=0 && (parseInt(divId[0])-(i-20))<8 && (parseInt(divId[2])-(i-20))>=0 && (parseInt(divId[2])-(i-20))<8 && upperLeftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-20));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-(i-20));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upperLeftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upperLeftPerm= false;\r\n }\r\n //All lower blocks\r\n else if(i>=28 && i<35 && (parseInt(divId[0])+(i-27))>=0 && (parseInt(divId[0])+(i-27))<8 && downPerm)\r\n {\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])+(i-27));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n downPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n downPerm= false;\r\n }\r\n //All upper blocks\r\n else if(i>=35 && i<42 && (parseInt(divId[0])-(i-34))>=0 && (parseInt(divId[0])-(i-34))<8 && upPerm)\r\n { \r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])-(i-34));\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n upPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n upPerm= false;\r\n }\r\n //All right blocks\r\n else if(i>=42 && i<49 && (parseInt(divId[2])+(i-41))>=0 && (parseInt(divId[2])+(i-41))<8 && rightPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+(i-41));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n rightPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n rightPerm= false;\r\n }\r\n //All left blocks\r\n else if(i>=49 && i<56 && (parseInt(divId[2])-(i-48))>=0 && (parseInt(divId[2])-(i-48))<8 && leftPerm)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-(i-48));\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[i]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[i]); \r\n leftPerm= false;\r\n } \r\n else if(targetBlock.firstChild.id[0]==pieceSelector.id[0])\r\n leftPerm= false;\r\n }\r\n }\r\n }\r\n ////////////////////////////////////KINGS////////////////////////////////////////////\r\n else if(event.target.id==\"wk\" || event.target.id==\"bk\")\r\n { \r\n //Upper block\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8)\r\n { \r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[0]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[0]); \r\n } \r\n }\r\n //Upper right block\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[1]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[1]); \r\n } \r\n }\r\n //Right block\r\n if((parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[2]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[2]); \r\n } \r\n }\r\n //Lower right block\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n {\r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[3]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[3]); \r\n } \r\n }\r\n //Lower block\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8)\r\n {\r\n targetBlockId= divId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[4]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[4]); \r\n } \r\n }\r\n //Lower left block\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[5]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[5]); \r\n } \r\n }\r\n //All left blocks\r\n if((parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[6]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[6]); \r\n } \r\n }\r\n //Upper left block\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[7]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[7]); \r\n } \r\n }\r\n }\r\n ////////////////////////////////////KNIGHTS//////////////////////////////////////////\r\n else if(event.target.id==\"wkn\" || event.target.id==\"bkn\")\r\n { \r\n //1 o'clock\r\n if((parseInt(divId[0])-2)>=0 && (parseInt(divId[0])-2)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[0]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[0]); \r\n } \r\n }\r\n //2 o'clock\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])+2)>=0 && (parseInt(divId[2])+2)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+2);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[1]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[1]); \r\n } \r\n }\r\n //4 o'clock\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])+2)>=0 && (parseInt(divId[2])+2)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+2);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[2]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[2]); \r\n } \r\n }\r\n //5 o'clock\r\n if((parseInt(divId[0])+2)>=0 && (parseInt(divId[0])+2)<8 && (parseInt(divId[2])+1)>=0 && (parseInt(divId[2])+1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])+1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[3]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[3]); \r\n } \r\n }\r\n //7 o'clock\r\n if((parseInt(divId[0])+2)>=0 && (parseInt(divId[0])+2)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[4]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[4]); \r\n } \r\n }\r\n //8 o'clock\r\n if((parseInt(divId[0])+1)>=0 && (parseInt(divId[0])+1)<8 && (parseInt(divId[2])-2)>=0 && (parseInt(divId[2])-2)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-2);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])+1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[5]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[5]); \r\n } \r\n }\r\n //10 o'clock\r\n if((parseInt(divId[0])-1)>=0 && (parseInt(divId[0])-1)<8 && (parseInt(divId[2])-2)>=0 && (parseInt(divId[2])-2)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-2);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-1);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[6]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[6]); \r\n } \r\n }\r\n //11 o'clock\r\n if((parseInt(divId[0])-2)>=0 && (parseInt(divId[0])-2)<8 && (parseInt(divId[2])-1)>=0 && (parseInt(divId[2])-1)<8)\r\n { \r\n targetBlockId= divId.replaceAll(divId[2],parseInt(divId[2])-1);\r\n targetBlockId=targetBlockId.replace(targetBlockId[0],divId[0]);\r\n targetBlockId= targetBlockId.replace(divId[0],parseInt(divId[0])-2);\r\n targetBlock= document.getElementById(targetBlockId);\r\n if(targetBlock.innerHTML== \"\")\r\n targetBlock.appendChild(greenSqArray[7]);\r\n else if(targetBlock.firstChild.id[0]!=pieceSelector.id[0])\r\n { \r\n targetBlock.firstChild.onclick=victimPiece;\r\n targetBlock.appendChild(redSqArray[7]); \r\n } \r\n }\r\n }\r\n}", "title": "" }, { "docid": "a434e04b8b4d6e132d57d5591c27deea", "score": "0.54970586", "text": "drawPiece() {\n this.drawEmpty();\n this.drawBoard();\n var piece = this.piece.getPiece();\n for (var r = 0; r < piece.length; r++) {\n for (var c = 0; c < piece.length; c++) {\n if (this.piece.isEmpty(r, c)) {\n continue;\n }\n this.drawSquare(c + this.piece.getX(), r + this.piece.getY(), this.piece.getColor());\n }\n }\n }", "title": "" }, { "docid": "0486f92057958ecf690170b5b6e0f12a", "score": "0.549037", "text": "function queenClicked() {\n /*making sure it's the corrent turn*/\n if ($(this).hasClass(\"movable\")){\n /*lastClicked = tile\n as classArray = lastClicked classes, i get the coordinates of the image*/\n lastClicked = $(this).closest(\"div\");\n console.log(\"queen clicked!\");\n /*go to pieceClicked for more info on this function*/\n pieceClicked();\n\n /*queen bio:\n √ has the most power as it travels diagionally, horizontally and vertically \n - basically the power of rooks and bishops combined\n √ the extent they can move depends whether there's a piece in the way of their path\n - if it's a black piece, they have the ability to eat it\n - if it's a white piece, they are just blocked.\n because it's all copied and pasted code, I won't attach comments except for whether it's a rook or bishop section. \n therefore, please go to those pieces for more info\n \n rook moves*/\n currentMoves = [\".\"+classArray[1], \".\"+classArray[2]];\n var q=0\n while (q<4){\n var i=1\n while (i<8){\n var anythingYpluscoords = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i] + \".\"+classArray[2];\n var anythingXpluscoords = \".\"+classArray[1]+\".\"+(parseInt(classArray[2])+i);\n var anythingYnegcoords = \".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i] + \".\"+classArray[2];\n var anythingXnegcoords = \".\"+classArray[1]+\".\"+(parseInt(classArray[2])-i);\n \n var anything = [anythingYpluscoords, anythingXpluscoords, anythingYnegcoords, anythingXnegcoords];\n\n if ($(anything[q]).find(\"img\").length==0){\n $(anything[q]).addClass(\"special\");\n i++;\n }\n else if ($(this).hasClass(\"whitePiece\")){\n if ($(anything[q]).find(\".whitePiece\").length==1){\n break;\n }\n else if ($(anything[q]).find(\".blackPiece\").length==1){\n $(anything[q]).addClass(\"eat\");\n break;\n }\n }\n else if ($(this).hasClass(\"blackPiece\")){\n if ($(anything[q]).find(\".blackPiece\").length==1){\n break;\n }\n else if ($(anything[q]).find(\".whitePiece\").length==1){\n $(anything[q]).addClass(\"eat\");\n break;\n }\n }\n }\n console.log(\"checking next direction\");\n q++;\n }\n\n /*bishop moves*/\n currentMoves1 = [];\n currentMoves2 = [];\n currentMoves3 = [];\n currentMoves4 = [];\n\n for (var i=1;i<8;i++) {\n currentMoves1.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i]+\".\"+(parseInt(classArray[2])+i)));\n currentMoves2.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i]+\".\"+(parseInt(classArray[2])+i)));\n currentMoves3.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) + i]+\".\"+(parseInt(classArray[2])-i)));\n currentMoves4.push($(\".\"+yCoordinates[yCoordinates.indexOf(classArray[1]) - i]+\".\"+(parseInt(classArray[2])-i)));\n }\n currentMoves = [currentMoves1, currentMoves2, currentMoves3, currentMoves4]\n\n for (var q=0;q<4;q++){\n var i=0;\n while (i<8){\n if ($((currentMoves[q])[i]).find(\"img\").length==0){\n console.log(\"found space! \"+i);\n $((currentMoves[q])[i]).addClass(\"special\");\n i++;\n }\n else if ($(this).hasClass(\"whitePiece\")){\n console.log(\"it's a white bishop!\");\n\n if ($((currentMoves[q])[i]).find(\".whitePiece\").length==1){\n console.log(\"saw white piece! \"+i);\n break;\n }\n else if ($((currentMoves[q])[i]).find(\".blackPiece\").length==1){\n console.log(\"saw black piece \"+i);\n $((currentMoves[q])[i]).addClass(\"eat\");\n break;\n }\n }\n else if ($(this).hasClass(\"blackPiece\")){\n console.log(\"it's a black bishop!\");\n if ($((currentMoves[q])[i]).find(\".blackPiece\").length==1){\n console.log(\"saw black piece \"+i);\n break;\n }\n else if ($((currentMoves[q])[i]).find(\".whitePiece\").length==1){\n console.log(\"saw white piece! \"+i);\n $((currentMoves[q])[i]).addClass(\"eat\");\n break;\n }\n }\n console.log(\"finding other moves conditions\");\n }\n }\n }\n}", "title": "" }, { "docid": "a8f837987db5f05bbfc1fb918c397104", "score": "0.5487764", "text": "_draw_state() {\n\n for (let i = 0; i < this._engine._tabPiece.length; ++i) {\n let intersection = this._engine._cases[i];\n\n let letter = this._engine._tabPiece[i]._coordinates._letter;\n let number = this._engine._tabPiece[i]._coordinates._number;\n let color = this._engine._tabPiece[i]._color;\n\n let stack = this._engine._tabPiece[i]._stack;\n let level = this._engine._tabPiece[i]._level;\n\n this._draw_piece(letter, number, color, intersection.sixth(), stack, level);\n }\n }", "title": "" }, { "docid": "6942433782ce8b8866a28aa6e3cb9464", "score": "0.54868", "text": "function setup() {\n if (show_screen) {\n createCanvas(board_width*scl + scl*x_gap + 128, board_height*scl + scl*y_gap);\n }\n frameRate(_fr_);\n\n if (ai_active && natural_selection) {\n newGen();\n }\n\n //position for \"next\" piece\n next_x = scl + (board_width*scl + scl*x_gap) - scl*x_gap/2 + (scl*x_gap/2 - scl*4)/2;\n next_y = scl*y_gap/2;\n next_x = (next_x - scl*x_gap/2)/scl;\n next_y = (height - next_y - scl*y_gap/2)/scl;\n next_y -= 2;\n\n //position for \"held\" piece\n held_x = scl + (scl*x_gap/2 - scl*4)/2;\n held_y = scl*y_gap/2;\n held_x = (held_x - scl*x_gap/2)/scl;\n held_y = (height - held_y - scl*y_gap/2)/scl;\n held_y -= 2;\n\n //dictionary for piece colors and shapes\n letter_dict = {\n \"I\": [color(\"cyan\"), [[0, 0], [-1, 0], [1, 0], [2, 0]]], \n \"O\": [color(\"yellow\"), [[0, 0], [1, 0], [0, 1], [1, 1]]], \n \"T\": [color(\"purple\"), [[0, 0], [-1, 0], [1, 0], [0, 1]]], \n \"S\": [color(\"lime\"), [[0, 0], [-1, 0], [0, 1], [1, 1]]], \n \"Z\": [color(\"red\"), [[0, 0], [-1, 1], [0, 1], [1, 0]]], \n \"J\": [color(\"blue\"), [[0, 0], [-1, 0], [-1, 1], [1, 0]]], \n \"L\": [color(\"orange\"), [[0, 0], [-1, 0], [1, 0], [1, 1]]]\n };\n\n buttons[0] = new Button(width - 112, y_gap*scl/2 + 64, 96, 32, \"AI OFF\", \"AI ON\");\n buttons[1] = new Button(width - 112, y_gap*scl/2, 96, 32, \"NEW GAME\", \"NEW GAME\");\n\n sloiders[0] = new Sloider(width - 112, y_gap*scl/2 + 152, 96, 1);\n \n newGame();\n}", "title": "" }, { "docid": "18dbcf82114d689c87ef34f09e343b82", "score": "0.5485701", "text": "function buildSideFaces() {\n\n\t\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\t\tlet layeroffset = 0;\n\t\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t\t//, true\n\t\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t\t}", "title": "" }, { "docid": "8ec27ece4d8f6898ff71f60904f0250b", "score": "0.54848385", "text": "addPoint(p, c) {\n this.pieces.push(p.slice());\n // this.slopes.push(slope);\n this.directionals.push(c.slice());\n\n return this;\n }", "title": "" }, { "docid": "391f28efcec9144c0183e1a32183b719", "score": "0.547947", "text": "function placePieces (pieces) {\n for (let row = 0; row < 8; row++) {\n for (let col = 0; col < 8; col++) {\n board[row][col] = new NullPiece(row,col);\n }\n }\n//then takes each piece passed in as an argument and replaces the corresponding nullpiece on the board\n pieces.forEach ((piece) => {\n board[piece.row][piece.col] = new piece.pieceName(piece.color, piece.row, piece.col);\n });\n}", "title": "" }, { "docid": "dda537a4ea4bfa4b73439102cbc648af", "score": "0.5475262", "text": "generate() {\n // Allocate a giant, empty map\n const fullMap=[];\n for (let z=0;z<this.towerHeight;z++) {\n fullMap.push(this.emptyLevel());\n this.possibleStairs.push({});\n this.connectedTowers.push({});\n }\n // Do the math on the target number of tiles\n this.targetTiles = this.targetFraction * (this.dimensions[0] - this.border*2) * (this.dimensions[1] - this.border*2) * this.towerHeight;\n\n // Build the shell of the structure\n this.buildExterior(fullMap);\n\n // Add a front door in front of where the player will be\n this.addFrontDoor(fullMap[0]);\n\n // Add some fancier rooms to the space while it is still mostly empty\n this.addFancyRooms(fullMap);\n\n // Add some cool hallways\n this.addHallways(fullMap);\n\n // Add a pile of subdivisions\n this.subdivideEverything(fullMap);\n\n\n // Add stairs and doors!\n this.addConnections(fullMap);\n\n \n // touchups, add floors above things a floor down\n this.postProcessing(fullMap);\n\n // Store the generated map\n map.levels=fullMap;\n\n this.populateLevel(map.levels[0],0);\n }", "title": "" }, { "docid": "6ea8477adf69585be223511c3da36867", "score": "0.5469323", "text": "function buildSideFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t}", "title": "" }, { "docid": "6ea8477adf69585be223511c3da36867", "score": "0.5469323", "text": "function buildSideFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t}", "title": "" }, { "docid": "6ea8477adf69585be223511c3da36867", "score": "0.5469323", "text": "function buildSideFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t}", "title": "" }, { "docid": "6ea8477adf69585be223511c3da36867", "score": "0.5469323", "text": "function buildSideFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t}", "title": "" }, { "docid": "88fc515ad34ad4037f10d791ceee6de5", "score": "0.5468056", "text": "createCube() {\r\n if (this.numSquares !== NUM_SQUARES) return;\r\n let pieceNumber = 0;\r\n let newPiece;\r\n let sqNumber;\r\n\r\n // Create the core first\r\n this.core = new RubiksPiece({\r\n scene: this.scene,\r\n geometry: this.geometry,\r\n x: this.position.x,\r\n y: this.position.y,\r\n z: this.position.z,\r\n color: this.debug ? 0xFFC0CB : COLORS[GREY]\r\n });\r\n\r\n let numLayers = 3;\r\n let numColumns = 3;\r\n let numRows = 3;\r\n\r\n // Then create all the other pieces\r\n for (let lay = 0; lay < numLayers; lay++) {\r\n for (let col = 0; col < numColumns; col++) {\r\n for (let row = 0; row < numRows; row++) {\r\n sqNumber = pieceNumber % 9;\r\n if (lay !== 1 || row !== 1 || col !== 1) {\r\n newPiece = new RubiksPiece({\r\n parentPiece: this.core,\r\n geometry: this.geometry,\r\n x: this.position.x + OFFSETS[lay],\r\n y: this.position.y + OFFSETS[row],\r\n z: this.position.z + OFFSETS[col],\r\n mats: getMaterialsForPiece({\r\n state: this.state,\r\n layerIndex: lay,\r\n sqNumber: sqNumber\r\n })\r\n });\r\n this.pieces.push(newPiece);\r\n }\r\n pieceNumber++;\r\n }\r\n }\r\n }\r\n }", "title": "" }, { "docid": "a0c8b6beb8abc1aa22463647801ccc42", "score": "0.5466691", "text": "function buildSideFaces() {\n\n \t\t\tvar start = verticesArray.length / 3;\n \t\t\tvar layeroffset = 0;\n \t\t\tsidewalls( contour, layeroffset );\n \t\t\tlayeroffset += contour.length;\n\n \t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n \t\t\t\tahole = holes[ h ];\n \t\t\t\tsidewalls( ahole, layeroffset );\n\n \t\t\t\t//, true\n \t\t\t\tlayeroffset += ahole.length;\n\n \t\t\t}\n\n\n \t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n \t\t}", "title": "" }, { "docid": "ef1541c9207cce0f4f44246bcf15faf7", "score": "0.54661864", "text": "function testPieces() {\n for (let i = 0; i < cubeSize; i++) {\n for (let j = 0; j < cubeSize; j++) {\n pieces.push(new Piece(i, j, floor(random(6))));\n \n }\n }\n}", "title": "" }, { "docid": "bff655568314d328446d888447ce9988", "score": "0.54622364", "text": "function allTakingParameters(piece) {\n var posX = clickPosX / gridSquareSize;\n var posY = clickPosY / gridSquareSize;\n\n var takeParams = piece.taking();\n var allTaking = {\n allLeftTaking: [],\n allRightTaking: [],\n allUpTaking: [],\n allDownTaking: [],\n allDiagTaking: []\n }\n\n // gets index of the piececlick col inside of row array\n var rowType = piece.col;\n\n if (piece.team1) {\n if (takeParams.DIAG > 0) {\n for (var diag = 0; diag <= takeParams.DIAG; diag++) {\n if (piece.TAKE_FORWARD) {\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX - diag));\n } else {\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX - diag));\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX - diag));\n }\n }\n }\n for (var down = 0; down <= takeParams.DOWN; down++) {\n if (piece.type === \"KNIGHT\") {\n // sides one down\n allTaking.allDownTaking.push(row[rowType + 1] + (posX - 2));\n allTaking.allDownTaking.push(row[rowType + 1] + (posX + 2));\n\n // bottom section take pos\n allTaking.allDownTaking.push(row[rowType + 2] + (posX + 1));\n allTaking.allDownTaking.push(row[rowType + 2] + (posX - 1));\n } else {\n allTaking.allDownTaking.push(row[rowType + down] + posX);\n } \n }\n\n for (var up = 0; up <= takeParams.UP; up++) {\n if (piece.type === \"KNIGHT\") {\n allTaking.allUpTaking.push(row[rowType - 1] + (posX + 2));\n allTaking.allUpTaking.push(row[rowType - 1] + (posX - 2));\n\n // bottom section take pos\n allTaking.allUpTaking.push(row[rowType - 2] + (posX + 1));\n allTaking.allUpTaking.push(row[rowType - 2] + (posX - 1));\n\n } else {\n allTaking.allUpTaking.push(row[rowType - up] + posX);\n } \n }\n\n for (var right = 0; right <= takeParams.RIGHT; right++) {\n allTaking.allRightTaking.push(row[rowType] + (posX + right)); \n }\n\n for (var left = 0; left <= takeParams.LEFT; left++) {\n allTaking.allLeftTaking.push(row[rowType] + (posX - left)); \n }\n } else {\n if (takeParams.DIAG > 0) {\n for (var diag = 0; diag <= takeParams.DIAG; diag++) {\n if (piece.TAKE_FORWARD) {\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX - diag));\n } else {\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX + diag));\n allTaking.allDiagTaking.push(row[rowType + diag] + (posX - diag));\n allTaking.allDiagTaking.push(row[rowType - diag] + (posX - diag));\n }\n }\n }\n for (var down = 0; down <= takeParams.DOWN; down++) {\n if (piece.type === \"KNIGHT\") {\n // sides one down\n allTaking.allDownTaking.push(row[rowType - 1] + (posX - 2));\n allTaking.allDownTaking.push(row[rowType - 1] + (posX + 2));\n\n // bottom section take pos\n allTaking.allDownTaking.push(row[rowType - 2] + (posX + 1));\n allTaking.allDownTaking.push(row[rowType - 2] + (posX - 1));\n } else {\n allTaking.allDownTaking.push(row[rowType - down] + posX);\n } \n }\n\n for (var up = 0; up <= takeParams.DOWN; up++) {\n if (piece.type === \"KNIGHT\") {\n allTaking.allUpTaking.push(row[rowType + 1] + (posX + 2));\n allTaking.allUpTaking.push(row[rowType + 1] + (posX - 2));\n\n // bottom section take pos\n allTaking.allUpTaking.push(row[rowType + 2] + (posX + 1));\n allTaking.allUpTaking.push(row[rowType + 2] + (posX - 1));\n\n } else {\n allTaking.allUpTaking.push(row[rowType + up] + posX)\n } \n }\n\n for (var right = 0; right <= takeParams.RIGHT; right++) {\n allTaking.allRightTaking.push(row[rowType] + (posX + right));\n }\n\n for (var left = 0; left <= takeParams.LEFT; left++) {\n allTaking.allLeftTaking.push(row[rowType] + (posX - left));\n }\n }\n return allTaking;\n}", "title": "" }, { "docid": "4b9e40e3feeb53142358d1506d7221e9", "score": "0.5461095", "text": "function buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}", "title": "" }, { "docid": "9036a9a63953f04f88f395ac6a9f12d1", "score": "0.54604006", "text": "function buildSideFaces() {\n \n var start = verticesArray.length / 3;\n var layeroffset = 0;\n sidewalls( contour, layeroffset );\n layeroffset += contour.length;\n \n for ( h = 0, hl = holes.length; h < hl; h ++ ) {\n \n ahole = holes[ h ];\n sidewalls( ahole, layeroffset );\n \n //, true\n layeroffset += ahole.length;\n \n }\n \n \n scope.addGroup( start, verticesArray.length / 3 - start, 1 );\n \n \n }", "title": "" }, { "docid": "51026b15812fd81204cb7070adb7c4d9", "score": "0.54565775", "text": "constructor(nroColumn, nroRow, xStart, xEnd, yStart, yEnd, piece){\n this.nroColumn = nroColumn;\n this.nroRow = nroRow;\n this.xStart = xStart;\n this.xEnd = xEnd;\n this.yStart = yStart;\n this.yEnd = yEnd;\n this.setPiece(piece);\n }", "title": "" }, { "docid": "bee0e9cc9d7a45c068a546e5b5f9a3b7", "score": "0.54546475", "text": "function buildSideFaces() {\n\n \t\t\tvar start = verticesArray.length / 3;\n \t\t\tvar layeroffset = 0;\n \t\t\tsidewalls( contour, layeroffset );\n \t\t\tlayeroffset += contour.length;\n\n \t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n \t\t\t\tahole = holes[ h ];\n \t\t\t\tsidewalls( ahole, layeroffset );\n\n \t\t\t\t//, true\n \t\t\t\tlayeroffset += ahole.length;\n\n \t\t\t}\n \t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n \t\t}", "title": "" }, { "docid": "3aed75f39e717a4bd709257202919741", "score": "0.54471433", "text": "function buildSideFaces() {\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\t\t}\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "73651c0df688bc6ade6911b3491fc675", "score": "0.54427004", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length/3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);\n\n\n\t}", "title": "" }, { "docid": "7e9b0a2950a178f5020d9dbff0def0c0", "score": "0.54382175", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length / 3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length / 3 - start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1 );\n\n\n\t}", "title": "" }, { "docid": "7e9b0a2950a178f5020d9dbff0def0c0", "score": "0.54382175", "text": "function buildSideFaces() {\n\n\t\tvar start = verticesArray.length / 3;\n\t\tvar layeroffset = 0;\n\t\tsidewalls( contour, layeroffset );\n\t\tlayeroffset += contour.length;\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t//, true\n\t\t\tlayeroffset += ahole.length;\n\n\t\t}\n\n\n\t\tscope.addGroup( start, verticesArray.length / 3 - start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1 );\n\n\n\t}", "title": "" }, { "docid": "83ac2d4f043fbddc76a9cf78cfc93926", "score": "0.54269177", "text": "function buildSideFaces() {\n\n var layeroffset = 0;\n sidewalls( contour, layeroffset );\n layeroffset += contour.length;\n\n for ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n ahole = holes[ h ];\n sidewalls( ahole, layeroffset );\n\n //, true\n layeroffset += ahole.length;\n\n }\n\n }", "title": "" }, { "docid": "3077a34e553fd569cba19b2c8647e564", "score": "0.5420957", "text": "generateGameboard() {\n var layer_1_A_loc = [300, 500];\n var layer_1_B_loc = [600, 500];\n var layer_1_C_loc = [900, 500];\n\n // create a warehouse for each shape\n var layer_1_A = new Warehouse(this.context, drawTriangle, layer_1_A_loc, \"blue\", 20, 50, true);\n var layer_1_B = new Warehouse(this.context, drawSquare, layer_1_B_loc, \"red\", 20, 50, true);\n var layer_1_C = new Warehouse(this.context, drawPentagon, layer_1_C_loc, \"gold\", 20, 50, true);\n\n // create a second layer of warehouses\n var layer_2_A_loc = [200, 300];\n var layer_2_B_loc = [300, 300];\n var layer_2_C_loc = [500, 300];\n var layer_2_D_loc = [600, 300];\n var layer_2_E_loc = [800, 300];\n var layer_2_F_loc = [900, 300];\n var layer_2_G_loc = [1000, 300];\n\n var layer_2_A = new Warehouse(this.context, drawSquare, layer_2_A_loc, \"red\", 20, 50, true);\n var layer_2_B = new Warehouse(this.context, drawTriangle, layer_2_B_loc, \"blue\", 20, 50, true);\n var layer_2_C = new Warehouse(this.context, drawCircle, layer_2_C_loc, \"gold\", 20, 50, true);\n var layer_2_D = new Warehouse(this.context, drawTriangle, layer_2_D_loc, \"blue\", 20, 50, true);\n var layer_2_E = new Warehouse(this.context, drawSquare, layer_2_E_loc, \"red\", 20, 50, true);\n var layer_2_F = new Warehouse(this.context, drawPentagon, layer_2_F_loc, \"purple\", 20, 50, true);\n var layer_2_G = new Warehouse(this.context, drawSquare, layer_2_G_loc, \"gold\", 20, 50, true);\n\n\n // create a third layer of warehouses\n var layer_3_A_loc = [100, 100];\n var layer_3_B_loc = [250, 100];\n var layer_3_C_loc = [450, 100];\n var layer_3_D_loc = [600, 100];\n var layer_3_E_loc = [800, 100];\n var layer_3_F_loc = [950, 100];\n var layer_3_G_loc = [1050, 100];\n\n var layer_3_A = new Warehouse(this.context, drawPentagon, layer_3_A_loc, \"red\", 20, 50, true);\n var layer_3_B = new Warehouse(this.context, drawTriangle, layer_3_B_loc, \"gold\", 20, 50, true);\n var layer_3_C = new Warehouse(this.context, drawSquare, layer_3_C_loc, \"purple\", 20, 50, true);\n var layer_3_D = new Warehouse(this.context, drawSquare, layer_3_D_loc, \"gold\", 20, 50, true);\n var layer_3_E = new Warehouse(this.context, drawTriangle, layer_3_E_loc, \"purple\", 20, 50, true);\n var layer_3_F = new Warehouse(this.context, drawPentagon, layer_3_F_loc, \"blue\", 20, 50, true);\n var layer_3_G = new Warehouse(this.context, drawCircle, layer_3_G_loc, \"red\", 20, 50, true);\n\n layer_1_A.downstreamWarehouses.push(layer_2_A, layer_2_B);\n layer_1_B.downstreamWarehouses.push(layer_2_B, layer_2_C, layer_2_D, layer_2_E);\n layer_1_C.downstreamWarehouses.push(layer_2_E, layer_2_F, layer_2_G);\n\n layer_2_A.downstreamWarehouses.push(layer_3_A, layer_3_B)\n layer_2_B.downstreamWarehouses.push(layer_3_B)\n layer_2_C.downstreamWarehouses.push(layer_3_C)\n layer_2_D.downstreamWarehouses.push(layer_3_D)\n layer_2_E.downstreamWarehouses.push(layer_3_D, layer_3_E)\n layer_2_F.downstreamWarehouses.push(layer_3_F, layer_3_G)\n layer_2_G.downstreamWarehouses.push(layer_3_G)\n \n // record each warehouse in the gameboard object\n this.warehouses = [layer_1_A, layer_1_B, layer_1_C,\n layer_2_A, layer_2_B, layer_2_C, layer_2_D, layer_2_E, layer_2_F, layer_2_G,\n layer_3_A, layer_3_B, layer_3_C, layer_3_D, layer_3_E, layer_3_F, layer_3_G];\n\n // generate the base package spawner\n // context, location, period, downstreamWarehouses, active=true, random=false, spawnMax=Infinity, colorByShape=false, packageShape=null, packageColor=null, packageSpeed=null\n var baseSpawner = new Spawner(context, [600, 700], .5, [layer_1_A, layer_1_B, layer_1_C], true, false, Infinity, false, undefined, undefined, undefined);\n this.spawners.push(baseSpawner);\n\n packages = []; // active packages\n warehouses = this.warehouses; // active warehouses\n spawners = this.spawners; // active spawners\n\n layer_1_A.prefillPackages(packages);\n layer_1_B.prefillPackages(packages);\n layer_1_C.prefillPackages(packages);\n\n layer_2_A.prefillPackages(packages);\n layer_2_B.prefillPackages(packages);\n layer_2_C.prefillPackages(packages);\n layer_2_D.prefillPackages(packages);\n layer_2_E.prefillPackages(packages);\n layer_2_F.prefillPackages(packages);\n layer_2_G.prefillPackages(packages);\n\n layer_3_A.prefillPackages(packages);\n layer_3_B.prefillPackages(packages);\n layer_3_C.prefillPackages(packages);\n layer_3_D.prefillPackages(packages);\n layer_3_E.prefillPackages(packages);\n layer_3_F.prefillPackages(packages);\n layer_3_G.prefillPackages(packages);\n }", "title": "" }, { "docid": "d78307ce0a3bf417330f5e12af23d20a", "score": "0.5416241", "text": "function pieceSet (){\n let i = 0; //traversal counter for the puzzle piece set \n for (let y = 0; y < 4; y++){ //traversing the rows of the grid \n for (let x = 0; x < 4; x++){ //traversing the columns of the grid \n if(x==3&& y==3){break;}; //set so that an id isn't assigned to the empty space \n puzzlePiece[i].classList.add(\"puzzlepiece\"); //adding class of \"puzzlepiece\" to puzzlepieces \n puzzlePiece[i].style.position = \"relative\"; // setting positions to relative to get a grid layout \n puzzlePiece[i].setAttribute(\"id\", \"xy(\" + x + \",\" + y + \")\"); //Setting id in the form xy(column,row)\n puzzlePiece[i].style.backgroundPosition = (-1 * 100 * x) + \"px\" + \" \" + (-1 * 100 * y) + \"px\"; // setting tile backgrounds\n puzzlePiece[i].style.gridRow = `${y + 1} / span 1`; //setting tile positions\n puzzlePiece[i].style.gridColumn = `${x + 1} / span 1`;\n puzzlePiece[i].addEventListener(\"click\",movePiece); //making movable tiles move when clicked \n puzzlePiece[i].addEventListener(\"mouseover\", function (){ //changing appearance of movable tiles when \n if (isMovable(this)) // mouse is over them \n this.classList.add(\"movablepiece\");\n else\n this.classList.remove(\"movablepiece\");\n })\n i++;\n }\n }\n setBackground(Math.floor(Math.random() * 4)); //choosing a random background \n }", "title": "" }, { "docid": "52e5ce29fbe526eaef8bc5a0786b34ae", "score": "0.5413313", "text": "function p4_prepare(state){\n var i, j, x, y, a;\n var pieces = state.pieces = [[], []];\n /*convert state.moveno half move count to move cycle count */\n var moveno = state.moveno >> 1;\n var board = state.board;\n\n /* high earliness_weight indicates a low move number. The formula\n * should work above moveno == 50, but this is javascript.\n */\n var earliness_weight = (moveno > 50) ? 0 : parseInt(6 * Math.exp(moveno * -0.07));\n var king_should_hide = moveno < 12;\n var early = moveno < 5;\n /* find the pieces, kings, and weigh material*/\n var kings = [0, 0];\n var material = [0, 0];\n var best_pieces = [0, 0];\n for(i = 20; i < 100; i++){\n a = board[i];\n var piece = a & 14;\n var colour = a & 1;\n if(piece){\n pieces[colour].push([a, i]);\n if (piece == P4_KING){\n kings[colour] = i;\n }\n else{\n material[colour] += P4_VALUES[piece];\n best_pieces[colour] = Math.max(best_pieces[colour], P4_VALUES[piece]);\n }\n }\n }\n\n /*does a draw seem likely soon?*/\n var draw_likely = (state.draw_timeout > 90 || state.current_repetitions >= 2);\n if (draw_likely)\n p4_log(\"draw likely\", state.current_repetitions, state.draw_timeout);\n state.values = [[], []];\n var qvalue = P4_VALUES[P4_QUEEN]; /*used as ballast in various ratios*/\n var material_sum = material[0] + material[1] + 2 * qvalue;\n var wmul = 2 * (material[1] + qvalue) / material_sum;\n var bmul = 2 * (material[0] + qvalue) / material_sum;\n var multipliers = [wmul, bmul];\n var emptiness = 4 * P4_QUEEN / material_sum;\n state.stalemate_scores = [parseInt(0.5 + (wmul - 1) * 2 * qvalue),\n parseInt(0.5 + (bmul - 1) * 2 * qvalue)];\n //p4_log(\"value multipliers (W, B):\", wmul, bmul,\n // \"stalemate scores\", state.stalemate_scores);\n for (i = 0; i < P4_VALUES.length; i++){\n var v = P4_VALUES[i];\n if (v < P4_WIN){//i.e., not king\n state.values[0][i] = parseInt(v * wmul + 0.5);\n state.values[1][i] = parseInt(v * bmul + 0.5);\n }\n else {\n state.values[0][i] = v;\n state.values[1][i] = v;\n }\n }\n /*used for pruning quiescence search */\n state.best_pieces = [parseInt(best_pieces[0] * wmul + 0.5),\n parseInt(best_pieces[1] * bmul + 0.5)];\n\n var kx = [kings[0] % 10, kings[1] % 10];\n var ky = [parseInt(kings[0] / 10), parseInt(kings[1] / 10)];\n\n /* find the frontmost pawns in each file */\n var pawn_cols = [[], []];\n for (y = 3; y < 9; y++){\n for (x = 1; x < 9; x++){\n i = y * 10 + x;\n a = board[i];\n if ((a & 14) != P4_PAWN)\n continue;\n if ((a & 1) == 0){\n pawn_cols[0][x] = y;\n }\n else if (pawn_cols[1][x] === undefined){\n pawn_cols[1][x] = y;\n }\n }\n }\n var target_king = (moveno >= 20 || material_sum < 5 * qvalue);\n var weights = state.weights;\n\n for (y = 2; y < 10; y++){\n for (x = 1; x < 9; x++){\n i = y * 10 + x;\n var early_centre = P4_CENTRALISING_WEIGHTS[i] * earliness_weight;\n var plateau = P4_KNIGHT_WEIGHTS[i];\n for (var c = 0; c < 2; c++){\n var dx = Math.abs(kx[1 - c] - x);\n var dy = Math.abs(ky[1 - c] - y);\n var our_dx = Math.abs(kx[c] - x);\n var our_dy = Math.abs(ky[c] - y);\n\n var d = Math.max(Math.sqrt(dx * dx + dy * dy), 1) + 1;\n var mul = multipliers[c]; /*(mul < 1) <==> we're winning*/\n var mul3 = mul * mul * mul;\n var at_home = y == 2 + c * 7;\n var pawn_home = y == 3 + c * 5;\n var row4 = y == 5 + c;\n var promotion_row = y == 9 - c * 7;\n var get_out = (early && at_home) * -5;\n\n var knight = parseInt(early_centre * 0.3) + 2 * plateau + get_out;\n var rook = parseInt(early_centre * 0.3);\n var bishop = parseInt(early_centre * 0.6) + plateau + get_out;\n if (at_home){\n rook += (x == 4 || x == 5) * (earliness_weight + ! target_king);\n rook += (x == 1 || x == 8) * (moveno > 10 && moveno < 20) * -3;\n rook += (x == 2 || x == 7) * (moveno > 10 && moveno < 20) * -1;\n }\n\n /*Queen wants to stay home early, then jump right in*/\n /*keep kings back on home row for a while*/\n var queen = parseInt(plateau * 0.5 + early_centre * (0.5 - early));\n var king = (king_should_hide && at_home) * 2 * earliness_weight;\n\n /*empty board means pawn advancement is more urgent*/\n var get_on_with_it = Math.max(emptiness * 2, 1);\n var pawn = get_on_with_it * P4_BASE_PAWN_WEIGHTS[c ? 119 - i : i];\n if (early){\n /* Early pawn weights are slightly randomised, so each game is different.\n */\n if (y >= 4 && y <= 7){\n var boost = 1 + 3 * (y == 5 || y == 6);\n pawn += parseInt((boost + p4_random_int(state, 4)) * 0.1 *\n early_centre);\n }\n if (x == 4 || x == 5){\n //discourage middle pawns from waiting at home\n pawn -= 3 * pawn_home;\n pawn += 3 * row4;\n }\n }\n /*pawn promotion row is weighted as a queen minus a pawn.*/\n if (promotion_row)\n pawn += state.values[c][P4_QUEEN] - state.values[c][P4_PAWN];\n\n /*pawns in front of a castled king should stay there*/\n pawn += 4 * (y == 3 && ky[c] == 2 && Math.abs(our_dx) < 2 &&\n kx[c] != 5 && x != 4 && x != 5);\n /*passed pawns (having no opposing pawn in front) are encouraged. */\n var cols = pawn_cols[1 - c];\n if (cols[x] == undefined ||\n (c == 0 && cols[x] < y) ||\n (c == 1 && cols[x] > y))\n pawn += 2;\n\n /* After a while, start going for opposite king. Just\n * attract pieces into the area so they can mill about in\n * the area, waiting for an opportunity.\n *\n * As prepare is only called at the beginning of each tree\n * search, the king could wander out of the targetted area\n * in deep searches. But that's OK. Heuristics are\n * heuristics.\n */\n if (target_king){\n knight += 2 * parseInt(8 * mul / d);\n rook += 2 * ((dx < 2) + (dy < 2));\n bishop += 3 * (Math.abs((dx - dy)) < 2);\n queen += 2 * parseInt(8 / d) + (dx * dy == 0) + (dx - dy == 0);\n /* The losing king wants to stay in the middle, while\n the winning king goes in for the kill.*/\n var king_centre_wt = 8 * emptiness * P4_CENTRALISING_WEIGHTS[i];\n king += parseInt(150 * emptiness / (mul3 * d) + king_centre_wt * mul3);\n }\n weights[P4_PAWN + c][i] = pawn;\n weights[P4_KNIGHT + c][i] = knight;\n weights[P4_ROOK + c][i] = rook;\n weights[P4_BISHOP + c][i] = bishop;\n weights[P4_QUEEN + c][i] = queen;\n weights[P4_KING + c][i] = king;\n\n if (draw_likely && mul < 1){\n /*The winning side wants to avoid draw, so adds jitter to its weights.*/\n var range = 3 / mul3;\n for (j = 2 + c; j < 14; j += 2){\n weights[j][i] += p4_random_int(state, range);\n }\n }\n }\n }\n }\n state.prepared = true;\n}", "title": "" }, { "docid": "e46cb2a750242aa61ac13162ab6a26c6", "score": "0.5413002", "text": "function makePieces() {\n let rowA = [\n {\n id: \"1A\",\n description: \"Semicircle\",\n rots: [0], //If current rotation is in rots, then the piece enters,\n color: \"#777777\",\n },\n {\n id: \"2A\",\n description: \"Rhombus\",\n rots: [0,1,2,3], //0 is for 0°, 1 for 90°, 2 for 180° and 3 for 270°,\n color: \"#777777\"\n },\n {\n id: \"3A\",\n description: \"Tilde\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"4A\",\n description: \"Hexagon\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"5A\",\n description: \"Starfish\",\n rots: [0],\n color: \"#777777\"\n },\n ];\n \n let rowB = [\n {\n id: \"1B\",\n description: \"Five-Point-Star\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"2B\",\n description: \"Hotdog\",\n rots: [0,2],\n color: \"#777777\"\n },\n {\n id: \"3B\",\n description: \"Right-triangle\",\n rots: [0],\n color: \"#777777\"\n }, \n {\n id: \"4B\",\n description: \"Triskelion\",\n rots: [0],\n color: \"#777777\"\n }, \n {\n id: \"5B\",\n description: \"Rectangle\",\n rots: [0,2],\n color: \"#777777\"\n },\n ];\n \n let rowC = [\n {\n id: \"1C\",\n description: \"Rhombus-2\",\n rots: [0,2],\n color: \"#777777\"\n },\n {\n id: \"2C\",\n description: \"Arc\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"3C\",\n description: \"Circle\",\n rots: [0,1,2,3],\n color: \"#777777\"\n }, \n {\n id: \"4C\",\n description: \"Wide-cross\",\n rots: [0,1,2,3],\n color: \"#777777\"\n }, \n {\n id: \"5C\",\n description: \"Inverted-tilde\",\n rots: [0, 2],\n color: \"#777777\"\n },\n ];\n \n let rowD = [\n {\n id: \"1D\",\n description: \"Quarter-circle\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"2D\",\n description: \"Trapezoid\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"3D\",\n description: \"Six-point-star\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"4D\",\n description: \"Diamond\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"5D\",\n description: \"Octagon\",\n rots: [0,1,2,3],\n color: \"#777777\"\n },\n ];\n \n let rowE = [\n {\n id: \"1E\",\n description: \"Star-piece\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"2E\",\n description: \"Pentagon\",\n rots: [0],\n color: \"#777777\"\n },\n {\n id: \"3E\",\n description: \"Pill\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"4E\",\n description: \"X\",\n rots: [0,2],\n color: \"#777777\"\n }, \n {\n id: \"5E\",\n description: \"Equilateral-triangle\",\n rots: [0],\n color: \"#777777\"\n },\n ];\n \n let pieces = [\n //5x5 grid\n rowA, rowB, rowC, rowD, rowE\n ];\n\n return pieces;\n}", "title": "" }, { "docid": "ea6b91464af694f492b2e19e00b53afe", "score": "0.5404675", "text": "drawLargeStraberryPartOne(primary, secondary) {\n const trajectory = this.plantNode.getTrajectory();\n\n if (trajectory === TRAVEL_UP) {\n this.canvasGrid.update(this.col - this.strawbSideOffset, this.row - 2, GREEN);\n } else if (trajectory === TRAVEL_LEFT) {\n this.canvasGrid.update(this.col - 2, this.row - this.strawbSideOffset, GREEN);\n } else if (trajectory === TRAVEL_DOWN) {\n this.canvasGrid.update(this.col + this.strawbSideOffset, this.row + 2, GREEN);\n } else if (trajectory === TRAVEL_RIGHT) {\n this.canvasGrid.update(this.col + 2, this.row + this.strawbSideOffset, GREEN);\n }\n\n const offset = this.strawbSideOffset === 2 ? -1 : 1;\n if (trajectory === TRAVEL_UP) {\n this.canvasGrid.update(this.col - this.strawbSideOffset, this.row - 3, primary);\n this.drawSmallStrawberryTopper(trajectory, primary, this.topPosition + offset);\n } else if (trajectory === TRAVEL_LEFT) {\n this.canvasGrid.update(this.col - 3, this.row - this.strawbSideOffset, primary);\n this.drawSmallStrawberryTopper(trajectory, primary, this.topPosition + offset);\n } else if (trajectory === TRAVEL_DOWN) {\n this.canvasGrid.update(this.col + this.strawbSideOffset, this.row + 3, primary);\n this.drawSmallStrawberryTopper(trajectory, primary, this.topPosition - offset);\n } else if (trajectory === TRAVEL_RIGHT) {\n this.canvasGrid.update(this.col + 3, this.row + this.strawbSideOffset, primary);\n this.drawSmallStrawberryTopper(trajectory, primary, this.topPosition - offset);\n }\n }", "title": "" }, { "docid": "034ad96db764f9c8e02236204a15a3c5", "score": "0.5403354", "text": "function Spot(i, j) {\n\n // Location\n this.i = i;\n this.j = j;\n\n // f, g, and h values for A*\n this.f = 0;\n this.g = 0;\n this.h = 0;\n\n // Neighbors array\n this.neighbors = [];\n\n // the parent of this current Spot\n this.previous = undefined;\n\n var splitString = split(gameMap[this.j+4], \"\");\n //console.log(splitString);\n \n if(splitString[this.i] == '.'){\n this.wall = false;\n }\n else{\n this.wall = true;\n }\n\n // Display me\n this.show = function(color) {\n if (this.wall) {\n fill(50);\n noStroke();\n //ellipseMode(CORNER);\n // //draw the walls as little black dots\n ellipse\n (this.i * w + w / 1.5, this.j * h + h / 1.5, w / 1.5, h / 1.5);\n } \n else if (color){\n fill(color);\n //draw the normal Spots as white boxes\n // rect(this.i * w, this.j * h, w, h,30);\n //ellipseMode(CORNER);\n ellipse\n (this.i * w + w / 1.5, this.j * h + h / 1.5, w / 1.5, h / 1.5);\n }\n \n }\n\n // Figure out who my neighbors are and then add to the array\n // cases to consider from eight directions\n this.addNeighbors = function(grid) {\n var i = this.i;\n var j = this.j;\n if (i < rows - 1) {\n this.neighbors.push(grid[i + 1][j]);\n }\n if (i > 0) {\n this.neighbors.push(grid[i - 1][j]);\n }\n if (j < cols - 1) {\n this.neighbors.push(grid[i][j + 1]);\n }\n if (j > 0) {\n this.neighbors.push(grid[i][j - 1]);\n }\n //we can also go diagonal\n if (i > 0 && j > 0) {\n this.neighbors.push(grid[i - 1][j - 1]);\n }\n if (i < rows - 1 && j > 0) {\n this.neighbors.push(grid[i + 1][j - 1]);\n }\n if (i > 0 && j < cols - 1) {\n this.neighbors.push(grid[i - 1][j + 1]);\n }\n if (i < rows - 1 && j < cols - 1) {\n this.neighbors.push(grid[i + 1][j + 1]);\n }\n } \n}", "title": "" }, { "docid": "85a93013da81f4de1b70dcc185f606c3", "score": "0.5387962", "text": "_flushPieces() {\n // see /diary/wierd variable scoping issue.png\n this.pieces.map(piece => {\n const { x, y } = piece.position\n\n // update the `matrix.coordinates` to update their pieces\n this[x][y].piece = piece\n piece.board = this\n })\n }", "title": "" }, { "docid": "8f2d7c7125be4e7c484e56e122d5640e", "score": "0.5384005", "text": "constructor() {\n super();\n this.type = \"international\";\n this.nbSqPSideX = 8;\n this.nbSqPSideY = 8;\n this.subSizeX = 45;\n this.subSizeY = 45;\n this.imageSrcs = [\n \"./images/international/pieces.svg\",\n \"./images/international/board.png\"\n ];\n this.coordinates = { //holds information about where the piece sprites are from the images file\n 0: [0, 0], //king white (w)\n 1: [0, 1], //king black (b)\n 2: [1, 0], //queen w\n 3: [1, 1], //queen b\n 4: [2, 0], //bishop w\n 5: [2, 1], //bishop b\n 6: [3, 0], //knight w\n 7: [3, 1], //knight b\n 8: [4, 0], //rook w\n 9: [4, 1], //rook b\n 10: [5, 0], //pawn w\n 11: [5, 1] //pawn b\n };\n this.initGameState = \n {\n \"variant\":\"international\",\n \"moveNb\":0,\n \"check\":false,\n \"lastMove\":{\"piece\":null,\"originStr\":null,\"originCoord\":null,\"destinationStr\":null,\"destinationCoord\":null},\n \"pieces\":\n [\n {\"pid\":0,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"a1\",\"positionCoord\":[0,0],\"originalType\":\"rook\",\"type\":\"rook\",\"colour\":\"white\",\"spriteCoord\":8},\n {\"pid\":1,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"b1\",\"positionCoord\":[1,0],\"originalType\":\"knight\",\"type\":\"knight\",\"colour\":\"white\",\"spriteCoord\":6},\n {\"pid\":2,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"c1\",\"positionCoord\":[2,0],\"originalType\":\"bishop\",\"type\":\"bishop\",\"colour\":\"white\",\"spriteCoord\":4},\n {\"pid\":3,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"d1\",\"positionCoord\":[3,0],\"originalType\":\"queen\",\"type\":\"queen\",\"colour\":\"white\",\"spriteCoord\":2},\n {\"pid\":4,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"e1\",\"positionCoord\":[4,0],\"originalType\":\"king\",\"type\":\"king\",\"colour\":\"white\",\"spriteCoord\":0},\n {\"pid\":5,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"f1\",\"positionCoord\":[5,0],\"originalType\":\"bishop\",\"type\":\"bishop\",\"colour\":\"white\",\"spriteCoord\":4},\n {\"pid\":6,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"g1\",\"positionCoord\":[6,0],\"originalType\":\"knight\",\"type\":\"knight\",\"colour\":\"white\",\"spriteCoord\":6},\n {\"pid\":7,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"h1\",\"positionCoord\":[7,0],\"originalType\":\"rook\",\"type\":\"rook\",\"colour\":\"white\",\"spriteCoord\":8},\n {\"pid\":8,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"a2\",\"positionCoord\":[0,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":9,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"b2\",\"positionCoord\":[1,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":10,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"c2\",\"positionCoord\":[2,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":11,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"d2\",\"positionCoord\":[3,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":12,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"e2\",\"positionCoord\":[4,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":13,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"f2\",\"positionCoord\":[5,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":14,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"g2\",\"positionCoord\":[6,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":15,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"h2\",\"positionCoord\":[7,1],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"white\",\"spriteCoord\":10},\n {\"pid\":16,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"a8\",\"positionCoord\":[0,7],\"originalType\":\"rook\",\"type\":\"rook\",\"colour\":\"black\",\"spriteCoord\":9},\n {\"pid\":17,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"b8\",\"positionCoord\":[1,7],\"originalType\":\"knight\",\"type\":\"knight\",\"colour\":\"black\",\"spriteCoord\":7},\n {\"pid\":18,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"c8\",\"positionCoord\":[2,7],\"originalType\":\"bishop\",\"type\":\"bishop\",\"colour\":\"black\",\"spriteCoord\":5},\n {\"pid\":19,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"d8\",\"positionCoord\":[3,7],\"originalType\":\"queen\",\"type\":\"queen\",\"colour\":\"black\",\"spriteCoord\":3},\n {\"pid\":20,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"e8\",\"positionCoord\":[4,7],\"originalType\":\"king\",\"type\":\"king\",\"colour\":\"black\",\"spriteCoord\":1},\n {\"pid\":21,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"f8\",\"positionCoord\":[5,7],\"originalType\":\"bishop\",\"type\":\"bishop\",\"colour\":\"black\",\"spriteCoord\":5},\n {\"pid\":22,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"g8\",\"positionCoord\":[6,7],\"originalType\":\"knight\",\"type\":\"knight\",\"colour\":\"black\",\"spriteCoord\":7},\n {\"pid\":23,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"h8\",\"positionCoord\":[7,7],\"originalType\":\"rook\",\"type\":\"rook\",\"colour\":\"black\",\"spriteCoord\":9},\n {\"pid\":24,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"a7\",\"positionCoord\":[0,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":25,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"b7\",\"positionCoord\":[1,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":26,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"c7\",\"positionCoord\":[2,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":27,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"d7\",\"positionCoord\":[3,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":28,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"e7\",\"positionCoord\":[4,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":29,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"f7\",\"positionCoord\":[5,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":30,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"g7\",\"positionCoord\":[6,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11},\n {\"pid\":31,\"alive\":true,\"numberMoves\":0,\"positionStr\":\"h7\",\"positionCoord\":[7,6],\"originalType\":\"pawn\",\"type\":\"pawn\",\"colour\":\"black\",\"spriteCoord\":11}\n ]\n }\n this.gameStates.push(this.initGameState);\n }", "title": "" }, { "docid": "815f863f9d2d625cce280638cef9a1e3", "score": "0.53804934", "text": "createSections () {\n if (!this.owner.hasStateValue('selectedTile')) {\n return null\n }\n\n var tile = this.owner.stateValue('selectedTile')\n this.tileInformation(tile)\n\n if (tile.structure !== null) {\n var structure = tile.structure\n this.structureInformation(structure)\n this.structureRuining(structure)\n } else {\n this.createBuildingButtons(tile)\n }\n }", "title": "" }, { "docid": "958f599b9981eeeb6665fa5804dc25cf", "score": "0.5379772", "text": "reposition(piecesInTile) {\n piecesInTile.forEach(piece => piece.setDepth(Constants.GameObjectDepth.PIECE));\n\n if (piecesInTile.length == 1) {\n piecesInTile[0].setOrigin(0.5);\n piecesInTile[0].setScale(0.45);\n } else if (piecesInTile.length == 2) {\n piecesInTile[0].setOrigin(0.5, 0.35);\n piecesInTile[0].setScale(0.35);\n this.topOfStackPositioning(piecesInTile, 1);\n } else if (piecesInTile.length == 3) {\n piecesInTile.forEach(piece => piece.setScale(0.35));\n piecesInTile[0].setOrigin(0.2, 0.35);\n piecesInTile[1].setOrigin(0.8, 0.35);\n this.topOfStackPositioning(piecesInTile, 2);\n } else if (piecesInTile.length == 4) {\n piecesInTile.forEach(piece => piece.setScale(0.3));\n piecesInTile[0].setOrigin(0.1, 0.35);\n piecesInTile[1].setOrigin(0.5, 0.35);\n piecesInTile[2].setOrigin(0.9, 0.35);\n this.topOfStackPositioning(piecesInTile, 3);\n } else if (piecesInTile.length == 5) {\n piecesInTile.forEach(piece => piece.setScale(0.3));\n piecesInTile[0].setOrigin(0, 0.35);\n piecesInTile[1].setOrigin(0.33, 0.35);\n piecesInTile[2].setOrigin(0.66, 0.35);\n piecesInTile[3].setOrigin(1, 0.35);\n this.topOfStackPositioning(piecesInTile, 4);\n }\n }", "title": "" }, { "docid": "7ff0910eb40b65809daa325d0f67f1e7", "score": "0.5375082", "text": "function drawBike(b) {\n // For bike parts that are estimated due to lack of data\n var bike_parts_estimated = new Group();\n\n // For the bike wheels\n var bike_wheels = new Group();\n\n // For bike parts that we know the properties of\n var bike_parts = new Group();\n\n // Draw rear wheel\n var shapeRearWheel = new Shape.Circle(b.rear_wheel, b.wheel_size);\n bike_wheels.addChild(shapeRearWheel);\n\n // Draw front wheel\n var shapeFrontWheel = new Shape.Circle(b.front_wheel, b.wheel_size);\n bike_wheels.addChild(shapeFrontWheel);\n\n // Draw Head Tube\n var pathHeadTube = new Path.Line(b.steering_axis_top, b.head_tube_bottom);\n pathHeadTube.label = \"Head tube\";\n bike_parts.addChild(pathHeadTube);\n\n // Draw Down Tube. As this is estimated we move 80% up the head tube.\n var pathDownTube = new Path.Line(b.bottom_bracket, (pathHeadTube.getPointAt(pathHeadTube.length * 0.8)));\n bike_parts_estimated.addChild(pathDownTube);\n\n // Draw Seat Stay\n var pathSeatStay = new Path.Line(b.rear_wheel, b.seat_tube_top);\n bike_parts_estimated.addChild(pathSeatStay);\n\n // Draw Seat Post continuing from seat tube\n var pathSeatPost = new Path.Line(b.seat_tube_top, b.seat_post_top);\n bike_parts_estimated.addChild(pathSeatPost);\n\n // Draw handlebars from head tube\n var pathHandlebars = new Path.Line(b.steering_axis_top, b.handlebar_post_top);\n pathHandlebars.add(pathHandlebars.position + new Point(100, -25));\n pathHandlebars.smooth();\n bike_parts_estimated.addChild(pathHandlebars);\n\n // Draw chainstay\n var pathChainstay = new Path.Line(b.bottom_bracket, b.rear_wheel);\n pathChainstay.label = \"Chainstay\";\n bike_parts.addChild(pathChainstay);\n\n // Draw Seat Tube\n var pathSeatTube = new Path.Line(b.bottom_bracket, b.seat_tube_top);\n pathSeatTube.label = \"Seat tube\";\n bike_parts.addChild(pathSeatTube);\n\n // Draw Fork\n var pathFork = new Path.Line(b.head_tube_bottom, b.front_wheel);\n pathFork.label = \"Fork\";\n bike_parts.addChild(pathFork);\n\n //Draw Top Tube\n var pathTopTube = new Path.Line(b.seat_tube_top, b.steering_axis_top);\n pathTopTube.label = \"Top tube\";\n bike_parts.addChild(pathTopTube);\n\n // Draw bottom bracket\n var shapeBottomBracket = new Shape.Circle(b.bottom_bracket, 25);\n shapeBottomBracket.fillColor = window.globals.colours.component;\n shapeBottomBracket.label = \"Bottom bracket\";\n bike_parts.addChild(shapeBottomBracket);\n\n // Apply styling and interactivity to each bike part that we know the value of\n bike_parts.children.forEach(function (part) {\n part.set(window.globals.bike_part_settings);\n\n part.onMouseEnter = function () {\n window.globals.hover_label.content = part.label;\n part.strokeColor = window.globals.colours.hovered;\n part.bringToFront();\n };\n part.onMouseLeave = function () {\n window.globals.hover_label.content = \"\";\n part.strokeColor = window.globals.colours.component;\n part.bringToFront();\n }\n });\n\n bike_wheels.children.forEach(function (part) {\n part.set(window.globals.bike_wheel_settings);\n });\n\n bike_parts_estimated.children.forEach(function (part) {\n part.set(window.globals.bike_part_estimated_settings);\n });\n\n b.bike_group.addChild(bike_wheels);\n b.bike_group.addChild(bike_parts_estimated);\n b.bike_group.addChild(bike_parts);\n}", "title": "" }, { "docid": "52bd1f7654d4406ddb5671e310a6e31c", "score": "0.5372086", "text": "build()\n\t{\n this.halfWidth = system.width/2;\n\t\tthis.halfHeight = system.height/2;\n\t\tthis.name = 'Title';\n\t\tthis.bottomContainer = new cjs.Container();\n\t\tthis.topContainer = new cjs.Container();\n\t\tthis.bottomContainer.y = 1000;\n\t\tthis.topContainer.y = -600;\n\t\tlet backGround = this.getShape(system.width, system.height,-this.halfWidth, -this.halfHeight, \"#83a5db\");\n\t\tthis.textBorder = this.getShape(700, 100, -355, -this.halfHeight+155, \"#ff0000\");\n\t\tthis.textBg = this.getShape(680, 85, -345, -this.halfHeight+163, \"#ffffff\");\n\t\tthis.text = new cjs.Text('BATHROOM RUN', '180px pixel_maz', '#fffd07').set({x:0, y:-this.halfHeight+200, textBaseline: 'middle', textAlign:'center'});\n\t\tthis.textSS = new cjs.Text('BATHROOM RUN', '180px pixel_maz', '#000').set({x:2, scaleX:1, y:-this.halfHeight+205, textBaseline: 'middle', textAlign:'center'});\n\t\tlet cloudBG = new cjs.Sprite(cache.get('gameSS'),'cloud-background').set({x:-368, y:this.halfHeight-600, scaleX:-2, scaleY:2}).center();\n\t\tlet cityBG = new cjs.Sprite(cache.get('citySS'),'city-background_02').set({x:-120, y:this.halfHeight-600, scaleX:-1}).center();\n\t\tlet grassBG = new cjs.Sprite(cache.get('citySS'),'grass-bg_01').set({x:0, y:this.halfHeight-348, scaleX:1.5, scaleY:1.5}).center();\n\t\tlet floor = new cjs.Sprite(cache.get('gameSS'),'floor-1').set({x:0, y:this.halfHeight-80}).center();\n\t\tlet runner = new cjs.Sprite(cache.get('animationsSS'), 'heroRun').set({framerate:12, scaleX:2, scaleY:2, x:-260, y:this.halfHeight-345}).center();\n\t\tlet mailBox = new cjs.Sprite(cache.get('gameSS'),'mail-box-enemy').set({x:0, y:this.halfHeight-282, scaleX:1.5, scaleY:1.5}).center();\n\n\t\tthis.bottomContainer.addChild(cloudBG, cityBG, grassBG, floor, runner, mailBox);\n\t\tthis.cloud1 = new cjs.Sprite(cache.get('gameSS'),'cloud-1').set({x:800, y:floor.y-1070, scaleX:-1.5, scaleY:1.5}).center();\n\t\tthis.cloud2 = new cjs.Sprite(cache.get('gameSS'),'cloud-3').set({x:-800, y:floor.y-970, scaleX:-1.5, scaleY:1.5}).center();\n\t\tthis.startButton = new cjs.Sprite(cache.get('gameSS'),'start').set({x:0, y:-1500, name: 'startButton'}).center();\n\t\tthis.startButton.on('mouseover', this.buttonHandler, this);\n\t\tthis.startButton.on('mouseout', this.buttonHandler, this);\n\t\tthis.startButton.on('click', this.buttonHandler, this);\n\t\tthis.soundBtn = new cjs.Sprite(cache.get('gameSS'),'sound').set({x:250, name:'soundBtn', soundOn: true, y:-this.halfHeight+50, }).center();\n\t\tthis.soundBtn.on('mouseover', this.buttonHandler, this);\n\t\tthis.soundBtn.on('mouseout', this.buttonHandler, this);\n\t\tthis.soundBtn.on('click', this.buttonHandler, this);\n\t\tthis.topContainer.addChild(this.textBorder, this.textBg, this.textSS, this.text, this.soundBtn);\n\t\tthis.howToPlay = new cjs.Sprite(cache.get('gameSS'),'how-to-play').set({x:0, y:1500, name: 'howToPlay'}).center();\n\t\tthis.howToPlay.on('mouseover', this.buttonHandler, this);\n\t\tthis.howToPlay.on('mouseout', this.buttonHandler, this);\n\t\tthis.howToPlay.on('click', this.buttonHandler, this);\n\t\tthis.howTo = new HowToWindow();\n\t\tthis.leaderBoardBtn = new cjs.Sprite(cache.get('gameSS'),'rank').set({x:0, y:1500, name: 'leaderBoardBtn'}).center();\n\t\tthis.leaderBoardBtn.on('mouseover', this.buttonHandler, this);\n\t\tthis.leaderBoardBtn.on('mouseout', this.buttonHandler, this);\n\t\tthis.leaderBoardBtn.on('click', this.buttonHandler, this);\n\t\t///FACEBOOK TESTING\n\t\t// var playerImage = new Image();\n\t\t// playerImage.crossOrigin = 'anonymous';\n\t\t// This function should be called after FBInstant.initializeAsync()\n\t\t// resolves.\n\t\t// playerImage.src = FBInstant.player.getPhoto();\n\t\t// var bitmap = new cjs.Bitmap(playerImage.src);\n\t\t// bitmap.set({regX:200, regY:200});\n\t\t// cjs.Tween.get(bitmap, {loop:true}).to({rotation:360}, 1000);\n\n\t\t///GET LEADERBOARD SCORES\n\n\t\tthis.leaderBoardArray = [];\n\t\tthis.playersCurrentBoard = null;\n\t\t// FBInstant.getLeaderboardAsync('how_long_you_held_it')\n\t\t// \t.then(leaderboard => leaderboard.getEntriesAsync(10, 0))\n\t\t// \t.then(entries =>\n\t\t// \t{\n\t\t// \t\tfor (var i = 0; i < entries.length; i++) {\n\t\t// \t\t\tlet rank = entries[i].getRank();\n\t\t// \t\t\tlet name = entries[i].getPlayer().getName();\n\t\t// \t\t\tlet score = entries[i].getScore();\n\t\t// \t\t\tlet playerImage = new Image();\n\t\t// \t\t\tplayerImage.crossOrigin = 'anonymous';\n\t\t// \t\t\tplayerImage.src = entries[i].getPlayer().getPhoto();\n\t\t// \t\t\tlet infoObect = { rank: rank, name: name, score: score, photo:playerImage};\n\t\t// \t\t\tthis.leaderBoardArray.push(infoObect);\n\t\t// \t\t}\n\t\t// \t})\n\t\t// .catch(error => console.error(error));\n\n\t\t// FBInstant.getLeaderboardAsync('how_long_you_held_it')\n\t\t// \t.then(leaderboard => leaderboard.getPlayerEntryAsync())\n\t\t// \t.then(entry => {\n\t\t// \t\tlet rank = entry.getRank();\n\t\t// \t\tlet name = entry.getPlayer().getName();\n\t\t// \t\tlet score = entry.getScore();\n\t\t// \t\tlet playerImage = new Image();\n\t\t// \t\tplayerImage.crossOrigin = 'anonymous';\n\t\t// \t\tplayerImage.src = entry.getPlayer().getPhoto();\n\t\t// \t\tthis.playersCurrentBoard = {rank: rank, name: name, score:score, photo:playerImage};\n\t\t// \t\tif(this.playersCurrentBoard.score === null || this.playersCurrentBoard.score === undefined){\n\t\t// \t\t\tcjs.Tween.get(this.howToPlay, {loop:true}).to({scaleX:1.1, scaleY:1.1}, 300).to({scaleX:1, scaleY:1}, 300, cjs.Ease.quadOut);\n\t\t// \t\t}\n\t\t// \t})\n\t\t// \t.catch(error => console.error(error));\n\n\n\n\t\t\t// this.soundBtn.visible = this.startButton.visible = this.howToPlay.visible = this.leaderBoardBtn.visible = false;\n\t\tthis.addChild(backGround, this.cloud1, this.cloud2, this.bottomContainer, this.startButton, this.howToPlay, this.topContainer, this.howTo, this.leaderBoardBtn);\n\t\tcjs.Tween.get(this).wait(2000).call(this.addLeaderBoard, null, this);\n\n\t\t// this.howToPlay.visible = false;\n\t\tthis.leaderBoardBtn.visible = false;\n\t\t// this.soundBtn.visible = false;\n\n\t}", "title": "" }, { "docid": "02602f063f51960641f1a9234617815c", "score": "0.53711575", "text": "newPiece(){\n let p = this.generateRandomPiece();\n p.pos.y=-1;\n p.pos.x=Math.floor(this.constants.gridWidth/2)-Math.floor(p.grid.length/2);\n this.currentPiece=p;\n }", "title": "" }, { "docid": "6fe01bc2e6c129041ab3470df035ff7d", "score": "0.5368934", "text": "function puzzleSplitter() {\n\t\tvar mainPuzzle = document.getElementById(\"puzzlearea\");\n\t\tfor (var i=1; i < 16; i++) {\n\t\t\tvar tempTile = document.createElement(\"div\");\n\t\t\ttempTile.className = \"puzzlePiece\";\n\t\t\ttempTile.innerHTML = i;\n\t\t\ttempTile.onmouseover = over;\n\t\t\ttempTile.onmouseout = out;\n\t\t\ttempTile.onclick = moveAssist;\n\t\t\tpuzzlearea.appendChild(tempTile);\n\t\t}\n\t}", "title": "" }, { "docid": "67b5d658e1b3ba98b31ce6b329829e48", "score": "0.5362362", "text": "constructor(){\n this.nbSqPSideX; //number of squares on the horizontal axes\n this.nbSqPSideY; //number of squares on the vertical axes\n this.images = { //file locations for board and piece images\n board: null,\n pieces: null\n };\n this.moveNb = 0; //current game move\n this.eyeNb = 0; //game move being drawn onto the canvas\n this.gameStates = []; //set of all moves and piece positions\n this.moves = {}; //set of valid squares which piece can move to (generated before canvas is drawn)\n this.focus = { //structure which holds data to show user which piece is selected and where it can be moved\n piece: null,\n validSquares: null\n };\n this.promotionConfigs = []; //set of promotion rules applied to each piece\n this.promotingChoice = []; //set of promotion choices if piece dropped in promotion zone\n this.promoting = false; //false if piece isn't being promoted, true otherwise\n this.promotingSquare; //keeps track of which square promoted piece must be dropped to\n }", "title": "" }, { "docid": "67b5d658e1b3ba98b31ce6b329829e48", "score": "0.5362362", "text": "constructor(){\n this.nbSqPSideX; //number of squares on the horizontal axes\n this.nbSqPSideY; //number of squares on the vertical axes\n this.images = { //file locations for board and piece images\n board: null,\n pieces: null\n };\n this.moveNb = 0; //current game move\n this.eyeNb = 0; //game move being drawn onto the canvas\n this.gameStates = []; //set of all moves and piece positions\n this.moves = {}; //set of valid squares which piece can move to (generated before canvas is drawn)\n this.focus = { //structure which holds data to show user which piece is selected and where it can be moved\n piece: null,\n validSquares: null\n };\n this.promotionConfigs = []; //set of promotion rules applied to each piece\n this.promotingChoice = []; //set of promotion choices if piece dropped in promotion zone\n this.promoting = false; //false if piece isn't being promoted, true otherwise\n this.promotingSquare; //keeps track of which square promoted piece must be dropped to\n }", "title": "" }, { "docid": "02cd936f04590e5c879e817410a2cc49", "score": "0.5360857", "text": "function Piece(x1, y1, x2, y2) {\n this.x1 = x1;\n this.y1 = y1;\n this.x2 = x2;\n this.y2 = y2;\n }", "title": "" } ]
4a8bfe71009743002d81c6057972456b
Method to draw shape. If !isWithShape draw self el only, but not shape.
[ { "docid": "ca9ff17b597311d31f0e4ee0533a9931", "score": "0.7789388", "text": "_draw () {\n // call _draw or just _drawEl @ Shape depending if there is `shape`\n var methodName = ( this._props.isWithShape ) ? '_draw' : '_drawEl';\n Shape.prototype[ methodName ].call(this);\n }", "title": "" } ]
[ { "docid": "b35029b72092e10c77e59cf6583c0fca", "score": "0.6850187", "text": "_drawShape() {\n assertParameters(arguments);\n \n this._updateBlinking();\n \n const radius = this._calculateRadius();\n const coords = this._getCoords(radius);\n \n if (this._highlight !== false && this._shouldDraw) {\n const highlightSize = this._highlight * (Hexagon.HIGHLIGHT_SIZE + radius);\n this._canvas.drawWithShadow(highlightSize, Hexagon.HIGHLIGHT_COLOR, \n this._drawWithCoords.bind(this, coords));\n } else {\n this._drawWithCoords(coords);\n }\n }", "title": "" }, { "docid": "4881feaa1393f11f15216e89560d4a62", "score": "0.67354125", "text": "function drawShape(parent, element) {\n var h = handlers[element.type];\n\n if (!h) {\n return BaseRenderer.prototype.drawShape.apply(this, [parent, element]);\n } else {\n return h(parent, element);\n }\n }", "title": "" }, { "docid": "72d6088bceb8566563a6104426aa7e86", "score": "0.66009706", "text": "appendShape(shape) {\n this._shapes.push(shape);\n shape._canvas = this;\n this._div.appendChild(shape.div);\n }", "title": "" }, { "docid": "f5832009ea972c199252e20654d3c7b4", "score": "0.6581312", "text": "function drawshape(context, shape) {\r\n context.fillStyle = 'rgba(2,165,165,0.7)';\r\n\r\n // We can skip the drawing of elements that have moved off the screen:\r\n if (shape.x() > WIDTH || shape.y() > HEIGHT)\r\n return;\r\n if (shape.x() + shape.width() < 0 || shape.y() + shape.height() < 0)\r\n return;\r\n\r\n context.fillRect(shape.x(), shape.y(), shape.width(), shape.height());\r\n}", "title": "" }, { "docid": "7cb982b81a9c0747158d545a48afcd0e", "score": "0.6567136", "text": "function draw() {\n if (self.currentShapes == 'circles') {\n drawCircles();\n } else if (self.currentShapes == 'triangles') {\n drawTriangles();\n } else {\n drawRectangles();\n }\n }", "title": "" }, { "docid": "00484305dc89f098ceb1259fbea97bd4", "score": "0.64714605", "text": "appendShape(shape){\n this._shapes.push(shape);\n if (this.canvas.classname === \"Canvas\"){\n this.canvas.appendShape(shape)\n }\n this.div.appendChild(shape.div)\n }", "title": "" }, { "docid": "9728e777163dfa004973010d4af8128f", "score": "0.64412594", "text": "draw_shapes() {\n\t\t\tlet params = { offsetX: 0, offsetY: 0 };\n\t\t\tlet ctx = this.canvas.getContext(\"2d\");\n\t\t\tfor (let shape_name in this.shapes) {\n\t\t\t\tlet shape = this.shapes[shape_name];\n\t\t\t\t// draw all visible shapes\n\t\t\t\tif (shape.visible && !shape.active) {\n\t\t\t\t\tdocument.draw_shape(ctx, shape, params);\n\t\t\t\t\tdocument.draw_shape_border(ctx, shape, params);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// make sure to draw active shape last (so it appears 'on top')\n\t\t\tif (this.pento_active_shape && this.pento_active_shape.visible) {\n\t\t\t\tdocument.draw_shape(ctx, this.pento_active_shape, params);\n\t\t\t\tdocument.draw_shape_border(ctx, this.pento_active_shape, params);\n\t\t\t}\n\t\t}", "title": "" }, { "docid": "cd78aa71b3fad3e2ff0ff6aa6717a832", "score": "0.6385586", "text": "updateShape() {\n\n const shape = new Shape();\n\n if ( this.shapePoints.length > 1 ) {\n shape.moveToPoint( this.shapePoints[ 0 ] );\n for ( let i = 1; i < this.shapePoints.length; i++ ) {\n shape.lineToPoint( this.shapePoints[ i ] );\n }\n shape.close();\n }\n\n this.shape = shape;\n }", "title": "" }, { "docid": "ec725ea27c6b5bc0df99d8e5f8d47569", "score": "0.63823587", "text": "function drawshape(context, shape) {\n\n // We can skip the drawing of elements that have moved off the screen:\n if (shape.x > canvas.width || shape.y > canvas.height) return;\n if (shape.x + shape.w < 0 || shape.y + shape.h < 0) return;\n\n if (shape.type == \"server\") {\n if (serverImg) context.drawImage(serverImg, shape.x, shape.y, shape.w, shape.h);\n }\n if (shape.type == \"module\") {\n if (moduleImg) context.drawImage(moduleImg, shape.x, shape.y, shape.w, shape.h);\n }\n if (shape.type == \"light\") {\n if (lightImg){\n\t\t\t\tif(!shape.isLit) context.drawImage(lightImg, shape.x, shape.y, shape.w, shape.h);\n\t\t\t\telse context.drawImage(lightImgLit, shape.x, shape.y, shape.w, shape.h);\n\t\t\t}\n }\n\n }", "title": "" }, { "docid": "3c2d9bd440cd3f006a511fc65385528c", "score": "0.63277906", "text": "function drawShape(){\n return true;\n}", "title": "" }, { "docid": "704d95b578d92fe5ba86fd646ac5c836", "score": "0.6261319", "text": "function drawSelectedShape() {\n drawRectangle(context, selectedShape.x, selectedShape.y, selectedShape.toX, selectedShape.toY, \"red\");\n for (let i = 0; i < selectedShape.selectionHandles.length; i++) {\n //if the selected shape is a circle we only draw 2 handles\n if (selectedItem instanceof Circle) {\n if (i === 3 || i === 4) {\n drawRectangle(context, selectedShape.selectionHandles[i].x,\n selectedShape.selectionHandles[i].y,\n selectedShape.selectionHandles[i].x + selectedShape.handleSize,\n selectedShape.selectionHandles[i].y + selectedShape.handleSize, \"red\", true)\n }\n }\n //we draw all handles if it's any other shape\n else {\n drawRectangle(context, selectedShape.selectionHandles[i].x,\n selectedShape.selectionHandles[i].y,\n selectedShape.selectionHandles[i].x + selectedShape.handleSize,\n selectedShape.selectionHandles[i].y + selectedShape.handleSize, \"red\", true)\n }\n }\n}", "title": "" }, { "docid": "de182693fa646f74f20d9e93f3de0be1", "score": "0.6228217", "text": "drawShape( game, body , shape, context ) {\n\n\t\tcontext.strokeStyle = '#000';\n\t\tcontext.lineWidth = 1;\n\t\tlet scale = game.scale;\n\t\t\n\t\tcontext.fillStyle = \"#ccc\";\n\t\t\n\t\tcontext.beginPath();\n\t\tswitch (shape.GetType()) \n\t\t{\n\t\t\t//A polygon type shape like a square , rectangle etc\n\t\t\tcase this.b2Shape.e_polygonShape:\t\t\t\n\t\t\t\tlet vert = shape.GetVertices();\n\t\t\t\tlet position = body.GetPosition();\n\t\t\t\t//b2Math.MulMV(b.m_xf.R , vert[0]);\n\t\t\t\t\n\t\t\t\tlet tV = position.Copy();\n\t\t\t\tlet a = vert[0].Copy();\n\t\t\t\ta.MulM( body.GetTransform().R );\n\t\t\t\t\n\t\t\t\ttV.Add(a);\n\t\t\t\t\n\t\t\t\tlet _v = game.get_offset( tV );\n\t\t\t\t\n\t\t\t\tlet _x = _v.x;\n\t\t\t\tlet _y = _v.y;\n\t\t\t\t\n\t\t\t\tcontext.moveTo( _x * scale, _y * scale );\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < vert.length; i++) {\n\t\t\t\t\t//Get a copy of the vertice\n\t\t\t\t\tlet v = vert[i].Copy();\n\t\t\t\t\t\n\t\t\t\t\t//Rotate the vertice\n\t\t\t\t\tv.MulM( body.GetTransform().R );\n\t\t\t\t\t\n\t\t\t\t\tv.Add(position);\n\t\t\t\t\t\n\t\t\t\t\t//Subtract the camera coordinates to get relative offsets\n\t\t\t\t\tlet _v = game.get_offset(v);\n\t\t\t\t\t\n\t\t\t\t\tlet _x1 = _v.x;\n\t\t\t\t\tlet _y1 = _v.y;\n\n\t\t\t\t\t//Draw line to the new point\n\t\t\t\t\tcontext.lineTo( _x1 * scale , _y1 * scale);\n\t\t\t\t}\n\t\t\t\tcontext.lineTo(_x * scale, _y * scale);\t\t\t\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcontext.fill();\n\t\tcontext.stroke();\n\t}", "title": "" }, { "docid": "de182693fa646f74f20d9e93f3de0be1", "score": "0.6228217", "text": "drawShape( game, body , shape, context ) {\n\n\t\tcontext.strokeStyle = '#000';\n\t\tcontext.lineWidth = 1;\n\t\tlet scale = game.scale;\n\t\t\n\t\tcontext.fillStyle = \"#ccc\";\n\t\t\n\t\tcontext.beginPath();\n\t\tswitch (shape.GetType()) \n\t\t{\n\t\t\t//A polygon type shape like a square , rectangle etc\n\t\t\tcase this.b2Shape.e_polygonShape:\t\t\t\n\t\t\t\tlet vert = shape.GetVertices();\n\t\t\t\tlet position = body.GetPosition();\n\t\t\t\t//b2Math.MulMV(b.m_xf.R , vert[0]);\n\t\t\t\t\n\t\t\t\tlet tV = position.Copy();\n\t\t\t\tlet a = vert[0].Copy();\n\t\t\t\ta.MulM( body.GetTransform().R );\n\t\t\t\t\n\t\t\t\ttV.Add(a);\n\t\t\t\t\n\t\t\t\tlet _v = game.get_offset( tV );\n\t\t\t\t\n\t\t\t\tlet _x = _v.x;\n\t\t\t\tlet _y = _v.y;\n\t\t\t\t\n\t\t\t\tcontext.moveTo( _x * scale, _y * scale );\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < vert.length; i++) {\n\t\t\t\t\t//Get a copy of the vertice\n\t\t\t\t\tlet v = vert[i].Copy();\n\t\t\t\t\t\n\t\t\t\t\t//Rotate the vertice\n\t\t\t\t\tv.MulM( body.GetTransform().R );\n\t\t\t\t\t\n\t\t\t\t\tv.Add(position);\n\t\t\t\t\t\n\t\t\t\t\t//Subtract the camera coordinates to get relative offsets\n\t\t\t\t\tlet _v = game.get_offset(v);\n\t\t\t\t\t\n\t\t\t\t\tlet _x1 = _v.x;\n\t\t\t\t\tlet _y1 = _v.y;\n\n\t\t\t\t\t//Draw line to the new point\n\t\t\t\t\tcontext.lineTo( _x1 * scale , _y1 * scale);\n\t\t\t\t}\n\t\t\t\tcontext.lineTo(_x * scale, _y * scale);\t\t\t\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcontext.fill();\n\t\tcontext.stroke();\n\t}", "title": "" }, { "docid": "47dfc3d852e59c4024a9865a353a0aae", "score": "0.622597", "text": "function drawShape(shape, context) {\n\tcontext.strokeStyle = '#003300';\n\tcontext.beginPath();\n\tswitch (shape.m_type) {\n\t\tcase b2Shape.e_circleShape:\n\t\t\tvar circle = shape;\n\t\t\tvar pos = circle.m_position;\n\t\t\tvar r = circle.m_radius;\n\t\t\tvar segments = 16.0;\n\t\t\tvar theta = 0.0;\n\t\t\tvar dtheta = 2.0 * Math.PI / segments;\n\t\t\t// draw circle\n\t\t\tcontext.moveTo(pos.x + r, pos.y);\n\t\t\tfor (var i = 0; i < segments; i++) {\n\t\t\t\tvar d = new b2Vec2(r * Math.cos(theta),\n\t\t\t\t\tr * Math.sin(theta));\n\t\t\t\tvar v = b2Math.AddVV(pos, d);\n\t\t\t\tcontext.lineTo(v.x, v.y);\n\t\t\t\ttheta += dtheta;\n\t\t\t}\n\t\t\tcontext.lineTo(pos.x + r, pos.y);\n\t\t\t// draw radius\n\t\t\tcontext.moveTo(pos.x, pos.y);\n\t\t\tvar ax = circle.m_R.col1;\n\t\t\tvar pos2 = new b2Vec2(pos.x + r * ax.x, pos.y + r * ax.y);\n\t\t\tcontext.lineTo(pos2.x, pos2.y);\n\t\t\tbreak;\n\t\tcase b2Shape.e_polyShape:\n\t\t\tvar poly = shape;\n\t\t\tvar tV = b2Math.AddVV(poly.m_position,\n\t\t\t\tb2Math.b2MulMV(poly.m_R, poly.m_vertices[0]));\n\t\t\tcontext.moveTo(tV.x, tV.y);\n\t\t\tfor (var i = 0; i < poly.m_vertexCount; i++) {\n\t\t\t\tvar v = b2Math.AddVV(poly.m_position,\n\t\t\t\t\tb2Math.b2MulMV(poly.m_R, poly.m_vertices[i]));\n\t\t\t\tcontext.lineTo(v.x, v.y);\n\t\t\t}\n\t\t\tcontext.lineTo(tV.x, tV.y);\n\t\t\tbreak;\n\t}\n\tcontext.stroke();\n}", "title": "" }, { "docid": "8505ce3bb5eaf94eb994922cf402b0a0", "score": "0.620596", "text": "function drawShape(shape, context) {\n\tcontext.strokeStyle = 'white';\n\tcontext.beginPath();\n\tswitch (shape.m_type) {\n\t\tcase b2Shape.e_circleShape:\n\t\tvar circle = shape;\n\t\tvar pos = circle.m_position;\n\t\tvar r = circle.m_radius;\n\t\tvar segments = 16.0;\n\t\tvar theta = 0.0;\n\t\tvar dtheta = 2.0 * Math.PI / segments;\n\t\t// draw circle\n\t\tcontext.moveTo(pos.x + r, pos.y);\n\t\tfor (var i = 0; i < segments; i++) {\n\t\t\tvar d = new b2Vec2(r * Math.cos(theta),\n\t\t\tr * Math.sin(theta));\n\t\t\tvar v = b2Math.AddVV(pos, d);\n\t\t\tcontext.lineTo(v.x, v.y);\n\t\t\ttheta += dtheta;\n\t\t}\n\t\tcontext.lineTo(pos.x + r, pos.y);\n\t\t// draw radius\n\t\tcontext.moveTo(pos.x, pos.y);\n\t\tvar ax = circle.m_R.col1;\n\t\tvar pos2 = new b2Vec2(pos.x + r * ax.x, pos.y + r * ax.y);\n\t\tcontext.lineTo(pos2.x, pos2.y);\n\t\tbreak;\n\t\tcase b2Shape.e_polyShape:\n\t\tvar poly = shape;\n\t\tvar tV = b2Math.AddVV(poly.m_position,\n\t\tb2Math.b2MulMV(poly.m_R, poly.m_vertices[0]));\n\t\tcontext.moveTo(tV.x, tV.y);\n\t\tfor (var i = 0; i < poly.m_vertexCount; i++) {\n\t\t\tvar v = b2Math.AddVV(poly.m_position,\n\t\t\tb2Math.b2MulMV(poly.m_R, poly.m_vertices[i]));\n\t\t\tcontext.lineTo(v.x, v.y);\n\t\t}\n\t\tcontext.lineTo(tV.x, tV.y);\n\t\tbreak;\n\t}\n\tcontext.stroke();\n}", "title": "" }, { "docid": "d7e466f400d9b12cda2a85df547c7894", "score": "0.6202879", "text": "drawShape(x, y, shapeType){\r\n\r\n if(isNaN(x) || isNaN(y) || isNaN(shapeType)){\r\n throw \"X, Y or ShapeType is not a numbers\";\r\n }\r\n\r\n if(x > this.xcells || y > this.ycells) {\r\n throw `x: ${x}, y: ${y} is out of bounds`;\r\n }\r\n\r\n if(shapeType != Enums.Shapes.Circle && shapeType != Enums.Shapes.Cross){\r\n throw `Shape Type: ${shapeType}, is not a valid shape`;\r\n }\r\n\r\n let xcoord = x * this.elementWidth;\r\n let ycoord = y * this.elementHeight;\r\n\r\n let shape = shapeType == 1 \r\n ? new Cross(xcoord, ycoord, this.elementWidth, this.elementHeight, this.lineWidth)\r\n : new Circle(xcoord, ycoord , this.elementRadiusx, this.elementRadiusy, this.lineWidth);\r\n shape.paint(this.ctx, this.Color);\r\n }", "title": "" }, { "docid": "8fc48ba63a181220f78f4a7a825d16c8", "score": "0.6094857", "text": "function reDraw() {\n $scope.shape = $scope.shapeSelected.draw(\n $scope.shapeHeight,\n $scope.shapeLabel,\n $scope.labelRow);\n }", "title": "" }, { "docid": "8202c04c288a679e29564f3ddad42bb3", "score": "0.60310644", "text": "draw() {\n\t\tthis.shape = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n\t\tthis.shape.setAttribute(\"fill\", \"transparent\");\n\t\tthis.shape.setAttribute(\"stroke\", this.color);\n\t\tthis.shape.setAttribute(\"stroke-width\", this.strokeWidth);\n\n\t\tthis.effectsShape = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n\t\tthis.effectsShape.setAttribute(\"fill\", \"transparent\");\n\t\tthis.effectsShape.setAttribute(\"stroke-linecap\", \"butt\");\n\t\tthis.effectsShape.setAttribute(\"stroke\", this.color);\n\t\tthis.effectsShape.setAttribute(\"stroke-width\", this.strokeWidth);\n\n\t\tsuper.draw();\n\t}", "title": "" }, { "docid": "63d258d7d7bd4d647cc429d36628eb83", "score": "0.6011842", "text": "function sceneFunc(context, shape) {\n if (props.vertices && props.vertices.length > 0) {\n if (props.trackVertices && props.trackVertices.length > 0) {\n drawTrackVertices(context)\n }\n\n drawLayerVertices(context, props.bounds)\n\n if (props.start || props.end || isSelected) {\n drawStartAndEndPoints(context)\n }\n helper.drawSliderEndPoint(context)\n }\n\n context.fillStrokeShape(shape)\n }", "title": "" }, { "docid": "d7c7fb1dbd878295f5152bbfac04aa76", "score": "0.6011262", "text": "draw() {\n fill(this.filled ? 0 : 255)\n strokeWeight(0.05);\n\n beginShape()\n this.edges.forEach(edge => {\n let [a, b] = edge\n vertex(a.x, a.y)\n vertex(b.x, b.y)\n })\n endShape(CLOSE);\n }", "title": "" }, { "docid": "fd9381fb7bc493b66ceced64b4ac6ffb", "score": "0.5951736", "text": "function drawShape(shapeObj, highLight){\n let keys = Object.keys(shapeObj);\n let arcOne = keys[2];\n let arcTwo = keys[3];\n let id = keys[0];\n let arc1 = shapeObj[arcOne];\n let arc2 = shapeObj[arcTwo];\n let regionID = shapeObj[id];\n let color = '';\n\n if(highLight === true) {\n color = shapeObj['color'][1];\n }\n else {\n color = shapeObj['color'][0];\n }\n\n //Draws panel shape on board canvas.\n board.beginPath();\n board.arc(arc1[0], arc1[1], arc1[2], arc1[3], arc1[4], arc1[5]);\n board.arc(arc2[0], arc2[1], arc2[2], arc2[3], arc2[4], arc2[5]);\n board.closePath();\n\n board.fillStyle = color;\n board.fill();\n board.addHitRegion({id: regionID});\n\n }", "title": "" }, { "docid": "93af42287eae5155f40a5e564fc79941", "score": "0.594441", "text": "function draw() {\r\n\t// clear the background\r\n\tbackground(\"white\");\r\n\r\n\tlet [offsetX, offsetY] = [0, 0];\r\n\r\n\tif(shapeMoving) {\r\n\t\t[offsetX, offsetY] = [mouseX - moveX, mouseY - moveY];\r\n\t}\r\n\r\n\t// draw all the rectangles\r\n\tfor(const rectangle of rectangles) {\r\n\t\tif(rectangle.highlighted) {\r\n\t\t\trectangle.render(offsetX, offsetY);\r\n\t\t} else {\r\n\t\t\trectangle.render();\r\n\t\t}\r\n\t}\r\n\r\n\t// draw all the dots\r\n\tfor(const dot of dots) {\r\n\t\tif(dot.highlighted) {\r\n\t\t\tdot.render(offsetX, offsetY);\r\n\t\t} else {\r\n\t\t\tdot.render();\r\n\t\t}\r\n\t}\r\n\r\n\t// show the temporary rectangle on screen\r\n\tif(rectangleStarted) {\r\n\t\tconst rectWidth = abs(rectX - mouseX);\r\n\t\tconst rectHeight = abs(rectY - mouseY);\r\n\t\tconst tempX = min(rectX, mouseX);\r\n\t\tconst tempY = min(rectY, mouseY);\r\n\r\n\t\tpush();\r\n\t\tstroke(160);\r\n\t\tstrokeWeight(1);\r\n\t\tnoFill();\r\n\t\trect(tempX, tempY, rectWidth, rectHeight);\r\n\t\tpop();\r\n\t}\r\n}", "title": "" }, { "docid": "37d1e54e103e553659b34008f278330a", "score": "0.592005", "text": "draw() {\n ctx.beginPath();\n ctx.rect(this.loc.x, this.loc.y, this.width, this.height);\n ctx.fillStyle = this.fill;\n ctx.fill();\n ctx.closePath();\n }", "title": "" }, { "docid": "cc5877cfdc7aaad8743b98a02979ff39", "score": "0.5918671", "text": "function drawShape() {\n\t var line1 = drawLine(),\n\t line2 = drawLine();\n\t var path = 'M ' + line1.start + ' C ' + line1.handle1 + ' ' + line1.handle2 + ' ' + line1.end + ' ' +\n\t 'L ' + line2.end + ' C ' + line2.handle2 + ' ' + line2.handle1 + ' ' + line2.start + ' ' +\n\t 'L ' + line1.start;\n\t var shape = paper.path(path).attr({fill: color, stroke: color});\n\t shapes.push(shape);\n\t return shape;\n\t}", "title": "" }, { "docid": "4801c76c68e9982a9d0c1265ff8d9e49", "score": "0.5913886", "text": "draw(){\n if(!this.points.length) return null;\n CANVAS_CONTEXT.beginPath();\n CANVAS_CONTEXT.moveTo(\n this.points[0].getIsoX(),\n this.points[0].getIsoY()\n );\n for(let point of this.points){\n CANVAS_CONTEXT.lineTo(point.getIsoX(), point.getIsoY());\n }\n //close the shape\n CANVAS_CONTEXT.lineTo(\n this.points[0].getIsoX(),\n this.points[0].getIsoY()\n );\n if(this.strokeColor && this.strokeWidth){\n CANVAS_CONTEXT.strokeWidth = this.strokeWidth;\n CANVAS_CONTEXT.strokeStyle = this.strokeColor;\n CANVAS_CONTEXT.stroke();\n }\n CANVAS_CONTEXT.fillStyle = this.color;\n CANVAS_CONTEXT.fill();\n CANVAS_CONTEXT.closePath();\n }", "title": "" }, { "docid": "efb08e37b311fe802e603bc9dd334f6f", "score": "0.5899528", "text": "draw() {\n let newFigure = this.getTransformedFigure();\n\n if (this.filled) {\n ctx.fillStyle = settings.theme.fgColor;\n fillPath(newFigure);\n } else {\n ctx.strokeStyle = settings.theme.fgColor;\n strokePath(newFigure);\n }\n }", "title": "" }, { "docid": "fb958643baecdba2ff65600089de4eae", "score": "0.58951354", "text": "Draw (){\n ctx.beginPath()\n ctx.fillStyle = this.color\n ctx.fillRect(this.x, this.y, this.width, this.height)\n ctx.closePath()\n }", "title": "" }, { "docid": "55f8fc0dea06296a9ebc6cacfc826763", "score": "0.58944696", "text": "_toggleShape() {\n if (this._getShapeData().shape) {\n return this._handlePreviewState(false, () => ({shape: ''}));\n } else {\n const target = this.$target[0];\n const previousSibling = target.previousElementSibling;\n const [shapeWidget] = this._requestUserValueWidgets('bg_shape_opt');\n const possibleShapes = shapeWidget.getMethodsParams('shape').possibleValues;\n let shapeToSelect;\n if (previousSibling) {\n const previousShape = this._getShapeData(previousSibling).shape;\n shapeToSelect = possibleShapes.find((shape, i) => {\n return possibleShapes[i - 1] === previousShape;\n });\n } else {\n shapeToSelect = possibleShapes[1];\n }\n return this._handlePreviewState(false, () => ({shape: shapeToSelect}));\n }\n }", "title": "" }, { "docid": "0181a10d52a23989221fcc2b5ccc96da", "score": "0.58748806", "text": "function drawShape(x, y, prevX, prevY) {\n\n gCtx.beginPath();\n updateSpeed(x, y, prevX, prevY);\n switch(gOptions.shape) {\n case 'rectangle':\n drawRectangle(x, y);\n break;\n case 'circle':\n drawCircle(x, y);\n break;\n case 'line':\n drawLine(x, y, prevX, prevY);\n break;\n case 'triangle':\n drawTriangle(x, y, prevX, prevY);\n break;\n case 'arrow':\n drawArrow(x, y, prevX, prevY);\n break;s\n\n }\n\n if (gOptions.bgColor === 'random') gCtx.fillStyle = getRandomColor();\n else gCtx.fillStyle = gOptions.bgColor;\n\n if (gOptions.color === 'random') gCtx.strokeStyle = getRandomColor();\n else gCtx.strokeStyle = gOptions.color;\n \n gCtx.fill();\n gCtx.stroke();\n}", "title": "" }, { "docid": "aeb46a24eeebdde499328c7d65ffccf4", "score": "0.58710575", "text": "draw(){\n context.beginPath();\n context.strokeStyle = \"#FF0000\";\n context.rect(this.x,this.y,this.width,this.height);\n context.stroke();\n }", "title": "" }, { "docid": "34fe806638da4ab2fdc75ffb04049d41", "score": "0.5857772", "text": "draw(){\n //draw itself\n painter.beginPath();\n painter.fillStyle = this.color;\n //making the object that is about to be painted\n painter.arc(this.x, this.y, this.size, 0, 2 * Math.PI);\n //filling said object with x color\n painter.fill();\n painter.strokeStyle = this.InvertedColor;\n //stroking only draws the borders of object x\n painter.stroke();\n }", "title": "" }, { "docid": "a00d3da8f071c0b57094b1e16c80699e", "score": "0.5855657", "text": "function draw() {\n if (isSpinning) {\n illo.rotate.y += 0.03;\n }\n\n if (!is_moving) {\n current_morphing = -1;\n illo.updateRenderGraph();\n } else {\n if (current_morphing == -1) {\n current_morphing = 0;\n }\n illo.children = []; // drop all children before regeneration\n if (draw_mode_current == 1) {\n // Wireframe mode\n mainshape = new Zdog.Shape({\n addTo: illo,\n path: genShape1(current_morphing),\n color: default_color,\n closed: false,\n stroke: stroke_value,\n fill: false,\n });\n mainshape.updatePath();\n } else {\n if (draw_mode_current == 2) {\n // Faces mode\n genShape2(illo, current_morphing);\n } else {\n // Points mode\n genShape3(illo, current_morphing);\n }\n }\n\n illo.updateRenderGraph();\n\n current_morphing++;\n\n if (current_morphing >= max_morphing) {\n current_morphing = 0;\n }\n }\n }", "title": "" }, { "docid": "7b166e606b00e7d6b865e440ecca8149", "score": "0.58343947", "text": "function shape() { }", "title": "" }, { "docid": "6097fc294aa711b0c4904f8056c08baf", "score": "0.5829585", "text": "draw1(){\n\t\tconsole.log(\"Shape is drawn with size \"+ this.size);\n\t}", "title": "" }, { "docid": "bd47788b362edbf7e1215099f38a9e31", "score": "0.5815066", "text": "draw() {\n this.clear();\n for (const aes of this.aesthetics) {\n if (aes.isEnabled())\n this.drawTriangles(aes);\n this.drawBorders(aes);\n }\n }", "title": "" }, { "docid": "7fd99a72dd92aec56ac4609a93624d80", "score": "0.5811987", "text": "function draw() {\n \nif(shapeSwitch === 0)\n {\n ellipse(mouseX, mouseY, mouseY / 3)\n }\nif(shapeSwitch === 1)\n {\n triangle(mouseX, mouseX*2, mouseY*2, mouseX,mouseY * 2,mouseX / 2)\n }\nif(shapeSwitch === 2)\n {\n square(mouseX, mouseY, mouseY * 1.5);\n }\n\n let c = color(mouseX*2, mouseY/6, Math.floor(Math.random() * 777)) \n fill(c)\n}", "title": "" }, { "docid": "28f8ea33d70f93cb23ce993a105e8332", "score": "0.5801857", "text": "draw() {\n\t\tturtleRenderingContext.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);\n\n\t\tif (!this.hidden) {\n\t\t\tturtleRenderingContext.strokeStyle = '#FFFF00';\n\n\t\t\tturtleRenderingContext.beginPath();\n\t\t\tturtleRenderingContext.moveTo(this.position.x, this.position.y);\n\t\t\tturtleRenderingContext.arc(\n\t\t\t\tthis.position.x, this.position.y, 10,\n\t\t\t\tthis.angle.angle() + (Math.PI / 4),\n\t\t\t\tthis.angle.angle() + (7 * Math.PI / 4)\n\t\t\t);\n\t\t\tturtleRenderingContext.closePath();\n\t\t\tturtleRenderingContext.stroke();\n\t\t}\n\t}", "title": "" }, { "docid": "779498b9059efffa4d42972160a706d5", "score": "0.57932854", "text": "draw() {\n noStroke();\n fill(\"rgba(255, 255, 255, 0.8)\");\n circle(this.position.x, this.position.y, this.size);\n }", "title": "" }, { "docid": "7d70d6c8ceb7d589f7fdae0c3be228d0", "score": "0.57662314", "text": "function selectShape(){\n\tif(this === circle_select){\n\t\tcircle = new Circle(0,0);\n\t\tsquare = 0;\n\t\ttriangle = 0;\n\t\trectangle = 0;\n\t}\n\telse if(this === square_select){\n\t\tsquare = new Square(100,0);\n\t\tcircle = 0;\n\t\ttriangle = 0;\n\t\trectangle = 0;\n\t}\n\telse if(this === rectangle_select) {\n\t\trectangle = new Square(120,80);\n\t\tsquare = 0;\n\t\ttriangle = 0;\n\t\tcircle = 0;\n\t}\n\telse if(this === triangle_select) {\n\t\ttriangle = new Triangle(0,0);\n\t\tsquare = 0;\n\t\tcircle = 0;\n\t\trectangle = 0;\n\t}\n\telse if(this === pencil_select) {\n\t\tpencil = new Pencil(0,0);\n\t\tcircle = 0;\n\t\tsquare = 0;\n\t\ttriangle = 0;\n\t\trectangle = 0;\n\t}\n\telse if(this === erase_select){\n\t\tcontext.strokeStyle = 'white';\n\t\tcontext.lineWidth = 10;\n\t\terase = new Pencil(0,0);\n\t}\n\n\tif(this !== pencil_select) pencil = 0;\n\tif(this !== erase_select){\n\t\terase = 0;\n\t\tcontext.strokeStyle = prevLineColor;\n\t\tcontext.lineWidth = '2';\n\t}\n}", "title": "" }, { "docid": "1b418ae9f97501760e89944350e54cdf", "score": "0.5763995", "text": "function addshape(e) {\n e.preventDefault();\n if (e.target.value === \"circle\") { //CIRCLE\n let canvasDiv = document.getElementById(\"canvas\");\n //create new circle element\n let circle = document.createElement(\"div\");\n // circle.style.position = \"absolute\"; needed for drag\n circle.style.height = \"50px\";\n circle.style.width = \"50px\";\n circle.style.borderRadius = \"50px\"\n circle.style.backgroundColor = \"black\";\n circle.setAttribute(\"value\", \"circle\");\n //object template for circles\n let circleObj = {\n id: \"\",\n type: \"circle\",\n height: \"50px\",\n width: \"50px\",\n borderRadius: \"50px\",\n color: \"black\"\n }\n shapeArr.push(circleObj);\n //create unique id \n for (let i = 0; i < shapeArr.length; i++) {\n let newId = document.createAttribute(\"id\");\n newId.value = [i];\n circle.setAttributeNode(newId);\n circleObj.id = newId.value;\n }\n\n //create class\n let newClass = document.createAttribute(\"class\");\n newClass.value = \"shape\";\n circle.setAttributeNode(newClass);\n\n //append to canvas\n canvasDiv.appendChild(circle);\n\n // functions that come with circles\n circle.addEventListener(\"mouseenter\", highlightShape);\n circle.addEventListener(\"click\", clickShape);\n circle.addEventListener(\"mouseleave\", removeHighlight);\n\n\n } else { //RECTANGLE\n let canvasDiv = document.getElementById(\"canvas\");\n //create new rectangle element\n let rectangle = document.createElement(\"div\");\n rectangle.style.height = \"50px\";\n rectangle.style.width = \"100px\";\n rectangle.style.backgroundColor = \"white\";\n rectangle.setAttribute(\"value\", \"rectangle\");\n // template for rect object\n let rectObj = {\n id: \"\",\n type: \"rectangle\",\n height: \"50px\",\n width: \"100px\",\n color: \"white\",\n }\n shapeArr.push(rectObj);\n //create unique id \n for (let i = 0; i < shapeArr.length; i++) {\n let newId = document.createAttribute(\"id\");\n newId.value = [i];\n rectangle.setAttributeNode(newId);\n rectObj.id = newId.value;\n }\n //create class \n let newClass = document.createAttribute(\"class\");\n newClass.value = \"shape\";\n rectangle.setAttributeNode(newClass);\n\n //append to canvas\n canvasDiv.appendChild(rectangle);\n\n //functions for rectangles\n rectangle.addEventListener(\"mouseenter\", highlightShape);\n rectangle.addEventListener(\"click\", clickShape);\n rectangle.addEventListener(\"mouseleave\", removeHighlight);\n\n }\n // clickAndDrag();\n}", "title": "" }, { "docid": "a3d51f921fc2f04e5bfe61f9f2dbe031", "score": "0.57535857", "text": "draw() {\n // Draw all the previous paths saved to the history array\n if(this.drawHistory) {\n this.drawPreviousEdges();\n }\n\n // Draw bounds\n if(this.showBounds && this.bounds != undefined && this.bounds instanceof Bounds) {\n this.drawBounds();\n }\n\n // Set shape fill \n if(this.fillMode && this.isClosed) {\n this.p5.fill(this.currentFillColor.h, this.currentFillColor.s, this.currentFillColor.b, this.currentFillColor.a);\n } else {\n this.p5.noFill();\n }\n\n // Set stroke color\n this.p5.stroke(this.currentStrokeColor.h, this.currentStrokeColor.s, this.currentStrokeColor.b, this.currentStrokeColor.a);\n\n // Draw current edges\n this.drawCurrentEdges();\n\n // Draw all nodes\n if(this.drawNodes) {\n this.drawCurrentNodes();\n }\n }", "title": "" }, { "docid": "5c4e58c6de8399506799416dbe5f51ff", "score": "0.5744609", "text": "draw() {\n\t\t\t// erase the canvas\n\t\t\tthis.destroy_board();\n\t\t\t// redraw the contents\n\t\t\tthis.init_grid(); // grid, if show_grid is set\n\t\t\tthis.init_tray(); // tray, if pento_with_tray is set\n\t\t\tthis.draw_shapes(); // shapes present in pento_shapes\n\t\t}", "title": "" }, { "docid": "d720aa8363858bbed0111710034b50c7", "score": "0.5743789", "text": "function renderShape(shape) {\n var nj = shape.length;\n var ni = shape[0].length;\n for (var j = 0 ; j < nj-1 ; j++)\n for (var i = 0 ; i < ni-1 ; i++)\n drawCurve([ shape[j ][i ],\n shape[j + 1][i ],\n shape[j + 1][i + 1],\n shape[j ][i + 1] ]);\n}", "title": "" }, { "docid": "8bdee3706307f535bd13a70f3392c091", "score": "0.5742751", "text": "function draw() {\n background(bgColor);\n Shape.displayAllShapes();\n}", "title": "" }, { "docid": "fc92b552b99674a2766b7998d8e6d2b3", "score": "0.57419956", "text": "drawPath() {\n\t\tif (this.drawing) {\n\t\t\trenderingContext.beginPath();\n\t\t\trenderingContext.moveTo(this.previousPos.x, this.previousPos.y);\n\t\t\trenderingContext.lineTo(this.position.x, this.position.y);\n\t\t\trenderingContext.closePath();\n\t\t\trenderingContext.stroke();\n\t\t}\n\t}", "title": "" }, { "docid": "9d0dc395bfe9d2e598f4c4418d5d61df", "score": "0.5734709", "text": "function draw(shape, x, y, color, size) {\n var shape = svg3.append(\"path\")\n .attr(\"class\", \"point\")\n .attr(\"d\", d3.symbol().type(shape).size(size * 5))\n .attr(\"transform\", function(d){\n return \"translate(\" + xScale3(x) + \",\" + yScale3(y) + \")\"; })\n .attr('fill', color);\n return shape;\n }", "title": "" }, { "docid": "d690d06ebed55f297db3f51183b9a561", "score": "0.57292855", "text": "draw() {\r\n ctx.beginPath();\r\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2, false);\r\n ctx. fillStyle = '#fff';\r\n ctx.fill();\r\n }", "title": "" }, { "docid": "42371bcb9d1f829ec4574f754f37afd3", "score": "0.5717064", "text": "draw(){\n\t\tpush();\n\t\ttranslate(this.x, this.y);\n\t\trectMode(CORNER);\n\t\tfill(this.color);\n\t\trect(0, 0, this.w, this.h);\n\t\tpop();\n\t}", "title": "" }, { "docid": "b032b3a3b0ff3282f6f8f1eed1146225", "score": "0.57134795", "text": "draw(){\n if (this.canvas.getContext) {\n let ctx = this.canvas.getContext('2d');\n ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n let draw_polygon = (coords, color) => {\n ctx.fillStyle = color;\n ctx.beginPath();\n ctx.moveTo(coords[0], coords[1]);\n for(let i=2; i<coords.length; i+=2)\n ctx.lineTo(coords[i], coords[i+1]);\n ctx.fill();\n }\n\n if(this.polygon.length >= 6)\n draw_polygon(this.polygon, '#e6e6e6'); // polygon\n\n if(this.view_polygon.length >= 6)\n draw_polygon(this.view_polygon, this.vis_poly_color); // vis poly\n\n if(this.polygon.length >= 6){\n ctx.strokeStyle = \"#262626\"; // border\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(this.polygon[0], this.polygon[1]);\n for(let i=2; i<this.polygon.length; i+=2)\n ctx.lineTo(this.polygon[i], this.polygon[i+1]);\n ctx.stroke();\n }\n\n ctx.fillStyle='#663300';\n ctx.beginPath();\n ctx.arc(this.viewpoint_x, this.viewpoint_y, 5, 0, Math.PI*2, 0);\n ctx.fill();\n }\n }", "title": "" }, { "docid": "bf83abc9099c3278215c264565d73fa1", "score": "0.5711648", "text": "drawPolygon(rect, colorFill, colorStroke, lineWidth) {\n this.fillPolygon(rect, colorFill);\n this.strokePolygon(rect, colorStroke || colorFill, lineWidth);\n return this;\n }", "title": "" }, { "docid": "370946f5a6919a6afc48eb3fd1377380", "score": "0.5710521", "text": "draw() {\n this.context.beginPath();\n this.context.arc(this.x, this.y, this.size, 0, 2 * Math.PI, false)\n this.context.fillStyle = this.color\n this.context.fill()\n this.context.stroke()\n }", "title": "" }, { "docid": "21bd56236a599052fc60b6fb114102d3", "score": "0.56868815", "text": "function shape() {\n canvas.addEventListener(\"touchstart\", pattern2TouchStart);\n context.lineWidth = 0.5;\n }", "title": "" }, { "docid": "780f073b1680662f1be4c72d0f3ca3de", "score": "0.5663422", "text": "draw() {\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.fillStyle = this.color;\n\t\t\t\tctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI);\n\t\t\t\tctx.fill();\n\t\t\t}", "title": "" }, { "docid": "4f13a1dc2b494df61a733aabd565d502", "score": "0.5657618", "text": "draw(draw) {\n draw.self();\n }", "title": "" }, { "docid": "2e0edcd553dd0ff4eae2f898822bbaf2", "score": "0.5654526", "text": "addWholeShape(shape) {\n\t\tthis.addShape(shape.pos, shape.scale, shape.yaw, shape.type, shape.terminal, shape.iter);\n\t}", "title": "" }, { "docid": "2e8ea3d1768553999e774300969aee8f", "score": "0.56493014", "text": "activateShape(shape){\n for(var i=0; i<arguments.length; i++){\n var shape = arguments[i];\n var index = this.shapes.active.indexOf(shape);\n if(index==-1) this.shapes.active.push(shape);\n }\n return this;\n }", "title": "" }, { "docid": "22bf174febc168e22f32488c8701865c", "score": "0.5646213", "text": "function CShape()\r\n{\r\n\tthis.html = '';\r\n\tthis.tool = '';\r\n\tthis.objShape = null;\r\n\tthis.rect = null;\r\n\r\n\tthis.check = function()\r\n\t{\r\n\t\tif( this.tool == 'freehand' )\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif( this.rect.width() < 20 && this.rect.height() < 20 )\r\n\t\t{\r\n\t\t\tthis.objShape.style.visibility = 'hidden';\r\n\t\t\tthis.objShape.removeNode( true );\r\n\t\t}\r\n\t}\r\n\r\n\tthis.final = function()\r\n\t{\r\n\t\twith( this.objShape )\r\n\t\t{\r\n\t\t\tonmouseover = Main_MouseOver;\r\n\t\t\tonmouseout = Main_MouseOut;\r\n\t\t\tonmousedown = Shape_MouseDown;\r\n\t\t\tonmouseup = Shape_MouseUp;\r\n\t\t\tstyle.filter = 'alpha(opacity=70)';\r\n\t\t}\r\n\t}\r\n\r\n\tthis.create = function( shape )\r\n\t{\r\n\t\tvar vml = '';\r\n\t\twith( this.rect )\r\n\t\t{\r\n\t\t\tif( shape == 'arrow' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:line style=\"position:absolute\" id=\"_shape\" from=\"'+left+'px,'+top+'px\" to=\"'+(right+1)+'px,'+(bottom+1)+'px\" ';\r\n\t\t\t\tvml+= 'strokeweight=\"'+ strokeWeight+'px\" strokecolor=\"'+strokeColor+'\">';\r\n\t\t\t\tvml+= '<v:stroke endarrow=\"classic\" /></v:line>';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'line' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:line style=\"position:absolute\" id=\"_shape\" from=\"'+left+'px,'+top+'px\" to=\"'+(right+1)+'px,'+(bottom+1)+'px\" ';\r\n\t\t\t\tvml+= 'strokeweight=\"'+ strokeWeight+'px\" strokecolor=\"'+strokeColor+'\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'rect' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:rect id=\"_shape\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"'+filled+'\" fillcolor=\"'+fillColor+'\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'circle' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:oval id=\"_shape\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"'+filled+'\" fillcolor=\"'+fillColor+'\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'rrect' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:roundrect id=\"_shape\" arcsize=\"0.2\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"'+filled+'\" fillcolor=\"'+fillColor+'\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'right' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:shape id=\"_shape\" coordsize=\"3 2\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"f\" stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" path=\"m0,1 l1,2,3,0 e\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'wrong' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:shape id=\"_shape\" coordsize=\"3 3\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"f\" stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" path=\"m0,0 l3,3 m0,3 l3,0 e\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'quest' )\r\n\t\t\t{\r\n\t\t\t\tvml+= '<v:shape id=\"_shape\" coordsize=\"10 20\" style=\"position:absolute; top:'+top+'px; left:'+left+'px; width:'+width()+'px; height:'+height()+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"f\" stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" path=\"wr0,0,10,10,0,5,5,10 l5,13 m5,14 l5,16 e\" />';\r\n\t\t\t}\r\n\t\t\telse if( shape == 'freehand' )\r\n\t\t\t{\r\n\t\t\t\tw = mainWin.document.body.scrollWidth;\r\n\t\t\t\th = mainWin.document.body.scrollHeight;\r\n\r\n\t\t\t\tvml+= '<v:shape id=\"_shape\" coordsize=\"'+w+','+h+'\" style=\"position:absolute; top:0px; left:0px; width:'+w+'px; height:'+h+'px\" ';\r\n\t\t\t\tvml+= 'filled=\"f\" stroked=\"t\" strokecolor=\"'+strokeColor+'\" strokeweight=\"'+strokeWeight+'px\" path=\"m'+left+','+top+'l'+left+','+top+'e\" />';\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.html = vml;\r\n\t\tdelete vml;\r\n\t}\r\n\r\n\tthis.insert = function( obj )\r\n\t{\r\n\t\tobj.insertAdjacentHTML( \"BeforeEnd\", this.html );\t\t// insert HTML & get object control\r\n\t\tthis.objShape = obj.lastChild;\r\n\t\tif( this.objShape == null )\r\n\t\t{\r\n\t\t\talert( 'cannot get object' );\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tthis.adjust = function( x, y )\r\n\t{\r\n\t\tif( this.tool == 'line' || this.tool == 'arrow' )\r\n\t\t{\r\n\t\t\tthis.objShape.to = x + 'px,' + y + 'px';\r\n\t\t\twith( this.rect )\r\n\t\t\t{\r\n\t\t\t\tright = x;\r\n\t\t\t\tbottom = y;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if( this.tool == 'freehand' )\r\n\t\t{\r\n\t\t\tvar re = / *e/i;\r\n\t\t\tvar str = new String(this.objShape.path);\r\n\t\t\tthis.objShape.path = str.replace( re, ',' + x + ',' + y + 'e' );\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.rect.right = x;\r\n\t\t\tthis.rect.bottom = y;\r\n\t\t\twith( this.rect )\r\n\t\t\t\tvar r = new CRect( left, top, right, bottom );\r\n\r\n\t\t\twith( r )\r\n\t\t\t{\r\n\t\t\t\tnormalize();\r\n\t\t\t\tthis.objShape.style.top = top;\r\n\t\t\t\tthis.objShape.style.left = left;\r\n\t\t\t\tthis.objShape.style.width = width();\r\n\t\t\t\tthis.objShape.style.height = height();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "40758bffb654c23f66c8cf6705b18fb8", "score": "0.56436443", "text": "draw(){\n\t\tellipse(this.x, this.y, 2,2);\n\t}", "title": "" }, { "docid": "0d77e846bb04a3950b213c4dbddfa88a", "score": "0.5640317", "text": "function drawTheoreticalShapeOnClick(event){\r\n [theoreticalShape.x, theoreticalShape.y] = convertCanvasXYintoFileXY(mouseOnCanvas.canvasX, mouseOnCanvas.canvasY);\r\n theoreticalShape.onFirstDraw();\r\n drawShape(theoreticalShape)\r\n drawnScreenShapes.push(theoreticalShape);\r\n unselectAllTools();\r\n}", "title": "" }, { "docid": "ed62c32c73483c02ee24dd2db74b4eb6", "score": "0.5634884", "text": "draw() {\n c.beginPath();\n c.arc(this.x,this.y, this.radius, 0, (Math.PI*2), false);\n c.strokeStyle = this.borderColor;\n c.fillStyle = this.fillColor;\n c.stroke();\n c.fill();\n }", "title": "" }, { "docid": "21cf1581a7ac0ad2cbbe3dd9714ea04c", "score": "0.56230104", "text": "function drawObj(processing){\n\n\tprocessing.size( stage.width, stage.width );\n\tprocessing.smooth();\n\tprocessing.background(255,255,255,0);\n\tprocessing.stroke(220,220,220);\n\tprocessing.strokeWeight(lineWidth);\n\tprocessing.strokeCap(processing.SQUARE);\n\tprocessing.noFill();\n\tprocessing.noLoop();\n\n\tshapes = new MyShape(currentType, 0, 0, 0, 0);\n\n\tprocessing.draw = function (){\n\n\t\tsetProcessingStyle(processing);\n\n\t\tswitch(currentType){\n\t\t\tcase \"rect\":\n\t\t\t\tprocessing.rect(shapes.x,shapes.y,shapes.width,shapes.height);\n\t\t\t\tbreak;\n\t\t\tcase \"ellipse\":\n\t\t\t\tprocessing.ellipse(shapes.x+shapes.width/2,\n\t\t\t\t\t\t\t\t shapes.y+shapes.height/2,\n\t\t\t\t\t\t\t\t shapes.width,\n\t\t\t\t\t\t\t\t shapes.height);\n\t\t\t\tbreak;\n\t\t\tcase \"arrow\":\n\t\t\t\tdrawArrow(shapes.x,shapes.y,shapes.width,shapes.height,processing, \"gray\");\n\t\t\t\tbreak;\n\t\t\tcase \"brush\":\n\t\t\t\tdrawBrush(shapes.arrayX, shapes.arrayY,processing);\n\t\t\t\tbreak;\n\t\t\tcase \"dash\":\n\t\t\t\tdrawDash(shapes.x,shapes.y,shapes.width,shapes.height,processing);\n\t\t\t\tbreak;\n\t\t}\n\n\t}\n\tprocessing.mousePressed = function () {\n\n\t\tif(currentType == \"brush\"){\n\t\t\tshapes.arrayX[0] = processing.mouseX;\n\t\t\tshapes.arrayY[0] = processing.mouseY;\n\t\t}\n\n\t\tshapes.init(currentType, processing.mouseX, processing.mouseY);\n\t\n\t}\n\tprocessing.mouseDragged = function () {\n\n\t\tif(processing.mousePressed){\n\n\t\t\tif(currentType == \"brush\"){\n\t\t\t\tshapes.setArray(processing.mouseX, processing.mouseY);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tshapes.setWH(processing.mouseX, processing.mouseY);\n\t\t\t}\n\t\t\tprocessing.redraw();\n\t\t\t//shapes.display();\n\t\t}\n\t}\n\tprocessing.mouseReleased = function () {\n\n\t\tstage.getCurrent().exitDrawMode();\n\n\t\tif(currentType == \"brush\"){\n\t\t\tshapes.setArray(processing.mouseX, processing.mouseY);\n\t\t}\n\t\telse{\n\t\t\tshapes.setWH(processing.mouseX, processing.mouseY);\n\t\t}\n\n\t\tif(currentType == \"brush\")\n\t\t\tshapes.reDisplay();\n\t\telse if(currentType == \"rect\" || currentType == \"ellipse\")\n\t\t\tshapes.reDisplayBox();\n\t\t\n\t\tisDrawing = false;\n\n\t\t// popup a draw object\n\t\tif(shapes.width!=0){\n\t\t\tvar $html = createDrawObject(shapeNum[stage.currentSlide],shapes);\n\t\t\t//stage.getCurrent().$el.append($html);\n\t\t\t$html.insertBefore(stage.getCurrent().$el.find(\"canvas.drawCanvas\"));\n\t\t}\n\t\telse{\n\n\t\t}\n\n\t\t$('.toolbar ul li').removeClass(\"active\");\n\t\tstage.getCurrent().exitDrawMode();\n\n\t\tshapeNum[stage.currentSlide] ++;\n\t}\n\n}", "title": "" }, { "docid": "121621c6fb5b16986a9092b96f113e88", "score": "0.56130403", "text": "function deleteShape() {\n if (selectedShape) board.removeChild(selectedShape);\n }", "title": "" }, { "docid": "fa44f69dfbb6a768d8b5cf1c35be40bb", "score": "0.56058145", "text": "function SuperShape(_shapeID, _owner, _shapeConfig, _layerRadius, _layerPaint, _layerInk, _thick) {\n\tthis.shapeID = _shapeID;\n\tthis.shapeOwner = _owner;\n\tthis.shapeConfig = _shapeConfig;\n\tthis.radius = _layerRadius;\n\tthis.layerPaint = _layerPaint;\n\tthis.layerInk = _layerInk;\n\tthis.layerWeight = _thick;\n\tthis.m = this.shapeConfig[0];\n\tthis.n1 = this.shapeConfig[1];\n\tthis.n2 = this.shapeConfig[2];\n\tthis.n3 = this.shapeConfig[3];\n\tthis.c = this.shapeConfig[4];\n\tthis.a = this.shapeConfig[5];\n\tthis.b = this.shapeConfig[6];\n\t\n\tthis.showShape = function() {\n\t\t// NO LONGER just a dummy function\n\t var inc = TWO_PI / qtyPoints;\n\t\t\n\t\t// build our custom shape\n\t\t// start with buildshape(),\n\t\t// end with endShape(CLOSE).\n\t\t// the CLOSE automatically\n\t\t// connects the start with the\n\t\t// end of the line.\n\t\tbeginShape();\n\t\tfor (var angle = 0; angle < (TWO_PI * this.c); angle = angle + inc) {\n\t var r = this.plotSuperShape(angle);\n\t var x = (r * cos(angle)) * this.radius;\n\t var y = (r * sin(angle)) * this.radius;\n\t vertex(x, y);\n\t\t}\n\t\tendShape(CLOSE);\t\t\n\t}\n\t\n\tthis.plotSuperShape = function(theta) {\n var p1 = (1.0 / this.a) * cos(theta * this.m * 0.25);\n p1 = pow(abs(p1), this.n2);\n var p2 = (1.0 / this.b) * sin(theta * this.m * 0.25);\n p2 = pow(abs(p2), this.n3);\n var p3 = pow(p1 + p2, 1.0 / this.n1);\n return (1.0 / p3);\n\t}\n}", "title": "" }, { "docid": "79cc6c48ccf5dc9c450373ba82a74109", "score": "0.5604277", "text": "draw() {\r\n ctx.beginPath();\r\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2, false);\r\n ctx.fillStyle = this.color;\r\n ctx.fill();\r\n }", "title": "" }, { "docid": "9ed14bf0ae29d10fdcd4476f96c6039b", "score": "0.5591957", "text": "function createShape(img, pos) {\n\tvar s = new Kinetic.Image({\n\t\tx: pos.x,\n\t\ty: pos.y,\n\t\timage: img,\n\t\tscale:pos.scale,\n\t\tdraggable: true,\n\t\toffset: [img.width / 2, img.height / 2]\n\t});\n\ts.on(\"touchstart\", function(e) {\n\t\tconsole.log(this);\n\t\tselectedElement = this;\n\t\tdeSelect(this.parent);\n\t});\n\ts.on(\"touchend\", function(e) {\n\t\tthis.enableStroke();\n\t\tthis.setStroke(\"red\");\n\t\tstage.draw();\n\t});\n\ts.on(\"dragmove\", function(e){\n\t\tif(recording){\n\t\t\trecMovement.push({\n\t\t\t\tid: this._id,\n\t\t\t\tx: this.getX(),\n\t\t\t\ty: this.getY(),\n\t\t\t\trot: this.getRotationDeg()\n\t\t\t});\n\t\t\tconsole.log(recMovement);\t\t\t\n\t\t}\n\t});\n\treturn s;\n}", "title": "" }, { "docid": "bafbe780fe453b304d61d4d33d92550f", "score": "0.55916065", "text": "draw(draw) { draw.self(); }", "title": "" }, { "docid": "6cc5ada513db3d2c3d286ed3fa4d527a", "score": "0.5589083", "text": "draw(){\r\n\t\tctx.beginPath();\r\n\t\tctx.arc(this.x,this.y,this.size,0,Math.PI*2,false);\r\n\t\tctx.fillStyle = this.color;\r\n\t\tctx.strokeStyle = '#333';\r\n\t\tctx.fill();\r\n\t\tctx.stroke();\r\n\t}", "title": "" }, { "docid": "4b11e3771212549ebef044533cc18143", "score": "0.5571908", "text": "draw() {\n if (this.drawn_) {\n this.redraw_();\n return;\n }\n\n const canvas = this.canvas_;\n if (!canvas) {\n // onAdd has not been called yet.\n return;\n }\n\n const ctx = canvas.getContext('2d');\n const height = ctx.canvas.height;\n const width = ctx.canvas.width;\n this.width_ = width;\n this.height_ = height;\n\n if (!this.redraw_()) {\n return;\n }\n\n this.drawn_ = true;\n }", "title": "" }, { "docid": "e9cd302de68d2b40595da562becfa62e", "score": "0.5567594", "text": "_draw() {\n super._draw();\n var p = this._props;\n\n var radiusX = (p.radiusX != null) ? p.radiusX : p.radius;\n var radiusY = (p.radiusY != null) ? p.radiusY : p.radius;\n\n var isRadiusX = radiusX === this._prevRadiusX;\n var isRadiusY = radiusY === this._prevRadiusY;\n var isPoints = p.points === this._prevPoints;\n\n // skip if nothing changed\n if (isRadiusX && isRadiusY && isPoints) { return; }\n\n var x = p.width / 2;\n var y = p.height / 2;\n var x1 = x - radiusX;\n var x2 = x + radiusX;\n\n var d = `M${x1} ${y} Q ${x} ${y - 2 * radiusY} ${x2} ${y}`;\n\n // set the `d` attribute and save it to `_prevD`\n this.el.setAttribute('d', d);\n\n // save the properties\n this._prevPoints = p.points;\n this._prevRadiusX = radiusX;\n this._prevRadiusY = radiusY;\n }", "title": "" }, { "docid": "212abd755125ffdee684c1c7839b57a3", "score": "0.5538158", "text": "drawWith (plotId, svg) {}", "title": "" }, { "docid": "61228d1f66d2cb34982c4e937465e783", "score": "0.55304444", "text": "function newShape($drawViewDiv,shapeType,_id,_pos,_size)\n { \n var scale = parseFloat($drawViewDiv.data( 'orgscale' ) );\n \n //exception handle\n if( typeof _pos.left === 'undefined' \n || typeof _pos.top === 'undefined' \n || typeof _size.width === 'undefined' \n || typeof _size.height === 'undefined' )//why no any pos or size,how to display\n return;\n \n //Currently, On display, inframe and outframe is same level. inframe is not put in outframe. \n if(shapeType===\"outframe\"){\n \n var newOutFrameDiv = $(OutFrameDivHTML);\n\n $drawViewDiv.append(newOutFrameDiv);\n if(_id){\n newOutFrameDiv.attr('id', _id);\n }\n if(_pos){\n newOutFrameDiv.css({ left: _pos.left*scale , top: _pos.top*scale });\n newOutFrameDiv.data({ orgleft: _pos.left, orgtop: _pos.top });\n }\n if(_size){\n newOutFrameDiv.css({ width:_size.width*scale,height:_size.height*scale});\n newOutFrameDiv.data({ orgwidth: _size.width, orgheight: _size.height });\n }\n return true;\n }else if(shapeType===\"inframe\"){\n var newInFrameDiv = $(InFrameDivHTML);\n $drawViewDiv.append(newInFrameDiv);\n if(_id){\n $(newInFrameDiv).attr('id', _id);\n }\n if(_pos){\n $(newInFrameDiv).css({ left: _pos.left*scale , top: _pos.top*scale });\n $(newInFrameDiv).data({ orgleft: _pos.left, orgtop: _pos.top });\n }\n if(_size){\n $(newInFrameDiv).css({width:_size.width*scale,height:_size.height*scale});\n $(newInFrameDiv).data({ orgwidth: _size.width, orgheight: _size.height });\n }\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "c366b4564dcf1ddb14a0ff0cd9348d57", "score": "0.55257505", "text": "shape(x ,y) {\n this._context.beginPath()\n this._context.arc(x, y, this._radius, 0, 2 * Math.PI, false)\n this._context.fillStyle = this._color\n this._context.fill()\n }", "title": "" }, { "docid": "7a8be088bdedcc9cd1ebb093d4496c50", "score": "0.55241054", "text": "draw() {\n const ctx = this.checkContext();\n this.setRendered();\n\n ctx.save();\n ctx.setStrokeStyle(this.render_options.color);\n ctx.setFillStyle(this.render_options.color);\n ctx.setFont(this.font.family, this.font.size, this.font.weight);\n\n L('Rendering Pedal Marking');\n\n if (this.style === PedalMarking.Styles.BRACKET || this.style === PedalMarking.Styles.MIXED || this.style === PedalMarking.Styles.MIXED_OPEN_END ||\n this.style === PedalMarking.Styles.BRACKET_OPEN_BEGIN || this.style === PedalMarking.Styles.BRACKET_OPEN_END || this.style === PedalMarking.Styles.BRACKET_OPEN_BOTH) {\n ctx.setLineWidth(this.render_options.bracket_line_width);\n this.drawBracketed();\n } else if (this.style === PedalMarking.Styles.TEXT) {\n this.drawText();\n }\n\n ctx.restore();\n }", "title": "" }, { "docid": "bcea8ac800d69e2334a5d6525f2029c7", "score": "0.5520412", "text": "draw() {\n ctx.beginPath();\n ctx.arc(this.loc.x, this.loc.y, this.radius, 0, Math.PI * 2);\n ctx.fillStyle = this.fill;\n ctx.fill();\n ctx.closePath();\n }", "title": "" }, { "docid": "24b6e17d4292646f219bdb833d3eb35e", "score": "0.55077463", "text": "draw(){\n push();\n noFill();\n noStroke();\n rect(this.x,this.y,this.width,this.height);\n pop();\n }", "title": "" }, { "docid": "24b6e17d4292646f219bdb833d3eb35e", "score": "0.55077463", "text": "draw(){\n push();\n noFill();\n noStroke();\n rect(this.x,this.y,this.width,this.height);\n pop();\n }", "title": "" }, { "docid": "75157bef80ce160cc40bd874f15db9b9", "score": "0.5500474", "text": "display(){\n if(this.isclicked){\n fill(66, 244, 155);\n }else{\n fill(this.shade);\n }\n if(this.over){\n fill(255, 199, 225);\n }\n ellipse(this.x, this.y, this.w, this.h);\n }", "title": "" }, { "docid": "9063f37dbac62e63cdf65b438210ce3f", "score": "0.54904443", "text": "draw(graphic) {\n graphic.drawCircle (this.x, this.y, this.r);\n }", "title": "" }, { "docid": "bfc91e1595cf41667a90e5dd3a451e55", "score": "0.54817927", "text": "draw() {\n ctx.beginPath();\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2, false);\n ctx.fillStyle = \"rgba(60,64,198,.2)\";\n ctx.fill();\n }", "title": "" }, { "docid": "5bde620c44c36fee64ece33527c4933a", "score": "0.54641134", "text": "draw() \n\t{\n\t\tctx.beginPath();\n\t\tctx.arc(this.x, this.y, this.size, 0, Math.PI * 2, false);\n\t\tctx.fillStyle = '#FFFFFF';\n\t\tctx.fill();\n\t}", "title": "" }, { "docid": "13f19828f86770c9e01873edd819fa90", "score": "0.54640913", "text": "function draw() {\r\n if (canvasValid == false) {\r\n clear(ctx);\r\n\r\n // Add stuff you want drawn in the background all the time here\r\n if (image != null) {\r\n ctx.drawImage(image, 0, 0);\r\n }\r\n\r\n // draw all motor.zuordnungen()\r\n var l = motor.zuordnungen().length;\r\n for (var i = 0; i < l; i++) {\r\n drawshape(ctx, motor.zuordnungen()[i]);\r\n ctx.font = textFont;\r\n ctx.fillStyle = textColor;\r\n ctx.fillText(motor.zuordnungen()[i].baugruppe() + motor.zuordnungen()[i].einzelteil(), motor.zuordnungen()[i].x(), motor.zuordnungen()[i].y()-2);\r\n }\r\n\r\n // draw selection\r\n // right now this is just a stroke along the edge of the selected box\r\n if (motor.selectedZuordnung() != null) {\r\n ctx.strokeStyle = mySelColor;\r\n ctx.lineWidth = mySelWidth;\r\n ctx.strokeRect(motor.selectedZuordnung().x(), \r\n motor.selectedZuordnung().y(), \r\n motor.selectedZuordnung().width(), \r\n motor.selectedZuordnung().height());\r\n }\r\n\r\n // Add stuff you want drawn on top all the time here\r\n\r\n\r\n canvasValid = true;\r\n }\r\n}", "title": "" }, { "docid": "dba8b01a8928f13ff6041a29a5a97ef6", "score": "0.54532653", "text": "draw(canvasContext) {\n if (!this.isActive()) {\n return;\n }\n canvasContext.beginPath();\n canvasContext.arc(this.point.x, this.point.y, this.radius, 0, 2 * Math.PI, false);\n canvasContext.fillStyle = this.color;\n canvasContext.fill();\n }", "title": "" }, { "docid": "070c6c89a589005bca1c47b4921a422c", "score": "0.5446505", "text": "draw() {\r\n push(); //inicia uma nova rotina de desenho\r\n stroke(255); //define o contorno com a cor branco\r\n noFill(); //define que o que for desenhado nao será preenchido\r\n translate(this.posicao.x, this.posicao.y); //muda o centro de cordenadas da tela para a atual posição do inimigo\r\n //ellipse(this.posicao.x, this.posicao.y, this.r*2, this.r*2);\r\n beginShape(); //começa a desenhar uma forma\r\n for (var i = 0; i < this.total; i++) {\r\n var angle = map(i, 0, this.total, 0, TWO_PI); //é gerado um numero entre proporcional de 0 a 2pi a depender do ponto\r\n var r = this.r + this.offset[i]; //um novo raio é definido a partir do atual somado com o offset\r\n //é definido o novo vertice da forma usando coordenadas polares\r\n var x = r * cos(angle);\r\n var y = r * sin(angle);\r\n vertex(x, y);\r\n }\r\n endShape(CLOSE); //encherra o desenho da forma\r\n pop(); //encerra a nova rotina de desenho a retorna a padrão\r\n }", "title": "" }, { "docid": "9c2010bdde73cadf49fb5837a3b944f0", "score": "0.5439831", "text": "draw(){\n var grabbedPoint = this._pointCollection.getPoint( this._pointSelectIndex );\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._fillBackground();\n this._drawGrid();\n this._drawData();\n\n if(grabbedPoint) {\n this._drawCoordinates(\n grabbedPoint\n );\n }\n }", "title": "" }, { "docid": "7942ba33f09c65cf745ec6a5b97013d0", "score": "0.5434536", "text": "startPoly() {\n if (this.currentPath) {\n const points = this.currentPath.points, len = this.currentPath.points.length;\n len > 2 && (this.drawShape(this.currentPath), this.currentPath = new Polygon(), this.currentPath.closeStroke = !1, this.currentPath.points.push(points[len - 2], points[len - 1]));\n } else\n this.currentPath = new Polygon(), this.currentPath.closeStroke = !1;\n }", "title": "" }, { "docid": "8b35b5f5096449e91ea28ff6e568a065", "score": "0.5422722", "text": "beginPath() {\n this.getContext().beginPath();\n }", "title": "" }, { "docid": "1cf8d1f93539d6b371e48cb02fdca22e", "score": "0.54202557", "text": "display(){\n\n fill('red');\n ellipse(this.position.x, this.position.y, this.size);\n }", "title": "" }, { "docid": "db003fca57d0dd114360195587f92854", "score": "0.5419089", "text": "draw() {\n const ctx = simulationArea.context;\n this.checkHover();\n\n\n if (this.x * this.scope.scale + this.scope.ox < -this.rightDimensionX * this.scope.scale - 0 || this.x * this.scope.scale + this.scope.ox > width + this.leftDimensionX * this.scope.scale + 0 || this.y * this.scope.scale + this.scope.oy < -this.downDimensionY * this.scope.scale - 0 || this.y * this.scope.scale + this.scope.oy > height + 0 + this.upDimensionY * this.scope.scale) return;\n\n // Draws rectangle and highlights\n if (this.rectangleObject) {\n ctx.strokeStyle = 'black';\n ctx.fillStyle = 'white';\n ctx.lineWidth = correctWidth(3);\n ctx.beginPath();\n rect2(ctx, -this.leftDimensionX, -this.upDimensionY, this.leftDimensionX + this.rightDimensionX, this.upDimensionY + this.downDimensionY, this.x, this.y, [this.direction, 'RIGHT'][+this.directionFixed]);\n if ((this.hover && !simulationArea.shiftDown) || simulationArea.lastSelected === this || simulationArea.multipleObjectSelections.contains(this)) ctx.fillStyle = 'rgba(255, 255, 32,0.8)';\n ctx.fill();\n ctx.stroke();\n }\n if (this.label !== '') {\n let rX = this.rightDimensionX;\n let lX = this.leftDimensionX;\n let uY = this.upDimensionY;\n let dY = this.downDimensionY;\n if (!this.directionFixed) {\n if (this.direction === 'LEFT') {\n lX = this.rightDimensionX;\n rX = this.leftDimensionX;\n } else if (this.direction === 'DOWN') {\n lX = this.downDimensionY;\n rX = this.upDimensionY;\n uY = this.leftDimensionX;\n dY = this.rightDimensionX;\n } else if (this.direction === 'UP') {\n lX = this.downDimensionY;\n rX = this.upDimensionY;\n dY = this.leftDimensionX;\n uY = this.rightDimensionX;\n }\n }\n\n if (this.labelDirection === 'LEFT') {\n ctx.beginPath();\n ctx.textAlign = 'right';\n ctx.fillStyle = 'black';\n fillText(ctx, this.label, this.x - lX - 10, this.y + 5, 14);\n ctx.fill();\n } else if (this.labelDirection === 'RIGHT') {\n ctx.beginPath();\n ctx.textAlign = 'left';\n ctx.fillStyle = 'black';\n fillText(ctx, this.label, this.x + rX + 10, this.y + 5, 14);\n ctx.fill();\n } else if (this.labelDirection === 'UP') {\n ctx.beginPath();\n ctx.textAlign = 'center';\n ctx.fillStyle = 'black';\n fillText(ctx, this.label, this.x, this.y + 5 - uY - 10, 14);\n ctx.fill();\n } else if (this.labelDirection === 'DOWN') {\n ctx.beginPath();\n ctx.textAlign = 'center';\n ctx.fillStyle = 'black';\n fillText(ctx, this.label, this.x, this.y + 5 + dY + 10, 14);\n ctx.fill();\n }\n }\n\n // calls the custom circuit design\n if (this.customDraw) { this.customDraw(); }\n\n // draws nodes - Moved to renderCanvas\n // for (let i = 0; i < this.nodeList.length; i++)\n // this.nodeList[i].draw();\n }", "title": "" }, { "docid": "c25cee1c803f1b8794d45b32ed8683c4", "score": "0.54122263", "text": "function draw() {\n current.forEach(index => {\n squares[currentPosition + index].classList.add('shape')\n squares[currentPosition + index].style.backgroundColor = colors[randomShape]\n })\n }", "title": "" }, { "docid": "0b9ead1de5a6a0a0b19bc2573e59fecf", "score": "0.54119176", "text": "draw(drawing) { }", "title": "" }, { "docid": "748f9286a9b4a1bb09b6b2ecec5c8b23", "score": "0.540176", "text": "addShape(shape) {\n this.shapes.push(shape);\n }", "title": "" }, { "docid": "eaa11ee3e5a5abaefd2cac11ccbfb009", "score": "0.539673", "text": "render() {\n // render `commonShape` only once\n if (\n this._commonShapeConfiguration !== null &&\n this._$itemCommonShapeMap.size === 0\n ) {\n const { ctor, accessors, options } = this._commonShapeConfiguration;\n const $group = document.createElementNS(ns, 'g');\n const shape = new ctor(options);\n\n shape.install(accessors);\n $group.appendChild(shape.render());\n $group.classList.add('item', 'common', shape.getClassName());\n\n this._$itemCommonShapeMap.set($group, shape);\n this.$offset.appendChild($group);\n }\n\n // append elements all at once\n const fragment = document.createDocumentFragment();\n const values = this._$itemDataMap.values(); // iterator\n\n // enter\n this.data.forEach((datum) => {\n for (let value of values) { if (value === datum) { return; } }\n\n const { ctor, accessors, options } = this._shapeConfiguration;\n const shape = new ctor(options);\n shape.install(accessors);\n\n const $el = shape.render(this._renderingContext);\n $el.classList.add('item', shape.getClassName());\n\n this._$itemShapeMap.set($el, shape);\n this._$itemDataMap.set($el, datum);\n\n fragment.appendChild($el);\n });\n\n this.$offset.appendChild(fragment);\n\n // remove\n for (let [$item, datum] of this._$itemDataMap.entries()) {\n if (this.data.indexOf(datum) !== -1) { continue; }\n\n const shape = this._$itemShapeMap.get($item);\n\n this.$offset.removeChild($item);\n shape.destroy();\n // a removed item cannot be selected\n if (this._behavior) {\n this._behavior.unselect($item, datum);\n }\n\n this._$itemDataMap.delete($item);\n this._$itemShapeMap.delete($item);\n }\n }", "title": "" }, { "docid": "883bd2898a7da4e3c07398bf6a17d2a6", "score": "0.5393352", "text": "finishPoly() {\n this.currentPath && (this.currentPath.points.length > 2 ? (this.drawShape(this.currentPath), this.currentPath = null) : this.currentPath.points.length = 0);\n }", "title": "" }, { "docid": "8ab2256ce350eb726a971a4b78d0e900", "score": "0.53925294", "text": "function drawShape(x, y, containerWidth, containerHeight) {\n drawCtx.save();\n\n let shapeObj = shapeObjects[audioOptions.shape];\n\n drawCtx.translate(x, y);\n const margin = {x: containerWidth * .2, y: containerHeight * .2};\n let shapeScale = scaleToFit(\n containerWidth - margin.x, containerHeight - margin.y,\n shapeObj.width, shapeObj.height \n );\n drawCtx.scale(shapeScale, shapeScale);\n audio.analyser.getByteFrequencyData(audio.byteFreqData);\n\n shapeGrad = drawCtx.createLinearGradient(-shapeObj.width/2, -shapeObj.height/2, shapeObj.width, shapeObj.height);\n shapeGrad.addColorStop(0, \"red\");\n shapeGrad.addColorStop(0.35, \"black\");\n\n let fill = audioOptions.gradient ? shapeGrad : \"black\"\n shapeObjects[audioOptions.shape].render(drawCtx, audio.byteFreqData, \"#2e2e30\", fill);\n drawCtx.restore();\n }", "title": "" }, { "docid": "1ba9b206a81842518f5c6c8e197623af", "score": "0.53908694", "text": "drawDot() {\n this.ctx.beginPath();\n this.ctx.arc(\n this.currX,\n this.currY,\n this.size / 2,\n 0,\n 2 * Math.PI,\n false\n );\n this.ctx.fillStyle = this.mode === 'draw' ? this.color : '#ffffff';\n this.ctx.fill();\n this.ctx.closePath();\n }", "title": "" }, { "docid": "f93b2ae2207c21490a2c5e81213674be", "score": "0.5390229", "text": "removeShape(shape) {\n const index = this.shapes.indexOf(shape);\n\n if (index === -1) {\n console.warn('Shape does not belong to the body');\n return this;\n }\n\n this.shapes.splice(index, 1);\n this.shapeOffsets.splice(index, 1);\n this.shapeOrientations.splice(index, 1);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = null;\n return this;\n }", "title": "" }, { "docid": "4ffd7feb428e540a13aa6f6c6afe7717", "score": "0.5384545", "text": "draw() {\n if (this.state === CONSTANTS.EMPTY) {\n canvas.cell(this.x, this.y, this.isWin, this.hover);\n \n } else if (this.state === CONSTANTS.CROSS) {\n canvas.cross(this.x, this.y, this.isWin, this.hover);\n \n } else if (this.state === CONSTANTS.CIRCLE) {\n canvas.circle(this.x, this.y, this.isWin, this.hover);\n }\n }", "title": "" }, { "docid": "8e0c304d5ca939087aad76643a55cd6c", "score": "0.5382902", "text": "drawState() {\n const drawSide = (side) => {\n if (side.lineX) {\n this.drawLine(side.lineX, false, side.point);\n }\n if (side.point) {\n this.drawPoint(side.point.x, side.point.y, false, side.line);\n }\n };\n\n this.ctx.clearRect(0, 0, this.rect.width + 20, this.rect.height + 20);\n this.drawPath();\n drawSide(this.data.left);\n drawSide(this.data.right);\n }", "title": "" }, { "docid": "1cd3ae345c95204be7e73766637814c0", "score": "0.5381143", "text": "drawBall(){\n \tstroke(0);\n strokeWeight(1);\n \tfill(232,24,21);\n\t\t ellipse(this.x,this.y,10,10);\n line(this.x,this.y-5,this.x-3,this.y-7);\n ellipse(this.x-3,this.y-10,5,3);\n\t}", "title": "" }, { "docid": "7858a30b59e889005e041a93802aa641", "score": "0.537603", "text": "addShape(shape) {\n //console.log(\"addShape: Start\");\n // Top row of shape aligns with top row of Grid\n // Mid point of shape aligns with mid point of Grid\n this.shape = shape;\n this.shape.left = Math.round((this.columns - shape.width) / 2.0);\n this.shape.top = 0;\n\n //console.log(\"addShape: End\");\n return this.moveShape(0, 0, true);\n }", "title": "" } ]
b2027380b7b19842e905e44e8ec5f4c8
CLICK TO MOVE WORD FROM NON SELECTED TO SELECTED
[ { "docid": "c3e823bf2940e44d1c64cf97cde1ef15", "score": "0.0", "text": "function moveWord(elem) {\n var word = $(this).text();\n $(this).detach().appendTo('#answerListBox .bestWords');\n var index = currentWords.findIndex(function (w) {\n return w.word == word;\n });\n bestWords.push(currentWords[index]);\n currentWords.splice(index, 1);\n\n console.log(currentWords);\n console.log(bestWords);\n\n}", "title": "" } ]
[ { "docid": "54077678ad59d5016602ade01435e024", "score": "0.66432625", "text": "function onWordMouseDown(event)\n{\n\tvar wordUI = event.currentTarget;\n\twordUI.parent.setChildIndex(wordUI, wordUI.parent.getNumChildren() - 1);\n\twordUI._currentLocalX = event.localX;\n\twordUI._currentLocalY = event.localY;\n\twordUI.initialPosition = {x:wordUI.x, y:wordUI.y};\n\n}", "title": "" }, { "docid": "6af470646c6dcb041b4bf7b8bb5ca4cf", "score": "0.66112536", "text": "function moveSelection(dx, dy) {\n sClickBox.updatePosition(sClickBox.x + dx, sClickBox.y + dy);\n for (let i = 0; i < selection[selection.length - 1]; i++) {\n selection[i].alterPosition(dx, dy);\n }\n}", "title": "" }, { "docid": "f99d189fb10f21374dddbf2f3fda4e2d", "score": "0.6522792", "text": "function moveTo(){\n\tdeselect();\n\tthis.appendChild(selected[2]);\n\tsetKings(this);\n\tturn ++;\n}", "title": "" }, { "docid": "ca34e46c7aff1c776ebae6cfb4522de6", "score": "0.64355594", "text": "set doubleClickSelectsWord(value) {}", "title": "" }, { "docid": "3b3454fd82b6fe4ae58f5c69338a4525", "score": "0.6376507", "text": "handleDocumentClick() {\n this.onNextFrame(() => {\n this.props.moveSelection(...this.getCaretPos());\n });\n }", "title": "" }, { "docid": "8e89b8e2df31015ec2c162675d68853b", "score": "0.6351968", "text": "onUpKey() {\n this.moveselected(-1)\n }", "title": "" }, { "docid": "28a1255bc168256aaecbe2d0a4c95a0a", "score": "0.6244743", "text": "select(index, direction)\r\n {\r\n //...But first, clear the current selection.\r\n this.clearSelection()\r\n\r\n //Update selectedIndex\r\n this.selectedIndex = index;\r\n\r\n //Transform this index into x and y coordinates\r\n let x = index%this.width;\r\n let y = Math.floor(index/this.width);\r\n\r\n //Find the word that's selected; we'll need to display its clue, and know which one is next/previous\r\n //Filter the only possible word from the wordList:\r\n this.selectedWord = this.words.filter(function(w){\r\n if(w.direction != direction) return false; //Exclude a word that's in the wrong direction\r\n if(direction) // Across\r\n {\r\n if(w.y != y) return false; //Exclude any word that's on another row\r\n if(w.x > x) return false; //Exclude any word that starts after the selected cell\r\n if(w.x + w.answer.length-1 < x) return false; //Exclude any word that ends before the selected cell\r\n return true;\r\n } else // Down\r\n {\r\n if(w.x != x) return false; //Exclude any word that's on another column\r\n if(w.y > y) return false; //Exclude any word that starts after the selected cell\r\n if(w.y + w.answer.length-1 < y) return false; //Exclude any word that ends before the selected cell\r\n return true;\r\n }\r\n })[0];\r\n\r\n //Select all the cells in that word\r\n this.cellsInWord(this.selectedWord).forEach(c => c.wordSelected = true);\r\n //Of course, select the cell at the given index\r\n this.cells[index].selected = true;\r\n\r\n //Does the clue for this word reference another word in the grid?\r\n let referenceRE = new RegExp('([0-9]+)-(?=.*?(Across|Down))', 'gmi');\r\n let match;\r\n while(match = referenceRE.exec(this.selectedWord.clue))\r\n {\r\n let referenceDirection = match[2] == \"Across\";\r\n let test = this.cellsInWord(this.words.find(w=>w.number == match[1] && w.direction == referenceDirection));\r\n test.forEach(c => c.referenced = true);\r\n console.log(test);\r\n }\r\n }", "title": "" }, { "docid": "54ec73eaaed7cb77d32ae56f0ef7d6d4", "score": "0.62056446", "text": "function moveSelectionForward(editorState,maxDistance){var focusOffset,selection=editorState.getSelection(),key=selection.getStartKey(),offset=selection.getStartOffset(),content=editorState.getCurrentContent(),focusKey=key;return maxDistance>content.getBlockForKey(key).getText().length-offset?(focusKey=content.getKeyAfter(key),focusOffset=0):focusOffset=offset+maxDistance,selection.merge({focusKey:focusKey,focusOffset:focusOffset});}", "title": "" }, { "docid": "462bbe0afedcf639d3679e116f47ba31", "score": "0.61991", "text": "function click_word(event) {\n var $clicked = $(this); \n var $sentence = $clicked.closest('.sentence');\n var idx = $clicked.data('nr');\n var lang = $sentence.prop('id');\n var direction = $sentence.prop('dir');\n\n var all_menus = DATA[lang].menus;\n var is_insertion = $clicked.hasClass('space');\n var entry = next_menu(all_menus, idx, is_insertion);\n if (!entry) {\n $('.overlay').hide();\n return\n }\n var [selection, menu] = entry;\n console.log(`Selection ${strsel(selection)}: ${menu.length} menu items`);\n\n $clicked.addClass('selected');\n mark_selected_words($sentence, selection);\n\n if (DEBUG) console.log(\"CLICK\", idx, lang, direction);\n var $popup = $('#menu');\n for (var i = 0; i < menu.length; i++) {\n var [sel, lin, original] = menu[i];\n var $menuitem = $('<li>')\n .prop({dir: direction})\n .addClass('menuitem clickable')\n .click({lin:original, lang:lang}, update_sentences_and_menus)\n .appendTo($popup);\n build_lin($menuitem, lin);\n var newsel = remove_insertions_from_selection(sel);\n mark_selected_words($menuitem, newsel);\n\n // TODO: the threshold should be configurable\n var threshold = 2;\n $menuitem.children().addClass('irrelevant');\n $menuitem.children('.selected').each(function() {\n $(this).removeClass('irrelevant');\n $(this)\n .prevAll()\n .slice(0, threshold)\n .removeClass('irrelevant');\n $(this)\n .nextAll()\n .slice(0, threshold)\n .removeClass('irrelevant');\n });\n }\n popup_menu($clicked, $popup);\n}", "title": "" }, { "docid": "2c75a84af8e3832c1ae4f3d205b2db42", "score": "0.61778766", "text": "get doubleClickSelectsWord() {}", "title": "" }, { "docid": "40ed9b3301baa6eeb6963883a8fb9f9e", "score": "0.6164803", "text": "function moveSelection(keyCode) {\n // Determine the next index based on UP_KEY or DOWN_KEY\n const mod = keyCode === UP_KEY ? -1 : 1;\n let nextIndex = autocompleteController.selectedSuggestionIndex + mod;\n\n // Make sure the index never goes out of bounds\n nextIndex = _.clamp(nextIndex, 0, autocompleteController.suggestions.length - 1);\n\n // Finally apply the index\n autocompleteController.selectedSuggestionIndex = nextIndex;\n\n const liElements = ulElement.find('li');\n\n // We want the <li> semi-centered so we ignore the heights of the previous two.\n const moveTo = _(liElements)\n .take(nextIndex - 2)\n .map((li) => jquery(li).height())\n .sum();\n\n ulElement.scrollTop(moveTo);\n }", "title": "" }, { "docid": "4efbc5ad5214154c481b73bac266fb1f", "score": "0.61616987", "text": "rewind(direction)\r\n {\r\n this.select(this.coordsToIndex(this.selectedWord.x, this.selectedWord.y), direction);\r\n }", "title": "" }, { "docid": "751831ece001d9ddec0ce11c5cb4457f", "score": "0.61384743", "text": "function dat_doMouseDown() {\n\tvar rowIndex = event.srcElement.innerText*1;\n\tthis.moveto(rowIndex);\n\t\n}", "title": "" }, { "docid": "e39aedd649deb36139b4bc1710ecd18d", "score": "0.61305636", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = findWordAt(cm, start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = findWordAt(cm, pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if ((ie && !ie_upto9) ? !e.buttons : !e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "3d4f0493a855803200a9028564b57e6d", "score": "0.61204284", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = findWordAt(doc, start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), sel_mouse);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = findWordAt(doc, pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if ((ie && !ie_upto9) ? !e.buttons : !e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "81f32945d0fd68082b76b4dec3e23b42", "score": "0.6109406", "text": "function moveChoiceTo(elem_choice, direction) {\n\n var span = elem_choice.parentNode,\n td = span.parentNode;\n\n if (direction === -1 && span.previousElementSibling) {\n td.insertBefore(span, span.previousElementSibling);\n } else if (direction === 1 && span.nextElementSibling) {\n td.insertBefore(span, span.nextElementSibling.nextElementSibling)\n }\n}", "title": "" }, { "docid": "058230bd1c3ec664fd64b3db9b148d42", "score": "0.6103015", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "70682df016f5984f22a669a7eaa9f281", "score": "0.6076517", "text": "commandClick(index) {\n if (this.selection.has(index)) {\n // anchor/focus move to the next selected element with a larger index, if\n // there isn't one then it moves to the next selected with a smaller\n // index. Finally, if that doesn't exist they reset to 0.\n\n let isFound\n\n // search forwards\n const values = Array.from(this.selection.values())\n const max = Math.max(...values)\n for (var i = index + 1; i < max; i++) {\n if (this.selection.has(i)) {\n this.anchor = i\n this.focus = i\n isFound = true\n break\n }\n }\n\n // search backwards\n if (!isFound) {\n for (i = index - 1; i > -1; i--) {\n if (this.selection.has(i)) {\n this.anchor = i\n this.focus = i\n isFound = true\n break\n }\n }\n }\n\n // nothing selected\n if (!isFound) {\n this.anchor = 0\n this.focus = 0\n }\n\n this.selection.delete(index)\n\n } else {\n this.anchor = index\n this.focus = index\n this.selection.add(index)\n }\n }", "title": "" }, { "docid": "8e7fbf7b04e5e37e6fd9ce057262ef3e", "score": "0.60501456", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "8e7fbf7b04e5e37e6fd9ce057262ef3e", "score": "0.60501456", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "8e7fbf7b04e5e37e6fd9ce057262ef3e", "score": "0.60501456", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "8e7fbf7b04e5e37e6fd9ce057262ef3e", "score": "0.60501456", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "775f573905c356351f5b5253296889d2", "score": "0.60498595", "text": "function selectWord(_a) {\n var text = _a.text, selection = _a.selection;\n if (text && text.length && selection.start === selection.end) {\n // the user is pointing to a word\n return getSurroundingWord(text, selection.start);\n }\n return selection;\n}", "title": "" }, { "docid": "cce3afbceb4a284afce4c23096b69bd0", "score": "0.60401773", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "cce3afbceb4a284afce4c23096b69bd0", "score": "0.60401773", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "cce3afbceb4a284afce4c23096b69bd0", "score": "0.60401773", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "d49c4a3721177d7b4a82cd6b74ff4f28", "score": "0.60204035", "text": "function wordsBtnClicked(e) {\n // change old selection\n let oldBtn = d_select('.words-btn.btn-primary')\n oldBtn.classList.remove(\"btn-primary\")\n oldBtn.classList.add(\"btn-light\")\n // change new selection\n let newBtn = e.target\n newBtn.classList.remove(\"btn-light\")\n newBtn.classList.add(\"btn-primary\")\n renderAll(false, false, true, false)\n}", "title": "" }, { "docid": "9c77d644f4e85f76e14a735ca36011ca", "score": "0.5990683", "text": "function t(e){var t=e.getSelection(),r=t.getEndKey(),o=e.getCurrentContent(),i=o.getBlockForKey(r).getLength();return n.set(e,{selection:t.merge({anchorKey:r,anchorOffset:i,focusKey:r,focusOffset:i,isBackward:!1}),forceSelection:!0})}", "title": "" }, { "docid": "a512689a6f9377439b0dcd23974b2af4", "score": "0.5966842", "text": "selectPrevWord(direction, selectLastCell = false)\r\n {\r\n let directionChanged = false; //We'll return true if we had to change directions\r\n\r\n //Find a word that has a number that's lower than the current word's number, in the same diretion.\r\n let currentNumber = this.selectedWord.number;\r\n //use reverse() on a copy (given by slice()) of our array. Find will return the first match, which is necessarily the previous word...\r\n let prevWord = this.words.slice().reverse().find(w=>w.number < currentNumber && w.direction == direction);\r\n //... or nothing at all.\r\n if(prevWord == undefined)\r\n {\r\n //We were on the first word of the grid in that direction.\r\n //Change directions,\r\n direction = !direction;\r\n directionChanged = true;\r\n // and find the first word, from the end of the list, in this new direction.\r\n prevWord = this.words.slice().reverse().find(w=>w.direction == direction);\r\n }\r\n\r\n if(selectLastCell)\r\n {\r\n //Select the last cell of this word (index + length - 1, directionally aware)\r\n this.select(this.coordsToIndex(prevWord.x, prevWord.y) + (direction?1:this.width)*(prevWord.answer.length-1), direction);\r\n } else\r\n {\r\n //Select the first empty cell of this word\r\n this.select(this.findIndexOfFirstEmptyCell(prevWord), direction);\r\n }\r\n\r\n //Notify whoever called us that this action led to a change of direction\r\n return directionChanged;\r\n }", "title": "" }, { "docid": "fdc3c258ef866f838e455c3ac7bc0b5f", "score": "0.5950985", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc\n e_preventDefault(e)\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start)\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex] }\n else\n { ourRange = new Range(start, start) }\n } else {\n ourRange = doc.sel.primary()\n ourIndex = doc.sel.primIndex\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\"\n if (!addNew) { ourRange = new Range(start, start) }\n start = posFromMouse(cm, e, true, true)\n ourIndex = -1\n } else if (type == \"double\") {\n var word = cm.findWordAt(start)\n if (cm.display.shift || doc.extend)\n { ourRange = extendRange(doc, ourRange, word.anchor, word.head) }\n else\n { ourRange = word }\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)))\n if (cm.display.shift || doc.extend)\n { ourRange = extendRange(doc, ourRange, line.anchor, line.head) }\n else\n { ourRange = line }\n } else {\n ourRange = extendRange(doc, ourRange, start)\n }\n\n if (!addNew) {\n ourIndex = 0\n setSelection(doc, new Selection([ourRange], 0), sel_mouse)\n startSel = doc.sel\n } else if (ourIndex == -1) {\n ourIndex = ranges.length\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"})\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"})\n startSel = doc.sel\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)\n }\n\n var lastPos = start\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)) }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false})\n cm.scrollIntoView(pos)\n } else {\n var oldRange = ourRange\n var anchor = oldRange.anchor, head = pos\n if (type != \"single\") {\n var range\n if (type == \"double\")\n { range = cm.findWordAt(pos) }\n else\n { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) }\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head\n anchor = minPos(oldRange.from(), range.anchor)\n } else {\n head = range.anchor\n anchor = maxPos(oldRange.to(), range.head)\n }\n }\n var ranges$1 = startSel.ranges.slice(0)\n ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head)\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse)\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect()\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0\n\n function extend(e) {\n var curCount = ++counter\n var cur = posFromMouse(cm, e, true, type == \"rect\")\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt()\n extendTo(cur)\n var visible = visibleLines(display, doc)\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside\n extend(e)\n }), 50) }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false\n counter = Infinity\n e_preventDefault(e)\n display.input.focus()\n off(document, \"mousemove\", move)\n off(document, \"mouseup\", up)\n doc.history.lastSelOrigin = null\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e) }\n else { extend(e) }\n })\n var up = operation(cm, done)\n cm.state.selectingText = up\n on(document, \"mousemove\", move)\n on(document, \"mouseup\", up)\n}", "title": "" }, { "docid": "54d991761792119ffe65d4e2e18a64dd", "score": "0.59503394", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "54d991761792119ffe65d4e2e18a64dd", "score": "0.59503394", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "54d991761792119ffe65d4e2e18a64dd", "score": "0.59503394", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "54d991761792119ffe65d4e2e18a64dd", "score": "0.59503394", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "title": "" }, { "docid": "50250e212a7727fa8cb6b8e1f4db9c4a", "score": "0.5928306", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }\n else\n { ourRange = word; }\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }\n else\n { ourRange = line; }\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n var range$$1;\n if (type == \"double\")\n { range$$1 = cm.findWordAt(pos); }\n else\n { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "590e935a1f348e125d94e88394a6f57a", "score": "0.59259623", "text": "move_blackBookNote_EditButton_Left(){\n this.blackBookNote_EditButton.waitForExist();\n this.blackBookNote_EditButton.pause(3000);\n\n browser.touchAction('//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.Button/android.widget.TextView', \n ['longPress', {action: 'moveTo', x: (this.X_Axis_blackBookNote_EditButton-273), y: 0}, 'release'\n ])\n }", "title": "" }, { "docid": "23c43bff6df1163a15015718d1844d2a", "score": "0.5920353", "text": "function t(e){var t=e.getSelection(),r=t.getStartKey();return n.set(e,{selection:t.merge({anchorKey:r,anchorOffset:0,focusKey:r,focusOffset:0,isBackward:!1}),forceSelection:!0})}", "title": "" }, { "docid": "34552da5736f4b465856fd011a55a4ea", "score": "0.5918015", "text": "function moveTo(selectedDiv) {\n //console.log(\"#\" + selectedDiv);\n // selectedDiv = index of div starting from 1\n $.scrollify.move(\"#\" + selectedDiv);\n}", "title": "" }, { "docid": "fc23191ce472d1ef8027bcfb9e82b335", "score": "0.5866743", "text": "moveSelected(delta) {\n this[selectionSym].forEach(obj=> {\n if(obj.move)\n obj.move(delta);\n });\n }", "title": "" }, { "docid": "126d8699c17a8ad9faa2eb881b8533ee", "score": "0.5845275", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t }\n\n\t if (e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\") {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t ensureFocus(cm);\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\n\t function done(e) {\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t focusInput(cm);\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "title": "" }, { "docid": "ad1db58f6c5e37ac02d9d1213a50d987", "score": "0.58444965", "text": "function clickDown({ target }) {\n // Don't grab piece if it isn't your turn\n if (props.turn !== props.pieceColor) {\n return\n }\n\n props.savePossibleMoves(lastMove[0], lastMove[1], thisPieceType, props.pieceColor)\n\n const elem = target.getBoundingClientRect();\n if (!selected) {\n setOffset([elem.right - props.mouseX, elem.top - props.mouseY])\n }\n\n setLastMove([indexCoordinates(props.mouseX, 0), indexCoordinates(props.mouseY, 1)])\n\n setSelected(true)\n }", "title": "" }, { "docid": "2ece1ac3c9ce403eea6a7527be244e84", "score": "0.58364356", "text": "function mousePressed(){\n index = index + 1;\n if (index == words.length){\n index = 0;\n }\n}", "title": "" }, { "docid": "a44b10d218827288c82b6baf10b923b8", "score": "0.58323365", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\n\t if (e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "title": "" }, { "docid": "a44b10d218827288c82b6baf10b923b8", "score": "0.58323365", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\n\t if (e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "title": "" }, { "docid": "ab4f26e13017ddf51a5d705542571ecd", "score": "0.5828479", "text": "function moveSelectionForward(editorState, maxDistance) {\n var focusOffset, selection = editorState.getSelection(), key = selection.getStartKey(), offset = selection.getStartOffset(), content = editorState.getCurrentContent(), focusKey = key;\n return maxDistance > content.getBlockForKey(key).getText().length - offset ? (focusKey = content.getKeyAfter(key), \n focusOffset = 0) : focusOffset = offset + maxDistance, selection.merge({\n focusKey: focusKey,\n focusOffset: focusOffset\n });\n }", "title": "" }, { "docid": "a610fe51c20114b3ceffb84fca773f7e", "score": "0.5820458", "text": "moveSelectedDown() {\n let $item = $(\"#editor-viewport\").find(`.game-item-select`); // Find selected object\n if ($item.html() != undefined) { // Check if selectionis valid\n let $option = $(\"#objects-list option:selected\"); // Selected object in objects list\n $item.insertAfter($item.next()); // Change order in viewport\n $option.insertAfter($option.next()); // Change order in objects list\n // Show success message\n $(\"#info\").html(`Game object <span class=\"debug-text\">${$option.text()}</span> is brought forward`);\n }\n }", "title": "" }, { "docid": "e46c61213afd0bd5a25bc63db58844f1", "score": "0.58141685", "text": "function _move_elem(e) {\r\n x_pos = document.all ? window.event.clientX : e.pageX;\r\n y_pos = document.all ? window.event.clientY : e.pageY;\r\n if (selected !== null) {\r\n selected.style.left = (x_pos - x_elem) + 'px';\r\n selected.style.top = (y_pos - y_elem) + 'px'; // not sure yet why I had to subtract 35!\r\n }\r\n}", "title": "" }, { "docid": "e3e4af6bb596a377a59958b8ba98a132", "score": "0.580298", "text": "move(list, selected, direction) {\n if (isPresent(selected)) {\n selected.set('isSelected', false);\n }\n\n if (isEmpty(list)) {\n return;\n }\n\n let node;\n\n if (direction === 38) {\n if (isPresent(selected)) {\n node = this.findPrevNode(list, selected);\n }\n\n if (isNone(node)) {\n node = list[list.length - 1];\n }\n } else if (direction === 40) {\n if (isPresent(selected)) {\n node = this.findNextNode(list, selected);\n }\n\n if (isNone(node)) {\n node = list[0];\n }\n }\n\n this.set('selected', node);\n node.set('isSelected', true);\n\n run.next(this, bringInView, '.es-options', '.tree-highlight');\n }", "title": "" }, { "docid": "14deb6f0aa5145c106f0e18a553eb791", "score": "0.5801364", "text": "function onBoardWordMouseDown(event){\n\tupdate = true;\n\tvar wordUI = event.currentTarget;\n\tevent.stopImmediatePropagation();\n\tif(_isConnecting)\n\t{\n\t\t//clear current failed connection\n\t\treturn;\n\t}\n\t_isConnecting = true;\n\tvar connection = getNewConnection(wordUI, null);\n\tboard.addChild(connection.shape);\n\tboard.addChild(connection.textDeprel);\n\t_currentConnection = connection;\n}", "title": "" }, { "docid": "9844ca9f8a92a89b60ba6ed39ff88ac0", "score": "0.578406", "text": "function move(next) {\n if (marks.length > 0) {\n console.assert(cur >= 0 && cur < marks.length);\n marks[cur].className = \"\";\n if (next) {\n nextMatch();\n } else {\n prevMatch();\n }\n marks[cur].className = \"__regexp_search_selected\";\n infoSpan.setText((cur + 1) + \" of \" + marks.length + \" matches.\");\n }\n}", "title": "" }, { "docid": "714188d582a10cf0654c0325700499f8", "score": "0.57589775", "text": "function moveBackToList(word) { \r\n\tvar i; //index\r\n\ti = words8.indexOf(word);\r\n\twordElems[i].innerHTML = words8[i];\r\n} // End moveBackToList", "title": "" }, { "docid": "f23b2861044b9fb793df91f83ef971e8", "score": "0.5754549", "text": "function moveTheWord(serverWord) {\n console.log(serverWord)\n var movedWord = document.getElementById(serverWord.id);\n // console.log('movedWord', movedWord)\n movedWord.style.left = serverWord.x * 90 + 'vw';\n movedWord.style.top = serverWord.y * 90 + 3 + 'vw';\n}", "title": "" }, { "docid": "302b0b420fe7e6e17da6c1d16c84b0b6", "score": "0.57511723", "text": "function _move_elem(e) {\n x_pos = document.all ? window.event.clientX : e.pageX;\n y_pos = document.all ? window.event.clientY : e.pageY;\n if (selected !== null) {\n selected.style.left = (x_pos - x_elem) + 'px';\n selected.style.top = (y_pos - y_elem) + 'px';\n }\n }", "title": "" }, { "docid": "2056ad332aad0216739067adf3d8d69e", "score": "0.57496154", "text": "changeDirection(newTarget, evt) {\n // console.log(newTarget, evt);\n const [changeDirection] = [ACROSS, DOWN].filter(dir => dir !== this.direction);\n const cell = newTarget || this.selected;\n // check if the cell exist in a word on the other direction\n // if it doesn't exist in another direction, just return,\n // else, change direction\n if (getCellVariable(cell, changeDirection)) {// this will return if the cell exists in a word on the changeDirection\n this.updateDirectionAndSelected(cell, changeDirection);\n }\n\n }", "title": "" }, { "docid": "bdf58730e93c06827fd1b2317a613a5a", "score": "0.57479024", "text": "function _move_elem(e) {\n\tx_pos = document.all ? window.event.clientX : e.pageX;\n\ty_pos = document.all ? window.event.clientY : e.pageY;\n\tif (selected !== null) {\n\t\tselected.style.left = (x_pos - x_elem) + 'px';\n\t\tselected.style.top = (y_pos - y_elem) + 'px';\n\t}\n}", "title": "" }, { "docid": "0868f306d4d8ea20db0f2833a47c6759", "score": "0.57411206", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\t\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\t\n\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\t\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\t\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\t\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\t\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\t\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\t\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\t\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "title": "" }, { "docid": "0868f306d4d8ea20db0f2833a47c6759", "score": "0.57411206", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\t\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\t\n\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\t\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\t\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\t\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\t\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\t\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\t\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\t\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "title": "" }, { "docid": "9436e7243b191c56a58c2b5168fd92e9", "score": "0.57402945", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc\n\t e_preventDefault(e)\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start)\n\t if (ourIndex > -1)\n\t { ourRange = ranges[ourIndex] }\n\t else\n\t { ourRange = new Range(start, start) }\n\t } else {\n\t ourRange = doc.sel.primary()\n\t ourIndex = doc.sel.primIndex\n\t }\n\n\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t type = \"rect\"\n\t if (!addNew) { ourRange = new Range(start, start) }\n\t start = posFromMouse(cm, e, true, true)\n\t ourIndex = -1\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start)\n\t if (cm.display.shift || doc.extend)\n\t { ourRange = extendRange(doc, ourRange, word.anchor, word.head) }\n\t else\n\t { ourRange = word }\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)))\n\t if (cm.display.shift || doc.extend)\n\t { ourRange = extendRange(doc, ourRange, line.anchor, line.head) }\n\t else\n\t { ourRange = line }\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start)\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse)\n\t startSel = doc.sel\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"})\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"})\n\t startSel = doc.sel\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)\n\t }\n\n\t var lastPos = start\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) { return }\n\t lastPos = pos\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)\n\t if (left == right)\n\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) }\n\t else if (text.length > leftPos)\n\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) }\n\t }\n\t if (!ranges.length) { ranges.push(new Range(start, start)) }\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false})\n\t cm.scrollIntoView(pos)\n\t } else {\n\t var oldRange = ourRange\n\t var anchor = oldRange.anchor, head = pos\n\t if (type != \"single\") {\n\t var range\n\t if (type == \"double\")\n\t { range = cm.findWordAt(pos) }\n\t else\n\t { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) }\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head\n\t anchor = minPos(oldRange.from(), range.anchor)\n\t } else {\n\t head = range.anchor\n\t anchor = maxPos(oldRange.to(), range.head)\n\t }\n\t }\n\t var ranges$1 = startSel.ranges.slice(0)\n\t ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head)\n\t setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse)\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect()\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0\n\n\t function extend(e) {\n\t var curCount = ++counter\n\t var cur = posFromMouse(cm, e, true, type == \"rect\")\n\t if (!cur) { return }\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt()\n\t extendTo(cur)\n\t var visible = visibleLines(display, doc)\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) }\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0\n\t if (outside) { setTimeout(operation(cm, function () {\n\t if (counter != curCount) { return }\n\t display.scroller.scrollTop += outside\n\t extend(e)\n\t }), 50) }\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false\n\t counter = Infinity\n\t e_preventDefault(e)\n\t display.input.focus()\n\t off(document, \"mousemove\", move)\n\t off(document, \"mouseup\", up)\n\t doc.history.lastSelOrigin = null\n\t }\n\n\t var move = operation(cm, function (e) {\n\t if (!e_button(e)) { done(e) }\n\t else { extend(e) }\n\t })\n\t var up = operation(cm, done)\n\t cm.state.selectingText = up\n\t on(document, \"mousemove\", move)\n\t on(document, \"mouseup\", up)\n\t}", "title": "" }, { "docid": "9436e7243b191c56a58c2b5168fd92e9", "score": "0.57402945", "text": "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc\n\t e_preventDefault(e)\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start)\n\t if (ourIndex > -1)\n\t { ourRange = ranges[ourIndex] }\n\t else\n\t { ourRange = new Range(start, start) }\n\t } else {\n\t ourRange = doc.sel.primary()\n\t ourIndex = doc.sel.primIndex\n\t }\n\n\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t type = \"rect\"\n\t if (!addNew) { ourRange = new Range(start, start) }\n\t start = posFromMouse(cm, e, true, true)\n\t ourIndex = -1\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start)\n\t if (cm.display.shift || doc.extend)\n\t { ourRange = extendRange(doc, ourRange, word.anchor, word.head) }\n\t else\n\t { ourRange = word }\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)))\n\t if (cm.display.shift || doc.extend)\n\t { ourRange = extendRange(doc, ourRange, line.anchor, line.head) }\n\t else\n\t { ourRange = line }\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start)\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse)\n\t startSel = doc.sel\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"})\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"})\n\t startSel = doc.sel\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)\n\t }\n\n\t var lastPos = start\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) { return }\n\t lastPos = pos\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)\n\t if (left == right)\n\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) }\n\t else if (text.length > leftPos)\n\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) }\n\t }\n\t if (!ranges.length) { ranges.push(new Range(start, start)) }\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false})\n\t cm.scrollIntoView(pos)\n\t } else {\n\t var oldRange = ourRange\n\t var anchor = oldRange.anchor, head = pos\n\t if (type != \"single\") {\n\t var range\n\t if (type == \"double\")\n\t { range = cm.findWordAt(pos) }\n\t else\n\t { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) }\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head\n\t anchor = minPos(oldRange.from(), range.anchor)\n\t } else {\n\t head = range.anchor\n\t anchor = maxPos(oldRange.to(), range.head)\n\t }\n\t }\n\t var ranges$1 = startSel.ranges.slice(0)\n\t ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head)\n\t setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse)\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect()\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0\n\n\t function extend(e) {\n\t var curCount = ++counter\n\t var cur = posFromMouse(cm, e, true, type == \"rect\")\n\t if (!cur) { return }\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt()\n\t extendTo(cur)\n\t var visible = visibleLines(display, doc)\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) }\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0\n\t if (outside) { setTimeout(operation(cm, function () {\n\t if (counter != curCount) { return }\n\t display.scroller.scrollTop += outside\n\t extend(e)\n\t }), 50) }\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false\n\t counter = Infinity\n\t e_preventDefault(e)\n\t display.input.focus()\n\t off(document, \"mousemove\", move)\n\t off(document, \"mouseup\", up)\n\t doc.history.lastSelOrigin = null\n\t }\n\n\t var move = operation(cm, function (e) {\n\t if (!e_button(e)) { done(e) }\n\t else { extend(e) }\n\t })\n\t var up = operation(cm, done)\n\t cm.state.selectingText = up\n\t on(document, \"mousemove\", move)\n\t on(document, \"mouseup\", up)\n\t}", "title": "" }, { "docid": "3969bf0a10d050b1c59bb1934e355653", "score": "0.573718", "text": "function _move_elem(e) {\n x_pos = document.all ? window.event.clientX : e.pageX;\n y_pos = document.all ? window.event.clientY : e.pageY;\n if (selected !== null) {\n selected.style.left = (x_pos - x_elem) + 'px';\n selected.style.top = (y_pos - y_elem) + 'px';\n }\n}", "title": "" }, { "docid": "289e99d7b322cd048dc0fb604c146aa8", "score": "0.5735003", "text": "function moveElement(selected, destination) {\n var moveElement = $(\"#\" + selected);\n moveElement.detach();\n $(\"#\" + destination).append(moveElement);\n}", "title": "" }, { "docid": "65f1a99236dea9a4a268927b7c1cfb35", "score": "0.5730231", "text": "function _move_elem(e) {\n x_pos = document.all ? window.event.clientX : e.pageX;\n y_pos = document.all ? window.event.clientY : e.pageY;\n if (selected !== null) {\n selected.style.left = (x_pos - x_elem) + 'px';\n selected.style.top = (y_pos - y_elem) + 'px';\n }\n }", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "ca27ebcff2c24e1e739718d1783dfc6e", "score": "0.5720507", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n}", "title": "" }, { "docid": "4c3d25b26aed471d5a0167a01d50c91b", "score": "0.57021236", "text": "function moveSelectedItems() {\n\tvar deltaX = curMousePos.x - oldMousePos.x;\n\tvar deltaY = curMousePos.y - oldMousePos.y;\n\n\tvar highlightedItems = getHighlightedItems();\n\tvar cells = graph.getCells();\n\n\tfor (var i = 0; i < highlightedItems.length; i++) {\n\t\tvar highlightedItem = highlightedItems[i];\n\t\tvar htmlId = highlightedItem.getAttribute(\"model-id\");\n\n\t\tfor (var j = 0; j < cells.length; j++) {\n\t\t\tvar cell = cells[j];\n\t\t\tvar modelId = cell.attributes.id;\n\n\t\t\tif (modelId == htmlId) {\n\t\t\t\tcell.translate(deltaX, deltaY);\n\t\t\t}\n\t\t}\n\t}\n\n\tselected[0].translate(-deltaX, -deltaY);\n}", "title": "" }, { "docid": "c60afeb9956e7b03434d7203c7c8a11f", "score": "0.56840056", "text": "function t(e){var t=e.getSelection();if(!t.isCollapsed())return e;var i=t.getAnchorOffset();if(0===i)return e;var a=t.getAnchorKey(),s=e.getCurrentContent(),u=s.getBlockForKey(a),l=u.getLength();\n// Nothing to transpose if there aren't two characters.\nif(l<=1)return e;var c,p;i===l?(\n// The cursor is at the end of the block. Swap the last two characters.\nc=t.set(\"anchorOffset\",i-1),p=t):(c=t.set(\"focusOffset\",i+1),p=c.set(\"anchorOffset\",i+1));\n// Extract the character to move as a fragment. This preserves its\n// styling and entity, if any.\nvar f=o(s,c),d=n.removeRange(s,c,\"backward\"),h=d.getSelectionAfter(),v=h.getAnchorOffset()-1,m=h.merge({anchorOffset:v,focusOffset:v}),y=n.replaceWithFragment(d,m,f),g=r.push(e,y,\"insert-fragment\");return r.acceptSelection(g,p)}", "title": "" }, { "docid": "2fabfcf709afd03d374fb25c0c765903", "score": "0.56807333", "text": "function moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n\n var focusKey = key;\n var focusOffset;\n\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n }", "title": "" }, { "docid": "87e5188b56ddd3201e01c32f8013bc6c", "score": "0.567938", "text": "function moveSelectionForward(editorState, maxDistance) {\n\t var selection = editorState.getSelection();\n\t var key = selection.getStartKey();\n\t var offset = selection.getStartOffset();\n\t var content = editorState.getCurrentContent();\n\t\n\t var focusKey = key;\n\t var focusOffset;\n\t\n\t var block = content.getBlockForKey(key);\n\t\n\t if (maxDistance > block.getText().length - offset) {\n\t focusKey = content.getKeyAfter(key);\n\t focusOffset = 0;\n\t } else {\n\t focusOffset = offset + maxDistance;\n\t }\n\t\n\t return selection.merge({ focusKey: focusKey, focusOffset: focusOffset });\n\t}", "title": "" }, { "docid": "7d0dc009824fbd3cec4562dbff16fdd1", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "title": "" }, { "docid": "a0dca1ec50bed23f6f71dab7e52eaa84", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "a0dca1ec50bed23f6f71dab7e52eaa84", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "a0dca1ec50bed23f6f71dab7e52eaa84", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "7d0dc009824fbd3cec4562dbff16fdd1", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "title": "" }, { "docid": "886dffb45717c546cea6cad015406a66", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "a0dca1ec50bed23f6f71dab7e52eaa84", "score": "0.5670088", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "title": "" }, { "docid": "140a566647bec085c3918a47902ff62d", "score": "0.566555", "text": "function move( direction ) /* 1|-1 */ {\n let c = cursor(page()) \n let next = c.nextSibling \n if ( direction == -1 ) {\n next = c.previousSibling }\n if ( next == null ) {\n return }\n c.classList.remove(\"cursor\") \n next.classList.add(\"cursor\") }", "title": "" }, { "docid": "457559cb8514edf3c7279d56f0010818", "score": "0.56612784", "text": "function move(highlightedElement,direction) {\n var elementID = parseInt(highlightedElement.id);\n var switchID;\n if (direction === \"left\" && elementID > 1) {\n switchID = elementID-1;\n } else if (direction === \"right\" && elementID < 12) {\n switchID = elementID+1;\n } else if (direction === \"up\" && elementID > 4) {\n switchID = elementID-4;\n } else if (direction === \"down\" && elementID < 9) {\n switchID = elementID+4;\n } else {\n switchID = elementID;\n }\n var switchedHTML = switchPhoto(highlightedElement,switchID);\n switchPhoto(switchedHTML,elementID);\n}", "title": "" }, { "docid": "ef7b33b4202e6a20ea36626ca6d49467", "score": "0.56521523", "text": "function startDrag(selected) { \n selected.body.moves = false;\n }", "title": "" }, { "docid": "0c7a76a6a439f5e15d3eb5c0ffd1da46", "score": "0.5642403", "text": "function switch_to(element){\r\n element.click();\r\n element.select();\r\n element.focus();\r\n}", "title": "" }, { "docid": "035dea7d8c53d570ed1cadcff4c0f3ad", "score": "0.56409323", "text": "function savePosClick(x, y){\n gMeme.clickPos.x = x - gMeme.textLines[gMeme.selectedLineId].position.x\n gMeme.clickPos.y = y - gMeme.textLines[gMeme.selectedLineId].position.y\n}", "title": "" }, { "docid": "bedfe404576c13c308b4ae4cb441c23e", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "0d1d4214af787cba7eb73ce13f99c2d4", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "bedfe404576c13c308b4ae4cb441c23e", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "0d1d4214af787cba7eb73ce13f99c2d4", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "bedfe404576c13c308b4ae4cb441c23e", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "0d1d4214af787cba7eb73ce13f99c2d4", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "bedfe404576c13c308b4ae4cb441c23e", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "bedfe404576c13c308b4ae4cb441c23e", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "0d1d4214af787cba7eb73ce13f99c2d4", "score": "0.5640325", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "d9dc33000a9cdc871fed22e2bc04d6af", "score": "0.5639304", "text": "handleWordMove(startCoordinate, dropCoordinate){\n const content = this.state.collections[startCoordinate[0]][startCoordinate[1]]\n this.removeWord(startCoordinate[0], startCoordinate[1]);\n this.insertWord(dropCoordinate[0], dropCoordinate[1], content);\n }", "title": "" }, { "docid": "295e7fb3d503746a5f272647cccc475e", "score": "0.5633416", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "295e7fb3d503746a5f272647cccc475e", "score": "0.5633416", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" }, { "docid": "295e7fb3d503746a5f272647cccc475e", "score": "0.5633416", "text": "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "title": "" } ]
704e55eb1d3125d9ce70ac304efd0362
Copyright Joyent, Inc. and other Node contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[ { "docid": "c35a0cd81b647576789125afb9467762", "score": "0.0", "text": "function EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}", "title": "" } ]
[ { "docid": "482e4162508d52eb84917f97484df791", "score": "0.5616133", "text": "function plp_js_test () {\n var __symbols__ = ['__py3.6__', '__esv5__'];\n var __all__ = {};\n var __world__ = __all__;\n \n // Nested object creator, part of the nesting may already exist and have attributes\n var __nest__ = function (headObject, tailNames, value) {\n // In some cases this will be a global object, e.g. 'window'\n var current = headObject;\n \n if (tailNames != '') { // Split on empty string doesn't give empty list\n // Find the last already created object in tailNames\n var tailChain = tailNames.split ('.');\n var firstNewIndex = tailChain.length;\n for (var index = 0; index < tailChain.length; index++) {\n if (!current.hasOwnProperty (tailChain [index])) {\n firstNewIndex = index;\n break;\n }\n current = current [tailChain [index]];\n }\n \n // Create the rest of the objects, if any\n for (var index = firstNewIndex; index < tailChain.length; index++) {\n current [tailChain [index]] = {};\n current = current [tailChain [index]];\n }\n }\n \n // Insert it new attributes, it may have been created earlier and have other attributes\n for (var attrib in value) {\n current [attrib] = value [attrib]; \n } \n };\n __all__.__nest__ = __nest__;\n \n // Initialize module if not yet done and return its globals\n var __init__ = function (module) {\n if (!module.__inited__) {\n module.__all__.__init__ (module.__all__);\n module.__inited__ = true;\n }\n return module.__all__;\n };\n __all__.__init__ = __init__;\n \n \n \n \n // Since we want to assign functions, a = b.f should make b.f produce a bound function\n // So __get__ should be called by a property rather then a function\n // Factory __get__ creates one of three curried functions for func\n // Which one is produced depends on what's to the left of the dot of the corresponding JavaScript property\n var __get__ = function (self, func, quotedFuncName) {\n if (self) {\n if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) { // Object before the dot\n if (quotedFuncName) { // Memoize call since fcall is on, by installing bound function in instance\n Object.defineProperty (self, quotedFuncName, { // Will override the non-own property, next time it will be called directly\n value: function () { // So next time just call curry function that calls function\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n }, \n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n return function () { // Return bound function, code dupplication for efficiency if no memoizing\n var args = [] .slice.apply (arguments); // So multilayer search prototype, apply __get__, call curry func that calls func\n return func.apply (null, [self] .concat (args));\n };\n }\n else { // Class before the dot\n return func; // Return static method\n }\n }\n else { // Nothing before the dot\n return func; // Return free function\n }\n }\n __all__.__get__ = __get__;\n \n // Mother of all metaclasses \n var py_metatype = {\n __name__: 'type',\n __bases__: [],\n \n // Overridable class creation worker\n __new__: function (meta, name, bases, attribs) {\n // Create the class cls, a functor, which the class creator function will return\n var cls = function () { // If cls is called with arg0, arg1, etc, it calls its __new__ method with [arg0, arg1, etc]\n var args = [] .slice.apply (arguments); // It has a __new__ method, not yet but at call time, since it is copied from the parent in the loop below\n return cls.__new__ (args); // Each Python class directly or indirectly derives from object, which has the __new__ method\n }; // If there are no bases in the Python source, the compiler generates [object] for this parameter\n \n // Copy all methods, including __new__, properties and static attributes from base classes to new cls object\n // The new class object will simply be the prototype of its instances\n // JavaScript prototypical single inheritance will do here, since any object has only one class\n // This has nothing to do with Python multiple inheritance, that is implemented explictly in the copy loop below\n for (var index = bases.length - 1; index >= 0; index--) { // Reversed order, since class vars of first base should win\n var base = bases [index];\n for (var attrib in base) {\n var descrip = Object.getOwnPropertyDescriptor (base, attrib);\n Object.defineProperty (cls, attrib, descrip);\n } \n }\n \n // Add class specific attributes to the created cls object\n cls.__metaclass__ = meta;\n cls.__name__ = name;\n cls.__bases__ = bases;\n \n // Add own methods, properties and own static attributes to the created cls object\n for (var attrib in attribs) {\n var descrip = Object.getOwnPropertyDescriptor (attribs, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n // Return created cls object\n return cls;\n }\n };\n py_metatype.__metaclass__ = py_metatype;\n __all__.py_metatype = py_metatype;\n \n // Mother of all classes\n var object = {\n __init__: function (self) {},\n \n __metaclass__: py_metatype, // By default, all classes have metaclass type, since they derive from object\n __name__: 'object',\n __bases__: [],\n \n // Object creator function, is inherited by all classes (so could be global)\n __new__: function (args) { // Args are just the constructor args \n // In JavaScript the Python class is the prototype of the Python object\n // In this way methods and static attributes will be available both with a class and an object before the dot\n // The descriptor produced by __get__ will return the right method flavor\n var instance = Object.create (this, {__class__: {value: this, enumerable: true}});\n \n\n // Call constructor\n this.__init__.apply (null, [instance] .concat (args));\n\n // Return constructed instance\n return instance;\n } \n };\n __all__.object = object;\n \n // Class creator facade function, calls class creation worker\n var __class__ = function (name, bases, attribs, meta) { // Parameter meta is optional\n if (meta == undefined) {\n meta = bases [0] .__metaclass__;\n }\n \n return meta.__new__ (meta, name, bases, attribs);\n }\n __all__.__class__ = __class__;\n \n // Define __pragma__ to preserve '<all>' and '</all>', since it's never generated as a function, must be done early, so here\n var __pragma__ = function () {};\n __all__.__pragma__ = __pragma__;\n \n \t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__base__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __Envir__ = __class__ ('__Envir__', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.interpreter_name = 'python';\n\t\t\t\t\t\t\tself.transpiler_name = 'transcrypt';\n\t\t\t\t\t\t\tself.transpiler_version = '3.6.34';\n\t\t\t\t\t\t\tself.target_subdir = '__javascript__';\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __envir__ = __Envir__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__Envir__ = __Envir__;\n\t\t\t\t\t\t__all__.__envir__ = __envir__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__standard__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar Exception = __class__ ('Exception', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.__args__ = args;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.stack = kwargs.error.stack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.stack = 'No stack trace available';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn '{}{}'.format (self.__class__.__name__, repr (tuple (self.__args__)));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '{}()'.format (self.__class__.__name__);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__) > 1) {\n\t\t\t\t\t\t\t\treturn str (tuple (self.__args__));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn str (self.__args__ [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IterableError = __class__ ('IterableError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, \"Can't iterate over non-iterable\", __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StopIteration = __class__ ('StopIteration', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Iterator exhausted', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ValueError = __class__ ('ValueError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Erroneous value', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar KeyError = __class__ ('KeyError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Invalid key', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AssertionError = __class__ ('AssertionError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tif (message) {\n\t\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tException.__init__ (self, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar NotImplementedError = __class__ ('NotImplementedError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IndexError = __class__ ('IndexError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AttributeError = __class__ ('AttributeError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Warning = __class__ ('Warning', [Exception], {\n\t\t\t\t\t});\n\t\t\t\t\tvar UserWarning = __class__ ('UserWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar DeprecationWarning = __class__ ('DeprecationWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar RuntimeWarning = __class__ ('RuntimeWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar __sort__ = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key) {\n\t\t\t\t\t\t\titerable.sort ((function __lambda__ (a, b) {\n\t\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'a': var a = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'b': var b = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (key (a) > key (b) ? 1 : -(1));\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\titerable.sort ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (reverse) {\n\t\t\t\t\t\t\titerable.reverse ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar sorted = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (py_typeof (iterable) == dict) {\n\t\t\t\t\t\t\tvar result = copy (iterable.py_keys ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar result = copy (iterable);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__sort__ (result, key, reverse);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t\tvar map = function (func, iterable) {\n\t\t\t\t\t\treturn function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tvar __iterable0__ = iterable;\n\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t__accu0__.append (func (item));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t} ();\n\t\t\t\t\t};\n\t\t\t\t\tvar filter = function (func, iterable) {\n\t\t\t\t\t\tif (func == null) {\n\t\t\t\t\t\t\tvar func = bool;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tvar __iterable0__ = iterable;\n\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\tif (func (item)) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t} ();\n\t\t\t\t\t};\n\t\t\t\t\tvar __Terminal__ = __class__ ('__Terminal__', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.buffer = '';\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.element = document.getElementById ('__terminal__');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.element = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.style.overflowX = 'auto';\n\t\t\t\t\t\t\t\tself.element.style.boxSizing = 'border-box';\n\t\t\t\t\t\t\t\tself.element.style.padding = '5px';\n\t\t\t\t\t\t\t\tself.element.innerHTML = '_';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget print () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar sep = ' ';\n\t\t\t\t\t\t\tvar end = '\\n';\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'sep': var sep = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'end': var end = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.buffer = '{}{}{}'.format (self.buffer, sep.join (function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = args;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar arg = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ()), end).__getslice__ (-(4096), null, 1);\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.innerHTML = self.buffer.py_replace ('\\n', '<br>');\n\t\t\t\t\t\t\t\tself.element.scrollTop = self.element.scrollHeight;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tconsole.log (sep.join (function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tvar __iterable0__ = args;\n\t\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\t\tvar arg = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t} ()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget input () {return __get__ (this, function (self, question) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'question': var question = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.print ('{}'.format (question), __kwargtrans__ ({end: ''}));\n\t\t\t\t\t\t\tvar answer = window.prompt ('\\n'.join (self.buffer.py_split ('\\n').__getslice__ (-(16), null, 1)));\n\t\t\t\t\t\t\tself.print (answer);\n\t\t\t\t\t\t\treturn answer;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __terminal__ = __Terminal__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AssertionError = AssertionError;\n\t\t\t\t\t\t__all__.AttributeError = AttributeError;\n\t\t\t\t\t\t__all__.DeprecationWarning = DeprecationWarning;\n\t\t\t\t\t\t__all__.Exception = Exception;\n\t\t\t\t\t\t__all__.IndexError = IndexError;\n\t\t\t\t\t\t__all__.IterableError = IterableError;\n\t\t\t\t\t\t__all__.KeyError = KeyError;\n\t\t\t\t\t\t__all__.NotImplementedError = NotImplementedError;\n\t\t\t\t\t\t__all__.RuntimeWarning = RuntimeWarning;\n\t\t\t\t\t\t__all__.StopIteration = StopIteration;\n\t\t\t\t\t\t__all__.UserWarning = UserWarning;\n\t\t\t\t\t\t__all__.ValueError = ValueError;\n\t\t\t\t\t\t__all__.Warning = Warning;\n\t\t\t\t\t\t__all__.__Terminal__ = __Terminal__;\n\t\t\t\t\t\t__all__.__sort__ = __sort__;\n\t\t\t\t\t\t__all__.__terminal__ = __terminal__;\n\t\t\t\t\t\t__all__.filter = filter;\n\t\t\t\t\t\t__all__.map = map;\n\t\t\t\t\t\t__all__.sorted = sorted;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n var __call__ = function (/* <callee>, <this>, <params>* */) { // Needed for __base__ and __standard__ if global 'opov' switch is on\n var args = [] .slice.apply (arguments);\n if (typeof args [0] == 'object' && '__call__' in args [0]) { // Overloaded\n return args [0] .__call__ .apply (args [1], args.slice (2));\n }\n else { // Native\n return args [0] .apply (args [1], args.slice (2));\n }\n };\n __all__.__call__ = __call__;\n\n // Initialize non-nested modules __base__ and __standard__ and make its names available directly and via __all__\n // They can't do that itself, because they're regular Python modules\n // The compiler recognizes their names and generates them inline rather than nesting them\n // In this way it isn't needed to import them everywhere\n\n // __base__\n\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__base__));\n var __envir__ = __all__.__envir__;\n\n // __standard__\n\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__standard__));\n\n var Exception = __all__.Exception;\n var IterableError = __all__.IterableError;\n var StopIteration = __all__.StopIteration;\n var ValueError = __all__.ValueError;\n var KeyError = __all__.KeyError;\n var AssertionError = __all__.AssertionError;\n var NotImplementedError = __all__.NotImplementedError;\n var IndexError = __all__.IndexError;\n var AttributeError = __all__.AttributeError;\n\n // Warnings Exceptions\n var Warning = __all__.Warning;\n var UserWarning = __all__.UserWarning;\n var DeprecationWarning = __all__.DeprecationWarning;\n var RuntimeWarning = __all__.RuntimeWarning;\n\n var __sort__ = __all__.__sort__;\n var sorted = __all__.sorted;\n\n var map = __all__.map;\n var filter = __all__.filter;\n\n __all__.print = __all__.__terminal__.print;\n __all__.input = __all__.__terminal__.input;\n\n var __terminal__ = __all__.__terminal__;\n var print = __all__.print;\n var input = __all__.input;\n\n // Complete __envir__, that was created in __base__, for non-stub mode\n __envir__.executor_name = __envir__.transpiler_name;\n\n // Make make __main__ available in browser\n var __main__ = {__file__: ''};\n __all__.main = __main__;\n\n // Define current exception, there's at most one exception in the air at any time\n var __except__ = null;\n __all__.__except__ = __except__;\n \n // Creator of a marked dictionary, used to pass **kwargs parameter\n var __kwargtrans__ = function (anObject) {\n anObject.__kwargtrans__ = null; // Removable marker\n anObject.constructor = Object;\n return anObject;\n }\n __all__.__kwargtrans__ = __kwargtrans__;\n\n // 'Oneshot' dict promotor, used to enrich __all__ and help globals () return a true dict\n var __globals__ = function (anObject) {\n if (isinstance (anObject, dict)) { // Don't attempt to promote (enrich) again, since it will make a copy\n return anObject;\n }\n else {\n return dict (anObject)\n }\n }\n __all__.__globals__ = __globals__\n \n // Partial implementation of super () .<methodName> (<params>)\n var __super__ = function (aClass, methodName) { \n // Lean and fast, no C3 linearization, only call first implementation encountered\n // Will allow __super__ ('<methodName>') (self, <params>) rather than only <className>.<methodName> (self, <params>)\n \n for (var index = 0; index < aClass.__bases__.length; index++) {\n var base = aClass.__bases__ [index];\n if (methodName in base) {\n return base [methodName];\n }\n }\n\n throw new Exception ('Superclass method not found'); // !!! Improve!\n }\n __all__.__super__ = __super__\n \n // Python property installer function, no member since that would bloat classes\n var property = function (getter, setter) { // Returns a property descriptor rather than a property\n if (!setter) { // ??? Make setter optional instead of dummy?\n setter = function () {};\n }\n return {get: function () {return getter (this)}, set: function (value) {setter (this, value)}, enumerable: true};\n }\n __all__.property = property;\n \n // Conditional JavaScript property installer function, prevents redefinition of properties if multiple Transcrypt apps are on one page\n var __setProperty__ = function (anObject, name, descriptor) {\n if (!anObject.hasOwnProperty (name)) {\n Object.defineProperty (anObject, name, descriptor);\n }\n }\n __all__.__setProperty__ = __setProperty__\n \n // Assert function, call to it only generated when compiling with --dassert option\n function assert (condition, message) { // Message may be undefined\n if (!condition) {\n throw AssertionError (message, new Error ());\n }\n }\n\n __all__.assert = assert;\n\n var __merge__ = function (object0, object1) {\n var result = {};\n for (var attrib in object0) {\n result [attrib] = object0 [attrib];\n }\n for (var attrib in object1) {\n result [attrib] = object1 [attrib];\n }\n return result;\n };\n __all__.__merge__ = __merge__;\n\n // Manipulating attributes by name\n \n var dir = function (obj) {\n var aList = [];\n for (var aKey in obj) {\n aList.push (aKey);\n }\n aList.sort ();\n return aList;\n };\n __all__.dir = dir;\n\n var setattr = function (obj, name, value) {\n obj [name] = value;\n };\n __all__.setattr = setattr;\n\n var getattr = function (obj, name) {\n return obj [name];\n };\n __all__.getattr= getattr;\n\n var hasattr = function (obj, name) {\n try {\n return name in obj;\n }\n catch (exception) {\n return false;\n }\n };\n __all__.hasattr = hasattr;\n\n var delattr = function (obj, name) {\n delete obj [name];\n };\n __all__.delattr = (delattr);\n\n // The __in__ function, used to mimic Python's 'in' operator\n // In addition to CPython's semantics, the 'in' operator is also allowed to work on objects, avoiding a counterintuitive separation between Python dicts and JavaScript objects\n // In general many Transcrypt compound types feature a deliberate blend of Python and JavaScript facilities, facilitating efficient integration with JavaScript libraries\n // If only Python objects and Python dicts are dealt with in a certain context, the more pythonic 'hasattr' is preferred for the objects as opposed to 'in' for the dicts\n var __in__ = function (element, container) {\n if (py_typeof (container) == dict) { // Currently only implemented as an augmented JavaScript object\n return container.hasOwnProperty (element);\n }\n else { // Parameter 'element' itself is an array, string or a plain, non-dict JavaScript object\n return (\n container.indexOf ? // If it has an indexOf\n container.indexOf (element) > -1 : // it's an array or a string,\n container.hasOwnProperty (element) // else it's a plain, non-dict JavaScript object\n );\n }\n };\n __all__.__in__ = __in__;\n\n // Find out if an attribute is special\n var __specialattrib__ = function (attrib) {\n return (attrib.startswith ('__') && attrib.endswith ('__')) || attrib == 'constructor' || attrib.startswith ('py_');\n };\n __all__.__specialattrib__ = __specialattrib__;\n\n // Len function for any object\n var len = function (anObject) {\n if (anObject) {\n var l = anObject.length;\n if (l == undefined) {\n var result = 0;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n result++;\n }\n }\n return result;\n }\n else {\n return l;\n }\n }\n else {\n return 0;\n }\n };\n __all__.len = len;\n\n // General conversions\n\n function __i__ (any) { // Conversion to iterable\n return py_typeof (any) == dict ? any.py_keys () : any;\n }\n\n function __t__ (any) { // Conversion to truthyness, __ ([1, 2, 3]) returns [1, 2, 3], needed for nonempty selection: l = list1 or list2]\n return (['boolean', 'number'] .indexOf (typeof any) >= 0 || any instanceof Function || len (any)) ? any : false;\n // JavaScript functions have a length attribute, denoting the number of parameters\n // Python objects are JavaScript functions, but their length doesn't matter, only their existence\n // By the term 'any instanceof Function' we make sure that Python objects aren't rejected when their length equals zero\n }\n __all__.__t__ = __t__;\n\n var bool = function (any) { // Always truly returns a bool, rather than something truthy or falsy\n return !!__t__ (any);\n };\n bool.__name__ = 'bool'; // So it can be used as a type with a name\n __all__.bool = bool;\n\n var float = function (any) {\n if (any == 'inf') {\n return Infinity;\n }\n else if (any == '-inf') {\n return -Infinity;\n }\n else if (isNaN (parseFloat (any))) { // Call to parseFloat needed to exclude '', ' ' etc.\n throw ValueError (new Error ());\n }\n else {\n return +any;\n }\n };\n float.__name__ = 'float';\n __all__.float = float;\n\n var int = function (any) {\n return float (any) | 0\n };\n int.__name__ = 'int';\n __all__.int = int;\n\n var py_typeof = function (anObject) {\n var aType = typeof anObject;\n if (aType == 'object') { // Directly trying '__class__ in anObject' turns out to wreck anObject in Chrome if its a primitive\n try {\n return anObject.__class__;\n }\n catch (exception) {\n return aType;\n }\n }\n else {\n return ( // Odly, the braces are required here\n aType == 'boolean' ? bool :\n aType == 'string' ? str :\n aType == 'number' ? (anObject % 1 == 0 ? int : float) :\n null\n );\n }\n };\n __all__.py_typeof = py_typeof;\n\n var isinstance = function (anObject, classinfo) {\n function isA (queryClass) {\n if (queryClass == classinfo) {\n return true;\n }\n for (var index = 0; index < queryClass.__bases__.length; index++) {\n if (isA (queryClass.__bases__ [index], classinfo)) {\n return true;\n }\n }\n return false;\n }\n\n if (classinfo instanceof Array) { // Assume in most cases it isn't, then making it recursive rather than two functions saves a call\n for (var index = 0; index < classinfo.length; index++) {\n var aClass = classinfo [index];\n if (isinstance (anObject, aClass)) {\n return true;\n }\n }\n return false;\n }\n\n try { // Most frequent use case first\n return '__class__' in anObject ? isA (anObject.__class__) : anObject instanceof classinfo;\n }\n catch (exception) { // Using isinstance on primitives assumed rare\n var aType = py_typeof (anObject);\n return aType == classinfo || (aType == bool && classinfo == int);\n }\n };\n __all__.isinstance = isinstance;\n\n var callable = function (anObject) {\n if ( typeof anObject == 'object' && '__call__' in anObject ) {\n return true;\n }\n else {\n return typeof anObject === 'function';\n }\n };\n __all__.callable = callable;\n\n // Repr function uses __repr__ method, then __str__, then toString\n var repr = function (anObject) {\n try {\n return anObject.__repr__ ();\n }\n catch (exception) {\n try {\n return anObject.__str__ ();\n }\n catch (exception) { // anObject has no __repr__ and no __str__\n try {\n if (anObject == null) {\n return 'None';\n }\n else if (anObject.constructor == Object) {\n var result = '{';\n var comma = false;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n if (attrib.isnumeric ()) {\n var attribRepr = attrib; // If key can be interpreted as numerical, we make it numerical\n } // So we accept that '1' is misrepresented as 1\n else {\n var attribRepr = '\\'' + attrib + '\\''; // Alpha key in dict\n }\n\n if (comma) {\n result += ', ';\n }\n else {\n comma = true;\n }\n result += attribRepr + ': ' + repr (anObject [attrib]);\n }\n }\n result += '}';\n return result;\n }\n else {\n return typeof anObject == 'boolean' ? anObject.toString () .capitalize () : anObject.toString ();\n }\n }\n catch (exception) {\n console.log ('ERROR: Could not evaluate repr (<object of type ' + typeof anObject + '>)');\n console.log (exception);\n return '???';\n }\n }\n }\n };\n __all__.repr = repr;\n\n // Char from Unicode or ASCII\n var chr = function (charCode) {\n return String.fromCharCode (charCode);\n };\n __all__.chr = chr;\n\n // Unicode or ASCII from char\n var ord = function (aChar) {\n return aChar.charCodeAt (0);\n };\n __all__.ord = ord;\n\n // Maximum of n numbers\n var max = Math.max;\n __all__.max = max;\n\n // Minimum of n numbers\n var min = Math.min;\n __all__.min = min;\n\n // Absolute value\n var abs = Math.abs;\n __all__.abs = abs;\n\n // Bankers rounding\n var round = function (number, ndigits) {\n if (ndigits) {\n var scale = Math.pow (10, ndigits);\n number *= scale;\n }\n\n var rounded = Math.round (number);\n if (rounded - number == 0.5 && rounded % 2) { // Has rounded up to odd, should have rounded down to even\n rounded -= 1;\n }\n\n if (ndigits) {\n rounded /= scale;\n }\n\n return rounded;\n };\n __all__.round = round;\n\n // BEGIN unified iterator model\n\n function __jsUsePyNext__ () { // Add as 'next' method to make Python iterator JavaScript compatible\n try {\n var result = this.__next__ ();\n return {value: result, done: false};\n }\n catch (exception) {\n return {value: undefined, done: true};\n }\n }\n\n function __pyUseJsNext__ () { // Add as '__next__' method to make JavaScript iterator Python compatible\n var result = this.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n\n function py_iter (iterable) { // Alias for Python's iter function, produces a universal iterator / iterable, usable in Python and JavaScript\n if (typeof iterable == 'string' || '__iter__' in iterable) { // JavaScript Array or string or Python iterable (string has no 'in')\n var result = iterable.__iter__ (); // Iterator has a __next__\n result.next = __jsUsePyNext__; // Give it a next\n }\n else if ('selector' in iterable) { // Assume it's a JQuery iterator\n var result = list (iterable) .__iter__ (); // Has a __next__\n result.next = __jsUsePyNext__; // Give it a next\n }\n else if ('next' in iterable) { // It's a JavaScript iterator already, maybe a generator, has a next and may have a __next__\n var result = iterable\n if (! ('__next__' in result)) { // If there's no danger of recursion\n result.__next__ = __pyUseJsNext__; // Give it a __next__\n }\n }\n else if (Symbol.iterator in iterable) { // It's a JavaScript iterable such as a typed array, but not an iterator\n var result = iterable [Symbol.iterator] (); // Has a next\n result.__next__ = __pyUseJsNext__; // Give it a __next__\n }\n else {\n throw IterableError (new Error ()); // No iterator at all\n }\n result [Symbol.iterator] = function () {return result;};\n return result;\n }\n\n function py_next (iterator) { // Called only in a Python context, could receive Python or JavaScript iterator\n try { // Primarily assume Python iterator, for max speed\n var result = iterator.__next__ ();\n }\n catch (exception) { // JavaScript iterators are the exception here\n var result = iterator.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n if (result == undefined) {\n throw StopIteration (new Error ());\n }\n else {\n return result;\n }\n }\n\n function __PyIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n\n __PyIterator__.prototype.__next__ = function () {\n if (this.index < this.iterable.length) {\n return this.iterable [this.index++];\n }\n else {\n throw StopIteration (new Error ());\n }\n };\n\n function __JsIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n\n __JsIterator__.prototype.next = function () {\n if (this.index < this.iterable.py_keys.length) {\n return {value: this.index++, done: false};\n }\n else {\n return {value: undefined, done: true};\n }\n };\n\n // END unified iterator model\n\n // Reversed function for arrays\n var py_reversed = function (iterable) {\n iterable = iterable.slice ();\n iterable.reverse ();\n return iterable;\n };\n __all__.py_reversed = py_reversed;\n\n // Zip method for arrays and strings\n var zip = function () {\n var args = [] .slice.call (arguments);\n for (var i = 0; i < args.length; i++) {\n if (typeof args [i] == 'string') {\n args [i] = args [i] .split ('');\n }\n }\n var shortest = args.length == 0 ? [] : args.reduce ( // Find shortest array in arguments\n function (array0, array1) {\n return array0.length < array1.length ? array0 : array1;\n }\n );\n return shortest.map ( // Map each element of shortest array\n function (current, index) { // To the result of this function\n return args.map ( // Map each array in arguments\n function (current) { // To the result of this function\n return current [index]; // Namely it's index't entry\n }\n );\n }\n );\n };\n __all__.zip = zip;\n\n // Range method, returning an array\n function range (start, stop, step) {\n if (stop == undefined) {\n // one param defined\n stop = start;\n start = 0;\n }\n if (step == undefined) {\n step = 1;\n }\n if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {\n return [];\n }\n var result = [];\n for (var i = start; step > 0 ? i < stop : i > stop; i += step) {\n result.push(i);\n }\n return result;\n };\n __all__.range = range;\n\n // Any, all and sum\n\n function any (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n if (bool (iterable [index])) {\n return true;\n }\n }\n return false;\n }\n function all (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n if (! bool (iterable [index])) {\n return false;\n }\n }\n return true;\n }\n function sum (iterable) {\n var result = 0;\n for (var index = 0; index < iterable.length; index++) {\n result += iterable [index];\n }\n return result;\n }\n\n __all__.any = any;\n __all__.all = all;\n __all__.sum = sum;\n\n // Enumerate method, returning a zipped list\n function enumerate (iterable) {\n return zip (range (len (iterable)), iterable);\n }\n __all__.enumerate = enumerate;\n\n // Shallow and deepcopy\n\n function copy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = anObject [attrib];\n }\n }\n return result;\n }\n }\n __all__.copy = copy;\n\n function deepcopy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = deepcopy (anObject [attrib]);\n }\n }\n return result;\n }\n }\n __all__.deepcopy = deepcopy;\n\n // List extensions to Array\n\n function list (iterable) { // All such creators should be callable without new\n var instance = iterable ? [] .slice.apply (iterable) : []; // Spread iterable, n.b. array.slice (), so array before dot\n // Sort is the normal JavaScript sort, Python sort is a non-member function\n return instance;\n }\n __all__.list = list;\n Array.prototype.__class__ = list; // All arrays are lists (not only if constructed by the list ctor), unless constructed otherwise\n list.__name__ = 'list';\n\n /*\n Array.from = function (iterator) { // !!! remove\n result = [];\n for (item of iterator) {\n result.push (item);\n }\n return result;\n }\n */\n\n Array.prototype.__iter__ = function () {return new __PyIterator__ (this);};\n\n Array.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n else if (stop > this.length) {\n stop = this.length;\n }\n\n var result = list ([]);\n for (var index = start; index < stop; index += step) {\n result.push (this [index]);\n }\n\n return result;\n };\n\n Array.prototype.__setslice__ = function (start, stop, step, source) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n\n if (step == null) { // Assign to 'ordinary' slice, replace subsequence\n Array.prototype.splice.apply (this, [start, stop - start] .concat (source));\n }\n else { // Assign to extended slice, replace designated items one by one\n var sourceIndex = 0;\n for (var targetIndex = start; targetIndex < stop; targetIndex += step) {\n this [targetIndex] = source [sourceIndex++];\n }\n }\n };\n\n Array.prototype.__repr__ = function () {\n if (this.__class__ == set && !this.length) {\n return 'set()';\n }\n\n var result = !this.__class__ || this.__class__ == list ? '[' : this.__class__ == tuple ? '(' : '{';\n\n for (var index = 0; index < this.length; index++) {\n if (index) {\n result += ', ';\n }\n result += repr (this [index]);\n }\n\n if (this.__class__ == tuple && this.length == 1) {\n result += ',';\n }\n\n result += !this.__class__ || this.__class__ == list ? ']' : this.__class__ == tuple ? ')' : '}';;\n return result;\n };\n\n Array.prototype.__str__ = Array.prototype.__repr__;\n\n Array.prototype.append = function (element) {\n this.push (element);\n };\n\n Array.prototype.clear = function () {\n this.length = 0;\n };\n\n Array.prototype.extend = function (aList) {\n this.push.apply (this, aList);\n };\n\n Array.prototype.insert = function (index, element) {\n this.splice (index, 0, element);\n };\n\n Array.prototype.remove = function (element) {\n var index = this.indexOf (element);\n if (index == -1) {\n throw ValueError (new Error ());\n }\n this.splice (index, 1);\n };\n\n Array.prototype.index = function (element) {\n return this.indexOf (element);\n };\n\n Array.prototype.py_pop = function (index) {\n if (index == undefined) {\n return this.pop (); // Remove last element\n }\n else {\n return this.splice (index, 1) [0];\n }\n };\n\n Array.prototype.py_sort = function () {\n __sort__.apply (null, [this].concat ([] .slice.apply (arguments))); // Can't work directly with arguments\n // Python params: (iterable, key = None, reverse = False)\n // py_sort is called with the Transcrypt kwargs mechanism, and just passes the params on to __sort__\n // __sort__ is def'ed with the Transcrypt kwargs mechanism\n };\n\n Array.prototype.__add__ = function (aList) {\n return list (this.concat (aList));\n };\n\n Array.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result.concat (this);\n }\n return result;\n };\n\n Array.prototype.__rmul__ = Array.prototype.__mul__;\n\n // Tuple extensions to Array\n\n function tuple (iterable) {\n var instance = iterable ? [] .slice.apply (iterable) : [];\n instance.__class__ = tuple; // Not all arrays are tuples\n return instance;\n }\n __all__.tuple = tuple;\n tuple.__name__ = 'tuple';\n\n // Set extensions to Array\n // N.B. Since sets are unordered, set operations will occasionally alter the 'this' array by sorting it\n\n function set (iterable) {\n var instance = [];\n if (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n instance.add (iterable [index]);\n }\n\n\n }\n instance.__class__ = set; // Not all arrays are sets\n return instance;\n }\n __all__.set = set;\n set.__name__ = 'set';\n\n Array.prototype.__bindexOf__ = function (element) { // Used to turn O (n^2) into O (n log n)\n // Since sorting is lex, compare has to be lex. This also allows for mixed lists\n\n element += '';\n\n var mindex = 0;\n var maxdex = this.length - 1;\n\n while (mindex <= maxdex) {\n var index = (mindex + maxdex) / 2 | 0;\n var middle = this [index] + '';\n\n if (middle < element) {\n mindex = index + 1;\n }\n else if (middle > element) {\n maxdex = index - 1;\n }\n else {\n return index;\n }\n }\n\n return -1;\n };\n\n Array.prototype.add = function (element) {\n if (this.indexOf (element) == -1) { // Avoid duplicates in set\n this.push (element);\n }\n };\n\n Array.prototype.discard = function (element) {\n var index = this.indexOf (element);\n if (index != -1) {\n this.splice (index, 1);\n }\n };\n\n Array.prototype.isdisjoint = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.issuperset = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) == -1) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.issubset = function (other) {\n return set (other.slice ()) .issuperset (this); // Sort copy of 'other', not 'other' itself, since it may be an ordered sequence\n };\n\n Array.prototype.union = function (other) {\n var result = set (this.slice () .sort ());\n for (var i = 0; i < other.length; i++) {\n if (result.__bindexOf__ (other [i]) == -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n\n Array.prototype.intersection = function (other) {\n this.sort ();\n var result = set ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n\n Array.prototype.difference = function (other) {\n var sother = set (other.slice () .sort ());\n var result = set ();\n for (var i = 0; i < this.length; i++) {\n if (sother.__bindexOf__ (this [i]) == -1) {\n result.push (this [i]);\n }\n }\n return result;\n };\n\n Array.prototype.symmetric_difference = function (other) {\n return this.union (other) .difference (this.intersection (other));\n };\n\n Array.prototype.py_update = function () { // O (n)\n var updated = [] .concat.apply (this.slice (), arguments) .sort ();\n this.clear ();\n for (var i = 0; i < updated.length; i++) {\n if (updated [i] != updated [i - 1]) {\n this.push (updated [i]);\n }\n }\n };\n\n Array.prototype.__eq__ = function (other) { // Also used for list\n if (this.length != other.length) {\n return false;\n }\n if (this.__class__ == set) {\n this.sort ();\n other.sort ();\n }\n for (var i = 0; i < this.length; i++) {\n if (this [i] != other [i]) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.__ne__ = function (other) { // Also used for list\n return !this.__eq__ (other);\n };\n\n Array.prototype.__le__ = function (other) {\n return this.issubset (other);\n };\n\n Array.prototype.__ge__ = function (other) {\n return this.issuperset (other);\n };\n\n Array.prototype.__lt__ = function (other) {\n return this.issubset (other) && !this.issuperset (other);\n };\n\n Array.prototype.__gt__ = function (other) {\n return this.issuperset (other) && !this.issubset (other);\n };\n\n // String extensions\n\n function str (stringable) {\n try {\n return stringable.__str__ ();\n }\n catch (exception) {\n try {\n return repr (stringable);\n }\n catch (exception) {\n return String (stringable); // No new, so no permanent String object but a primitive in a temporary 'just in time' wrapper\n }\n }\n };\n __all__.str = str;\n\n String.prototype.__class__ = str; // All strings are str\n str.__name__ = 'str';\n\n String.prototype.__iter__ = function () {new __PyIterator__ (this);};\n\n String.prototype.__repr__ = function () {\n return (this.indexOf ('\\'') == -1 ? '\\'' + this + '\\'' : '\"' + this + '\"') .py_replace ('\\t', '\\\\t') .py_replace ('\\n', '\\\\n');\n };\n\n String.prototype.__str__ = function () {\n return this;\n };\n\n String.prototype.capitalize = function () {\n return this.charAt (0).toUpperCase () + this.slice (1);\n };\n\n String.prototype.endswith = function (suffix) {\n return suffix == '' || this.slice (-suffix.length) == suffix;\n };\n\n String.prototype.find = function (sub, start) {\n return this.indexOf (sub, start);\n };\n\n String.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n\n var result = '';\n if (step == 1) {\n result = this.substring (start, stop);\n }\n else {\n for (var index = start; index < stop; index += step) {\n result = result.concat (this.charAt(index));\n }\n }\n return result;\n }\n\n // Since it's worthwhile for the 'format' function to be able to deal with *args, it is defined as a property\n // __get__ will produce a bound function if there's something before the dot\n // Since a call using *args is compiled to e.g. <object>.<function>.apply (null, args), the function has to be bound already\n // Otherwise it will never be, because of the null argument\n // Using 'this' rather than 'null' contradicts the requirement to be able to pass bound functions around\n // The object 'before the dot' won't be available at call time in that case, unless implicitly via the function bound to it\n // While for Python methods this mechanism is generated by the compiler, for JavaScript methods it has to be provided manually\n // Call memoizing is unattractive here, since every string would then have to hold a reference to a bound format method\n __setProperty__ (String.prototype, 'format', {\n get: function () {return __get__ (this, function (self) {\n var args = tuple ([] .slice.apply (arguments).slice (1));\n var autoIndex = 0;\n return self.replace (/\\{(\\w*)\\}/g, function (match, key) {\n if (key == '') {\n key = autoIndex++;\n }\n if (key == +key) { // So key is numerical\n return args [key] == undefined ? match : str (args [key]);\n }\n else { // Key is a string\n for (var index = 0; index < args.length; index++) {\n // Find first 'dict' that has that key and the right field\n if (typeof args [index] == 'object' && args [index][key] != undefined) {\n return str (args [index][key]); // Return that field field\n }\n }\n return match;\n }\n });\n });},\n enumerable: true\n });\n\n String.prototype.isnumeric = function () {\n return !isNaN (parseFloat (this)) && isFinite (this);\n };\n\n String.prototype.join = function (strings) {\n return strings.join (this);\n };\n\n String.prototype.lower = function () {\n return this.toLowerCase ();\n };\n\n String.prototype.py_replace = function (old, aNew, maxreplace) {\n return this.split (old, maxreplace) .join (aNew);\n };\n\n String.prototype.lstrip = function () {\n return this.replace (/^\\s*/g, '');\n };\n\n String.prototype.rfind = function (sub, start) {\n return this.lastIndexOf (sub, start);\n };\n\n String.prototype.rsplit = function (sep, maxsplit) { // Combination of general whitespace sep and positive maxsplit neither supported nor checked, expensive and rare\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n var maxrsplit = result.length - maxsplit;\n return [result.slice (0, maxrsplit) .join (sep)] .concat (result.slice (maxrsplit));\n }\n else {\n return result;\n }\n }\n };\n\n String.prototype.rstrip = function () {\n return this.replace (/\\s*$/g, '');\n };\n\n String.prototype.py_split = function (sep, maxsplit) { // Combination of general whitespace sep and positive maxsplit neither supported nor checked, expensive and rare\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n return result.slice (0, maxsplit).concat ([result.slice (maxsplit).join (sep)]);\n }\n else {\n return result;\n }\n }\n };\n\n String.prototype.startswith = function (prefix) {\n return this.indexOf (prefix) == 0;\n };\n\n String.prototype.strip = function () {\n return this.trim ();\n };\n\n String.prototype.upper = function () {\n return this.toUpperCase ();\n };\n\n String.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result + this;\n }\n return result;\n };\n\n String.prototype.__rmul__ = String.prototype.__mul__;\n\n // Dict extensions to object\n\n function __keys__ () {\n var keys = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n keys.push (attrib);\n }\n }\n return keys;\n }\n\n function __items__ () {\n var items = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n items.push ([attrib, this [attrib]]);\n }\n }\n return items;\n }\n\n function __del__ (key) {\n delete this [key];\n }\n\n function __clear__ () {\n for (var attrib in this) {\n delete this [attrib];\n }\n }\n\n function __getdefault__ (aKey, aDefault) { // Each Python object already has a function called __get__, so we call this one __getdefault__\n var result = this [aKey];\n return result == undefined ? (aDefault == undefined ? null : aDefault) : result;\n }\n\n function __setdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n return result;\n }\n var val = aDefault == undefined ? null : aDefault;\n this [aKey] = val;\n return val;\n }\n\n function __pop__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n delete this [aKey];\n return result;\n } else {\n // Identify check because user could pass None\n if ( aDefault === undefined ) {\n throw KeyError (aKey, new Error());\n }\n }\n return aDefault;\n }\n \n function __popitem__ () {\n var aKey = Object.keys (this) [0];\n if (aKey == null) {\n throw KeyError (aKey, new Error ());\n }\n var result = tuple ([aKey, this [aKey]]);\n delete this [aKey];\n return result;\n }\n \n function __update__ (aDict) {\n for (var aKey in aDict) {\n this [aKey] = aDict [aKey];\n }\n }\n \n function __values__ () {\n var values = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n values.push (this [attrib]);\n }\n }\n return values;\n\n }\n \n function __dgetitem__ (aKey) {\n return this [aKey];\n }\n \n function __dsetitem__ (aKey, aValue) {\n this [aKey] = aValue;\n }\n\n function dict (objectOrPairs) {\n var instance = {};\n if (!objectOrPairs || objectOrPairs instanceof Array) { // It's undefined or an array of pairs\n if (objectOrPairs) {\n for (var index = 0; index < objectOrPairs.length; index++) {\n var pair = objectOrPairs [index];\n if ( !(pair instanceof Array) || pair.length != 2) {\n throw ValueError(\n \"dict update sequence element #\" + index +\n \" has length \" + pair.length +\n \"; 2 is required\", new Error());\n }\n var key = pair [0];\n var val = pair [1];\n if (!(objectOrPairs instanceof Array) && objectOrPairs instanceof Object) {\n // User can potentially pass in an object\n // that has a hierarchy of objects. This\n // checks to make sure that these objects\n // get converted to dict objects instead of\n // leaving them as js objects.\n \n if (!isinstance (objectOrPairs, dict)) {\n val = dict (val);\n }\n }\n instance [key] = val;\n }\n }\n }\n else {\n if (isinstance (objectOrPairs, dict)) {\n // Passed object is a dict already so we need to be a little careful\n // N.B. - this is a shallow copy per python std - so\n // it is assumed that children have already become\n // python objects at some point.\n \n var aKeys = objectOrPairs.py_keys ();\n for (var index = 0; index < aKeys.length; index++ ) {\n var key = aKeys [index];\n instance [key] = objectOrPairs [key];\n }\n } else if (objectOrPairs instanceof Object) {\n // Passed object is a JavaScript object but not yet a dict, don't copy it\n instance = objectOrPairs;\n } else {\n // We have already covered Array so this indicates\n // that the passed object is not a js object - i.e.\n // it is an int or a string, which is invalid.\n \n throw ValueError (\"Invalid type of object for dict creation\", new Error ());\n }\n }\n\n // Trancrypt interprets e.g. {aKey: 'aValue'} as a Python dict literal rather than a JavaScript object literal\n // So dict literals rather than bare Object literals will be passed to JavaScript libraries\n // Some JavaScript libraries call all enumerable callable properties of an object that's passed to them\n // So the properties of a dict should be non-enumerable\n __setProperty__ (instance, '__class__', {value: dict, enumerable: false, writable: true});\n __setProperty__ (instance, 'py_keys', {value: __keys__, enumerable: false});\n __setProperty__ (instance, '__iter__', {value: function () {new __PyIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, Symbol.iterator, {value: function () {new __JsIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, 'py_items', {value: __items__, enumerable: false});\n __setProperty__ (instance, 'py_del', {value: __del__, enumerable: false});\n __setProperty__ (instance, 'py_clear', {value: __clear__, enumerable: false});\n __setProperty__ (instance, 'py_get', {value: __getdefault__, enumerable: false});\n __setProperty__ (instance, 'py_setdefault', {value: __setdefault__, enumerable: false});\n __setProperty__ (instance, 'py_pop', {value: __pop__, enumerable: false});\n __setProperty__ (instance, 'py_popitem', {value: __popitem__, enumerable: false});\n __setProperty__ (instance, 'py_update', {value: __update__, enumerable: false});\n __setProperty__ (instance, 'py_values', {value: __values__, enumerable: false});\n __setProperty__ (instance, '__getitem__', {value: __dgetitem__, enumerable: false}); // Needed since compound keys necessarily\n __setProperty__ (instance, '__setitem__', {value: __dsetitem__, enumerable: false}); // trigger overloading to deal with slices\n return instance;\n }\n\n __all__.dict = dict;\n dict.__name__ = 'dict';\n \n // Docstring setter\n\n function __setdoc__ (docString) {\n this.__doc__ = docString;\n return this;\n }\n\n // Python classes, methods and functions are all translated to JavaScript functions\n __setProperty__ (Function.prototype, '__setdoc__', {value: __setdoc__, enumerable: false});\n\n // General operator overloading, only the ones that make most sense in matrix and complex operations\n\n var __neg__ = function (a) {\n if (typeof a == 'object' && '__neg__' in a) {\n return a.__neg__ ();\n }\n else {\n return -a;\n }\n };\n __all__.__neg__ = __neg__;\n\n var __matmul__ = function (a, b) {\n return a.__matmul__ (b);\n };\n __all__.__matmul__ = __matmul__;\n\n var __pow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.pow = __pow__;\n\n var __jsmod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.__jsmod__ = __jsmod__;\n \n var __mod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.mod = __mod__;\n\n // Overloaded binary arithmetic\n \n var __mul__ = function (a, b) {\n if (typeof a == 'object' && '__mul__' in a) {\n return a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return b.__rmul__ (a);\n }\n else {\n return a * b;\n }\n };\n __all__.__mul__ = __mul__;\n\n var __div__ = function (a, b) {\n if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return a / b;\n }\n };\n __all__.__div__ = __div__;\n\n var __add__ = function (a, b) {\n if (typeof a == 'object' && '__add__' in a) {\n return a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return b.__radd__ (a);\n }\n else {\n return a + b;\n }\n };\n __all__.__add__ = __add__;\n\n var __sub__ = function (a, b) {\n if (typeof a == 'object' && '__sub__' in a) {\n return a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return b.__rsub__ (a);\n }\n else {\n return a - b;\n }\n };\n __all__.__sub__ = __sub__;\n\n // Overloaded binary bitwise\n \n var __lshift__ = function (a, b) {\n if (typeof a == 'object' && '__lshift__' in a) {\n return a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return b.__rlshift__ (a);\n }\n else {\n return a << b;\n }\n };\n __all__.__lshift__ = __lshift__;\n\n var __rshift__ = function (a, b) {\n if (typeof a == 'object' && '__rshift__' in a) {\n return a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return b.__rrshift__ (a);\n }\n else {\n return a >> b;\n }\n };\n __all__.__rshift__ = __rshift__;\n\n var __or__ = function (a, b) {\n if (typeof a == 'object' && '__or__' in a) {\n return a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return b.__ror__ (a);\n }\n else {\n return a | b;\n }\n };\n __all__.__or__ = __or__;\n\n var __xor__ = function (a, b) {\n if (typeof a == 'object' && '__xor__' in a) {\n return a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return b.__rxor__ (a);\n }\n else {\n return a ^ b;\n }\n };\n __all__.__xor__ = __xor__;\n\n var __and__ = function (a, b) {\n if (typeof a == 'object' && '__and__' in a) {\n return a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return b.__rand__ (a);\n }\n else {\n return a & b;\n }\n };\n __all__.__and__ = __and__; \n \n // Overloaded binary compare\n \n var __eq__ = function (a, b) {\n if (typeof a == 'object' && '__eq__' in a) {\n return a.__eq__ (b);\n }\n else {\n return a == b;\n }\n };\n __all__.__eq__ = __eq__;\n\n var __ne__ = function (a, b) {\n if (typeof a == 'object' && '__ne__' in a) {\n return a.__ne__ (b);\n }\n else {\n return a != b\n }\n };\n __all__.__ne__ = __ne__;\n\n var __lt__ = function (a, b) {\n if (typeof a == 'object' && '__lt__' in a) {\n return a.__lt__ (b);\n }\n else {\n return a < b;\n }\n };\n __all__.__lt__ = __lt__;\n\n var __le__ = function (a, b) {\n if (typeof a == 'object' && '__le__' in a) {\n return a.__le__ (b);\n }\n else {\n return a <= b;\n }\n };\n __all__.__le__ = __le__;\n\n var __gt__ = function (a, b) {\n if (typeof a == 'object' && '__gt__' in a) {\n return a.__gt__ (b);\n }\n else {\n return a > b;\n }\n };\n __all__.__gt__ = __gt__;\n\n var __ge__ = function (a, b) {\n if (typeof a == 'object' && '__ge__' in a) {\n return a.__ge__ (b);\n }\n else {\n return a >= b;\n }\n };\n __all__.__ge__ = __ge__;\n \n // Overloaded augmented general\n \n var __imatmul__ = function (a, b) {\n if ('__imatmul__' in a) {\n return a.__imatmul__ (b);\n }\n else {\n return a.__matmul__ (b);\n }\n };\n __all__.__imatmul__ = __imatmul__;\n\n var __ipow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__ipow__ (b);\n }\n else if (typeof a == 'object' && '__ipow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.ipow = __ipow__;\n\n var __ijsmod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__ismod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.ijsmod__ = __ijsmod__;\n \n var __imod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__imod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.imod = __imod__;\n \n // Overloaded augmented arithmetic\n \n var __imul__ = function (a, b) {\n if (typeof a == 'object' && '__imul__' in a) {\n return a.__imul__ (b);\n }\n else if (typeof a == 'object' && '__mul__' in a) {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return a = b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return a = b.__rmul__ (a);\n }\n else {\n return a *= b;\n }\n };\n __all__.__imul__ = __imul__;\n\n var __idiv__ = function (a, b) {\n if (typeof a == 'object' && '__idiv__' in a) {\n return a.__idiv__ (b);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a = a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return a = b.__rdiv__ (a);\n }\n else {\n return a /= b;\n }\n };\n __all__.__idiv__ = __idiv__;\n\n var __iadd__ = function (a, b) {\n if (typeof a == 'object' && '__iadd__' in a) {\n return a.__iadd__ (b);\n }\n else if (typeof a == 'object' && '__add__' in a) {\n return a = a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return a = b.__radd__ (a);\n }\n else {\n return a += b;\n }\n };\n __all__.__iadd__ = __iadd__;\n\n var __isub__ = function (a, b) {\n if (typeof a == 'object' && '__isub__' in a) {\n return a.__isub__ (b);\n }\n else if (typeof a == 'object' && '__sub__' in a) {\n return a = a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return a = b.__rsub__ (a);\n }\n else {\n return a -= b;\n }\n };\n __all__.__isub__ = __isub__;\n\n // Overloaded augmented bitwise\n \n var __ilshift__ = function (a, b) {\n if (typeof a == 'object' && '__ilshift__' in a) {\n return a.__ilshift__ (b);\n }\n else if (typeof a == 'object' && '__lshift__' in a) {\n return a = a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return a = b.__rlshift__ (a);\n }\n else {\n return a <<= b;\n }\n };\n __all__.__ilshift__ = __ilshift__;\n\n var __irshift__ = function (a, b) {\n if (typeof a == 'object' && '__irshift__' in a) {\n return a.__irshift__ (b);\n }\n else if (typeof a == 'object' && '__rshift__' in a) {\n return a = a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return a = b.__rrshift__ (a);\n }\n else {\n return a >>= b;\n }\n };\n __all__.__irshift__ = __irshift__;\n\n var __ior__ = function (a, b) {\n if (typeof a == 'object' && '__ior__' in a) {\n return a.__ior__ (b);\n }\n else if (typeof a == 'object' && '__or__' in a) {\n return a = a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return a = b.__ror__ (a);\n }\n else {\n return a |= b;\n }\n };\n __all__.__ior__ = __ior__;\n\n var __ixor__ = function (a, b) {\n if (typeof a == 'object' && '__ixor__' in a) {\n return a.__ixor__ (b);\n }\n else if (typeof a == 'object' && '__xor__' in a) {\n return a = a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return a = b.__rxor__ (a);\n }\n else {\n return a ^= b;\n }\n };\n __all__.__ixor__ = __ixor__;\n\n var __iand__ = function (a, b) {\n if (typeof a == 'object' && '__iand__' in a) {\n return a.__iand__ (b);\n }\n else if (typeof a == 'object' && '__and__' in a) {\n return a = a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return a = b.__rand__ (a);\n }\n else {\n return a &= b;\n }\n };\n __all__.__iand__ = __iand__;\n \n // Indices and slices\n\n var __getitem__ = function (container, key) { // Slice c.q. index, direct generated call to runtime switch\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ (key); // Overloaded on container\n }\n else {\n return container [key]; // Container must support bare JavaScript brackets\n }\n };\n __all__.__getitem__ = __getitem__;\n\n var __setitem__ = function (container, key, value) { // Slice c.q. index, direct generated call to runtime switch\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ (key, value); // Overloaded on container\n }\n else {\n container [key] = value; // Container must support bare JavaScript brackets\n }\n };\n __all__.__setitem__ = __setitem__;\n\n var __getslice__ = function (container, lower, upper, step) { // Slice only, no index, direct generated call to runtime switch\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ ([lower, upper, step]); // Container supports overloaded slicing c.q. indexing\n }\n else {\n return container.__getslice__ (lower, upper, step); // Container only supports slicing injected natively in prototype\n }\n };\n __all__.__getslice__ = __getslice__;\n\n var __setslice__ = function (container, lower, upper, step, value) { // Slice, no index, direct generated call to runtime switch\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ ([lower, upper, step], value); // Container supports overloaded slicing c.q. indexing\n }\n else {\n container.__setslice__ (lower, upper, step, value); // Container only supports slicing injected natively in prototype\n }\n };\n __all__.__setslice__ = __setslice__;\n\n\t__nest__ (\n\t\t__all__,\n\t\t'line', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar Vector = __init__ (__world__.vector).Vector;\n\t\t\t\t\tvar Line = __class__ ('Line', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, vec, offset) {\n\t\t\t\t\t\t\tself.vec = Vector (vec).normalize ();\n\t\t\t\t\t\t\tself.offset = Vector (offset);\n\t\t\t\t\t\t\tself.offset = __sub__ (self.offset, __mul__ (self.vec, __call__ (self.offset.dot, self.offset, self.vec)));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getXYZ () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar param = list ([0, 1]);\n\t\t\t\t\t\t\tvar vec = self.vec.vec;\n\t\t\t\t\t\t\tvar off = self.offset.vec;\n\t\t\t\t\t\t\tvar x = function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = param;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar t = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (off [0] + t * vec [0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ();\n\t\t\t\t\t\t\tvar y = function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = param;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar t = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (off [1] + t * vec [1]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ();\n\t\t\t\t\t\t\tvar z = function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = param;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar t = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (off [2] + t * vec [2]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ();\n\t\t\t\t\t\t\treturn tuple ([x, y, z]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget goify () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __left0__ = self.getXYZ (layout);\n\t\t\t\t\t\t\tvar x = __left0__ [0];\n\t\t\t\t\t\t\tvar y = __left0__ [1];\n\t\t\t\t\t\t\tvar z = __left0__ [2];\n\t\t\t\t\t\t\tvar line = dict ({'mode': 'lines', 'x': list (x), 'y': list (y), 'z': list (z), 'line': dict (__kwargtrans__ ({color: 'rgb(205, 12, 24)', width: 10}))});\n\t\t\t\t\t\t\treturn line;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'vector' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.Line = Line;\n\t\t\t\t\t\t__all__.Vector = Vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'plane', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar Vector = __init__ (__world__.vector).Vector;\n\t\t\t\t\tvar Plane = __class__ ('Plane', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, normal, offset) {\n\t\t\t\t\t\t\tself.normal = Vector (normal).normalize ();\n\t\t\t\t\t\t\tself.offset = Vector (offset);\n\t\t\t\t\t\t\tself.offset = __mul__ (__call__ (self.offset.dot, self.offset, self.normal), self.normal);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getXYZ () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar mesh2d = function (xlim, ylim) {\n\t\t\t\t\t\t\t\tvar xx = list ([list ([xlim [0], xlim [1]]), list ([xlim [0], xlim [1]])]);\n\t\t\t\t\t\t\t\tvar yy = list ([list ([ylim [0], ylim [0]]), list ([ylim [1], ylim [1]])]);\n\t\t\t\t\t\t\t\treturn tuple ([xx, yy]);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar calc = function (x, y, z, normal, offset) {\n\t\t\t\t\t\t\t\tvar unknown = ((normal.dot (offset) - normal.vec [0] * x) - normal.vec [1] * y) - normal.vec [2] * z;\n\t\t\t\t\t\t\t\treturn unknown;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar xlim = list ([-(1), 1]);\n\t\t\t\t\t\t\tvar ylim = list ([-(1), 1]);\n\t\t\t\t\t\t\tvar zlim = list ([-(1), 1]);\n\t\t\t\t\t\t\tvar n = self.normal;\n\t\t\t\t\t\t\tvar off = self.offset;\n\t\t\t\t\t\t\tif (n.vec [2] == 0) {\n\t\t\t\t\t\t\t\tif (n.vec [1] == 0) {\n\t\t\t\t\t\t\t\t\tif (n.vec [0] == 0) {\n\t\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Normal vector is zero vector.');\n\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tvar __left0__ = mesh2d (ylim, zlim);\n\t\t\t\t\t\t\t\t\t\tvar yy = __left0__ [0];\n\t\t\t\t\t\t\t\t\t\tvar zz = __left0__ [1];\n\t\t\t\t\t\t\t\t\t\tvar xx = list ([list ([null, null]), list ([null, null])]);\n\t\t\t\t\t\t\t\t\t\tvar __iterable0__ = list ([0, 1]);\n\t\t\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t\t\tvar __iterable1__ = list ([0, 1]);\n\t\t\t\t\t\t\t\t\t\t\tfor (var __index1__ = 0; __index1__ < __iterable1__.length; __index1__++) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar j = __iterable1__ [__index1__];\n\t\t\t\t\t\t\t\t\t\t\t\txx [i] [j] = calc (0, yy [i] [j], zz [i] [j], n, off);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __left0__ = mesh2d (xlim, zlim);\n\t\t\t\t\t\t\t\t\tvar xx = __left0__ [0];\n\t\t\t\t\t\t\t\t\tvar zz = __left0__ [1];\n\t\t\t\t\t\t\t\t\tvar yy = list ([list ([null, null]), list ([null, null])]);\n\t\t\t\t\t\t\t\t\tvar __iterable0__ = list ([0, 1]);\n\t\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t\tvar __iterable1__ = list ([0, 1]);\n\t\t\t\t\t\t\t\t\t\tfor (var __index1__ = 0; __index1__ < __iterable1__.length; __index1__++) {\n\t\t\t\t\t\t\t\t\t\t\tvar j = __iterable1__ [__index1__];\n\t\t\t\t\t\t\t\t\t\t\tyy [i] [j] = calc (xx [i] [j], 0, zz [i] [j], n, off);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar __left0__ = mesh2d (xlim, ylim);\n\t\t\t\t\t\t\t\tvar xx = __left0__ [0];\n\t\t\t\t\t\t\t\tvar yy = __left0__ [1];\n\t\t\t\t\t\t\t\tvar zz = list ([list ([null, null]), list ([null, null])]);\n\t\t\t\t\t\t\t\tvar __iterable0__ = list ([0, 1]);\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\tvar __iterable1__ = list ([0, 1]);\n\t\t\t\t\t\t\t\t\tfor (var __index1__ = 0; __index1__ < __iterable1__.length; __index1__++) {\n\t\t\t\t\t\t\t\t\t\tvar j = __iterable1__ [__index1__];\n\t\t\t\t\t\t\t\t\t\tzz [i] [j] = calc (xx [i] [j], yy [i] [j], 0, n, off);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tuple ([xx, yy, zz]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget goify () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __left0__ = self.getXYZ (layout);\n\t\t\t\t\t\t\tvar xx = __left0__ [0];\n\t\t\t\t\t\t\tvar yy = __left0__ [1];\n\t\t\t\t\t\t\tvar zz = __left0__ [2];\n\t\t\t\t\t\t\tvar surf = dict (__kwargtrans__ ({py_metatype: 'surface', x: xx, y: yy, z: zz}));\n\t\t\t\t\t\t\treturn surf;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'vector' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.Plane = Plane;\n\t\t\t\t\t\t__all__.Vector = Vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'plputils', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar close = function (a, b, threshold) {\n\t\t\t\t\t\tif (typeof threshold == 'undefined' || (threshold != null && threshold .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar threshold = 1e-06;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar N = len (a);\n\t\t\t\t\t\tvar ans = list ([]);\n\t\t\t\t\t\tif (N != len (b)) {\n\t\t\t\t\t\t\tvar __except0__ = ValueError ('Dimensions mismatch');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (var idx = 0; idx < N; idx++) {\n\t\t\t\t\t\t\tans.append (numbersclose (a [idx], b [idx], threshold));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn ans;\n\t\t\t\t\t};\n\t\t\t\t\tvar numbersclose = function (a, b, threshold) {\n\t\t\t\t\t\tif (typeof threshold == 'undefined' || (threshold != null && threshold .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar threshold = 1e-06;\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn abs (a - b) < threshold;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.close = close;\n\t\t\t\t\t\t__all__.numbersclose = numbersclose;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'point', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar Vector = __init__ (__world__.vector).Vector;\n\t\t\t\t\tvar Point = __class__ ('Point', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, position) {\n\t\t\t\t\t\t\tself.pos = Vector (position);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getXYZ () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar pos = self.pos.vec;\n\t\t\t\t\t\t\treturn tuple ([list ([pos [0]]), list ([pos [1]]), list ([pos [2]])]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget goify () {return __get__ (this, function (self, layout) {\n\t\t\t\t\t\t\tif (typeof layout == 'undefined' || (layout != null && layout .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar layout = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __left0__ = self.getXYZ (layout);\n\t\t\t\t\t\t\tvar x = __left0__ [0];\n\t\t\t\t\t\t\tvar y = __left0__ [1];\n\t\t\t\t\t\t\tvar z = __left0__ [2];\n\t\t\t\t\t\t\tvar pt = dict ({'type': 'scatter3d', 'mode': 'markers', 'x': x, 'y': y, 'z': z});\n\t\t\t\t\t\t\treturn pt;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'vector' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.Point = Point;\n\t\t\t\t\t\t__all__.Vector = Vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'vector', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar plputils = {};\n\t\t\t\t\t__nest__ (plputils, '', __init__ (__world__.plputils));\n\t\t\t\t\tvar Vector = __class__ ('Vector', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, vec) {\n\t\t\t\t\t\t\tself.vec = vec;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __add__ () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\tvar N = len (self.vec);\n\t\t\t\t\t\t\tvar ans = list ([]);\n\t\t\t\t\t\t\tif (N != len (other.vec)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Dimensions mismatch');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (var idx = 0; idx < N; idx++) {\n\t\t\t\t\t\t\t\tans.append (self.vec [idx] + other.vec [idx]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Vector (ans);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __sub__ () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\treturn self.__add__ (other.__neg__ ());\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __neg__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar ans = list ([]);\n\t\t\t\t\t\t\tfor (var idx = 0; idx < len (self.vec); idx++) {\n\t\t\t\t\t\t\t\tans.append (-(self.vec [idx]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Vector (ans);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget mul () {return __get__ (this, function (self, num) {\n\t\t\t\t\t\t\tvar new_vec = function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = self.vec;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (num * i);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ();\n\t\t\t\t\t\t\treturn Vector (new_vec);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __mul__ () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\treturn self.mul (other);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __rmul__ () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\treturn self.__mul__ (other);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn 'Vector: ' + str (self.vec);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget dot () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\tvar N = len (self.vec);\n\t\t\t\t\t\t\tvar ans = list ([]);\n\t\t\t\t\t\t\tif (N != len (other.vec)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Dimensions mismatch');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (var idx = 0; idx < N; idx++) {\n\t\t\t\t\t\t\t\tans.append (self.vec [idx] * other.vec [idx]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn float (sum (ans));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget cross () {return __get__ (this, function (self, other) {\n\t\t\t\t\t\t\tvar a = self.vec;\n\t\t\t\t\t\t\tvar b = other.vec;\n\t\t\t\t\t\t\tif (len (a) != 3 || len (b) != 3) {\n\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Dimensions mismatch: cross product only works in 3d');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn Vector (list ([a [1] * b [2] - a [2] * b [1], a [0] * b [2] - a [2] * b [0], a [0] * b [1] - a [1] * b [0]]));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget normalize () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar magnitude = self.norm ();\n\t\t\t\t\t\t\tif (plputils.numbersclose (magnitude, 0.0)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Zero vector cannot be normalized.');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn Vector (function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tvar __iterable0__ = self.vec;\n\t\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (i / magnitude);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t} ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget norm () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn Math.pow (sum (function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = self.vec;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < __iterable0__.length; __index0__++) {\n\t\t\t\t\t\t\t\t\tvar i = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (Math.pow (i, 2));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ()), 0.5);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'plputils' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.Vector = Vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t(function () {\n\t\tvar line = {};\n\t\tvar plane = {};\n\t\tvar point = {};\n\t\tvar point_test = function () {\n\t\t\t__nest__ (point, '', __init__ (__world__.point));\n\t\t\tvar x = __call__ (float, null, __call__ (document.getElementById, document, 'point_x').value);\n\t\t\tvar y = __call__ (float, null, __call__ (document.getElementById, document, 'point_y').value);\n\t\t\tvar z = __call__ (float, null, __call__ (document.getElementById, document, 'point_z').value);\n\t\t\tvar pt = __call__ (point.Point, point, list ([x, y, z]));\n\t\t\t__call__ (document.getElementById, document, 'point_pos').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'Position', pt.pos);\n\t\t\t__call__ (document.getElementById, document, 'point_getXYZ').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'getXYZ()', __call__ (pt.getXYZ, pt));\n\t\t\t__call__ (document.getElementById, document, 'point_goify').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'goify()', __call__ (pt.goify, pt));\n\t\t\t__call__ (Plotly.plot, Plotly, 'scatter3d', __call__ (pt.goify, pt));\n\t\t};\n\t\tvar line_test = function () {\n\t\t\t__nest__ (line, '', __init__ (__world__.line));\n\t\t\tvar vx = __call__ (float, null, __call__ (document.getElementById, document, 'line_dir_x').value);\n\t\t\tvar vy = __call__ (float, null, __call__ (document.getElementById, document, 'line_dir_y').value);\n\t\t\tvar vz = __call__ (float, null, __call__ (document.getElementById, document, 'line_dir_z').value);\n\t\t\tvar ox = __call__ (float, null, __call__ (document.getElementById, document, 'line_off_x').value);\n\t\t\tvar oy = __call__ (float, null, __call__ (document.getElementById, document, 'line_off_y').value);\n\t\t\tvar oz = __call__ (float, null, __call__ (document.getElementById, document, 'line_off_z').value);\n\t\t\tvar lin = __call__ (line.Line, line, list ([vx, vy, vz]), list ([ox, oy, oz]));\n\t\t\t__call__ (document.getElementById, document, 'line_dir').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'Direction', lin.vec);\n\t\t\t__call__ (document.getElementById, document, 'line_off').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'Offset', lin.offset);\n\t\t\t__call__ (document.getElementById, document, 'line_getXYZ').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'getXYZ()', __call__ (lin.getXYZ, lin));\n\t\t\t__call__ (document.getElementById, document, 'line_goify').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'goify()', __call__ (lin.goify, lin));\n\t\t};\n\t\tvar plane_test = function () {\n\t\t\t__nest__ (plane, '', __init__ (__world__.plane));\n\t\t\tvar nx = __call__ (float, null, __call__ (document.getElementById, document, 'plane_n_x').value);\n\t\t\tvar ny = __call__ (float, null, __call__ (document.getElementById, document, 'plane_n_y').value);\n\t\t\tvar nz = __call__ (float, null, __call__ (document.getElementById, document, 'plane_n_z').value);\n\t\t\tvar ox = __call__ (float, null, __call__ (document.getElementById, document, 'plane_off_x').value);\n\t\t\tvar oy = __call__ (float, null, __call__ (document.getElementById, document, 'plane_off_y').value);\n\t\t\tvar oz = __call__ (float, null, __call__ (document.getElementById, document, 'plane_off_z').value);\n\t\t\tvar pl = __call__ (plane.Plane, plane, list ([nx, ny, nz]), list ([ox, oy, oz]));\n\t\t\t__call__ (document.getElementById, document, 'plane_normal').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'Normal', pl.normal);\n\t\t\t__call__ (document.getElementById, document, 'plane_off').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'Offset', pl.offset);\n\t\t\t__call__ (document.getElementById, document, 'plane_getXYZ').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'getXYZ()', __call__ (pl.getXYZ, pl));\n\t\t\t__call__ (document.getElementById, document, 'plane_goify').innerHTML = __call__ ('{}: {}'.format, '{}: {}', 'goify()', __call__ (pl.goify, pl));\n\t\t};\n\t\t__pragma__ ('<use>' +\n\t\t\t'line' +\n\t\t\t'plane' +\n\t\t\t'point' +\n\t\t'</use>')\n\t\t__pragma__ ('<all>')\n\t\t\t__all__.line_test = line_test;\n\t\t\t__all__.plane_test = plane_test;\n\t\t\t__all__.point_test = point_test;\n\t\t__pragma__ ('</all>')\n\t}) ();\n return __all__;\n}", "title": "" }, { "docid": "6c4ea071937c952a31afd4ac101fff0f", "score": "0.5598967", "text": "function __init__ () {\n var __symbols__ = ['__py3.6__', '__esv6__'];\n var __all__ = {};\n var __world__ = __all__;\n var __nest__ = function (headObject, tailNames, value) {\n var current = headObject;\n if (tailNames != '') {\n var tailChain = tailNames.split ('.');\n var firstNewIndex = tailChain.length;\n for (var index = 0; index < tailChain.length; index++) {\n if (!current.hasOwnProperty (tailChain [index])) {\n firstNewIndex = index;\n break;\n }\n current = current [tailChain [index]];\n }\n for (var index = firstNewIndex; index < tailChain.length; index++) {\n current [tailChain [index]] = {};\n current = current [tailChain [index]];\n }\n }\n for (var attrib in value) {\n current [attrib] = value [attrib];\n }\n };\n __all__.__nest__ = __nest__;\n var __init__ = function (module) {\n if (!module.__inited__) {\n module.__all__.__init__ (module.__all__);\n module.__inited__ = true;\n }\n return module.__all__;\n };\n __all__.__init__ = __init__;\n var __proxy__ = false;\n var __get__ = function (self, func, quotedFuncName) {\n if (self) {\n if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {\n if (quotedFuncName) {\n Object.defineProperty (self, quotedFuncName, {\n value: function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n },\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n };\n }\n else {\n return func;\n }\n }\n else {\n return func;\n }\n }\n __all__.__get__ = __get__;\n var __getcm__ = function (self, func, quotedFuncName) {\n if (self.hasOwnProperty ('__class__')) {\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self.__class__] .concat (args));\n };\n }\n else {\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n };\n }\n }\n __all__.__getcm__ = __getcm__;\n var __getsm__ = function (self, func, quotedFuncName) {\n return func;\n }\n __all__.__getsm__ = __getsm__;\n var py_metatype = {\n __name__: 'type',\n __bases__: [],\n __new__: function (meta, name, bases, attribs) {\n var cls = function () {\n var args = [] .slice.apply (arguments);\n return cls.__new__ (args);\n };\n for (var index = bases.length - 1; index >= 0; index--) {\n var base = bases [index];\n for (var attrib in base) {\n var descrip = Object.getOwnPropertyDescriptor (base, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n for (let symbol of Object.getOwnPropertySymbols (base)) {\n let descrip = Object.getOwnPropertyDescriptor (base, symbol);\n Object.defineProperty (cls, symbol, descrip);\n }\n }\n cls.__metaclass__ = meta;\n cls.__name__ = name.startsWith ('py_') ? name.slice (3) : name;\n cls.__bases__ = bases;\n for (var attrib in attribs) {\n var descrip = Object.getOwnPropertyDescriptor (attribs, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n for (let symbol of Object.getOwnPropertySymbols (attribs)) {\n let descrip = Object.getOwnPropertyDescriptor (attribs, symbol);\n Object.defineProperty (cls, symbol, descrip);\n }\n return cls;\n }\n };\n py_metatype.__metaclass__ = py_metatype;\n __all__.py_metatype = py_metatype;\n var object = {\n __init__: function (self) {},\n __metaclass__: py_metatype,\n __name__: 'object',\n __bases__: [],\n __new__: function (args) {\n var instance = Object.create (this, {__class__: {value: this, enumerable: true}});\n if ('__getattr__' in this || '__setattr__' in this) {\n instance = new Proxy (instance, {\n get: function (target, name) {\n let result = target [name];\n if (result == undefined) {\n return target.__getattr__ (name);\n }\n else {\n return result;\n }\n },\n set: function (target, name, value) {\n try {\n target.__setattr__ (name, value);\n }\n catch (exception) {\n target [name] = value;\n }\n return true;\n }\n })\n }\n this.__init__.apply (null, [instance] .concat (args));\n return instance;\n }\n };\n __all__.object = object;\n var __class__ = function (name, bases, attribs, meta) {\n if (meta === undefined) {\n meta = bases [0] .__metaclass__;\n }\n return meta.__new__ (meta, name, bases, attribs);\n }\n __all__.__class__ = __class__;\n var __pragma__ = function () {};\n __all__.__pragma__ = __pragma__;\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__base__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'org.transcrypt.__base__';\n\t\t\t\t\tvar __Envir__ = __class__ ('__Envir__', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.interpreter_name = 'python';\n\t\t\t\t\t\t\tself.transpiler_name = 'transcrypt';\n\t\t\t\t\t\t\tself.transpiler_version = '3.6.101';\n\t\t\t\t\t\t\tself.target_subdir = '__javascript__';\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __envir__ = __Envir__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__Envir__ = __Envir__;\n\t\t\t\t\t\t__all__.__envir__ = __envir__;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__standard__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'org.transcrypt.__standard__';\n\t\t\t\t\tvar Exception = __class__ ('Exception', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.__args__ = args;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.stack = kwargs.error.stack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.stack = 'No stack trace available';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn '{}{}'.format (self.__class__.__name__, repr (tuple (self.__args__)));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '{}()'.format (self.__class__.__name__);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__) > 1) {\n\t\t\t\t\t\t\t\treturn str (tuple (self.__args__));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn str (self.__args__ [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IterableError = __class__ ('IterableError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, \"Can't iterate over non-iterable\", __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StopIteration = __class__ ('StopIteration', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Iterator exhausted', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ValueError = __class__ ('ValueError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar KeyError = __class__ ('KeyError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AssertionError = __class__ ('AssertionError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tif (message) {\n\t\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tException.__init__ (self, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar NotImplementedError = __class__ ('NotImplementedError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IndexError = __class__ ('IndexError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AttributeError = __class__ ('AttributeError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar py_TypeError = __class__ ('py_TypeError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Warning = __class__ ('Warning', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar UserWarning = __class__ ('UserWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar DeprecationWarning = __class__ ('DeprecationWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar RuntimeWarning = __class__ ('RuntimeWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar __sort__ = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key) {\n\t\t\t\t\t\t\titerable.sort ((function __lambda__ (a, b) {\n\t\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'a': var a = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'b': var b = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (key (a) > key (b) ? 1 : -(1));\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\titerable.sort ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (reverse) {\n\t\t\t\t\t\t\titerable.reverse ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar sorted = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (py_typeof (iterable) == dict) {\n\t\t\t\t\t\t\tvar result = copy (iterable.py_keys ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar result = copy (iterable);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__sort__ (result, key, reverse);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t\tvar map = function (func, iterable) {\n\t\t\t\t\t\treturn (function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var item of iterable) {\n\t\t\t\t\t\t\t\t__accu0__.append (func (item));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ();\n\t\t\t\t\t};\n\t\t\t\t\tvar filter = function (func, iterable) {\n\t\t\t\t\t\tif (func == null) {\n\t\t\t\t\t\t\tvar func = bool;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var item of iterable) {\n\t\t\t\t\t\t\t\tif (func (item)) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ();\n\t\t\t\t\t};\n\t\t\t\t\tvar __Terminal__ = __class__ ('__Terminal__', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.buffer = '';\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.element = document.getElementById ('__terminal__');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.element = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.style.overflowX = 'auto';\n\t\t\t\t\t\t\t\tself.element.style.boxSizing = 'border-box';\n\t\t\t\t\t\t\t\tself.element.style.padding = '5px';\n\t\t\t\t\t\t\t\tself.element.innerHTML = '_';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget print () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar sep = ' ';\n\t\t\t\t\t\t\tvar end = '\\n';\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'sep': var sep = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'end': var end = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.buffer = '{}{}{}'.format (self.buffer, sep.join ((function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tfor (var arg of args) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t}) ()), end).__getslice__ (-(4096), null, 1);\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.innerHTML = self.buffer.py_replace ('\\n', '<br>').py_replace (' ', '&nbsp');\n\t\t\t\t\t\t\t\tself.element.scrollTop = self.element.scrollHeight;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tconsole.log (sep.join ((function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tfor (var arg of args) {\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t}) ()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget input () {return __get__ (this, function (self, question) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'question': var question = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.print ('{}'.format (question), __kwargtrans__ ({end: ''}));\n\t\t\t\t\t\t\tvar answer = window.prompt ('\\n'.join (self.buffer.py_split ('\\n').__getslice__ (-(16), null, 1)));\n\t\t\t\t\t\t\tself.print (answer);\n\t\t\t\t\t\t\treturn answer;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __terminal__ = __Terminal__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AssertionError = AssertionError;\n\t\t\t\t\t\t__all__.AttributeError = AttributeError;\n\t\t\t\t\t\t__all__.DeprecationWarning = DeprecationWarning;\n\t\t\t\t\t\t__all__.Exception = Exception;\n\t\t\t\t\t\t__all__.IndexError = IndexError;\n\t\t\t\t\t\t__all__.IterableError = IterableError;\n\t\t\t\t\t\t__all__.KeyError = KeyError;\n\t\t\t\t\t\t__all__.NotImplementedError = NotImplementedError;\n\t\t\t\t\t\t__all__.RuntimeWarning = RuntimeWarning;\n\t\t\t\t\t\t__all__.StopIteration = StopIteration;\n\t\t\t\t\t\t__all__.py_TypeError = py_TypeError;\n\t\t\t\t\t\t__all__.UserWarning = UserWarning;\n\t\t\t\t\t\t__all__.ValueError = ValueError;\n\t\t\t\t\t\t__all__.Warning = Warning;\n\t\t\t\t\t\t__all__.__Terminal__ = __Terminal__;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.__sort__ = __sort__;\n\t\t\t\t\t\t__all__.__terminal__ = __terminal__;\n\t\t\t\t\t\t__all__.filter = filter;\n\t\t\t\t\t\t__all__.map = map;\n\t\t\t\t\t\t__all__.sorted = sorted;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n var __call__ = function (/* <callee>, <this>, <params>* */) {\n var args = [] .slice.apply (arguments);\n if (typeof args [0] == 'object' && '__call__' in args [0]) {\n return args [0] .__call__ .apply (args [1], args.slice (2));\n }\n else {\n return args [0] .apply (args [1], args.slice (2));\n }\n };\n __all__.__call__ = __call__;\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__base__));\n var __envir__ = __all__.__envir__;\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__standard__));\n var Exception = __all__.Exception;\n var IterableError = __all__.IterableError;\n var StopIteration = __all__.StopIteration;\n var ValueError = __all__.ValueError;\n var KeyError = __all__.KeyError;\n var AssertionError = __all__.AssertionError;\n var NotImplementedError = __all__.NotImplementedError;\n var IndexError = __all__.IndexError;\n var AttributeError = __all__.AttributeError;\n var py_TypeError = __all__.py_TypeError;\n var Warning = __all__.Warning;\n var UserWarning = __all__.UserWarning;\n var DeprecationWarning = __all__.DeprecationWarning;\n var RuntimeWarning = __all__.RuntimeWarning;\n var __sort__ = __all__.__sort__;\n var sorted = __all__.sorted;\n var map = __all__.map;\n var filter = __all__.filter;\n __all__.print = __all__.__terminal__.print;\n __all__.input = __all__.__terminal__.input;\n var __terminal__ = __all__.__terminal__;\n var print = __all__.print;\n var input = __all__.input;\n __envir__.executor_name = __envir__.transpiler_name;\n var __main__ = {__file__: ''};\n __all__.main = __main__;\n var __except__ = null;\n __all__.__except__ = __except__;\n var __kwargtrans__ = function (anObject) {\n anObject.__kwargtrans__ = null;\n anObject.constructor = Object;\n return anObject;\n }\n __all__.__kwargtrans__ = __kwargtrans__;\n var __globals__ = function (anObject) {\n if (isinstance (anObject, dict)) {\n return anObject;\n }\n else {\n return dict (anObject)\n }\n }\n __all__.__globals__ = __globals__\n var __super__ = function (aClass, methodName) {\n for (let base of aClass.__bases__) {\n if (methodName in base) {\n return base [methodName];\n }\n }\n throw new Exception ('Superclass method not found');\n }\n __all__.__super__ = __super__\n var property = function (getter, setter) {\n if (!setter) {\n setter = function () {};\n }\n return {get: function () {return getter (this)}, set: function (value) {setter (this, value)}, enumerable: true};\n }\n __all__.property = property;\n var __setProperty__ = function (anObject, name, descriptor) {\n if (!anObject.hasOwnProperty (name)) {\n Object.defineProperty (anObject, name, descriptor);\n }\n }\n __all__.__setProperty__ = __setProperty__\n function assert (condition, message) {\n if (!condition) {\n throw AssertionError (message, new Error ());\n }\n }\n __all__.assert = assert;\n var __merge__ = function (object0, object1) {\n var result = {};\n for (var attrib in object0) {\n result [attrib] = object0 [attrib];\n }\n for (var attrib in object1) {\n result [attrib] = object1 [attrib];\n }\n return result;\n };\n __all__.__merge__ = __merge__;\n var dir = function (obj) {\n var aList = [];\n for (var aKey in obj) {\n aList.push (aKey.startsWith ('py_') ? aKey.slice (3) : aKey);\n }\n aList.sort ();\n return aList;\n };\n __all__.dir = dir;\n var setattr = function (obj, name, value) {\n obj [name] = value;\n };\n __all__.setattr = setattr;\n var getattr = function (obj, name) {\n return name in obj ? obj [name] : obj ['py_' + name];\n };\n __all__.getattr = getattr;\n var hasattr = function (obj, name) {\n try {\n return name in obj || 'py_' + name in obj;\n }\n catch (exception) {\n return false;\n }\n };\n __all__.hasattr = hasattr;\n var delattr = function (obj, name) {\n if (name in obj) {\n delete obj [name];\n }\n else {\n delete obj ['py_' + name];\n }\n };\n __all__.delattr = (delattr);\n var __in__ = function (element, container) {\n if (container === undefined || container === null) {\n return false;\n }\n if (container.__contains__ instanceof Function) {\n return container.__contains__ (element);\n }\n else {\n return (\n container.indexOf ?\n container.indexOf (element) > -1 :\n container.hasOwnProperty (element)\n );\n }\n };\n __all__.__in__ = __in__;\n var __specialattrib__ = function (attrib) {\n return (attrib.startswith ('__') && attrib.endswith ('__')) || attrib == 'constructor' || attrib.startswith ('py_');\n };\n __all__.__specialattrib__ = __specialattrib__;\n var len = function (anObject) {\n if (anObject === undefined || anObject === null) {\n return 0;\n }\n if (anObject.__len__ instanceof Function) {\n return anObject.__len__ ();\n }\n if (anObject.length !== undefined) {\n return anObject.length;\n }\n var length = 0;\n for (var attr in anObject) {\n if (!__specialattrib__ (attr)) {\n length++;\n }\n }\n return length;\n };\n __all__.len = len;\n function __i__ (any) {\n return py_typeof (any) == dict ? any.py_keys () : any;\n }\n function __k__ (keyed, key) {\n var result = keyed [key];\n if (typeof result == 'undefined') {\n if (keyed instanceof Array)\n if (key == +key && key >= 0 && keyed.length > key)\n return result;\n else\n throw IndexError (key, new Error());\n else\n throw KeyError (key, new Error());\n }\n return result;\n }\n function __t__ (target) {\n return (\n target === undefined || target === null ? false :\n ['boolean', 'number'] .indexOf (typeof target) >= 0 ? target :\n target.__bool__ instanceof Function ? (target.__bool__ () ? target : false) :\n target.__len__ instanceof Function ? (target.__len__ () !== 0 ? target : false) :\n target instanceof Function ? target :\n len (target) !== 0 ? target :\n false\n );\n }\n __all__.__t__ = __t__;\n var float = function (any) {\n if (any == 'inf') {\n return Infinity;\n }\n else if (any == '-inf') {\n return -Infinity;\n }\n else if (any == 'nan') {\n return NaN;\n }\n else if (isNaN (parseFloat (any))) {\n if (any === false) {\n return 0;\n }\n else if (any === true) {\n return 1;\n }\n else {\n throw ValueError (\"could not convert string to float: '\" + str(any) + \"'\", new Error ());\n }\n }\n else {\n return +any;\n }\n };\n float.__name__ = 'float';\n float.__bases__ = [object];\n __all__.float = float;\n var int = function (any) {\n return float (any) | 0\n };\n int.__name__ = 'int';\n int.__bases__ = [object];\n __all__.int = int;\n var bool = function (any) {\n return !!__t__ (any);\n };\n bool.__name__ = 'bool';\n bool.__bases__ = [int];\n __all__.bool = bool;\n var py_typeof = function (anObject) {\n var aType = typeof anObject;\n if (aType == 'object') {\n try {\n return '__class__' in anObject ? anObject.__class__ : object;\n }\n catch (exception) {\n return aType;\n }\n }\n else {\n return (\n aType == 'boolean' ? bool :\n aType == 'string' ? str :\n aType == 'number' ? (anObject % 1 == 0 ? int : float) :\n null\n );\n }\n };\n __all__.py_typeof = py_typeof;\n var issubclass = function (aClass, classinfo) {\n if (classinfo instanceof Array) {\n for (let aClass2 of classinfo) {\n if (issubclass (aClass, aClass2)) {\n return true;\n }\n }\n return false;\n }\n try {\n var aClass2 = aClass;\n if (aClass2 == classinfo) {\n return true;\n }\n else {\n var bases = [].slice.call (aClass2.__bases__);\n while (bases.length) {\n aClass2 = bases.shift ();\n if (aClass2 == classinfo) {\n return true;\n }\n if (aClass2.__bases__.length) {\n bases = [].slice.call (aClass2.__bases__).concat (bases);\n }\n }\n return false;\n }\n }\n catch (exception) {\n return aClass == classinfo || classinfo == object;\n }\n };\n __all__.issubclass = issubclass;\n var isinstance = function (anObject, classinfo) {\n try {\n return '__class__' in anObject ? issubclass (anObject.__class__, classinfo) : issubclass (py_typeof (anObject), classinfo);\n }\n catch (exception) {\n return issubclass (py_typeof (anObject), classinfo);\n }\n };\n __all__.isinstance = isinstance;\n var callable = function (anObject) {\n return anObject && typeof anObject == 'object' && '__call__' in anObject ? true : typeof anObject === 'function';\n };\n __all__.callable = callable;\n var repr = function (anObject) {\n try {\n return anObject.__repr__ ();\n }\n catch (exception) {\n try {\n return anObject.__str__ ();\n }\n catch (exception) {\n try {\n if (anObject == null) {\n return 'None';\n }\n else if (anObject.constructor == Object) {\n var result = '{';\n var comma = false;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n if (attrib.isnumeric ()) {\n var attribRepr = attrib;\n }\n else {\n var attribRepr = '\\'' + attrib + '\\'';\n }\n if (comma) {\n result += ', ';\n }\n else {\n comma = true;\n }\n result += attribRepr + ': ' + repr (anObject [attrib]);\n }\n }\n result += '}';\n return result;\n }\n else {\n return typeof anObject == 'boolean' ? anObject.toString () .capitalize () : anObject.toString ();\n }\n }\n catch (exception) {\n return '<object of type: ' + typeof anObject + '>';\n }\n }\n }\n };\n __all__.repr = repr;\n var chr = function (charCode) {\n return String.fromCharCode (charCode);\n };\n __all__.chr = chr;\n var ord = function (aChar) {\n return aChar.charCodeAt (0);\n };\n __all__.ord = ord;\n var max = function (nrOrSeq) {\n return arguments.length == 1 ? Math.max (...nrOrSeq) : Math.max (...arguments);\n };\n __all__.max = max;\n var min = function (nrOrSeq) {\n return arguments.length == 1 ? Math.min (...nrOrSeq) : Math.min (...arguments);\n };\n __all__.min = min;\n var abs = Math.abs;\n __all__.abs = abs;\n var round = function (number, ndigits) {\n if (ndigits) {\n var scale = Math.pow (10, ndigits);\n number *= scale;\n }\n var rounded = Math.round (number);\n if (rounded - number == 0.5 && rounded % 2) {\n rounded -= 1;\n }\n if (ndigits) {\n rounded /= scale;\n }\n return rounded;\n };\n __all__.round = round;\n function __jsUsePyNext__ () {\n try {\n var result = this.__next__ ();\n return {value: result, done: false};\n }\n catch (exception) {\n return {value: undefined, done: true};\n }\n }\n function __pyUseJsNext__ () {\n var result = this.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n function py_iter (iterable) {\n if (typeof iterable == 'string' || '__iter__' in iterable) {\n var result = iterable.__iter__ ();\n result.next = __jsUsePyNext__;\n }\n else if ('selector' in iterable) {\n var result = list (iterable) .__iter__ ();\n result.next = __jsUsePyNext__;\n }\n else if ('next' in iterable) {\n var result = iterable\n if (! ('__next__' in result)) {\n result.__next__ = __pyUseJsNext__;\n }\n }\n else if (Symbol.iterator in iterable) {\n var result = iterable [Symbol.iterator] ();\n result.__next__ = __pyUseJsNext__;\n }\n else {\n throw IterableError (new Error ());\n }\n result [Symbol.iterator] = function () {return result;};\n return result;\n }\n function py_next (iterator) {\n try {\n var result = iterator.__next__ ();\n }\n catch (exception) {\n var result = iterator.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n if (result == undefined) {\n throw StopIteration (new Error ());\n }\n else {\n return result;\n }\n }\n function __PyIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n __PyIterator__.prototype.__next__ = function () {\n if (this.index < this.iterable.length) {\n return this.iterable [this.index++];\n }\n else {\n throw StopIteration (new Error ());\n }\n };\n function __JsIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n __JsIterator__.prototype.next = function () {\n if (this.index < this.iterable.py_keys.length) {\n return {value: this.index++, done: false};\n }\n else {\n return {value: undefined, done: true};\n }\n };\n var py_reversed = function (iterable) {\n iterable = iterable.slice ();\n iterable.reverse ();\n return iterable;\n };\n __all__.py_reversed = py_reversed;\n var zip = function () {\n var args = [] .slice.call (arguments);\n for (var i = 0; i < args.length; i++) {\n if (typeof args [i] == 'string') {\n args [i] = args [i] .split ('');\n }\n else if (!Array.isArray (args [i])) {\n args [i] = Array.from (args [i]);\n }\n }\n var shortest = args.length == 0 ? [] : args.reduce (\n function (array0, array1) {\n return array0.length < array1.length ? array0 : array1;\n }\n );\n return shortest.map (\n function (current, index) {\n return args.map (\n function (current) {\n return current [index];\n }\n );\n }\n );\n };\n __all__.zip = zip;\n function range (start, stop, step) {\n if (stop == undefined) {\n stop = start;\n start = 0;\n }\n if (step == undefined) {\n step = 1;\n }\n if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {\n return [];\n }\n var result = [];\n for (var i = start; step > 0 ? i < stop : i > stop; i += step) {\n result.push(i);\n }\n return result;\n };\n __all__.range = range;\n function any (iterable) {\n for (let item of iterable) {\n if (bool (item)) {\n return true;\n }\n }\n return false;\n }\n function all (iterable) {\n for (let item of iterable) {\n if (! bool (item)) {\n return false;\n }\n }\n return true;\n }\n function sum (iterable) {\n let result = 0;\n for (let item of iterable) {\n result += item;\n }\n return result;\n }\n __all__.any = any;\n __all__.all = all;\n __all__.sum = sum;\n function enumerate (iterable) {\n return zip (range (len (iterable)), iterable);\n }\n __all__.enumerate = enumerate;\n function copy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = anObject [attrib];\n }\n }\n return result;\n }\n }\n __all__.copy = copy;\n function deepcopy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = deepcopy (anObject [attrib]);\n }\n }\n return result;\n }\n }\n __all__.deepcopy = deepcopy;\n function list (iterable) {\n var instance = iterable ? Array.from (iterable) : [];\n return instance;\n }\n __all__.list = list;\n Array.prototype.__class__ = list;\n list.__name__ = 'list';\n list.__bases__ = [object];\n Array.prototype.__iter__ = function () {return new __PyIterator__ (this);};\n Array.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n else if (stop > this.length) {\n stop = this.length;\n }\n var result = list ([]);\n for (var index = start; index < stop; index += step) {\n result.push (this [index]);\n }\n return result;\n };\n Array.prototype.__setslice__ = function (start, stop, step, source) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n if (step == null) {\n Array.prototype.splice.apply (this, [start, stop - start] .concat (source));\n }\n else {\n var sourceIndex = 0;\n for (var targetIndex = start; targetIndex < stop; targetIndex += step) {\n this [targetIndex] = source [sourceIndex++];\n }\n }\n };\n Array.prototype.__repr__ = function () {\n if (this.__class__ == set && !this.length) {\n return 'set()';\n }\n var result = !this.__class__ || this.__class__ == list ? '[' : this.__class__ == tuple ? '(' : '{';\n for (var index = 0; index < this.length; index++) {\n if (index) {\n result += ', ';\n }\n result += repr (this [index]);\n }\n if (this.__class__ == tuple && this.length == 1) {\n result += ',';\n }\n result += !this.__class__ || this.__class__ == list ? ']' : this.__class__ == tuple ? ')' : '}';;\n return result;\n };\n Array.prototype.__str__ = Array.prototype.__repr__;\n Array.prototype.append = function (element) {\n this.push (element);\n };\n Array.prototype.py_clear = function () {\n this.length = 0;\n };\n Array.prototype.extend = function (aList) {\n this.push.apply (this, aList);\n };\n Array.prototype.insert = function (index, element) {\n this.splice (index, 0, element);\n };\n Array.prototype.remove = function (element) {\n var index = this.indexOf (element);\n if (index == -1) {\n throw ValueError (\"list.remove(x): x not in list\", new Error ());\n }\n this.splice (index, 1);\n };\n Array.prototype.index = function (element) {\n return this.indexOf (element);\n };\n Array.prototype.py_pop = function (index) {\n if (index == undefined) {\n return this.pop ();\n }\n else {\n return this.splice (index, 1) [0];\n }\n };\n Array.prototype.py_sort = function () {\n __sort__.apply (null, [this].concat ([] .slice.apply (arguments)));\n };\n Array.prototype.__add__ = function (aList) {\n return list (this.concat (aList));\n };\n Array.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result.concat (this);\n }\n return result;\n };\n Array.prototype.__rmul__ = Array.prototype.__mul__;\n function tuple (iterable) {\n var instance = iterable ? [] .slice.apply (iterable) : [];\n instance.__class__ = tuple;\n return instance;\n }\n __all__.tuple = tuple;\n tuple.__name__ = 'tuple';\n tuple.__bases__ = [object];\n function set (iterable) {\n var instance = [];\n if (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n instance.add (iterable [index]);\n }\n }\n instance.__class__ = set;\n return instance;\n }\n __all__.set = set;\n set.__name__ = 'set';\n set.__bases__ = [object];\n Array.prototype.__bindexOf__ = function (element) {\n element += '';\n var mindex = 0;\n var maxdex = this.length - 1;\n while (mindex <= maxdex) {\n var index = (mindex + maxdex) / 2 | 0;\n var middle = this [index] + '';\n if (middle < element) {\n mindex = index + 1;\n }\n else if (middle > element) {\n maxdex = index - 1;\n }\n else {\n return index;\n }\n }\n return -1;\n };\n Array.prototype.add = function (element) {\n if (this.indexOf (element) == -1) {\n this.push (element);\n }\n };\n Array.prototype.discard = function (element) {\n var index = this.indexOf (element);\n if (index != -1) {\n this.splice (index, 1);\n }\n };\n Array.prototype.isdisjoint = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.issuperset = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) == -1) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.issubset = function (other) {\n return set (other.slice ()) .issuperset (this);\n };\n Array.prototype.union = function (other) {\n var result = set (this.slice () .sort ());\n for (var i = 0; i < other.length; i++) {\n if (result.__bindexOf__ (other [i]) == -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n Array.prototype.intersection = function (other) {\n this.sort ();\n var result = set ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n Array.prototype.difference = function (other) {\n var sother = set (other.slice () .sort ());\n var result = set ();\n for (var i = 0; i < this.length; i++) {\n if (sother.__bindexOf__ (this [i]) == -1) {\n result.push (this [i]);\n }\n }\n return result;\n };\n Array.prototype.symmetric_difference = function (other) {\n return this.union (other) .difference (this.intersection (other));\n };\n Array.prototype.py_update = function () {\n var updated = [] .concat.apply (this.slice (), arguments) .sort ();\n this.py_clear ();\n for (var i = 0; i < updated.length; i++) {\n if (updated [i] != updated [i - 1]) {\n this.push (updated [i]);\n }\n }\n };\n Array.prototype.__eq__ = function (other) {\n if (this.length != other.length) {\n return false;\n }\n if (this.__class__ == set) {\n this.sort ();\n other.sort ();\n }\n for (var i = 0; i < this.length; i++) {\n if (this [i] != other [i]) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.__ne__ = function (other) {\n return !this.__eq__ (other);\n };\n Array.prototype.__le__ = function (other) {\n return this.issubset (other);\n };\n Array.prototype.__ge__ = function (other) {\n return this.issuperset (other);\n };\n Array.prototype.__lt__ = function (other) {\n return this.issubset (other) && !this.issuperset (other);\n };\n Array.prototype.__gt__ = function (other) {\n return this.issuperset (other) && !this.issubset (other);\n };\n function bytearray (bytable, encoding) {\n if (bytable == undefined) {\n return new Uint8Array (0);\n }\n else {\n var aType = py_typeof (bytable);\n if (aType == int) {\n return new Uint8Array (bytable);\n }\n else if (aType == str) {\n var aBytes = new Uint8Array (len (bytable));\n for (var i = 0; i < len (bytable); i++) {\n aBytes [i] = bytable.charCodeAt (i);\n }\n return aBytes;\n }\n else if (aType == list || aType == tuple) {\n return new Uint8Array (bytable);\n }\n else {\n throw py_TypeError;\n }\n }\n }\n var bytes = bytearray;\n __all__.bytearray = bytearray;\n __all__.bytes = bytearray;\n Uint8Array.prototype.__add__ = function (aBytes) {\n var result = new Uint8Array (this.length + aBytes.length);\n result.set (this);\n result.set (aBytes, this.length);\n return result;\n };\n Uint8Array.prototype.__mul__ = function (scalar) {\n var result = new Uint8Array (scalar * this.length);\n for (var i = 0; i < scalar; i++) {\n result.set (this, i * this.length);\n }\n return result;\n };\n Uint8Array.prototype.__rmul__ = Uint8Array.prototype.__mul__;\n function str (stringable) {\n if (typeof stringable === 'number')\n return stringable.toString();\n else {\n try {\n return stringable.__str__ ();\n }\n catch (exception) {\n try {\n return repr (stringable);\n }\n catch (exception) {\n return String (stringable);\n }\n }\n }\n };\n __all__.str = str;\n String.prototype.__class__ = str;\n str.__name__ = 'str';\n str.__bases__ = [object];\n String.prototype.__iter__ = function () {new __PyIterator__ (this);};\n String.prototype.__repr__ = function () {\n return (this.indexOf ('\\'') == -1 ? '\\'' + this + '\\'' : '\"' + this + '\"') .py_replace ('\\t', '\\\\t') .py_replace ('\\n', '\\\\n');\n };\n String.prototype.__str__ = function () {\n return this;\n };\n String.prototype.capitalize = function () {\n return this.charAt (0).toUpperCase () + this.slice (1);\n };\n String.prototype.endswith = function (suffix) {\n if (suffix instanceof Array) {\n for (var i=0;i<suffix.length;i++) {\n if (this.slice (-suffix[i].length) == suffix[i])\n return true;\n }\n } else\n return suffix == '' || this.slice (-suffix.length) == suffix;\n return false;\n };\n String.prototype.find = function (sub, start) {\n return this.indexOf (sub, start);\n };\n String.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n var result = '';\n if (step == 1) {\n result = this.substring (start, stop);\n }\n else {\n for (var index = start; index < stop; index += step) {\n result = result.concat (this.charAt(index));\n }\n }\n return result;\n };\n __setProperty__ (String.prototype, 'format', {\n get: function () {return __get__ (this, function (self) {\n var args = tuple ([] .slice.apply (arguments).slice (1));\n var autoIndex = 0;\n return self.replace (/\\{(\\w*)\\}/g, function (match, key) {\n if (key == '') {\n key = autoIndex++;\n }\n if (key == +key) {\n return args [key] == undefined ? match : str (args [key]);\n }\n else {\n for (var index = 0; index < args.length; index++) {\n if (typeof args [index] == 'object' && args [index][key] != undefined) {\n return str (args [index][key]);\n }\n }\n return match;\n }\n });\n });},\n enumerable: true\n });\n String.prototype.isalnum = function () {\n return /^[0-9a-zA-Z]{1,}$/.test(this)\n }\n String.prototype.isalpha = function () {\n return /^[a-zA-Z]{1,}$/.test(this)\n }\n String.prototype.isdecimal = function () {\n return /^[0-9]{1,}$/.test(this)\n }\n String.prototype.isdigit = function () {\n return this.isdecimal()\n }\n String.prototype.islower = function () {\n return /^[a-z]{1,}$/.test(this)\n }\n String.prototype.isupper = function () {\n return /^[A-Z]{1,}$/.test(this)\n }\n String.prototype.isspace = function () {\n return /^[\\s]{1,}$/.test(this)\n }\n String.prototype.isnumeric = function () {\n return !isNaN (parseFloat (this)) && isFinite (this);\n };\n String.prototype.join = function (strings) {\n strings = Array.from (strings);\n return strings.join (this);\n };\n String.prototype.lower = function () {\n return this.toLowerCase ();\n };\n String.prototype.py_replace = function (old, aNew, maxreplace) {\n return this.split (old, maxreplace) .join (aNew);\n };\n String.prototype.lstrip = function () {\n return this.replace (/^\\s*/g, '');\n };\n String.prototype.rfind = function (sub, start) {\n return this.lastIndexOf (sub, start);\n };\n String.prototype.rsplit = function (sep, maxsplit) {\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n var maxrsplit = result.length - maxsplit;\n return [result.slice (0, maxrsplit) .join (sep)] .concat (result.slice (maxrsplit));\n }\n else {\n return result;\n }\n }\n };\n String.prototype.rstrip = function () {\n return this.replace (/\\s*$/g, '');\n };\n String.prototype.py_split = function (sep, maxsplit) {\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n return result.slice (0, maxsplit).concat ([result.slice (maxsplit).join (sep)]);\n }\n else {\n return result;\n }\n }\n };\n String.prototype.startswith = function (prefix) {\n if (prefix instanceof Array) {\n for (var i=0;i<prefix.length;i++) {\n if (this.indexOf (prefix [i]) == 0)\n return true;\n }\n } else\n return this.indexOf (prefix) == 0;\n return false;\n };\n String.prototype.strip = function () {\n return this.trim ();\n };\n String.prototype.upper = function () {\n return this.toUpperCase ();\n };\n String.prototype.__mul__ = function (scalar) {\n var result = '';\n for (var i = 0; i < scalar; i++) {\n result = result + this;\n }\n return result;\n };\n String.prototype.__rmul__ = String.prototype.__mul__;\n function __contains__ (element) {\n return this.hasOwnProperty (element);\n }\n function __keys__ () {\n var keys = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n keys.push (attrib);\n }\n }\n return keys;\n }\n function __items__ () {\n var items = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n items.push ([attrib, this [attrib]]);\n }\n }\n return items;\n }\n function __del__ (key) {\n delete this [key];\n }\n function __clear__ () {\n for (var attrib in this) {\n delete this [attrib];\n }\n }\n function __getdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result == undefined) {\n result = this ['py_' + aKey]\n }\n return result == undefined ? (aDefault == undefined ? null : aDefault) : result;\n }\n function __setdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n return result;\n }\n var val = aDefault == undefined ? null : aDefault;\n this [aKey] = val;\n return val;\n }\n function __pop__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n delete this [aKey];\n return result;\n } else {\n if ( aDefault === undefined ) {\n throw KeyError (aKey, new Error());\n }\n }\n return aDefault;\n }\n function __popitem__ () {\n var aKey = Object.keys (this) [0];\n if (aKey == null) {\n throw KeyError (\"popitem(): dictionary is empty\", new Error ());\n }\n var result = tuple ([aKey, this [aKey]]);\n delete this [aKey];\n return result;\n }\n function __update__ (aDict) {\n for (var aKey in aDict) {\n this [aKey] = aDict [aKey];\n }\n }\n function __values__ () {\n var values = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n values.push (this [attrib]);\n }\n }\n return values;\n }\n function __dgetitem__ (aKey) {\n return this [aKey];\n }\n function __dsetitem__ (aKey, aValue) {\n this [aKey] = aValue;\n }\n function dict (objectOrPairs) {\n var instance = {};\n if (!objectOrPairs || objectOrPairs instanceof Array) {\n if (objectOrPairs) {\n for (var index = 0; index < objectOrPairs.length; index++) {\n var pair = objectOrPairs [index];\n if ( !(pair instanceof Array) || pair.length != 2) {\n throw ValueError(\n \"dict update sequence element #\" + index +\n \" has length \" + pair.length +\n \"; 2 is required\", new Error());\n }\n var key = pair [0];\n var val = pair [1];\n if (!(objectOrPairs instanceof Array) && objectOrPairs instanceof Object) {\n if (!isinstance (objectOrPairs, dict)) {\n val = dict (val);\n }\n }\n instance [key] = val;\n }\n }\n }\n else {\n if (isinstance (objectOrPairs, dict)) {\n var aKeys = objectOrPairs.py_keys ();\n for (var index = 0; index < aKeys.length; index++ ) {\n var key = aKeys [index];\n instance [key] = objectOrPairs [key];\n }\n } else if (objectOrPairs instanceof Object) {\n instance = objectOrPairs;\n } else {\n throw ValueError (\"Invalid type of object for dict creation\", new Error ());\n }\n }\n __setProperty__ (instance, '__class__', {value: dict, enumerable: false, writable: true});\n __setProperty__ (instance, '__contains__', {value: __contains__, enumerable: false});\n __setProperty__ (instance, 'py_keys', {value: __keys__, enumerable: false});\n __setProperty__ (instance, '__iter__', {value: function () {new __PyIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, Symbol.iterator, {value: function () {new __JsIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, 'py_items', {value: __items__, enumerable: false});\n __setProperty__ (instance, 'py_del', {value: __del__, enumerable: false});\n __setProperty__ (instance, 'py_clear', {value: __clear__, enumerable: false});\n __setProperty__ (instance, 'py_get', {value: __getdefault__, enumerable: false});\n __setProperty__ (instance, 'py_setdefault', {value: __setdefault__, enumerable: false});\n __setProperty__ (instance, 'py_pop', {value: __pop__, enumerable: false});\n __setProperty__ (instance, 'py_popitem', {value: __popitem__, enumerable: false});\n __setProperty__ (instance, 'py_update', {value: __update__, enumerable: false});\n __setProperty__ (instance, 'py_values', {value: __values__, enumerable: false});\n __setProperty__ (instance, '__getitem__', {value: __dgetitem__, enumerable: false});\n __setProperty__ (instance, '__setitem__', {value: __dsetitem__, enumerable: false});\n return instance;\n }\n __all__.dict = dict;\n dict.__name__ = 'dict';\n dict.__bases__ = [object];\n function __setdoc__ (docString) {\n this.__doc__ = docString;\n return this;\n }\n __setProperty__ (Function.prototype, '__setdoc__', {value: __setdoc__, enumerable: false});\n var __jsmod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.__jsmod__ = __jsmod__;\n var __mod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.mod = __mod__;\n var __pow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.pow = __pow__;\n var __neg__ = function (a) {\n if (typeof a == 'object' && '__neg__' in a) {\n return a.__neg__ ();\n }\n else {\n return -a;\n }\n };\n __all__.__neg__ = __neg__;\n var __matmul__ = function (a, b) {\n return a.__matmul__ (b);\n };\n __all__.__matmul__ = __matmul__;\n var __mul__ = function (a, b) {\n if (typeof a == 'object' && '__mul__' in a) {\n return a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return b.__rmul__ (a);\n }\n else {\n return a * b;\n }\n };\n __all__.__mul__ = __mul__;\n var __truediv__ = function (a, b) {\n if (typeof a == 'object' && '__truediv__' in a) {\n return a.__truediv__ (b);\n }\n else if (typeof b == 'object' && '__rtruediv__' in b) {\n return b.__rtruediv__ (a);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return a / b;\n }\n };\n __all__.__truediv__ = __truediv__;\n var __floordiv__ = function (a, b) {\n if (typeof a == 'object' && '__floordiv__' in a) {\n return a.__floordiv__ (b);\n }\n else if (typeof b == 'object' && '__rfloordiv__' in b) {\n return b.__rfloordiv__ (a);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return Math.floor (a / b);\n }\n };\n __all__.__floordiv__ = __floordiv__;\n var __add__ = function (a, b) {\n if (typeof a == 'object' && '__add__' in a) {\n return a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return b.__radd__ (a);\n }\n else {\n return a + b;\n }\n };\n __all__.__add__ = __add__;\n var __sub__ = function (a, b) {\n if (typeof a == 'object' && '__sub__' in a) {\n return a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return b.__rsub__ (a);\n }\n else {\n return a - b;\n }\n };\n __all__.__sub__ = __sub__;\n var __lshift__ = function (a, b) {\n if (typeof a == 'object' && '__lshift__' in a) {\n return a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return b.__rlshift__ (a);\n }\n else {\n return a << b;\n }\n };\n __all__.__lshift__ = __lshift__;\n var __rshift__ = function (a, b) {\n if (typeof a == 'object' && '__rshift__' in a) {\n return a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return b.__rrshift__ (a);\n }\n else {\n return a >> b;\n }\n };\n __all__.__rshift__ = __rshift__;\n var __or__ = function (a, b) {\n if (typeof a == 'object' && '__or__' in a) {\n return a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return b.__ror__ (a);\n }\n else {\n return a | b;\n }\n };\n __all__.__or__ = __or__;\n var __xor__ = function (a, b) {\n if (typeof a == 'object' && '__xor__' in a) {\n return a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return b.__rxor__ (a);\n }\n else {\n return a ^ b;\n }\n };\n __all__.__xor__ = __xor__;\n var __and__ = function (a, b) {\n if (typeof a == 'object' && '__and__' in a) {\n return a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return b.__rand__ (a);\n }\n else {\n return a & b;\n }\n };\n __all__.__and__ = __and__;\n var __eq__ = function (a, b) {\n if (typeof a == 'object' && '__eq__' in a) {\n return a.__eq__ (b);\n }\n else {\n return a == b;\n }\n };\n __all__.__eq__ = __eq__;\n var __ne__ = function (a, b) {\n if (typeof a == 'object' && '__ne__' in a) {\n return a.__ne__ (b);\n }\n else {\n return a != b\n }\n };\n __all__.__ne__ = __ne__;\n var __lt__ = function (a, b) {\n if (typeof a == 'object' && '__lt__' in a) {\n return a.__lt__ (b);\n }\n else {\n return a < b;\n }\n };\n __all__.__lt__ = __lt__;\n var __le__ = function (a, b) {\n if (typeof a == 'object' && '__le__' in a) {\n return a.__le__ (b);\n }\n else {\n return a <= b;\n }\n };\n __all__.__le__ = __le__;\n var __gt__ = function (a, b) {\n if (typeof a == 'object' && '__gt__' in a) {\n return a.__gt__ (b);\n }\n else {\n return a > b;\n }\n };\n __all__.__gt__ = __gt__;\n var __ge__ = function (a, b) {\n if (typeof a == 'object' && '__ge__' in a) {\n return a.__ge__ (b);\n }\n else {\n return a >= b;\n }\n };\n __all__.__ge__ = __ge__;\n var __imatmul__ = function (a, b) {\n if ('__imatmul__' in a) {\n return a.__imatmul__ (b);\n }\n else {\n return a.__matmul__ (b);\n }\n };\n __all__.__imatmul__ = __imatmul__;\n var __ipow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__ipow__ (b);\n }\n else if (typeof a == 'object' && '__ipow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.ipow = __ipow__;\n var __ijsmod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__ismod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.ijsmod__ = __ijsmod__;\n var __imod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__imod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.imod = __imod__;\n var __imul__ = function (a, b) {\n if (typeof a == 'object' && '__imul__' in a) {\n return a.__imul__ (b);\n }\n else if (typeof a == 'object' && '__mul__' in a) {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return a = b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return a = b.__rmul__ (a);\n }\n else {\n return a *= b;\n }\n };\n __all__.__imul__ = __imul__;\n var __idiv__ = function (a, b) {\n if (typeof a == 'object' && '__idiv__' in a) {\n return a.__idiv__ (b);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a = a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return a = b.__rdiv__ (a);\n }\n else {\n return a /= b;\n }\n };\n __all__.__idiv__ = __idiv__;\n var __iadd__ = function (a, b) {\n if (typeof a == 'object' && '__iadd__' in a) {\n return a.__iadd__ (b);\n }\n else if (typeof a == 'object' && '__add__' in a) {\n return a = a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return a = b.__radd__ (a);\n }\n else {\n return a += b;\n }\n };\n __all__.__iadd__ = __iadd__;\n var __isub__ = function (a, b) {\n if (typeof a == 'object' && '__isub__' in a) {\n return a.__isub__ (b);\n }\n else if (typeof a == 'object' && '__sub__' in a) {\n return a = a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return a = b.__rsub__ (a);\n }\n else {\n return a -= b;\n }\n };\n __all__.__isub__ = __isub__;\n var __ilshift__ = function (a, b) {\n if (typeof a == 'object' && '__ilshift__' in a) {\n return a.__ilshift__ (b);\n }\n else if (typeof a == 'object' && '__lshift__' in a) {\n return a = a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return a = b.__rlshift__ (a);\n }\n else {\n return a <<= b;\n }\n };\n __all__.__ilshift__ = __ilshift__;\n var __irshift__ = function (a, b) {\n if (typeof a == 'object' && '__irshift__' in a) {\n return a.__irshift__ (b);\n }\n else if (typeof a == 'object' && '__rshift__' in a) {\n return a = a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return a = b.__rrshift__ (a);\n }\n else {\n return a >>= b;\n }\n };\n __all__.__irshift__ = __irshift__;\n var __ior__ = function (a, b) {\n if (typeof a == 'object' && '__ior__' in a) {\n return a.__ior__ (b);\n }\n else if (typeof a == 'object' && '__or__' in a) {\n return a = a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return a = b.__ror__ (a);\n }\n else {\n return a |= b;\n }\n };\n __all__.__ior__ = __ior__;\n var __ixor__ = function (a, b) {\n if (typeof a == 'object' && '__ixor__' in a) {\n return a.__ixor__ (b);\n }\n else if (typeof a == 'object' && '__xor__' in a) {\n return a = a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return a = b.__rxor__ (a);\n }\n else {\n return a ^= b;\n }\n };\n __all__.__ixor__ = __ixor__;\n var __iand__ = function (a, b) {\n if (typeof a == 'object' && '__iand__' in a) {\n return a.__iand__ (b);\n }\n else if (typeof a == 'object' && '__and__' in a) {\n return a = a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return a = b.__rand__ (a);\n }\n else {\n return a &= b;\n }\n };\n __all__.__iand__ = __iand__;\n var __getitem__ = function (container, key) {\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ (key);\n }\n else if ((typeof container == 'string' || container instanceof Array) && key < 0) {\n return container [container.length + key];\n }\n else {\n return container [key];\n }\n };\n __all__.__getitem__ = __getitem__;\n var __setitem__ = function (container, key, value) {\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ (key, value);\n }\n else if ((typeof container == 'string' || container instanceof Array) && key < 0) {\n container [container.length + key] = value;\n }\n else {\n container [key] = value;\n }\n };\n __all__.__setitem__ = __setitem__;\n var __getslice__ = function (container, lower, upper, step) {\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ ([lower, upper, step]);\n }\n else {\n return container.__getslice__ (lower, upper, step);\n }\n };\n __all__.__getslice__ = __getslice__;\n var __setslice__ = function (container, lower, upper, step, value) {\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ ([lower, upper, step], value);\n }\n else {\n container.__setslice__ (lower, upper, step, value);\n }\n };\n __all__.__setslice__ = __setslice__;\n\t__nest__ (\n\t\t__all__,\n\t\t'constants', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'constants';\n\t\t\t\t\tvar pi = __init__ (__world__.math).pi;\n\t\t\t\t\tvar LATITUDE_OF_NORTHERN_TROPIC = (23.43673 / 180) * pi;\n\t\t\t\t\tvar LATITUDE_OF_SOUTHERN_TROPIC = (-(23.43673) / 180) * pi;\n\t\t\t\t\tvar DISK_EXTENSION = 0.25;\n\t\t\t\t\tvar DISK_TIMERING_THICKNESS = 0.2;\n\t\t\t\t\tvar SOLAR_TERMS = list (['立春', '雨水', '惊蛰', '春分', '清明', '谷雨', '立夏', '小满', '芒种', '夏至', '小暑', '大暑', '立秋', '处暑', '白露', '秋分', '寒露', '霜降', '立冬', '小雪', '大雪', '冬至', '小寒', '大寒']);\n\t\t\t\t\tvar STARMARK_ADJUST = dict ({'50Alp UMa': tuple ([0, +(0.15)]), '85Eta UMa': tuple ([0, -(0.03)]), '77Eps UMa': tuple ([0, -(0.03)]), '32Alp Leo': tuple ([+(0.08), -(0.03)]), '58Alp Ori': tuple ([-(0.13), +(0.05)]), '24Gam Ori': tuple ([+(0.12), +(0.05)]), '19Bet Ori': tuple ([+(0.1), +(0.05)]), '46Eps Ori': tuple ([-(0.12), +(0.03)]), '16Alp Boo': tuple ([0, -(0.03)]), '3Alp Lyr': tuple ([0.13, -(0.03)]), '53Alp Aql': tuple ([-(0.13), +(0.02)]), '13Alp Aur': tuple ([+(0.13), +(0.18)]), '34Bet Aur': tuple ([-(0.22), 0]), '66Alp Gem': tuple ([-(0.22), +(0.1)]), '78Bet Gem': tuple ([-(0.2), +(0.06)]), '24Gam Gem': tuple ([+(0.14), +(0.05)]), '112Bet Tau': tuple ([-(0.18), +(0.07)]), '9Alp CMa': tuple ([+(0.02), +(0.1)]), '2Bet CMa': tuple ([+(0.04), +(0.01)]), '30Alp Hya': tuple ([+(0.05), 0])});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'math' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.DISK_EXTENSION = DISK_EXTENSION;\n\t\t\t\t\t\t__all__.DISK_TIMERING_THICKNESS = DISK_TIMERING_THICKNESS;\n\t\t\t\t\t\t__all__.LATITUDE_OF_NORTHERN_TROPIC = LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t\t\t\t__all__.LATITUDE_OF_SOUTHERN_TROPIC = LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t\t\t\t__all__.SOLAR_TERMS = SOLAR_TERMS;\n\t\t\t\t\t\t__all__.STARMARK_ADJUST = STARMARK_ADJUST;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'math', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'math';\n\t\t\t\t\tvar pi = Math.PI;\n\t\t\t\t\tvar e = Math.E;\n\t\t\t\t\tvar exp = Math.exp;\n\t\t\t\t\tvar expm1 = function (x) {\n\t\t\t\t\t\treturn Math.exp (x) - 1;\n\t\t\t\t\t};\n\t\t\t\t\tvar log = function (x, base) {\n\t\t\t\t\t\treturn (base === undefined ? Math.log (x) : Math.log (x) / Math.log (base));\n\t\t\t\t\t};\n\t\t\t\t\tvar log1p = function (x) {\n\t\t\t\t\t\treturn Math.log (x + 1);\n\t\t\t\t\t};\n\t\t\t\t\tvar log2 = function (x) {\n\t\t\t\t\t\treturn Math.log (x) / Math.LN2;\n\t\t\t\t\t};\n\t\t\t\t\tvar log10 = function (x) {\n\t\t\t\t\t\treturn Math.log (x) / Math.LN10;\n\t\t\t\t\t};\n\t\t\t\t\tvar pow = Math.pow;\n\t\t\t\t\tvar sqrt = Math.sqrt;\n\t\t\t\t\tvar sin = Math.sin;\n\t\t\t\t\tvar cos = Math.cos;\n\t\t\t\t\tvar tan = Math.tan;\n\t\t\t\t\tvar asin = Math.asin;\n\t\t\t\t\tvar acos = Math.acos;\n\t\t\t\t\tvar atan = Math.atan;\n\t\t\t\t\tvar atan2 = Math.atan2;\n\t\t\t\t\tvar hypot = Math.hypot;\n\t\t\t\t\tvar degrees = function (x) {\n\t\t\t\t\t\treturn (x * 180) / Math.PI;\n\t\t\t\t\t};\n\t\t\t\t\tvar radians = function (x) {\n\t\t\t\t\t\treturn (x * Math.PI) / 180;\n\t\t\t\t\t};\n\t\t\t\t\tvar sinh = Math.sinh;\n\t\t\t\t\tvar cosh = Math.cosh;\n\t\t\t\t\tvar tanh = Math.tanh;\n\t\t\t\t\tvar asinh = Math.asinh;\n\t\t\t\t\tvar acosh = Math.acosh;\n\t\t\t\t\tvar atanh = Math.atanh;\n\t\t\t\t\tvar floor = Math.floor;\n\t\t\t\t\tvar ceil = Math.ceil;\n\t\t\t\t\tvar trunc = Math.trunc;\n\t\t\t\t\tvar isnan = isNaN;\n\t\t\t\t\tvar inf = Infinity;\n\t\t\t\t\tvar nan = NaN;\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.acos = acos;\n\t\t\t\t\t\t__all__.acosh = acosh;\n\t\t\t\t\t\t__all__.asin = asin;\n\t\t\t\t\t\t__all__.asinh = asinh;\n\t\t\t\t\t\t__all__.atan = atan;\n\t\t\t\t\t\t__all__.atan2 = atan2;\n\t\t\t\t\t\t__all__.atanh = atanh;\n\t\t\t\t\t\t__all__.ceil = ceil;\n\t\t\t\t\t\t__all__.cos = cos;\n\t\t\t\t\t\t__all__.cosh = cosh;\n\t\t\t\t\t\t__all__.degrees = degrees;\n\t\t\t\t\t\t__all__.e = e;\n\t\t\t\t\t\t__all__.exp = exp;\n\t\t\t\t\t\t__all__.expm1 = expm1;\n\t\t\t\t\t\t__all__.floor = floor;\n\t\t\t\t\t\t__all__.hypot = hypot;\n\t\t\t\t\t\t__all__.inf = inf;\n\t\t\t\t\t\t__all__.isnan = isnan;\n\t\t\t\t\t\t__all__.log = log;\n\t\t\t\t\t\t__all__.log10 = log10;\n\t\t\t\t\t\t__all__.log1p = log1p;\n\t\t\t\t\t\t__all__.log2 = log2;\n\t\t\t\t\t\t__all__.nan = nan;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t\t__all__.pow = pow;\n\t\t\t\t\t\t__all__.radians = radians;\n\t\t\t\t\t\t__all__.sin = sin;\n\t\t\t\t\t\t__all__.sinh = sinh;\n\t\t\t\t\t\t__all__.sqrt = sqrt;\n\t\t\t\t\t\t__all__.tan = tan;\n\t\t\t\t\t\t__all__.tanh = tanh;\n\t\t\t\t\t\t__all__.trunc = trunc;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'mathfunc', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'mathfunc';\n\t\t\t\t\tvar sin = __init__ (__world__.math).sin;\n\t\t\t\t\tvar cos = __init__ (__world__.math).cos;\n\t\t\t\t\tvar asin = __init__ (__world__.math).asin;\n\t\t\t\t\tvar acos = __init__ (__world__.math).acos;\n\t\t\t\t\tvar pi = __init__ (__world__.math).pi;\n\t\t\t\t\tvar latlng2xyz = function (latlng) {\n\t\t\t\t\t\tvar __left0__ = latlng;\n\t\t\t\t\t\tvar lat = __left0__ [0];\n\t\t\t\t\t\tvar lng = __left0__ [1];\n\t\t\t\t\t\tvar z = sin (lat);\n\t\t\t\t\t\tvar x = cos (lat) * cos (lng);\n\t\t\t\t\t\tvar y = cos (lat) * sin (lng);\n\t\t\t\t\t\treturn tuple ([x, y, z]);\n\t\t\t\t\t};\n\t\t\t\t\tvar sphere_angle = function (latlng1, latlng2) {\n\t\t\t\t\t\tvar __left0__ = latlng2xyz (latlng1);\n\t\t\t\t\t\tvar x1 = __left0__ [0];\n\t\t\t\t\t\tvar y1 = __left0__ [1];\n\t\t\t\t\t\tvar z1 = __left0__ [2];\n\t\t\t\t\t\tvar __left0__ = latlng2xyz (latlng2);\n\t\t\t\t\t\tvar x2 = __left0__ [0];\n\t\t\t\t\t\tvar y2 = __left0__ [1];\n\t\t\t\t\t\tvar z2 = __left0__ [2];\n\t\t\t\t\t\treturn 2 * asin (Math.pow ((Math.pow (x2 - x1, 2) + Math.pow (y2 - y1, 2)) + Math.pow (z2 - z1, 2), 0.5) / 2);\n\t\t\t\t\t};\n\t\t\t\t\tvar projectionXYZ = function (xyz) {\n\t\t\t\t\t\tvar __left0__ = xyz;\n\t\t\t\t\t\tvar x1 = __left0__ [0];\n\t\t\t\t\t\tvar y1 = __left0__ [1];\n\t\t\t\t\t\tvar z1 = __left0__ [2];\n\t\t\t\t\t\tvar __left0__ = tuple ([0, 0, -(1)]);\n\t\t\t\t\t\tvar x0 = __left0__ [0];\n\t\t\t\t\t\tvar y0 = __left0__ [1];\n\t\t\t\t\t\tvar z0 = __left0__ [2];\n\t\t\t\t\t\tvar z2 = 1;\n\t\t\t\t\t\tvar k = (z2 - z0) / (z1 - z0);\n\t\t\t\t\t\tvar x2 = x0 + k * (x1 - x0);\n\t\t\t\t\t\tvar y2 = y0 + k * (y1 - y0);\n\t\t\t\t\t\treturn tuple ([x2, y2]);\n\t\t\t\t\t};\n\t\t\t\t\tvar projectionLatlng = function (latlng) {\n\t\t\t\t\t\treturn projectionXYZ (latlng2xyz (latlng));\n\t\t\t\t\t};\n\t\t\t\t\tvar bisect = function (func, x0, x1) {\n\t\t\t\t\t\tvar y0 = func (x0);\n\t\t\t\t\t\tvar y1 = func (x1);\n\t\t\t\t\t\tif (y0 * y1 > 0) {\n\t\t\t\t\t\t\tvar __except0__ = Exception ('func(x0) and func(x1) must have different signs.');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile (abs (x1 - x0) > 1e-10) {\n\t\t\t\t\t\t\tvar x01 = (x0 + x1) / 2;\n\t\t\t\t\t\t\tvar y01 = func (x01);\n\t\t\t\t\t\t\tif (y01 * y0 <= 0) {\n\t\t\t\t\t\t\t\tvar x1 = x01;\n\t\t\t\t\t\t\t\tvar y1 = y01;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar x0 = x01;\n\t\t\t\t\t\t\t\tvar y0 = y01;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tuple ([x01, y01]);\n\t\t\t\t\t};\n\t\t\t\t\tvar add_vector = function () {\n\t\t\t\t\t\tvar vecs = tuple ([].slice.apply (arguments).slice (0));\n\t\t\t\t\t\treturn tuple ([sum ((function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var e of vecs) {\n\t\t\t\t\t\t\t\t__accu0__.append (e [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ()), sum ((function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var e of vecs) {\n\t\t\t\t\t\t\t\t__accu0__.append (e [1]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ()), sum ((function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var e of vecs) {\n\t\t\t\t\t\t\t\t__accu0__.append (e [2]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ())]);\n\t\t\t\t\t};\n\t\t\t\t\tvar zoom_vector = function (xyz, k) {\n\t\t\t\t\t\treturn tuple ([xyz [0] * k, xyz [1] * k, xyz [2] * k]);\n\t\t\t\t\t};\n\t\t\t\t\tvar cross_product = function (xyz1, xyz2) {\n\t\t\t\t\t\tvar __left0__ = xyz1;\n\t\t\t\t\t\tvar x1 = __left0__ [0];\n\t\t\t\t\t\tvar y1 = __left0__ [1];\n\t\t\t\t\t\tvar z1 = __left0__ [2];\n\t\t\t\t\t\tvar __left0__ = xyz2;\n\t\t\t\t\t\tvar x2 = __left0__ [0];\n\t\t\t\t\t\tvar y2 = __left0__ [1];\n\t\t\t\t\t\tvar z2 = __left0__ [2];\n\t\t\t\t\t\treturn tuple ([y1 * z2 - y2 * z1, -(x1 * z2 - z1 * x2), x1 * y2 - x2 * y1]);\n\t\t\t\t\t};\n\t\t\t\t\tvar linspace = function (x0, x1, n) {\n\t\t\t\t\t\tvar ret = list ([]);\n\t\t\t\t\t\tvar t = x0;\n\t\t\t\t\t\tvar d = (x1 - x0) / (n - 1);\n\t\t\t\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\t\t\t\tret.append (t);\n\t\t\t\t\t\t\tt += d;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn ret;\n\t\t\t\t\t};\n\t\t\t\t\tvar circle_parametric = function (vector1, vector2, angle) {\n\t\t\t\t\t\tvar cosangle = cos (angle);\n\t\t\t\t\t\tvar sinangle = sin (angle);\n\t\t\t\t\t\treturn tuple ([vector1 [0] * cosangle + vector2 [0] * sinangle, vector1 [1] * cosangle + vector2 [1] * sinangle, vector1 [2] * cosangle + vector2 [2] * sinangle]);\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'math' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.acos = acos;\n\t\t\t\t\t\t__all__.add_vector = add_vector;\n\t\t\t\t\t\t__all__.asin = asin;\n\t\t\t\t\t\t__all__.bisect = bisect;\n\t\t\t\t\t\t__all__.circle_parametric = circle_parametric;\n\t\t\t\t\t\t__all__.cos = cos;\n\t\t\t\t\t\t__all__.cross_product = cross_product;\n\t\t\t\t\t\t__all__.latlng2xyz = latlng2xyz;\n\t\t\t\t\t\t__all__.linspace = linspace;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t\t__all__.projectionLatlng = projectionLatlng;\n\t\t\t\t\t\t__all__.projectionXYZ = projectionXYZ;\n\t\t\t\t\t\t__all__.sin = sin;\n\t\t\t\t\t\t__all__.sphere_angle = sphere_angle;\n\t\t\t\t\t\t__all__.zoom_vector = zoom_vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'rete', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'rete';\n\t\t\t\t\tvar sin = __init__ (__world__.math).sin;\n\t\t\t\t\tvar cos = __init__ (__world__.math).cos;\n\t\t\t\t\tvar asin = __init__ (__world__.math).asin;\n\t\t\t\t\tvar acos = __init__ (__world__.math).acos;\n\t\t\t\t\tvar pi = __init__ (__world__.math).pi;\n\t\t\t\t\tvar CONSTELLATIONS = __init__ (__world__.stardata).CONSTELLATIONS;\n\t\t\t\t\tvar DISK_EXTENSION = __init__ (__world__.constants).DISK_EXTENSION;\n\t\t\t\t\tvar DISK_TIMERING_THICKNESS = __init__ (__world__.constants).DISK_TIMERING_THICKNESS;\n\t\t\t\t\tvar LATITUDE_OF_NORTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t\t\tvar LATITUDE_OF_SOUTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t\t\tvar SOLAR_TERMS = __init__ (__world__.constants).SOLAR_TERMS;\n\t\t\t\t\tvar STARMARK_ADJUST = __init__ (__world__.constants).STARMARK_ADJUST;\n\t\t\t\t\tvar __name__ = __init__ (__world__.constants).__name__;\n\t\t\t\t\tvar pi = __init__ (__world__.constants).pi;\n\t\t\t\t\tvar __name__ = __init__ (__world__.mathfunc).__name__;\n\t\t\t\t\tvar acos = __init__ (__world__.mathfunc).acos;\n\t\t\t\t\tvar add_vector = __init__ (__world__.mathfunc).add_vector;\n\t\t\t\t\tvar asin = __init__ (__world__.mathfunc).asin;\n\t\t\t\t\tvar bisect = __init__ (__world__.mathfunc).bisect;\n\t\t\t\t\tvar circle_parametric = __init__ (__world__.mathfunc).circle_parametric;\n\t\t\t\t\tvar cos = __init__ (__world__.mathfunc).cos;\n\t\t\t\t\tvar cross_product = __init__ (__world__.mathfunc).cross_product;\n\t\t\t\t\tvar latlng2xyz = __init__ (__world__.mathfunc).latlng2xyz;\n\t\t\t\t\tvar linspace = __init__ (__world__.mathfunc).linspace;\n\t\t\t\t\tvar pi = __init__ (__world__.mathfunc).pi;\n\t\t\t\t\tvar projectionLatlng = __init__ (__world__.mathfunc).projectionLatlng;\n\t\t\t\t\tvar projectionXYZ = __init__ (__world__.mathfunc).projectionXYZ;\n\t\t\t\t\tvar sin = __init__ (__world__.mathfunc).sin;\n\t\t\t\t\tvar sphere_angle = __init__ (__world__.mathfunc).sphere_angle;\n\t\t\t\t\tvar zoom_vector = __init__ (__world__.mathfunc).zoom_vector;\n\t\t\t\t\tvar SVG = __init__ (__world__.svg).SVG;\n\t\t\t\t\tvar Rete = function (self) {\n\t\t\t\t\t\tvar svg = SVG ();\n\t\t\t\t\t\tvar projected_r_max = self.projected_r_max;\n\t\t\t\t\t\tvar projected_r_in = self.projected_r_in;\n\t\t\t\t\t\tvar projected_ecliptic_center = (projected_r_max - projected_r_in) / 2;\n\t\t\t\t\t\tvar projected_ecliptic_radius = (projected_r_max + projected_r_in) / 2;\n\t\t\t\t\t\tsvg.circle (projected_ecliptic_center, 0, projected_ecliptic_radius, 'circle-ecliptic');\n\t\t\t\t\t\tvar getRFromEcliptic = function (theta) {\n\t\t\t\t\t\t\tvar a = 1;\n\t\t\t\t\t\t\tvar b = (-(2) * projected_ecliptic_center) * cos (theta);\n\t\t\t\t\t\t\tvar c = Math.pow (projected_ecliptic_center, 2) - Math.pow (projected_ecliptic_radius, 2);\n\t\t\t\t\t\t\tvar R = (-(b) + Math.pow (Math.pow (b, 2) - (4 * a) * c, 0.5)) / (2 * a);\n\t\t\t\t\t\t\treturn R;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (var t = 0; t < 360; t += 5) {\n\t\t\t\t\t\t\tvar theta = (t / 180) * pi + (3 * pi) / 2;\n\t\t\t\t\t\t\tvar R = getRFromEcliptic (theta);\n\t\t\t\t\t\t\tvar endVector1 = tuple ([(R - 0.1) * cos (theta), (R - 0.1) * sin (theta)]);\n\t\t\t\t\t\t\tif (t == 0) {\n\t\t\t\t\t\t\t\tvar endVector2 = tuple ([projected_r_max * cos (theta), projected_r_max * sin (theta)]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__mod__ (t, 15) == 0) {\n\t\t\t\t\t\t\t\tvar endVector2 = tuple ([(R + 0.1) * cos (theta), (R + 0.1) * sin (theta)]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar endVector2 = tuple ([R * cos (theta), R * sin (theta)]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.line (endVector1 [0], endVector1 [1], endVector2 [0], endVector2 [1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar outerR1 = projected_r_max;\n\t\t\t\t\t\tvar outerR2 = outerR1 + DISK_EXTENSION;\n\t\t\t\t\t\tvar outerRM = (outerR1 + outerR2) / 2;\n\t\t\t\t\t\tvar outerRT = outerR1 + DISK_EXTENSION * 0.25;\n\t\t\t\t\t\tvar solarTermsIndex = 0;\n\t\t\t\t\t\tfor (var t = 0; t < 24; t++) {\n\t\t\t\t\t\t\tvar theta = ((pi / 12) * t + pi / 2) - (3 * pi) / 12;\n\t\t\t\t\t\t\tvar endVector1 = tuple ([outerR1 * cos (theta), outerR1 * sin (theta)]);\n\t\t\t\t\t\t\tif (__mod__ (t, 2) == 1) {\n\t\t\t\t\t\t\t\tvar endVector2 = tuple ([outerR2 * cos (theta), outerR2 * sin (theta)]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar endVector2 = tuple ([outerRM * cos (theta), outerRM * sin (theta)]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.line (endVector1 [0], endVector1 [1], endVector2 [0], endVector2 [1]);\n\t\t\t\t\t\t\tvar textAngle = 2 * pi - theta;\n\t\t\t\t\t\t\tsvg._raw ('\\n <text transform=\"translate({},{}) rotate({})\" text-anchor=\"middle\" textLength=\"2.5em\">{}</text>\\n '.format (svg.ratio (outerRT * cos (textAngle)), svg.ratio (outerRT * sin (textAngle)), ((textAngle + pi / 2) / pi) * 180, SOLAR_TERMS [t]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar theta = (3 * pi) / 2;\n\t\t\t\t\t\tvar R = getRFromEcliptic (theta);\n\t\t\t\t\t\tsvg._raw ('\\n <g transform=\"translate({} 0)\">\\n\\n <g class=\"sun-arrow-1\">\\n <circle cx=\"0\" cy=\"0\" r=\"{}\" stroke-width=\"10\" visibility=\"visible\" opacity=\"0.4\" fill=\"none\"/>\\n <circle cx=\"0\" cy=\"-{}\" r=\"5\" stroke-width=\"0\" fill=\"red\" />\\n <circle cx=\"0\" cy=\"-{}\" r=\"9\" stroke-width=\"1\" fill=\"none\" />\\n </g>\\n\\n </g>\\n\\n <g class=\"sun-arrow-2\">\\n <circle cx=\"0\" cy=\"-{}\" r=\"5\" stroke-width=\"0\" fill=\"red\" />\\n <circle cx=\"0\" cy=\"-{}\" r=\"9\" stroke-width=\"1\" fill=\"none\" />\\n </g>\\n '.format (svg.ratio (projected_ecliptic_center), svg.ratio (projected_ecliptic_radius), svg.ratio (projected_ecliptic_radius), svg.ratio (projected_ecliptic_radius), svg.ratio (projected_r_max + DISK_EXTENSION), svg.ratio (projected_r_max + DISK_EXTENSION)));\n\t\t\t\t\t\tdrawStars (svg);\n\t\t\t\t\t\treturn svg;\n\t\t\t\t\t};\n\t\t\t\t\tvar drawStars = function (reteSVG) {\n\t\t\t\t\t\tvar svg = reteSVG;\n\t\t\t\t\t\tvar drawnStars = list ([]);\n\t\t\t\t\t\tvar drawStar = function (star) {\n\t\t\t\t\t\t\tvar starRA = ((star ['RA'] * 15) / 180) * pi;\n\t\t\t\t\t\t\tvar starDE = (star ['DE'] / 180) * pi;\n\t\t\t\t\t\t\tif (__in__ (star ['name'], drawnStars)) {\n\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (starDE < LATITUDE_OF_SOUTHERN_TROPIC) {\n\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar projectRA = (pi * 3) / 2 - starRA;\n\t\t\t\t\t\t\tvar point = projectionLatlng (tuple ([starDE, projectRA]));\n\t\t\t\t\t\t\tvar Vmag = star ['Vmag'];\n\t\t\t\t\t\t\tif (Vmag <= 0) {\n\t\t\t\t\t\t\t\tvar size = 0.04;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (Vmag <= 1) {\n\t\t\t\t\t\t\t\tvar size = 0.03;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (Vmag <= 2) {\n\t\t\t\t\t\t\t\tvar size = 0.02;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (Vmag < 3) {\n\t\t\t\t\t\t\t\tvar size = 0.01;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.circle (point [0], point [1], size, 'star');\n\t\t\t\t\t\t\tif (star ['mark']) {\n\t\t\t\t\t\t\t\tvar deltaRA = 0;\n\t\t\t\t\t\t\t\tvar deltaDE = -(0.03);\n\t\t\t\t\t\t\t\tif (__in__ (star ['name'], STARMARK_ADJUST)) {\n\t\t\t\t\t\t\t\t\tdeltaRA += STARMARK_ADJUST [star ['name']] [0];\n\t\t\t\t\t\t\t\t\tdeltaDE += STARMARK_ADJUST [star ['name']] [1];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar pointText = projectionLatlng (tuple ([starDE + deltaDE, projectRA + deltaRA]));\n\t\t\t\t\t\t\t\tvar starname = star ['mark'] [0];\n\t\t\t\t\t\t\t\tsvg._raw ('<text\\n transform=\"translate({},{}) rotate({})\"\\n class=\"starname\"\\n text-anchor=\"middle\">{}</text>'.format (svg.ratio (pointText [0]), svg.ratio (pointText [1]), (((projectRA + deltaRA) + pi / 2) / pi) * 180, starname));\n\t\t\t\t\t\t\t\tprint (starname, star ['name']);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdrawnStars.append (star ['name']);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar drawLine = function (star0, star1) {\n\t\t\t\t\t\t\tvar n = 10;\n\t\t\t\t\t\t\tvar ra0 = ((star0 ['RA'] * 15) / 180) * pi;\n\t\t\t\t\t\t\tvar dec0 = (star0 ['DE'] / 180) * pi;\n\t\t\t\t\t\t\tvar ra1 = ((star1 ['RA'] * 15) / 180) * pi;\n\t\t\t\t\t\t\tvar dec1 = (star1 ['DE'] / 180) * pi;\n\t\t\t\t\t\t\tif (ra0 > ra1) {\n\t\t\t\t\t\t\t\tvar t = dec1;\n\t\t\t\t\t\t\t\tvar dec1 = dec0;\n\t\t\t\t\t\t\t\tvar dec0 = t;\n\t\t\t\t\t\t\t\tvar t = ra1;\n\t\t\t\t\t\t\t\tvar ra1 = ra0;\n\t\t\t\t\t\t\t\tvar ra0 = t;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (ra1 - ra0 > pi) {\n\t\t\t\t\t\t\t\tra0 += 2 * pi;\n\t\t\t\t\t\t\t\tvar t = dec1;\n\t\t\t\t\t\t\t\tvar dec1 = dec0;\n\t\t\t\t\t\t\t\tvar dec0 = t;\n\t\t\t\t\t\t\t\tvar t = ra1;\n\t\t\t\t\t\t\t\tvar ra1 = ra0;\n\t\t\t\t\t\t\t\tvar ra0 = t;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar ra_n = linspace (ra0, ra1, n);\n\t\t\t\t\t\t\tvar dec_n = linspace (dec0, dec1, n);\n\t\t\t\t\t\t\tvar points = list ([]);\n\t\t\t\t\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\t\t\t\t\tvar __left0__ = tuple ([ra_n [i], dec_n [i]]);\n\t\t\t\t\t\t\t\tvar ra_i = __left0__ [0];\n\t\t\t\t\t\t\t\tvar dec_i = __left0__ [1];\n\t\t\t\t\t\t\t\tif (dec_i < LATITUDE_OF_SOUTHERN_TROPIC) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar point = projectionLatlng (tuple ([dec_i, (2 * pi - ra_i) + (pi * 3) / 2]));\n\t\t\t\t\t\t\t\tpoints.append (point);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.polyline (points, 'constellation-line');\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (var constellation of CONSTELLATIONS) {\n\t\t\t\t\t\t\tfor (var line of constellation ['lines']) {\n\t\t\t\t\t\t\t\tfor (var i = 0; i < len (line) - 1; i++) {\n\t\t\t\t\t\t\t\t\tdrawStar (line [i]);\n\t\t\t\t\t\t\t\t\tdrawLine (line [i], line [i + 1]);\n\t\t\t\t\t\t\t\t\tdrawStar (line [i + 1]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn svg;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'constants' +\n\t\t\t\t\t\t'math' +\n\t\t\t\t\t\t'mathfunc' +\n\t\t\t\t\t\t'stardata' +\n\t\t\t\t\t\t'svg' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.CONSTELLATIONS = CONSTELLATIONS;\n\t\t\t\t\t\t__all__.DISK_EXTENSION = DISK_EXTENSION;\n\t\t\t\t\t\t__all__.DISK_TIMERING_THICKNESS = DISK_TIMERING_THICKNESS;\n\t\t\t\t\t\t__all__.LATITUDE_OF_NORTHERN_TROPIC = LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t\t\t\t__all__.LATITUDE_OF_SOUTHERN_TROPIC = LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t\t\t\t__all__.Rete = Rete;\n\t\t\t\t\t\t__all__.SOLAR_TERMS = SOLAR_TERMS;\n\t\t\t\t\t\t__all__.STARMARK_ADJUST = STARMARK_ADJUST;\n\t\t\t\t\t\t__all__.SVG = SVG;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.acos = acos;\n\t\t\t\t\t\t__all__.add_vector = add_vector;\n\t\t\t\t\t\t__all__.asin = asin;\n\t\t\t\t\t\t__all__.bisect = bisect;\n\t\t\t\t\t\t__all__.circle_parametric = circle_parametric;\n\t\t\t\t\t\t__all__.cos = cos;\n\t\t\t\t\t\t__all__.cross_product = cross_product;\n\t\t\t\t\t\t__all__.drawStars = drawStars;\n\t\t\t\t\t\t__all__.latlng2xyz = latlng2xyz;\n\t\t\t\t\t\t__all__.linspace = linspace;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t\t__all__.projectionLatlng = projectionLatlng;\n\t\t\t\t\t\t__all__.projectionXYZ = projectionXYZ;\n\t\t\t\t\t\t__all__.sin = sin;\n\t\t\t\t\t\t__all__.sphere_angle = sphere_angle;\n\t\t\t\t\t\t__all__.zoom_vector = zoom_vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'stardata', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'stardata';\n\t\t\t\t\tvar CONSTELLATIONS = list ([dict ({'name': '仙后座', 'lines': list ([list ([dict ({'name': '11Bet Cas', 'Vmag': 2.27, 'alias': 'BD+58 3;SAO21133', 'RA': 0.1529722222222222, 'DE': 59.14972222222222, 'mark': ''}), dict ({'name': '18Alp Cas', 'Vmag': 2.23, 'alias': 'BD+55 139;SAO21609', 'RA': 0.6751388888888888, 'DE': 56.53722222222222, 'mark': ''}), dict ({'name': '27Gam Cas', 'Vmag': 2.47, 'alias': 'BD+59 144;SAO11482', 'RA': 0.9451388888888889, 'DE': 60.71666666666667, 'mark': ''}), dict ({'name': '37Del Cas', 'Vmag': 2.68, 'alias': 'BD+59 248;SAO22268', 'RA': 1.4302777777777778, 'DE': 60.23527777777778, 'mark': ''}), dict ({'name': '45Eps Cas', 'Vmag': 3.38, 'alias': 'BD+62 320;SAO12031', 'RA': 1.9065833333333333, 'DE': 63.669999999999995, 'mark': ''})])])}), dict ({'name': '猎户座', 'lines': list ([list ([dict ({'name': '19Bet Ori', 'Vmag': 0.12, 'alias': 'BD-08 1063;SAO131907', 'RA': 5.242305555555555, 'DE': -(7.798333333333333), 'mark': tuple (['参宿七', 'Rigel'])}), dict ({'name': '20Tau Ori', 'Vmag': 3.6, 'alias': 'BD-07 1028;SAO131952', 'RA': 5.293444444444444, 'DE': -(5.155555555555556), 'mark': ''}), dict ({'name': '28Eta Ori', 'Vmag': 3.36, 'alias': 'BD-02 1235;SAO132071', 'RA': 5.407944444444444, 'DE': -(1.6030555555555557), 'mark': ''}), dict ({'name': '34Del Ori', 'Vmag': 6.85, 'alias': 'BD-00 982;SAO132221', 'RA': 5.533472222222222, 'DE': 0.28444444444444444, 'mark': ''}), dict ({'name': '24Gam Ori', 'Vmag': 1.64, 'alias': 'BD+06 919;SAO112740', 'RA': 5.418861111111111, 'DE': 6.349722222222222, 'mark': tuple (['参宿五', 'Bellatrix'])}), dict ({'name': '39Lam Ori', 'Vmag': 3.54, 'alias': 'BD+09 879;SAO112921', 'RA': 5.585638888888888, 'DE': 9.934166666666666, 'mark': ''}), dict ({'name': '58Alp Ori', 'Vmag': 0.5, 'alias': 'BD+07 1055;SAO113271', 'RA': 5.919527777777778, 'DE': 7.406944444444445, 'mark': tuple (['参宿四', 'Betelgeuse'])}), dict ({'name': '50Zet Ori', 'Vmag': 2.05, 'alias': 'BD-02 1338;SAO132444', 'RA': 5.679305555555556, 'DE': -(0.05722222222222221), 'mark': ''}), dict ({'name': '53Kap Ori', 'Vmag': 2.06, 'alias': 'BD-09 1235;SAO132542', 'RA': 5.795944444444444, 'DE': -(8.330277777777779), 'mark': ''})]), list ([dict ({'name': '24Gam Ori', 'Vmag': 1.64, 'alias': 'BD+06 919;SAO112740', 'RA': 5.418861111111111, 'DE': 6.349722222222222, 'mark': tuple (['参宿五', 'Bellatrix'])}), dict ({'name': '58Alp Ori', 'Vmag': 0.5, 'alias': 'BD+07 1055;SAO113271', 'RA': 5.919527777777778, 'DE': 7.406944444444445, 'mark': tuple (['参宿四', 'Betelgeuse'])})]), list ([dict ({'name': '34Del Ori', 'Vmag': 6.85, 'alias': 'BD-00 982;SAO132221', 'RA': 5.533472222222222, 'DE': 0.28444444444444444, 'mark': ''}), dict ({'name': '46Eps Ori', 'Vmag': 1.7, 'alias': 'BD-01 969;SAO132346', 'RA': 5.603555555555555, 'DE': -(0.7980555555555556), 'mark': tuple (['参宿二', 'Alnilam'])}), dict ({'name': '50Zet Ori', 'Vmag': 2.05, 'alias': 'BD-02 1338;SAO132444', 'RA': 5.679305555555556, 'DE': -(0.05722222222222221), 'mark': ''})]), list ([dict ({'name': '58Alp Ori', 'Vmag': 0.5, 'alias': 'BD+07 1055;SAO113271', 'RA': 5.919527777777778, 'DE': 7.406944444444445, 'mark': tuple (['参宿四', 'Betelgeuse'])}), dict ({'name': '61Mu Ori', 'Vmag': 4.12, 'alias': 'BD+09 1064;SAO113389', 'RA': 6.039722222222222, 'DE': 9.647499999999999, 'mark': ''}), dict ({'name': '67Nu Ori', 'Vmag': 4.42, 'alias': 'BD+14 1152;SAO95259', 'RA': 6.126194444444444, 'DE': 14.768333333333334, 'mark': ''})])])}), dict ({'name': '大熊座', 'lines': list ([list ([dict ({'name': '85Eta UMa', 'Vmag': 1.86, 'alias': 'BD+50 2027;SAO44752', 'RA': 13.792333333333334, 'DE': 49.31333333333333, 'mark': tuple (['瑶光', 'Alkaid'])}), dict ({'name': '79Zet UMa', 'Vmag': 2.27, 'alias': 'BD+55 1598;SAO28737', 'RA': 13.39875, 'DE': 54.92527777777777, 'mark': ''}), dict ({'name': '77Eps UMa', 'Vmag': 1.77, 'alias': 'BD+56 1627;SAO28553', 'RA': 12.900472222222223, 'DE': 55.959722222222226, 'mark': tuple (['玉衡', 'Alioth'])}), dict ({'name': '69Del UMa', 'Vmag': 3.31, 'alias': 'BD+57 1363;SAO28315', 'RA': 12.257111111111112, 'DE': 57.0325, 'mark': ''}), dict ({'name': '64Gam UMa', 'Vmag': 2.44, 'alias': 'BD+54 1475;SAO28179', 'RA': 11.897166666666665, 'DE': 53.69472222222222, 'mark': ''}), dict ({'name': '48Bet UMa', 'Vmag': 2.37, 'alias': 'BD+57 1302;SAO27876', 'RA': 11.030694444444446, 'DE': 56.3825, 'mark': ''}), dict ({'name': '50Alp UMa', 'Vmag': 1.79, 'alias': 'BD+62 1161;SAO15384', 'RA': 11.062138888888889, 'DE': 61.75083333333333, 'mark': tuple (['天枢', 'Dubhe'])})]), list ([dict ({'name': '50Alp UMa', 'Vmag': 1.79, 'alias': 'BD+62 1161;SAO15384', 'RA': 11.062138888888889, 'DE': 61.75083333333333, 'mark': tuple (['天枢', 'Dubhe'])}), dict ({'name': '69Del UMa', 'Vmag': 3.31, 'alias': 'BD+57 1363;SAO28315', 'RA': 12.257111111111112, 'DE': 57.0325, 'mark': ''}), dict ({'name': '23 UMa', 'Vmag': 3.67, 'alias': 'BD+63 845;SAO14908', 'RA': 9.525472222222223, 'DE': 63.06194444444444, 'mark': ''}), dict ({'name': '1Omi UMa', 'Vmag': 3.36, 'alias': 'BD+61 1054;SAO14573', 'RA': 8.504416666666666, 'DE': 60.71805555555556, 'mark': ''}), dict ({'name': '29Ups UMa', 'Vmag': 3.8, 'alias': 'BD+59 1268;SAO27401', 'RA': 9.849833333333335, 'DE': 59.03861111111111, 'mark': ''}), dict ({'name': '30Phi UMa', 'Vmag': 4.59, 'alias': 'BD+54 1331;SAO27408', 'RA': 9.868444444444444, 'DE': 54.06444444444444, 'mark': ''}), dict ({'name': '48Bet UMa', 'Vmag': 2.37, 'alias': 'BD+57 1302;SAO27876', 'RA': 11.030694444444446, 'DE': 56.3825, 'mark': ''})]), list ([dict ({'name': '30Phi UMa', 'Vmag': 4.59, 'alias': 'BD+54 1331;SAO27408', 'RA': 9.868444444444444, 'DE': 54.06444444444444, 'mark': ''}), dict ({'name': '25The UMa', 'Vmag': 3.17, 'alias': 'BD+52 1401;SAO27289', 'RA': 9.547611111111111, 'DE': 51.67722222222222, 'mark': ''}), dict ({'name': '9Iot UMa', 'Vmag': 3.14, 'alias': 'BD+48 1707;SAO42630', 'RA': 8.986777777777776, 'DE': 48.041666666666664, 'mark': ''})]), list ([dict ({'name': '25The UMa', 'Vmag': 3.17, 'alias': 'BD+52 1401;SAO27289', 'RA': 9.547611111111111, 'DE': 51.67722222222222, 'mark': ''}), dict ({'name': '12Kap UMa', 'Vmag': 3.6, 'alias': 'BD+47 1633;SAO42661', 'RA': 9.060416666666667, 'DE': 47.156666666666666, 'mark': ''})]), list ([dict ({'name': '64Gam UMa', 'Vmag': 2.44, 'alias': 'BD+54 1475;SAO28179', 'RA': 11.897166666666665, 'DE': 53.69472222222222, 'mark': ''}), dict ({'name': '63Chi UMa', 'Vmag': 3.71, 'alias': 'BD+48 1966;SAO43886', 'RA': 11.7675, 'DE': 47.779444444444444, 'mark': ''}), dict ({'name': '52Psi UMa', 'Vmag': 3.01, 'alias': 'BD+45 1897;SAO43629', 'RA': 11.161055555555556, 'DE': 44.49861111111111, 'mark': ''}), dict ({'name': '34Mu UMa', 'Vmag': 3.05, 'alias': 'BD+42 2115;SAO43310', 'RA': 10.37213888888889, 'DE': 41.49944444444444, 'mark': ''})]), list ([dict ({'name': '52Psi UMa', 'Vmag': 3.01, 'alias': 'BD+45 1897;SAO43629', 'RA': 11.161055555555556, 'DE': 44.49861111111111, 'mark': ''}), dict ({'name': '33Lam UMa', 'Vmag': 3.45, 'alias': 'BD+43 2005;SAO43268', 'RA': 10.284944444444445, 'DE': 42.91444444444444, 'mark': ''})])])}), dict ({'name': '小熊座', 'lines': list ([list ([dict ({'name': '1Alp UMi', 'Vmag': 2.02, 'alias': 'BD+88 8;SAO308', 'RA': 2.530194444444444, 'DE': 89.26416666666667, 'mark': ''}), dict ({'name': '23Del UMi', 'Vmag': 4.36, 'alias': 'BD+86 269;SAO2937', 'RA': 17.53691666666667, 'DE': 86.58638888888889, 'mark': ''}), dict ({'name': '22Eps UMi', 'Vmag': 4.23, 'alias': 'BD+82 498;SAO2770', 'RA': 16.76613888888889, 'DE': 82.03722222222223, 'mark': ''}), dict ({'name': '16Zet UMi', 'Vmag': 4.32, 'alias': 'BD+78 527;SAO8328', 'RA': 15.734305555555554, 'DE': 77.79444444444444, 'mark': ''}), dict ({'name': '7Bet UMi', 'Vmag': 2.08, 'alias': 'BD+74 595;SAO8102', 'RA': 14.845083333333333, 'DE': 74.15555555555557, 'mark': ''}), dict ({'name': '13Gam UMi', 'Vmag': 3.05, 'alias': 'BD+72 679;SAO8220', 'RA': 15.345472222222222, 'DE': 71.83388888888888, 'mark': ''}), dict ({'name': '21Eta UMi', 'Vmag': 4.95, 'alias': 'BD+76 596;SAO8470', 'RA': 16.29175, 'DE': 75.75527777777778, 'mark': ''}), dict ({'name': '16Zet UMi', 'Vmag': 4.32, 'alias': 'BD+78 527;SAO8328', 'RA': 15.734305555555554, 'DE': 77.79444444444444, 'mark': ''})])])}), dict ({'name': '三角座', 'lines': list ([list ([dict ({'name': '2Alp Tri', 'Vmag': 3.41, 'alias': 'BD+28 312;SAO74996', 'RA': 1.8846944444444444, 'DE': 29.578888888888887, 'mark': ''}), dict ({'name': '4Bet Tri', 'Vmag': 3.0, 'alias': 'BD+34 381;SAO55306', 'RA': 2.1590555555555553, 'DE': 34.98722222222222, 'mark': ''}), dict ({'name': '9Gam Tri', 'Vmag': 4.01, 'alias': 'BD+33 397;SAO55427', 'RA': 2.2885833333333334, 'DE': 33.84722222222222, 'mark': ''}), dict ({'name': '2Alp Tri', 'Vmag': 3.41, 'alias': 'BD+28 312;SAO74996', 'RA': 1.8846944444444444, 'DE': 29.578888888888887, 'mark': ''})])])}), dict ({'name': '英仙座', 'lines': list ([list ([dict ({'name': '15Eta Per', 'Vmag': 3.76, 'alias': 'BD+55 714;SAO23655', 'RA': 2.8449444444444447, 'DE': 55.89555555555555, 'mark': ''}), dict ({'name': '23Gam Per', 'Vmag': 2.93, 'alias': 'BD+52 654;SAO23789', 'RA': 3.0799444444444446, 'DE': 53.506388888888885, 'mark': ''}), dict ({'name': '33Alp Per', 'Vmag': 1.79, 'alias': 'BD+49 917;SAO38787', 'RA': 3.405388888888889, 'DE': 49.861111111111114, 'mark': tuple (['天船三', 'Mirfak'])}), dict ({'name': '39Del Per', 'Vmag': 3.01, 'alias': 'BD+47 876;SAO39053', 'RA': 3.715416666666667, 'DE': 47.7875, 'mark': ''}), dict ({'name': '45Eps Per', 'Vmag': 2.89, 'alias': 'BD+39 895;SAO56840', 'RA': 3.9642222222222223, 'DE': 40.01027777777778, 'mark': ''}), dict ({'name': '46Xi Per', 'Vmag': 4.04, 'alias': 'BD+35 775;SAO56856', 'RA': 3.9827500000000002, 'DE': 35.79111111111111, 'mark': ''}), dict ({'name': '44Zet Per', 'Vmag': 2.85, 'alias': 'BD+31 666;SAO56799', 'RA': 3.9021944444444445, 'DE': 31.88361111111111, 'mark': ''}), dict ({'name': '38Omi Per', 'Vmag': 3.83, 'alias': 'BD+31 642;SAO56673', 'RA': 3.738638888888889, 'DE': 32.288333333333334, 'mark': ''})]), list ([dict ({'name': '33Alp Per', 'Vmag': 1.79, 'alias': 'BD+49 917;SAO38787', 'RA': 3.405388888888889, 'DE': 49.861111111111114, 'mark': tuple (['天船三', 'Mirfak'])}), dict ({'name': '26Bet Per', 'Vmag': 2.12, 'alias': 'BD+40 673;SAO38592', 'RA': 3.136138888888889, 'DE': 40.955555555555556, 'mark': ''}), dict ({'name': '25Rho Per', 'Vmag': 3.39, 'alias': 'BD+38 630;SAO56138', 'RA': 3.086277777777778, 'DE': 38.84027777777778, 'mark': ''}), dict ({'name': '16 Per', 'Vmag': 4.23, 'alias': 'BD+37 646;SAO55928', 'RA': 2.8430833333333334, 'DE': 38.31861111111112, 'mark': ''})])])}), dict ({'name': '白羊座', 'lines': list ([list ([dict ({'name': '41 Ari', 'Vmag': 3.63, 'alias': 'BD+26 471;SAO75596', 'RA': 2.833055555555555, 'DE': 27.260555555555555, 'mark': ''}), dict ({'name': '13Alp Ari', 'Vmag': 2.0, 'alias': 'BD+22 306;SAO75151', 'RA': 2.1195555555555554, 'DE': 23.4625, 'mark': tuple (['娄宿三', 'Hamal'])}), dict ({'name': '6Bet Ari', 'Vmag': 2.64, 'alias': 'BD+20 306;SAO75012', 'RA': 1.9106666666666665, 'DE': 20.808055555555555, 'mark': ''}), dict ({'name': '5Gam1Ari', 'Vmag': 4.83, 'alias': 'BD+18 243;SAO92680', 'RA': 1.8921666666666666, 'DE': 19.295833333333334, 'mark': ''})])])}), dict ({'name': '双鱼座', 'lines': list ([list ([dict ({'name': '85Phi Psc', 'Vmag': 4.65, 'alias': 'BD+23 158;SAO74571', 'RA': 1.229138888888889, 'DE': 24.58361111111111, 'mark': ''}), dict ({'name': '90Ups Psc', 'Vmag': 4.76, 'alias': 'BD+26 220;SAO74637', 'RA': 1.3244444444444445, 'DE': 27.264166666666668, 'mark': ''}), dict ({'name': '69Sig Psc', 'Vmag': 5.5, 'alias': 'BD+31 168;SAO54374', 'RA': 1.0469722222222224, 'DE': 31.804444444444446, 'mark': ''}), dict ({'name': '85Phi Psc', 'Vmag': 4.65, 'alias': 'BD+23 158;SAO74571', 'RA': 1.229138888888889, 'DE': 24.58361111111111, 'mark': ''}), dict ({'name': '99Eta Psc', 'Vmag': 3.62, 'alias': 'BD+14 231;SAO92484', 'RA': 1.524722222222222, 'DE': 15.345833333333333, 'mark': ''}), dict ({'name': '110Omi Psc', 'Vmag': 4.26, 'alias': 'BD+08 273;SAO110110', 'RA': 1.7565555555555556, 'DE': 9.157777777777778, 'mark': ''}), dict ({'name': '113Alp Psc', 'Vmag': 5.23, 'alias': 'BD+02 317;SAO', 'RA': 2.034111111111111, 'DE': 2.763611111111111, 'mark': ''}), dict ({'name': '111Xi Psc', 'Vmag': 4.62, 'alias': 'BD+02 290;SAO110206', 'RA': 1.8925833333333333, 'DE': 3.1875, 'mark': ''}), dict ({'name': '106Nu Psc', 'Vmag': 4.44, 'alias': 'BD+04 293;SAO110065', 'RA': 1.6905277777777779, 'DE': 5.4875, 'mark': ''}), dict ({'name': '71Eps Psc', 'Vmag': 4.28, 'alias': 'BD+07 153;SAO109627', 'RA': 1.0490555555555556, 'DE': 7.89, 'mark': ''}), dict ({'name': '62 Psc', 'Vmag': 5.93, 'alias': 'BD+06 105;SAO109470', 'RA': 0.8048333333333334, 'DE': 7.3, 'mark': ''}), dict ({'name': '41 Psc', 'Vmag': 5.37, 'alias': 'BD+07 36;SAO109152', 'RA': 0.34330555555555553, 'DE': 8.190277777777778, 'mark': ''}), dict ({'name': '28Ome Psc', 'Vmag': 4.01, 'alias': 'BD+06 5227;SAO128513', 'RA': 23.98852777777778, 'DE': 6.863333333333333, 'mark': ''}), dict ({'name': '17Iot Psc', 'Vmag': 4.13, 'alias': 'BD+04 5035;SAO128310', 'RA': 23.66583333333333, 'DE': 5.626388888888889, 'mark': ''}), dict ({'name': '18Lam Psc', 'Vmag': 4.5, 'alias': 'BD+00 5037;SAO128336', 'RA': 23.700777777777777, 'DE': 1.78, 'mark': ''}), dict ({'name': '8Kap Psc', 'Vmag': 4.94, 'alias': 'BD+00 4998;SAO128186', 'RA': 23.448888888888888, 'DE': 1.2555555555555555, 'mark': ''}), dict ({'name': '6Gam Psc', 'Vmag': 3.69, 'alias': 'BD+02 4648;SAO128085', 'RA': 23.286083333333334, 'DE': 3.2822222222222224, 'mark': ''}), dict ({'name': '10The Psc', 'Vmag': 4.28, 'alias': 'BD+05 5173;SAO128196', 'RA': 23.46613888888889, 'DE': 6.378888888888889, 'mark': ''}), dict ({'name': '17Iot Psc', 'Vmag': 4.13, 'alias': 'BD+04 5035;SAO128310', 'RA': 23.66583333333333, 'DE': 5.626388888888889, 'mark': ''})])])}), dict ({'name': '天琴座', 'lines': list ([list ([dict ({'name': '3Alp Lyr', 'Vmag': 0.03, 'alias': 'BD+38 3238;SAO67174', 'RA': 18.615638888888892, 'DE': 38.78361111111111, 'mark': tuple (['织女一', 'Vega'])}), dict ({'name': '6Zet1Lyr', 'Vmag': 4.36, 'alias': 'BD+37 3222;SAO67321', 'RA': 18.746222222222222, 'DE': 37.605000000000004, 'mark': ''}), dict ({'name': '12Del2Lyr', 'Vmag': 4.3, 'alias': 'BD+36 3319;SAO67559', 'RA': 18.908388888888886, 'DE': 36.89888888888889, 'mark': ''}), dict ({'name': '14Gam Lyr', 'Vmag': 3.24, 'alias': 'BD+32 3286;SAO67663', 'RA': 18.982388888888888, 'DE': 32.68944444444444, 'mark': ''}), dict ({'name': '10Bet Lyr', 'Vmag': 3.45, 'alias': 'BD+33 3223;SAO67451', 'RA': 18.834666666666667, 'DE': 33.36277777777778, 'mark': ''}), dict ({'name': '6Zet1Lyr', 'Vmag': 4.36, 'alias': 'BD+37 3222;SAO67321', 'RA': 18.746222222222222, 'DE': 37.605000000000004, 'mark': ''})])])}), dict ({'name': '天鹅座', 'lines': list ([list ([dict ({'name': '78Mu 1Cyg', 'Vmag': 4.73, 'alias': 'BD+28 4169;SAO89940', 'RA': 21.735722222222222, 'DE': 28.74277777777778, 'mark': ''}), dict ({'name': '64Zet Cyg', 'Vmag': 3.2, 'alias': 'BD+29 4348;SAO71070', 'RA': 21.21561111111111, 'DE': 30.22694444444444, 'mark': ''}), dict ({'name': '53Eps Cyg', 'Vmag': 2.46, 'alias': 'BD+33 4018;SAO70474', 'RA': 20.770194444444442, 'DE': 33.97027777777778, 'mark': ''}), dict ({'name': '37Gam Cyg', 'Vmag': 2.2, 'alias': 'BD+39 4159;SAO49528', 'RA': 20.370472222222222, 'DE': 40.25666666666667, 'mark': ''}), dict ({'name': '18Del Cyg', 'Vmag': 2.87, 'alias': 'BD+44 3234;SAO48796', 'RA': 19.749583333333334, 'DE': 45.130833333333335, 'mark': ''}), dict ({'name': '10Iot2Cyg', 'Vmag': 3.79, 'alias': 'BD+51 2605;SAO31702', 'RA': 19.495083333333334, 'DE': 51.72972222222222, 'mark': ''}), dict ({'name': '1Kap Cyg', 'Vmag': 3.77, 'alias': 'BD+53 2216;SAO31537', 'RA': 19.28505555555556, 'DE': 53.368611111111115, 'mark': ''})]), list ([dict ({'name': '50Alp Cyg', 'Vmag': 1.25, 'alias': 'BD+44 3541;SAO49941', 'RA': 20.690527777777778, 'DE': 45.280277777777776, 'mark': tuple (['天津四', 'Deneb'])}), dict ({'name': '37Gam Cyg', 'Vmag': 2.2, 'alias': 'BD+39 4159;SAO49528', 'RA': 20.370472222222222, 'DE': 40.25666666666667, 'mark': ''}), dict ({'name': '21Eta Cyg', 'Vmag': 3.89, 'alias': 'BD+34 3798;SAO69116', 'RA': 19.938444444444446, 'DE': 35.083333333333336, 'mark': ''}), dict ({'name': '6Bet1Cyg', 'Vmag': 3.08, 'alias': 'BD+27 3410;SAO87301', 'RA': 19.512027777777778, 'DE': 27.959722222222222, 'mark': ''})])])}), dict ({'name': '仙女座', 'lines': list ([list ([dict ({'name': '57Gam1And', 'Vmag': 2.26, 'alias': 'BD+41 395;SAO37734', 'RA': 2.065, 'DE': 42.32972222222222, 'mark': ''}), dict ({'name': '43Bet And', 'Vmag': 2.06, 'alias': 'BD+34 198;SAO54471', 'RA': 1.1621944444444443, 'DE': 35.620555555555555, 'mark': ''}), dict ({'name': '31Del And', 'Vmag': 3.27, 'alias': 'BD+30 91;SAO54058', 'RA': 0.6554722222222222, 'DE': 30.860833333333336, 'mark': ''}), dict ({'name': '21Alp And', 'Vmag': 2.06, 'alias': 'BD+28 4;SAO73765', 'RA': 0.13980555555555554, 'DE': 29.090555555555554, 'mark': ''})]), list ([dict ({'name': '35Nu And', 'Vmag': 4.53, 'alias': 'BD+40 171;SAO36699', 'RA': 0.8302222222222222, 'DE': 41.07888888888889, 'mark': ''}), dict ({'name': '37Mu And', 'Vmag': 3.87, 'alias': 'BD+37 175;SAO54281', 'RA': 0.9458888888888889, 'DE': 38.49944444444444, 'mark': ''}), dict ({'name': '43Bet And', 'Vmag': 2.06, 'alias': 'BD+34 198;SAO54471', 'RA': 1.1621944444444443, 'DE': 35.620555555555555, 'mark': ''})])])}), dict ({'name': '飞马座', 'lines': list ([list ([dict ({'name': '27Pi 1Peg', 'Vmag': 5.58, 'alias': 'BD+32 4349;SAO72064', 'RA': 22.153777777777776, 'DE': 33.17222222222222, 'mark': ''}), dict ({'name': '44Eta Peg', 'Vmag': 2.94, 'alias': 'BD+29 4741;SAO90734', 'RA': 22.716694444444443, 'DE': 30.22138888888889, 'mark': ''}), dict ({'name': '53Bet Peg', 'Vmag': 2.42, 'alias': 'BD+27 4480;SAO90981', 'RA': 23.062916666666666, 'DE': 28.08277777777778, 'mark': ''}), dict ({'name': '21Alp And', 'Vmag': 2.06, 'alias': 'BD+28 4;SAO73765', 'RA': 0.13980555555555554, 'DE': 29.090555555555554, 'mark': ''}), dict ({'name': '88Gam Peg', 'Vmag': 2.83, 'alias': 'BD+14 14;SAO91781', 'RA': 0.22061111111111112, 'DE': 15.18361111111111, 'mark': ''}), dict ({'name': '54Alp Peg', 'Vmag': 2.49, 'alias': 'BD+14 4926;SAO108378', 'RA': 23.079361111111112, 'DE': 15.205277777777777, 'mark': ''}), dict ({'name': '46Xi Peg', 'Vmag': 4.19, 'alias': 'BD+11 4875;SAO108165', 'RA': 22.778222222222222, 'DE': 12.172777777777776, 'mark': ''}), dict ({'name': '42Zet Peg', 'Vmag': 3.4, 'alias': 'BD+10 4797;SAO108103', 'RA': 22.691027777777776, 'DE': 10.831388888888888, 'mark': ''}), dict ({'name': '26The Peg', 'Vmag': 3.53, 'alias': 'BD+05 4961;SAO127340', 'RA': 22.17, 'DE': 6.197777777777778, 'mark': ''}), dict ({'name': '8Eps Peg', 'Vmag': 2.39, 'alias': 'BD+09 4891;SAO127029', 'RA': 21.736444444444444, 'DE': 9.875, 'mark': ''})]), list ([dict ({'name': '54Alp Peg', 'Vmag': 2.49, 'alias': 'BD+14 4926;SAO108378', 'RA': 23.079361111111112, 'DE': 15.205277777777777, 'mark': ''}), dict ({'name': '53Bet Peg', 'Vmag': 2.42, 'alias': 'BD+27 4480;SAO90981', 'RA': 23.062916666666666, 'DE': 28.08277777777778, 'mark': ''}), dict ({'name': '48Mu Peg', 'Vmag': 3.48, 'alias': 'BD+23 4615;SAO90816', 'RA': 22.833388888888887, 'DE': 24.601666666666667, 'mark': ''}), dict ({'name': '47Lam Peg', 'Vmag': 3.95, 'alias': 'BD+22 4709;SAO90775', 'RA': 22.77552777777778, 'DE': 23.565555555555555, 'mark': ''}), dict ({'name': '24Iot Peg', 'Vmag': 3.76, 'alias': 'BD+24 4533;SAO90238', 'RA': 22.116861111111113, 'DE': 25.345, 'mark': ''}), dict ({'name': '10Kap Peg', 'Vmag': 4.13, 'alias': 'BD+24 4463;SAO89949', 'RA': 21.744083333333336, 'DE': 25.645, 'mark': ''})])])}), dict ({'name': '狐狸座', 'lines': list ([list ([dict ({'name': '6Alp Vul', 'Vmag': 4.44, 'alias': 'BD+24 3759;SAO87261', 'RA': 19.478416666666664, 'DE': 24.665, 'mark': ''}), dict ({'name': '15 Vul', 'Vmag': 4.64, 'alias': 'BD+27 3587;SAO88071', 'RA': 20.018361111111112, 'DE': 27.753611111111113, 'mark': ''})])])}), dict ({'name': '天箭座', 'lines': list ([list ([dict ({'name': '16Eta Sge', 'Vmag': 5.1, 'alias': 'BD+19 4277;SAO105659', 'RA': 20.08597222222222, 'DE': 19.991111111111113, 'mark': ''}), dict ({'name': '12Gam Sge', 'Vmag': 3.47, 'alias': 'BD+19 4229;SAO105500', 'RA': 19.979277777777774, 'DE': 19.492222222222225, 'mark': ''}), dict ({'name': '7Del Sge', 'Vmag': 3.82, 'alias': 'BD+18 4240;SAO105259', 'RA': 19.789805555555557, 'DE': 18.534166666666668, 'mark': ''}), dict ({'name': '5Alp Sge', 'Vmag': 4.37, 'alias': 'BD+17 4042;SAO105120', 'RA': 19.668277777777778, 'DE': 18.01388888888889, 'mark': ''})]), list ([dict ({'name': '7Del Sge', 'Vmag': 3.82, 'alias': 'BD+18 4240;SAO105259', 'RA': 19.789805555555557, 'DE': 18.534166666666668, 'mark': ''}), dict ({'name': '6Bet Sge', 'Vmag': 4.37, 'alias': 'BD+17 4048;SAO105133', 'RA': 19.68413888888889, 'DE': 17.47611111111111, 'mark': ''})])])}), dict ({'name': '武仙座', 'lines': list ([list ([dict ({'name': '1Chi Her', 'Vmag': 4.62, 'alias': 'BD+42 2648;SAO45772', 'RA': 15.877916666666668, 'DE': 42.45166666666667, 'mark': ''}), dict ({'name': '22Tau Her', 'Vmag': 3.89, 'alias': 'BD+46 2169;SAO46028', 'RA': 16.329, 'DE': 46.31333333333333, 'mark': ''}), dict ({'name': '35Sig Her', 'Vmag': 4.2, 'alias': 'BD+42 2724;SAO46161', 'RA': 16.56838888888889, 'DE': 42.43694444444444, 'mark': ''}), dict ({'name': '44Eta Her', 'Vmag': 3.53, 'alias': 'BD+39 3029;SAO65504', 'RA': 16.714944444444445, 'DE': 38.92222222222222, 'mark': ''}), dict ({'name': '40Zet Her', 'Vmag': 2.81, 'alias': 'BD+31 2884;SAO65485', 'RA': 16.688111111111112, 'DE': 31.603055555555557, 'mark': ''}), dict ({'name': '27Bet Her', 'Vmag': 2.77, 'alias': 'BD+21 2934;SAO84411', 'RA': 16.503666666666668, 'DE': 21.489722222222223, 'mark': ''}), dict ({'name': '20Gam Her', 'Vmag': 3.75, 'alias': 'BD+19 3086;SAO102107', 'RA': 16.365333333333336, 'DE': 19.153055555555554, 'mark': ''})]), list ([dict ({'name': '85Iot Her', 'Vmag': 3.8, 'alias': 'BD+46 2349;SAO46872', 'RA': 17.65775, 'DE': 46.006388888888885, 'mark': ''}), dict ({'name': '91The Her', 'Vmag': 3.86, 'alias': 'BD+37 2982;SAO66485', 'RA': 17.937555555555555, 'DE': 37.25055555555556, 'mark': ''}), dict ({'name': '75Rho Her', 'Vmag': 5.47, 'alias': 'BD+37 2878;SAO66000', 'RA': 17.39463888888889, 'DE': 37.14666666666667, 'mark': ''}), dict ({'name': '69 Her', 'Vmag': 4.65, 'alias': 'BD+37 2864;SAO65921', 'RA': 17.29452777777778, 'DE': 37.291666666666664, 'mark': ''}), dict ({'name': '67Pi Her', 'Vmag': 3.16, 'alias': 'BD+36 2844;SAO65890', 'RA': 17.250777777777778, 'DE': 36.80916666666666, 'mark': ''}), dict ({'name': '58Eps Her', 'Vmag': 3.92, 'alias': 'BD+31 2947;SAO65716', 'RA': 17.004833333333334, 'DE': 30.92638888888889, 'mark': ''}), dict ({'name': '76Lam Her', 'Vmag': 4.41, 'alias': 'BD+26 3034;SAO85163', 'RA': 17.512305555555557, 'DE': 26.110555555555557, 'mark': ''})]), list ([dict ({'name': '44Eta Her', 'Vmag': 3.53, 'alias': 'BD+39 3029;SAO65504', 'RA': 16.714944444444445, 'DE': 38.92222222222222, 'mark': ''}), dict ({'name': '67Pi Her', 'Vmag': 3.16, 'alias': 'BD+36 2844;SAO65890', 'RA': 17.250777777777778, 'DE': 36.80916666666666, 'mark': ''})]), list ([dict ({'name': '40Zet Her', 'Vmag': 2.81, 'alias': 'BD+31 2884;SAO65485', 'RA': 16.688111111111112, 'DE': 31.603055555555557, 'mark': ''}), dict ({'name': '58Eps Her', 'Vmag': 3.92, 'alias': 'BD+31 2947;SAO65716', 'RA': 17.004833333333334, 'DE': 30.92638888888889, 'mark': ''})]), list ([dict ({'name': '103Omi Her', 'Vmag': 3.83, 'alias': 'BD+28 2925;SAO85750', 'RA': 18.125722222222223, 'DE': 28.7625, 'mark': ''}), dict ({'name': '92Xi Her', 'Vmag': 3.7, 'alias': 'BD+29 3156;SAO85590', 'RA': 17.96275, 'DE': 29.247777777777777, 'mark': ''}), dict ({'name': '86Mu Her', 'Vmag': 3.42, 'alias': 'BD+27 2888;SAO85397', 'RA': 17.774305555555554, 'DE': 27.720555555555553, 'mark': ''}), dict ({'name': '76Lam Her', 'Vmag': 4.41, 'alias': 'BD+26 3034;SAO85163', 'RA': 17.512305555555557, 'DE': 26.110555555555557, 'mark': ''}), dict ({'name': '65Del Her', 'Vmag': 3.14, 'alias': 'BD+25 3221;SAO84951', 'RA': 17.250527777777776, 'DE': 24.839166666666664, 'mark': ''})])])}), dict ({'name': '牧夫座', 'lines': list ([list ([dict ({'name': '30Zet Boo', 'Vmag': 4.83, 'alias': 'BD+14 2770;SAO101145', 'RA': 14.685805555555556, 'DE': 13.728333333333333, 'mark': ''}), dict ({'name': '16Alp Boo', 'Vmag': -(0.04), 'alias': 'BD+19 2777;SAO100944', 'RA': 14.261027777777779, 'DE': 19.1825, 'mark': tuple (['大角', 'Arcturus'])}), dict ({'name': '36Eps Boo', 'Vmag': 5.12, 'alias': 'BD+27 2417;SAO', 'RA': 14.749777777777776, 'DE': 27.075, 'mark': ''}), dict ({'name': '49Del Boo', 'Vmag': 3.47, 'alias': 'BD+33 2561;SAO64589', 'RA': 15.25838888888889, 'DE': 33.31472222222222, 'mark': ''}), dict ({'name': '42Bet Boo', 'Vmag': 3.5, 'alias': 'BD+40 2840;SAO45337', 'RA': 15.032444444444446, 'DE': 40.39055555555556, 'mark': ''}), dict ({'name': '27Gam Boo', 'Vmag': 3.03, 'alias': 'BD+38 2565;SAO64203', 'RA': 14.534638888888889, 'DE': 38.30833333333333, 'mark': ''}), dict ({'name': '25Rho Boo', 'Vmag': 3.58, 'alias': 'BD+31 2628;SAO64202', 'RA': 14.5305, 'DE': 30.37138888888889, 'mark': ''}), dict ({'name': '16Alp Boo', 'Vmag': -(0.04), 'alias': 'BD+19 2777;SAO100944', 'RA': 14.261027777777779, 'DE': 19.1825, 'mark': tuple (['大角', 'Arcturus'])}), dict ({'name': '8Eta Boo', 'Vmag': 2.68, 'alias': 'BD+19 2725;SAO100766', 'RA': 13.911416666666668, 'DE': 18.397777777777776, 'mark': ''}), dict ({'name': '5Ups Boo', 'Vmag': 4.07, 'alias': 'BD+16 2564;SAO100725', 'RA': 13.82461111111111, 'DE': 15.797777777777778, 'mark': ''})])])}), dict ({'name': '室女座', 'lines': list ([list ([dict ({'name': '107Mu Vir', 'Vmag': 3.88, 'alias': 'BD-05 3936;SAO140090', 'RA': 14.717666666666666, 'DE': -(4.341666666666666), 'mark': ''}), dict ({'name': '99Iot Vir', 'Vmag': 4.08, 'alias': 'BD-05 3843;SAO139824', 'RA': 14.266916666666667, 'DE': -(5.999444444444444), 'mark': ''}), dict ({'name': '98Kap Vir', 'Vmag': 4.19, 'alias': 'BD-09 3878;SAO158427', 'RA': 14.214944444444443, 'DE': -(9.726388888888888), 'mark': ''}), dict ({'name': '67Alp Vir', 'Vmag': 0.98, 'alias': 'BD-10 3672;SAO157923', 'RA': 13.419888888888888, 'DE': -(10.838611111111112), 'mark': tuple (['角宿一', 'Spica'])}), dict ({'name': '79Zet Vir', 'Vmag': 3.37, 'alias': 'BD+00 3076;SAO139420', 'RA': 13.578222222222221, 'DE': 0.5958333333333333, 'mark': ''}), dict ({'name': '43Del Vir', 'Vmag': 3.38, 'alias': 'BD+04 2669;SAO119674', 'RA': 12.926722222222221, 'DE': 3.3975, 'mark': ''}), dict ({'name': '29Gam Vir', 'Vmag': 3.65, 'alias': 'BD-00 2601;SAO138917', 'RA': 12.694333333333333, 'DE': -(0.5505555555555556), 'mark': ''}), dict ({'name': '13 Vir', 'Vmag': 5.9, 'alias': 'BD+00 2920;SAO138710', 'RA': 12.311194444444444, 'DE': 0.7872222222222223, 'mark': ''}), dict ({'name': '3Nu Vir', 'Vmag': 4.03, 'alias': 'BD+07 2479;SAO119035', 'RA': 11.764333333333333, 'DE': 6.529444444444445, 'mark': ''})]), list ([dict ({'name': '109 Vir', 'Vmag': 3.72, 'alias': 'BD+02 2862;SAO120648', 'RA': 14.770805555555556, 'DE': 1.8927777777777777, 'mark': ''}), dict ({'name': '93Tau Vir', 'Vmag': 4.26, 'alias': 'BD+02 2761;SAO120238', 'RA': 14.027444444444445, 'DE': 1.5444444444444443, 'mark': ''}), dict ({'name': '79Zet Vir', 'Vmag': 3.37, 'alias': 'BD+00 3076;SAO139420', 'RA': 13.578222222222221, 'DE': 0.5958333333333333, 'mark': ''})]), list ([dict ({'name': '47Eps Vir', 'Vmag': 2.83, 'alias': 'BD+11 2529;SAO100384', 'RA': 13.036277777777778, 'DE': 10.959166666666667, 'mark': ''}), dict ({'name': '43Del Vir', 'Vmag': 3.38, 'alias': 'BD+04 2669;SAO119674', 'RA': 12.926722222222221, 'DE': 3.3975, 'mark': ''})]), list ([dict ({'name': '67Alp Vir', 'Vmag': 0.98, 'alias': 'BD-10 3672;SAO157923', 'RA': 13.419888888888888, 'DE': -(10.838611111111112), 'mark': tuple (['角宿一', 'Spica'])}), dict ({'name': '29Gam Vir', 'Vmag': 3.65, 'alias': 'BD-00 2601;SAO138917', 'RA': 12.694333333333333, 'DE': -(0.5505555555555556), 'mark': ''})])])}), dict ({'name': '金牛座', 'lines': list ([list ([dict ({'name': '123Zet Tau', 'Vmag': 3.0, 'alias': 'BD+21 908;SAO77336', 'RA': 5.627416666666667, 'DE': 21.1425, 'mark': ''}), dict ({'name': '87Alp Tau', 'Vmag': 0.85, 'alias': 'BD+16 629;SAO94027', 'RA': 4.5986666666666665, 'DE': 16.509166666666665, 'mark': tuple (['毕宿五', 'Aldebaran'])}), dict ({'name': '78The2Tau', 'Vmag': 3.4, 'alias': 'BD+15 632;SAO93957', 'RA': 4.477694444444444, 'DE': 15.870833333333334, 'mark': ''}), dict ({'name': '54Gam Tau', 'Vmag': 3.65, 'alias': 'BD+15 612;SAO93868', 'RA': 4.329888888888888, 'DE': 15.627500000000001, 'mark': ''}), dict ({'name': '61Del1Tau', 'Vmag': 3.76, 'alias': 'BD+17 712;SAO93897', 'RA': 4.38225, 'DE': 17.5425, 'mark': ''}), dict ({'name': '74Eps Tau', 'Vmag': 3.53, 'alias': 'BD+18 640;SAO93954', 'RA': 4.476944444444444, 'DE': 19.18027777777778, 'mark': ''}), dict ({'name': '94Tau Tau', 'Vmag': 4.28, 'alias': 'BD+22 739;SAO76721', 'RA': 4.704083333333333, 'DE': 22.956944444444442, 'mark': ''}), dict ({'name': '112Bet Tau', 'Vmag': 1.65, 'alias': 'BD+28 795;SAO77168', 'RA': 5.438194444444445, 'DE': 28.6075, 'mark': tuple (['五车五', 'Elnath'])})]), list ([dict ({'name': '61Del1Tau', 'Vmag': 3.76, 'alias': 'BD+17 712;SAO93897', 'RA': 4.38225, 'DE': 17.5425, 'mark': ''}), dict ({'name': '27 Tau', 'Vmag': 3.63, 'alias': 'BD+23 557;SAO76228', 'RA': 3.8193611111111108, 'DE': 24.053333333333335, 'mark': ''})]), list ([dict ({'name': '54Gam Tau', 'Vmag': 3.65, 'alias': 'BD+15 612;SAO93868', 'RA': 4.329888888888888, 'DE': 15.627500000000001, 'mark': ''}), dict ({'name': '35Lam Tau', 'Vmag': 3.47, 'alias': 'BD+12 539;SAO93719', 'RA': 4.011333333333333, 'DE': 12.490277777777777, 'mark': ''}), dict ({'name': '1Omi Tau', 'Vmag': 3.6, 'alias': 'BD+08 511;SAO111172', 'RA': 3.4135555555555555, 'DE': 9.02888888888889, 'mark': ''})])])}), dict ({'name': '御夫座', 'lines': list ([list ([dict ({'name': '112Bet Tau', 'Vmag': 1.65, 'alias': 'BD+28 795;SAO77168', 'RA': 5.438194444444445, 'DE': 28.6075, 'mark': tuple (['五车五', 'Elnath'])}), dict ({'name': '37The Aur', 'Vmag': 2.62, 'alias': 'BD+37 1380;SAO58636', 'RA': 5.995361111111111, 'DE': 37.212500000000006, 'mark': ''}), dict ({'name': '34Bet Aur', 'Vmag': 1.9, 'alias': 'BD+44 1328;SAO40750', 'RA': 5.992138888888889, 'DE': 44.9475, 'mark': tuple (['五车三', 'Menkalinan'])}), dict ({'name': '13Alp Aur', 'Vmag': 0.08, 'alias': 'BD+45 1077;SAO40186', 'RA': 5.2781666666666665, 'DE': 45.99805555555556, 'mark': tuple (['五车二', 'Capella'])}), dict ({'name': '8Zet Aur', 'Vmag': 3.75, 'alias': 'BD+40 1142;SAO39966', 'RA': 5.041305555555556, 'DE': 41.075833333333335, 'mark': ''}), dict ({'name': '3Iot Aur', 'Vmag': 2.69, 'alias': 'BD+32 855;SAO57522', 'RA': 4.949888888888889, 'DE': 33.16611111111111, 'mark': ''}), dict ({'name': '112Bet Tau', 'Vmag': 1.65, 'alias': 'BD+28 795;SAO77168', 'RA': 5.438194444444445, 'DE': 28.6075, 'mark': tuple (['五车五', 'Elnath'])})])])}), dict ({'name': '天猫座', 'lines': list ([list ([dict ({'name': '40Alp Lyn', 'Vmag': 3.13, 'alias': 'BD+35 1979;SAO61414', 'RA': 9.350916666666667, 'DE': 34.3925, 'mark': ''}), dict ({'name': '38 Lyn', 'Vmag': 3.82, 'alias': 'BD+37 1965;SAO61391', 'RA': 9.314083333333334, 'DE': 36.802499999999995, 'mark': ''}), dict ({'name': '', 'Vmag': 4.56, 'alias': 'BD+39 2200;SAO61254', 'RA': 9.108833333333333, 'DE': 38.452222222222225, 'mark': ''}), dict ({'name': '', 'Vmag': 3.97, 'alias': 'BD+42 1956;SAO42642', 'RA': 9.010666666666667, 'DE': 41.782777777777774, 'mark': ''}), dict ({'name': '31 Lyn', 'Vmag': 4.25, 'alias': 'BD+43 1815;SAO42319', 'RA': 8.380583333333334, 'DE': 43.18805555555555, 'mark': ''}), dict ({'name': '21 Lyn', 'Vmag': 4.64, 'alias': 'BD+49 1623;SAO41764', 'RA': 7.445222222222222, 'DE': 49.21138888888889, 'mark': ''}), dict ({'name': '15 Lyn', 'Vmag': 4.35, 'alias': 'BD+58 982;SAO26051', 'RA': 6.954583333333334, 'DE': 58.4225, 'mark': ''}), dict ({'name': '2 Lyn', 'Vmag': 4.48, 'alias': 'BD+59 959;SAO25665', 'RA': 6.327055555555555, 'DE': 59.01083333333333, 'mark': ''})])])}), dict ({'name': '天龙座', 'lines': list ([list ([dict ({'name': '1Lam Dra', 'Vmag': 3.84, 'alias': 'BD+70 665;SAO15532', 'RA': 11.52338888888889, 'DE': 69.33111111111111, 'mark': ''}), dict ({'name': '5Kap Dra', 'Vmag': 3.87, 'alias': 'BD+70 703;SAO7593', 'RA': 12.558055555555557, 'DE': 69.78833333333333, 'mark': ''}), dict ({'name': '11Alp Dra', 'Vmag': 3.65, 'alias': 'BD+65 978;SAO16273', 'RA': 14.073138888888888, 'DE': 64.37583333333333, 'mark': ''}), dict ({'name': '12Iot Dra', 'Vmag': 3.29, 'alias': 'BD+59 1654;SAO29520', 'RA': 15.4155, 'DE': 58.96611111111111, 'mark': ''}), dict ({'name': '13The Dra', 'Vmag': 4.01, 'alias': 'BD+58 1608;SAO29765', 'RA': 16.03147222222222, 'DE': 58.56527777777777, 'mark': ''}), dict ({'name': '14Eta Dra', 'Vmag': 2.74, 'alias': 'BD+61 1591;SAO17074', 'RA': 16.39986111111111, 'DE': 61.51416666666667, 'mark': ''}), dict ({'name': '22Zet Dra', 'Vmag': 3.17, 'alias': 'BD+65 1170;SAO17365', 'RA': 17.146444444444445, 'DE': 65.71472222222222, 'mark': ''}), dict ({'name': '44Chi Dra', 'Vmag': 3.57, 'alias': 'BD+72 839;SAO9087', 'RA': 18.350944444444448, 'DE': 72.73277777777778, 'mark': ''}), dict ({'name': '60Tau Dra', 'Vmag': 4.45, 'alias': 'BD+73 857;SAO9366', 'RA': 19.259166666666665, 'DE': 73.35555555555555, 'mark': ''}), dict ({'name': '63Eps Dra', 'Vmag': 3.83, 'alias': 'BD+69 1070;SAO9540', 'RA': 19.80288888888889, 'DE': 70.26777777777778, 'mark': ''}), dict ({'name': '57Del Dra', 'Vmag': 3.07, 'alias': 'BD+67 1129;SAO18222', 'RA': 19.20925, 'DE': 67.66166666666668, 'mark': ''}), dict ({'name': '32Xi Dra', 'Vmag': 3.75, 'alias': 'BD+56 2033;SAO30631', 'RA': 17.892138888888887, 'DE': 56.87277777777778, 'mark': ''}), dict ({'name': '33Gam Dra', 'Vmag': 2.23, 'alias': 'BD+51 2282;SAO30653', 'RA': 17.943444444444445, 'DE': 51.48888888888889, 'mark': ''}), dict ({'name': '23Bet Dra', 'Vmag': 2.79, 'alias': 'BD+52 2065;SAO30429', 'RA': 17.50722222222222, 'DE': 52.30138888888889, 'mark': ''}), dict ({'name': '25Nu 2Dra', 'Vmag': 4.87, 'alias': 'BD+55 1945;SAO30450', 'RA': 17.53777777777778, 'DE': 55.17305555555555, 'mark': ''}), dict ({'name': '32Xi Dra', 'Vmag': 3.75, 'alias': 'BD+56 2033;SAO30631', 'RA': 17.892138888888887, 'DE': 56.87277777777778, 'mark': ''})])])}), dict ({'name': '天鹰座', 'lines': list ([list ([dict ({'name': '50Gam Aql', 'Vmag': 2.72, 'alias': 'BD+10 4043;SAO105223', 'RA': 19.771, 'DE': 10.613333333333333, 'mark': ''}), dict ({'name': '53Alp Aql', 'Vmag': 0.77, 'alias': 'BD+08 4236;SAO125122', 'RA': 19.84638888888889, 'DE': 8.868333333333334, 'mark': tuple (['河鼓二', 'Altair'])}), dict ({'name': '60Bet Aql', 'Vmag': 3.71, 'alias': 'BD+06 4357;SAO125235', 'RA': 19.92188888888889, 'DE': 6.406666666666667, 'mark': ''})]), list ([dict ({'name': '13Eps Aql', 'Vmag': 4.02, 'alias': 'BD+14 3736;SAO104318', 'RA': 18.993722222222225, 'DE': 15.068333333333333, 'mark': ''}), dict ({'name': '17Zet Aql', 'Vmag': 2.99, 'alias': 'BD+13 3899;SAO104461', 'RA': 19.090166666666665, 'DE': 13.863333333333333, 'mark': ''}), dict ({'name': '30Del Aql', 'Vmag': 3.36, 'alias': 'BD+02 3879;SAO124603', 'RA': 19.424972222222223, 'DE': 3.1147222222222224, 'mark': ''}), dict ({'name': '55Eta Aql', 'Vmag': 3.9, 'alias': 'BD+00 4337;SAO125159', 'RA': 19.874555555555556, 'DE': 1.0055555555555555, 'mark': ''}), dict ({'name': '65The Aql', 'Vmag': 3.23, 'alias': 'BD-01 3911;SAO144150', 'RA': 20.18841666666667, 'DE': 0.8213888888888888, 'mark': ''})]), list ([dict ({'name': '53Alp Aql', 'Vmag': 0.77, 'alias': 'BD+08 4236;SAO125122', 'RA': 19.84638888888889, 'DE': 8.868333333333334, 'mark': tuple (['河鼓二', 'Altair'])}), dict ({'name': '30Del Aql', 'Vmag': 3.36, 'alias': 'BD+02 3879;SAO124603', 'RA': 19.424972222222223, 'DE': 3.1147222222222224, 'mark': ''}), dict ({'name': '16Lam Aql', 'Vmag': 3.44, 'alias': 'BD-05 4876;SAO143021', 'RA': 19.10413888888889, 'DE': -(3.1175), 'mark': ''})])])}), dict ({'name': '蝎虎座', 'lines': list ([list ([dict ({'name': '1 Lac', 'Vmag': 4.13, 'alias': 'BD+37 4526;SAO72191', 'RA': 22.266166666666667, 'DE': 37.74888888888889, 'mark': ''}), dict ({'name': '6 Lac', 'Vmag': 4.51, 'alias': 'BD+42 4420;SAO52079', 'RA': 22.50813888888889, 'DE': 43.123333333333335, 'mark': ''}), dict ({'name': '5 Lac', 'Vmag': 4.36, 'alias': 'BD+46 3719;SAO52055', 'RA': 22.492166666666666, 'DE': 47.706944444444446, 'mark': ''}), dict ({'name': '4 Lac', 'Vmag': 4.57, 'alias': 'BD+48 3715;SAO51970', 'RA': 22.40861111111111, 'DE': 49.47638888888889, 'mark': ''}), dict ({'name': '3Bet Lac', 'Vmag': 4.43, 'alias': 'BD+51 3358;SAO34395', 'RA': 22.392666666666667, 'DE': 52.22916666666667, 'mark': ''}), dict ({'name': '7Alp Lac', 'Vmag': 3.77, 'alias': 'BD+49 3875;SAO34542', 'RA': 22.521527777777777, 'DE': 50.2825, 'mark': ''}), dict ({'name': '5 Lac', 'Vmag': 4.36, 'alias': 'BD+46 3719;SAO52055', 'RA': 22.492166666666666, 'DE': 47.706944444444446, 'mark': ''})])])}), dict ({'name': '仙王座', 'lines': list ([list ([dict ({'name': '8Bet Cep', 'Vmag': 3.23, 'alias': 'BD+69 1173;SAO10057', 'RA': 21.477666666666664, 'DE': 70.56083333333333, 'mark': ''}), dict ({'name': '35Gam Cep', 'Vmag': 3.21, 'alias': 'BD+76 928;SAO10818', 'RA': 23.655777777777775, 'DE': 77.6325, 'mark': ''}), dict ({'name': '32Iot Cep', 'Vmag': 3.52, 'alias': 'BD+65 1814;SAO20268', 'RA': 22.828, 'DE': 66.20055555555555, 'mark': ''}), dict ({'name': '8Bet Cep', 'Vmag': 3.23, 'alias': 'BD+69 1173;SAO10057', 'RA': 21.477666666666664, 'DE': 70.56083333333333, 'mark': ''}), dict ({'name': '5Alp Cep', 'Vmag': 2.44, 'alias': 'BD+61 2111;SAO19302', 'RA': 21.30966666666667, 'DE': 62.58555555555556, 'mark': ''}), dict ({'name': '21Zet Cep', 'Vmag': 3.35, 'alias': 'BD+57 2475;SAO34137', 'RA': 22.18091666666667, 'DE': 58.20111111111111, 'mark': ''}), dict ({'name': '32Iot Cep', 'Vmag': 3.52, 'alias': 'BD+65 1814;SAO20268', 'RA': 22.828, 'DE': 66.20055555555555, 'mark': ''})])])}), dict ({'name': '鹿豹座', 'lines': list ([list ([dict ({'name': '', 'Vmag': 5.05, 'alias': 'BD+79 169;SAO5496', 'RA': 5.375972222222222, 'DE': 79.23111111111112, 'mark': ''}), dict ({'name': 'Gam Cam', 'Vmag': 4.63, 'alias': 'BD+70 259;SAO5006', 'RA': 3.8393055555555557, 'DE': 71.33222222222221, 'mark': ''}), dict ({'name': '', 'Vmag': 4.21, 'alias': 'BD+59 660;SAO24054', 'RA': 3.484472222222222, 'DE': 59.94027777777777, 'mark': ''}), dict ({'name': '9Alp Cam', 'Vmag': 4.29, 'alias': 'BD+66 358;SAO13298', 'RA': 4.900833333333334, 'DE': 66.34277777777777, 'mark': ''}), dict ({'name': 'Gam Cam', 'Vmag': 4.63, 'alias': 'BD+70 259;SAO5006', 'RA': 3.8393055555555557, 'DE': 71.33222222222221, 'mark': ''})])])}), dict ({'name': '小狮座', 'lines': list ([list ([dict ({'name': '10 LMi', 'Vmag': 4.55, 'alias': 'BD+37 2004;SAO61570', 'RA': 9.570388888888889, 'DE': 36.3975, 'mark': ''}), dict ({'name': '21 LMi', 'Vmag': 4.48, 'alias': 'BD+35 2110;SAO61874', 'RA': 10.123833333333334, 'DE': 35.24472222222222, 'mark': ''}), dict ({'name': '46 LMi', 'Vmag': 3.83, 'alias': 'BD+34 2172;SAO62297', 'RA': 10.888527777777778, 'DE': 34.215, 'mark': ''}), dict ({'name': '31Bet LMi', 'Vmag': 4.21, 'alias': 'BD+37 2080;SAO62053', 'RA': 10.464722222222221, 'DE': 36.70722222222223, 'mark': ''}), dict ({'name': '21 LMi', 'Vmag': 4.48, 'alias': 'BD+35 2110;SAO61874', 'RA': 10.123833333333334, 'DE': 35.24472222222222, 'mark': ''})])])}), dict ({'name': '狮子座', 'lines': list ([list ([dict ({'name': '32Alp Leo', 'Vmag': 1.35, 'alias': 'BD+12 2149;SAO98967', 'RA': 10.139527777777777, 'DE': 11.967222222222222, 'mark': tuple (['轩辕十四', 'Regulus'])}), dict ({'name': '70The Leo', 'Vmag': 3.34, 'alias': 'BD+16 2234;SAO99512', 'RA': 11.237333333333332, 'DE': 15.429444444444444, 'mark': ''}), dict ({'name': '94Bet Leo', 'Vmag': 2.14, 'alias': 'BD+15 2383;SAO99809', 'RA': 11.817666666666666, 'DE': 14.571944444444444, 'mark': ''}), dict ({'name': '68Del Leo', 'Vmag': 2.56, 'alias': 'BD+21 2298;SAO81727', 'RA': 11.235138888888889, 'DE': 20.52361111111111, 'mark': ''}), dict ({'name': '41Gam1Leo', 'Vmag': 2.61, 'alias': 'BD+20 2467;SAO81298', 'RA': 10.33286111111111, 'DE': 19.841666666666665, 'mark': ''}), dict ({'name': '36Zet Leo', 'Vmag': 3.44, 'alias': 'BD+24 2209;SAO81265', 'RA': 10.278166666666667, 'DE': 23.41722222222222, 'mark': ''}), dict ({'name': '24Mu Leo', 'Vmag': 3.88, 'alias': 'BD+26 2019;SAO81064', 'RA': 9.87938888888889, 'DE': 26.006944444444443, 'mark': ''}), dict ({'name': '17Eps Leo', 'Vmag': 2.98, 'alias': 'BD+24 2129;SAO81004', 'RA': 9.764194444444444, 'DE': 23.774166666666666, 'mark': ''})]), list ([dict ({'name': '68Del Leo', 'Vmag': 2.56, 'alias': 'BD+21 2298;SAO81727', 'RA': 11.235138888888889, 'DE': 20.52361111111111, 'mark': ''}), dict ({'name': '70The Leo', 'Vmag': 3.34, 'alias': 'BD+16 2234;SAO99512', 'RA': 11.237333333333332, 'DE': 15.429444444444444, 'mark': ''})]), list ([dict ({'name': '41Gam1Leo', 'Vmag': 2.61, 'alias': 'BD+20 2467;SAO81298', 'RA': 10.33286111111111, 'DE': 19.841666666666665, 'mark': ''}), dict ({'name': '30Eta Leo', 'Vmag': 3.52, 'alias': 'BD+17 2171;SAO98955', 'RA': 10.122222222222224, 'DE': 16.762777777777778, 'mark': ''}), dict ({'name': '32Alp Leo', 'Vmag': 1.35, 'alias': 'BD+12 2149;SAO98967', 'RA': 10.139527777777777, 'DE': 11.967222222222222, 'mark': tuple (['轩辕十四', 'Regulus'])})])])}), dict ({'name': '海豚座', 'lines': list ([list ([dict ({'name': '2Eps Del', 'Vmag': 4.03, 'alias': 'BD+10 4321;SAO106230', 'RA': 20.553555555555555, 'DE': 11.303333333333335, 'mark': ''}), dict ({'name': '6Bet Del', 'Vmag': 3.63, 'alias': 'BD+14 4369;SAO106316', 'RA': 20.625833333333333, 'DE': 14.595277777777778, 'mark': ''}), dict ({'name': '11Del Del', 'Vmag': 4.43, 'alias': 'BD+14 4403;SAO106425', 'RA': 20.724305555555553, 'DE': 15.074444444444444, 'mark': ''}), dict ({'name': '12Gam2Del', 'Vmag': 4.27, 'alias': 'BD+15 4255;SAO106476', 'RA': 20.777638888888887, 'DE': 16.124166666666667, 'mark': ''}), dict ({'name': '9Alp Del', 'Vmag': 3.77, 'alias': 'BD+15 4222;SAO106357', 'RA': 20.660638888888887, 'DE': 15.911944444444444, 'mark': ''}), dict ({'name': '6Bet Del', 'Vmag': 3.63, 'alias': 'BD+14 4369;SAO106316', 'RA': 20.625833333333333, 'DE': 14.595277777777778, 'mark': ''})])])}), dict ({'name': '小马座', 'lines': list ([list ([dict ({'name': '5Gam Equ', 'Vmag': 4.69, 'alias': 'BD+09 4732;SAO126593', 'RA': 21.172361111111112, 'DE': 10.131666666666668, 'mark': ''}), dict ({'name': '7Del Equ', 'Vmag': 4.49, 'alias': 'BD+09 4746;SAO126643', 'RA': 21.24136111111111, 'DE': 10.006944444444445, 'mark': ''}), dict ({'name': '10Bet Equ', 'Vmag': 5.16, 'alias': 'BD+06 4811;SAO126749', 'RA': 21.381555555555558, 'DE': 6.811111111111111, 'mark': ''}), dict ({'name': '8Alp Equ', 'Vmag': 3.92, 'alias': 'BD+04 4635;SAO126662', 'RA': 21.26372222222222, 'DE': 5.247777777777777, 'mark': ''}), dict ({'name': '5Gam Equ', 'Vmag': 4.69, 'alias': 'BD+09 4732;SAO126593', 'RA': 21.172361111111112, 'DE': 10.131666666666668, 'mark': ''})])])}), dict ({'name': '蛇夫座', 'lines': list ([list ([dict ({'name': '51 Oph', 'Vmag': 4.81, 'alias': 'CD-2313412;SAO185470', 'RA': 17.52361111111111, 'DE': -(22.037222222222223), 'mark': ''}), dict ({'name': '35Eta Oph', 'Vmag': 2.43, 'alias': 'BD-15 4467;SAO160332', 'RA': 17.172972222222224, 'DE': -(14.275277777777777), 'mark': ''}), dict ({'name': '60Bet Oph', 'Vmag': 2.77, 'alias': 'BD+04 3489;SAO122671', 'RA': 17.724555555555554, 'DE': 4.567222222222222, 'mark': ''}), dict ({'name': '55Alp Oph', 'Vmag': 2.08, 'alias': 'BD+12 3252;SAO102932', 'RA': 17.58225, 'DE': 12.56, 'mark': ''}), dict ({'name': '27Kap Oph', 'Vmag': 3.2, 'alias': 'BD+09 3298;SAO121962', 'RA': 16.96113888888889, 'DE': 9.375, 'mark': ''}), dict ({'name': '2Eps Oph', 'Vmag': 3.24, 'alias': 'BD-04 4086;SAO141086', 'RA': 16.30536111111111, 'DE': -(3.3074999999999997), 'mark': ''}), dict ({'name': '13Zet Oph', 'Vmag': 2.56, 'alias': 'BD-10 4350;SAO160006', 'RA': 16.619305555555556, 'DE': -(9.432777777777778), 'mark': ''}), dict ({'name': '35Eta Oph', 'Vmag': 2.43, 'alias': 'BD-15 4467;SAO160332', 'RA': 17.172972222222224, 'DE': -(14.275277777777777), 'mark': ''})])])}), dict ({'name': '巨蛇座', 'lines': list ([list ([dict ({'name': '63The1Ser', 'Vmag': 4.62, 'alias': 'BD+04 3916;SAO124068', 'RA': 18.937, 'DE': 4.203611111111111, 'mark': ''}), dict ({'name': '58Eta Ser', 'Vmag': 3.26, 'alias': 'BD-02 4599;SAO142241', 'RA': 18.35516666666667, 'DE': -(1.1011111111111112), 'mark': ''}), dict ({'name': '56Omi Ser', 'Vmag': 4.26, 'alias': 'BD-12 4808;SAO160747', 'RA': 17.69025, 'DE': -(11.124722222222221), 'mark': ''}), dict ({'name': '55Xi Ser', 'Vmag': 3.54, 'alias': 'BD-15 4621;SAO160700', 'RA': 17.626444444444445, 'DE': -(14.60138888888889), 'mark': ''}), dict ({'name': '53Nu Ser', 'Vmag': 4.33, 'alias': 'BD-12 4722;SAO160479', 'RA': 17.34713888888889, 'DE': -(11.153055555555556), 'mark': ''})]), list ([dict ({'name': '32Mu Ser', 'Vmag': 3.53, 'alias': 'BD-02 4052;SAO140787', 'RA': 15.827, 'DE': -(2.5697222222222225), 'mark': ''}), dict ({'name': '37Eps Ser', 'Vmag': 3.71, 'alias': 'BD+04 3069;SAO121218', 'RA': 15.846944444444444, 'DE': 4.477777777777778, 'mark': ''}), dict ({'name': '24Alp Ser', 'Vmag': 2.65, 'alias': 'BD+06 3088;SAO121157', 'RA': 15.737805555555555, 'DE': 6.4255555555555555, 'mark': ''}), dict ({'name': '13Del Ser', 'Vmag': 3.8, 'alias': 'BD+11 2821;SAO101623', 'RA': 15.580027777777778, 'DE': 10.5375, 'mark': ''}), dict ({'name': '28Bet Ser', 'Vmag': 3.67, 'alias': 'BD+15 2911;SAO101725', 'RA': 15.769805555555557, 'DE': 15.421944444444444, 'mark': ''}), dict ({'name': '35Kap Ser', 'Vmag': 4.09, 'alias': 'BD+18 3074;SAO101752', 'RA': 15.812333333333335, 'DE': 18.141666666666666, 'mark': ''}), dict ({'name': '41Gam Ser', 'Vmag': 3.85, 'alias': 'BD+16 2849;SAO101826', 'RA': 15.940888888888889, 'DE': 15.661666666666667, 'mark': ''}), dict ({'name': '28Bet Ser', 'Vmag': 3.67, 'alias': 'BD+15 2911;SAO101725', 'RA': 15.769805555555557, 'DE': 15.421944444444444, 'mark': ''})])])}), dict ({'name': '盾牌座', 'lines': list ([list ([dict ({'name': '', 'Vmag': 5.1, 'alias': 'BD-15 5143;SAO161964', 'RA': 18.91197222222222, 'DE': -(14.396944444444445), 'mark': ''}), dict ({'name': 'Gam Sct', 'Vmag': 4.7, 'alias': 'BD-14 5071;SAO161520', 'RA': 18.48663888888889, 'DE': -(13.434166666666666), 'mark': ''}), dict ({'name': 'Alp Sct', 'Vmag': 3.85, 'alias': 'BD-08 4638;SAO142408', 'RA': 18.586777777777776, 'DE': -(7.755833333333333), 'mark': ''}), dict ({'name': 'Bet Sct', 'Vmag': 4.22, 'alias': 'BD-04 4582;SAO142618', 'RA': 18.786250000000003, 'DE': -(3.252222222222222), 'mark': ''}), dict ({'name': '', 'Vmag': 5.2, 'alias': 'BD-05 4760;SAO142620', 'RA': 18.79138888888889, 'DE': -(4.295), 'mark': ''}), dict ({'name': '', 'Vmag': 5.1, 'alias': 'BD-15 5143;SAO161964', 'RA': 18.91197222222222, 'DE': -(14.396944444444445), 'mark': ''})])])}), dict ({'name': '巨蟹座', 'lines': list ([list ([dict ({'name': '65Alp Cnc', 'Vmag': 4.25, 'alias': 'BD+12 1948;SAO98267', 'RA': 8.974777777777778, 'DE': 11.857777777777777, 'mark': ''}), dict ({'name': '47Del Cnc', 'Vmag': 3.94, 'alias': 'BD+18 2027;SAO98087', 'RA': 8.74475, 'DE': 18.154166666666665, 'mark': ''}), dict ({'name': '43Gam Cnc', 'Vmag': 4.66, 'alias': 'BD+21 1895;SAO80378', 'RA': 8.721416666666666, 'DE': 21.46861111111111, 'mark': ''}), dict ({'name': '48Iot Cnc', 'Vmag': 6.57, 'alias': 'BD+29 1823;SAO80415', 'RA': 8.777777777777779, 'DE': 28.76527777777778, 'mark': ''})]), list ([dict ({'name': '47Del Cnc', 'Vmag': 3.94, 'alias': 'BD+18 2027;SAO98087', 'RA': 8.74475, 'DE': 18.154166666666665, 'mark': ''}), dict ({'name': '17Bet Cnc', 'Vmag': 3.52, 'alias': 'BD+09 1917;SAO116569', 'RA': 8.275250000000002, 'DE': 9.185555555555556, 'mark': ''})]), list ([dict ({'name': '43Gam Cnc', 'Vmag': 4.66, 'alias': 'BD+21 1895;SAO80378', 'RA': 8.721416666666666, 'DE': 21.46861111111111, 'mark': ''}), dict ({'name': '18Chi Cnc', 'Vmag': 5.14, 'alias': 'BD+27 1589;SAO80104', 'RA': 8.334416666666668, 'DE': 27.217777777777776, 'mark': ''})])])}), dict ({'name': '北冕座', 'lines': list ([list ([dict ({'name': '14Iot CrB', 'Vmag': 4.99, 'alias': 'BD+30 2738;SAO84152', 'RA': 16.024055555555556, 'DE': 29.851111111111113, 'mark': ''}), dict ({'name': '13Eps CrB', 'Vmag': 4.15, 'alias': 'BD+27 2558;SAO84098', 'RA': 15.959805555555555, 'DE': 26.87777777777778, 'mark': ''}), dict ({'name': '10Del CrB', 'Vmag': 4.63, 'alias': 'BD+26 2737;SAO84019', 'RA': 15.826583333333334, 'DE': 26.06833333333333, 'mark': ''}), dict ({'name': '8Gam CrB', 'Vmag': 3.84, 'alias': 'BD+26 2722;SAO83958', 'RA': 15.712388888888889, 'DE': 26.295555555555556, 'mark': ''}), dict ({'name': '5Alp CrB', 'Vmag': 2.23, 'alias': 'BD+27 2512;SAO83893', 'RA': 15.578138888888889, 'DE': 26.71472222222222, 'mark': ''}), dict ({'name': '3Bet CrB', 'Vmag': 3.68, 'alias': 'BD+29 2670;SAO83831', 'RA': 15.463805555555554, 'DE': 29.105833333333333, 'mark': ''}), dict ({'name': '4The CrB', 'Vmag': 4.14, 'alias': 'BD+31 2750;SAO64769', 'RA': 15.548833333333333, 'DE': 31.359166666666667, 'mark': ''})])])}), dict ({'name': '猎犬座', 'lines': list ([list ([dict ({'name': '12Alp2CVn', 'Vmag': 2.9, 'alias': 'BD+39 2580;SAO63257', 'RA': 12.933805555555557, 'DE': 38.318333333333335, 'mark': ''}), dict ({'name': '8Bet CVn', 'Vmag': 4.26, 'alias': 'BD+42 2321;SAO44230', 'RA': 12.562361111111112, 'DE': 41.3575, 'mark': ''})])])}), dict ({'name': '后发座', 'lines': list ([list ([dict ({'name': '42Alp Com', 'Vmag': 5.22, 'alias': 'BD+18 2697;SAO100443', 'RA': 13.166472222222222, 'DE': 17.529444444444444, 'mark': ''}), dict ({'name': '43Bet Com', 'Vmag': 4.26, 'alias': 'BD+28 2193;SAO82706', 'RA': 13.197888888888889, 'DE': 27.878055555555555, 'mark': ''}), dict ({'name': '15Gam Com', 'Vmag': 4.36, 'alias': 'BD+29 2288;SAO82313', 'RA': 12.448972222222222, 'DE': 28.26833333333333, 'mark': ''})])])}), dict ({'name': '双子座', 'lines': list ([list ([dict ({'name': '31Xi Gem', 'Vmag': 3.36, 'alias': 'BD+13 1396;SAO96074', 'RA': 6.754833333333333, 'DE': 12.895555555555555, 'mark': ''}), dict ({'name': '54Lam Gem', 'Vmag': 3.58, 'alias': 'BD+16 1443;SAO96746', 'RA': 7.301555555555556, 'DE': 16.540277777777778, 'mark': ''}), dict ({'name': '55Del Gem', 'Vmag': 3.53, 'alias': 'BD+22 1645;SAO79294', 'RA': 7.335388888888889, 'DE': 21.98222222222222, 'mark': ''}), dict ({'name': '69Ups Gem', 'Vmag': 4.06, 'alias': 'BD+27 1424;SAO79533', 'RA': 7.598694444444444, 'DE': 26.895833333333332, 'mark': ''}), dict ({'name': '60Iot Gem', 'Vmag': 3.79, 'alias': 'BD+28 1385;SAO79374', 'RA': 7.428777777777778, 'DE': 27.798055555555557, 'mark': ''}), dict ({'name': '46Tau Gem', 'Vmag': 4.41, 'alias': 'BD+30 1439;SAO59858', 'RA': 7.185666666666667, 'DE': 30.24527777777778, 'mark': ''}), dict ({'name': '27Eps Gem', 'Vmag': 2.98, 'alias': 'BD+25 1406;SAO78682', 'RA': 6.732194444444445, 'DE': 25.13111111111111, 'mark': ''}), dict ({'name': '13Mu Gem', 'Vmag': 2.88, 'alias': 'BD+22 1304;SAO78297', 'RA': 6.382666666666666, 'DE': 22.51361111111111, 'mark': ''}), dict ({'name': '7Eta Gem', 'Vmag': 3.28, 'alias': 'BD+22 1241;SAO78135', 'RA': 6.247944444444444, 'DE': 22.506666666666668, 'mark': ''}), dict ({'name': '1 Gem', 'Vmag': 4.16, 'alias': 'BD+23 1170;SAO77915', 'RA': 6.068666666666666, 'DE': 23.263333333333332, 'mark': ''})]), list ([dict ({'name': '24Gam Gem', 'Vmag': 1.93, 'alias': 'BD+16 1223;SAO95912', 'RA': 6.628527777777778, 'DE': 16.399166666666666, 'mark': tuple (['井宿三', 'Alhena'])}), dict ({'name': '43Zet Gem', 'Vmag': 3.79, 'alias': 'BD+20 1687;SAO79031', 'RA': 7.068472222222222, 'DE': 20.57027777777778, 'mark': ''}), dict ({'name': '55Del Gem', 'Vmag': 3.53, 'alias': 'BD+22 1645;SAO79294', 'RA': 7.335388888888889, 'DE': 21.98222222222222, 'mark': ''})]), list ([dict ({'name': '77Kap Gem', 'Vmag': 3.57, 'alias': 'BD+24 1759;SAO79653', 'RA': 7.740777777777778, 'DE': 24.398055555555555, 'mark': ''}), dict ({'name': '69Ups Gem', 'Vmag': 4.06, 'alias': 'BD+27 1424;SAO79533', 'RA': 7.598694444444444, 'DE': 26.895833333333332, 'mark': ''}), dict ({'name': '78Bet Gem', 'Vmag': 1.14, 'alias': 'BD+28 1463;SAO79666', 'RA': 7.75525, 'DE': 28.02611111111111, 'mark': tuple (['北河三', 'Pollux'])})]), list ([dict ({'name': '66Alp Gem', 'Vmag': 2.88, 'alias': 'BD+32 1581;SAO60198', 'RA': 7.576666666666666, 'DE': 31.88861111111111, 'mark': tuple (['北河二', 'Castor'])}), dict ({'name': '46Tau Gem', 'Vmag': 4.41, 'alias': 'BD+30 1439;SAO59858', 'RA': 7.185666666666667, 'DE': 30.24527777777778, 'mark': ''}), dict ({'name': '34The Gem', 'Vmag': 3.6, 'alias': 'BD+34 1481;SAO59570', 'RA': 6.879805555555556, 'DE': 33.961111111111116, 'mark': ''})]), list ([dict ({'name': '27Eps Gem', 'Vmag': 2.98, 'alias': 'BD+25 1406;SAO78682', 'RA': 6.732194444444445, 'DE': 25.13111111111111, 'mark': ''}), dict ({'name': '18Nu Gem', 'Vmag': 4.15, 'alias': 'BD+20 1441;SAO78423', 'RA': 6.482722222222223, 'DE': 20.21222222222222, 'mark': ''})])])}), dict ({'name': '天秤座', 'lines': list ([list ([dict ({'name': '46The Lib', 'Vmag': 4.15, 'alias': 'BD-16 4174;SAO159563', 'RA': 15.897083333333333, 'DE': -(15.270555555555555), 'mark': ''}), dict ({'name': '38Gam Lib', 'Vmag': 3.91, 'alias': 'BD-14 4237;SAO159370', 'RA': 15.592111111111112, 'DE': -(13.210555555555556), 'mark': ''}), dict ({'name': '27Bet Lib', 'Vmag': 2.61, 'alias': 'BD-08 3935;SAO140430', 'RA': 15.283444444444445, 'DE': -(8.616944444444444), 'mark': ''}), dict ({'name': '9Alp2Lib', 'Vmag': 2.75, 'alias': 'BD-15 3966;SAO158840', 'RA': 14.847972222222223, 'DE': -(15.958333333333334), 'mark': ''}), dict ({'name': '20Sig Lib', 'Vmag': 3.29, 'alias': 'CD-2411834;SAO183139', 'RA': 15.067833333333333, 'DE': -(24.718055555555555), 'mark': ''}), dict ({'name': '38Gam Lib', 'Vmag': 3.91, 'alias': 'BD-14 4237;SAO159370', 'RA': 15.592111111111112, 'DE': -(13.210555555555556), 'mark': ''})])])}), dict ({'name': '六分仪座', 'lines': list ([list ([dict ({'name': '15Alp Sex', 'Vmag': 4.49, 'alias': 'BD+00 2615;SAO137366', 'RA': 10.132305555555556, 'DE': 0.37166666666666665, 'mark': ''}), dict ({'name': '30Bet Sex', 'Vmag': 5.09, 'alias': 'BD+00 2663;SAO137608', 'RA': 10.504861111111111, 'DE': 0.6369444444444444, 'mark': ''})])])}), dict ({'name': '小犬座', 'lines': list ([list ([dict ({'name': '10Alp CMi', 'Vmag': 0.38, 'alias': 'BD+05 1739;SAO115756', 'RA': 7.655027777777778, 'DE': 5.2250000000000005, 'mark': tuple (['南河三', 'Procyon'])}), dict ({'name': '3Bet CMi', 'Vmag': 2.9, 'alias': 'BD+08 1774;SAO115456', 'RA': 7.452500000000001, 'DE': 8.289444444444444, 'mark': ''})])])}), dict ({'name': '麒麟座', 'lines': list ([list ([dict ({'name': '', 'Vmag': 5.73, 'alias': 'BD+02 1139;SAO113507', 'RA': 6.149416666666667, 'DE': 2.4994444444444444, 'mark': ''}), dict ({'name': '8Eps Mon', 'Vmag': 4.44, 'alias': 'BD+04 1236;SAO113810', 'RA': 6.396138888888889, 'DE': 4.592777777777777, 'mark': ''}), dict ({'name': '22Del Mon', 'Vmag': 4.15, 'alias': 'BD-00 1636;SAO134330', 'RA': 7.19775, 'DE': 0.49277777777777776, 'mark': ''}), dict ({'name': '29Zet Mon', 'Vmag': 4.34, 'alias': 'BD-02 2450;SAO135551', 'RA': 8.143222222222223, 'DE': -(1.016111111111111), 'mark': ''}), dict ({'name': '26Alp Mon', 'Vmag': 3.93, 'alias': 'BD-09 2172;SAO134986', 'RA': 7.687444444444445, 'DE': -(8.448888888888888), 'mark': ''})]), list ([dict ({'name': '22Del Mon', 'Vmag': 4.15, 'alias': 'BD-00 1636;SAO134330', 'RA': 7.19775, 'DE': 0.49277777777777776, 'mark': ''}), dict ({'name': '11Bet Mon', 'Vmag': 4.6, 'alias': 'BD-06 1574;SAO133316', 'RA': 6.480277777777778, 'DE': -(6.967222222222222), 'mark': ''}), dict ({'name': '5Gam Mon', 'Vmag': 3.98, 'alias': 'BD-06 1469;SAO133012', 'RA': 6.247583333333333, 'DE': -(5.7252777777777775), 'mark': ''})])])}), dict ({'name': '玉兔座', 'lines': list ([list ([dict ({'name': '18The Lep', 'Vmag': 4.67, 'alias': 'BD-14 1331;SAO151110', 'RA': 6.102583333333333, 'DE': -(13.064722222222223), 'mark': ''}), dict ({'name': '16Eta Lep', 'Vmag': 3.71, 'alias': 'BD-14 1286;SAO150957', 'RA': 5.940083333333334, 'DE': -(13.832222222222223), 'mark': ''}), dict ({'name': '14Zet Lep', 'Vmag': 3.55, 'alias': 'BD-14 1232;SAO150801', 'RA': 5.782583333333333, 'DE': -(13.178055555555556), 'mark': ''}), dict ({'name': '11Alp Lep', 'Vmag': 2.58, 'alias': 'BD-17 1166;SAO150547', 'RA': 5.5455, 'DE': -(16.177777777777777), 'mark': ''}), dict ({'name': '9Bet Lep', 'Vmag': 2.84, 'alias': 'BD-20 1096;SAO170457', 'RA': 5.47075, 'DE': -(19.240555555555556), 'mark': ''}), dict ({'name': '2Eps Lep', 'Vmag': 3.19, 'alias': 'BD-22 1000;SAO170051', 'RA': 5.091027777777778, 'DE': -(21.628888888888888), 'mark': ''}), dict ({'name': '5Mu Lep', 'Vmag': 3.31, 'alias': 'BD-16 1072;SAO150237', 'RA': 5.215527777777778, 'DE': -(15.794444444444444), 'mark': ''}), dict ({'name': '4Kap Lep', 'Vmag': 4.36, 'alias': 'BD-13 1092;SAO150239', 'RA': 5.220527777777778, 'DE': -(11.05861111111111), 'mark': ''}), dict ({'name': '3Iot Lep', 'Vmag': 4.45, 'alias': 'BD-12 1095;SAO150223', 'RA': 5.2049722222222226, 'DE': -(10.130833333333333), 'mark': ''})]), list ([dict ({'name': '5Mu Lep', 'Vmag': 3.31, 'alias': 'BD-16 1072;SAO150237', 'RA': 5.215527777777778, 'DE': -(15.794444444444444), 'mark': ''}), dict ({'name': '6Lam Lep', 'Vmag': 4.29, 'alias': 'BD-13 1127;SAO150340', 'RA': 5.32625, 'DE': -(12.823333333333334), 'mark': ''}), dict ({'name': '7Nu Lep', 'Vmag': 5.3, 'alias': 'BD-12 1132;SAO150345', 'RA': 5.333083333333333, 'DE': -(11.684444444444443), 'mark': ''})]), list ([dict ({'name': '5Mu Lep', 'Vmag': 3.31, 'alias': 'BD-16 1072;SAO150237', 'RA': 5.215527777777778, 'DE': -(15.794444444444444), 'mark': ''}), dict ({'name': '11Alp Lep', 'Vmag': 2.58, 'alias': 'BD-17 1166;SAO150547', 'RA': 5.5455, 'DE': -(16.177777777777777), 'mark': ''}), dict ({'name': '15Del Lep', 'Vmag': 3.81, 'alias': 'BD-20 1211;SAO170926', 'RA': 5.855361111111111, 'DE': -(19.120833333333334), 'mark': ''}), dict ({'name': '13Gam Lep', 'Vmag': 3.6, 'alias': 'BD-22 1211;SAO170759', 'RA': 5.741055555555556, 'DE': -(21.551666666666666), 'mark': ''}), dict ({'name': '9Bet Lep', 'Vmag': 2.84, 'alias': 'BD-20 1096;SAO170457', 'RA': 5.47075, 'DE': -(19.240555555555556), 'mark': ''})])])}), dict ({'name': '宝瓶座', 'lines': list ([list ([dict ({'name': '98 Aqr', 'Vmag': 3.97, 'alias': 'BD-20 6587;SAO191858', 'RA': 23.382833333333334, 'DE': -(19.899444444444445), 'mark': ''}), dict ({'name': '91Psi1Aqr', 'Vmag': 4.21, 'alias': 'BD-09 6156;SAO146598', 'RA': 23.26486111111111, 'DE': -(8.912222222222221), 'mark': ''}), dict ({'name': '73Lam Aqr', 'Vmag': 3.74, 'alias': 'BD-08 5968;SAO146362', 'RA': 22.876916666666666, 'DE': -(6.420277777777778), 'mark': ''}), dict ({'name': '62Eta Aqr', 'Vmag': 4.02, 'alias': 'BD-00 4384;SAO146181', 'RA': 22.589277777777777, 'DE': 0.11750000000000001, 'mark': ''}), dict ({'name': '55Zet1Aqr', 'Vmag': 4.59, 'alias': 'BD-00 4365;SAO146107', 'RA': 22.48047222222222, 'DE': 0.020277777777777777, 'mark': ''}), dict ({'name': '48Gam Aqr', 'Vmag': 3.84, 'alias': 'BD-02 5741;SAO146044', 'RA': 22.360944444444446, 'DE': -(0.6127777777777778), 'mark': ''}), dict ({'name': '34Alp Aqr', 'Vmag': 2.96, 'alias': 'BD-01 4246;SAO145862', 'RA': 22.09638888888889, 'DE': 0.3197222222222222, 'mark': ''}), dict ({'name': '43The Aqr', 'Vmag': 4.16, 'alias': 'BD-08 5845;SAO145991', 'RA': 22.280555555555555, 'DE': -(6.216666666666667), 'mark': ''}), dict ({'name': '57Sig Aqr', 'Vmag': 4.82, 'alias': 'BD-11 5850;SAO165134', 'RA': 22.51077777777778, 'DE': -(9.321944444444446), 'mark': ''}), dict ({'name': '71Tau2Aqr', 'Vmag': 4.01, 'alias': 'BD-14 6354;SAO165321', 'RA': 22.826527777777777, 'DE': -(12.407499999999999), 'mark': ''}), dict ({'name': '76Del Aqr', 'Vmag': 3.27, 'alias': 'BD-16 6173;SAO165375', 'RA': 22.910833333333333, 'DE': -(14.179166666666667), 'mark': ''}), dict ({'name': '88 Aqr', 'Vmag': 3.66, 'alias': 'BD-21 6368;SAO191683', 'RA': 23.157444444444444, 'DE': -(20.8275), 'mark': ''})]), list ([dict ({'name': '43The Aqr', 'Vmag': 4.16, 'alias': 'BD-08 5845;SAO145991', 'RA': 22.280555555555555, 'DE': -(6.216666666666667), 'mark': ''}), dict ({'name': '38 Aqr', 'Vmag': 5.46, 'alias': 'BD-12 6196;SAO164910', 'RA': 22.177083333333336, 'DE': -(10.434999999999999), 'mark': ''}), dict ({'name': '33Iot Aqr', 'Vmag': 4.27, 'alias': 'BD-14 6209;SAO164861', 'RA': 22.107277777777778, 'DE': -(12.130277777777778), 'mark': ''})]), list ([dict ({'name': '34Alp Aqr', 'Vmag': 2.96, 'alias': 'BD-01 4246;SAO145862', 'RA': 22.09638888888889, 'DE': 0.3197222222222222, 'mark': ''}), dict ({'name': '22Bet Aqr', 'Vmag': 2.91, 'alias': 'BD-06 5770;SAO145457', 'RA': 21.525972222222222, 'DE': -(4.428888888888889), 'mark': ''}), dict ({'name': '6Mu Aqr', 'Vmag': 4.73, 'alias': 'BD-09 5598;SAO144895', 'RA': 20.877555555555556, 'DE': -(7.016666666666667), 'mark': ''}), dict ({'name': '2Eps Aqr', 'Vmag': 3.77, 'alias': 'BD-10 5506;SAO144810', 'RA': 20.794611111111113, 'DE': -(8.504166666666668), 'mark': ''})])])}), dict ({'name': '鲸鱼座', 'lines': list ([list ([dict ({'name': '8Iot Cet', 'Vmag': 3.56, 'alias': 'BD-09 48;SAO128694', 'RA': 0.32380555555555557, 'DE': -(7.176111111111111), 'mark': ''}), dict ({'name': '16Bet Cet', 'Vmag': 2.04, 'alias': 'BD-18 115;SAO147420', 'RA': 0.7265, 'DE': -(16.013333333333332), 'mark': ''}), dict ({'name': '31Eta Cet', 'Vmag': 3.45, 'alias': 'BD-10 240;SAO147632', 'RA': 1.1431666666666667, 'DE': -(9.817777777777778), 'mark': ''}), dict ({'name': '45The Cet', 'Vmag': 3.6, 'alias': 'BD-08 244;SAO129274', 'RA': 1.400388888888889, 'DE': -(7.816666666666666), 'mark': ''}), dict ({'name': '55Zet Cet', 'Vmag': 3.73, 'alias': 'BD-11 359;SAO148059', 'RA': 1.8576666666666668, 'DE': -(9.665), 'mark': ''}), dict ({'name': '72Rho Cet', 'Vmag': 4.89, 'alias': 'BD-12 451;SAO148385', 'RA': 2.4324999999999997, 'DE': -(11.709444444444445), 'mark': ''}), dict ({'name': '83Eps Cet', 'Vmag': 4.84, 'alias': 'BD-12 501;SAO148528', 'RA': 2.6593888888888886, 'DE': -(10.127777777777776), 'mark': ''}), dict ({'name': '68Omi Cet', 'Vmag': 3.04, 'alias': 'BD-03 353;SAO129825', 'RA': 2.3224166666666664, 'DE': -(1.0225), 'mark': ''}), dict ({'name': '82Del Cet', 'Vmag': 4.07, 'alias': 'BD-00 406;SAO110665', 'RA': 2.6580555555555554, 'DE': 0.3286111111111111, 'mark': ''}), dict ({'name': '86Gam Cet', 'Vmag': 3.47, 'alias': 'BD+02 422;SAO110707', 'RA': 2.7216666666666667, 'DE': 3.2358333333333333, 'mark': ''}), dict ({'name': '92Alp Cet', 'Vmag': 2.53, 'alias': 'BD+03 419;SAO110920', 'RA': 3.038, 'DE': 4.089722222222222, 'mark': ''}), dict ({'name': '91Lam Cet', 'Vmag': 4.7, 'alias': 'BD+08 455;SAO110889', 'RA': 2.99525, 'DE': 8.9075, 'mark': ''}), dict ({'name': '87Mu Cet', 'Vmag': 4.27, 'alias': 'BD+09 359;SAO110723', 'RA': 2.7490277777777776, 'DE': 10.114166666666666, 'mark': ''}), dict ({'name': '73Xi 2Cet', 'Vmag': 4.28, 'alias': 'BD+07 388;SAO110543', 'RA': 2.4693055555555556, 'DE': 8.459999999999999, 'mark': ''}), dict ({'name': '65Xi 1Cet', 'Vmag': 4.37, 'alias': 'BD+08 345;SAO110408', 'RA': 2.216666666666667, 'DE': 8.846666666666668, 'mark': ''})]), list ([dict ({'name': '73Xi 2Cet', 'Vmag': 4.28, 'alias': 'BD+07 388;SAO110543', 'RA': 2.4693055555555556, 'DE': 8.459999999999999, 'mark': ''}), dict ({'name': '78Nu Cet', 'Vmag': 4.86, 'alias': 'BD+04 418;SAO110635', 'RA': 2.597916666666667, 'DE': 5.593333333333333, 'mark': ''}), dict ({'name': '86Gam Cet', 'Vmag': 3.47, 'alias': 'BD+02 422;SAO110707', 'RA': 2.7216666666666667, 'DE': 3.2358333333333333, 'mark': ''})]), list ([dict ({'name': '16Bet Cet', 'Vmag': 2.04, 'alias': 'BD-18 115;SAO147420', 'RA': 0.7265, 'DE': -(16.013333333333332), 'mark': ''}), dict ({'name': '52Tau Cet', 'Vmag': 3.5, 'alias': 'BD-16 295;SAO147986', 'RA': 1.7344722222222222, 'DE': -(14.0625), 'mark': ''}), dict ({'name': '76Sig Cet', 'Vmag': 4.75, 'alias': 'BD-15 449;SAO148445', 'RA': 2.534777777777778, 'DE': -(14.75527777777778), 'mark': ''}), dict ({'name': '89Pi Cet', 'Vmag': 4.25, 'alias': 'BD-14 519;SAO148575', 'RA': 2.735388888888889, 'DE': -(12.141388888888889), 'mark': ''}), dict ({'name': '83Eps Cet', 'Vmag': 4.84, 'alias': 'BD-12 501;SAO148528', 'RA': 2.6593888888888886, 'DE': -(10.127777777777776), 'mark': ''})])])}), dict ({'name': '乌鸦座', 'lines': list ([list ([dict ({'name': '1Alp Crv', 'Vmag': 4.02, 'alias': 'CD-2410174;SAO180505', 'RA': 12.140222222222222, 'DE': -(23.271111111111114), 'mark': ''}), dict ({'name': '2Eps Crv', 'Vmag': 3.0, 'alias': 'BD-21 3487;SAO180531', 'RA': 12.16875, 'DE': -(21.380277777777778), 'mark': ''}), dict ({'name': '4Gam Crv', 'Vmag': 2.59, 'alias': 'BD-16 3424;SAO157176', 'RA': 12.263444444444444, 'DE': -(16.458055555555553), 'mark': ''}), dict ({'name': '7Del Crv', 'Vmag': 2.95, 'alias': 'BD-15 3482;SAO157323', 'RA': 12.49775, 'DE': -(15.484444444444444), 'mark': ''}), dict ({'name': '8Eta Crv', 'Vmag': 4.31, 'alias': 'BD-15 3489;SAO157345', 'RA': 12.5345, 'DE': -(15.803888888888888), 'mark': ''})]), list ([dict ({'name': '2Eps Crv', 'Vmag': 3.0, 'alias': 'BD-21 3487;SAO180531', 'RA': 12.16875, 'DE': -(21.380277777777778), 'mark': ''}), dict ({'name': '9Bet Crv', 'Vmag': 2.65, 'alias': 'BD-22 3401;SAO180915', 'RA': 12.57311111111111, 'DE': -(22.603333333333335), 'mark': ''}), dict ({'name': '7Del Crv', 'Vmag': 2.95, 'alias': 'BD-15 3482;SAO157323', 'RA': 12.49775, 'DE': -(15.484444444444444), 'mark': ''})])])}), dict ({'name': '巨爵座', 'lines': list ([list ([dict ({'name': '12Del Crt', 'Vmag': 3.56, 'alias': 'BD-13 3345;SAO156605', 'RA': 11.32236111111111, 'DE': -(13.221388888888889), 'mark': ''}), dict ({'name': '15Gam Crt', 'Vmag': 4.08, 'alias': 'BD-16 3244;SAO156661', 'RA': 11.414694444444445, 'DE': -(16.316111111111113), 'mark': ''}), dict ({'name': '27Zet Crt', 'Vmag': 4.73, 'alias': 'BD-17 3460;SAO156869', 'RA': 11.746055555555555, 'DE': -(17.649166666666666), 'mark': ''}), dict ({'name': '30Eta Crt', 'Vmag': 5.18, 'alias': 'BD-16 3358;SAO156988', 'RA': 11.933583333333333, 'DE': -(16.84916666666667), 'mark': ''}), dict ({'name': '21The Crt', 'Vmag': 4.7, 'alias': 'BD-08 3202;SAO138296', 'RA': 11.61136111111111, 'DE': -(8.197777777777777), 'mark': ''}), dict ({'name': '14Eps Crt', 'Vmag': 4.83, 'alias': 'BD-10 3260;SAO156658', 'RA': 11.410166666666667, 'DE': -(9.140555555555556), 'mark': ''}), dict ({'name': '12Del Crt', 'Vmag': 3.56, 'alias': 'BD-13 3345;SAO156605', 'RA': 11.32236111111111, 'DE': -(13.221388888888889), 'mark': ''}), dict ({'name': '7Alp Crt', 'Vmag': 4.08, 'alias': 'BD-17 3273;SAO156375', 'RA': 10.99625, 'DE': -(17.70111111111111), 'mark': ''}), dict ({'name': '11Bet Crt', 'Vmag': 4.48, 'alias': 'BD-22 3095;SAO179624', 'RA': 11.194305555555555, 'DE': -(21.174166666666668), 'mark': ''}), dict ({'name': '15Gam Crt', 'Vmag': 4.08, 'alias': 'BD-16 3244;SAO156661', 'RA': 11.414694444444445, 'DE': -(16.316111111111113), 'mark': ''})])])}), dict ({'name': '摩羯座', 'lines': list ([list ([dict ({'name': '49Del Cap', 'Vmag': 2.87, 'alias': 'BD-16 5943;SAO164644', 'RA': 21.784000000000002, 'DE': -(15.872777777777777), 'mark': ''}), dict ({'name': '40Gam Cap', 'Vmag': 3.68, 'alias': 'BD-17 6340;SAO164560', 'RA': 21.668194444444445, 'DE': -(15.337777777777777), 'mark': ''}), dict ({'name': '32Iot Cap', 'Vmag': 4.28, 'alias': 'BD-17 6245;SAO164346', 'RA': 21.37077777777778, 'DE': -(15.165555555555555), 'mark': ''}), dict ({'name': '34Zet Cap', 'Vmag': 3.74, 'alias': 'BD-2215388;SAO190341', 'RA': 21.444444444444446, 'DE': -(21.588611111111113), 'mark': ''}), dict ({'name': '23The Cap', 'Vmag': 4.07, 'alias': 'BD-17 6174;SAO164132', 'RA': 21.09911111111111, 'DE': -(16.767222222222223), 'mark': ''}), dict ({'name': '9Bet Cap', 'Vmag': 3.08, 'alias': 'BD-15 5629;SAO163481', 'RA': 20.350194444444448, 'DE': -(13.21861111111111), 'mark': ''}), dict ({'name': '16Psi Cap', 'Vmag': 4.14, 'alias': 'CD-2515018;SAO189664', 'RA': 20.76825, 'DE': -(24.729166666666668), 'mark': ''})]), list ([dict ({'name': '9Bet Cap', 'Vmag': 3.08, 'alias': 'BD-15 5629;SAO163481', 'RA': 20.350194444444448, 'DE': -(13.21861111111111), 'mark': ''}), dict ({'name': '6Alp2Cap', 'Vmag': 3.57, 'alias': 'BD-12 5685;SAO163427', 'RA': 20.300916666666666, 'DE': -(11.455277777777779), 'mark': ''})]), list ([dict ({'name': '32Iot Cap', 'Vmag': 4.28, 'alias': 'BD-17 6245;SAO164346', 'RA': 21.37077777777778, 'DE': -(15.165555555555555), 'mark': ''}), dict ({'name': '23The Cap', 'Vmag': 4.07, 'alias': 'BD-17 6174;SAO164132', 'RA': 21.09911111111111, 'DE': -(16.767222222222223), 'mark': ''})]), list ([dict ({'name': '23The Cap', 'Vmag': 4.07, 'alias': 'BD-17 6174;SAO164132', 'RA': 21.09911111111111, 'DE': -(16.767222222222223), 'mark': ''}), dict ({'name': '18Ome Cap', 'Vmag': 4.11, 'alias': 'CD-2715082;SAO189781', 'RA': 20.863694444444445, 'DE': -(25.08083333333333), 'mark': ''})])])}), dict ({'name': '大犬座', 'lines': list ([list ([dict ({'name': '31Eta CMa', 'Vmag': 2.45, 'alias': 'CD-29 4328;SAO173651', 'RA': 7.401583333333334, 'DE': -(28.696944444444444), 'mark': ''}), dict ({'name': '28Ome CMa', 'Vmag': 3.85, 'alias': 'CD-26 4073;SAO173282', 'RA': 7.246861111111111, 'DE': -(25.227222222222224), 'mark': ''}), dict ({'name': '25Del CMa', 'Vmag': 1.84, 'alias': 'CD-26 3916;SAO173047', 'RA': 7.139861111111111, 'DE': -(25.606666666666666), 'mark': ''}), dict ({'name': '22Sig CMa', 'Vmag': 3.47, 'alias': 'CD-27 3544;SAO172797', 'RA': 7.028638888888889, 'DE': -(26.065277777777776), 'mark': ''}), dict ({'name': '21Eps CMa', 'Vmag': 1.5, 'alias': 'CD-28 3666;SAO172676', 'RA': 6.977083333333334, 'DE': -(27.02777777777778), 'mark': ''}), dict ({'name': '13Kap CMa', 'Vmag': 3.96, 'alias': 'CD-32 3404;SAO197258', 'RA': 6.830694444444444, 'DE': -(31.49138888888889), 'mark': ''})]), list ([dict ({'name': '25Del CMa', 'Vmag': 1.84, 'alias': 'CD-26 3916;SAO173047', 'RA': 7.139861111111111, 'DE': -(25.606666666666666), 'mark': ''}), dict ({'name': '24Omi2CMa', 'Vmag': 3.02, 'alias': 'CD-23 4797;SAO172839', 'RA': 7.050416666666666, 'DE': -(22.166666666666668), 'mark': ''}), dict ({'name': '9Alp CMa', 'Vmag': -(1.46), 'alias': 'BD-16 1591;SAO151881', 'RA': 6.752472222222222, 'DE': -(15.283888888888889), 'mark': tuple (['天狼', 'Sirius'])}), dict ({'name': '7Nu 2CMa', 'Vmag': 3.95, 'alias': 'BD-19 1502;SAO151702', 'RA': 6.6113888888888885, 'DE': -(18.74416666666667), 'mark': ''}), dict ({'name': '', 'Vmag': 6.91, 'alias': 'CD-23 4553;SAO172546', 'RA': 6.903611111111111, 'DE': -(22.071666666666665), 'mark': ''}), dict ({'name': '22Sig CMa', 'Vmag': 3.47, 'alias': 'CD-27 3544;SAO172797', 'RA': 7.028638888888889, 'DE': -(26.065277777777776), 'mark': ''})]), list ([dict ({'name': '21Eps CMa', 'Vmag': 1.5, 'alias': 'CD-28 3666;SAO172676', 'RA': 6.977083333333334, 'DE': -(27.02777777777778), 'mark': ''}), dict ({'name': '1Zet CMa', 'Vmag': 3.02, 'alias': 'CD-30 3038;SAO196698', 'RA': 6.338555555555555, 'DE': -(29.936666666666667), 'mark': ''})]), list ([dict ({'name': '2Bet CMa', 'Vmag': 1.98, 'alias': 'BD-17 1467;SAO151428', 'RA': 6.378333333333333, 'DE': -(16.04416666666667), 'mark': tuple (['军市一', 'Mirzam'])}), dict ({'name': '7Nu 2CMa', 'Vmag': 3.95, 'alias': 'BD-19 1502;SAO151702', 'RA': 6.6113888888888885, 'DE': -(18.74416666666667), 'mark': ''}), dict ({'name': '5Xi 2CMa', 'Vmag': 4.54, 'alias': 'BD-22 1458;SAO171982', 'RA': 6.5842777777777775, 'DE': -(21.03527777777778), 'mark': ''})]), list ([dict ({'name': '9Alp CMa', 'Vmag': -(1.46), 'alias': 'BD-16 1591;SAO151881', 'RA': 6.752472222222222, 'DE': -(15.283888888888889), 'mark': tuple (['天狼', 'Sirius'])}), dict ({'name': '20Iot CMa', 'Vmag': 4.37, 'alias': 'BD-16 1661;SAO152126', 'RA': 6.935611111111111, 'DE': -(16.945833333333333), 'mark': ''}), dict ({'name': '23Gam CMa', 'Vmag': 4.12, 'alias': 'BD-15 1625;SAO152303', 'RA': 7.0626388888888885, 'DE': -(14.366666666666667), 'mark': ''}), dict ({'name': '14The CMa', 'Vmag': 4.07, 'alias': 'BD-11 1681;SAO152071', 'RA': 6.903166666666667, 'DE': -(11.961388888888889), 'mark': ''}), dict ({'name': '20Iot CMa', 'Vmag': 4.37, 'alias': 'BD-16 1661;SAO152126', 'RA': 6.935611111111111, 'DE': -(16.945833333333333), 'mark': ''})])])}), dict ({'name': '长蛇座', 'lines': list ([list ([dict ({'name': '46Gam Hya', 'Vmag': 3.0, 'alias': 'BD-22 3554;SAO181543', 'RA': 13.315361111111113, 'DE': -(22.828333333333333), 'mark': ''}), dict ({'name': '45Psi Hya', 'Vmag': 4.95, 'alias': 'BD-22 3515;SAO181410', 'RA': 13.150916666666667, 'DE': -(22.881944444444443), 'mark': ''}), dict ({'name': 'Bet Hya', 'Vmag': 4.28, 'alias': 'CD-33 8018;SAO202901', 'RA': 11.881833333333335, 'DE': -(32.091944444444444), 'mark': ''}), dict ({'name': 'Xi Hya', 'Vmag': 3.54, 'alias': 'CD-31 9083;SAO202558', 'RA': 11.550027777777778, 'DE': -(30.14222222222222), 'mark': ''}), dict ({'name': 'Nu Hya', 'Vmag': 3.11, 'alias': 'BD-15 3138;SAO156256', 'RA': 10.827083333333333, 'DE': -(15.806388888888888), 'mark': ''}), dict ({'name': '42Mu Hya', 'Vmag': 3.81, 'alias': 'BD-16 3052;SAO155980', 'RA': 10.434833333333334, 'DE': -(15.163611111111111), 'mark': ''}), dict ({'name': '41Lam Hya', 'Vmag': 3.61, 'alias': 'BD-11 2820;SAO155785', 'RA': 10.176472222222221, 'DE': -(11.645833333333334), 'mark': ''}), dict ({'name': '39Ups1Hya', 'Vmag': 4.12, 'alias': 'BD-14 2963;SAO155542', 'RA': 9.857972222222221, 'DE': -(13.153333333333332), 'mark': ''}), dict ({'name': '30Alp Hya', 'Vmag': 1.98, 'alias': 'BD-08 2680;SAO136871', 'RA': 9.459777777777777, 'DE': -(7.341388888888889), 'mark': tuple (['星宿一', 'Alphard'])}), dict ({'name': '31Tau1Hya', 'Vmag': 4.6, 'alias': 'BD-02 2901;SAO136895', 'RA': 9.485805555555554, 'DE': -(1.2311111111111113), 'mark': ''}), dict ({'name': '32Tau2Hya', 'Vmag': 4.57, 'alias': 'BD-00 2211;SAO136932', 'RA': 9.533027777777779, 'DE': -(0.815), 'mark': ''}), dict ({'name': '22The Hya', 'Vmag': 3.88, 'alias': 'BD+02 2167;SAO117527', 'RA': 9.239416666666665, 'DE': 2.3141666666666665, 'mark': ''}), dict ({'name': '16Zet Hya', 'Vmag': 3.11, 'alias': 'BD+06 2060;SAO117264', 'RA': 8.923222222222222, 'DE': 5.945555555555556, 'mark': ''}), dict ({'name': '13Rho Hya', 'Vmag': 4.36, 'alias': 'BD+06 2040;SAO117146', 'RA': 8.807222222222222, 'DE': 5.837777777777777, 'mark': ''}), dict ({'name': '7Eta Hya', 'Vmag': 4.3, 'alias': 'BD+03 2039;SAO117050', 'RA': 8.720416666666667, 'DE': 3.3986111111111112, 'mark': ''}), dict ({'name': '5Sig Hya', 'Vmag': 4.44, 'alias': 'BD+03 2026;SAO116988', 'RA': 8.645944444444444, 'DE': 3.341388888888889, 'mark': ''}), dict ({'name': '4Del Hya', 'Vmag': 4.16, 'alias': 'BD+06 2001;SAO116965', 'RA': 8.627611111111111, 'DE': 5.703611111111111, 'mark': ''}), dict ({'name': '11Eps Hya', 'Vmag': 3.38, 'alias': 'BD+06 2036;SAO117112', 'RA': 8.779611111111112, 'DE': 6.4188888888888895, 'mark': ''}), dict ({'name': '13Rho Hya', 'Vmag': 4.36, 'alias': 'BD+06 2040;SAO117146', 'RA': 8.807222222222222, 'DE': 5.837777777777777, 'mark': ''})])])})]);\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.CONSTELLATIONS = CONSTELLATIONS;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'svg', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'svg';\n\t\t\t\t\tvar SVG = __class__ ('SVG', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, ratio) {\n\t\t\t\t\t\t\tif (typeof ratio == 'undefined' || (ratio != null && ratio .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar ratio = 80;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself._entries = list ([]);\n\t\t\t\t\t\t\tself.ratio = (function __lambda__ (f) {\n\t\t\t\t\t\t\t\treturn f * ratio;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _line () {return __get__ (this, function (self, x1, y1, x2, y2, className) {\n\t\t\t\t\t\t\tself._entries.append ('\\n <line class=\"{}\" x1=\"{}\" x2=\"{}\" y1=\"{}\" y2=\"{}\" stroke=\"black\" fill=\"none\" />\\n '.format (className, x1, x2, y1, y2));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget line () {return __get__ (this, function (self, x1, y1, x2, y2, className) {\n\t\t\t\t\t\t\tif (typeof className == 'undefined' || (className != null && className .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar className = '';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself._line (self.ratio (x1), self.ratio (y1), self.ratio (x2), self.ratio (y2), __kwargtrans__ ({className: className}));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _circle () {return __get__ (this, function (self, x, y, radius, className) {\n\t\t\t\t\t\t\tif (typeof className == 'undefined' || (className != null && className .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar className = '';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself._entries.append ('\\n <circle class=\"{}\" cx=\"{}\" cy=\"{}\" r=\"{}\" stroke=\"black\" stroke-width=\"1\" fill=\"none\" />\\n '.format (className, x, y, radius));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget circle () {return __get__ (this, function (self, x, y, radius, className) {\n\t\t\t\t\t\t\tif (typeof className == 'undefined' || (className != null && className .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar className = '';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself._circle (self.ratio (x), self.ratio (y), self.ratio (radius), className);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget polyline () {return __get__ (this, function (self, xyn, className) {\n\t\t\t\t\t\t\tif (typeof className == 'undefined' || (className != null && className .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar className = '';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar points = ' '.join ((function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tfor (var [x, y] of xyn) {\n\t\t\t\t\t\t\t\t\t__accu0__.append ('{},{}'.format (self.ratio (x), self.ratio (y)));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t}) ());\n\t\t\t\t\t\t\tself._entries.append ('<polyline class=\"{}\" fill=\"none\" stroke=\"black\"\\n points=\"{}\" />'.format (className, points));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _raw () {return __get__ (this, function (self, add) {\n\t\t\t\t\t\t\tself._entries.append (add);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _toString () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn '\\n'.join (self._entries);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget toString () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar size = 3.7;\n\t\t\t\t\t\t\tvar viewBox = '{} {} {} {}'.format (self.ratio (-(size)), self.ratio (-(size)), self.ratio (2 * size), self.ratio (2 * size));\n\t\t\t\t\t\t\treturn '<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"{}\">\\n {}</svg>'.format (viewBox, self._toString ());\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.SVG = SVG;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'tympan', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'tympan';\n\t\t\t\t\tvar sin = __init__ (__world__.math).sin;\n\t\t\t\t\tvar cos = __init__ (__world__.math).cos;\n\t\t\t\t\tvar asin = __init__ (__world__.math).asin;\n\t\t\t\t\tvar acos = __init__ (__world__.math).acos;\n\t\t\t\t\tvar pi = __init__ (__world__.math).pi;\n\t\t\t\t\tvar DISK_EXTENSION = __init__ (__world__.constants).DISK_EXTENSION;\n\t\t\t\t\tvar DISK_TIMERING_THICKNESS = __init__ (__world__.constants).DISK_TIMERING_THICKNESS;\n\t\t\t\t\tvar LATITUDE_OF_NORTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t\t\tvar LATITUDE_OF_SOUTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t\t\tvar SOLAR_TERMS = __init__ (__world__.constants).SOLAR_TERMS;\n\t\t\t\t\tvar STARMARK_ADJUST = __init__ (__world__.constants).STARMARK_ADJUST;\n\t\t\t\t\tvar __name__ = __init__ (__world__.constants).__name__;\n\t\t\t\t\tvar pi = __init__ (__world__.constants).pi;\n\t\t\t\t\tvar __name__ = __init__ (__world__.mathfunc).__name__;\n\t\t\t\t\tvar acos = __init__ (__world__.mathfunc).acos;\n\t\t\t\t\tvar add_vector = __init__ (__world__.mathfunc).add_vector;\n\t\t\t\t\tvar asin = __init__ (__world__.mathfunc).asin;\n\t\t\t\t\tvar bisect = __init__ (__world__.mathfunc).bisect;\n\t\t\t\t\tvar circle_parametric = __init__ (__world__.mathfunc).circle_parametric;\n\t\t\t\t\tvar cos = __init__ (__world__.mathfunc).cos;\n\t\t\t\t\tvar cross_product = __init__ (__world__.mathfunc).cross_product;\n\t\t\t\t\tvar latlng2xyz = __init__ (__world__.mathfunc).latlng2xyz;\n\t\t\t\t\tvar linspace = __init__ (__world__.mathfunc).linspace;\n\t\t\t\t\tvar pi = __init__ (__world__.mathfunc).pi;\n\t\t\t\t\tvar projectionLatlng = __init__ (__world__.mathfunc).projectionLatlng;\n\t\t\t\t\tvar projectionXYZ = __init__ (__world__.mathfunc).projectionXYZ;\n\t\t\t\t\tvar sin = __init__ (__world__.mathfunc).sin;\n\t\t\t\t\tvar sphere_angle = __init__ (__world__.mathfunc).sphere_angle;\n\t\t\t\t\tvar zoom_vector = __init__ (__world__.mathfunc).zoom_vector;\n\t\t\t\t\tvar SVG = __init__ (__world__.svg).SVG;\n\t\t\t\t\tvar Tympan = function (self, latitude) {\n\t\t\t\t\t\tvar svg = SVG ();\n\t\t\t\t\t\tvar projected_r_max = self.projected_r_max;\n\t\t\t\t\t\tvar projected_r_in = self.projected_r_in;\n\t\t\t\t\t\tvar zenith = tuple ([latitude, 0.0]);\n\t\t\t\t\t\tvar zenithVec1 = latlng2xyz (zenith);\n\t\t\t\t\t\tvar equatorVec2 = tuple ([0, 1.0, 0]);\n\t\t\t\t\t\tvar azinorthVec3 = cross_product (zenithVec1, equatorVec2);\n\t\t\t\t\t\tvar __left0__ = latlng2xyz (tuple ([LATITUDE_OF_SOUTHERN_TROPIC, 0]));\n\t\t\t\t\t\tvar x_of_southern_tropic = __left0__ [0];\n\t\t\t\t\t\tvar y_of_southern_tropic = __left0__ [1];\n\t\t\t\t\t\tvar z_of_southern_tropic = __left0__ [2];\n\t\t\t\t\t\tvar projected_equator = projectionLatlng (tuple ([0, 0]));\n\t\t\t\t\t\tsvg.circle (0, 0, projected_equator [0], 'circle-equator');\n\t\t\t\t\t\tsvg.circle (0, 0, projected_r_max, 'circle-southern-tropic');\n\t\t\t\t\t\tsvg.circle (0, 0, projected_r_in, 'circle-northern-tropic');\n\t\t\t\t\t\tfor (var altitudeDeg of list ([0, 10, 20, 30, 40, 50, 60, 70, 80, -(18), -(12), -(6)])) {\n\t\t\t\t\t\t\tvar altitude = (altitudeDeg / 180.0) * pi;\n\t\t\t\t\t\t\tvar R = cos (altitude);\n\t\t\t\t\t\t\tvar __left0__ = tuple ([zoom_vector (equatorVec2, R), zoom_vector (azinorthVec3, R)]);\n\t\t\t\t\t\t\tvar v1 = __left0__ [0];\n\t\t\t\t\t\t\tvar v2 = __left0__ [1];\n\t\t\t\t\t\t\tvar v3 = zoom_vector (zenithVec1, sin (altitude));\n\t\t\t\t\t\t\tvar svgPoints = list ([]);\n\t\t\t\t\t\t\tfor (var theta of linspace (-(pi) / 2, (pi * 3) / 2, 360)) {\n\t\t\t\t\t\t\t\tvar pointXYZ = add_vector (circle_parametric (v1, v2, theta), v3);\n\t\t\t\t\t\t\t\tif (pointXYZ [2] < z_of_southern_tropic) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar projectedXYZ = projectionXYZ (pointXYZ);\n\t\t\t\t\t\t\t\tsvgPoints.append (projectedXYZ);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.polyline (svgPoints, 'tympan-mesh');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (var azimuthDeg = 0; azimuthDeg < 360; azimuthDeg += 10) {\n\t\t\t\t\t\t\tvar theta = ((90 - azimuthDeg) / 180) * pi;\n\t\t\t\t\t\t\tvar azimuthVec = circle_parametric (equatorVec2, azinorthVec3, theta);\n\t\t\t\t\t\t\tvar svgPoints = list ([]);\n\t\t\t\t\t\t\tfor (var altitude of linspace (0, pi, 360)) {\n\t\t\t\t\t\t\t\tvar pointXYZ = circle_parametric (azimuthVec, zenithVec1, altitude);\n\t\t\t\t\t\t\t\tif (pointXYZ [2] < z_of_southern_tropic) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar projectedXYZ = projectionXYZ (pointXYZ);\n\t\t\t\t\t\t\t\tsvgPoints.append (projectedXYZ);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsvg.polyline (svgPoints, 'tympan-mesh');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar drawR1 = projected_r_max + DISK_EXTENSION;\n\t\t\t\t\t\tvar drawR2 = drawR1 + DISK_TIMERING_THICKNESS;\n\t\t\t\t\t\tvar drawRT = drawR1 + DISK_TIMERING_THICKNESS * 0.25;\n\t\t\t\t\t\tsvg.circle (0, 0, drawR1);\n\t\t\t\t\t\tsvg.circle (0, 0, drawR2);\n\t\t\t\t\t\tfor (var i = 0; i < 24; i++) {\n\t\t\t\t\t\t\tvar theta = ((i * 15) / 180) * pi;\n\t\t\t\t\t\t\tvar endVector1 = tuple ([drawR1 * cos (theta), drawR1 * sin (theta)]);\n\t\t\t\t\t\t\tvar endVector2 = tuple ([drawR2 * cos (theta), drawR2 * sin (theta)]);\n\t\t\t\t\t\t\tsvg.line (endVector1 [0], endVector1 [1], endVector2 [0], endVector2 [1]);\n\t\t\t\t\t\t\tvar textAngle = (theta + pi) + pi / 24;\n\t\t\t\t\t\t\tsvg._raw ('\\n <text transform=\"translate({},{}) rotate({})\" text-anchor=\"middle\" textLength=\"1.5em\">{}</text>\\n '.format (svg.ratio (drawRT * cos (textAngle)), svg.ratio (drawRT * sin (textAngle)), ((textAngle + pi / 2) / pi) * 180, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsvg._raw ('\\n <text x=\"0\" y=\"{}\" transform=\"rotate(90)\" text-anchor=\"middle\">\\n <tspan class=\"tympan-text1\" x=\"0\" dy=\"1.2em\"></tspan>\\n <tspan class=\"tympan-text2\" x=\"0\" dy=\"1.2em\"></tspan>\\n </text>\\n '.format (svg.ratio (2.2)));\n\t\t\t\t\t\treturn svg;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'constants' +\n\t\t\t\t\t\t'math' +\n\t\t\t\t\t\t'mathfunc' +\n\t\t\t\t\t\t'svg' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.DISK_EXTENSION = DISK_EXTENSION;\n\t\t\t\t\t\t__all__.DISK_TIMERING_THICKNESS = DISK_TIMERING_THICKNESS;\n\t\t\t\t\t\t__all__.LATITUDE_OF_NORTHERN_TROPIC = LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t\t\t\t__all__.LATITUDE_OF_SOUTHERN_TROPIC = LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t\t\t\t__all__.SOLAR_TERMS = SOLAR_TERMS;\n\t\t\t\t\t\t__all__.STARMARK_ADJUST = STARMARK_ADJUST;\n\t\t\t\t\t\t__all__.SVG = SVG;\n\t\t\t\t\t\t__all__.Tympan = Tympan;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.acos = acos;\n\t\t\t\t\t\t__all__.add_vector = add_vector;\n\t\t\t\t\t\t__all__.asin = asin;\n\t\t\t\t\t\t__all__.bisect = bisect;\n\t\t\t\t\t\t__all__.circle_parametric = circle_parametric;\n\t\t\t\t\t\t__all__.cos = cos;\n\t\t\t\t\t\t__all__.cross_product = cross_product;\n\t\t\t\t\t\t__all__.latlng2xyz = latlng2xyz;\n\t\t\t\t\t\t__all__.linspace = linspace;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t\t__all__.projectionLatlng = projectionLatlng;\n\t\t\t\t\t\t__all__.projectionXYZ = projectionXYZ;\n\t\t\t\t\t\t__all__.sin = sin;\n\t\t\t\t\t\t__all__.sphere_angle = sphere_angle;\n\t\t\t\t\t\t__all__.zoom_vector = zoom_vector;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t(function () {\n\t\tvar __name__ = '__main__';\n\t\tvar sin = __init__ (__world__.math).sin;\n\t\tvar cos = __init__ (__world__.math).cos;\n\t\tvar asin = __init__ (__world__.math).asin;\n\t\tvar acos = __init__ (__world__.math).acos;\n\t\tvar pi = __init__ (__world__.math).pi;\n\t\tvar CONSTELLATIONS = __init__ (__world__.stardata).CONSTELLATIONS;\n\t\tvar DISK_EXTENSION = __init__ (__world__.constants).DISK_EXTENSION;\n\t\tvar DISK_TIMERING_THICKNESS = __init__ (__world__.constants).DISK_TIMERING_THICKNESS;\n\t\tvar LATITUDE_OF_NORTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_NORTHERN_TROPIC;\n\t\tvar LATITUDE_OF_SOUTHERN_TROPIC = __init__ (__world__.constants).LATITUDE_OF_SOUTHERN_TROPIC;\n\t\tvar SOLAR_TERMS = __init__ (__world__.constants).SOLAR_TERMS;\n\t\tvar STARMARK_ADJUST = __init__ (__world__.constants).STARMARK_ADJUST;\n\t\tvar __name__ = __init__ (__world__.constants).__name__;\n\t\tvar pi = __init__ (__world__.constants).pi;\n\t\tvar SVG = __init__ (__world__.svg).SVG;\n\t\tvar __name__ = __init__ (__world__.mathfunc).__name__;\n\t\tvar acos = __init__ (__world__.mathfunc).acos;\n\t\tvar add_vector = __init__ (__world__.mathfunc).add_vector;\n\t\tvar asin = __init__ (__world__.mathfunc).asin;\n\t\tvar bisect = __init__ (__world__.mathfunc).bisect;\n\t\tvar circle_parametric = __init__ (__world__.mathfunc).circle_parametric;\n\t\tvar cos = __init__ (__world__.mathfunc).cos;\n\t\tvar cross_product = __init__ (__world__.mathfunc).cross_product;\n\t\tvar latlng2xyz = __init__ (__world__.mathfunc).latlng2xyz;\n\t\tvar linspace = __init__ (__world__.mathfunc).linspace;\n\t\tvar pi = __init__ (__world__.mathfunc).pi;\n\t\tvar projectionLatlng = __init__ (__world__.mathfunc).projectionLatlng;\n\t\tvar projectionXYZ = __init__ (__world__.mathfunc).projectionXYZ;\n\t\tvar sin = __init__ (__world__.mathfunc).sin;\n\t\tvar sphere_angle = __init__ (__world__.mathfunc).sphere_angle;\n\t\tvar zoom_vector = __init__ (__world__.mathfunc).zoom_vector;\n\t\tvar Tympan = __init__ (__world__.tympan).Tympan;\n\t\tvar Rete = __init__ (__world__.rete).Rete;\n\t\tvar Astrolabe = __class__ ('Astrolabe', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\tvar __left0__ = projectionLatlng (tuple ([LATITUDE_OF_SOUTHERN_TROPIC, 0]));\n\t\t\t\tvar projected_r_max = __left0__ [0];\n\t\t\t\tvar _ = __left0__ [1];\n\t\t\t\tvar __left0__ = projectionLatlng (tuple ([LATITUDE_OF_NORTHERN_TROPIC, 0]));\n\t\t\t\tvar projected_r_in = __left0__ [0];\n\t\t\t\tvar __ = __left0__ [1];\n\t\t\t\tself.projected_ecliptic_center = (projected_r_max - projected_r_in) / 2;\n\t\t\t\tself.projected_ecliptic_radius = (projected_r_max + projected_r_in) / 2;\n\t\t\t\tself.projected_r_max = projected_r_max;\n\t\t\t\tself.projected_r_in = projected_r_in;\n\t\t\t});},\n\t\t\tget getSVG () {return __get__ (this, function (self, latitude) {\n\t\t\t\tvar mainSVG = SVG ();\n\t\t\t\tvar subsvg = Tympan (self, latitude);\n\t\t\t\tmainSVG._raw ('<g class=\"tympan\">{}</g>'.format (subsvg._toString ()));\n\t\t\t\tvar subsvg = Rete (self);\n\t\t\t\tmainSVG._raw ('<g class=\"rete\">{}</g>'.format (subsvg._toString ()));\n\t\t\t\treturn mainSVG.toString ();\n\t\t\t});},\n\t\t\tget getSunArrow1Angle () {return __get__ (this, function (self, solarEclipticLongitudeInDegrees) {\n\t\t\t\tvar projected_ecliptic_center = self.projected_ecliptic_center;\n\t\t\t\tvar projected_ecliptic_radius = self.projected_ecliptic_radius;\n\t\t\t\tvar getRFromEcliptic = function (theta) {\n\t\t\t\t\tvar a = 1;\n\t\t\t\t\tvar b = (-(2) * projected_ecliptic_center) * cos (theta);\n\t\t\t\t\tvar c = Math.pow (projected_ecliptic_center, 2) - Math.pow (projected_ecliptic_radius, 2);\n\t\t\t\t\tvar R = (-(b) + Math.pow (Math.pow (b, 2) - (4 * a) * c, 0.5)) / (2 * a);\n\t\t\t\t\treturn R;\n\t\t\t\t};\n\t\t\t\tvar ecllng = (solarEclipticLongitudeInDegrees / 180) * pi + pi / 2;\n\t\t\t\tvar R = getRFromEcliptic (ecllng);\n\t\t\t\tvar angle1 = asin ((projected_ecliptic_center * sin (ecllng)) / projected_ecliptic_radius);\n\t\t\t\tvar retAngle = angle1 + ecllng;\n\t\t\t\treturn 90 - (retAngle / pi) * 180.0;\n\t\t\t});},\n\t\t\tget getSunArrow2Angle () {return __get__ (this, function (self, solarEclipticLongitudeInDegrees) {\n\t\t\t\treturn -(solarEclipticLongitudeInDegrees);\n\t\t\t});},\n\t\t\tget getReteAngle () {return __get__ (this, function (self, solarEclipticLongitudeInDegrees, siderealTimeIn24Hours) {\n\t\t\t\treturn (siderealTimeIn24Hours * 15 + solarEclipticLongitudeInDegrees) + 270;\n\t\t\t});}\n\t\t});\n\t\t__pragma__ ('<use>' +\n\t\t\t'constants' +\n\t\t\t'math' +\n\t\t\t'mathfunc' +\n\t\t\t'rete' +\n\t\t\t'stardata' +\n\t\t\t'svg' +\n\t\t\t'tympan' +\n\t\t'</use>')\n\t\t__pragma__ ('<all>')\n\t\t\t__all__.Astrolabe = Astrolabe;\n\t\t\t__all__.CONSTELLATIONS = CONSTELLATIONS;\n\t\t\t__all__.DISK_EXTENSION = DISK_EXTENSION;\n\t\t\t__all__.DISK_TIMERING_THICKNESS = DISK_TIMERING_THICKNESS;\n\t\t\t__all__.LATITUDE_OF_NORTHERN_TROPIC = LATITUDE_OF_NORTHERN_TROPIC;\n\t\t\t__all__.LATITUDE_OF_SOUTHERN_TROPIC = LATITUDE_OF_SOUTHERN_TROPIC;\n\t\t\t__all__.Rete = Rete;\n\t\t\t__all__.SOLAR_TERMS = SOLAR_TERMS;\n\t\t\t__all__.STARMARK_ADJUST = STARMARK_ADJUST;\n\t\t\t__all__.SVG = SVG;\n\t\t\t__all__.Tympan = Tympan;\n\t\t\t__all__.__name__ = __name__;\n\t\t\t__all__.acos = acos;\n\t\t\t__all__.add_vector = add_vector;\n\t\t\t__all__.asin = asin;\n\t\t\t__all__.bisect = bisect;\n\t\t\t__all__.circle_parametric = circle_parametric;\n\t\t\t__all__.cos = cos;\n\t\t\t__all__.cross_product = cross_product;\n\t\t\t__all__.latlng2xyz = latlng2xyz;\n\t\t\t__all__.linspace = linspace;\n\t\t\t__all__.pi = pi;\n\t\t\t__all__.projectionLatlng = projectionLatlng;\n\t\t\t__all__.projectionXYZ = projectionXYZ;\n\t\t\t__all__.sin = sin;\n\t\t\t__all__.sphere_angle = sphere_angle;\n\t\t\t__all__.zoom_vector = zoom_vector;\n\t\t__pragma__ ('</all>')\n\t}) ();\n return __all__;\n}", "title": "" }, { "docid": "ad8f8caec37d3f3bd584c13ea71f5bc9", "score": "0.55968755", "text": "function r(a,b){\"string\"===typeof a&&(a=Ga(a,\"code\"));this.Ga=a.constructor;var d=new this.Ga({options:{}}),c;for(c in a)d[c]=\"body\"===c?a[c].slice():a[c];this.ka=d;this.kb=b;this.sa=!1;this.$=[];this.Ra=0;this.lb=Object.create(null);a=/^step([A-Z]\\w*)$/;var e,g;for(g in this)\"function\"===typeof this[g]&&(e=g.match(a))&&(this.lb[e[1]]=this[g].bind(this));this.R=Ha(this,this.ka,null);this.Sa=this.R.object;this.ka=Ga(this.$.join(\"\\n\"),\"polyfills\");this.$=void 0;Ia(this.ka,void 0,void 0);e=new t(this.ka,\nthis.R);e.done=!1;this.o=[e];this.xb();this.value=void 0;this.ka=d;e=new t(this.ka,this.R);e.done=!1;this.o.length=0;this.o[0]=e}", "title": "" }, { "docid": "401523fc9fad910d3f20a9357d8eaabc", "score": "0.55883414", "text": "function u(r){return r?{ray:Object(_ray_js__WEBPACK_IMPORTED_MODULE_3__[\"c\"])(r.ray),c0:r.c0,c1:r.c1}:{ray:Object(_ray_js__WEBPACK_IMPORTED_MODULE_3__[\"c\"])(),c0:0,c1:Number.MAX_VALUE}}", "title": "" }, { "docid": "6be09f8b1904190aaf652cfa8d127a10", "score": "0.5556994", "text": "function nodejsBufferThisSanityTest() {\n var buf = new Buffer('ABCD');\n var thisValues = [\n undefined, null, true, false, 123.0, 'foo',\n { foo: 'bar' },\n [ 'foo', 'bar' ],\n Duktape.dec('hex', 'deadbeef'),\n Object(Duktape.dec('hex', 'deadfeed')),\n new Buffer('ABCDEFGH'),\n function func() {}\n ];\n var funcValues = [\n Buffer,\n\n Buffer.isEncoding,\n Buffer.isBuffer,\n Buffer.byteLength,\n Buffer.concat,\n Buffer.compare,\n\n buf.length,\n buf.write,\n buf.writeUIntLE,\n buf.writeUIntBE,\n buf.writeIntLE,\n buf.writeIntBE,\n buf.readUIntLE,\n buf.readUIntBE,\n buf.readIntLE,\n buf.readIntBE,\n buf.toString,\n buf.toJSON,\n buf.equals,\n buf.compare,\n buf.copy,\n buf.slice,\n buf.fill,\n\n buf.readUInt8,\n buf.readUInt16LE,\n buf.readUInt16BE,\n buf.readUInt32LE,\n buf.readUInt32BE,\n buf.readInt8,\n buf.readInt16LE,\n buf.readInt16BE,\n buf.readInt32LE,\n buf.readInt32BE,\n buf.readFloatLE,\n buf.readFloatBE,\n buf.readDoubleLE,\n buf.readDoubleBE,\n buf.writeUInt8,\n buf.writeUInt16LE,\n buf.writeUInt16BE,\n buf.writeUInt32LE,\n buf.writeUInt32BE,\n buf.writeInt8,\n buf.writeInt16LE,\n buf.writeInt16BE,\n buf.writeInt32LE,\n buf.writeInt32BE,\n buf.writeFloatLE,\n buf.writeFloatBE,\n buf.writeDoubleLE,\n buf.writeDoubleBE\n ];\n // Pretty dummy\n var argsValues = [\n [],\n [ undefined ],\n [ buf ],\n [ 123, ],\n [ 'quux', ],\n [ buf, undefined ],\n [ buf, buf ],\n [ buf, 123 ],\n [ buf, 'quux' ],\n ];\n\n var totalCount = 0;\n var errorCount = 0;\n\n thisValues.forEach(function (thisVal) {\n funcValues.forEach(function (funcVal) {\n argsValues.forEach(function (args) {\n totalCount++;\n try {\n funcVal.apply(thisVal, args);\n } catch (e) {\n //print(e);\n errorCount++;\n }\n });\n });\n });\n\n print('total:', totalCount);\n //print('errors:', errorCount); // varies when details changed\n}", "title": "" }, { "docid": "debbff88d17394c074408276e4ee50ea", "score": "0.55377954", "text": "function pysteroids () {\n var __symbols__ = ['__py3.6__', '__esv6__'];\n var __all__ = {};\n var __world__ = __all__;\n \n // Nested object creator, part of the nesting may already exist and have attributes\n var __nest__ = function (headObject, tailNames, value) {\n // In some cases this will be a global object, e.g. 'window'\n var current = headObject;\n \n if (tailNames != '') { // Split on empty string doesn't give empty list\n // Find the last already created object in tailNames\n var tailChain = tailNames.split ('.');\n var firstNewIndex = tailChain.length;\n for (var index = 0; index < tailChain.length; index++) {\n if (!current.hasOwnProperty (tailChain [index])) {\n firstNewIndex = index;\n break;\n }\n current = current [tailChain [index]];\n }\n \n // Create the rest of the objects, if any\n for (var index = firstNewIndex; index < tailChain.length; index++) {\n current [tailChain [index]] = {};\n current = current [tailChain [index]];\n }\n }\n \n // Insert it new attributes, it may have been created earlier and have other attributes\n for (var attrib in value) {\n current [attrib] = value [attrib]; \n } \n };\n __all__.__nest__ = __nest__;\n \n // Initialize module if not yet done and return its globals\n var __init__ = function (module) {\n if (!module.__inited__) {\n module.__all__.__init__ (module.__all__);\n module.__inited__ = true;\n }\n return module.__all__;\n };\n __all__.__init__ = __init__;\n \n \n // Proxy switch, controlled by __pragma__ ('proxy') and __pragma ('noproxy')\n var __proxy__ = false; // No use assigning it to __all__, only its transient state is important\n \n \n // Since we want to assign functions, a = b.f should make b.f produce a bound function\n // So __get__ should be called by a property rather then a function\n // Factory __get__ creates one of three curried functions for func\n // Which one is produced depends on what's to the left of the dot of the corresponding JavaScript property\n var __get__ = function (self, func, quotedFuncName) {\n if (self) {\n if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) { // Object before the dot\n if (quotedFuncName) { // Memoize call since fcall is on, by installing bound function in instance\n Object.defineProperty (self, quotedFuncName, { // Will override the non-own property, next time it will be called directly\n value: function () { // So next time just call curry function that calls function\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n }, \n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n return function () { // Return bound function, code dupplication for efficiency if no memoizing\n var args = [] .slice.apply (arguments); // So multilayer search prototype, apply __get__, call curry func that calls func\n return func.apply (null, [self] .concat (args));\n };\n }\n else { // Class before the dot\n return func; // Return static method\n }\n }\n else { // Nothing before the dot\n return func; // Return free function\n }\n }\n __all__.__get__ = __get__;\n \n // Mother of all metaclasses \n var py_metatype = {\n __name__: 'type',\n __bases__: [],\n \n // Overridable class creation worker\n __new__: function (meta, name, bases, attribs) {\n // Create the class cls, a functor, which the class creator function will return\n var cls = function () { // If cls is called with arg0, arg1, etc, it calls its __new__ method with [arg0, arg1, etc]\n var args = [] .slice.apply (arguments); // It has a __new__ method, not yet but at call time, since it is copied from the parent in the loop below\n return cls.__new__ (args); // Each Python class directly or indirectly derives from object, which has the __new__ method\n }; // If there are no bases in the Python source, the compiler generates [object] for this parameter\n \n // Copy all methods, including __new__, properties and static attributes from base classes to new cls object\n // The new class object will simply be the prototype of its instances\n // JavaScript prototypical single inheritance will do here, since any object has only one class\n // This has nothing to do with Python multiple inheritance, that is implemented explictly in the copy loop below\n for (var index = bases.length - 1; index >= 0; index--) { // Reversed order, since class vars of first base should win\n var base = bases [index];\n for (var attrib in base) {\n var descrip = Object.getOwnPropertyDescriptor (base, attrib);\n Object.defineProperty (cls, attrib, descrip);\n } \n\n for (var symbol of Object.getOwnPropertySymbols (base)) {\n var descrip = Object.getOwnPropertyDescriptor (base, symbol);\n Object.defineProperty (cls, symbol, descrip);\n }\n \n }\n \n // Add class specific attributes to the created cls object\n cls.__metaclass__ = meta;\n cls.__name__ = name;\n cls.__bases__ = bases;\n \n // Add own methods, properties and own static attributes to the created cls object\n for (var attrib in attribs) {\n var descrip = Object.getOwnPropertyDescriptor (attribs, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n\n for (var symbol of Object.getOwnPropertySymbols (attribs)) {\n var descrip = Object.getOwnPropertyDescriptor (attribs, symbol);\n Object.defineProperty (cls, symbol, descrip);\n }\n \n // Return created cls object\n return cls;\n }\n };\n py_metatype.__metaclass__ = py_metatype;\n __all__.py_metatype = py_metatype;\n \n // Mother of all classes\n var object = {\n __init__: function (self) {},\n \n __metaclass__: py_metatype, // By default, all classes have metaclass type, since they derive from object\n __name__: 'object',\n __bases__: [],\n \n // Object creator function, is inherited by all classes (so could be global)\n __new__: function (args) { // Args are just the constructor args \n // In JavaScript the Python class is the prototype of the Python object\n // In this way methods and static attributes will be available both with a class and an object before the dot\n // The descriptor produced by __get__ will return the right method flavor\n var instance = Object.create (this, {__class__: {value: this, enumerable: true}});\n \n if ('__getattr__' in this || '__setattr__' in this) {\n instance = new Proxy (instance, {\n get: function (target, name) {\n var result = target [name];\n if (result == undefined) { // Target doesn't have attribute named name\n return target.__getattr__ (name);\n }\n else {\n return result;\n }\n },\n set: function (target, name, value) {\n try {\n target.__setattr__ (name, value);\n }\n catch (exception) { // Target doesn't have a __setattr__ method\n target [name] = value;\n }\n return true;\n }\n })\n }\n\n // Call constructor\n this.__init__.apply (null, [instance] .concat (args));\n\n // Return constructed instance\n return instance;\n } \n };\n __all__.object = object;\n \n // Class creator facade function, calls class creation worker\n var __class__ = function (name, bases, attribs, meta) { // Parameter meta is optional\n if (meta == undefined) {\n meta = bases [0] .__metaclass__;\n }\n \n return meta.__new__ (meta, name, bases, attribs);\n }\n __all__.__class__ = __class__;\n \n // Define __pragma__ to preserve '<all>' and '</all>', since it's never generated as a function, must be done early, so here\n var __pragma__ = function () {};\n __all__.__pragma__ = __pragma__;\n \n \t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__base__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __Envir__ = __class__ ('__Envir__', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.interpreter_name = 'python';\n\t\t\t\t\t\t\tself.transpiler_name = 'transcrypt';\n\t\t\t\t\t\t\tself.transpiler_version = '3.6.25';\n\t\t\t\t\t\t\tself.target_subdir = '__javascript__';\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __envir__ = __Envir__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__Envir__ = __Envir__;\n\t\t\t\t\t\t__all__.__envir__ = __envir__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__standard__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar Exception = __class__ ('Exception', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.__args__ = args;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.stack = kwargs.error.stack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.stack = 'No stack trace available';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn '{}{}'.format (self.__class__.__name__, repr (tuple (self.__args__)));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '{}()'.format (self.__class__.__name__);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__) > 1) {\n\t\t\t\t\t\t\t\treturn str (tuple (self.__args__));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn str (self.__args__ [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IterableError = __class__ ('IterableError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, \"Can't iterate over non-iterable\", __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StopIteration = __class__ ('StopIteration', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Iterator exhausted', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ValueError = __class__ ('ValueError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Erroneous value', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar KeyError = __class__ ('KeyError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Invalid key', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AssertionError = __class__ ('AssertionError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tif (message) {\n\t\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tException.__init__ (self, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar NotImplementedError = __class__ ('NotImplementedError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IndexError = __class__ ('IndexError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AttributeError = __class__ ('AttributeError', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Warning = __class__ ('Warning', [Exception], {\n\t\t\t\t\t});\n\t\t\t\t\tvar UserWarning = __class__ ('UserWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar DeprecationWarning = __class__ ('DeprecationWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar RuntimeWarning = __class__ ('RuntimeWarning', [Warning], {\n\t\t\t\t\t});\n\t\t\t\t\tvar __sort__ = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key) {\n\t\t\t\t\t\t\titerable.sort ((function __lambda__ (a, b) {\n\t\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'a': var a = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'b': var b = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (key (a) > key (b) ? 1 : -(1));\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\titerable.sort ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (reverse) {\n\t\t\t\t\t\t\titerable.reverse ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar sorted = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (py_typeof (iterable) == dict) {\n\t\t\t\t\t\t\tvar result = copy (iterable.py_keys ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar result = copy (iterable);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__sort__ (result, key, reverse);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t\tvar map = function (func, iterable) {\n\t\t\t\t\t\treturn function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var item of iterable) {\n\t\t\t\t\t\t\t\t__accu0__.append (func (item));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t} ();\n\t\t\t\t\t};\n\t\t\t\t\tvar filter = function (func, iterable) {\n\t\t\t\t\t\tif (func == null) {\n\t\t\t\t\t\t\tvar func = bool;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var item of iterable) {\n\t\t\t\t\t\t\t\tif (func (item)) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t} ();\n\t\t\t\t\t};\n\t\t\t\t\tvar __Terminal__ = __class__ ('__Terminal__', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.buffer = '';\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.element = document.getElementById ('__terminal__');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.element = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.style.overflowX = 'auto';\n\t\t\t\t\t\t\t\tself.element.style.boxSizing = 'border-box';\n\t\t\t\t\t\t\t\tself.element.style.padding = '5px';\n\t\t\t\t\t\t\t\tself.element.innerHTML = '_';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget print () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar sep = ' ';\n\t\t\t\t\t\t\tvar end = '\\n';\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'sep': var sep = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'end': var end = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.buffer = '{}{}{}'.format (self.buffer, sep.join (function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tfor (var arg of args) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ()), end).__getslice__ (-(4096), null, 1);\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.innerHTML = self.buffer.py_replace ('\\n', '<br>');\n\t\t\t\t\t\t\t\tself.element.scrollTop = self.element.scrollHeight;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tconsole.log (sep.join (function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tfor (var arg of args) {\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t} ()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget input () {return __get__ (this, function (self, question) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'question': var question = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.print ('{}'.format (question), __kwargtrans__ ({end: ''}));\n\t\t\t\t\t\t\tvar answer = window.prompt ('\\n'.join (self.buffer.py_split ('\\n').__getslice__ (-(16), null, 1)));\n\t\t\t\t\t\t\tself.print (answer);\n\t\t\t\t\t\t\treturn answer;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __terminal__ = __Terminal__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AssertionError = AssertionError;\n\t\t\t\t\t\t__all__.AttributeError = AttributeError;\n\t\t\t\t\t\t__all__.DeprecationWarning = DeprecationWarning;\n\t\t\t\t\t\t__all__.Exception = Exception;\n\t\t\t\t\t\t__all__.IndexError = IndexError;\n\t\t\t\t\t\t__all__.IterableError = IterableError;\n\t\t\t\t\t\t__all__.KeyError = KeyError;\n\t\t\t\t\t\t__all__.NotImplementedError = NotImplementedError;\n\t\t\t\t\t\t__all__.RuntimeWarning = RuntimeWarning;\n\t\t\t\t\t\t__all__.StopIteration = StopIteration;\n\t\t\t\t\t\t__all__.UserWarning = UserWarning;\n\t\t\t\t\t\t__all__.ValueError = ValueError;\n\t\t\t\t\t\t__all__.Warning = Warning;\n\t\t\t\t\t\t__all__.__Terminal__ = __Terminal__;\n\t\t\t\t\t\t__all__.__sort__ = __sort__;\n\t\t\t\t\t\t__all__.__terminal__ = __terminal__;\n\t\t\t\t\t\t__all__.filter = filter;\n\t\t\t\t\t\t__all__.map = map;\n\t\t\t\t\t\t__all__.sorted = sorted;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n var __call__ = function (/* <callee>, <this>, <params>* */) { // Needed for __base__ and __standard__ if global 'opov' switch is on\n var args = [] .slice.apply (arguments);\n if (typeof args [0] == 'object' && '__call__' in args [0]) { // Overloaded\n return args [0] .__call__ .apply (args [1], args.slice (2));\n }\n else { // Native\n return args [0] .apply (args [1], args.slice (2));\n }\n };\n __all__.__call__ = __call__;\n\n // Initialize non-nested modules __base__ and __standard__ and make its names available directly and via __all__\n // They can't do that itself, because they're regular Python modules\n // The compiler recognizes their names and generates them inline rather than nesting them\n // In this way it isn't needed to import them everywhere\n\n // __base__\n\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__base__));\n var __envir__ = __all__.__envir__;\n\n // __standard__\n\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__standard__));\n\n var Exception = __all__.Exception;\n var IterableError = __all__.IterableError;\n var StopIteration = __all__.StopIteration;\n var ValueError = __all__.ValueError;\n var KeyError = __all__.KeyError;\n var AssertionError = __all__.AssertionError;\n var NotImplementedError = __all__.NotImplementedError;\n var IndexError = __all__.IndexError;\n var AttributeError = __all__.AttributeError;\n\n // Warnings Exceptions\n var Warning = __all__.Warning;\n var UserWarning = __all__.UserWarning;\n var DeprecationWarning = __all__.DeprecationWarning;\n var RuntimeWarning = __all__.RuntimeWarning;\n\n var __sort__ = __all__.__sort__;\n var sorted = __all__.sorted;\n\n var map = __all__.map;\n var filter = __all__.filter;\n\n __all__.print = __all__.__terminal__.print;\n __all__.input = __all__.__terminal__.input;\n\n var __terminal__ = __all__.__terminal__;\n var print = __all__.print;\n var input = __all__.input;\n\n // Complete __envir__, that was created in __base__, for non-stub mode\n __envir__.executor_name = __envir__.transpiler_name;\n\n // Make make __main__ available in browser\n var __main__ = {__file__: ''};\n __all__.main = __main__;\n\n // Define current exception, there's at most one exception in the air at any time\n var __except__ = null;\n __all__.__except__ = __except__;\n \n // Creator of a marked dictionary, used to pass **kwargs parameter\n var __kwargtrans__ = function (anObject) {\n anObject.__kwargtrans__ = null; // Removable marker\n anObject.constructor = Object;\n return anObject;\n }\n __all__.__kwargtrans__ = __kwargtrans__;\n\n // 'Oneshot' dict promotor, used to enrich __all__ and help globals () return a true dict\n var __globals__ = function (anObject) {\n if (isinstance (anObject, dict)) { // Don't attempt to promote (enrich) again, since it will make a copy\n return anObject;\n }\n else {\n return dict (anObject)\n }\n }\n __all__.__globals__ = __globals__\n \n // Partial implementation of super () .<methodName> (<params>)\n var __super__ = function (aClass, methodName) { \n // Lean and fast, no C3 linearization, only call first implementation encountered\n // Will allow __super__ ('<methodName>') (self, <params>) rather than only <className>.<methodName> (self, <params>)\n \n for (let base of aClass.__bases__) {\n if (methodName in base) {\n return base [methodName];\n }\n }\n\n throw new Exception ('Superclass method not found'); // !!! Improve!\n }\n __all__.__super__ = __super__\n \n // Python property installer function, no member since that would bloat classes\n var property = function (getter, setter) { // Returns a property descriptor rather than a property\n if (!setter) { // ??? Make setter optional instead of dummy?\n setter = function () {};\n }\n return {get: function () {return getter (this)}, set: function (value) {setter (this, value)}, enumerable: true};\n }\n __all__.property = property;\n \n // Conditional JavaScript property installer function, prevents redefinition of properties if multiple Transcrypt apps are on one page\n var __setProperty__ = function (anObject, name, descriptor) {\n if (!anObject.hasOwnProperty (name)) {\n Object.defineProperty (anObject, name, descriptor);\n }\n }\n __all__.__setProperty__ = __setProperty__\n \n // Assert function, call to it only generated when compiling with --dassert option\n function assert (condition, message) { // Message may be undefined\n if (!condition) {\n throw AssertionError (message, new Error ());\n }\n }\n\n __all__.assert = assert;\n\n var __merge__ = function (object0, object1) {\n var result = {};\n for (var attrib in object0) {\n result [attrib] = object0 [attrib];\n }\n for (var attrib in object1) {\n result [attrib] = object1 [attrib];\n }\n return result;\n };\n __all__.__merge__ = __merge__;\n\n // Manipulating attributes by name\n \n var dir = function (obj) {\n var aList = [];\n for (var aKey in obj) {\n aList.push (aKey);\n }\n aList.sort ();\n return aList;\n };\n __all__.dir = dir;\n\n var setattr = function (obj, name, value) {\n obj [name] = value;\n };\n __all__.setattr = setattr;\n\n var getattr = function (obj, name) {\n return obj [name];\n };\n __all__.getattr= getattr;\n\n var hasattr = function (obj, name) {\n try {\n return name in obj;\n }\n catch (exception) {\n return false;\n }\n };\n __all__.hasattr = hasattr;\n\n var delattr = function (obj, name) {\n delete obj [name];\n };\n __all__.delattr = (delattr);\n\n // The __in__ function, used to mimic Python's 'in' operator\n // In addition to CPython's semantics, the 'in' operator is also allowed to work on objects, avoiding a counterintuitive separation between Python dicts and JavaScript objects\n // In general many Transcrypt compound types feature a deliberate blend of Python and JavaScript facilities, facilitating efficient integration with JavaScript libraries\n // If only Python objects and Python dicts are dealt with in a certain context, the more pythonic 'hasattr' is preferred for the objects as opposed to 'in' for the dicts\n var __in__ = function (element, container) {\n if (py_typeof (container) == dict) { // Currently only implemented as an augmented JavaScript object\n return container.hasOwnProperty (element);\n }\n else { // Parameter 'element' itself is an array, string or a plain, non-dict JavaScript object\n return (\n container.indexOf ? // If it has an indexOf\n container.indexOf (element) > -1 : // it's an array or a string,\n container.hasOwnProperty (element) // else it's a plain, non-dict JavaScript object\n );\n }\n };\n __all__.__in__ = __in__;\n\n // Find out if an attribute is special\n var __specialattrib__ = function (attrib) {\n return (attrib.startswith ('__') && attrib.endswith ('__')) || attrib == 'constructor' || attrib.startswith ('py_');\n };\n __all__.__specialattrib__ = __specialattrib__;\n\n // Len function for any object\n var len = function (anObject) {\n if (anObject) {\n var l = anObject.length;\n if (l == undefined) {\n var result = 0;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n result++;\n }\n }\n return result;\n }\n else {\n return l;\n }\n }\n else {\n return 0;\n }\n };\n __all__.len = len;\n\n // General conversions\n\n function __i__ (any) { // Conversion to iterable\n return py_typeof (any) == dict ? any.py_keys () : any;\n }\n\n function __t__ (any) { // Conversion to truthyness, __ ([1, 2, 3]) returns [1, 2, 3], needed for nonempty selection: l = list1 or list2]\n return (['boolean', 'number'] .indexOf (typeof any) >= 0 || any instanceof Function || len (any)) ? any : false;\n // JavaScript functions have a length attribute, denoting the number of parameters\n // Python objects are JavaScript functions, but their length doesn't matter, only their existence\n // By the term 'any instanceof Function' we make sure that Python objects aren't rejected when their length equals zero\n }\n __all__.__t__ = __t__;\n\n var bool = function (any) { // Always truly returns a bool, rather than something truthy or falsy\n return !!__t__ (any);\n };\n bool.__name__ = 'bool'; // So it can be used as a type with a name\n __all__.bool = bool;\n\n var float = function (any) {\n if (any == 'inf') {\n return Infinity;\n }\n else if (any == '-inf') {\n return -Infinity;\n }\n else if (isNaN (parseFloat (any))) { // Call to parseFloat needed to exclude '', ' ' etc.\n throw ValueError (new Error ());\n }\n else {\n return +any;\n }\n };\n float.__name__ = 'float';\n __all__.float = float;\n\n var int = function (any) {\n return float (any) | 0\n };\n int.__name__ = 'int';\n __all__.int = int;\n\n var py_typeof = function (anObject) {\n var aType = typeof anObject;\n if (aType == 'object') { // Directly trying '__class__ in anObject' turns out to wreck anObject in Chrome if its a primitive\n try {\n return anObject.__class__;\n }\n catch (exception) {\n return aType;\n }\n }\n else {\n return ( // Odly, the braces are required here\n aType == 'boolean' ? bool :\n aType == 'string' ? str :\n aType == 'number' ? (anObject % 1 == 0 ? int : float) :\n null\n );\n }\n };\n __all__.py_typeof = py_typeof;\n\n var isinstance = function (anObject, classinfo) {\n function isA (queryClass) {\n if (queryClass == classinfo) {\n return true;\n }\n for (var index = 0; index < queryClass.__bases__.length; index++) {\n if (isA (queryClass.__bases__ [index], classinfo)) {\n return true;\n }\n }\n return false;\n }\n\n if (classinfo instanceof Array) { // Assume in most cases it isn't, then making it recursive rather than two functions saves a call\n for (let aClass of classinfo) {\n if (isinstance (anObject, aClass)) {\n return true;\n }\n }\n return false;\n }\n\n try { // Most frequent use case first\n return '__class__' in anObject ? isA (anObject.__class__) : anObject instanceof classinfo;\n }\n catch (exception) { // Using isinstance on primitives assumed rare\n var aType = py_typeof (anObject);\n return aType == classinfo || (aType == bool && classinfo == int);\n }\n };\n __all__.isinstance = isinstance;\n\n var callable = function (anObject) {\n if ( typeof anObject == 'object' && '__call__' in anObject ) {\n return true;\n }\n else {\n return typeof anObject === 'function';\n }\n };\n __all__.callable = callable;\n\n // Repr function uses __repr__ method, then __str__, then toString\n var repr = function (anObject) {\n try {\n return anObject.__repr__ ();\n }\n catch (exception) {\n try {\n return anObject.__str__ ();\n }\n catch (exception) { // anObject has no __repr__ and no __str__\n try {\n if (anObject == null) {\n return 'None';\n }\n else if (anObject.constructor == Object) {\n var result = '{';\n var comma = false;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n if (attrib.isnumeric ()) {\n var attribRepr = attrib; // If key can be interpreted as numerical, we make it numerical\n } // So we accept that '1' is misrepresented as 1\n else {\n var attribRepr = '\\'' + attrib + '\\''; // Alpha key in dict\n }\n\n if (comma) {\n result += ', ';\n }\n else {\n comma = true;\n }\n result += attribRepr + ': ' + repr (anObject [attrib]);\n }\n }\n result += '}';\n return result;\n }\n else {\n return typeof anObject == 'boolean' ? anObject.toString () .capitalize () : anObject.toString ();\n }\n }\n catch (exception) {\n console.log ('ERROR: Could not evaluate repr (<object of type ' + typeof anObject + '>)');\n console.log (exception);\n return '???';\n }\n }\n }\n };\n __all__.repr = repr;\n\n // Char from Unicode or ASCII\n var chr = function (charCode) {\n return String.fromCharCode (charCode);\n };\n __all__.chr = chr;\n\n // Unicode or ASCII from char\n var ord = function (aChar) {\n return aChar.charCodeAt (0);\n };\n __all__.org = ord;\n\n // Maximum of n numbers\n var max = Math.max;\n __all__.max = max;\n\n // Minimum of n numbers\n var min = Math.min;\n __all__.min = min;\n\n // Absolute value\n var abs = Math.abs;\n __all__.abs = abs;\n\n // Bankers rounding\n var round = function (number, ndigits) {\n if (ndigits) {\n var scale = Math.pow (10, ndigits);\n number *= scale;\n }\n\n var rounded = Math.round (number);\n if (rounded - number == 0.5 && rounded % 2) { // Has rounded up to odd, should have rounded down to even\n rounded -= 1;\n }\n\n if (ndigits) {\n rounded /= scale;\n }\n\n return rounded;\n };\n __all__.round = round;\n\n // BEGIN unified iterator model\n\n function __jsUsePyNext__ () { // Add as 'next' method to make Python iterator JavaScript compatible\n try {\n var result = this.__next__ ();\n return {value: result, done: false};\n }\n catch (exception) {\n return {value: undefined, done: true};\n }\n }\n\n function __pyUseJsNext__ () { // Add as '__next__' method to make JavaScript iterator Python compatible\n var result = this.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n\n function py_iter (iterable) { // Alias for Python's iter function, produces a universal iterator / iterable, usable in Python and JavaScript\n if (typeof iterable == 'string' || '__iter__' in iterable) { // JavaScript Array or string or Python iterable (string has no 'in')\n var result = iterable.__iter__ (); // Iterator has a __next__\n result.next = __jsUsePyNext__; // Give it a next\n }\n else if ('selector' in iterable) { // Assume it's a JQuery iterator\n var result = list (iterable) .__iter__ (); // Has a __next__\n result.next = __jsUsePyNext__; // Give it a next\n }\n else if ('next' in iterable) { // It's a JavaScript iterator already, maybe a generator, has a next and may have a __next__\n var result = iterable\n if (! ('__next__' in result)) { // If there's no danger of recursion\n result.__next__ = __pyUseJsNext__; // Give it a __next__\n }\n }\n else if (Symbol.iterator in iterable) { // It's a JavaScript iterable such as a typed array, but not an iterator\n var result = iterable [Symbol.iterator] (); // Has a next\n result.__next__ = __pyUseJsNext__; // Give it a __next__\n }\n else {\n throw IterableError (new Error ()); // No iterator at all\n }\n result [Symbol.iterator] = function () {return result;};\n return result;\n }\n\n function py_next (iterator) { // Called only in a Python context, could receive Python or JavaScript iterator\n try { // Primarily assume Python iterator, for max speed\n var result = iterator.__next__ ();\n }\n catch (exception) { // JavaScript iterators are the exception here\n var result = iterator.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n if (result == undefined) {\n throw StopIteration (new Error ());\n }\n else {\n return result;\n }\n }\n\n function __PyIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n\n __PyIterator__.prototype.__next__ = function () {\n if (this.index < this.iterable.length) {\n return this.iterable [this.index++];\n }\n else {\n throw StopIteration (new Error ());\n }\n };\n\n function __JsIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n\n __JsIterator__.prototype.next = function () {\n if (this.index < this.iterable.py_keys.length) {\n return {value: this.index++, done: false};\n }\n else {\n return {value: undefined, done: true};\n }\n };\n\n // END unified iterator model\n\n // Reversed function for arrays\n var py_reversed = function (iterable) {\n iterable = iterable.slice ();\n iterable.reverse ();\n return iterable;\n };\n __all__.py_reversed = py_reversed;\n\n // Zip method for arrays and strings\n var zip = function () {\n var args = [] .slice.call (arguments);\n if (typeof args [0] == 'string') {\n for (var i = 0; i < args.length; i++) {\n args [i] = args [i] .split ('');\n }\n }\n var shortest = args.length == 0 ? [] : args.reduce ( // Find shortest array in arguments\n function (array0, array1) {\n return array0.length < array1.length ? array0 : array1;\n }\n );\n return shortest.map ( // Map each element of shortest array\n function (current, index) { // To the result of this function\n return args.map ( // Map each array in arguments\n function (current) { // To the result of this function\n return current [index]; // Namely it's index't entry\n }\n );\n }\n );\n };\n __all__.zip = zip;\n\n // Range method, returning an array\n function range (start, stop, step) {\n if (stop == undefined) {\n // one param defined\n stop = start;\n start = 0;\n }\n if (step == undefined) {\n step = 1;\n }\n if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {\n return [];\n }\n var result = [];\n for (var i = start; step > 0 ? i < stop : i > stop; i += step) {\n result.push(i);\n }\n return result;\n };\n __all__.range = range;\n\n // Any, all and sum\n\n function any (iterable) {\n for (let item of iterable) {\n if (bool (item)) {\n return true;\n }\n }\n return false;\n }\n function all (iterable) {\n for (let item of iterable) {\n if (! bool (item)) {\n return false;\n }\n }\n return true;\n }\n function sum (iterable) {\n let result = 0;\n for (let item of iterable) {\n result += item;\n }\n return result;\n }\n\n __all__.any = any;\n __all__.all = all;\n __all__.sum = sum;\n\n // Enumerate method, returning a zipped list\n function enumerate (iterable) {\n return zip (range (len (iterable)), iterable);\n }\n __all__.enumerate = enumerate;\n\n // Shallow and deepcopy\n\n function copy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = anObject [attrib];\n }\n }\n return result;\n }\n }\n __all__.copy = copy;\n\n function deepcopy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = deepcopy (anObject [attrib]);\n }\n }\n return result;\n }\n }\n __all__.deepcopy = deepcopy;\n\n // List extensions to Array\n\n function list (iterable) { // All such creators should be callable without new\n var instance = iterable ? Array.from (iterable) : [];\n // Sort is the normal JavaScript sort, Python sort is a non-member function\n return instance;\n }\n __all__.list = list;\n Array.prototype.__class__ = list; // All arrays are lists (not only if constructed by the list ctor), unless constructed otherwise\n list.__name__ = 'list';\n\n /*\n Array.from = function (iterator) { // !!! remove\n result = [];\n for (item of iterator) {\n result.push (item);\n }\n return result;\n }\n */\n\n Array.prototype.__iter__ = function () {return new __PyIterator__ (this);};\n\n Array.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n else if (stop > this.length) {\n stop = this.length;\n }\n\n var result = list ([]);\n for (var index = start; index < stop; index += step) {\n result.push (this [index]);\n }\n\n return result;\n };\n\n Array.prototype.__setslice__ = function (start, stop, step, source) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n\n if (step == null) { // Assign to 'ordinary' slice, replace subsequence\n Array.prototype.splice.apply (this, [start, stop - start] .concat (source));\n }\n else { // Assign to extended slice, replace designated items one by one\n var sourceIndex = 0;\n for (var targetIndex = start; targetIndex < stop; targetIndex += step) {\n this [targetIndex] = source [sourceIndex++];\n }\n }\n };\n\n Array.prototype.__repr__ = function () {\n if (this.__class__ == set && !this.length) {\n return 'set()';\n }\n\n var result = !this.__class__ || this.__class__ == list ? '[' : this.__class__ == tuple ? '(' : '{';\n\n for (var index = 0; index < this.length; index++) {\n if (index) {\n result += ', ';\n }\n result += repr (this [index]);\n }\n\n if (this.__class__ == tuple && this.length == 1) {\n result += ',';\n }\n\n result += !this.__class__ || this.__class__ == list ? ']' : this.__class__ == tuple ? ')' : '}';;\n return result;\n };\n\n Array.prototype.__str__ = Array.prototype.__repr__;\n\n Array.prototype.append = function (element) {\n this.push (element);\n };\n\n Array.prototype.clear = function () {\n this.length = 0;\n };\n\n Array.prototype.extend = function (aList) {\n this.push.apply (this, aList);\n };\n\n Array.prototype.insert = function (index, element) {\n this.splice (index, 0, element);\n };\n\n Array.prototype.remove = function (element) {\n var index = this.indexOf (element);\n if (index == -1) {\n throw ValueError (new Error ());\n }\n this.splice (index, 1);\n };\n\n Array.prototype.index = function (element) {\n return this.indexOf (element);\n };\n\n Array.prototype.py_pop = function (index) {\n if (index == undefined) {\n return this.pop (); // Remove last element\n }\n else {\n return this.splice (index, 1) [0];\n }\n };\n\n Array.prototype.py_sort = function () {\n __sort__.apply (null, [this].concat ([] .slice.apply (arguments))); // Can't work directly with arguments\n // Python params: (iterable, key = None, reverse = False)\n // py_sort is called with the Transcrypt kwargs mechanism, and just passes the params on to __sort__\n // __sort__ is def'ed with the Transcrypt kwargs mechanism\n };\n\n Array.prototype.__add__ = function (aList) {\n return list (this.concat (aList));\n };\n\n Array.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result.concat (this);\n }\n return result;\n };\n\n Array.prototype.__rmul__ = Array.prototype.__mul__;\n\n // Tuple extensions to Array\n\n function tuple (iterable) {\n var instance = iterable ? [] .slice.apply (iterable) : [];\n instance.__class__ = tuple; // Not all arrays are tuples\n return instance;\n }\n __all__.tuple = tuple;\n tuple.__name__ = 'tuple';\n\n // Set extensions to Array\n // N.B. Since sets are unordered, set operations will occasionally alter the 'this' array by sorting it\n\n function set (iterable) {\n var instance = [];\n if (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n instance.add (iterable [index]);\n }\n\n\n }\n instance.__class__ = set; // Not all arrays are sets\n return instance;\n }\n __all__.set = set;\n set.__name__ = 'set';\n\n Array.prototype.__bindexOf__ = function (element) { // Used to turn O (n^2) into O (n log n)\n // Since sorting is lex, compare has to be lex. This also allows for mixed lists\n\n element += '';\n\n var mindex = 0;\n var maxdex = this.length - 1;\n\n while (mindex <= maxdex) {\n var index = (mindex + maxdex) / 2 | 0;\n var middle = this [index] + '';\n\n if (middle < element) {\n mindex = index + 1;\n }\n else if (middle > element) {\n maxdex = index - 1;\n }\n else {\n return index;\n }\n }\n\n return -1;\n };\n\n Array.prototype.add = function (element) {\n if (this.indexOf (element) == -1) { // Avoid duplicates in set\n this.push (element);\n }\n };\n\n Array.prototype.discard = function (element) {\n var index = this.indexOf (element);\n if (index != -1) {\n this.splice (index, 1);\n }\n };\n\n Array.prototype.isdisjoint = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.issuperset = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) == -1) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.issubset = function (other) {\n return set (other.slice ()) .issuperset (this); // Sort copy of 'other', not 'other' itself, since it may be an ordered sequence\n };\n\n Array.prototype.union = function (other) {\n var result = set (this.slice () .sort ());\n for (var i = 0; i < other.length; i++) {\n if (result.__bindexOf__ (other [i]) == -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n\n Array.prototype.intersection = function (other) {\n this.sort ();\n var result = set ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n\n Array.prototype.difference = function (other) {\n var sother = set (other.slice () .sort ());\n var result = set ();\n for (var i = 0; i < this.length; i++) {\n if (sother.__bindexOf__ (this [i]) == -1) {\n result.push (this [i]);\n }\n }\n return result;\n };\n\n Array.prototype.symmetric_difference = function (other) {\n return this.union (other) .difference (this.intersection (other));\n };\n\n Array.prototype.py_update = function () { // O (n)\n var updated = [] .concat.apply (this.slice (), arguments) .sort ();\n this.clear ();\n for (var i = 0; i < updated.length; i++) {\n if (updated [i] != updated [i - 1]) {\n this.push (updated [i]);\n }\n }\n };\n\n Array.prototype.__eq__ = function (other) { // Also used for list\n if (this.length != other.length) {\n return false;\n }\n if (this.__class__ == set) {\n this.sort ();\n other.sort ();\n }\n for (var i = 0; i < this.length; i++) {\n if (this [i] != other [i]) {\n return false;\n }\n }\n return true;\n };\n\n Array.prototype.__ne__ = function (other) { // Also used for list\n return !this.__eq__ (other);\n };\n\n Array.prototype.__le__ = function (other) {\n return this.issubset (other);\n };\n\n Array.prototype.__ge__ = function (other) {\n return this.issuperset (other);\n };\n\n Array.prototype.__lt__ = function (other) {\n return this.issubset (other) && !this.issuperset (other);\n };\n\n Array.prototype.__gt__ = function (other) {\n return this.issuperset (other) && !this.issubset (other);\n };\n\n // String extensions\n\n function str (stringable) {\n try {\n return stringable.__str__ ();\n }\n catch (exception) {\n try {\n return repr (stringable);\n }\n catch (exception) {\n return String (stringable); // No new, so no permanent String object but a primitive in a temporary 'just in time' wrapper\n }\n }\n };\n __all__.str = str;\n\n String.prototype.__class__ = str; // All strings are str\n str.__name__ = 'str';\n\n String.prototype.__iter__ = function () {new __PyIterator__ (this);};\n\n String.prototype.__repr__ = function () {\n return (this.indexOf ('\\'') == -1 ? '\\'' + this + '\\'' : '\"' + this + '\"') .py_replace ('\\t', '\\\\t') .py_replace ('\\n', '\\\\n');\n };\n\n String.prototype.__str__ = function () {\n return this;\n };\n\n String.prototype.capitalize = function () {\n return this.charAt (0).toUpperCase () + this.slice (1);\n };\n\n String.prototype.endswith = function (suffix) {\n return suffix == '' || this.slice (-suffix.length) == suffix;\n };\n\n String.prototype.find = function (sub, start) {\n return this.indexOf (sub, start);\n };\n\n String.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n\n var result = '';\n if (step == 1) {\n result = this.substring (start, stop);\n }\n else {\n for (var index = start; index < stop; index += step) {\n result = result.concat (this.charAt(index));\n }\n }\n return result;\n }\n\n // Since it's worthwhile for the 'format' function to be able to deal with *args, it is defined as a property\n // __get__ will produce a bound function if there's something before the dot\n // Since a call using *args is compiled to e.g. <object>.<function>.apply (null, args), the function has to be bound already\n // Otherwise it will never be, because of the null argument\n // Using 'this' rather than 'null' contradicts the requirement to be able to pass bound functions around\n // The object 'before the dot' won't be available at call time in that case, unless implicitly via the function bound to it\n // While for Python methods this mechanism is generated by the compiler, for JavaScript methods it has to be provided manually\n // Call memoizing is unattractive here, since every string would then have to hold a reference to a bound format method\n __setProperty__ (String.prototype, 'format', {\n get: function () {return __get__ (this, function (self) {\n var args = tuple ([] .slice.apply (arguments).slice (1));\n var autoIndex = 0;\n return self.replace (/\\{(\\w*)\\}/g, function (match, key) {\n if (key == '') {\n key = autoIndex++;\n }\n if (key == +key) { // So key is numerical\n return args [key] == undefined ? match : str (args [key]);\n }\n else { // Key is a string\n for (var index = 0; index < args.length; index++) {\n // Find first 'dict' that has that key and the right field\n if (typeof args [index] == 'object' && args [index][key] != undefined) {\n return str (args [index][key]); // Return that field field\n }\n }\n return match;\n }\n });\n });},\n enumerable: true\n });\n\n String.prototype.isnumeric = function () {\n return !isNaN (parseFloat (this)) && isFinite (this);\n };\n\n String.prototype.join = function (strings) {\n strings = Array.from (strings); // Much faster than iterating through strings char by char\n return strings.join (this);\n };\n\n String.prototype.lower = function () {\n return this.toLowerCase ();\n };\n\n String.prototype.py_replace = function (old, aNew, maxreplace) {\n return this.split (old, maxreplace) .join (aNew);\n };\n\n String.prototype.lstrip = function () {\n return this.replace (/^\\s*/g, '');\n };\n\n String.prototype.rfind = function (sub, start) {\n return this.lastIndexOf (sub, start);\n };\n\n String.prototype.rsplit = function (sep, maxsplit) { // Combination of general whitespace sep and positive maxsplit neither supported nor checked, expensive and rare\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n var maxrsplit = result.length - maxsplit;\n return [result.slice (0, maxrsplit) .join (sep)] .concat (result.slice (maxrsplit));\n }\n else {\n return result;\n }\n }\n };\n\n String.prototype.rstrip = function () {\n return this.replace (/\\s*$/g, '');\n };\n\n String.prototype.py_split = function (sep, maxsplit) { // Combination of general whitespace sep and positive maxsplit neither supported nor checked, expensive and rare\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n return result.slice (0, maxsplit).concat ([result.slice (maxsplit).join (sep)]);\n }\n else {\n return result;\n }\n }\n };\n\n String.prototype.startswith = function (prefix) {\n return this.indexOf (prefix) == 0;\n };\n\n String.prototype.strip = function () {\n return this.trim ();\n };\n\n String.prototype.upper = function () {\n return this.toUpperCase ();\n };\n\n String.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result + this;\n }\n return result;\n };\n\n String.prototype.__rmul__ = String.prototype.__mul__;\n\n // Dict extensions to object\n\n function __keys__ () {\n var keys = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n keys.push (attrib);\n }\n }\n return keys;\n }\n\n function __items__ () {\n var items = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n items.push ([attrib, this [attrib]]);\n }\n }\n return items;\n }\n\n function __del__ (key) {\n delete this [key];\n }\n\n function __clear__ () {\n for (var attrib in this) {\n delete this [attrib];\n }\n }\n\n function __getdefault__ (aKey, aDefault) { // Each Python object already has a function called __get__, so we call this one __getdefault__\n var result = this [aKey];\n return result == undefined ? (aDefault == undefined ? null : aDefault) : result;\n }\n\n function __setdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n return result;\n }\n var val = aDefault == undefined ? null : aDefault;\n this [aKey] = val;\n return val;\n }\n\n function __pop__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n delete this [aKey];\n return result;\n } else {\n // Identify check because user could pass None\n if ( aDefault === undefined ) {\n throw KeyError (aKey, new Error());\n }\n }\n return aDefault;\n }\n \n function __popitem__ () {\n var aKey = Object.keys (this) [0];\n if (aKey == null) {\n throw KeyError (aKey, new Error ());\n }\n var result = tuple ([aKey, this [aKey]]);\n delete this [aKey];\n return result;\n }\n \n function __update__ (aDict) {\n for (var aKey in aDict) {\n this [aKey] = aDict [aKey];\n }\n }\n \n function __dgetitem__ (aKey) {\n return this [aKey];\n }\n \n function __dsetitem__ (aKey, aValue) {\n this [aKey] = aValue;\n }\n\n function dict (objectOrPairs) {\n var instance = {};\n if (!objectOrPairs || objectOrPairs instanceof Array) { // It's undefined or an array of pairs\n if (objectOrPairs) {\n for (var index = 0; index < objectOrPairs.length; index++) {\n var pair = objectOrPairs [index];\n if ( !(pair instanceof Array) || pair.length != 2) {\n throw ValueError(\n \"dict update sequence element #\" + index +\n \" has length \" + pair.length +\n \"; 2 is required\", new Error());\n }\n var key = pair [0];\n var val = pair [1];\n if (!(objectOrPairs instanceof Array) && objectOrPairs instanceof Object) {\n // User can potentially pass in an object\n // that has a hierarchy of objects. This\n // checks to make sure that these objects\n // get converted to dict objects instead of\n // leaving them as js objects.\n \n if (!isinstance (objectOrPairs, dict)) {\n val = dict (val);\n }\n }\n instance [key] = val;\n }\n }\n }\n else {\n if (isinstance (objectOrPairs, dict)) {\n // Passed object is a dict already so we need to be a little careful\n // N.B. - this is a shallow copy per python std - so\n // it is assumed that children have already become\n // python objects at some point.\n \n var aKeys = objectOrPairs.py_keys ();\n for (var index = 0; index < aKeys.length; index++ ) {\n var key = aKeys [index];\n instance [key] = objectOrPairs [key];\n }\n } else if (objectOrPairs instanceof Object) {\n // Passed object is a JavaScript object but not yet a dict, don't copy it\n instance = objectOrPairs;\n } else {\n // We have already covered Array so this indicates\n // that the passed object is not a js object - i.e.\n // it is an int or a string, which is invalid.\n \n throw ValueError (\"Invalid type of object for dict creation\", new Error ());\n }\n }\n\n // Trancrypt interprets e.g. {aKey: 'aValue'} as a Python dict literal rather than a JavaScript object literal\n // So dict literals rather than bare Object literals will be passed to JavaScript libraries\n // Some JavaScript libraries call all enumerable callable properties of an object that's passed to them\n // So the properties of a dict should be non-enumerable\n __setProperty__ (instance, '__class__', {value: dict, enumerable: false, writable: true});\n __setProperty__ (instance, 'py_keys', {value: __keys__, enumerable: false});\n __setProperty__ (instance, '__iter__', {value: function () {new __PyIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, Symbol.iterator, {value: function () {new __JsIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, 'py_items', {value: __items__, enumerable: false});\n __setProperty__ (instance, 'py_del', {value: __del__, enumerable: false});\n __setProperty__ (instance, 'py_clear', {value: __clear__, enumerable: false});\n __setProperty__ (instance, 'py_get', {value: __getdefault__, enumerable: false});\n __setProperty__ (instance, 'py_setdefault', {value: __setdefault__, enumerable: false});\n __setProperty__ (instance, 'py_pop', {value: __pop__, enumerable: false});\n __setProperty__ (instance, 'py_popitem', {value: __popitem__, enumerable: false});\n __setProperty__ (instance, 'py_update', {value: __update__, enumerable: false});\n __setProperty__ (instance, '__getitem__', {value: __dgetitem__, enumerable: false}); // Needed since compound keys necessarily\n __setProperty__ (instance, '__setitem__', {value: __dsetitem__, enumerable: false}); // trigger overloading to deal with slices\n return instance;\n }\n\n __all__.dict = dict;\n dict.__name__ = 'dict';\n \n // Docstring setter\n\n function __setdoc__ (docString) {\n this.__doc__ = docString;\n return this;\n }\n\n // Python classes, methods and functions are all translated to JavaScript functions\n __setProperty__ (Function.prototype, '__setdoc__', {value: __setdoc__, enumerable: false});\n\n // General operator overloading, only the ones that make most sense in matrix and complex operations\n\n var __neg__ = function (a) {\n if (typeof a == 'object' && '__neg__' in a) {\n return a.__neg__ ();\n }\n else {\n return -a;\n }\n };\n __all__.__neg__ = __neg__;\n\n var __matmul__ = function (a, b) {\n return a.__matmul__ (b);\n };\n __all__.__matmul__ = __matmul__;\n\n var __pow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.pow = __pow__;\n\n var __jsmod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.__jsmod__ = __jsmod__;\n \n var __mod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.mod = __mod__;\n\n // Overloaded binary arithmetic\n \n var __mul__ = function (a, b) {\n if (typeof a == 'object' && '__mul__' in a) {\n return a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return b.__rmul__ (a);\n }\n else {\n return a * b;\n }\n };\n __all__.__mul__ = __mul__;\n\n var __div__ = function (a, b) {\n if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return a / b;\n }\n };\n __all__.__div__ = __div__;\n\n var __add__ = function (a, b) {\n if (typeof a == 'object' && '__add__' in a) {\n return a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return b.__radd__ (a);\n }\n else {\n return a + b;\n }\n };\n __all__.__add__ = __add__;\n\n var __sub__ = function (a, b) {\n if (typeof a == 'object' && '__sub__' in a) {\n return a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return b.__rsub__ (a);\n }\n else {\n return a - b;\n }\n };\n __all__.__sub__ = __sub__;\n\n // Overloaded binary bitwise\n \n var __lshift__ = function (a, b) {\n if (typeof a == 'object' && '__lshift__' in a) {\n return a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return b.__rlshift__ (a);\n }\n else {\n return a << b;\n }\n };\n __all__.__lshift__ = __lshift__;\n\n var __rshift__ = function (a, b) {\n if (typeof a == 'object' && '__rshift__' in a) {\n return a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return b.__rrshift__ (a);\n }\n else {\n return a >> b;\n }\n };\n __all__.__rshift__ = __rshift__;\n\n var __or__ = function (a, b) {\n if (typeof a == 'object' && '__or__' in a) {\n return a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return b.__ror__ (a);\n }\n else {\n return a | b;\n }\n };\n __all__.__or__ = __or__;\n\n var __xor__ = function (a, b) {\n if (typeof a == 'object' && '__xor__' in a) {\n return a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return b.__rxor__ (a);\n }\n else {\n return a ^ b;\n }\n };\n __all__.__xor__ = __xor__;\n\n var __and__ = function (a, b) {\n if (typeof a == 'object' && '__and__' in a) {\n return a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return b.__rand__ (a);\n }\n else {\n return a & b;\n }\n };\n __all__.__and__ = __and__; \n \n // Overloaded binary compare\n \n var __eq__ = function (a, b) {\n if (typeof a == 'object' && '__eq__' in a) {\n return a.__eq__ (b);\n }\n else {\n return a == b;\n }\n };\n __all__.__eq__ = __eq__;\n\n var __ne__ = function (a, b) {\n if (typeof a == 'object' && '__ne__' in a) {\n return a.__ne__ (b);\n }\n else {\n return a != b\n }\n };\n __all__.__ne__ = __ne__;\n\n var __lt__ = function (a, b) {\n if (typeof a == 'object' && '__lt__' in a) {\n return a.__lt__ (b);\n }\n else {\n return a < b;\n }\n };\n __all__.__lt__ = __lt__;\n\n var __le__ = function (a, b) {\n if (typeof a == 'object' && '__le__' in a) {\n return a.__le__ (b);\n }\n else {\n return a <= b;\n }\n };\n __all__.__le__ = __le__;\n\n var __gt__ = function (a, b) {\n if (typeof a == 'object' && '__gt__' in a) {\n return a.__gt__ (b);\n }\n else {\n return a > b;\n }\n };\n __all__.__gt__ = __gt__;\n\n var __ge__ = function (a, b) {\n if (typeof a == 'object' && '__ge__' in a) {\n return a.__ge__ (b);\n }\n else {\n return a >= b;\n }\n };\n __all__.__ge__ = __ge__;\n \n // Overloaded augmented general\n \n var __imatmul__ = function (a, b) {\n if ('__imatmul__' in a) {\n return a.__imatmul__ (b);\n }\n else {\n return a.__matmul__ (b);\n }\n };\n __all__.__imatmul__ = __imatmul__;\n\n var __ipow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__ipow__ (b);\n }\n else if (typeof a == 'object' && '__ipow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.ipow = __ipow__;\n\n var __ijsmod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__ismod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.ijsmod__ = __ijsmod__;\n \n var __imod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__imod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.imod = __imod__;\n \n // Overloaded augmented arithmetic\n \n var __imul__ = function (a, b) {\n if (typeof a == 'object' && '__imul__' in a) {\n return a.__imul__ (b);\n }\n else if (typeof a == 'object' && '__mul__' in a) {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return a = b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return a = b.__rmul__ (a);\n }\n else {\n return a *= b;\n }\n };\n __all__.__imul__ = __imul__;\n\n var __idiv__ = function (a, b) {\n if (typeof a == 'object' && '__idiv__' in a) {\n return a.__idiv__ (b);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a = a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return a = b.__rdiv__ (a);\n }\n else {\n return a /= b;\n }\n };\n __all__.__idiv__ = __idiv__;\n\n var __iadd__ = function (a, b) {\n if (typeof a == 'object' && '__iadd__' in a) {\n return a.__iadd__ (b);\n }\n else if (typeof a == 'object' && '__add__' in a) {\n return a = a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return a = b.__radd__ (a);\n }\n else {\n return a += b;\n }\n };\n __all__.__iadd__ = __iadd__;\n\n var __isub__ = function (a, b) {\n if (typeof a == 'object' && '__isub__' in a) {\n return a.__isub__ (b);\n }\n else if (typeof a == 'object' && '__sub__' in a) {\n return a = a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return a = b.__rsub__ (a);\n }\n else {\n return a -= b;\n }\n };\n __all__.__isub__ = __isub__;\n\n // Overloaded augmented bitwise\n \n var __ilshift__ = function (a, b) {\n if (typeof a == 'object' && '__ilshift__' in a) {\n return a.__ilshift__ (b);\n }\n else if (typeof a == 'object' && '__lshift__' in a) {\n return a = a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return a = b.__rlshift__ (a);\n }\n else {\n return a <<= b;\n }\n };\n __all__.__ilshift__ = __ilshift__;\n\n var __irshift__ = function (a, b) {\n if (typeof a == 'object' && '__irshift__' in a) {\n return a.__irshift__ (b);\n }\n else if (typeof a == 'object' && '__rshift__' in a) {\n return a = a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return a = b.__rrshift__ (a);\n }\n else {\n return a >>= b;\n }\n };\n __all__.__irshift__ = __irshift__;\n\n var __ior__ = function (a, b) {\n if (typeof a == 'object' && '__ior__' in a) {\n return a.__ior__ (b);\n }\n else if (typeof a == 'object' && '__or__' in a) {\n return a = a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return a = b.__ror__ (a);\n }\n else {\n return a |= b;\n }\n };\n __all__.__ior__ = __ior__;\n\n var __ixor__ = function (a, b) {\n if (typeof a == 'object' && '__ixor__' in a) {\n return a.__ixor__ (b);\n }\n else if (typeof a == 'object' && '__xor__' in a) {\n return a = a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return a = b.__rxor__ (a);\n }\n else {\n return a ^= b;\n }\n };\n __all__.__ixor__ = __ixor__;\n\n var __iand__ = function (a, b) {\n if (typeof a == 'object' && '__iand__' in a) {\n return a.__iand__ (b);\n }\n else if (typeof a == 'object' && '__and__' in a) {\n return a = a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return a = b.__rand__ (a);\n }\n else {\n return a &= b;\n }\n };\n __all__.__iand__ = __iand__;\n \n // Indices and slices\n\n var __getitem__ = function (container, key) { // Slice c.q. index, direct generated call to runtime switch\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ (key); // Overloaded on container\n }\n else {\n return container [key]; // Container must support bare JavaScript brackets\n }\n };\n __all__.__getitem__ = __getitem__;\n\n var __setitem__ = function (container, key, value) { // Slice c.q. index, direct generated call to runtime switch\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ (key, value); // Overloaded on container\n }\n else {\n container [key] = value; // Container must support bare JavaScript brackets\n }\n };\n __all__.__setitem__ = __setitem__;\n\n var __getslice__ = function (container, lower, upper, step) { // Slice only, no index, direct generated call to runtime switch\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ ([lower, upper, step]); // Container supports overloaded slicing c.q. indexing\n }\n else {\n return container.__getslice__ (lower, upper, step); // Container only supports slicing injected natively in prototype\n }\n };\n __all__.__getslice__ = __getslice__;\n\n var __setslice__ = function (container, lower, upper, step, value) { // Slice, no index, direct generated call to runtime switch\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ ([lower, upper, step], value); // Container supports overloaded slicing c.q. indexing\n }\n else {\n container.__setslice__ (lower, upper, step, value); // Container only supports slicing injected natively in prototype\n }\n };\n __all__.__setslice__ = __setslice__;\n\n\t__nest__ (\n\t\t__all__,\n\t\t'audio', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar logging = {};\n\t\t\t\t\t__nest__ (logging, '', __init__ (__world__.logging));\n\t\t\t\t\tvar logger = logging.getLogger ('root');\n\t\t\t\t\tvar load = function (player_element, sourcefile) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar audio_element = document.getElementById (player_element);\n\t\t\t\t\t\t\tif (!(len (audio_element))) {\n\t\t\t\t\t\t\t\tvar __except0__ = Exception (\"unable to load audio from element '{}'\".format (player_element));\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (len (sourcefile)) {\n\t\t\t\t\t\t\t\taudio_element.src = sourcefile;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn audio_element;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\tvar e = __except0__;\n\t\t\t\t\t\t\t\tlogging.exception (e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar clip = function (filename) {\n\t\t\t\t\t\tvar player = new Audio (filename);\n\t\t\t\t\t\treturn player;\n\t\t\t\t\t};\n\t\t\t\t\tvar loop = function (filename) {\n\t\t\t\t\t\tvar player = new Audio (filename);\n\t\t\t\t\t\tvar reset_player = function () {\n\t\t\t\t\t\t\tplayer.currentTime = 0;\n\t\t\t\t\t\t\tplayer.play ();\n\t\t\t\t\t\t};\n\t\t\t\t\t\tplayer.addEventListener ('ended', reset_player, false);\n\t\t\t\t\t\treturn player;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'logging' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.clip = clip;\n\t\t\t\t\t\t__all__.load = load;\n\t\t\t\t\t\t__all__.logger = logger;\n\t\t\t\t\t\t__all__.loop = loop;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'controls', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar clamp = __init__ (__world__.utils).clamp;\n\t\t\t\t\tvar Keyboard = __class__ ('Keyboard', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.keyboard = dict ({0: false});\n\t\t\t\t\t\t\tself.handlers = dict ({});\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget key_down () {return __get__ (this, function (self, key) {\n\t\t\t\t\t\t\tself.keyboard [key.key] = true;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget key_up () {return __get__ (this, function (self, key) {\n\t\t\t\t\t\t\tself.keyboard [key.key] = false;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_get () {return __get__ (this, function (self, key) {\n\t\t\t\t\t\t\treturn self.keyboard.py_get (key, false);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_axis () {return __get__ (this, function (self, key) {\n\t\t\t\t\t\t\treturn self.handlers [key].value;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget add_handler () {return __get__ (this, function (self, py_name, handler) {\n\t\t\t\t\t\t\tself.handlers [py_name] = handler;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, interval) {\n\t\t\t\t\t\t\tfor (var [_, eachhandler] of self.handlers.py_items ()) {\n\t\t\t\t\t\t\t\teachhandler.py_update (self, interval);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_clear () {return __get__ (this, function (self, axis) {\n\t\t\t\t\t\t\tself.handlers.py_get (axis).value = 0;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ControlAxis = __class__ ('ControlAxis', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, positive_key, negative_key, attack, decay, deadzone) {\n\t\t\t\t\t\t\tif (typeof attack == 'undefined' || (attack != null && attack .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar attack = 1;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof decay == 'undefined' || (decay != null && decay .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar decay = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof deadzone == 'undefined' || (deadzone != null && deadzone .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar deadzone = 0.02;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'positive_key': var positive_key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'negative_key': var negative_key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'attack': var attack = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'decay': var decay = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'deadzone': var deadzone = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.positive = positive_key;\n\t\t\t\t\t\t\tself.negative = negative_key;\n\t\t\t\t\t\t\tself.attack = attack;\n\t\t\t\t\t\t\tself.decay = decay;\n\t\t\t\t\t\t\tself.deadzone = deadzone;\n\t\t\t\t\t\t\tself.value = 0;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, keyboard, interval) {\n\t\t\t\t\t\t\tself.value -= (interval * self.decay) * self.value;\n\t\t\t\t\t\t\tvar dz = abs (self.value) < self.deadzone;\n\t\t\t\t\t\t\tif (keyboard.py_get (self.positive)) {\n\t\t\t\t\t\t\t\tvar dz = false;\n\t\t\t\t\t\t\t\tself.value += interval * self.attack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (keyboard.py_get (self.negative)) {\n\t\t\t\t\t\t\t\tvar dz = false;\n\t\t\t\t\t\t\t\tself.value -= interval * self.attack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (dz) {\n\t\t\t\t\t\t\t\tself.value = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tself.value = clamp (self.value, -(1), 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'utils' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.ControlAxis = ControlAxis;\n\t\t\t\t\t\t__all__.Keyboard = Keyboard;\n\t\t\t\t\t\t__all__.clamp = clamp;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'logging', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar time = {};\n\t\t\t\t\tvar warnings = {};\n\t\t\t\t\t__nest__ (time, '', __init__ (__world__.time));\n\t\t\t\t\t__nest__ (warnings, '', __init__ (__world__.warnings));\n\t\t\t\t\tvar __author__ = 'Vinay Sajip <[email protected]>, Carl Allendorph';\n\t\t\t\t\tvar __status__ = 'experimental';\n\t\t\t\t\tvar __version__ = '0.5.1.2';\n\t\t\t\t\tvar __date__ = '15 November 2016';\n\t\t\t\t\tvar _startTime = time.time ();\n\t\t\t\t\tvar raiseExceptions = true;\n\t\t\t\t\tvar logThreads = true;\n\t\t\t\t\tvar logMultiprocessing = true;\n\t\t\t\t\tvar logProcesses = true;\n\t\t\t\t\tvar CRITICAL = 50;\n\t\t\t\t\tvar FATAL = CRITICAL;\n\t\t\t\t\tvar ERROR = 40;\n\t\t\t\t\tvar WARNING = 30;\n\t\t\t\t\tvar WARN = WARNING;\n\t\t\t\t\tvar INFO = 20;\n\t\t\t\t\tvar DEBUG = 10;\n\t\t\t\t\tvar NOTSET = 0;\n\t\t\t\t\tvar _levelToName = dict ([[CRITICAL, 'CRITICAL'], [ERROR, 'ERROR'], [WARNING, 'WARNING'], [INFO, 'INFO'], [DEBUG, 'DEBUG'], [NOTSET, 'NOTSET']]);\n\t\t\t\t\tvar _nameToLevel = dict ({'CRITICAL': CRITICAL, 'FATAL': FATAL, 'ERROR': ERROR, 'WARN': WARNING, 'WARNING': WARNING, 'INFO': INFO, 'DEBUG': DEBUG, 'NOTSET': NOTSET});\n\t\t\t\t\tvar getLevelName = function (level) {\n\t\t\t\t\t\treturn _levelToName.py_get (level) || _nameToLevel.py_get (level) || 'Level {}'.format (level);\n\t\t\t\t\t};\n\t\t\t\t\tvar addLevelName = function (level, levelName) {\n\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t_levelToName [level] = levelName;\n\t\t\t\t\t\t\t_nameToLevel [levelName] = level;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\tvar exc = __except0__;\n\t\t\t\t\t\t\t\tvar __except1__ = exc;\n\t\t\t\t\t\t\t\t__except1__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except1__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar currentframe = function () {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t};\n\t\t\t\t\tvar _srcfile = null;\n\t\t\t\t\tvar _checkLevel = function (level) {\n\t\t\t\t\t\tif (isinstance (level, int)) {\n\t\t\t\t\t\t\tvar rv = level;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (str (level) == level) {\n\t\t\t\t\t\t\tif (!__in__ (level, _nameToLevel)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Unknown level: {}'.format (level));\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar rv = _nameToLevel [level];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('Level not an integer or a valid string: {}'.format (level));\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn rv;\n\t\t\t\t\t};\n\t\t\t\t\tvar _lock = null;\n\t\t\t\t\tvar _acquireLock = function () {\n\t\t\t\t\t\tif (_lock) {\n\t\t\t\t\t\t\t_lock.acquire ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _releaseLock = function () {\n\t\t\t\t\t\tif (_lock) {\n\t\t\t\t\t\t\t_lock.release ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar LogRecord = __class__ ('LogRecord', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, py_name, level, pathname, lineno, msg, args, exc_info, func, sinfo) {\n\t\t\t\t\t\t\tif (typeof func == 'undefined' || (func != null && func .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar func = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof sinfo == 'undefined' || (sinfo != null && sinfo .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar sinfo = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar ct = time.time ();\n\t\t\t\t\t\t\tself.py_name = py_name;\n\t\t\t\t\t\t\tself.msg = msg;\n\t\t\t\t\t\t\tif (args && len (args) == 1 && isinstance (args [0], collections.Mapping) && args [0]) {\n\t\t\t\t\t\t\t\tif (raiseExceptions) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No Dict Args to Log Record');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.args = args;\n\t\t\t\t\t\t\tself.levelname = getLevelName (level);\n\t\t\t\t\t\t\tself.levelno = level;\n\t\t\t\t\t\t\tself.pathname = pathname;\n\t\t\t\t\t\t\tself.filename = pathname;\n\t\t\t\t\t\t\tself.module = 'Unknown module';\n\t\t\t\t\t\t\tself.exc_info = exc_info;\n\t\t\t\t\t\t\tself.exc_text = null;\n\t\t\t\t\t\t\tself.stack_info = sinfo;\n\t\t\t\t\t\t\tself.lineno = lineno;\n\t\t\t\t\t\t\tself.funcName = func;\n\t\t\t\t\t\t\tself.created = ct;\n\t\t\t\t\t\t\tself.msecs = (ct - int (ct)) * 1000;\n\t\t\t\t\t\t\tself.relativeCreated = (self.created - _startTime) * 1000;\n\t\t\t\t\t\t\tself.thread = null;\n\t\t\t\t\t\t\tself.threadName = null;\n\t\t\t\t\t\t\tself.processName = null;\n\t\t\t\t\t\t\tself.process = null;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getMessage () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar msg = str (self.msg);\n\t\t\t\t\t\t\tif (self.args) {\n\t\t\t\t\t\t\t\tvar msg = msg.format (...self.args);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn msg;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget toDict () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar keysToPick = list (['name', 'msg', 'levelname', 'levelno', 'pathname', 'filename', 'module', 'lineno', 'funcName', 'created', 'asctime', 'msecs', 'relativeCreated', 'thread', 'threadName', 'process']);\n\t\t\t\t\t\t\tvar ret = dict ({});\n\t\t\t\t\t\t\tfor (var k of keysToPick) {\n\t\t\t\t\t\t\t\tif (k == 'name') {\n\t\t\t\t\t\t\t\t\tret [k] = getattr (self, 'py_name', null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tret [k] = getattr (self, k, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tret ['message'] = self.getMessage ();\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn '<LogRecord: {}, {}, {}, {}, \"{}\">'.format (self.py_name, self.levelno, self.pathname, self.lineno, self.msg);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn str (self);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _logRecordFactory = LogRecord;\n\t\t\t\t\tvar setLogRecordFactory = function (factory) {\n\t\t\t\t\t\t_logRecordFactory = factory;\n\t\t\t\t\t};\n\t\t\t\t\tvar getLogRecordFactory = function () {\n\t\t\t\t\t\treturn _logRecordFactory;\n\t\t\t\t\t};\n\t\t\t\t\tvar makeLogRecord = function (dict) {\n\t\t\t\t\t\tvar rv = _logRecordFactory (null, null, '', 0, '', tuple ([]), null, null);\n\t\t\t\t\t\trv.__dict__.py_update (dict);\n\t\t\t\t\t\treturn rv;\n\t\t\t\t\t};\n\t\t\t\t\tvar PercentStyle = __class__ ('PercentStyle', [object], {\n\t\t\t\t\t\tdefault_format: '%(message)s',\n\t\t\t\t\t\tasctime_format: '%(asctime)s',\n\t\t\t\t\t\tasctime_search: '%(asctime)',\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, fmt) {\n\t\t\t\t\t\t\tself._fmt = fmt || self.default_format;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget usesTime () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._fmt.find (self.asctime_search) >= 0;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\treturn __mod__ (self._fmt, record.__dict__);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StrFormatStyle = __class__ ('StrFormatStyle', [PercentStyle], {\n\t\t\t\t\t\tdefault_format: '{message}',\n\t\t\t\t\t\tasctime_format: '{asctime}',\n\t\t\t\t\t\tasctime_search: '{asctime',\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'record': var record = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn self._fmt.format (__kwargtrans__ (record.toDict ()));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StringTemplateStyle = __class__ ('StringTemplateStyle', [PercentStyle], {\n\t\t\t\t\t\tdefault_format: '${message}',\n\t\t\t\t\t\tasctime_format: '${asctime}',\n\t\t\t\t\t\tasctime_search: '${asctime}',\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, fmt) {\n\t\t\t\t\t\t\tself._fmt = fmt || self.default_format;\n\t\t\t\t\t\t\tself._tpl = Template (self._fmt);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget usesTime () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar fmt = self._fmt;\n\t\t\t\t\t\t\treturn fmt.find ('$asctime') >= 0 || fmt.find (self.asctime_format) >= 0;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'record': var record = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn self._tpl.substitute (__kwargtrans__ (record.__dict__));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar BASIC_FORMAT = '{levelname}:{name}:{message}';\n\t\t\t\t\tvar _STYLES = dict ({'{': tuple ([StrFormatStyle, BASIC_FORMAT])});\n\t\t\t\t\tvar Formatter = __class__ ('Formatter', [object], {\n\t\t\t\t\t\tconverter: time.localtime,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, format, datefmt, style) {\n\t\t\t\t\t\t\tif (typeof format == 'undefined' || (format != null && format .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar format = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof datefmt == 'undefined' || (datefmt != null && datefmt .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar datefmt = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof style == 'undefined' || (style != null && style .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar style = '{';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'format': var format = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'datefmt': var datefmt = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'style': var style = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (style != '{') {\n\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('{} format only');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself._style = _STYLES [style] [0] (format);\n\t\t\t\t\t\t\tself._fmt = self._style._fmt;\n\t\t\t\t\t\t\tself.datefmt = datefmt;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tdefault_time_format: '%Y-%m-%d %H:%M:%S',\n\t\t\t\t\t\tdefault_msec_format: '{},{:03d}',\n\t\t\t\t\t\tget formatTime () {return __get__ (this, function (self, record, datefmt) {\n\t\t\t\t\t\t\tif (typeof datefmt == 'undefined' || (datefmt != null && datefmt .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar datefmt = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar ct = self.converter (record.created);\n\t\t\t\t\t\t\tif (datefmt) {\n\t\t\t\t\t\t\t\tvar s = time.strftime (datefmt, ct);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar t = time.strftime (self.default_time_format, ct);\n\t\t\t\t\t\t\t\tvar s = __mod__ (self.default_msec_format, tuple ([t, record.msecs]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn s;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget formatException () {return __get__ (this, function (self, ei) {\n\t\t\t\t\t\t\treturn str (ei);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget usesTime () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._style.usesTime ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget formatMessage () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\treturn self._style.format (record);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget formatStack () {return __get__ (this, function (self, stack_info) {\n\t\t\t\t\t\t\treturn stack_info;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\trecord.message = record.getMessage ();\n\t\t\t\t\t\t\tif (self.usesTime ()) {\n\t\t\t\t\t\t\t\trecord.asctime = self.formatTime (record, self.datefmt);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar s = self.formatMessage (record);\n\t\t\t\t\t\t\tif (record.exc_info) {\n\t\t\t\t\t\t\t\tif (!(record.exc_text)) {\n\t\t\t\t\t\t\t\t\trecord.exc_text = self.formatException (record.exc_info);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (record.exc_text) {\n\t\t\t\t\t\t\t\tif (s [len (s) - 1] != '\\n') {\n\t\t\t\t\t\t\t\t\tvar s = s + '\\n';\n\t\t\t\t\t\t\t\t\tvar s = s + record.exc_text;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (record.stack_info) {\n\t\t\t\t\t\t\t\tif (s [len (s) - 1] != '\\n') {\n\t\t\t\t\t\t\t\t\tvar s = s + '\\n';\n\t\t\t\t\t\t\t\t\tvar s = s + self.formatStack (record.stack_info);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn s;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _defaultFormatter = Formatter ();\n\t\t\t\t\tvar BufferingFormatter = __class__ ('BufferingFormatter', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, linefmt) {\n\t\t\t\t\t\t\tif (typeof linefmt == 'undefined' || (linefmt != null && linefmt .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar linefmt = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (linefmt) {\n\t\t\t\t\t\t\t\tself.linefmt = linefmt;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tself.linefmt = _defaultFormatter;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget formatHeader () {return __get__ (this, function (self, records) {\n\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget formatFooter () {return __get__ (this, function (self, records) {\n\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, records) {\n\t\t\t\t\t\t\tvar rv = '';\n\t\t\t\t\t\t\tif (len (records) > 0) {\n\t\t\t\t\t\t\t\tvar rv = rv + self.formatHeader (records);\n\t\t\t\t\t\t\t\tfor (var record of records) {\n\t\t\t\t\t\t\t\t\tvar rv = rv + self.linefmt.format (record);\n\t\t\t\t\t\t\t\t\tvar rv = rv + self.formatFooter (records);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Filter = __class__ ('Filter', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, py_name) {\n\t\t\t\t\t\t\tif (typeof py_name == 'undefined' || (py_name != null && py_name .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar py_name = '';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself.py_name = py_name;\n\t\t\t\t\t\t\tself.nlen = len (py_name);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget filter () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (self.nlen == 0) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (self.py_name == record.py_name) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (record.py_name.find (self.py_name, 0, self.nlen) != 0) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn record.py_name [self.nlen] == '.';\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Filterer = __class__ ('Filterer', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.filters = list ([]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget addFilter () {return __get__ (this, function (self, filt) {\n\t\t\t\t\t\t\tif (!(__in__ (filt, self.filters))) {\n\t\t\t\t\t\t\t\tself.filters.append (filt);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget removeFilter () {return __get__ (this, function (self, filt) {\n\t\t\t\t\t\t\tif (__in__ (filt, self.filters)) {\n\t\t\t\t\t\t\t\tself.filters.remove (filt);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget filter () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tvar rv = true;\n\t\t\t\t\t\t\tfor (var f of self.filters) {\n\t\t\t\t\t\t\t\tif (hasattr (f, 'filter')) {\n\t\t\t\t\t\t\t\t\tvar result = f.filter (record);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar result = f (record);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!(result)) {\n\t\t\t\t\t\t\t\t\tvar rv = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ConsoleLogStream = __class__ ('ConsoleLogStream', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.py_name = 'console';\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget write () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar msg = msg.rstrip ('\\n\\r');\n\t\t\t\t\t\t\tif (len (msg) > 0) {\n\t\t\t\t\t\t\t\tconsole.log (msg);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _consoleStream = ConsoleLogStream ();\n\t\t\t\t\tvar _handlers = dict ({});\n\t\t\t\t\tvar _handlerList = list ([]);\n\t\t\t\t\tvar _removeHandlerRef = function (wr) {\n\t\t\t\t\t\tvar __left0__ = tuple ([_acquireLock, _releaseLock, _handlerList]);\n\t\t\t\t\t\tvar acquire = __left0__ [0];\n\t\t\t\t\t\tvar release = __left0__ [1];\n\t\t\t\t\t\tvar handlers = __left0__ [2];\n\t\t\t\t\t\tif (acquire && release && handlers) {\n\t\t\t\t\t\t\tacquire ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (__in__ (wr, handlers)) {\n\t\t\t\t\t\t\t\t\thandlers.remove (wr);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\trelease ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _addHandlerRef = function (handler) {\n\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t_handlerList.append (handler);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar Handler = __class__ ('Handler', [Filterer], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tif (typeof level == 'undefined' || (level != null && level .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar level = NOTSET;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tFilterer.__init__ (self);\n\t\t\t\t\t\t\tself._name = null;\n\t\t\t\t\t\t\tself.level = _checkLevel (level);\n\t\t\t\t\t\t\tself.formatter = null;\n\t\t\t\t\t\t\t_addHandlerRef (self);\n\t\t\t\t\t\t\tself.createLock ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_name () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._name;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget set_name () {return __get__ (this, function (self, py_name) {\n\t\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (__in__ (self._name, _handlers)) {\n\t\t\t\t\t\t\t\t\tdelete _handlers [self._name];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tself._name = py_name;\n\t\t\t\t\t\t\t\tif (py_name) {\n\t\t\t\t\t\t\t\t\t_handlers [py_name] = self;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget createLock () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.lock = null;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget acquire () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (self.lock) {\n\t\t\t\t\t\t\t\tself.lock.acquire ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget release () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (self.lock) {\n\t\t\t\t\t\t\t\tself.lock.release ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setLevel () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tself.level = _checkLevel (level);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget format () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (self.formatter) {\n\t\t\t\t\t\t\t\tvar fmt = self.formatter;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar fmt = _defaultFormatter;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn fmt.format (record);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget emit () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('Must be implemented by handler');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget handle () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tvar rv = self.filter (record);\n\t\t\t\t\t\t\tif (rv) {\n\t\t\t\t\t\t\t\tself.acquire ();\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tself.emit (record);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t\tself.release ();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setFormatter () {return __get__ (this, function (self, fmt) {\n\t\t\t\t\t\t\tself.formatter = fmt;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget flush () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget close () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (self._name && __in__ (self._name, _handlers)) {\n\t\t\t\t\t\t\t\t\tdelete _handlers [self._name];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget handleError () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (raiseExceptions) {\n\t\t\t\t\t\t\t\tvar __except0__ = Exception ('Failed to log: {}'.format (record));\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t_consoleStream.write ('--- Logging Error ---\\n');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar level = getLevelName (self.level);\n\t\t\t\t\t\t\treturn '<{} ({})>'.format (self.__class__.__name__, level);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Handler, 'name', property.call (Handler, Handler.get_name, Handler.set_name));;\n\t\t\t\t\tvar StreamHandler = __class__ ('StreamHandler', [Handler], {\n\t\t\t\t\t\tterminator: '\\n',\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, stream, level) {\n\t\t\t\t\t\t\tif (typeof stream == 'undefined' || (stream != null && stream .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar stream = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof level == 'undefined' || (level != null && level .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar level = NOTSET;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tHandler.__init__ (self, level);\n\t\t\t\t\t\t\tif (stream === null) {\n\t\t\t\t\t\t\t\tvar stream = _consoleStream;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.stream = stream;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget flush () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.acquire ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (self.stream && hasattr (self.stream, 'flush')) {\n\t\t\t\t\t\t\t\t\tself.stream.flush ();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\tself.release ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget emit () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvar msg = self.format (record);\n\t\t\t\t\t\t\t\tvar stream = self.stream;\n\t\t\t\t\t\t\t\tstream.write (msg);\n\t\t\t\t\t\t\t\tstream.write (self.terminator);\n\t\t\t\t\t\t\t\tself.flush ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\t\tself.handleError (record);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar level = getLevelName (self.level);\n\t\t\t\t\t\t\tvar py_name = getattr (self.stream, 'name', '');\n\t\t\t\t\t\t\tif (py_name) {\n\t\t\t\t\t\t\t\tpy_name += ' ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn '<{} {}({})>'.format (self.__class__.__name__, py_name, level);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar FileHandler = __class__ ('FileHandler', [StreamHandler], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, filename, mode, encoding, delay) {\n\t\t\t\t\t\t\tif (typeof mode == 'undefined' || (mode != null && mode .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar mode = 'a';\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof encoding == 'undefined' || (encoding != null && encoding .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar encoding = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof delay == 'undefined' || (delay != null && delay .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar delay = false;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No Filesystem for FileHandler');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _StderrHandler = __class__ ('_StderrHandler', [StreamHandler], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tif (typeof level == 'undefined' || (level != null && level .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar level = NOTSET;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tStreamHandler.__init__ (self, null, level);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getStream () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn _consoleStream;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (_StderrHandler, 'stream', property.call (_StderrHandler, _StderrHandler._getStream));;\n\t\t\t\t\tvar _defaultLastResort = _StderrHandler (WARNING);\n\t\t\t\t\tvar lastResort = _defaultLastResort;\n\t\t\t\t\tvar PlaceHolder = __class__ ('PlaceHolder', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, alogger) {\n\t\t\t\t\t\t\tvar n = alogger.py_name;\n\t\t\t\t\t\t\tself.loggerMap = dict ([[n, alogger]]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget append () {return __get__ (this, function (self, alogger) {\n\t\t\t\t\t\t\tvar n = alogger.py_name;\n\t\t\t\t\t\t\tif (!__in__ (n, self.loggerMap.py_keys ())) {\n\t\t\t\t\t\t\t\tself.loggerMap [n] = alogger;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar setLoggerClass = function (klass) {\n\t\t\t\t\t\tif (klass != Logger) {\n\t\t\t\t\t\t\tif (!(issubclass (klass, Logger))) {\n\t\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('logger not derived from logging.Logger: ' + klass.__name__);\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_loggerClass = klass;\n\t\t\t\t\t};\n\t\t\t\t\tvar getLoggerClass = function () {\n\t\t\t\t\t\treturn _loggerClass;\n\t\t\t\t\t};\n\t\t\t\t\tvar Manager = __class__ ('Manager', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, rootnode) {\n\t\t\t\t\t\t\tself.root = rootnode;\n\t\t\t\t\t\t\tself.disable = 0;\n\t\t\t\t\t\t\tself.emittedNoHandlerWarning = false;\n\t\t\t\t\t\t\tself.loggerDict = dict ({});\n\t\t\t\t\t\t\tself.loggerClass = null;\n\t\t\t\t\t\t\tself.logRecordFactory = null;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getLogger () {return __get__ (this, function (self, py_name) {\n\t\t\t\t\t\t\tvar rv = null;\n\t\t\t\t\t\t\tif (!(isinstance (py_name, str))) {\n\t\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('A logger name must be a string');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (__in__ (py_name, self.loggerDict)) {\n\t\t\t\t\t\t\t\t\tvar rv = self.loggerDict [py_name];\n\t\t\t\t\t\t\t\t\tif (isinstance (rv, PlaceHolder)) {\n\t\t\t\t\t\t\t\t\t\tvar ph = rv;\n\t\t\t\t\t\t\t\t\t\tvar rv = self.loggerClass || _loggerClass (py_name);\n\t\t\t\t\t\t\t\t\t\trv.manager = self;\n\t\t\t\t\t\t\t\t\t\tself.loggerDict [py_name] = rv;\n\t\t\t\t\t\t\t\t\t\tself._fixupChildren (ph, rv);\n\t\t\t\t\t\t\t\t\t\tself._fixupParents (rv);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar rv = self.loggerClass || _loggerClass (py_name);\n\t\t\t\t\t\t\t\t\trv.manager = self;\n\t\t\t\t\t\t\t\t\tself.loggerDict [py_name] = rv;\n\t\t\t\t\t\t\t\t\tself._fixupParents (rv);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setLoggerClass () {return __get__ (this, function (self, klass) {\n\t\t\t\t\t\t\tif (klass != Logger) {\n\t\t\t\t\t\t\t\tif (!(issubclass (klass, Logger))) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('logger not derived from logging.Logger: ' + klass.__name__);\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.loggerClass = klass;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setLogRecordFactory () {return __get__ (this, function (self, factory) {\n\t\t\t\t\t\t\tself.logRecordFactory = factory;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _fixupParents () {return __get__ (this, function (self, alogger) {\n\t\t\t\t\t\t\tvar py_name = alogger.py_name;\n\t\t\t\t\t\t\tvar i = py_name.rfind ('.');\n\t\t\t\t\t\t\tvar rv = null;\n\t\t\t\t\t\t\twhile (i > 0 && !(rv)) {\n\t\t\t\t\t\t\t\tvar substr = py_name.__getslice__ (0, i, 1);\n\t\t\t\t\t\t\t\tif (!__in__ (substr, self.loggerDict)) {\n\t\t\t\t\t\t\t\t\tself.loggerDict [substr] = PlaceHolder (alogger);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar obj = self.loggerDict [substr];\n\t\t\t\t\t\t\t\t\tif (isinstance (obj, Logger)) {\n\t\t\t\t\t\t\t\t\t\tvar rv = obj;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tobj.append (alogger);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar i = py_name.rfind ('.', 0, i - 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!(rv)) {\n\t\t\t\t\t\t\t\tvar rv = self.root;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talogger.parent = rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _fixupChildren () {return __get__ (this, function (self, ph, alogger) {\n\t\t\t\t\t\t\tvar py_name = alogger.py_name;\n\t\t\t\t\t\t\tvar namelen = len (py_name);\n\t\t\t\t\t\t\tfor (var c of ph.loggerMap.py_keys ()) {\n\t\t\t\t\t\t\t\tvar log = ph.loggerMap [c];\n\t\t\t\t\t\t\t\tif (!(log.parent.py_name.startswith (py_name))) {\n\t\t\t\t\t\t\t\t\talogger.parent = log.parent;\n\t\t\t\t\t\t\t\t\tlog.parent = alogger;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Logger = __class__ ('Logger', [Filterer], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, py_name, level) {\n\t\t\t\t\t\t\tif (typeof level == 'undefined' || (level != null && level .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar level = NOTSET;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tFilterer.__init__ (self);\n\t\t\t\t\t\t\tself.py_name = py_name;\n\t\t\t\t\t\t\tself.level = _checkLevel (level);\n\t\t\t\t\t\t\tself.parent = null;\n\t\t\t\t\t\t\tself.propagate = true;\n\t\t\t\t\t\t\tself.handlers = list ([]);\n\t\t\t\t\t\t\tself.disabled = false;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setLevel () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tself.level = _checkLevel (level);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget debug () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (DEBUG)) {\n\t\t\t\t\t\t\t\tself._log (DEBUG, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget info () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (INFO)) {\n\t\t\t\t\t\t\t\tself._log (INFO, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget warning () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (WARNING)) {\n\t\t\t\t\t\t\t\tself._log (WARNING, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget warn () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twarnings.warn_explicit ('The `warn` method is deprecated - use `warning`', DeprecationWarning, 'logging/__init__.py', 1388, 'logging');\n\t\t\t\t\t\t\tself.warning (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget error () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (ERROR)) {\n\t\t\t\t\t\t\t\tself._log (ERROR, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget exception () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar exc_info = true;\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'exc_info': var exc_info = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.error (msg, ...args, __kwargtrans__ (__merge__ ({exc_info: exc_info}, kwargs)));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget critical () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (CRITICAL)) {\n\t\t\t\t\t\t\t\tself._log (CRITICAL, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar fatal = critical;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget log () {return __get__ (this, function (self, level, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'level': var level = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (3, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!(isinstance (level, int))) {\n\t\t\t\t\t\t\t\tif (raiseExceptions) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('level must be an integer');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (level)) {\n\t\t\t\t\t\t\t\tself._log (level, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget findCaller () {return __get__ (this, function (self, stack_info) {\n\t\t\t\t\t\t\tif (typeof stack_info == 'undefined' || (stack_info != null && stack_info .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar stack_info = false;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar f = currentframe ();\n\t\t\t\t\t\t\tvar rv = tuple (['(unknown file)', 0, '(unknown function)', null]);\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget makeRecord () {return __get__ (this, function (self, py_name, level, fn, lno, msg, args, exc_info, func, extra, sinfo) {\n\t\t\t\t\t\t\tif (typeof func == 'undefined' || (func != null && func .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar func = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof extra == 'undefined' || (extra != null && extra .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar extra = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof sinfo == 'undefined' || (sinfo != null && sinfo .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar sinfo = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar rv = _logRecordFactory (py_name, level, fn, lno, msg, args, exc_info, func, sinfo);\n\t\t\t\t\t\t\tif (extra !== null) {\n\t\t\t\t\t\t\t\tfor (var key of extra) {\n\t\t\t\t\t\t\t\t\tif (__in__ (key, list (['message', 'asctime'])) || __in__ (key, rv.__dict__)) {\n\t\t\t\t\t\t\t\t\t\tvar __except0__ = KeyError (__mod__ ('Attempt to overwrite %r in LogRecord', key));\n\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\trv.__dict__ [key] = extra [key];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _log () {return __get__ (this, function (self, level, msg, args, exc_info, extra, stack_info) {\n\t\t\t\t\t\t\tif (typeof exc_info == 'undefined' || (exc_info != null && exc_info .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar exc_info = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof extra == 'undefined' || (extra != null && extra .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar extra = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof stack_info == 'undefined' || (stack_info != null && stack_info .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar stack_info = false;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar sinfo = null;\n\t\t\t\t\t\t\tif (_srcfile) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tvar __left0__ = self.findCaller (stack_info);\n\t\t\t\t\t\t\t\t\tvar fn = __left0__ [0];\n\t\t\t\t\t\t\t\t\tvar lno = __left0__ [1];\n\t\t\t\t\t\t\t\t\tvar func = __left0__ [2];\n\t\t\t\t\t\t\t\t\tvar sinfo = __left0__ [3];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\t\tif (isinstance (__except0__, ValueError)) {\n\t\t\t\t\t\t\t\t\t\tvar __left0__ = tuple (['(unknown file)', 0, '(unknown function)']);\n\t\t\t\t\t\t\t\t\t\tvar fn = __left0__ [0];\n\t\t\t\t\t\t\t\t\t\tvar lno = __left0__ [1];\n\t\t\t\t\t\t\t\t\t\tvar func = __left0__ [2];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar __left0__ = tuple (['(unknown file)', 0, '(unknown function)']);\n\t\t\t\t\t\t\t\tvar fn = __left0__ [0];\n\t\t\t\t\t\t\t\tvar lno = __left0__ [1];\n\t\t\t\t\t\t\t\tvar func = __left0__ [2];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar record = self.makeRecord (self.py_name, level, fn, lno, msg, args, exc_info, func, extra, sinfo);\n\t\t\t\t\t\t\tself.handle (record);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget handle () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tif (!(self.disabled) && self.filter (record)) {\n\t\t\t\t\t\t\t\tself.callHandlers (record);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget addHandler () {return __get__ (this, function (self, hdlr) {\n\t\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (!(__in__ (hdlr, self.handlers))) {\n\t\t\t\t\t\t\t\t\tself.handlers.append (hdlr);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget removeHandler () {return __get__ (this, function (self, hdlr) {\n\t\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (__in__ (hdlr, self.handlers)) {\n\t\t\t\t\t\t\t\t\tself.handlers.remove (hdlr);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget hasHandlers () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar c = self;\n\t\t\t\t\t\t\tvar rv = false;\n\t\t\t\t\t\t\twhile (c) {\n\t\t\t\t\t\t\t\tif (len (c.handlers) > 0) {\n\t\t\t\t\t\t\t\t\tvar rv = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!(c.propagate)) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar c = c.parent;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rv;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget callHandlers () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t\tvar c = self;\n\t\t\t\t\t\t\tvar found = 0;\n\t\t\t\t\t\t\twhile (c) {\n\t\t\t\t\t\t\t\tfor (var hdlr of c.handlers) {\n\t\t\t\t\t\t\t\t\tvar found = found + 1;\n\t\t\t\t\t\t\t\t\tif (record.levelno >= hdlr.level) {\n\t\t\t\t\t\t\t\t\t\thdlr.handle (record);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!(c.propagate)) {\n\t\t\t\t\t\t\t\t\tvar c = null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar c = c.parent;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (found == 0) {\n\t\t\t\t\t\t\t\tif (lastResort) {\n\t\t\t\t\t\t\t\t\tif (record.levelno >= lastResort.level) {\n\t\t\t\t\t\t\t\t\t\tlastResort.handle (record);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (raiseExceptions && !(self.manager.emittedNoHandlerWarning)) {\n\t\t\t\t\t\t\t\t\t_consoleStream.write ('No handlers could be found for logger \"{}\"'.format (self.py_name));\n\t\t\t\t\t\t\t\t\tself.manager.emittedNoHandlerWarning = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getEffectiveLevel () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar logger = self;\n\t\t\t\t\t\t\twhile (logger) {\n\t\t\t\t\t\t\t\tif (logger.level) {\n\t\t\t\t\t\t\t\t\treturn logger.level;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar logger = logger.parent;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn NOTSET;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget isEnabledFor () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tif (self.manager.disable >= level) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn level >= self.getEffectiveLevel ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getChild () {return __get__ (this, function (self, suffix) {\n\t\t\t\t\t\t\tif (self.root !== self) {\n\t\t\t\t\t\t\t\tvar suffix = '.'.join (tuple ([self.py_name, suffix]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn self.manager.getLogger (suffix);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar level = getLevelName (self.getEffectiveLevel ());\n\t\t\t\t\t\t\treturn '<{} {} ({})>'.format (self.__class__.__name__, self.py_name, level);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar RootLogger = __class__ ('RootLogger', [Logger], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tLogger.__init__ (self, 'root', level);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _loggerClass = Logger;\n\t\t\t\t\tvar LoggerAdapter = __class__ ('LoggerAdapter', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, logger, extra) {\n\t\t\t\t\t\t\tself.logger = logger;\n\t\t\t\t\t\t\tself.extra = extra;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget process () {return __get__ (this, function (self, msg, kwargs) {\n\t\t\t\t\t\t\tkwargs ['extra'] = self.extra;\n\t\t\t\t\t\t\treturn tuple ([msg, kwargs]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget debug () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (DEBUG, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget info () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (INFO, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget warning () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (WARNING, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget warn () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twarnings.warn_explicit ('The `warn` method is deprecated - use `warning`', DeprecationWarning, 'logging/__init__.py', 1719, 'logging');\n\t\t\t\t\t\t\tself.warning (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget error () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (ERROR, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget exception () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar exc_info = true;\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'exc_info': var exc_info = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (ERROR, msg, ...args, __kwargtrans__ (__merge__ ({exc_info: exc_info}, kwargs)));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget critical () {return __get__ (this, function (self, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.log (CRITICAL, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget log () {return __get__ (this, function (self, level, msg) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'level': var level = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (3, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.isEnabledFor (level)) {\n\t\t\t\t\t\t\t\tvar __left0__ = self.process (msg, kwargs);\n\t\t\t\t\t\t\t\tvar msg = __left0__ [0];\n\t\t\t\t\t\t\t\tvar kwargs = __left0__ [1];\n\t\t\t\t\t\t\t\tself.logger._log (level, msg, args, __kwargtrans__ (kwargs));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget isEnabledFor () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tif (self.logger.manager.disable >= level) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn level >= self.getEffectiveLevel ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget setLevel () {return __get__ (this, function (self, level) {\n\t\t\t\t\t\t\tself.logger.setLevel (level);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget getEffectiveLevel () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.logger.getEffectiveLevel ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget hasHandlers () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.logger.hasHandlers ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar logger = self.logger;\n\t\t\t\t\t\t\tvar level = getLevelName (logger.getEffectiveLevel ());\n\t\t\t\t\t\t\treturn '<{} {} ({})>'.format (self.__class__.__name__, logger.py_name, level);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar root = RootLogger (WARNING);\n\t\t\t\t\tLogger.root = root;\n\t\t\t\t\tLogger.manager = Manager (Logger.root);\n\t\t\t\t\troot.manager = Logger.manager;\n\t\t\t\t\tvar _resetLogging = function () {\n\t\t\t\t\t\tvar _handlerList = list ([]);\n\t\t\t\t\t\tvar _handlers = dict ({});\n\t\t\t\t\t\troot = RootLogger (WARNING);\n\t\t\t\t\t\tLogger.root = root;\n\t\t\t\t\t\tLogger.manager = Manager (Logger.root);\n\t\t\t\t\t\troot.manager = Logger.manager;\n\t\t\t\t\t};\n\t\t\t\t\tvar basicConfig = function () {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_acquireLock ();\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\t\tvar handlers = kwargs.py_pop ('handlers', null);\n\t\t\t\t\t\t\t\tif (handlers !== null) {\n\t\t\t\t\t\t\t\t\tif (__in__ ('stream', kwargs)) {\n\t\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError (\"'stream' should not be specified together with 'handlers'\");\n\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (handlers === null) {\n\t\t\t\t\t\t\t\t\tvar stream = kwargs.py_pop ('stream', null);\n\t\t\t\t\t\t\t\t\tvar h = StreamHandler (stream);\n\t\t\t\t\t\t\t\t\tvar handlers = list ([h]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar dfs = kwargs.py_pop ('datefmt', null);\n\t\t\t\t\t\t\t\tvar style = kwargs.py_pop ('style', '{');\n\t\t\t\t\t\t\t\tif (!__in__ (style, _STYLES)) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Style must be one of: {}'.format (','.join (_STYLES.py_keys ())));\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar fs = kwargs.py_pop ('format', _STYLES [style] [1]);\n\t\t\t\t\t\t\t\tvar fmt = Formatter (fs, dfs, style);\n\t\t\t\t\t\t\t\tfor (var h of handlers) {\n\t\t\t\t\t\t\t\t\tif (h.formatter === null) {\n\t\t\t\t\t\t\t\t\t\th.setFormatter (fmt);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\troot.addHandler (h);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar level = kwargs.py_pop ('level', null);\n\t\t\t\t\t\t\t\tif (level !== null) {\n\t\t\t\t\t\t\t\t\troot.setLevel (level);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (len (kwargs) > 0) {\n\t\t\t\t\t\t\t\t\tvar py_keys = ', '.join (kwargs.py_keys ());\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Unrecognised argument(s): {}'.format (py_keys));\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t_releaseLock ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar getLogger = function (py_name) {\n\t\t\t\t\t\tif (typeof py_name == 'undefined' || (py_name != null && py_name .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar py_name = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (py_name) {\n\t\t\t\t\t\t\treturn Logger.manager.getLogger (py_name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\treturn root;\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar critical = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.critical (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar fatal = critical;\n\t\t\t\t\tvar error = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.error (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar exception = function (msg) {\n\t\t\t\t\t\tvar exc_info = true;\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'exc_info': var exc_info = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\terror (msg, ...args, __kwargtrans__ (__merge__ ({exc_info: exc_info}, kwargs)));\n\t\t\t\t\t};\n\t\t\t\t\tvar warning = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.warning (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar warn = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\twarnings.warn_explicit ('The `warn` method is deprecated - use `warning`', DeprecationWarning, 'logging/__init__.py', 1944, 'logging');\n\t\t\t\t\t\twarning (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar info = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.info (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar debug = function (msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.debug (msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar log = function (level, msg) {\n\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'level': var level = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'msg': var msg = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (2, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (len (root.handlers) == 0) {\n\t\t\t\t\t\t\tbasicConfig ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\troot.log (level, msg, ...args, __kwargtrans__ (kwargs));\n\t\t\t\t\t};\n\t\t\t\t\tvar disable = function (level) {\n\t\t\t\t\t\troot.manager.disable = level;\n\t\t\t\t\t};\n\t\t\t\t\tvar shutdown = function (handlerList) {\n\t\t\t\t\t\tif (typeof handlerList == 'undefined' || (handlerList != null && handlerList .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar handlerList = _handlerList;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (var wr of py_reversed (handlerList.__getslice__ (0, null, 1))) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvar h = wr ();\n\t\t\t\t\t\t\t\tif (h) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\th.acquire ();\n\t\t\t\t\t\t\t\t\t\th.flush ();\n\t\t\t\t\t\t\t\t\t\th.close ();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\t\t\tif (isinstance (__except0__, tuple ([OSError, ValueError]))) {\n\t\t\t\t\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t\t\th.release ();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\t\tvar exc = __except0__;\n\t\t\t\t\t\t\t\t\tif (raiseExceptions) {\n\t\t\t\t\t\t\t\t\t\tvar __except1__ = exc;\n\t\t\t\t\t\t\t\t\t\t__except1__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except1__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar NullHandler = __class__ ('NullHandler', [Handler], {\n\t\t\t\t\t\tget handle () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget emit () {return __get__ (this, function (self, record) {\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget createLock () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.lock = null;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar _warnings_showwarning = null;\n\t\t\t\t\tvar _showwarning = function (message, category, filename, lineno, file, line) {\n\t\t\t\t\t\tif (typeof file == 'undefined' || (file != null && file .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar file = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof line == 'undefined' || (line != null && line .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar line = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (file !== null) {\n\t\t\t\t\t\t\tif (_warnings_showwarning !== null) {\n\t\t\t\t\t\t\t\t_warnings_showwarning (message, category, filename, lineno, file, line);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar s = warnings.formatwarning (message, category, filename, lineno, line);\n\t\t\t\t\t\t\tvar logger = getLogger ('py.warnings');\n\t\t\t\t\t\t\tif (!(logger.handlers)) {\n\t\t\t\t\t\t\t\tlogger.addHandler (NullHandler ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlogger.warning (s);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar captureWarnings = function (capture) {\n\t\t\t\t\t\tif (capture) {\n\t\t\t\t\t\t\tif (_warnings_showwarning === null) {\n\t\t\t\t\t\t\t\t_warnings_showwarning = warnings.showwarning;\n\t\t\t\t\t\t\t\twarnings.setShowWarning (_showwarning);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (_warnings_showwarning !== null) {\n\t\t\t\t\t\t\twarnings.setShowWarnings (_warnings_showwarning);\n\t\t\t\t\t\t\t_warnings_showwarning = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'time' +\n\t\t\t\t\t\t'warnings' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.BASIC_FORMAT = BASIC_FORMAT;\n\t\t\t\t\t\t__all__.BufferingFormatter = BufferingFormatter;\n\t\t\t\t\t\t__all__.CRITICAL = CRITICAL;\n\t\t\t\t\t\t__all__.ConsoleLogStream = ConsoleLogStream;\n\t\t\t\t\t\t__all__.DEBUG = DEBUG;\n\t\t\t\t\t\t__all__.ERROR = ERROR;\n\t\t\t\t\t\t__all__.FATAL = FATAL;\n\t\t\t\t\t\t__all__.FileHandler = FileHandler;\n\t\t\t\t\t\t__all__.Filter = Filter;\n\t\t\t\t\t\t__all__.Filterer = Filterer;\n\t\t\t\t\t\t__all__.Formatter = Formatter;\n\t\t\t\t\t\t__all__.Handler = Handler;\n\t\t\t\t\t\t__all__.INFO = INFO;\n\t\t\t\t\t\t__all__.LogRecord = LogRecord;\n\t\t\t\t\t\t__all__.Logger = Logger;\n\t\t\t\t\t\t__all__.LoggerAdapter = LoggerAdapter;\n\t\t\t\t\t\t__all__.Manager = Manager;\n\t\t\t\t\t\t__all__.NOTSET = NOTSET;\n\t\t\t\t\t\t__all__.NullHandler = NullHandler;\n\t\t\t\t\t\t__all__.PercentStyle = PercentStyle;\n\t\t\t\t\t\t__all__.PlaceHolder = PlaceHolder;\n\t\t\t\t\t\t__all__.RootLogger = RootLogger;\n\t\t\t\t\t\t__all__.StrFormatStyle = StrFormatStyle;\n\t\t\t\t\t\t__all__.StreamHandler = StreamHandler;\n\t\t\t\t\t\t__all__.StringTemplateStyle = StringTemplateStyle;\n\t\t\t\t\t\t__all__.WARN = WARN;\n\t\t\t\t\t\t__all__.WARNING = WARNING;\n\t\t\t\t\t\t__all__._STYLES = _STYLES;\n\t\t\t\t\t\t__all__._StderrHandler = _StderrHandler;\n\t\t\t\t\t\t__all__.__author__ = __author__;\n\t\t\t\t\t\t__all__.__date__ = __date__;\n\t\t\t\t\t\t__all__.__status__ = __status__;\n\t\t\t\t\t\t__all__.__version__ = __version__;\n\t\t\t\t\t\t__all__._acquireLock = _acquireLock;\n\t\t\t\t\t\t__all__._addHandlerRef = _addHandlerRef;\n\t\t\t\t\t\t__all__._checkLevel = _checkLevel;\n\t\t\t\t\t\t__all__._consoleStream = _consoleStream;\n\t\t\t\t\t\t__all__._defaultFormatter = _defaultFormatter;\n\t\t\t\t\t\t__all__._defaultLastResort = _defaultLastResort;\n\t\t\t\t\t\t__all__._handlerList = _handlerList;\n\t\t\t\t\t\t__all__._handlers = _handlers;\n\t\t\t\t\t\t__all__._levelToName = _levelToName;\n\t\t\t\t\t\t__all__._lock = _lock;\n\t\t\t\t\t\t__all__._logRecordFactory = _logRecordFactory;\n\t\t\t\t\t\t__all__._loggerClass = _loggerClass;\n\t\t\t\t\t\t__all__._nameToLevel = _nameToLevel;\n\t\t\t\t\t\t__all__._releaseLock = _releaseLock;\n\t\t\t\t\t\t__all__._removeHandlerRef = _removeHandlerRef;\n\t\t\t\t\t\t__all__._resetLogging = _resetLogging;\n\t\t\t\t\t\t__all__._showwarning = _showwarning;\n\t\t\t\t\t\t__all__._srcfile = _srcfile;\n\t\t\t\t\t\t__all__._startTime = _startTime;\n\t\t\t\t\t\t__all__._warnings_showwarning = _warnings_showwarning;\n\t\t\t\t\t\t__all__.addLevelName = addLevelName;\n\t\t\t\t\t\t__all__.basicConfig = basicConfig;\n\t\t\t\t\t\t__all__.captureWarnings = captureWarnings;\n\t\t\t\t\t\t__all__.critical = critical;\n\t\t\t\t\t\t__all__.currentframe = currentframe;\n\t\t\t\t\t\t__all__.debug = debug;\n\t\t\t\t\t\t__all__.disable = disable;\n\t\t\t\t\t\t__all__.error = error;\n\t\t\t\t\t\t__all__.exception = exception;\n\t\t\t\t\t\t__all__.fatal = fatal;\n\t\t\t\t\t\t__all__.getLevelName = getLevelName;\n\t\t\t\t\t\t__all__.getLogRecordFactory = getLogRecordFactory;\n\t\t\t\t\t\t__all__.getLogger = getLogger;\n\t\t\t\t\t\t__all__.getLoggerClass = getLoggerClass;\n\t\t\t\t\t\t__all__.info = info;\n\t\t\t\t\t\t__all__.lastResort = lastResort;\n\t\t\t\t\t\t__all__.log = log;\n\t\t\t\t\t\t__all__.logMultiprocessing = logMultiprocessing;\n\t\t\t\t\t\t__all__.logProcesses = logProcesses;\n\t\t\t\t\t\t__all__.logThreads = logThreads;\n\t\t\t\t\t\t__all__.makeLogRecord = makeLogRecord;\n\t\t\t\t\t\t__all__.raiseExceptions = raiseExceptions;\n\t\t\t\t\t\t__all__.root = root;\n\t\t\t\t\t\t__all__.setLogRecordFactory = setLogRecordFactory;\n\t\t\t\t\t\t__all__.setLoggerClass = setLoggerClass;\n\t\t\t\t\t\t__all__.shutdown = shutdown;\n\t\t\t\t\t\t__all__.warn = warn;\n\t\t\t\t\t\t__all__.warning = warning;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'math', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar pi = Math.PI;\n\t\t\t\t\tvar e = Math.E;\n\t\t\t\t\tvar exp = Math.exp;\n\t\t\t\t\tvar expm1 = function (x) {\n\t\t\t\t\t\treturn Math.exp (x) - 1;\n\t\t\t\t\t};\n\t\t\t\t\tvar log = function (x, base) {\n\t\t\t\t\t\treturn (base === undefined ? Math.log (x) : Math.log (x) / Math.log (base));\n\t\t\t\t\t};\n\t\t\t\t\tvar log1p = function (x) {\n\t\t\t\t\t\treturn Math.log (x + 1);\n\t\t\t\t\t};\n\t\t\t\t\tvar log2 = function (x) {\n\t\t\t\t\t\treturn Math.log (x) / Math.LN2;\n\t\t\t\t\t};\n\t\t\t\t\tvar log10 = function (x) {\n\t\t\t\t\t\treturn Math.log (x) / Math.LN10;\n\t\t\t\t\t};\n\t\t\t\t\tvar pow = Math.pow;\n\t\t\t\t\tvar sqrt = Math.sqrt;\n\t\t\t\t\tvar sin = Math.sin;\n\t\t\t\t\tvar cos = Math.cos;\n\t\t\t\t\tvar tan = Math.tan;\n\t\t\t\t\tvar asin = Math.asin;\n\t\t\t\t\tvar acos = Math.acos;\n\t\t\t\t\tvar atan = Math.atan;\n\t\t\t\t\tvar atan2 = Math.atan2;\n\t\t\t\t\tvar hypot = Math.hypot;\n\t\t\t\t\tvar degrees = function (x) {\n\t\t\t\t\t\treturn (x * 180) / Math.PI;\n\t\t\t\t\t};\n\t\t\t\t\tvar radians = function (x) {\n\t\t\t\t\t\treturn (x * Math.PI) / 180;\n\t\t\t\t\t};\n\t\t\t\t\tvar sinh = Math.sinh;\n\t\t\t\t\tvar cosh = Math.cosh;\n\t\t\t\t\tvar tanh = Math.tanh;\n\t\t\t\t\tvar asinh = Math.asinh;\n\t\t\t\t\tvar acosh = Math.acosh;\n\t\t\t\t\tvar atanh = Math.atanh;\n\t\t\t\t\tvar floor = Math.floor;\n\t\t\t\t\tvar ceil = Math.ceil;\n\t\t\t\t\tvar trunc = Math.trunc;\n\t\t\t\t\tvar isnan = isNaN;\n\t\t\t\t\tvar inf = Infinity;\n\t\t\t\t\tvar nan = NaN;\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.acos = acos;\n\t\t\t\t\t\t__all__.acosh = acosh;\n\t\t\t\t\t\t__all__.asin = asin;\n\t\t\t\t\t\t__all__.asinh = asinh;\n\t\t\t\t\t\t__all__.atan = atan;\n\t\t\t\t\t\t__all__.atan2 = atan2;\n\t\t\t\t\t\t__all__.atanh = atanh;\n\t\t\t\t\t\t__all__.ceil = ceil;\n\t\t\t\t\t\t__all__.cos = cos;\n\t\t\t\t\t\t__all__.cosh = cosh;\n\t\t\t\t\t\t__all__.degrees = degrees;\n\t\t\t\t\t\t__all__.e = e;\n\t\t\t\t\t\t__all__.exp = exp;\n\t\t\t\t\t\t__all__.expm1 = expm1;\n\t\t\t\t\t\t__all__.floor = floor;\n\t\t\t\t\t\t__all__.hypot = hypot;\n\t\t\t\t\t\t__all__.inf = inf;\n\t\t\t\t\t\t__all__.isnan = isnan;\n\t\t\t\t\t\t__all__.log = log;\n\t\t\t\t\t\t__all__.log10 = log10;\n\t\t\t\t\t\t__all__.log1p = log1p;\n\t\t\t\t\t\t__all__.log2 = log2;\n\t\t\t\t\t\t__all__.nan = nan;\n\t\t\t\t\t\t__all__.pi = pi;\n\t\t\t\t\t\t__all__.pow = pow;\n\t\t\t\t\t\t__all__.radians = radians;\n\t\t\t\t\t\t__all__.sin = sin;\n\t\t\t\t\t\t__all__.sinh = sinh;\n\t\t\t\t\t\t__all__.sqrt = sqrt;\n\t\t\t\t\t\t__all__.tan = tan;\n\t\t\t\t\t\t__all__.tanh = tanh;\n\t\t\t\t\t\t__all__.trunc = trunc;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'org.threejs', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar _ctor = function (obj) {\n\t\t\t\t\t\tvar _c_ = function () {\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (0));\n\t\t\t\t\t\t\treturn new obj (...args);\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn _c_;\n\t\t\t\t\t};\n\t\t\t\t\tvar api = THREE\n\t\t\t\t\tvar WebGLRenderTargetCube = _ctor (api.WebGLRenderTargetCube);\n\t\t\t\t\tvar WebGLRenderTarget = _ctor (api.WebGLRenderTarget);\n\t\t\t\t\tvar WebGLRenderer = _ctor (api.WebGLRenderer);\n\t\t\t\t\tvar ShaderLib = _ctor (api.ShaderLib);\n\t\t\t\t\tvar UniformsLib = _ctor (api.UniformsLib);\n\t\t\t\t\tvar UniformsUtils = _ctor (api.UniformsUtils);\n\t\t\t\t\tvar ShaderChunk = _ctor (api.ShaderChunk);\n\t\t\t\t\tvar FogExp2 = _ctor (api.FogExp2);\n\t\t\t\t\tvar Fog = _ctor (api.Fog);\n\t\t\t\t\tvar Scene = _ctor (api.Scene);\n\t\t\t\t\tvar LensFlare = _ctor (api.LensFlare);\n\t\t\t\t\tvar Sprite = _ctor (api.Sprite);\n\t\t\t\t\tvar LOD = _ctor (api.LOD);\n\t\t\t\t\tvar SkinnedMesh = _ctor (api.SkinnedMesh);\n\t\t\t\t\tvar Skeleton = _ctor (api.Skeleton);\n\t\t\t\t\tvar Bone = _ctor (api.Bone);\n\t\t\t\t\tvar Mesh = _ctor (api.Mesh);\n\t\t\t\t\tvar LineSegments = _ctor (api.LineSegments);\n\t\t\t\t\tvar LineLoop = _ctor (api.LineLoop);\n\t\t\t\t\tvar Line = _ctor (api.Line);\n\t\t\t\t\tvar Points = _ctor (api.Points);\n\t\t\t\t\tvar Group = _ctor (api.Group);\n\t\t\t\t\tvar VideoTexture = _ctor (api.VideoTexture);\n\t\t\t\t\tvar DataTexture = _ctor (api.DataTexture);\n\t\t\t\t\tvar CompressedTexture = _ctor (api.CompressedTexture);\n\t\t\t\t\tvar CubeTexture = _ctor (api.CubeTexture);\n\t\t\t\t\tvar CanvasTexture = _ctor (api.CanvasTexture);\n\t\t\t\t\tvar DepthTexture = _ctor (api.DepthTexture);\n\t\t\t\t\tvar Texture = _ctor (api.Texture);\n\t\t\t\t\tvar CompressedTextureLoader = _ctor (api.CompressedTextureLoader);\n\t\t\t\t\tvar DataTextureLoader = _ctor (api.DataTextureLoader);\n\t\t\t\t\tvar CubeTextureLoader = _ctor (api.CubeTextureLoader);\n\t\t\t\t\tvar TextureLoader = _ctor (api.TextureLoader);\n\t\t\t\t\tvar ObjectLoader = _ctor (api.ObjectLoader);\n\t\t\t\t\tvar MaterialLoader = _ctor (api.MaterialLoader);\n\t\t\t\t\tvar BufferGeometryLoader = _ctor (api.BufferGeometryLoader);\n\t\t\t\t\tvar DefaultLoadingManager = _ctor (api.DefaultLoadingManager);\n\t\t\t\t\tvar LoadingManager = _ctor (api.LoadingManager);\n\t\t\t\t\tvar JSONLoader = _ctor (api.JSONLoader);\n\t\t\t\t\tvar ImageLoader = _ctor (api.ImageLoader);\n\t\t\t\t\tvar FontLoader = _ctor (api.FontLoader);\n\t\t\t\t\tvar FileLoader = _ctor (api.FileLoader);\n\t\t\t\t\tvar Loader = _ctor (api.Loader);\n\t\t\t\t\tvar Cache = _ctor (api.Cache);\n\t\t\t\t\tvar AudioLoader = _ctor (api.AudioLoader);\n\t\t\t\t\tvar SpotLightShadow = _ctor (api.SpotLightShadow);\n\t\t\t\t\tvar SpotLight = _ctor (api.SpotLight);\n\t\t\t\t\tvar PointLight = _ctor (api.PointLight);\n\t\t\t\t\tvar RectAreaLight = _ctor (api.RectAreaLight);\n\t\t\t\t\tvar HemisphereLight = _ctor (api.HemisphereLight);\n\t\t\t\t\tvar DirectionalLightShadow = _ctor (api.DirectionalLightShadow);\n\t\t\t\t\tvar DirectionalLight = _ctor (api.DirectionalLight);\n\t\t\t\t\tvar AmbientLight = _ctor (api.AmbientLight);\n\t\t\t\t\tvar LightShadow = _ctor (api.LightShadow);\n\t\t\t\t\tvar Light = _ctor (api.Light);\n\t\t\t\t\tvar StereoCamera = _ctor (api.StereoCamera);\n\t\t\t\t\tvar PerspectiveCamera = _ctor (api.PerspectiveCamera);\n\t\t\t\t\tvar OrthographicCamera = _ctor (api.OrthographicCamera);\n\t\t\t\t\tvar CubeCamera = _ctor (api.CubeCamera);\n\t\t\t\t\tvar ArrayCamera = _ctor (api.ArrayCamera);\n\t\t\t\t\tvar Camera = _ctor (api.Camera);\n\t\t\t\t\tvar AudioListener = _ctor (api.AudioListener);\n\t\t\t\t\tvar PositionalAudio = _ctor (api.PositionalAudio);\n\t\t\t\t\tvar AudioContext = _ctor (api.AudioContext);\n\t\t\t\t\tvar AudioAnalyser = _ctor (api.AudioAnalyser);\n\t\t\t\t\tvar Audio = _ctor (api.Audio);\n\t\t\t\t\tvar VectorKeyframeTrack = _ctor (api.VectorKeyframeTrack);\n\t\t\t\t\tvar StringKeyframeTrack = _ctor (api.StringKeyframeTrack);\n\t\t\t\t\tvar QuaternionKeyframeTrack = _ctor (api.QuaternionKeyframeTrack);\n\t\t\t\t\tvar NumberKeyframeTrack = _ctor (api.NumberKeyframeTrack);\n\t\t\t\t\tvar ColorKeyframeTrack = _ctor (api.ColorKeyframeTrack);\n\t\t\t\t\tvar BooleanKeyframeTrack = _ctor (api.BooleanKeyframeTrack);\n\t\t\t\t\tvar PropertyMixer = _ctor (api.PropertyMixer);\n\t\t\t\t\tvar PropertyBinding = _ctor (api.PropertyBinding);\n\t\t\t\t\tvar KeyframeTrack = _ctor (api.KeyframeTrack);\n\t\t\t\t\tvar AnimationUtils = _ctor (api.AnimationUtils);\n\t\t\t\t\tvar AnimationObjectGroup = _ctor (api.AnimationObjectGroup);\n\t\t\t\t\tvar AnimationMixer = _ctor (api.AnimationMixer);\n\t\t\t\t\tvar AnimationClip = _ctor (api.AnimationClip);\n\t\t\t\t\tvar Uniform = _ctor (api.Uniform);\n\t\t\t\t\tvar InstancedBufferGeometry = _ctor (api.InstancedBufferGeometry);\n\t\t\t\t\tvar BufferGeometry = _ctor (api.BufferGeometry);\n\t\t\t\t\tvar GeometryIdCount = _ctor (api.GeometryIdCount);\n\t\t\t\t\tvar Geometry = _ctor (api.Geometry);\n\t\t\t\t\tvar InterleavedBufferAttribute = _ctor (api.InterleavedBufferAttribute);\n\t\t\t\t\tvar InstancedInterleavedBuffer = _ctor (api.InstancedInterleavedBuffer);\n\t\t\t\t\tvar InterleavedBuffer = _ctor (api.InterleavedBuffer);\n\t\t\t\t\tvar InstancedBufferAttribute = _ctor (api.InstancedBufferAttribute);\n\t\t\t\t\tvar Face3 = _ctor (api.Face3);\n\t\t\t\t\tvar Object3D = _ctor (api.Object3D);\n\t\t\t\t\tvar Raycaster = _ctor (api.Raycaster);\n\t\t\t\t\tvar Layers = _ctor (api.Layers);\n\t\t\t\t\tvar EventDispatcher = _ctor (api.EventDispatcher);\n\t\t\t\t\tvar Clock = _ctor (api.Clock);\n\t\t\t\t\tvar QuaternionLinearInterpolant = _ctor (api.QuaternionLinearInterpolant);\n\t\t\t\t\tvar LinearInterpolant = _ctor (api.LinearInterpolant);\n\t\t\t\t\tvar DiscreteInterpolant = _ctor (api.DiscreteInterpolant);\n\t\t\t\t\tvar CubicInterpolant = _ctor (api.CubicInterpolant);\n\t\t\t\t\tvar Interpolant = _ctor (api.Interpolant);\n\t\t\t\t\tvar Triangle = _ctor (api.Triangle);\n\t\t\t\t\tvar Math = _ctor (api.Math);\n\t\t\t\t\tvar Spherical = _ctor (api.Spherical);\n\t\t\t\t\tvar Cylindrical = _ctor (api.Cylindrical);\n\t\t\t\t\tvar Plane = _ctor (api.Plane);\n\t\t\t\t\tvar Frustum = _ctor (api.Frustum);\n\t\t\t\t\tvar Sphere = _ctor (api.Sphere);\n\t\t\t\t\tvar Ray = _ctor (api.Ray);\n\t\t\t\t\tvar Matrix4 = _ctor (api.Matrix4);\n\t\t\t\t\tvar Matrix3 = _ctor (api.Matrix3);\n\t\t\t\t\tvar Box3 = _ctor (api.Box3);\n\t\t\t\t\tvar Box2 = _ctor (api.Box2);\n\t\t\t\t\tvar Line3 = _ctor (api.Line3);\n\t\t\t\t\tvar Euler = _ctor (api.Euler);\n\t\t\t\t\tvar Vector3 = _ctor (api.Vector3);\n\t\t\t\t\tvar Quaternion = _ctor (api.Quaternion);\n\t\t\t\t\tvar Color = _ctor (api.Color);\n\t\t\t\t\tvar MorphBlendMesh = _ctor (api.MorphBlendMesh);\n\t\t\t\t\tvar ImmediateRenderObject = _ctor (api.ImmediateRenderObject);\n\t\t\t\t\tvar VertexNormalsHelper = _ctor (api.VertexNormalsHelper);\n\t\t\t\t\tvar SpotLightHelper = _ctor (api.SpotLightHelper);\n\t\t\t\t\tvar SkeletonHelper = _ctor (api.SkeletonHelper);\n\t\t\t\t\tvar PointLightHelper = _ctor (api.PointLightHelper);\n\t\t\t\t\tvar RectAreaLightHelper = _ctor (api.RectAreaLightHelper);\n\t\t\t\t\tvar HemisphereLightHelper = _ctor (api.HemisphereLightHelper);\n\t\t\t\t\tvar GridHelper = _ctor (api.GridHelper);\n\t\t\t\t\tvar PolarGridHelper = _ctor (api.PolarGridHelper);\n\t\t\t\t\tvar FaceNormalsHelper = _ctor (api.FaceNormalsHelper);\n\t\t\t\t\tvar DirectionalLightHelper = _ctor (api.DirectionalLightHelper);\n\t\t\t\t\tvar CameraHelper = _ctor (api.CameraHelper);\n\t\t\t\t\tvar BoxHelper = _ctor (api.BoxHelper);\n\t\t\t\t\tvar ArrowHelper = _ctor (api.ArrowHelper);\n\t\t\t\t\tvar AxisHelper = _ctor (api.AxisHelper);\n\t\t\t\t\tvar CatmullRomCurve3 = _ctor (api.CatmullRomCurve3);\n\t\t\t\t\tvar CubicBezierCurve3 = _ctor (api.CubicBezierCurve3);\n\t\t\t\t\tvar QuadraticBezierCurve3 = _ctor (api.QuadraticBezierCurve3);\n\t\t\t\t\tvar LineCurve3 = _ctor (api.LineCurve3);\n\t\t\t\t\tvar ArcCurve = _ctor (api.ArcCurve);\n\t\t\t\t\tvar EllipseCurve = _ctor (api.EllipseCurve);\n\t\t\t\t\tvar SplineCurve = _ctor (api.SplineCurve);\n\t\t\t\t\tvar CubicBezierCurve = _ctor (api.CubicBezierCurve);\n\t\t\t\t\tvar QuadraticBezierCurve = _ctor (api.QuadraticBezierCurve);\n\t\t\t\t\tvar LineCurve = _ctor (api.LineCurve);\n\t\t\t\t\tvar Shape = _ctor (api.Shape);\n\t\t\t\t\tvar Path = _ctor (api.Path);\n\t\t\t\t\tvar ShapePath = _ctor (api.ShapePath);\n\t\t\t\t\tvar Font = _ctor (api.Font);\n\t\t\t\t\tvar CurvePath = _ctor (api.CurvePath);\n\t\t\t\t\tvar Curve = _ctor (api.Curve);\n\t\t\t\t\tvar ShapeUtils = _ctor (api.ShapeUtils);\n\t\t\t\t\tvar SceneUtils = _ctor (api.SceneUtils);\n\t\t\t\t\tvar WireframeGeometry = _ctor (api.WireframeGeometry);\n\t\t\t\t\tvar ParametricGeometry = _ctor (api.ParametricGeometry);\n\t\t\t\t\tvar ParametricBufferGeometry = _ctor (api.ParametricBufferGeometry);\n\t\t\t\t\tvar TetrahedronGeometry = _ctor (api.TetrahedronGeometry);\n\t\t\t\t\tvar TetrahedronBufferGeometry = _ctor (api.TetrahedronBufferGeometry);\n\t\t\t\t\tvar OctahedronGeometry = _ctor (api.OctahedronGeometry);\n\t\t\t\t\tvar OctahedronBufferGeometry = _ctor (api.OctahedronBufferGeometry);\n\t\t\t\t\tvar IcosahedronGeometry = _ctor (api.IcosahedronGeometry);\n\t\t\t\t\tvar IcosahedronBufferGeometry = _ctor (api.IcosahedronBufferGeometry);\n\t\t\t\t\tvar DodecahedronGeometry = _ctor (api.DodecahedronGeometry);\n\t\t\t\t\tvar DodecahedronBufferGeometry = _ctor (api.DodecahedronBufferGeometry);\n\t\t\t\t\tvar PolyhedronGeometry = _ctor (api.PolyhedronGeometry);\n\t\t\t\t\tvar PolyhedronBufferGeometry = _ctor (api.PolyhedronBufferGeometry);\n\t\t\t\t\tvar TubeGeometry = _ctor (api.TubeGeometry);\n\t\t\t\t\tvar TubeBufferGeometry = _ctor (api.TubeBufferGeometry);\n\t\t\t\t\tvar TorusKnotGeometry = _ctor (api.TorusKnotGeometry);\n\t\t\t\t\tvar TorusKnotBufferGeometry = _ctor (api.TorusKnotBufferGeometry);\n\t\t\t\t\tvar TorusGeometry = _ctor (api.TorusGeometry);\n\t\t\t\t\tvar TorusBufferGeometry = _ctor (api.TorusBufferGeometry);\n\t\t\t\t\tvar TextGeometry = _ctor (api.TextGeometry);\n\t\t\t\t\tvar TextBufferGeometry = _ctor (api.TextBufferGeometry);\n\t\t\t\t\tvar SphereGeometry = _ctor (api.SphereGeometry);\n\t\t\t\t\tvar SphereBufferGeometry = _ctor (api.SphereBufferGeometry);\n\t\t\t\t\tvar RingGeometry = _ctor (api.RingGeometry);\n\t\t\t\t\tvar RingBufferGeometry = _ctor (api.RingBufferGeometry);\n\t\t\t\t\tvar PlaneGeometry = _ctor (api.PlaneGeometry);\n\t\t\t\t\tvar PlaneBufferGeometry = _ctor (api.PlaneBufferGeometry);\n\t\t\t\t\tvar LatheGeometry = _ctor (api.LatheGeometry);\n\t\t\t\t\tvar LatheBufferGeometry = _ctor (api.LatheBufferGeometry);\n\t\t\t\t\tvar ShapeGeometry = _ctor (api.ShapeGeometry);\n\t\t\t\t\tvar ShapeBufferGeometry = _ctor (api.ShapeBufferGeometry);\n\t\t\t\t\tvar ExtrudeGeometry = _ctor (api.ExtrudeGeometry);\n\t\t\t\t\tvar ExtrudeBufferGeometry = _ctor (api.ExtrudeBufferGeometry);\n\t\t\t\t\tvar EdgesGeometry = _ctor (api.EdgesGeometry);\n\t\t\t\t\tvar ConeGeometry = _ctor (api.ConeGeometry);\n\t\t\t\t\tvar ConeBufferGeometry = _ctor (api.ConeBufferGeometry);\n\t\t\t\t\tvar CylinderGeometry = _ctor (api.CylinderGeometry);\n\t\t\t\t\tvar CylinderBufferGeometry = _ctor (api.CylinderBufferGeometry);\n\t\t\t\t\tvar CircleGeometry = _ctor (api.CircleGeometry);\n\t\t\t\t\tvar CircleBufferGeometry = _ctor (api.CircleBufferGeometry);\n\t\t\t\t\tvar BoxGeometry = _ctor (api.BoxGeometry);\n\t\t\t\t\tvar BoxBufferGeometry = _ctor (api.BoxBufferGeometry);\n\t\t\t\t\tvar ShadowMaterial = _ctor (api.ShadowMaterial);\n\t\t\t\t\tvar SpriteMaterial = _ctor (api.SpriteMaterial);\n\t\t\t\t\tvar RawShaderMaterial = _ctor (api.RawShaderMaterial);\n\t\t\t\t\tvar ShaderMaterial = _ctor (api.ShaderMaterial);\n\t\t\t\t\tvar PointsMaterial = _ctor (api.PointsMaterial);\n\t\t\t\t\tvar MeshPhysicalMaterial = _ctor (api.MeshPhysicalMaterial);\n\t\t\t\t\tvar MeshStandardMaterial = _ctor (api.MeshStandardMaterial);\n\t\t\t\t\tvar MeshPhongMaterial = _ctor (api.MeshPhongMaterial);\n\t\t\t\t\tvar MeshToonMaterial = _ctor (api.MeshToonMaterial);\n\t\t\t\t\tvar MeshNormalMaterial = _ctor (api.MeshNormalMaterial);\n\t\t\t\t\tvar MeshLambertMaterial = _ctor (api.MeshLambertMaterial);\n\t\t\t\t\tvar MeshDepthMaterial = _ctor (api.MeshDepthMaterial);\n\t\t\t\t\tvar MeshBasicMaterial = _ctor (api.MeshBasicMaterial);\n\t\t\t\t\tvar LineDashedMaterial = _ctor (api.LineDashedMaterial);\n\t\t\t\t\tvar LineBasicMaterial = _ctor (api.LineBasicMaterial);\n\t\t\t\t\tvar Material = _ctor (api.Material);\n\t\t\t\t\tvar Float64BufferAttribute = _ctor (api.Float64BufferAttribute);\n\t\t\t\t\tvar Float32BufferAttribute = _ctor (api.Float32BufferAttribute);\n\t\t\t\t\tvar Uint32BufferAttribute = _ctor (api.Uint32BufferAttribute);\n\t\t\t\t\tvar Int32BufferAttribute = _ctor (api.Int32BufferAttribute);\n\t\t\t\t\tvar Uint16BufferAttribute = _ctor (api.Uint16BufferAttribute);\n\t\t\t\t\tvar Int16BufferAttribute = _ctor (api.Int16BufferAttribute);\n\t\t\t\t\tvar Uint8ClampedBufferAttribute = _ctor (api.Uint8ClampedBufferAttribute);\n\t\t\t\t\tvar Uint8BufferAttribute = _ctor (api.Uint8BufferAttribute);\n\t\t\t\t\tvar Int8BufferAttribute = _ctor (api.Int8BufferAttribute);\n\t\t\t\t\tvar BufferAttribute = _ctor (api.BufferAttribute);\n\t\t\t\t\tvar REVISION = _ctor (api.REVISION);\n\t\t\t\t\tvar MOUSE = _ctor (api.MOUSE);\n\t\t\t\t\tvar CullFaceNone = _ctor (api.CullFaceNone);\n\t\t\t\t\tvar CullFaceBack = _ctor (api.CullFaceBack);\n\t\t\t\t\tvar CullFaceFront = _ctor (api.CullFaceFront);\n\t\t\t\t\tvar CullFaceFrontBack = _ctor (api.CullFaceFrontBack);\n\t\t\t\t\tvar FrontFaceDirectionCW = _ctor (api.FrontFaceDirectionCW);\n\t\t\t\t\tvar FrontFaceDirectionCCW = _ctor (api.FrontFaceDirectionCCW);\n\t\t\t\t\tvar BasicShadowMap = _ctor (api.BasicShadowMap);\n\t\t\t\t\tvar PCFShadowMap = _ctor (api.PCFShadowMap);\n\t\t\t\t\tvar PCFSoftShadowMap = _ctor (api.PCFSoftShadowMap);\n\t\t\t\t\tvar FrontSide = _ctor (api.FrontSide);\n\t\t\t\t\tvar BackSide = _ctor (api.BackSide);\n\t\t\t\t\tvar DoubleSide = _ctor (api.DoubleSide);\n\t\t\t\t\tvar FlatShading = _ctor (api.FlatShading);\n\t\t\t\t\tvar SmoothShading = _ctor (api.SmoothShading);\n\t\t\t\t\tvar NoColors = _ctor (api.NoColors);\n\t\t\t\t\tvar FaceColors = _ctor (api.FaceColors);\n\t\t\t\t\tvar VertexColors = _ctor (api.VertexColors);\n\t\t\t\t\tvar NoBlending = _ctor (api.NoBlending);\n\t\t\t\t\tvar NormalBlending = _ctor (api.NormalBlending);\n\t\t\t\t\tvar AdditiveBlending = _ctor (api.AdditiveBlending);\n\t\t\t\t\tvar SubtractiveBlending = _ctor (api.SubtractiveBlending);\n\t\t\t\t\tvar MultiplyBlending = _ctor (api.MultiplyBlending);\n\t\t\t\t\tvar CustomBlending = _ctor (api.CustomBlending);\n\t\t\t\t\tvar AddEquation = _ctor (api.AddEquation);\n\t\t\t\t\tvar SubtractEquation = _ctor (api.SubtractEquation);\n\t\t\t\t\tvar ReverseSubtractEquation = _ctor (api.ReverseSubtractEquation);\n\t\t\t\t\tvar MinEquation = _ctor (api.MinEquation);\n\t\t\t\t\tvar MaxEquation = _ctor (api.MaxEquation);\n\t\t\t\t\tvar ZeroFactor = _ctor (api.ZeroFactor);\n\t\t\t\t\tvar OneFactor = _ctor (api.OneFactor);\n\t\t\t\t\tvar SrcColorFactor = _ctor (api.SrcColorFactor);\n\t\t\t\t\tvar OneMinusSrcColorFactor = _ctor (api.OneMinusSrcColorFactor);\n\t\t\t\t\tvar SrcAlphaFactor = _ctor (api.SrcAlphaFactor);\n\t\t\t\t\tvar OneMinusSrcAlphaFactor = _ctor (api.OneMinusSrcAlphaFactor);\n\t\t\t\t\tvar DstAlphaFactor = _ctor (api.DstAlphaFactor);\n\t\t\t\t\tvar OneMinusDstAlphaFactor = _ctor (api.OneMinusDstAlphaFactor);\n\t\t\t\t\tvar DstColorFactor = _ctor (api.DstColorFactor);\n\t\t\t\t\tvar OneMinusDstColorFactor = _ctor (api.OneMinusDstColorFactor);\n\t\t\t\t\tvar SrcAlphaSaturateFactor = _ctor (api.SrcAlphaSaturateFactor);\n\t\t\t\t\tvar NeverDepth = _ctor (api.NeverDepth);\n\t\t\t\t\tvar AlwaysDepth = _ctor (api.AlwaysDepth);\n\t\t\t\t\tvar LessDepth = _ctor (api.LessDepth);\n\t\t\t\t\tvar LessEqualDepth = _ctor (api.LessEqualDepth);\n\t\t\t\t\tvar EqualDepth = _ctor (api.EqualDepth);\n\t\t\t\t\tvar GreaterEqualDepth = _ctor (api.GreaterEqualDepth);\n\t\t\t\t\tvar GreaterDepth = _ctor (api.GreaterDepth);\n\t\t\t\t\tvar NotEqualDepth = _ctor (api.NotEqualDepth);\n\t\t\t\t\tvar MultiplyOperation = _ctor (api.MultiplyOperation);\n\t\t\t\t\tvar MixOperation = _ctor (api.MixOperation);\n\t\t\t\t\tvar AddOperation = _ctor (api.AddOperation);\n\t\t\t\t\tvar NoToneMapping = _ctor (api.NoToneMapping);\n\t\t\t\t\tvar LinearToneMapping = _ctor (api.LinearToneMapping);\n\t\t\t\t\tvar ReinhardToneMapping = _ctor (api.ReinhardToneMapping);\n\t\t\t\t\tvar Uncharted2ToneMapping = _ctor (api.Uncharted2ToneMapping);\n\t\t\t\t\tvar CineonToneMapping = _ctor (api.CineonToneMapping);\n\t\t\t\t\tvar UVMapping = _ctor (api.UVMapping);\n\t\t\t\t\tvar CubeReflectionMapping = _ctor (api.CubeReflectionMapping);\n\t\t\t\t\tvar CubeRefractionMapping = _ctor (api.CubeRefractionMapping);\n\t\t\t\t\tvar EquirectangularReflectionMapping = _ctor (api.EquirectangularReflectionMapping);\n\t\t\t\t\tvar EquirectangularRefractionMapping = _ctor (api.EquirectangularRefractionMapping);\n\t\t\t\t\tvar SphericalReflectionMapping = _ctor (api.SphericalReflectionMapping);\n\t\t\t\t\tvar CubeUVReflectionMapping = _ctor (api.CubeUVReflectionMapping);\n\t\t\t\t\tvar CubeUVRefractionMapping = _ctor (api.CubeUVRefractionMapping);\n\t\t\t\t\tvar RepeatWrapping = _ctor (api.RepeatWrapping);\n\t\t\t\t\tvar ClampToEdgeWrapping = _ctor (api.ClampToEdgeWrapping);\n\t\t\t\t\tvar MirroredRepeatWrapping = _ctor (api.MirroredRepeatWrapping);\n\t\t\t\t\tvar NearestFilter = _ctor (api.NearestFilter);\n\t\t\t\t\tvar NearestMipMapNearestFilter = _ctor (api.NearestMipMapNearestFilter);\n\t\t\t\t\tvar NearestMipMapLinearFilter = _ctor (api.NearestMipMapLinearFilter);\n\t\t\t\t\tvar LinearFilter = _ctor (api.LinearFilter);\n\t\t\t\t\tvar LinearMipMapNearestFilter = _ctor (api.LinearMipMapNearestFilter);\n\t\t\t\t\tvar LinearMipMapLinearFilter = _ctor (api.LinearMipMapLinearFilter);\n\t\t\t\t\tvar UnsignedByteType = _ctor (api.UnsignedByteType);\n\t\t\t\t\tvar ByteType = _ctor (api.ByteType);\n\t\t\t\t\tvar ShortType = _ctor (api.ShortType);\n\t\t\t\t\tvar UnsignedShortType = _ctor (api.UnsignedShortType);\n\t\t\t\t\tvar IntType = _ctor (api.IntType);\n\t\t\t\t\tvar UnsignedIntType = _ctor (api.UnsignedIntType);\n\t\t\t\t\tvar FloatType = _ctor (api.FloatType);\n\t\t\t\t\tvar HalfFloatType = _ctor (api.HalfFloatType);\n\t\t\t\t\tvar UnsignedShort4444Type = _ctor (api.UnsignedShort4444Type);\n\t\t\t\t\tvar UnsignedShort5551Type = _ctor (api.UnsignedShort5551Type);\n\t\t\t\t\tvar UnsignedShort565Type = _ctor (api.UnsignedShort565Type);\n\t\t\t\t\tvar UnsignedInt248Type = _ctor (api.UnsignedInt248Type);\n\t\t\t\t\tvar AlphaFormat = _ctor (api.AlphaFormat);\n\t\t\t\t\tvar RGBFormat = _ctor (api.RGBFormat);\n\t\t\t\t\tvar RGBAFormat = _ctor (api.RGBAFormat);\n\t\t\t\t\tvar LuminanceFormat = _ctor (api.LuminanceFormat);\n\t\t\t\t\tvar LuminanceAlphaFormat = _ctor (api.LuminanceAlphaFormat);\n\t\t\t\t\tvar RGBEFormat = _ctor (api.RGBEFormat);\n\t\t\t\t\tvar DepthFormat = _ctor (api.DepthFormat);\n\t\t\t\t\tvar DepthStencilFormat = _ctor (api.DepthStencilFormat);\n\t\t\t\t\tvar RGB_S3TC_DXT1_Format = _ctor (api.RGB_S3TC_DXT1_Format);\n\t\t\t\t\tvar RGBA_S3TC_DXT1_Format = _ctor (api.RGBA_S3TC_DXT1_Format);\n\t\t\t\t\tvar RGBA_S3TC_DXT3_Format = _ctor (api.RGBA_S3TC_DXT3_Format);\n\t\t\t\t\tvar RGBA_S3TC_DXT5_Format = _ctor (api.RGBA_S3TC_DXT5_Format);\n\t\t\t\t\tvar RGB_PVRTC_4BPPV1_Format = _ctor (api.RGB_PVRTC_4BPPV1_Format);\n\t\t\t\t\tvar RGB_PVRTC_2BPPV1_Format = _ctor (api.RGB_PVRTC_2BPPV1_Format);\n\t\t\t\t\tvar RGBA_PVRTC_4BPPV1_Format = _ctor (api.RGBA_PVRTC_4BPPV1_Format);\n\t\t\t\t\tvar RGBA_PVRTC_2BPPV1_Format = _ctor (api.RGBA_PVRTC_2BPPV1_Format);\n\t\t\t\t\tvar RGB_ETC1_Format = _ctor (api.RGB_ETC1_Format);\n\t\t\t\t\tvar LoopOnce = _ctor (api.LoopOnce);\n\t\t\t\t\tvar LoopRepeat = _ctor (api.LoopRepeat);\n\t\t\t\t\tvar LoopPingPong = _ctor (api.LoopPingPong);\n\t\t\t\t\tvar InterpolateDiscrete = _ctor (api.InterpolateDiscrete);\n\t\t\t\t\tvar InterpolateLinear = _ctor (api.InterpolateLinear);\n\t\t\t\t\tvar InterpolateSmooth = _ctor (api.InterpolateSmooth);\n\t\t\t\t\tvar ZeroCurvatureEnding = _ctor (api.ZeroCurvatureEnding);\n\t\t\t\t\tvar ZeroSlopeEnding = _ctor (api.ZeroSlopeEnding);\n\t\t\t\t\tvar WrapAroundEnding = _ctor (api.WrapAroundEnding);\n\t\t\t\t\tvar TrianglesDrawMode = _ctor (api.TrianglesDrawMode);\n\t\t\t\t\tvar TriangleStripDrawMode = _ctor (api.TriangleStripDrawMode);\n\t\t\t\t\tvar TriangleFanDrawMode = _ctor (api.TriangleFanDrawMode);\n\t\t\t\t\tvar LinearEncoding = _ctor (api.LinearEncoding);\n\t\t\t\t\tvar sRGBEncoding = _ctor (api.sRGBEncoding);\n\t\t\t\t\tvar GammaEncoding = _ctor (api.GammaEncoding);\n\t\t\t\t\tvar RGBEEncoding = _ctor (api.RGBEEncoding);\n\t\t\t\t\tvar LogLuvEncoding = _ctor (api.LogLuvEncoding);\n\t\t\t\t\tvar RGBM7Encoding = _ctor (api.RGBM7Encoding);\n\t\t\t\t\tvar RGBM16Encoding = _ctor (api.RGBM16Encoding);\n\t\t\t\t\tvar RGBDEncoding = _ctor (api.RGBDEncoding);\n\t\t\t\t\tvar BasicDepthPacking = _ctor (api.BasicDepthPacking);\n\t\t\t\t\tvar RGBADepthPacking = _ctor (api.RGBADepthPacking);\n\t\t\t\t\tvar CubeGeometry = _ctor (api.CubeGeometry);\n\t\t\t\t\tvar Face4 = _ctor (api.Face4);\n\t\t\t\t\tvar LineStrip = _ctor (api.LineStrip);\n\t\t\t\t\tvar LinePieces = _ctor (api.LinePieces);\n\t\t\t\t\tvar MeshFaceMaterial = _ctor (api.MeshFaceMaterial);\n\t\t\t\t\tvar MultiMaterial = _ctor (api.MultiMaterial);\n\t\t\t\t\tvar PointCloud = _ctor (api.PointCloud);\n\t\t\t\t\tvar Particle = _ctor (api.Particle);\n\t\t\t\t\tvar ParticleSystem = _ctor (api.ParticleSystem);\n\t\t\t\t\tvar PointCloudMaterial = _ctor (api.PointCloudMaterial);\n\t\t\t\t\tvar ParticleBasicMaterial = _ctor (api.ParticleBasicMaterial);\n\t\t\t\t\tvar ParticleSystemMaterial = _ctor (api.ParticleSystemMaterial);\n\t\t\t\t\tvar Vertex = _ctor (api.Vertex);\n\t\t\t\t\tvar DynamicBufferAttribute = _ctor (api.DynamicBufferAttribute);\n\t\t\t\t\tvar Int8Attribute = _ctor (api.Int8Attribute);\n\t\t\t\t\tvar Uint8Attribute = _ctor (api.Uint8Attribute);\n\t\t\t\t\tvar Uint8ClampedAttribute = _ctor (api.Uint8ClampedAttribute);\n\t\t\t\t\tvar Int16Attribute = _ctor (api.Int16Attribute);\n\t\t\t\t\tvar Uint16Attribute = _ctor (api.Uint16Attribute);\n\t\t\t\t\tvar Int32Attribute = _ctor (api.Int32Attribute);\n\t\t\t\t\tvar Uint32Attribute = _ctor (api.Uint32Attribute);\n\t\t\t\t\tvar Float32Attribute = _ctor (api.Float32Attribute);\n\t\t\t\t\tvar Float64Attribute = _ctor (api.Float64Attribute);\n\t\t\t\t\tvar ClosedSplineCurve3 = _ctor (api.ClosedSplineCurve3);\n\t\t\t\t\tvar SplineCurve3 = _ctor (api.SplineCurve3);\n\t\t\t\t\tvar Spline = _ctor (api.Spline);\n\t\t\t\t\tvar BoundingBoxHelper = _ctor (api.BoundingBoxHelper);\n\t\t\t\t\tvar EdgesHelper = _ctor (api.EdgesHelper);\n\t\t\t\t\tvar WireframeHelper = _ctor (api.WireframeHelper);\n\t\t\t\t\tvar XHRLoader = _ctor (api.XHRLoader);\n\t\t\t\t\tvar BinaryTextureLoader = _ctor (api.BinaryTextureLoader);\n\t\t\t\t\tvar GeometryUtils = _ctor (api.GeometryUtils);\n\t\t\t\t\tvar ImageUtils = _ctor (api.ImageUtils);\n\t\t\t\t\tvar Projector = _ctor (api.Projector);\n\t\t\t\t\tvar CanvasRenderer = _ctor (api.CanvasRenderer);\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AddEquation = AddEquation;\n\t\t\t\t\t\t__all__.AddOperation = AddOperation;\n\t\t\t\t\t\t__all__.AdditiveBlending = AdditiveBlending;\n\t\t\t\t\t\t__all__.AlphaFormat = AlphaFormat;\n\t\t\t\t\t\t__all__.AlwaysDepth = AlwaysDepth;\n\t\t\t\t\t\t__all__.AmbientLight = AmbientLight;\n\t\t\t\t\t\t__all__.AnimationClip = AnimationClip;\n\t\t\t\t\t\t__all__.AnimationMixer = AnimationMixer;\n\t\t\t\t\t\t__all__.AnimationObjectGroup = AnimationObjectGroup;\n\t\t\t\t\t\t__all__.AnimationUtils = AnimationUtils;\n\t\t\t\t\t\t__all__.ArcCurve = ArcCurve;\n\t\t\t\t\t\t__all__.ArrayCamera = ArrayCamera;\n\t\t\t\t\t\t__all__.ArrowHelper = ArrowHelper;\n\t\t\t\t\t\t__all__.Audio = Audio;\n\t\t\t\t\t\t__all__.AudioAnalyser = AudioAnalyser;\n\t\t\t\t\t\t__all__.AudioContext = AudioContext;\n\t\t\t\t\t\t__all__.AudioListener = AudioListener;\n\t\t\t\t\t\t__all__.AudioLoader = AudioLoader;\n\t\t\t\t\t\t__all__.AxisHelper = AxisHelper;\n\t\t\t\t\t\t__all__.BackSide = BackSide;\n\t\t\t\t\t\t__all__.BasicDepthPacking = BasicDepthPacking;\n\t\t\t\t\t\t__all__.BasicShadowMap = BasicShadowMap;\n\t\t\t\t\t\t__all__.BinaryTextureLoader = BinaryTextureLoader;\n\t\t\t\t\t\t__all__.Bone = Bone;\n\t\t\t\t\t\t__all__.BooleanKeyframeTrack = BooleanKeyframeTrack;\n\t\t\t\t\t\t__all__.BoundingBoxHelper = BoundingBoxHelper;\n\t\t\t\t\t\t__all__.Box2 = Box2;\n\t\t\t\t\t\t__all__.Box3 = Box3;\n\t\t\t\t\t\t__all__.BoxBufferGeometry = BoxBufferGeometry;\n\t\t\t\t\t\t__all__.BoxGeometry = BoxGeometry;\n\t\t\t\t\t\t__all__.BoxHelper = BoxHelper;\n\t\t\t\t\t\t__all__.BufferAttribute = BufferAttribute;\n\t\t\t\t\t\t__all__.BufferGeometry = BufferGeometry;\n\t\t\t\t\t\t__all__.BufferGeometryLoader = BufferGeometryLoader;\n\t\t\t\t\t\t__all__.ByteType = ByteType;\n\t\t\t\t\t\t__all__.Cache = Cache;\n\t\t\t\t\t\t__all__.Camera = Camera;\n\t\t\t\t\t\t__all__.CameraHelper = CameraHelper;\n\t\t\t\t\t\t__all__.CanvasRenderer = CanvasRenderer;\n\t\t\t\t\t\t__all__.CanvasTexture = CanvasTexture;\n\t\t\t\t\t\t__all__.CatmullRomCurve3 = CatmullRomCurve3;\n\t\t\t\t\t\t__all__.CineonToneMapping = CineonToneMapping;\n\t\t\t\t\t\t__all__.CircleBufferGeometry = CircleBufferGeometry;\n\t\t\t\t\t\t__all__.CircleGeometry = CircleGeometry;\n\t\t\t\t\t\t__all__.ClampToEdgeWrapping = ClampToEdgeWrapping;\n\t\t\t\t\t\t__all__.Clock = Clock;\n\t\t\t\t\t\t__all__.ClosedSplineCurve3 = ClosedSplineCurve3;\n\t\t\t\t\t\t__all__.Color = Color;\n\t\t\t\t\t\t__all__.ColorKeyframeTrack = ColorKeyframeTrack;\n\t\t\t\t\t\t__all__.CompressedTexture = CompressedTexture;\n\t\t\t\t\t\t__all__.CompressedTextureLoader = CompressedTextureLoader;\n\t\t\t\t\t\t__all__.ConeBufferGeometry = ConeBufferGeometry;\n\t\t\t\t\t\t__all__.ConeGeometry = ConeGeometry;\n\t\t\t\t\t\t__all__.CubeCamera = CubeCamera;\n\t\t\t\t\t\t__all__.CubeGeometry = CubeGeometry;\n\t\t\t\t\t\t__all__.CubeReflectionMapping = CubeReflectionMapping;\n\t\t\t\t\t\t__all__.CubeRefractionMapping = CubeRefractionMapping;\n\t\t\t\t\t\t__all__.CubeTexture = CubeTexture;\n\t\t\t\t\t\t__all__.CubeTextureLoader = CubeTextureLoader;\n\t\t\t\t\t\t__all__.CubeUVReflectionMapping = CubeUVReflectionMapping;\n\t\t\t\t\t\t__all__.CubeUVRefractionMapping = CubeUVRefractionMapping;\n\t\t\t\t\t\t__all__.CubicBezierCurve = CubicBezierCurve;\n\t\t\t\t\t\t__all__.CubicBezierCurve3 = CubicBezierCurve3;\n\t\t\t\t\t\t__all__.CubicInterpolant = CubicInterpolant;\n\t\t\t\t\t\t__all__.CullFaceBack = CullFaceBack;\n\t\t\t\t\t\t__all__.CullFaceFront = CullFaceFront;\n\t\t\t\t\t\t__all__.CullFaceFrontBack = CullFaceFrontBack;\n\t\t\t\t\t\t__all__.CullFaceNone = CullFaceNone;\n\t\t\t\t\t\t__all__.Curve = Curve;\n\t\t\t\t\t\t__all__.CurvePath = CurvePath;\n\t\t\t\t\t\t__all__.CustomBlending = CustomBlending;\n\t\t\t\t\t\t__all__.CylinderBufferGeometry = CylinderBufferGeometry;\n\t\t\t\t\t\t__all__.CylinderGeometry = CylinderGeometry;\n\t\t\t\t\t\t__all__.Cylindrical = Cylindrical;\n\t\t\t\t\t\t__all__.DataTexture = DataTexture;\n\t\t\t\t\t\t__all__.DataTextureLoader = DataTextureLoader;\n\t\t\t\t\t\t__all__.DefaultLoadingManager = DefaultLoadingManager;\n\t\t\t\t\t\t__all__.DepthFormat = DepthFormat;\n\t\t\t\t\t\t__all__.DepthStencilFormat = DepthStencilFormat;\n\t\t\t\t\t\t__all__.DepthTexture = DepthTexture;\n\t\t\t\t\t\t__all__.DirectionalLight = DirectionalLight;\n\t\t\t\t\t\t__all__.DirectionalLightHelper = DirectionalLightHelper;\n\t\t\t\t\t\t__all__.DirectionalLightShadow = DirectionalLightShadow;\n\t\t\t\t\t\t__all__.DiscreteInterpolant = DiscreteInterpolant;\n\t\t\t\t\t\t__all__.DodecahedronBufferGeometry = DodecahedronBufferGeometry;\n\t\t\t\t\t\t__all__.DodecahedronGeometry = DodecahedronGeometry;\n\t\t\t\t\t\t__all__.DoubleSide = DoubleSide;\n\t\t\t\t\t\t__all__.DstAlphaFactor = DstAlphaFactor;\n\t\t\t\t\t\t__all__.DstColorFactor = DstColorFactor;\n\t\t\t\t\t\t__all__.DynamicBufferAttribute = DynamicBufferAttribute;\n\t\t\t\t\t\t__all__.EdgesGeometry = EdgesGeometry;\n\t\t\t\t\t\t__all__.EdgesHelper = EdgesHelper;\n\t\t\t\t\t\t__all__.EllipseCurve = EllipseCurve;\n\t\t\t\t\t\t__all__.EqualDepth = EqualDepth;\n\t\t\t\t\t\t__all__.EquirectangularReflectionMapping = EquirectangularReflectionMapping;\n\t\t\t\t\t\t__all__.EquirectangularRefractionMapping = EquirectangularRefractionMapping;\n\t\t\t\t\t\t__all__.Euler = Euler;\n\t\t\t\t\t\t__all__.EventDispatcher = EventDispatcher;\n\t\t\t\t\t\t__all__.ExtrudeBufferGeometry = ExtrudeBufferGeometry;\n\t\t\t\t\t\t__all__.ExtrudeGeometry = ExtrudeGeometry;\n\t\t\t\t\t\t__all__.Face3 = Face3;\n\t\t\t\t\t\t__all__.Face4 = Face4;\n\t\t\t\t\t\t__all__.FaceColors = FaceColors;\n\t\t\t\t\t\t__all__.FaceNormalsHelper = FaceNormalsHelper;\n\t\t\t\t\t\t__all__.FileLoader = FileLoader;\n\t\t\t\t\t\t__all__.FlatShading = FlatShading;\n\t\t\t\t\t\t__all__.Float32Attribute = Float32Attribute;\n\t\t\t\t\t\t__all__.Float32BufferAttribute = Float32BufferAttribute;\n\t\t\t\t\t\t__all__.Float64Attribute = Float64Attribute;\n\t\t\t\t\t\t__all__.Float64BufferAttribute = Float64BufferAttribute;\n\t\t\t\t\t\t__all__.FloatType = FloatType;\n\t\t\t\t\t\t__all__.Fog = Fog;\n\t\t\t\t\t\t__all__.FogExp2 = FogExp2;\n\t\t\t\t\t\t__all__.Font = Font;\n\t\t\t\t\t\t__all__.FontLoader = FontLoader;\n\t\t\t\t\t\t__all__.FrontFaceDirectionCCW = FrontFaceDirectionCCW;\n\t\t\t\t\t\t__all__.FrontFaceDirectionCW = FrontFaceDirectionCW;\n\t\t\t\t\t\t__all__.FrontSide = FrontSide;\n\t\t\t\t\t\t__all__.Frustum = Frustum;\n\t\t\t\t\t\t__all__.GammaEncoding = GammaEncoding;\n\t\t\t\t\t\t__all__.Geometry = Geometry;\n\t\t\t\t\t\t__all__.GeometryIdCount = GeometryIdCount;\n\t\t\t\t\t\t__all__.GeometryUtils = GeometryUtils;\n\t\t\t\t\t\t__all__.GreaterDepth = GreaterDepth;\n\t\t\t\t\t\t__all__.GreaterEqualDepth = GreaterEqualDepth;\n\t\t\t\t\t\t__all__.GridHelper = GridHelper;\n\t\t\t\t\t\t__all__.Group = Group;\n\t\t\t\t\t\t__all__.HalfFloatType = HalfFloatType;\n\t\t\t\t\t\t__all__.HemisphereLight = HemisphereLight;\n\t\t\t\t\t\t__all__.HemisphereLightHelper = HemisphereLightHelper;\n\t\t\t\t\t\t__all__.IcosahedronBufferGeometry = IcosahedronBufferGeometry;\n\t\t\t\t\t\t__all__.IcosahedronGeometry = IcosahedronGeometry;\n\t\t\t\t\t\t__all__.ImageLoader = ImageLoader;\n\t\t\t\t\t\t__all__.ImageUtils = ImageUtils;\n\t\t\t\t\t\t__all__.ImmediateRenderObject = ImmediateRenderObject;\n\t\t\t\t\t\t__all__.InstancedBufferAttribute = InstancedBufferAttribute;\n\t\t\t\t\t\t__all__.InstancedBufferGeometry = InstancedBufferGeometry;\n\t\t\t\t\t\t__all__.InstancedInterleavedBuffer = InstancedInterleavedBuffer;\n\t\t\t\t\t\t__all__.Int16Attribute = Int16Attribute;\n\t\t\t\t\t\t__all__.Int16BufferAttribute = Int16BufferAttribute;\n\t\t\t\t\t\t__all__.Int32Attribute = Int32Attribute;\n\t\t\t\t\t\t__all__.Int32BufferAttribute = Int32BufferAttribute;\n\t\t\t\t\t\t__all__.Int8Attribute = Int8Attribute;\n\t\t\t\t\t\t__all__.Int8BufferAttribute = Int8BufferAttribute;\n\t\t\t\t\t\t__all__.IntType = IntType;\n\t\t\t\t\t\t__all__.InterleavedBuffer = InterleavedBuffer;\n\t\t\t\t\t\t__all__.InterleavedBufferAttribute = InterleavedBufferAttribute;\n\t\t\t\t\t\t__all__.Interpolant = Interpolant;\n\t\t\t\t\t\t__all__.InterpolateDiscrete = InterpolateDiscrete;\n\t\t\t\t\t\t__all__.InterpolateLinear = InterpolateLinear;\n\t\t\t\t\t\t__all__.InterpolateSmooth = InterpolateSmooth;\n\t\t\t\t\t\t__all__.JSONLoader = JSONLoader;\n\t\t\t\t\t\t__all__.KeyframeTrack = KeyframeTrack;\n\t\t\t\t\t\t__all__.LOD = LOD;\n\t\t\t\t\t\t__all__.LatheBufferGeometry = LatheBufferGeometry;\n\t\t\t\t\t\t__all__.LatheGeometry = LatheGeometry;\n\t\t\t\t\t\t__all__.Layers = Layers;\n\t\t\t\t\t\t__all__.LensFlare = LensFlare;\n\t\t\t\t\t\t__all__.LessDepth = LessDepth;\n\t\t\t\t\t\t__all__.LessEqualDepth = LessEqualDepth;\n\t\t\t\t\t\t__all__.Light = Light;\n\t\t\t\t\t\t__all__.LightShadow = LightShadow;\n\t\t\t\t\t\t__all__.Line = Line;\n\t\t\t\t\t\t__all__.Line3 = Line3;\n\t\t\t\t\t\t__all__.LineBasicMaterial = LineBasicMaterial;\n\t\t\t\t\t\t__all__.LineCurve = LineCurve;\n\t\t\t\t\t\t__all__.LineCurve3 = LineCurve3;\n\t\t\t\t\t\t__all__.LineDashedMaterial = LineDashedMaterial;\n\t\t\t\t\t\t__all__.LineLoop = LineLoop;\n\t\t\t\t\t\t__all__.LinePieces = LinePieces;\n\t\t\t\t\t\t__all__.LineSegments = LineSegments;\n\t\t\t\t\t\t__all__.LineStrip = LineStrip;\n\t\t\t\t\t\t__all__.LinearEncoding = LinearEncoding;\n\t\t\t\t\t\t__all__.LinearFilter = LinearFilter;\n\t\t\t\t\t\t__all__.LinearInterpolant = LinearInterpolant;\n\t\t\t\t\t\t__all__.LinearMipMapLinearFilter = LinearMipMapLinearFilter;\n\t\t\t\t\t\t__all__.LinearMipMapNearestFilter = LinearMipMapNearestFilter;\n\t\t\t\t\t\t__all__.LinearToneMapping = LinearToneMapping;\n\t\t\t\t\t\t__all__.Loader = Loader;\n\t\t\t\t\t\t__all__.LoadingManager = LoadingManager;\n\t\t\t\t\t\t__all__.LogLuvEncoding = LogLuvEncoding;\n\t\t\t\t\t\t__all__.LoopOnce = LoopOnce;\n\t\t\t\t\t\t__all__.LoopPingPong = LoopPingPong;\n\t\t\t\t\t\t__all__.LoopRepeat = LoopRepeat;\n\t\t\t\t\t\t__all__.LuminanceAlphaFormat = LuminanceAlphaFormat;\n\t\t\t\t\t\t__all__.LuminanceFormat = LuminanceFormat;\n\t\t\t\t\t\t__all__.MOUSE = MOUSE;\n\t\t\t\t\t\t__all__.Material = Material;\n\t\t\t\t\t\t__all__.MaterialLoader = MaterialLoader;\n\t\t\t\t\t\t__all__.Math = Math;\n\t\t\t\t\t\t__all__.Matrix3 = Matrix3;\n\t\t\t\t\t\t__all__.Matrix4 = Matrix4;\n\t\t\t\t\t\t__all__.MaxEquation = MaxEquation;\n\t\t\t\t\t\t__all__.Mesh = Mesh;\n\t\t\t\t\t\t__all__.MeshBasicMaterial = MeshBasicMaterial;\n\t\t\t\t\t\t__all__.MeshDepthMaterial = MeshDepthMaterial;\n\t\t\t\t\t\t__all__.MeshFaceMaterial = MeshFaceMaterial;\n\t\t\t\t\t\t__all__.MeshLambertMaterial = MeshLambertMaterial;\n\t\t\t\t\t\t__all__.MeshNormalMaterial = MeshNormalMaterial;\n\t\t\t\t\t\t__all__.MeshPhongMaterial = MeshPhongMaterial;\n\t\t\t\t\t\t__all__.MeshPhysicalMaterial = MeshPhysicalMaterial;\n\t\t\t\t\t\t__all__.MeshStandardMaterial = MeshStandardMaterial;\n\t\t\t\t\t\t__all__.MeshToonMaterial = MeshToonMaterial;\n\t\t\t\t\t\t__all__.MinEquation = MinEquation;\n\t\t\t\t\t\t__all__.MirroredRepeatWrapping = MirroredRepeatWrapping;\n\t\t\t\t\t\t__all__.MixOperation = MixOperation;\n\t\t\t\t\t\t__all__.MorphBlendMesh = MorphBlendMesh;\n\t\t\t\t\t\t__all__.MultiMaterial = MultiMaterial;\n\t\t\t\t\t\t__all__.MultiplyBlending = MultiplyBlending;\n\t\t\t\t\t\t__all__.MultiplyOperation = MultiplyOperation;\n\t\t\t\t\t\t__all__.NearestFilter = NearestFilter;\n\t\t\t\t\t\t__all__.NearestMipMapLinearFilter = NearestMipMapLinearFilter;\n\t\t\t\t\t\t__all__.NearestMipMapNearestFilter = NearestMipMapNearestFilter;\n\t\t\t\t\t\t__all__.NeverDepth = NeverDepth;\n\t\t\t\t\t\t__all__.NoBlending = NoBlending;\n\t\t\t\t\t\t__all__.NoColors = NoColors;\n\t\t\t\t\t\t__all__.NoToneMapping = NoToneMapping;\n\t\t\t\t\t\t__all__.NormalBlending = NormalBlending;\n\t\t\t\t\t\t__all__.NotEqualDepth = NotEqualDepth;\n\t\t\t\t\t\t__all__.NumberKeyframeTrack = NumberKeyframeTrack;\n\t\t\t\t\t\t__all__.Object3D = Object3D;\n\t\t\t\t\t\t__all__.ObjectLoader = ObjectLoader;\n\t\t\t\t\t\t__all__.OctahedronBufferGeometry = OctahedronBufferGeometry;\n\t\t\t\t\t\t__all__.OctahedronGeometry = OctahedronGeometry;\n\t\t\t\t\t\t__all__.OneFactor = OneFactor;\n\t\t\t\t\t\t__all__.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;\n\t\t\t\t\t\t__all__.OneMinusDstColorFactor = OneMinusDstColorFactor;\n\t\t\t\t\t\t__all__.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;\n\t\t\t\t\t\t__all__.OneMinusSrcColorFactor = OneMinusSrcColorFactor;\n\t\t\t\t\t\t__all__.OrthographicCamera = OrthographicCamera;\n\t\t\t\t\t\t__all__.PCFShadowMap = PCFShadowMap;\n\t\t\t\t\t\t__all__.PCFSoftShadowMap = PCFSoftShadowMap;\n\t\t\t\t\t\t__all__.ParametricBufferGeometry = ParametricBufferGeometry;\n\t\t\t\t\t\t__all__.ParametricGeometry = ParametricGeometry;\n\t\t\t\t\t\t__all__.Particle = Particle;\n\t\t\t\t\t\t__all__.ParticleBasicMaterial = ParticleBasicMaterial;\n\t\t\t\t\t\t__all__.ParticleSystem = ParticleSystem;\n\t\t\t\t\t\t__all__.ParticleSystemMaterial = ParticleSystemMaterial;\n\t\t\t\t\t\t__all__.Path = Path;\n\t\t\t\t\t\t__all__.PerspectiveCamera = PerspectiveCamera;\n\t\t\t\t\t\t__all__.Plane = Plane;\n\t\t\t\t\t\t__all__.PlaneBufferGeometry = PlaneBufferGeometry;\n\t\t\t\t\t\t__all__.PlaneGeometry = PlaneGeometry;\n\t\t\t\t\t\t__all__.PointCloud = PointCloud;\n\t\t\t\t\t\t__all__.PointCloudMaterial = PointCloudMaterial;\n\t\t\t\t\t\t__all__.PointLight = PointLight;\n\t\t\t\t\t\t__all__.PointLightHelper = PointLightHelper;\n\t\t\t\t\t\t__all__.Points = Points;\n\t\t\t\t\t\t__all__.PointsMaterial = PointsMaterial;\n\t\t\t\t\t\t__all__.PolarGridHelper = PolarGridHelper;\n\t\t\t\t\t\t__all__.PolyhedronBufferGeometry = PolyhedronBufferGeometry;\n\t\t\t\t\t\t__all__.PolyhedronGeometry = PolyhedronGeometry;\n\t\t\t\t\t\t__all__.PositionalAudio = PositionalAudio;\n\t\t\t\t\t\t__all__.Projector = Projector;\n\t\t\t\t\t\t__all__.PropertyBinding = PropertyBinding;\n\t\t\t\t\t\t__all__.PropertyMixer = PropertyMixer;\n\t\t\t\t\t\t__all__.QuadraticBezierCurve = QuadraticBezierCurve;\n\t\t\t\t\t\t__all__.QuadraticBezierCurve3 = QuadraticBezierCurve3;\n\t\t\t\t\t\t__all__.Quaternion = Quaternion;\n\t\t\t\t\t\t__all__.QuaternionKeyframeTrack = QuaternionKeyframeTrack;\n\t\t\t\t\t\t__all__.QuaternionLinearInterpolant = QuaternionLinearInterpolant;\n\t\t\t\t\t\t__all__.REVISION = REVISION;\n\t\t\t\t\t\t__all__.RGBADepthPacking = RGBADepthPacking;\n\t\t\t\t\t\t__all__.RGBAFormat = RGBAFormat;\n\t\t\t\t\t\t__all__.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format;\n\t\t\t\t\t\t__all__.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;\n\t\t\t\t\t\t__all__.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;\n\t\t\t\t\t\t__all__.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;\n\t\t\t\t\t\t__all__.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;\n\t\t\t\t\t\t__all__.RGBDEncoding = RGBDEncoding;\n\t\t\t\t\t\t__all__.RGBEEncoding = RGBEEncoding;\n\t\t\t\t\t\t__all__.RGBEFormat = RGBEFormat;\n\t\t\t\t\t\t__all__.RGBFormat = RGBFormat;\n\t\t\t\t\t\t__all__.RGBM16Encoding = RGBM16Encoding;\n\t\t\t\t\t\t__all__.RGBM7Encoding = RGBM7Encoding;\n\t\t\t\t\t\t__all__.RGB_ETC1_Format = RGB_ETC1_Format;\n\t\t\t\t\t\t__all__.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;\n\t\t\t\t\t\t__all__.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format;\n\t\t\t\t\t\t__all__.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format;\n\t\t\t\t\t\t__all__.RawShaderMaterial = RawShaderMaterial;\n\t\t\t\t\t\t__all__.Ray = Ray;\n\t\t\t\t\t\t__all__.Raycaster = Raycaster;\n\t\t\t\t\t\t__all__.RectAreaLight = RectAreaLight;\n\t\t\t\t\t\t__all__.RectAreaLightHelper = RectAreaLightHelper;\n\t\t\t\t\t\t__all__.ReinhardToneMapping = ReinhardToneMapping;\n\t\t\t\t\t\t__all__.RepeatWrapping = RepeatWrapping;\n\t\t\t\t\t\t__all__.ReverseSubtractEquation = ReverseSubtractEquation;\n\t\t\t\t\t\t__all__.RingBufferGeometry = RingBufferGeometry;\n\t\t\t\t\t\t__all__.RingGeometry = RingGeometry;\n\t\t\t\t\t\t__all__.Scene = Scene;\n\t\t\t\t\t\t__all__.SceneUtils = SceneUtils;\n\t\t\t\t\t\t__all__.ShaderChunk = ShaderChunk;\n\t\t\t\t\t\t__all__.ShaderLib = ShaderLib;\n\t\t\t\t\t\t__all__.ShaderMaterial = ShaderMaterial;\n\t\t\t\t\t\t__all__.ShadowMaterial = ShadowMaterial;\n\t\t\t\t\t\t__all__.Shape = Shape;\n\t\t\t\t\t\t__all__.ShapeBufferGeometry = ShapeBufferGeometry;\n\t\t\t\t\t\t__all__.ShapeGeometry = ShapeGeometry;\n\t\t\t\t\t\t__all__.ShapePath = ShapePath;\n\t\t\t\t\t\t__all__.ShapeUtils = ShapeUtils;\n\t\t\t\t\t\t__all__.ShortType = ShortType;\n\t\t\t\t\t\t__all__.Skeleton = Skeleton;\n\t\t\t\t\t\t__all__.SkeletonHelper = SkeletonHelper;\n\t\t\t\t\t\t__all__.SkinnedMesh = SkinnedMesh;\n\t\t\t\t\t\t__all__.SmoothShading = SmoothShading;\n\t\t\t\t\t\t__all__.Sphere = Sphere;\n\t\t\t\t\t\t__all__.SphereBufferGeometry = SphereBufferGeometry;\n\t\t\t\t\t\t__all__.SphereGeometry = SphereGeometry;\n\t\t\t\t\t\t__all__.Spherical = Spherical;\n\t\t\t\t\t\t__all__.SphericalReflectionMapping = SphericalReflectionMapping;\n\t\t\t\t\t\t__all__.Spline = Spline;\n\t\t\t\t\t\t__all__.SplineCurve = SplineCurve;\n\t\t\t\t\t\t__all__.SplineCurve3 = SplineCurve3;\n\t\t\t\t\t\t__all__.SpotLight = SpotLight;\n\t\t\t\t\t\t__all__.SpotLightHelper = SpotLightHelper;\n\t\t\t\t\t\t__all__.SpotLightShadow = SpotLightShadow;\n\t\t\t\t\t\t__all__.Sprite = Sprite;\n\t\t\t\t\t\t__all__.SpriteMaterial = SpriteMaterial;\n\t\t\t\t\t\t__all__.SrcAlphaFactor = SrcAlphaFactor;\n\t\t\t\t\t\t__all__.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor;\n\t\t\t\t\t\t__all__.SrcColorFactor = SrcColorFactor;\n\t\t\t\t\t\t__all__.StereoCamera = StereoCamera;\n\t\t\t\t\t\t__all__.StringKeyframeTrack = StringKeyframeTrack;\n\t\t\t\t\t\t__all__.SubtractEquation = SubtractEquation;\n\t\t\t\t\t\t__all__.SubtractiveBlending = SubtractiveBlending;\n\t\t\t\t\t\t__all__.TetrahedronBufferGeometry = TetrahedronBufferGeometry;\n\t\t\t\t\t\t__all__.TetrahedronGeometry = TetrahedronGeometry;\n\t\t\t\t\t\t__all__.TextBufferGeometry = TextBufferGeometry;\n\t\t\t\t\t\t__all__.TextGeometry = TextGeometry;\n\t\t\t\t\t\t__all__.Texture = Texture;\n\t\t\t\t\t\t__all__.TextureLoader = TextureLoader;\n\t\t\t\t\t\t__all__.TorusBufferGeometry = TorusBufferGeometry;\n\t\t\t\t\t\t__all__.TorusGeometry = TorusGeometry;\n\t\t\t\t\t\t__all__.TorusKnotBufferGeometry = TorusKnotBufferGeometry;\n\t\t\t\t\t\t__all__.TorusKnotGeometry = TorusKnotGeometry;\n\t\t\t\t\t\t__all__.Triangle = Triangle;\n\t\t\t\t\t\t__all__.TriangleFanDrawMode = TriangleFanDrawMode;\n\t\t\t\t\t\t__all__.TriangleStripDrawMode = TriangleStripDrawMode;\n\t\t\t\t\t\t__all__.TrianglesDrawMode = TrianglesDrawMode;\n\t\t\t\t\t\t__all__.TubeBufferGeometry = TubeBufferGeometry;\n\t\t\t\t\t\t__all__.TubeGeometry = TubeGeometry;\n\t\t\t\t\t\t__all__.UVMapping = UVMapping;\n\t\t\t\t\t\t__all__.Uint16Attribute = Uint16Attribute;\n\t\t\t\t\t\t__all__.Uint16BufferAttribute = Uint16BufferAttribute;\n\t\t\t\t\t\t__all__.Uint32Attribute = Uint32Attribute;\n\t\t\t\t\t\t__all__.Uint32BufferAttribute = Uint32BufferAttribute;\n\t\t\t\t\t\t__all__.Uint8Attribute = Uint8Attribute;\n\t\t\t\t\t\t__all__.Uint8BufferAttribute = Uint8BufferAttribute;\n\t\t\t\t\t\t__all__.Uint8ClampedAttribute = Uint8ClampedAttribute;\n\t\t\t\t\t\t__all__.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;\n\t\t\t\t\t\t__all__.Uncharted2ToneMapping = Uncharted2ToneMapping;\n\t\t\t\t\t\t__all__.Uniform = Uniform;\n\t\t\t\t\t\t__all__.UniformsLib = UniformsLib;\n\t\t\t\t\t\t__all__.UniformsUtils = UniformsUtils;\n\t\t\t\t\t\t__all__.UnsignedByteType = UnsignedByteType;\n\t\t\t\t\t\t__all__.UnsignedInt248Type = UnsignedInt248Type;\n\t\t\t\t\t\t__all__.UnsignedIntType = UnsignedIntType;\n\t\t\t\t\t\t__all__.UnsignedShort4444Type = UnsignedShort4444Type;\n\t\t\t\t\t\t__all__.UnsignedShort5551Type = UnsignedShort5551Type;\n\t\t\t\t\t\t__all__.UnsignedShort565Type = UnsignedShort565Type;\n\t\t\t\t\t\t__all__.UnsignedShortType = UnsignedShortType;\n\t\t\t\t\t\t__all__.Vector3 = Vector3;\n\t\t\t\t\t\t__all__.VectorKeyframeTrack = VectorKeyframeTrack;\n\t\t\t\t\t\t__all__.Vertex = Vertex;\n\t\t\t\t\t\t__all__.VertexColors = VertexColors;\n\t\t\t\t\t\t__all__.VertexNormalsHelper = VertexNormalsHelper;\n\t\t\t\t\t\t__all__.VideoTexture = VideoTexture;\n\t\t\t\t\t\t__all__.WebGLRenderTarget = WebGLRenderTarget;\n\t\t\t\t\t\t__all__.WebGLRenderTargetCube = WebGLRenderTargetCube;\n\t\t\t\t\t\t__all__.WebGLRenderer = WebGLRenderer;\n\t\t\t\t\t\t__all__.WireframeGeometry = WireframeGeometry;\n\t\t\t\t\t\t__all__.WireframeHelper = WireframeHelper;\n\t\t\t\t\t\t__all__.WrapAroundEnding = WrapAroundEnding;\n\t\t\t\t\t\t__all__.XHRLoader = XHRLoader;\n\t\t\t\t\t\t__all__.ZeroCurvatureEnding = ZeroCurvatureEnding;\n\t\t\t\t\t\t__all__.ZeroFactor = ZeroFactor;\n\t\t\t\t\t\t__all__.ZeroSlopeEnding = ZeroSlopeEnding;\n\t\t\t\t\t\t__all__._ctor = _ctor;\n\t\t\t\t\t\t__all__.api = api;\n\t\t\t\t\t\t__all__.sRGBEncoding = sRGBEncoding;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'random', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar _array = function () {\n\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\tfor (var i = 0; i < 624; i++) {\n\t\t\t\t\t\t\t__accu0__.append (0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t} ();\n\t\t\t\t\tvar _index = 0;\n\t\t\t\t\tvar _bitmask1 = Math.pow (2, 32) - 1;\n\t\t\t\t\tvar _bitmask2 = Math.pow (2, 31);\n\t\t\t\t\tvar _bitmask3 = Math.pow (2, 31) - 1;\n\t\t\t\t\tvar _fill_array = function () {\n\t\t\t\t\t\tfor (var i = 0; i < 624; i++) {\n\t\t\t\t\t\t\tvar y = (_array [i] & _bitmask2) + (_array [__mod__ (i + 1, 624)] & _bitmask3);\n\t\t\t\t\t\t\t_array [i] = _array [__mod__ (i + 397, 624)] ^ y >> 1;\n\t\t\t\t\t\t\tif (__mod__ (y, 2) != 0) {\n\t\t\t\t\t\t\t\t_array [i] ^= 2567483615;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _random_integer = function () {\n\t\t\t\t\t\tif (_index == 0) {\n\t\t\t\t\t\t\t_fill_array ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar y = _array [_index];\n\t\t\t\t\t\ty ^= y >> 11;\n\t\t\t\t\t\ty ^= y << 7 & 2636928640;\n\t\t\t\t\t\ty ^= y << 15 & 4022730752;\n\t\t\t\t\t\ty ^= y >> 18;\n\t\t\t\t\t\t_index = __mod__ (_index + 1, 624);\n\t\t\t\t\t\treturn y;\n\t\t\t\t\t};\n\t\t\t\t\tvar seed = function (x) {\n\t\t\t\t\t\tif (typeof x == 'undefined' || (x != null && x .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar x = int (_bitmask3 * Math.random ());\n\t\t\t\t\t\t};\n\t\t\t\t\t\t_array [0] = x;\n\t\t\t\t\t\tfor (var i = 1; i < 624; i++) {\n\t\t\t\t\t\t\t_array [i] = (1812433253 * _array [i - 1] ^ (_array [i - 1] >> 30) + i) & _bitmask1;\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar randint = function (a, b) {\n\t\t\t\t\t\treturn a + __mod__ (_random_integer (), (b - a) + 1);\n\t\t\t\t\t};\n\t\t\t\t\tvar choice = function (seq) {\n\t\t\t\t\t\treturn seq [randint (0, len (seq) - 1)];\n\t\t\t\t\t};\n\t\t\t\t\tvar random = function () {\n\t\t\t\t\t\treturn _random_integer () / _bitmask3;\n\t\t\t\t\t};\n\t\t\t\t\tseed ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__._array = _array;\n\t\t\t\t\t\t__all__._bitmask1 = _bitmask1;\n\t\t\t\t\t\t__all__._bitmask2 = _bitmask2;\n\t\t\t\t\t\t__all__._bitmask3 = _bitmask3;\n\t\t\t\t\t\t__all__._fill_array = _fill_array;\n\t\t\t\t\t\t__all__._index = _index;\n\t\t\t\t\t\t__all__._random_integer = _random_integer;\n\t\t\t\t\t\t__all__.choice = choice;\n\t\t\t\t\t\t__all__.randint = randint;\n\t\t\t\t\t\t__all__.random = random;\n\t\t\t\t\t\t__all__.seed = seed;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t're', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar translate = __init__ (__world__.re.translate).translate;\n\t\t\t\t\tvar T = 1 << 0;\n\t\t\t\t\tvar TEMPLATE = T;\n\t\t\t\t\tvar I = 1 << 1;\n\t\t\t\t\tvar IGNORECASE = I;\n\t\t\t\t\tvar L = 1 << 2;\n\t\t\t\t\tvar LOCALE = L;\n\t\t\t\t\tvar M = 1 << 3;\n\t\t\t\t\tvar MULTILINE = M;\n\t\t\t\t\tvar S = 1 << 4;\n\t\t\t\t\tvar DOTALL = S;\n\t\t\t\t\tvar U = 1 << 5;\n\t\t\t\t\tvar UNICODE = U;\n\t\t\t\t\tvar X = 1 << 6;\n\t\t\t\t\tvar VERBOSE = X;\n\t\t\t\t\tvar DEBUG = 1 << 7;\n\t\t\t\t\tvar A = 1 << 8;\n\t\t\t\t\tvar ASCII = A;\n\t\t\t\t\tvar Y = 1 << 16;\n\t\t\t\t\tvar STICKY = Y;\n\t\t\t\t\tvar G = 1 << 17;\n\t\t\t\t\tvar GLOBAL = G;\n\t\t\t\t\tvar J = 1 << 19;\n\t\t\t\t\tvar JSSTRICT = J;\n\t\t\t\t\tvar error = __class__ ('error', [Exception], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, msg, error, pattern, flags, pos) {\n\t\t\t\t\t\t\tif (typeof pattern == 'undefined' || (pattern != null && pattern .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pattern = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tException.__init__ (self, msg, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\tself.pattern = pattern;\n\t\t\t\t\t\t\tself.flags = flags;\n\t\t\t\t\t\t\tself.pos = pos;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ReIndexError = __class__ ('ReIndexError', [IndexError], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tIndexError.__init__ (self, 'no such group');\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Match = __class__ ('Match', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, mObj, string, pos, endpos, rObj, namedGroups) {\n\t\t\t\t\t\t\tif (typeof namedGroups == 'undefined' || (namedGroups != null && namedGroups .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar namedGroups = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (var [index, match] of enumerate (mObj)) {\n\t\t\t\t\t\t\t\tmObj [index] = (mObj [index] == undefined ? null : mObj [index]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself._obj = mObj;\n\t\t\t\t\t\t\tself._pos = pos;\n\t\t\t\t\t\t\tself._endpos = endpos;\n\t\t\t\t\t\t\tself._re = rObj;\n\t\t\t\t\t\t\tself._string = string;\n\t\t\t\t\t\t\tself._namedGroups = namedGroups;\n\t\t\t\t\t\t\tself._lastindex = self._lastMatchGroup ();\n\t\t\t\t\t\t\tif (self._namedGroups !== null) {\n\t\t\t\t\t\t\t\tself._lastgroup = self._namedGroups [self._lastindex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tself._lastgroup = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getPos () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._pos;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setPos () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getEndPos () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._endpos;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setEndPos () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getRe () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._re;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setRe () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getString () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._string;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setString () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getLastGroup () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._lastgroup;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setLastGroup () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getLastIndex () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._lastindex;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setLastIndex () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _lastMatchGroup () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self._obj) > 1) {\n\t\t\t\t\t\t\t\tfor (var i = len (self._obj) - 1; i > 0; i--) {\n\t\t\t\t\t\t\t\t\tif (self._obj [i] !== null) {\n\t\t\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget expand () {return __get__ (this, function (self, template) {\n\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ();\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget group () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1));\n\t\t\t\t\t\t\tvar ret = list ([]);\n\t\t\t\t\t\t\tif (len (args) > 0) {\n\t\t\t\t\t\t\t\tfor (var index of args) {\n\t\t\t\t\t\t\t\t\tif (py_typeof (index) === str) {\n\t\t\t\t\t\t\t\t\t\tif (self._namedGroups !== null) {\n\t\t\t\t\t\t\t\t\t\t\tif (!__in__ (index, self._namedGroups.py_keys ())) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tret.append (self._obj [self._namedGroups [index]]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No NamedGroups Available');\n\t\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif (index >= len (self._obj)) {\n\t\t\t\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tret.append (self._obj [index]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tret.append (self._obj [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (len (ret) == 1) {\n\t\t\t\t\t\t\t\treturn ret [0];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn tuple (ret);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget groups () {return __get__ (this, function (self, py_default) {\n\t\t\t\t\t\t\tif (typeof py_default == 'undefined' || (py_default != null && py_default .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar py_default = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (len (self._obj) > 1) {\n\t\t\t\t\t\t\t\tvar ret = self._obj.__getslice__ (1, null, 1);\n\t\t\t\t\t\t\t\treturn tuple (function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tfor (var x of ret) {\n\t\t\t\t\t\t\t\t\t\t__accu0__.append ((x !== null ? x : py_default));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t} ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget groupdict () {return __get__ (this, function (self, py_default) {\n\t\t\t\t\t\t\tif (typeof py_default == 'undefined' || (py_default != null && py_default .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar py_default = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (self._namedGroups !== null) {\n\t\t\t\t\t\t\t\tvar ret = dict ({});\n\t\t\t\t\t\t\t\tfor (var [gName, gId] of self._namedGroups.py_items ()) {\n\t\t\t\t\t\t\t\t\tvar value = self._obj [gid];\n\t\t\t\t\t\t\t\t\tret [gName] = (value !== null ? value : py_default);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No NamedGroups Available');\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget start () {return __get__ (this, function (self, group) {\n\t\t\t\t\t\t\tif (typeof group == 'undefined' || (group != null && group .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar group = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar gId = 0;\n\t\t\t\t\t\t\tif (py_typeof (group) === str) {\n\t\t\t\t\t\t\t\tif (self._namedGroups !== null) {\n\t\t\t\t\t\t\t\t\tif (!__in__ (group, self._namedGroups.py_keys ())) {\n\t\t\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvar gId = self._namedGroups [group];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No NamedGroups Available');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar gId = group;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (gId >= len (self._obj)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (gId == 0) {\n\t\t\t\t\t\t\t\treturn self._obj.index;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (self._obj [gId] !== null) {\n\t\t\t\t\t\t\t\tvar r = compile (escape (self._obj [gId]), self._re.flags);\n\t\t\t\t\t\t\t\tvar m = r.search (self._obj [0]);\n\t\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\t\treturn self._obj.index + m.start ();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __except0__ = Exception ('Failed to find capture group');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn -(1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget end () {return __get__ (this, function (self, group) {\n\t\t\t\t\t\t\tif (typeof group == 'undefined' || (group != null && group .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar group = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar gId = 0;\n\t\t\t\t\t\t\tif (py_typeof (group) === str) {\n\t\t\t\t\t\t\t\tif (self._namedGroups !== null) {\n\t\t\t\t\t\t\t\t\tif (!__in__ (group, self._namedGroups.py_keys ())) {\n\t\t\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvar gId = self._namedGroups [group];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('No NamedGroups Available');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar gId = group;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (gId >= len (self._obj)) {\n\t\t\t\t\t\t\t\tvar __except0__ = ReIndexError ();\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (gId == 0) {\n\t\t\t\t\t\t\t\treturn self._obj.index + len (self._obj [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (self._obj [gId] !== null) {\n\t\t\t\t\t\t\t\tvar r = compile (escape (self._obj [gId]), self._re.flags);\n\t\t\t\t\t\t\t\tvar m = r.search (self._obj [0]);\n\t\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\t\treturn self._obj.index + m.end ();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __except0__ = Exception ('Failed to find capture group');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn -(1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget span () {return __get__ (this, function (self, group) {\n\t\t\t\t\t\t\tif (typeof group == 'undefined' || (group != null && group .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar group = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn tuple ([self.start (group), self.end (group)]);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Match, 'pos', property.call (Match, Match._getPos, Match._setPos));;\n\t\t\t\t\tObject.defineProperty (Match, 'endpos', property.call (Match, Match._getEndPos, Match._setEndPos));;\n\t\t\t\t\tObject.defineProperty (Match, 're', property.call (Match, Match._getRe, Match._setRe));;\n\t\t\t\t\tObject.defineProperty (Match, 'string', property.call (Match, Match._getString, Match._setString));;\n\t\t\t\t\tObject.defineProperty (Match, 'lastgroup', property.call (Match, Match._getLastGroup, Match._setLastGroup));;\n\t\t\t\t\tObject.defineProperty (Match, 'lastindex', property.call (Match, Match._getLastIndex, Match._setLastIndex));;\n\t\t\t\t\tvar Regex = __class__ ('Regex', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, pattern, flags) {\n\t\t\t\t\t\t\tif (!((flags & ASCII) > 0)) {\n\t\t\t\t\t\t\t\tflags |= UNICODE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself._flags = flags;\n\t\t\t\t\t\t\tvar __left0__ = self._compileWrapper (pattern, flags);\n\t\t\t\t\t\t\tself._jsFlags = __left0__ [0];\n\t\t\t\t\t\t\tself._obj = __left0__ [1];\n\t\t\t\t\t\t\tself._jspattern = pattern;\n\t\t\t\t\t\t\tself._pypattern = pattern;\n\t\t\t\t\t\t\tvar __left0__ = self._compileWrapper (pattern + '|', flags);\n\t\t\t\t\t\t\tvar _ = __left0__ [0];\n\t\t\t\t\t\t\tvar groupCounterRegex = __left0__ [1];\n\t\t\t\t\t\t\tself._groups = groupCounterRegex.exec ('').length - 1;\n\t\t\t\t\t\t\tself._groupindex = null;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getPattern () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar ret = self._pypattern.py_replace ('\\\\', '\\\\\\\\');\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setPattern () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getFlags () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._flags;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setFlags () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getGroups () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._groups;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setGroups () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getGroupIndex () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (self._groupindex === null) {\n\t\t\t\t\t\t\t\treturn dict ({});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn self._groupindex;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _setGroupIndex () {return __get__ (this, function (self, val) {\n\t\t\t\t\t\t\tvar __except0__ = AttributeError ('readonly attribute');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _compileWrapper () {return __get__ (this, function (self, pattern, flags) {\n\t\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar jsFlags = self._convertFlags (flags);\n\t\t\t\t\t\t\tvar rObj = null;\n\t\t\t\t\t\t\tvar errObj = null;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t try {\n\t\t\t\t\t\t\t rObj = new RegExp(pattern, jsFlags)\n\t\t\t\t\t\t\t } catch( err ) {\n\t\t\t\t\t\t\t errObj = err\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\tif (errObj !== null) {\n\t\t\t\t\t\t\t\tvar __except0__ = error (errObj.message, errObj, pattern, flags);\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tuple ([jsFlags, rObj]);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _convertFlags () {return __get__ (this, function (self, flags) {\n\t\t\t\t\t\t\tvar bitmaps = list ([tuple ([DEBUG, '']), tuple ([IGNORECASE, 'i']), tuple ([MULTILINE, 'm']), tuple ([STICKY, 'y']), tuple ([GLOBAL, 'g']), tuple ([UNICODE, 'u'])]);\n\t\t\t\t\t\t\tvar ret = ''.join (function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tfor (var x of bitmaps) {\n\t\t\t\t\t\t\t\t\tif ((x [0] & flags) > 0) {\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (x [1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t} ());\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _getTargetStr () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tvar endPtr = len (string);\n\t\t\t\t\t\t\tif (endpos !== null) {\n\t\t\t\t\t\t\t\tif (endpos < endPtr) {\n\t\t\t\t\t\t\t\t\tvar endPtr = endpos;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (endPtr < 0) {\n\t\t\t\t\t\t\t\tvar endPtr = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar ret = string.__getslice__ (pos, endPtr, 1);\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _patternHasCaptures () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self._groups > 0;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget search () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (endpos === null) {\n\t\t\t\t\t\t\t\tvar endpos = len (string);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar rObj = self._obj;\n\t\t\t\t\t\t\tvar m = rObj.exec (string);\n\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\tif (m.index < pos || m.index > endpos) {\n\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn Match (m, string, pos, endpos, self, self._groupindex);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget match () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar target = string;\n\t\t\t\t\t\t\tif (endpos !== null) {\n\t\t\t\t\t\t\t\tvar target = target.__getslice__ (0, endpos, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar endpos = len (string);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar rObj = self._obj;\n\t\t\t\t\t\t\tvar m = rObj.exec (target);\n\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\tif (m.index == pos) {\n\t\t\t\t\t\t\t\t\treturn Match (m, string, pos, endpos, self, self._groupindex);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget fullmatch () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar target = string;\n\t\t\t\t\t\t\tvar strEndPos = len (string);\n\t\t\t\t\t\t\tif (endpos !== null) {\n\t\t\t\t\t\t\t\tvar target = target.__getslice__ (0, endpos, 1);\n\t\t\t\t\t\t\t\tvar strEndPos = endpos;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar rObj = self._obj;\n\t\t\t\t\t\t\tvar m = rObj.exec (target);\n\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\tvar obsEndPos = m.index + len (m [0]);\n\t\t\t\t\t\t\t\tif (m.index == pos && obsEndPos == strEndPos) {\n\t\t\t\t\t\t\t\t\treturn Match (m, string, pos, strEndPos, self, self._groupindex);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_split () {return __get__ (this, function (self, string, maxsplit) {\n\t\t\t\t\t\t\tif (typeof maxsplit == 'undefined' || (maxsplit != null && maxsplit .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar maxsplit = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (maxsplit < 0) {\n\t\t\t\t\t\t\t\treturn list ([string]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar mObj = null;\n\t\t\t\t\t\t\tvar rObj = self._obj;\n\t\t\t\t\t\t\tif (maxsplit == 0) {\n\t\t\t\t\t\t\t\tvar mObj = string.py_split (rObj);\n\t\t\t\t\t\t\t\treturn mObj;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar flags = self._flags;\n\t\t\t\t\t\t\t\tflags |= GLOBAL;\n\t\t\t\t\t\t\t\tvar __left0__ = self._compileWrapper (self._jspattern, flags);\n\t\t\t\t\t\t\t\tvar _ = __left0__ [0];\n\t\t\t\t\t\t\t\tvar rObj = __left0__ [1];\n\t\t\t\t\t\t\t\tvar ret = list ([]);\n\t\t\t\t\t\t\t\tvar lastM = null;\n\t\t\t\t\t\t\t\tvar cnt = 0;\n\t\t\t\t\t\t\t\tfor (var i = 0; i < maxsplit; i++) {\n\t\t\t\t\t\t\t\t\tvar m = rObj.exec (string);\n\t\t\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t\t\t\t\tif (lastM !== null) {\n\t\t\t\t\t\t\t\t\t\t\tvar start = lastM.index + len (lastM [0]);\n\t\t\t\t\t\t\t\t\t\t\tvar head = string.__getslice__ (start, m.index, 1);\n\t\t\t\t\t\t\t\t\t\t\tret.append (head);\n\t\t\t\t\t\t\t\t\t\t\tif (len (m) > 1) {\n\t\t\t\t\t\t\t\t\t\t\t\tret.extend (m.__getslice__ (1, null, 1));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tvar head = string.__getslice__ (0, m.index, 1);\n\t\t\t\t\t\t\t\t\t\t\tret.append (head);\n\t\t\t\t\t\t\t\t\t\t\tif (len (m) > 1) {\n\t\t\t\t\t\t\t\t\t\t\t\tret.extend (m.__getslice__ (1, null, 1));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tvar lastM = m;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (lastM !== null) {\n\t\t\t\t\t\t\t\t\tvar endPos = lastM.index + len (lastM [0]);\n\t\t\t\t\t\t\t\t\tvar end = string.__getslice__ (endPos, null, 1);\n\t\t\t\t\t\t\t\t\tret.append (end);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget _findAllMatches () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar target = self._getTargetStr (string, pos, endpos);\n\t\t\t\t\t\t\tvar flags = self._flags;\n\t\t\t\t\t\t\tflags |= GLOBAL;\n\t\t\t\t\t\t\tvar __left0__ = self._compileWrapper (self._jspattern, flags);\n\t\t\t\t\t\t\tvar _ = __left0__ [0];\n\t\t\t\t\t\t\tvar rObj = __left0__ [1];\n\t\t\t\t\t\t\tvar ret = list ([]);\n\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\tvar m = rObj.exec (target);\n\t\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\t\tret.append (m);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget findall () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof pos == 'undefined' || (pos != null && pos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pos = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar mlist = self._findAllMatches (string, pos, endpos);\n\t\t\t\t\t\t\tvar mSelect = function (m) {\n\t\t\t\t\t\t\t\tif (len (m) > 2) {\n\t\t\t\t\t\t\t\t\treturn tuple (m.__getslice__ (1, null, 1));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (len (m) == 2) {\n\t\t\t\t\t\t\t\t\treturn m [1];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn m [0];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar ret = map (mSelect, mlist);\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget finditer () {return __get__ (this, function (self, string, pos, endpos) {\n\t\t\t\t\t\t\tif (typeof endpos == 'undefined' || (endpos != null && endpos .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar endpos = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar mlist = self._findAllMatches (string, pos, endpos);\n\t\t\t\t\t\t\tvar ret = map ((function __lambda__ (m) {\n\t\t\t\t\t\t\t\treturn Match (m, string, 0, len (string), self, self._groupindex);\n\t\t\t\t\t\t\t}), mlist);\n\t\t\t\t\t\t\treturn py_iter (ret);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget sub () {return __get__ (this, function (self, repl, string, count) {\n\t\t\t\t\t\t\tif (typeof count == 'undefined' || (count != null && count .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __left0__ = self.subn (repl, string, count);\n\t\t\t\t\t\t\tvar ret = __left0__ [0];\n\t\t\t\t\t\t\tvar _ = __left0__ [1];\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget subn () {return __get__ (this, function (self, repl, string, count) {\n\t\t\t\t\t\t\tif (typeof count == 'undefined' || (count != null && count .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar flags = self._flags;\n\t\t\t\t\t\t\tflags |= GLOBAL;\n\t\t\t\t\t\t\tvar __left0__ = self._compileWrapper (self._jspattern, flags);\n\t\t\t\t\t\t\tvar _ = __left0__ [0];\n\t\t\t\t\t\t\tvar rObj = __left0__ [1];\n\t\t\t\t\t\t\tvar ret = '';\n\t\t\t\t\t\t\tvar totalMatch = 0;\n\t\t\t\t\t\t\tvar lastEnd = -(1);\n\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\tif (count > 0) {\n\t\t\t\t\t\t\t\t\tif (totalMatch >= count) {\n\t\t\t\t\t\t\t\t\t\tif (lastEnd < 0) {\n\t\t\t\t\t\t\t\t\t\t\treturn tuple ([ret, totalMatch]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tret += string.__getslice__ (lastEnd, m.index, 1);\n\t\t\t\t\t\t\t\t\t\t\treturn tuple ([ret, totalMatch]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar m = rObj.exec (string);\n\t\t\t\t\t\t\t\tif (m) {\n\t\t\t\t\t\t\t\t\tif (lastEnd < 0) {\n\t\t\t\t\t\t\t\t\t\tret += string.__getslice__ (0, m.index, 1);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tret += string.__getslice__ (lastEnd, m.index, 1);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (callable (repl)) {\n\t\t\t\t\t\t\t\t\t\tvar content = repl (Match (m, string, 0, len (string), self, self._groupindex));\n\t\t\t\t\t\t\t\t\t\tret += content;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tret += repl;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttotalMatch++;\n\t\t\t\t\t\t\t\t\tvar lastEnd = m.index + len (m [0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (lastEnd < 0) {\n\t\t\t\t\t\t\t\t\treturn tuple ([string, 0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tret += string.__getslice__ (lastEnd, null, 1);\n\t\t\t\t\t\t\t\t\treturn tuple ([ret, totalMatch]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Regex, 'pattern', property.call (Regex, Regex._getPattern, Regex._setPattern));;\n\t\t\t\t\tObject.defineProperty (Regex, 'flags', property.call (Regex, Regex._getFlags, Regex._setFlags));;\n\t\t\t\t\tObject.defineProperty (Regex, 'groups', property.call (Regex, Regex._getGroups, Regex._setGroups));;\n\t\t\t\t\tObject.defineProperty (Regex, 'groupindex', property.call (Regex, Regex._getGroupIndex, Regex._setGroupIndex));;\n\t\t\t\t\tvar PyRegExp = __class__ ('PyRegExp', [Regex], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, pyPattern, flags) {\n\t\t\t\t\t\t\tvar __left0__ = translate (pyPattern);\n\t\t\t\t\t\t\tvar jsTokens = __left0__ [0];\n\t\t\t\t\t\t\tvar inlineFlags = __left0__ [1];\n\t\t\t\t\t\t\tvar namedGroups = __left0__ [2];\n\t\t\t\t\t\t\tvar nCapGroups = __left0__ [3];\n\t\t\t\t\t\t\tvar n_splits = __left0__ [4];\n\t\t\t\t\t\t\tflags |= inlineFlags;\n\t\t\t\t\t\t\tvar jsPattern = ''.join (jsTokens);\n\t\t\t\t\t\t\tRegex.__init__ (self, jsPattern, flags);\n\t\t\t\t\t\t\tself._pypattern = pyPattern;\n\t\t\t\t\t\t\tself._nsplits = n_splits;\n\t\t\t\t\t\t\tself._jsTokens = jsTokens;\n\t\t\t\t\t\t\tself._capgroups = nCapGroups;\n\t\t\t\t\t\t\tself._groupindex = namedGroups;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar compile = function (pattern, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (flags & JSSTRICT) {\n\t\t\t\t\t\t\tvar p = Regex (pattern, flags);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar p = PyRegExp (pattern, flags);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn p;\n\t\t\t\t\t};\n\t\t\t\t\tvar search = function (pattern, string, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.search (string);\n\t\t\t\t\t};\n\t\t\t\t\tvar match = function (pattern, string, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.match (string);\n\t\t\t\t\t};\n\t\t\t\t\tvar fullmatch = function (pattern, string, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.fullmatch (string);\n\t\t\t\t\t};\n\t\t\t\t\tvar py_split = function (pattern, string, maxsplit, flags) {\n\t\t\t\t\t\tif (typeof maxsplit == 'undefined' || (maxsplit != null && maxsplit .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar maxsplit = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.py_split (string, maxsplit);\n\t\t\t\t\t};\n\t\t\t\t\tvar findall = function (pattern, string, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.findall (string);\n\t\t\t\t\t};\n\t\t\t\t\tvar finditer = function (pattern, string, flags) {\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.finditer (string);\n\t\t\t\t\t};\n\t\t\t\t\tvar sub = function (pattern, repl, string, count, flags) {\n\t\t\t\t\t\tif (typeof count == 'undefined' || (count != null && count .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.sub (repl, string, count);\n\t\t\t\t\t};\n\t\t\t\t\tvar subn = function (pattern, repl, string, count, flags) {\n\t\t\t\t\t\tif (typeof count == 'undefined' || (count != null && count .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof flags == 'undefined' || (flags != null && flags .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar p = compile (pattern, flags);\n\t\t\t\t\t\treturn p.subn (repl, string, count);\n\t\t\t\t\t};\n\t\t\t\t\tvar escape = function (string) {\n\t\t\t\t\t\tvar ret = null;\n\t\t\t\t\t\tvar replfunc = function (m) {\n\t\t\t\t\t\t\tif (m [0] == '\\\\') {\n\t\t\t\t\t\t\t\treturn '\\\\\\\\\\\\\\\\';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '\\\\\\\\' + m [0];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\t var r = /[^A-Za-z\\d]/g;\n\t\t\t\t\t\t ret = string.replace(r, replfunc);\n\t\t\t\t\t\t \n\t\t\t\t\t\tif (ret !== null) {\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __except0__ = Exception ('Failed to escape the passed string');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar purge = function () {\n\t\t\t\t\t\t// pass;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t're.translate' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.A = A;\n\t\t\t\t\t\t__all__.ASCII = ASCII;\n\t\t\t\t\t\t__all__.DEBUG = DEBUG;\n\t\t\t\t\t\t__all__.DOTALL = DOTALL;\n\t\t\t\t\t\t__all__.G = G;\n\t\t\t\t\t\t__all__.GLOBAL = GLOBAL;\n\t\t\t\t\t\t__all__.I = I;\n\t\t\t\t\t\t__all__.IGNORECASE = IGNORECASE;\n\t\t\t\t\t\t__all__.J = J;\n\t\t\t\t\t\t__all__.JSSTRICT = JSSTRICT;\n\t\t\t\t\t\t__all__.L = L;\n\t\t\t\t\t\t__all__.LOCALE = LOCALE;\n\t\t\t\t\t\t__all__.M = M;\n\t\t\t\t\t\t__all__.MULTILINE = MULTILINE;\n\t\t\t\t\t\t__all__.Match = Match;\n\t\t\t\t\t\t__all__.PyRegExp = PyRegExp;\n\t\t\t\t\t\t__all__.ReIndexError = ReIndexError;\n\t\t\t\t\t\t__all__.Regex = Regex;\n\t\t\t\t\t\t__all__.S = S;\n\t\t\t\t\t\t__all__.STICKY = STICKY;\n\t\t\t\t\t\t__all__.T = T;\n\t\t\t\t\t\t__all__.TEMPLATE = TEMPLATE;\n\t\t\t\t\t\t__all__.U = U;\n\t\t\t\t\t\t__all__.UNICODE = UNICODE;\n\t\t\t\t\t\t__all__.VERBOSE = VERBOSE;\n\t\t\t\t\t\t__all__.X = X;\n\t\t\t\t\t\t__all__.Y = Y;\n\t\t\t\t\t\t__all__.compile = compile;\n\t\t\t\t\t\t__all__.error = error;\n\t\t\t\t\t\t__all__.escape = escape;\n\t\t\t\t\t\t__all__.findall = findall;\n\t\t\t\t\t\t__all__.finditer = finditer;\n\t\t\t\t\t\t__all__.fullmatch = fullmatch;\n\t\t\t\t\t\t__all__.match = match;\n\t\t\t\t\t\t__all__.purge = purge;\n\t\t\t\t\t\t__all__.search = search;\n\t\t\t\t\t\t__all__.py_split = py_split;\n\t\t\t\t\t\t__all__.sub = sub;\n\t\t\t\t\t\t__all__.subn = subn;\n\t\t\t\t\t\t__all__.translate = translate;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t're.translate', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar re = {};\n\t\t\t\t\tvar VERBOSE = false;\n\t\t\t\t\tvar MAX_SHIFTREDUCE_LOOPS = 1000;\n\t\t\t\t\tvar stringFlags = 'aiLmsux';\n\t\t\t\t\tvar Group = __class__ ('Group', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, start, end, klass) {\n\t\t\t\t\t\t\tself.start = start;\n\t\t\t\t\t\t\tself.end = end;\n\t\t\t\t\t\t\tself.klass = klass;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn str (tuple ([self.start, self.end, self.klass]));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar generateGroupSpans = function (tokens) {\n\t\t\t\t\t\tvar groupInfo = list ([]);\n\t\t\t\t\t\tvar idx = 0;\n\t\t\t\t\t\tfor (var token of tokens) {\n\t\t\t\t\t\t\tif (__t__ (token.py_name.startswith ('('))) {\n\t\t\t\t\t\t\t\tgroupInfo.append (Group (idx, null, token.py_name));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__t__ (token.py_name == ')')) {\n\t\t\t\t\t\t\t\tfor (var group of py_reversed (groupInfo)) {\n\t\t\t\t\t\t\t\t\tif (__t__ (group.end === null)) {\n\t\t\t\t\t\t\t\t\t\tgroup.end = idx;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tidx++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn groupInfo;\n\t\t\t\t\t};\n\t\t\t\t\tvar countCaptureGroups = function (tokens) {\n\t\t\t\t\t\tvar groupInfo = generateGroupSpans (tokens);\n\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\tfor (var token of tokens) {\n\t\t\t\t\t\t\tif (__t__ (token.py_name == '(')) {\n\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn count;\n\t\t\t\t\t};\n\t\t\t\t\tvar getCaptureGroup = function (groupInfo, namedGroups, groupRef) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar id = int (groupRef);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\tvar id = namedGroups [groupRef];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar search = 0;\n\t\t\t\t\t\tfor (var group of groupInfo) {\n\t\t\t\t\t\t\tif (__t__ (group.klass == '(')) {\n\t\t\t\t\t\t\t\tsearch++;\n\t\t\t\t\t\t\t\tif (__t__ (search == id)) {\n\t\t\t\t\t\t\t\t\treturn group;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar splitIfElse = function (tokens, namedGroups) {\n\t\t\t\t\t\tvar variants = list ([]);\n\t\t\t\t\t\tvar groupInfo = generateGroupSpans (tokens);\n\t\t\t\t\t\tfor (var group of groupInfo) {\n\t\t\t\t\t\t\tif (__t__ (group.klass == '(?<')) {\n\t\t\t\t\t\t\t\tvar iff = tokens.__getslice__ (0, null, 1);\n\t\t\t\t\t\t\t\tvar els = tokens.__getslice__ (0, null, 1);\n\t\t\t\t\t\t\t\tvar conStart = group.start;\n\t\t\t\t\t\t\t\tvar conEnd = group.end;\n\t\t\t\t\t\t\t\tvar ref = tokens [conStart + 1].py_name;\n\t\t\t\t\t\t\t\tvar captureGroup = getCaptureGroup (groupInfo, namedGroups, ref);\n\t\t\t\t\t\t\t\tvar captureGroupModifier = tokens [captureGroup.end + 1];\n\t\t\t\t\t\t\t\tif (__t__ (__t__ (__in__ (captureGroupModifier.py_name, list (['?', '*']))) || captureGroupModifier.py_name.startswith ('{0,'))) {\n\t\t\t\t\t\t\t\t\tif (__t__ (captureGroupModifier.py_name == '?')) {\n\t\t\t\t\t\t\t\t\t\tiff [captureGroup.end + 1] = null;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (__t__ (captureGroupModifier.py_name == '*')) {\n\t\t\t\t\t\t\t\t\t\tiff [captureGroup.end + 1] = Token ('+');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (__t__ (captureGroupModifier.py_name.startswith ('{0,'))) {\n\t\t\t\t\t\t\t\t\t\tiff [captureGroup.end + 1].py_name.__setslice__ (0, 3, null, '{1,');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tels [captureGroup.end + 1] = null;\n\t\t\t\t\t\t\t\t\tvar hasElse = false;\n\t\t\t\t\t\t\t\t\tfor (var idx = conStart; idx < conEnd; idx++) {\n\t\t\t\t\t\t\t\t\t\tif (__t__ (tokens [idx].py_name == '|')) {\n\t\t\t\t\t\t\t\t\t\t\tvar hasElse = true;\n\t\t\t\t\t\t\t\t\t\t\tels.py_pop (conEnd);\n\t\t\t\t\t\t\t\t\t\t\tiff.__setslice__ (idx, conEnd + 1, null, list ([]));\n\t\t\t\t\t\t\t\t\t\t\tels.__setslice__ (conStart, idx + 1, null, list ([]));\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (__t__ (!__t__ ((hasElse)))) {\n\t\t\t\t\t\t\t\t\t\tels.__setslice__ (conStart, conEnd + 1, null, list ([]));\n\t\t\t\t\t\t\t\t\t\tiff.py_pop (conEnd);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tiff.__setslice__ (conStart, conStart + 3, null, list ([]));\n\t\t\t\t\t\t\t\t\tels.__setslice__ (captureGroup.start, captureGroup.end + 1, null, list ([Token ('('), Token (')')]));\n\t\t\t\t\t\t\t\t\tiff.remove (null);\n\t\t\t\t\t\t\t\t\tels.remove (null);\n\t\t\t\t\t\t\t\t\tvariants.append (iff);\n\t\t\t\t\t\t\t\t\tvariants.append (els);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar pastIff = false;\n\t\t\t\t\t\t\t\t\tfor (var idx = conStart; idx < conEnd; idx++) {\n\t\t\t\t\t\t\t\t\t\tif (__t__ (iff [idx].py_name == '|')) {\n\t\t\t\t\t\t\t\t\t\t\tvar iff = tokens.__getslice__ (0, idx, 1);\n\t\t\t\t\t\t\t\t\t\t\tiff.extend (tokens.__getslice__ (conEnd + 1, null, 1));\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tiff.__setslice__ (conStart, conStart + 3, null, list ([]));\n\t\t\t\t\t\t\t\t\tvariants.append (iff);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__t__ (!__t__ ((variants)))) {\n\t\t\t\t\t\t\treturn list ([tokens]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar allVariants = list ([]);\n\t\t\t\t\t\tfor (var variant of variants) {\n\t\t\t\t\t\t\tallVariants.extend (splitIfElse (variant, namedGroups));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn allVariants;\n\t\t\t\t\t};\n\t\t\t\t\tvar Token = __class__ ('Token', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, py_name, paras, pure) {\n\t\t\t\t\t\t\tif (typeof paras == 'undefined' || (paras != null && paras .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar paras = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof pure == 'undefined' || (pure != null && pure .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar pure = false;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (__t__ (paras === null)) {\n\t\t\t\t\t\t\t\tvar paras = list ([]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.py_name = py_name;\n\t\t\t\t\t\t\tself.paras = paras;\n\t\t\t\t\t\t\tself.pure = pure;\n\t\t\t\t\t\t\tself.isModeGroup = false;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.py_name;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget resolve () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar paras = '';\n\t\t\t\t\t\t\tfor (var para of self.paras) {\n\t\t\t\t\t\t\t\tparas += str (para);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn self.py_name + paras;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar shift = function (stack, queue) {\n\t\t\t\t\t\tvar done = !__t__ ((bool (queue)));\n\t\t\t\t\t\tif (__t__ (!__t__ ((done)))) {\n\t\t\t\t\t\t\tstack.append (Token (queue [0], list ([]), true));\n\t\t\t\t\t\t\tvar queue = queue.__getslice__ (1, null, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tuple ([stack, queue, done]);\n\t\t\t\t\t};\n\t\t\t\t\tvar shiftReduce = function (stack, queue, namedGroups, flags) {\n\t\t\t\t\t\tvar done = false;\n\t\t\t\t\t\tvar high = len (stack) - 1;\n\t\t\t\t\t\tif (__t__ (len (stack) < 2)) {\n\t\t\t\t\t\t\tvar __left0__ = shift (stack, queue);\n\t\t\t\t\t\t\tvar stack = __left0__ [0];\n\t\t\t\t\t\t\tvar queue = __left0__ [1];\n\t\t\t\t\t\t\tvar done = __left0__ [2];\n\t\t\t\t\t\t\treturn tuple ([stack, queue, flags, done]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar s0 = (__t__ (len (stack) > 0) ? stack [high] : Token (''));\n\t\t\t\t\t\tvar s1 = (__t__ (len (stack) > 1) ? stack [high - 1] : Token (''));\n\t\t\t\t\t\tif (__t__ (VERBOSE)) {\n\t\t\t\t\t\t\tfor (var token of stack) {\n\t\t\t\t\t\t\t\tconsole.log (token.resolve (), '\\t', __kwargtrans__ ({end: ''}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconsole.log ('');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__t__ (s1.py_name == '\\\\')) {\n\t\t\t\t\t\t\tif (__t__ (s0.py_name == 'A')) {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('^')]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'a')) {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('\\\\07')]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'Z')) {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('$')]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('\\\\' + s0.py_name)]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (__t__ (s0.py_name == '$') && s0.pure)) {\n\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\tstack.extend (list ([Token ('(?='), Token ('\\\\n'), Token ('?'), Token ('$'), Token (')')]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '{')) {\n\t\t\t\t\t\t\tif (__t__ (__t__ (s0.py_name == ',') && len (s1.paras) == 0)) {\n\t\t\t\t\t\t\t\ts1.paras.append ('0');\n\t\t\t\t\t\t\t\ts1.paras.append (',');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__t__ (s0.py_name == '}')) {\n\t\t\t\t\t\t\t\ts1.paras.append ('}');\n\t\t\t\t\t\t\t\ts1.py_name = s1.resolve ();\n\t\t\t\t\t\t\t\ts1.paras = list ([]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ts1.paras.append (s0.py_name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar stack = stack.__getslice__ (0, -__t__ ((1)), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (__t__ (s1.py_name == '[') && s0.py_name == '^')) {\n\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('[^')]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (__t__ (s1.py_name == '(') && s0.py_name == '?')) {\n\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('(?')]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (__t__ (__in__ (s1.py_name, list (['*', '+', '?']))) && s0.py_name == '?')) {\n\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token (s1.py_name + '?')]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (__t__ (s1.isModeGroup) && s0.py_name == ')')) {\n\t\t\t\t\t\t\tvar stack = stack.__getslice__ (0, -__t__ ((2)), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?')) {\n\t\t\t\t\t\t\tif (__t__ (__in__ (s0.py_name, stringFlags))) {\n\t\t\t\t\t\t\t\tif (__t__ (s0.py_name == 'i')) {\n\t\t\t\t\t\t\t\t\tflags |= re.IGNORECASE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'L')) {\n\t\t\t\t\t\t\t\t\tflags |= re.LOCALE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'm')) {\n\t\t\t\t\t\t\t\t\tflags |= re.MULTILINE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 's')) {\n\t\t\t\t\t\t\t\t\tflags |= re.DOTALL;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'u')) {\n\t\t\t\t\t\t\t\t\tflags |= re.UNICODE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'x')) {\n\t\t\t\t\t\t\t\t\tflags |= re.VERBOSE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (__t__ (s0.py_name == 'a')) {\n\t\t\t\t\t\t\t\t\tflags |= re.ASCII;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\t\ts1.isModeGroup = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif (__t__ (s0.py_name == '(')) {\n\t\t\t\t\t\t\t\t\ts0.py_name = '<';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar newToken = Token ('(?' + s0.py_name);\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([newToken]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?<')) {\n\t\t\t\t\t\t\tif (__t__ (s0.py_name == ')')) {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((1)), null, null, list ([Token (''.join (s1.paras)), Token ('>')]));\n\t\t\t\t\t\t\t\ts1.paras = list ([]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ts1.paras.append (s0.py_name);\n\t\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?P')) {\n\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('(?P' + s0.py_name)]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?P<')) {\n\t\t\t\t\t\t\tif (__t__ (s0.py_name == '>')) {\n\t\t\t\t\t\t\t\tnamedGroups [''.join (s1.paras)] = countCaptureGroups (stack) + 1;\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('(')]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ts1.paras.append (s0.py_name);\n\t\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?P=')) {\n\t\t\t\t\t\t\tif (__t__ (s0.py_name == ')')) {\n\t\t\t\t\t\t\t\tstack.__setslice__ (-__t__ ((2)), null, null, list ([Token ('\\\\' + str (namedGroups [s1.paras [0]]))]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (__t__ (!__t__ ((s1.paras)))) {\n\t\t\t\t\t\t\t\ts1.paras.append (s0.py_name);\n\t\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ts1.paras [0] += s0.py_name;\n\t\t\t\t\t\t\t\tstack.py_pop ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__t__ (s1.py_name == '(?#')) {\n\t\t\t\t\t\t\tif (__t__ (s0.py_name == ')')) {\n\t\t\t\t\t\t\t\tvar stack = stack.__getslice__ (0, -__t__ ((2)), 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar stack = stack.__getslice__ (0, -__t__ ((1)), 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __left0__ = shift (stack, queue);\n\t\t\t\t\t\t\tvar stack = __left0__ [0];\n\t\t\t\t\t\t\tvar queue = __left0__ [1];\n\t\t\t\t\t\t\tvar done = __left0__ [2];\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tuple ([stack, queue, flags, done]);\n\t\t\t\t\t};\n\t\t\t\t\tvar translate = function (rgx) {\n\t\t\t\t\t\t__nest__ (re, '', __init__ (__world__.re));\n\t\t\t\t\t\tvar stack = list ([]);\n\t\t\t\t\t\tvar queue = list (rgx);\n\t\t\t\t\t\tvar flags = 0;\n\t\t\t\t\t\tvar namedGroups = dict ();\n\t\t\t\t\t\tvar nloop = 0;\n\t\t\t\t\t\twhile (__t__ (true)) {\n\t\t\t\t\t\t\tnloop++;\n\t\t\t\t\t\t\tif (__t__ (nloop > MAX_SHIFTREDUCE_LOOPS)) {\n\t\t\t\t\t\t\t\tvar __except0__ = Exception ();\n\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar __left0__ = shiftReduce (stack, queue, namedGroups, flags);\n\t\t\t\t\t\t\tvar stack = __left0__ [0];\n\t\t\t\t\t\t\tvar queue = __left0__ [1];\n\t\t\t\t\t\t\tvar flags = __left0__ [2];\n\t\t\t\t\t\t\tvar done = __left0__ [3];\n\t\t\t\t\t\t\tif (__t__ (done)) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar variants = splitIfElse (stack, namedGroups);\n\t\t\t\t\t\tvar n_splits = len (variants);\n\t\t\t\t\t\tvar final = list ([]);\n\t\t\t\t\t\tfor (var i = 0; i < len (variants); i++) {\n\t\t\t\t\t\t\tfinal.extend (variants [i]);\n\t\t\t\t\t\t\tif (__t__ (i < len (variants) - 1)) {\n\t\t\t\t\t\t\t\tfinal.append (Token ('|'));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar stack = final;\n\t\t\t\t\t\tvar groupInfo = generateGroupSpans (stack);\n\t\t\t\t\t\tvar resolvedTokens = list ([]);\n\t\t\t\t\t\tfor (var token of stack) {\n\t\t\t\t\t\t\tvar stringed = token.resolve ();\n\t\t\t\t\t\t\tif (__t__ (__t__ (flags & re.DOTALL) && stringed == '.')) {\n\t\t\t\t\t\t\t\tvar stringed = '[\\\\s\\\\S]';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresolvedTokens.append (stringed);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tuple ([resolvedTokens, flags, namedGroups, countCaptureGroups (stack), n_splits]);\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t're' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.Group = Group;\n\t\t\t\t\t\t__all__.MAX_SHIFTREDUCE_LOOPS = MAX_SHIFTREDUCE_LOOPS;\n\t\t\t\t\t\t__all__.Token = Token;\n\t\t\t\t\t\t__all__.VERBOSE = VERBOSE;\n\t\t\t\t\t\t__all__.countCaptureGroups = countCaptureGroups;\n\t\t\t\t\t\t__all__.generateGroupSpans = generateGroupSpans;\n\t\t\t\t\t\t__all__.getCaptureGroup = getCaptureGroup;\n\t\t\t\t\t\t__all__.shift = shift;\n\t\t\t\t\t\t__all__.shiftReduce = shiftReduce;\n\t\t\t\t\t\t__all__.splitIfElse = splitIfElse;\n\t\t\t\t\t\t__all__.stringFlags = stringFlags;\n\t\t\t\t\t\t__all__.translate = translate;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'time', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __date = new Date (0);\n\t\t\t\t\tvar __now = new Date ();\n\t\t\t\t\tvar __weekdays = list ([]);\n\t\t\t\t\tvar __weekdays_long = list ([]);\n\t\t\t\t\tvar __d = new Date (1467662339080);\n\t\t\t\t\tfor (var i = 0; i < 7; i++) {\n\t\t\t\t\t\tfor (var [l, s] of tuple ([tuple ([__weekdays, 'short']), tuple ([__weekdays_long, 'long'])])) {\n\t\t\t\t\t\t\tl.append (__d.toLocaleString (window.navigator.language, dict ({'weekday': s})).lower ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__d.setDate (__d.getDate () + 1);\n\t\t\t\t\t}\n\t\t\t\t\tvar __months = list ([]);\n\t\t\t\t\tvar __months_long = list ([]);\n\t\t\t\t\tvar __d = new Date (946681200000.0);\n\t\t\t\t\tfor (var i = 0; i < 12; i++) {\n\t\t\t\t\t\tfor (var [l, s] of tuple ([tuple ([__months, 'short']), tuple ([__months_long, 'long'])])) {\n\t\t\t\t\t\t\tl.append (__d.toLocaleString (window.navigator.language, dict ({'month': s})).lower ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__d.setMonth (__d.getMonth () + 1);\n\t\t\t\t\t}\n\t\t\t\t\tvar __lu = dict ({'Y': 0, 'm': 1, 'd': 2, 'H': 3, 'M': 4, 'S': 5});\n\t\t\t\t\tvar _lsplit = function (s, sep, maxsplit) {\n\t\t\t\t\t\tif (maxsplit == 0) {\n\t\t\t\t\t\t\treturn list ([s]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar py_split = s.py_split (sep);\n\t\t\t\t\t\tif (!(maxsplit)) {\n\t\t\t\t\t\t\treturn py_split;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar ret = py_split.slice (0, maxsplit, 1);\n\t\t\t\t\t\tif (len (ret) == len (py_split)) {\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tret.append (sep.join (py_split.__getslice__ (maxsplit, null, 1)));\n\t\t\t\t\t\treturn ret;\n\t\t\t\t\t};\n\t\t\t\t\tvar _local_time_tuple = function (jd) {\n\t\t\t\t\t\tvar res = tuple ([jd.getFullYear (), jd.getMonth () + 1, jd.getDate (), jd.getHours (), jd.getMinutes (), jd.getSeconds (), (jd.getDay () > 0 ? jd.getDay () - 1 : 6), _day_of_year (jd, true), _daylight_in_effect (jd), jd.getMilliseconds ()]);\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t};\n\t\t\t\t\tvar _utc_time_tuple = function (jd) {\n\t\t\t\t\t\tvar res = tuple ([jd.getUTCFullYear (), jd.getUTCMonth () + 1, jd.getUTCDate (), jd.getUTCHours (), jd.getUTCMinutes (), jd.getUTCSeconds (), jd.getUTCDay () - 1, _day_of_year (jd, false), 0, jd.getUTCMilliseconds ()]);\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t};\n\t\t\t\t\tvar _day_of_year = function (jd, local) {\n\t\t\t\t\t\tvar day_offs = 0;\n\t\t\t\t\t\tif (jd.getHours () + (jd.getTimezoneOffset () * 60) / 3600 < 0) {\n\t\t\t\t\t\t\tvar day_offs = -(1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar was = jd.getTime ();\n\t\t\t\t\t\tvar cur = jd.setHours (23);\n\t\t\t\t\t\tjd.setUTCDate (1);\n\t\t\t\t\t\tjd.setUTCMonth (0);\n\t\t\t\t\t\tjd.setUTCHours (0);\n\t\t\t\t\t\tjd.setUTCMinutes (0);\n\t\t\t\t\t\tjd.setUTCSeconds (0);\n\t\t\t\t\t\tvar res = round ((cur - jd) / 86400000);\n\t\t\t\t\t\tif (!(local)) {\n\t\t\t\t\t\t\tres += day_offs;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (res == 0) {\n\t\t\t\t\t\t\tvar res = 365;\n\t\t\t\t\t\t\tjd.setTime (jd.getTime () - 86400);\n\t\t\t\t\t\t\tvar last_year = jd.getUTCFullYear ();\n\t\t\t\t\t\t\tif (_is_leap (last_year)) {\n\t\t\t\t\t\t\t\tvar res = 366;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjd.setTime (was);\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t};\n\t\t\t\t\tvar _is_leap = function (year) {\n\t\t\t\t\t\treturn __mod__ (year, 4) == 0 && (__mod__ (year, 100) != 0 || __mod__ (year, 400) == 0);\n\t\t\t\t\t};\n\t\t\t\t\tvar __jan_jun_tz = function (t, func) {\n\t\t\t\t\t\tvar was = t.getTime ();\n\t\t\t\t\t\tt.setDate (1);\n\t\t\t\t\t\tvar res = list ([]);\n\t\t\t\t\t\tfor (var m of tuple ([0, 6])) {\n\t\t\t\t\t\t\tt.setMonth (m);\n\t\t\t\t\t\t\tif (!(func)) {\n\t\t\t\t\t\t\t\tres.append (t.getTimezoneOffset ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tres.append (func (t));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tt.setTime (was);\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t};\n\t\t\t\t\tvar _daylight = function (t) {\n\t\t\t\t\t\tvar jj = __jan_jun_tz (t);\n\t\t\t\t\t\tif (jj [0] != jj [1]) {\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t};\n\t\t\t\t\tvar _daylight_in_effect = function (t) {\n\t\t\t\t\t\tvar jj = __jan_jun_tz (t);\n\t\t\t\t\t\tif (min (jj [0], jj [1]) == t.getTimezoneOffset ()) {\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t};\n\t\t\t\t\tvar _timezone = function (t) {\n\t\t\t\t\t\tvar jj = __jan_jun_tz (t);\n\t\t\t\t\t\treturn max (jj [0], jj [1]);\n\t\t\t\t\t};\n\t\t\t\t\tvar __tzn = function (t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn str (t).py_split ('(') [1].py_split (')') [0];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\treturn 'n.a.';\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _tzname = function (t) {\n\t\t\t\t\t\tvar cn = __tzn (t);\n\t\t\t\t\t\tvar ret = list ([cn, cn]);\n\t\t\t\t\t\tvar jj = __jan_jun_tz (t, __tzn);\n\t\t\t\t\t\tvar ind = 0;\n\t\t\t\t\t\tif (!(_daylight_in_effect (t))) {\n\t\t\t\t\t\t\tvar ind = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (var i of jj) {\n\t\t\t\t\t\t\tif (i != cn) {\n\t\t\t\t\t\t\t\tret [ind] = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tuple (ret);\n\t\t\t\t\t};\n\t\t\t\t\tvar altzone = __now.getTimezoneOffset ();\n\t\t\t\t\tif (!(_daylight_in_effect (__now))) {\n\t\t\t\t\t\tvar _jj = __jan_jun_tz (__now);\n\t\t\t\t\t\tvar altzone = (altzone == _jj [1] ? _jj [0] : _jj [1]);\n\t\t\t\t\t}\n\t\t\t\t\tvar altzone = altzone * 60;\n\t\t\t\t\tvar timezone = _timezone (__now) * 60;\n\t\t\t\t\tvar daylight = _daylight (__now);\n\t\t\t\t\tvar tzname = _tzname (__now);\n\t\t\t\t\tvar time = function () {\n\t\t\t\t\t\treturn Date.now () / 1000;\n\t\t\t\t\t};\n\t\t\t\t\tvar asctime = function (t) {\n\t\t\t\t\t\treturn strftime ('%a %b %d %H:%M:%S %Y', t);\n\t\t\t\t\t};\n\t\t\t\t\tvar mktime = function (t) {\n\t\t\t\t\t\tvar d = new Date (t [0], t [1] - 1, t [2], t [3], t [4], t [5], 0);\n\t\t\t\t\t\treturn (d - 0) / 1000;\n\t\t\t\t\t};\n\t\t\t\t\tvar ctime = function (seconds) {\n\t\t\t\t\t\tif (!(seconds)) {\n\t\t\t\t\t\t\tvar seconds = time ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn asctime (localtime (seconds));\n\t\t\t\t\t};\n\t\t\t\t\tvar localtime = function (seconds) {\n\t\t\t\t\t\tif (!(seconds)) {\n\t\t\t\t\t\t\tvar seconds = time ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn gmtime (seconds, true);\n\t\t\t\t\t};\n\t\t\t\t\tvar gmtime = function (seconds, localtime) {\n\t\t\t\t\t\tif (!(seconds)) {\n\t\t\t\t\t\t\tvar seconds = time ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar millis = seconds * 1000;\n\t\t\t\t\t\t__date.setTime (millis);\n\t\t\t\t\t\tif (localtime) {\n\t\t\t\t\t\t\tvar t = _local_time_tuple (__date);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar t = _utc_time_tuple (__date);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn t.__getslice__ (0, 9, 1);\n\t\t\t\t\t};\n\t\t\t\t\tvar strptime = function (string, format) {\n\t\t\t\t\t\tif (!(format)) {\n\t\t\t\t\t\t\tvar format = '%a %b %d %H:%M:%S %Y';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar __left0__ = tuple ([string, format]);\n\t\t\t\t\t\tvar ts = __left0__ [0];\n\t\t\t\t\t\tvar fmt = __left0__ [1];\n\t\t\t\t\t\tvar get_next = function (fmt) {\n\t\t\t\t\t\t\tvar get_sep = function (fmt) {\n\t\t\t\t\t\t\t\tvar res = list ([]);\n\t\t\t\t\t\t\t\tif (!(fmt)) {\n\t\t\t\t\t\t\t\t\treturn tuple (['', '']);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor (var i = 0; i < len (fmt) - 1; i++) {\n\t\t\t\t\t\t\t\t\tvar c = fmt [i];\n\t\t\t\t\t\t\t\t\tif (c == '%') {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tres.append (c);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn tuple ([''.join (res), fmt.__getslice__ (i, null, 1)]);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvar __left0__ = tuple ([null, null, null]);\n\t\t\t\t\t\t\tvar d = __left0__ [0];\n\t\t\t\t\t\t\tvar sep = __left0__ [1];\n\t\t\t\t\t\t\tvar f = __left0__ [2];\n\t\t\t\t\t\t\tif (fmt) {\n\t\t\t\t\t\t\t\tif (fmt [0] == '%') {\n\t\t\t\t\t\t\t\t\tvar d = fmt [1];\n\t\t\t\t\t\t\t\t\tvar __left0__ = get_sep (fmt.__getslice__ (2, null, 1));\n\t\t\t\t\t\t\t\t\tvar sep = __left0__ [0];\n\t\t\t\t\t\t\t\t\tvar f = __left0__ [1];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tvar __left0__ = get_sep (fmt);\n\t\t\t\t\t\t\t\t\tvar sep = __left0__ [0];\n\t\t\t\t\t\t\t\t\tvar f = __left0__ [1];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tuple ([d, sep, f]);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar dir_val = dict ({});\n\t\t\t\t\t\twhile (ts) {\n\t\t\t\t\t\t\tvar __left0__ = get_next (fmt);\n\t\t\t\t\t\t\tvar d = __left0__ [0];\n\t\t\t\t\t\t\tvar sep = __left0__ [1];\n\t\t\t\t\t\t\tvar fmt = __left0__ [2];\n\t\t\t\t\t\t\tif (sep == '') {\n\t\t\t\t\t\t\t\tvar lv = null;\n\t\t\t\t\t\t\t\tif (d) {\n\t\t\t\t\t\t\t\t\tvar l = -(1);\n\t\t\t\t\t\t\t\t\tif (d == 'Y') {\n\t\t\t\t\t\t\t\t\t\tvar l = 4;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (d == 'a') {\n\t\t\t\t\t\t\t\t\t\tvar l = len (__weekdays [0]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (d == 'A') {\n\t\t\t\t\t\t\t\t\t\tvar l = len (__weekdays_long [0]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (d == 'b') {\n\t\t\t\t\t\t\t\t\t\tvar l = len (__months [0]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (__in__ (d, tuple (['d', 'm', 'H', 'M', 'S']))) {\n\t\t\t\t\t\t\t\t\t\tvar l = 2;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (l > -(1)) {\n\t\t\t\t\t\t\t\t\t\tvar lv = list ([ts.__getslice__ (0, l, 1), ts.__getslice__ (l, null, 1)]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!(lv)) {\n\t\t\t\t\t\t\t\t\tvar lv = list ([ts, '']);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar lv = _lsplit (ts, sep, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (d == null) {\n\t\t\t\t\t\t\t\tvar ts = lv [1];\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar __left0__ = tuple ([lv [1], lv [0]]);\n\t\t\t\t\t\t\tvar ts = __left0__ [0];\n\t\t\t\t\t\t\tdir_val [d] = __left0__ [1];\n\t\t\t\t\t\t\tif (fmt == '') {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar t = list ([1900, 1, 1, 0, 0, 0, 0, 1, -(1)]);\n\t\t\t\t\t\tvar ignore_keys = list ([]);\n\t\t\t\t\t\tvar have_weekday = false;\n\t\t\t\t\t\tfor (var [d, v] of dir_val.py_items ()) {\n\t\t\t\t\t\t\tif (__in__ (d, ignore_keys)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (d == 'p') {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (__in__ (d, __lu.py_keys ())) {\n\t\t\t\t\t\t\t\tt [__lu [d]] = int (v);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (__in__ (d, tuple (['a', 'A', 'b', 'B']))) {\n\t\t\t\t\t\t\t\tvar v = v.lower ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (d == 'm') {\n\t\t\t\t\t\t\t\tignore_keys.append ('b');\n\t\t\t\t\t\t\t\tignore_keys.append ('B');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (d == 'a') {\n\t\t\t\t\t\t\t\tif (!(__in__ (v, __weekdays))) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Weekday unknown in your locale');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar have_weekday = true;\n\t\t\t\t\t\t\t\tt [6] = __weekdays.index (v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'A') {\n\t\t\t\t\t\t\t\tif (!(__in__ (v, __weekdays_long))) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Weekday unknown in your locale');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar have_weekday = true;\n\t\t\t\t\t\t\t\tt [6] = __weekdays_long.index (v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'b') {\n\t\t\t\t\t\t\t\tif (!(__in__ (v, __months))) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Month unknown in your locale');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tt [1] = __months.index (v) + 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'B') {\n\t\t\t\t\t\t\t\tif (!(__in__ (v, __months_long))) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ('Month unknown in your locale');\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tt [1] = __months_long.index (v) + 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'I') {\n\t\t\t\t\t\t\t\tvar ampm = dir_val ['p'] || 'am';\n\t\t\t\t\t\t\t\tvar ampm = ampm.lower ();\n\t\t\t\t\t\t\t\tvar v = int (v);\n\t\t\t\t\t\t\t\tif (v == 12) {\n\t\t\t\t\t\t\t\t\tvar v = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (v > 12) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError ((((\"time data '\" + string) + \"' does not match format '\") + format) + \"'\");\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (ampm == 'pm') {\n\t\t\t\t\t\t\t\t\tv += 12;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tt [__lu ['H']] = v;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'y') {\n\t\t\t\t\t\t\t\tt [0] = 2000 + int (v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (d == 'Z') {\n\t\t\t\t\t\t\t\tif (__in__ (v.lower (), list (['gmt', 'utc']))) {\n\t\t\t\t\t\t\t\t\tt [-(1)] = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar __date = new Date (0);\n\t\t\t\t\t\t__date.setUTCFullYear (t [0]);\n\t\t\t\t\t\t__date.setUTCMonth (t [1] - 1);\n\t\t\t\t\t\t__date.setUTCDate (t [2]);\n\t\t\t\t\t\t__date.setUTCHours (t [3]);\n\t\t\t\t\t\tt [7] = _day_of_year (__date);\n\t\t\t\t\t\tif (!(have_weekday)) {\n\t\t\t\t\t\t\tt [6] = __date.getUTCDay () - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn t;\n\t\t\t\t\t};\n\t\t\t\t\tvar strftime = function (format, t) {\n\t\t\t\t\t\tvar zf2 = function (v) {\n\t\t\t\t\t\t\tif (v < 10) {\n\t\t\t\t\t\t\t\treturn '0' + str (v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn v;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (!(t)) {\n\t\t\t\t\t\t\tvar t = localtime ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar f = format;\n\t\t\t\t\t\tfor (var d of __lu.py_keys ()) {\n\t\t\t\t\t\t\tvar k = '%' + d;\n\t\t\t\t\t\t\tif (!(__in__ (k, f))) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar v = zf2 (t [__lu [d]]);\n\t\t\t\t\t\t\tvar f = f.py_replace (k, v);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (var [d, l, pos] of tuple ([tuple (['b', __months, 1]), tuple (['B', __months_long, 1]), tuple (['a', __weekdays, 6]), tuple (['A', __weekdays_long, 6])])) {\n\t\t\t\t\t\t\tvar p = t [pos];\n\t\t\t\t\t\t\tif (pos == 1) {\n\t\t\t\t\t\t\t\tvar p = p - 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar v = l [p].capitalize ();\n\t\t\t\t\t\t\tvar f = f.py_replace ('%' + d, v);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__in__ ('%p', f)) {\n\t\t\t\t\t\t\tif (t [3] > 11) {\n\t\t\t\t\t\t\t\tvar ap = 'PM';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar ap = 'AM';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar f = f.py_replace ('%p', ap);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__in__ ('%y', f)) {\n\t\t\t\t\t\t\tvar f = f.py_replace ('%y', str (t [0]).__getslice__ (-(2), null, 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__in__ ('%I', f)) {\n\t\t\t\t\t\t\tvar v = t [3];\n\t\t\t\t\t\t\tif (v == 0) {\n\t\t\t\t\t\t\t\tvar v = 12;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (v > 12) {\n\t\t\t\t\t\t\t\tvar v = v - 12;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar f = f.py_replace ('%I', zf2 (v));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn f;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__d = __d;\n\t\t\t\t\t\t__all__.__date = __date;\n\t\t\t\t\t\t__all__.__jan_jun_tz = __jan_jun_tz;\n\t\t\t\t\t\t__all__.__lu = __lu;\n\t\t\t\t\t\t__all__.__months = __months;\n\t\t\t\t\t\t__all__.__months_long = __months_long;\n\t\t\t\t\t\t__all__.__now = __now;\n\t\t\t\t\t\t__all__.__tzn = __tzn;\n\t\t\t\t\t\t__all__.__weekdays = __weekdays;\n\t\t\t\t\t\t__all__.__weekdays_long = __weekdays_long;\n\t\t\t\t\t\t__all__._day_of_year = _day_of_year;\n\t\t\t\t\t\t__all__._daylight = _daylight;\n\t\t\t\t\t\t__all__._daylight_in_effect = _daylight_in_effect;\n\t\t\t\t\t\t__all__._is_leap = _is_leap;\n\t\t\t\t\t\t__all__._jj = _jj;\n\t\t\t\t\t\t__all__._local_time_tuple = _local_time_tuple;\n\t\t\t\t\t\t__all__._lsplit = _lsplit;\n\t\t\t\t\t\t__all__._timezone = _timezone;\n\t\t\t\t\t\t__all__._tzname = _tzname;\n\t\t\t\t\t\t__all__._utc_time_tuple = _utc_time_tuple;\n\t\t\t\t\t\t__all__.altzone = altzone;\n\t\t\t\t\t\t__all__.asctime = asctime;\n\t\t\t\t\t\t__all__.ctime = ctime;\n\t\t\t\t\t\t__all__.daylight = daylight;\n\t\t\t\t\t\t__all__.gmtime = gmtime;\n\t\t\t\t\t\t__all__.i = i;\n\t\t\t\t\t\t__all__.l = l;\n\t\t\t\t\t\t__all__.localtime = localtime;\n\t\t\t\t\t\t__all__.mktime = mktime;\n\t\t\t\t\t\t__all__.s = s;\n\t\t\t\t\t\t__all__.strftime = strftime;\n\t\t\t\t\t\t__all__.strptime = strptime;\n\t\t\t\t\t\t__all__.time = time;\n\t\t\t\t\t\t__all__.timezone = timezone;\n\t\t\t\t\t\t__all__.tzname = tzname;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'units', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar random = {};\n\t\t\t\t\t__nest__ (random, '', __init__ (__world__.random));\n\t\t\t\t\tvar three = __init__ (__world__.org.threejs);\n\t\t\t\t\tvar wrap = __init__ (__world__.utils).wrap;\n\t\t\t\t\tvar AABB = __init__ (__world__.utils).AABB;\n\t\t\t\t\tvar Unit = __class__ ('Unit', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.geo = null;\n\t\t\t\t\t\t\tself.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_position () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.geo.position;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget set_position () {return __get__ (this, function (self, p) {\n\t\t\t\t\t\t\tself.geo.position.set (p.x, p.y, p.z);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, t) {\n\t\t\t\t\t\t\tif (self.visible) {\n\t\t\t\t\t\t\t\tvar current_pos = self.geo.position;\n\t\t\t\t\t\t\t\tvar move = three.Vector3 ().copy (self.momentum).multiplyScalar (t);\n\t\t\t\t\t\t\t\tvar current_pos = current_pos.add (move);\n\t\t\t\t\t\t\t\tself.geo.position.set (current_pos.x, current_pos.y, current_pos.z);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_vis () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.geo.visible;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget set_vis () {return __get__ (this, function (self, v) {\n\t\t\t\t\t\t\tself.geo.visible = v;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Unit, 'visible', property.call (Unit, Unit.get_vis, Unit.set_vis));;\n\t\t\t\t\tObject.defineProperty (Unit, 'position', property.call (Unit, Unit.get_position, Unit.set_position));;\n\t\t\t\t\tvar Ship = __class__ ('Ship', [Unit], {\n\t\t\t\t\t\tROTATE_SPEED: 2.1,\n\t\t\t\t\t\tTHRUST: 45,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, keyboard, game) {\n\t\t\t\t\t\t\tUnit.__init__ (self);\n\t\t\t\t\t\t\tself.keyboard = keyboard;\n\t\t\t\t\t\t\tself.geo = three.Mesh (three.ConeBufferGeometry (1, 3, 8), three.MeshNormalMaterial ());\n\t\t\t\t\t\t\tvar exhaust = three.Mesh (three.ConeBufferGeometry (0.5, 2, 8), three.MeshBasicMaterial (dict ({'color': 16776960})));\n\t\t\t\t\t\t\tself.geo.add (exhaust);\n\t\t\t\t\t\t\texhaust.translateY (-(2));\n\t\t\t\t\t\t\texhaust.rotateZ (3.14159);\n\t\t\t\t\t\t\tself.exhaust = exhaust;\n\t\t\t\t\t\t\tself.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t\tself.keyboard = keyboard;\n\t\t\t\t\t\t\tself.bbox = AABB (2, 3, self.geo.position);\n\t\t\t\t\t\t\tself.game = game;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget thrust () {return __get__ (this, function (self, amt) {\n\t\t\t\t\t\t\tvar thrust_amt = amt * self.THRUST;\n\t\t\t\t\t\t\tself.momentum = self.momentum.add (self.heading.multiplyScalar (thrust_amt));\n\t\t\t\t\t\t\tself.exhaust.visible = amt > 0;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget spin () {return __get__ (this, function (self, amt) {\n\t\t\t\t\t\t\tself.geo.rotateZ ((amt * self.ROTATE_SPEED) * -(1));\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, t) {\n\t\t\t\t\t\t\tUnit.py_update (self, t);\n\t\t\t\t\t\t\tself.bbox.py_update (self.position);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_heading () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar m = self.geo.matrixWorld.elements;\n\t\t\t\t\t\t\treturn three.Vector3 (m [4], m [5], m [6]);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Ship, 'heading', property.call (Ship, Ship.get_heading));;\n\t\t\t\t\tvar Asteroid = __class__ ('Asteroid', [Unit], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, radius, pos) {\n\t\t\t\t\t\t\tUnit.__init__ (self);\n\t\t\t\t\t\t\tself.radius = radius;\n\t\t\t\t\t\t\tself.geo = three.Mesh (three.SphereGeometry (self.radius), three.MeshNormalMaterial ());\n\t\t\t\t\t\t\tself.geo.position.set (pos.x, pos.y, pos.z);\n\t\t\t\t\t\t\tself.bbox = AABB (self.radius * 2, self.radius * 2, self.geo.position);\n\t\t\t\t\t\t\tself.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, t) {\n\t\t\t\t\t\t\tUnit.py_update (self, t);\n\t\t\t\t\t\t\tself.bbox.py_update (self.position);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Bullet = __class__ ('Bullet', [object], {\n\t\t\t\t\t\tEXPIRES: 1,\n\t\t\t\t\t\tRESET_POS: three.Vector3 (0, 0, 1000),\n\t\t\t\t\t\tBULLET_SPEED: 50,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.vector = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t\tself.geo = three.Mesh (three.BoxGeometry (0.25, 0.25, 0.25), three.MeshBasicMaterial (dict ({'color': 16777215})));\n\t\t\t\t\t\t\tself.lifespan = 0;\n\t\t\t\t\t\t\tself.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t\tself.reset ();\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, t) {\n\t\t\t\t\t\t\tif (self.geo.position.z < 1000) {\n\t\t\t\t\t\t\t\tself.lifespan += t;\n\t\t\t\t\t\t\t\tif (self.lifespan > self.EXPIRES) {\n\t\t\t\t\t\t\t\t\tself.reset ();\n\t\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar delta = three.Vector3 ().copy (self.vector);\n\t\t\t\t\t\t\t\tdelta.multiplyScalar (self.BULLET_SPEED * t);\n\t\t\t\t\t\t\t\tdelta.add (self.momentum);\n\t\t\t\t\t\t\t\tvar current_pos = self.geo.position.add (delta);\n\t\t\t\t\t\t\t\tself.geo.position.set (current_pos.x, current_pos.y, current_pos.z);\n\t\t\t\t\t\t\t\twrap (self.geo);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget reset () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.lifespan = 0;\n\t\t\t\t\t\t\tself.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\t\t\t\tself.geo.position.set (self.RESET_POS.x, self.RESET_POS.y, self.RESET_POS.z);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget get_position () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn self.geo.position;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tObject.defineProperty (Bullet, 'position', property.call (Bullet, Bullet.get_position));;\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'org.threejs' +\n\t\t\t\t\t\t'random' +\n\t\t\t\t\t\t'utils' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AABB = AABB;\n\t\t\t\t\t\t__all__.Asteroid = Asteroid;\n\t\t\t\t\t\t__all__.Bullet = Bullet;\n\t\t\t\t\t\t__all__.Ship = Ship;\n\t\t\t\t\t\t__all__.Unit = Unit;\n\t\t\t\t\t\t__all__.three = three;\n\t\t\t\t\t\t__all__.wrap = wrap;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'utils', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar three = __init__ (__world__.org.threejs);\n\t\t\t\t\tvar pad_wrap = function (min, max, val) {\n\t\t\t\t\t\tif (val < min) {\n\t\t\t\t\t\t\treturn max;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (val > max) {\n\t\t\t\t\t\t\treturn min;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn val;\n\t\t\t\t\t};\n\t\t\t\t\tvar XWRAP = 0;\n\t\t\t\t\tvar XNWRAP = 0;\n\t\t\t\t\tvar YWRAP = 0;\n\t\t\t\t\tvar YNWRAP = 0;\n\t\t\t\t\tvar set_limits = function (x, y) {\n\t\t\t\t\t\tXWRAP = int (x);\n\t\t\t\t\t\tXNWRAP = -(1) * XWRAP;\n\t\t\t\t\t\tYWRAP = int (y);\n\t\t\t\t\t\tYNWRAP = -(1) * YWRAP;\n\t\t\t\t\t};\n\t\t\t\t\tvar wrap = function (obj) {\n\t\t\t\t\t\tvar __left0__ = tuple ([obj.position.x, obj.position.y, obj.position.z]);\n\t\t\t\t\t\tvar x = __left0__ [0];\n\t\t\t\t\t\tvar y = __left0__ [1];\n\t\t\t\t\t\tvar z = __left0__ [2];\n\t\t\t\t\t\tvar x = pad_wrap (XNWRAP, XWRAP, x);\n\t\t\t\t\t\tvar y = pad_wrap (YNWRAP, YWRAP, y);\n\t\t\t\t\t\tobj.position.set (x, y, z);\n\t\t\t\t\t};\n\t\t\t\t\tvar clamp = function (val, low, high) {\n\t\t\t\t\t\treturn max (min (val, high), low);\n\t\t\t\t\t};\n\t\t\t\t\tvar sign = function (val) {\n\t\t\t\t\t\tif (val > 0) {\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (val < 0) {\n\t\t\t\t\t\t\treturn -(1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t};\n\t\t\t\t\tvar now = function () {\n\t\t\t\t\t\tvar d = new Date;\n\t\t\t\t\t\treturn d.getTime () / 1000.0;\n\t\t\t\t\t};\n\t\t\t\t\tvar set_element = function (id, value) {\n\t\t\t\t\t\tdocument.getElementById (id).innerHTML = value;\n\t\t\t\t\t};\n\t\t\t\t\tvar AABB = __class__ ('AABB', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, width, height, center) {\n\t\t\t\t\t\t\tself.hw = width / 2.0;\n\t\t\t\t\t\t\tself.hh = width / 2.0;\n\t\t\t\t\t\t\tself.position = center;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget contains () {return __get__ (this, function (self, item) {\n\t\t\t\t\t\t\tvar x = self.position.x;\n\t\t\t\t\t\t\tvar y = self.position.y;\n\t\t\t\t\t\t\tvar h = self.hh;\n\t\t\t\t\t\t\tvar w = self.hw;\n\t\t\t\t\t\t\treturn item.x > x - w && item.x < x + w && item.y > y - h && item.y < y + h;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, pos) {\n\t\t\t\t\t\t\tself.position = pos;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar FPSCounter = __class__ ('FPSCounter', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, hud_element) {\n\t\t\t\t\t\t\tself.frames = list ([0.1]);\n\t\t\t\t\t\t\tfor (var n = 0; n < 99; n++) {\n\t\t\t\t\t\t\t\tself.frames.append (0.1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.next_frame = 0;\n\t\t\t\t\t\t\tself.average = 0;\n\t\t\t\t\t\t\tself.visible = true;\n\t\t\t\t\t\t\tself.element = hud_element;\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget py_update () {return __get__ (this, function (self, t) {\n\t\t\t\t\t\t\tself.frames [self.next_frame] = t;\n\t\t\t\t\t\t\tself.next_frame++;\n\t\t\t\t\t\t\tif (self.next_frame > 99) {\n\t\t\t\t\t\t\t\tself.next_frame = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar sum = (function __lambda__ (a, b) {\n\t\t\t\t\t\t\t\treturn a + b;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tvar total = 0;\n\t\t\t\t\t\t\tfor (var n = 0; n < 100; n++) {\n\t\t\t\t\t\t\t\ttotal += self.frames [n];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.average = total * 10;\n\t\t\t\t\t\t\tif (self.visible) {\n\t\t\t\t\t\t\t\tself.element.innerHTML = '{} fps'.format (int (1000 / self.average));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar advance = function (cr, value) {\n\t\t\t\t\t\t(function () {return cr.next (value).value}) ();\n\t\t\t\t\t};\n\t\t\t\t\tvar coroutine = function (loop, callback) {\n\t\t\t\t\t\tvar callback_fn = (callback !== null ? callback : (function __lambda__ (a) {\n\t\t\t\t\t\t\treturn a;\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tvar coroutine_generator = function* () {\n\t\t\t\t\t\t\tvar alive = true;\n\t\t\t\t\t\t\tvar result = null;\n\t\t\t\t\t\t\twhile (alive) {\n\t\t\t\t\t\t\t\tvar next_value = yield;\n\t\t\t\t\t\t\t\tvar __left0__ = loop (next_value);\n\t\t\t\t\t\t\t\tvar alive = __left0__ [0];\n\t\t\t\t\t\t\t\tvar result = __left0__ [1];\n\t\t\t\t\t\t\t\tyield result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tyield callback_fn (result);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar cr = coroutine_generator ();\n\t\t\t\t\t\tcr.advance = (function __lambda__ (a) {\n\t\t\t\t\t\t\treturn advance (cr, a);\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn cr;\n\t\t\t\t\t};\n\t\t\t\t\tvar timer = function (duration, loop, callback) {\n\t\t\t\t\t\tvar expires_at = now () + duration;\n\t\t\t\t\t\tvar loop_fn = (loop !== null ? loop : (function __lambda__ (a) {\n\t\t\t\t\t\t\treturn tuple ([true, a]);\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tvar callback_fn = (callback !== null ? callback : (function __lambda__ (a) {\n\t\t\t\t\t\t\treturn a;\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tvar timer_coroutine = function* () {\n\t\t\t\t\t\t\tvar alive = true;\n\t\t\t\t\t\t\tvar result = null;\n\t\t\t\t\t\t\twhile (alive) {\n\t\t\t\t\t\t\t\tvar next_value = yield;\n\t\t\t\t\t\t\t\tvar __left0__ = loop_fn (next_value);\n\t\t\t\t\t\t\t\tvar alive = __left0__ [0];\n\t\t\t\t\t\t\t\tvar result = __left0__ [1];\n\t\t\t\t\t\t\t\tvar alive = alive && now () < expires_at;\n\t\t\t\t\t\t\t\tyield result;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tyield callback_fn (result);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar tc = timer_coroutine ();\n\t\t\t\t\t\ttc.advance = (function __lambda__ (a) {\n\t\t\t\t\t\t\treturn advance (tc, a);\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn tc;\n\t\t\t\t\t};\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t'org.threejs' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AABB = AABB;\n\t\t\t\t\t\t__all__.FPSCounter = FPSCounter;\n\t\t\t\t\t\t__all__.XNWRAP = XNWRAP;\n\t\t\t\t\t\t__all__.XWRAP = XWRAP;\n\t\t\t\t\t\t__all__.YNWRAP = YNWRAP;\n\t\t\t\t\t\t__all__.YWRAP = YWRAP;\n\t\t\t\t\t\t__all__.advance = advance;\n\t\t\t\t\t\t__all__.clamp = clamp;\n\t\t\t\t\t\t__all__.coroutine = coroutine;\n\t\t\t\t\t\t__all__.now = now;\n\t\t\t\t\t\t__all__.pad_wrap = pad_wrap;\n\t\t\t\t\t\t__all__.set_element = set_element;\n\t\t\t\t\t\t__all__.set_limits = set_limits;\n\t\t\t\t\t\t__all__.sign = sign;\n\t\t\t\t\t\t__all__.three = three;\n\t\t\t\t\t\t__all__.timer = timer;\n\t\t\t\t\t\t__all__.wrap = wrap;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t__nest__ (\n\t\t__all__,\n\t\t'warnings', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar re = {};\n\t\t\t\t\t__nest__ (re, '', __init__ (__world__.re));\n\t\t\t\t\tvar Actions = __class__ ('Actions', [object], {\n\t\t\t\t\t\terror: 'error',\n\t\t\t\t\t\tignore: 'ignore',\n\t\t\t\t\t\talways: 'always',\n\t\t\t\t\t\tdefaultact: 'default',\n\t\t\t\t\t\tmodule: 'module',\n\t\t\t\t\t\tonce: 'once'\n\t\t\t\t\t});\n\t\t\t\t\tvar ActionSet = set (function () {\n\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\tfor (var x of dir (Actions)) {\n\t\t\t\t\t\t\tif (!(x.startswith ('_'))) {\n\t\t\t\t\t\t\t\t__accu0__.append (x);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t} ());\n\t\t\t\t\tvar CategoryMap = dict ({'UserWarning': UserWarning, 'DeprecationWarning': DeprecationWarning, 'RuntimeWarning': RuntimeWarning});\n\t\t\t\t\tvar _warnings_defaults = false;\n\t\t\t\t\tvar filters = list ([]);\n\t\t\t\t\tvar defaultaction = Actions.defaultact;\n\t\t\t\t\tvar onceregistry = dict ({});\n\t\t\t\t\tvar _filters_version = 1;\n\t\t\t\t\tvar _filters_mutated = function () {\n\t\t\t\t\t\t_filters_version++;\n\t\t\t\t\t};\n\t\t\t\t\tvar showwarning = function (message, category, filename, lineno, file, line) {\n\t\t\t\t\t\tif (typeof file == 'undefined' || (file != null && file .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar file = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof line == 'undefined' || (line != null && line .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar line = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar msg = WarningMessage (message, category, filename, lineno, file, line);\n\t\t\t\t\t\t_showwarnmsg_impl (msg);\n\t\t\t\t\t};\n\t\t\t\t\tvar formatwarning = function (message, category, filename, lineno, line) {\n\t\t\t\t\t\tif (typeof line == 'undefined' || (line != null && line .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar line = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar msg = WarningMessage (message, category, filename, lineno, null, line);\n\t\t\t\t\t\treturn _formatwarnmsg_impl (msg);\n\t\t\t\t\t};\n\t\t\t\t\tvar _showwarnmsg_impl = function (msg) {\n\t\t\t\t\t\tvar f = msg.file;\n\t\t\t\t\t\tvar text = _formatwarnmsg (msg);\n\t\t\t\t\t\tif (f === null) {\n\t\t\t\t\t\t\tvar text = text.rstrip ('\\r\\n');\n\t\t\t\t\t\t\tconsole.log (text);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tf.write (text);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\t\tvar exc = __except0__;\n\t\t\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _formatwarnmsg_impl = function (msg) {\n\t\t\t\t\t\tvar s = '{}:{}: {}: {}\\n'.format (msg.filename, msg.lineno, msg.category, str (msg.message));\n\t\t\t\t\t\tif (msg.line) {\n\t\t\t\t\t\t\tvar line = msg.line.strip ();\n\t\t\t\t\t\t\ts += ' {}\\n'.format (line);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t};\n\t\t\t\t\tvar _showwarning = showwarning;\n\t\t\t\t\tvar setShowWarning = function (func) {\n\t\t\t\t\t\tif (!(callable (func))) {\n\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('showwarning method must be callable');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowwarning = func;\n\t\t\t\t\t};\n\t\t\t\t\tvar _showwarnmsg = function (msg) {\n\t\t\t\t\t\tif (!(callable (showwarning))) {\n\t\t\t\t\t\t\tvar __except0__ = py_TypeError ('warnings.showwarning() must be set to a function or method');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowwarning (msg.message, msg.category, msg.filename, msg.lineno, msg.file, msg.line);\n\t\t\t\t\t};\n\t\t\t\t\tvar _formatwarning = formatwarning;\n\t\t\t\t\tvar _formatwarnmsg = function (msg) {\n\t\t\t\t\t\tif (formatwarning !== _formatwarning) {\n\t\t\t\t\t\t\treturn formatwarning (msg.message, msg.category, msg.filename, msg.lineno, __kwargtrans__ ({line: msg.line}));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _formatwarnmsg_impl (msg);\n\t\t\t\t\t};\n\t\t\t\t\tvar addWarningCategory = function (cat) {\n\t\t\t\t\t\tvar py_name = cat.__name__;\n\t\t\t\t\t\tif (!__in__ (py_name, CategoryMap)) {\n\t\t\t\t\t\t\tCategoryMap [py_name] = cat;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __except0__ = Exception ('Warning Category {} already exists'.format (py_name));\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar filterwarnings = function (action, message, category, module, lineno, append) {\n\t\t\t\t\t\tif (typeof message == 'undefined' || (message != null && message .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar message = '';\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof category == 'undefined' || (category != null && category .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar category = Warning;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof module == 'undefined' || (module != null && module .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar module = '';\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof lineno == 'undefined' || (lineno != null && lineno .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar lineno = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof append == 'undefined' || (append != null && append .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar append = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'action': var action = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'message': var message = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'category': var category = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'module': var module = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'lineno': var lineno = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'append': var append = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_add_filter (action, re.compile (message, re.I), category, re.compile (module), lineno, __kwargtrans__ ({append: append}));\n\t\t\t\t\t};\n\t\t\t\t\tvar simplefilter = function (action, category, lineno, append) {\n\t\t\t\t\t\tif (typeof category == 'undefined' || (category != null && category .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar category = Warning;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof lineno == 'undefined' || (lineno != null && lineno .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar lineno = 0;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof append == 'undefined' || (append != null && append .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar append = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'action': var action = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'category': var category = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'lineno': var lineno = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'append': var append = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_add_filter (action, null, category, null, lineno, __kwargtrans__ ({append: append}));\n\t\t\t\t\t};\n\t\t\t\t\tvar _add_filter = function () {\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'append': var append = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar item = tuple ([].slice.apply (arguments).slice (0, __ilastarg0__ + 1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar item = tuple ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!(append)) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tfilters.remove (item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, Exception)) {\n\t\t\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfilters.insert (0, item);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!__in__ (item, filters)) {\n\t\t\t\t\t\t\tfilters.append (item);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_filters_mutated ();\n\t\t\t\t\t};\n\t\t\t\t\tvar resetwarnings = function () {\n\t\t\t\t\t\tvar filters = list ([]);\n\t\t\t\t\t\t_filters_mutated ();\n\t\t\t\t\t};\n\t\t\t\t\tvar __warningregistry__ = dict ({});\n\t\t\t\t\tvar _checkCatMatch = function (msgCat, filtCat) {\n\t\t\t\t\t\treturn msgCat.__name__ == filtCat.__name__;\n\t\t\t\t\t};\n\t\t\t\t\tvar warn_explicit = function (message, category, filename, lineno, module, registry, module_globals) {\n\t\t\t\t\t\tif (typeof module == 'undefined' || (module != null && module .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar module = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof registry == 'undefined' || (registry != null && registry .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar registry = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof module_globals == 'undefined' || (module_globals != null && module_globals .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar module_globals = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tvar lineno = int (lineno);\n\t\t\t\t\t\tif (module === null) {\n\t\t\t\t\t\t\tvar module = filename || '<unknown>';\n\t\t\t\t\t\t\tif (module.__getslice__ (-(3), null, 1).lower () == '.py') {\n\t\t\t\t\t\t\t\tvar module = module.__getslice__ (0, -(3), 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (registry === null) {\n\t\t\t\t\t\t\tvar registry = __warningregistry__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar currVersion = registry ['version'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\tif (isinstance (__except0__, KeyError)) {\n\t\t\t\t\t\t\t\tvar currVersion = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (currVersion != _filters_version) {\n\t\t\t\t\t\t\tregistry.py_clear ();\n\t\t\t\t\t\t\tregistry ['version'] = _filters_version;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isinstance (message, Warning)) {\n\t\t\t\t\t\t\tvar text = str (message);\n\t\t\t\t\t\t\tvar category = message.__class__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar text = message;\n\t\t\t\t\t\t\tvar message = category (message);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar key = tuple ([text, category, lineno]);\n\t\t\t\t\t\tif (__in__ (key, registry)) {\n\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar __break0__ = false;\n\t\t\t\t\t\tfor (var item of filters) {\n\t\t\t\t\t\t\tvar __left0__ = item;\n\t\t\t\t\t\t\tvar action = __left0__ [0];\n\t\t\t\t\t\t\tvar msg = __left0__ [1];\n\t\t\t\t\t\t\tvar cat = __left0__ [2];\n\t\t\t\t\t\t\tvar mod = __left0__ [3];\n\t\t\t\t\t\t\tvar ln = __left0__ [4];\n\t\t\t\t\t\t\tif ((msg === null || msg.match (text)) && _checkCatMatch (category, cat) && (mod === null || mod.match (module)) && (ln == 0 || lineno == ln)) {\n\t\t\t\t\t\t\t\t__break0__ = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!__break0__) {\n\t\t\t\t\t\t\tvar action = defaultaction;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (action == Actions.ignore) {\n\t\t\t\t\t\t\tregistry [key] = 1;\n\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (action == Actions.error) {\n\t\t\t\t\t\t\tvar __except0__ = message;\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (action == Actions.once) {\n\t\t\t\t\t\t\tregistry [key] = 1;\n\t\t\t\t\t\t\tvar oncekey = tuple ([text, category]);\n\t\t\t\t\t\t\tif (__in__ (oncekey, onceregistry)) {\n\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonceregistry [oncekey] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (action == Actions.always) {\n\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (action == Actions.module) {\n\t\t\t\t\t\t\tregistry [key] = 1;\n\t\t\t\t\t\t\tvar altkey = tuple ([text, category, 0]);\n\t\t\t\t\t\t\tif (__in__ (altkey, registry)) {\n\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tregistry [altkey] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (action == Actions.defaultact) {\n\t\t\t\t\t\t\tregistry [key] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __except0__ = RuntimeError ('Unrecognized action ({}) in warnings.filters:\\n {}'.format (action, item));\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar msg = WarningMessage (message, category.__name__, filename, lineno);\n\t\t\t\t\t\t_showwarnmsg (msg);\n\t\t\t\t\t};\n\t\t\t\t\tvar WarningMessage = __class__ ('WarningMessage', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, category, filename, lineno, file, line) {\n\t\t\t\t\t\t\tif (typeof file == 'undefined' || (file != null && file .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar file = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tif (typeof line == 'undefined' || (line != null && line .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\t\tvar line = null;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tself.message = message;\n\t\t\t\t\t\t\tself.category = category;\n\t\t\t\t\t\t\tself.filename = filename;\n\t\t\t\t\t\t\tself.lineno = lineno;\n\t\t\t\t\t\t\tself.file = file;\n\t\t\t\t\t\t\tself.line = line;\n\t\t\t\t\t\t\tself._category_name = (category ? category.__name__ : null);\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\treturn '{{message : {}, category : {}, filename : {}, lineno : {}, line : {} }}'.format (self.message, self._category_name, self.filename, self.lineno, self.line);\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar catch_warnings = __class__ ('catch_warnings', [object], {\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar record = false;\n\t\t\t\t\t\t\tvar module = null;\n\t\t\t\t\t\t\tself._record = record;\n\t\t\t\t\t\t\tself._entered = false;\n\t\t\t\t\t\t\tvar __except0__ = NotImplementedError ('with/as not well supported in transcrypt');\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar setWarningOptions = function (opts) {\n\t\t\t\t\t\t_processoptions (opts);\n\t\t\t\t\t};\n\t\t\t\t\tvar _OptionError = __class__ ('_OptionError', [Exception], {\n\t\t\t\t\t});\n\t\t\t\t\tvar _processoptions = function (args) {\n\t\t\t\t\t\tfor (var arg of args) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t_setoption (arg);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, _OptionError)) {\n\t\t\t\t\t\t\t\t\tvar msg = __except0__;\n\t\t\t\t\t\t\t\t\tconsole.log ('WARNING: Invalid -W option ignored: {}'.format (msg));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar _setoption = function (arg) {\n\t\t\t\t\t\tvar parts = arg.py_split (':');\n\t\t\t\t\t\tif (len (parts) > 5) {\n\t\t\t\t\t\t\tvar __except0__ = _OptionError ('too many fields (max 5): {}'.format (arg));\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile (len (parts) < 5) {\n\t\t\t\t\t\t\tparts.append ('');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar __left0__ = function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tfor (var s of parts) {\n\t\t\t\t\t\t\t\t__accu0__.append (s.strip ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t} ();\n\t\t\t\t\t\tvar action = __left0__ [0];\n\t\t\t\t\t\tvar message = __left0__ [1];\n\t\t\t\t\t\tvar category = __left0__ [2];\n\t\t\t\t\t\tvar module = __left0__ [3];\n\t\t\t\t\t\tvar lineno = __left0__ [4];\n\t\t\t\t\t\tvar action = _getaction (action);\n\t\t\t\t\t\tvar message = re.escape (message);\n\t\t\t\t\t\tvar category = _getcategory (category);\n\t\t\t\t\t\tvar module = re.escape (module);\n\t\t\t\t\t\tif (module) {\n\t\t\t\t\t\t\tvar module = module + '$';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (lineno) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvar lineno = int (lineno);\n\t\t\t\t\t\t\t\tif (lineno < 0) {\n\t\t\t\t\t\t\t\t\tvar __except0__ = ValueError;\n\t\t\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, tuple ([ValueError, OverflowError]))) {\n\t\t\t\t\t\t\t\t\tvar __except1__ = _OptionError ('invalid lineno {}'.format (lineno));\n\t\t\t\t\t\t\t\t\t__except1__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except1__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar lineno = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfilterwarnings (action, message, category, module, lineno);\n\t\t\t\t\t};\n\t\t\t\t\tvar _getaction = function (action) {\n\t\t\t\t\t\tif (!(action)) {\n\t\t\t\t\t\t\treturn Actions.defaultact;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (action == 'all') {\n\t\t\t\t\t\t\treturn Action.always;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (var a of ActionSet) {\n\t\t\t\t\t\t\tif (a.startswith (action)) {\n\t\t\t\t\t\t\t\treturn a;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar __except0__ = _OptionError ('invalid action: {}'.format (action));\n\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t};\n\t\t\t\t\tvar _getcategory = function (category) {\n\t\t\t\t\t\tif (!(category)) {\n\t\t\t\t\t\t\treturn Warning;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (__in__ (category, CategoryMap.py_keys ())) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvar cat = CategoryMap [category];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tif (isinstance (__except0__, NameError)) {\n\t\t\t\t\t\t\t\t\tvar __except1__ = _OptionError ('unknown warning category: {}'.format (category));\n\t\t\t\t\t\t\t\t\t__except1__.__cause__ = null;\n\t\t\t\t\t\t\t\t\tthrow __except1__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar __except0__ = Exception ('Unable to import category: {}, use `addWarningCategory`'.format (category));\n\t\t\t\t\t\t\t__except0__.__cause__ = null;\n\t\t\t\t\t\t\tthrow __except0__;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cat;\n\t\t\t\t\t};\n\t\t\t\t\tif (!(_warnings_defaults)) {\n\t\t\t\t\t\tvar silence = list ([DeprecationWarning]);\n\t\t\t\t\t\tfor (var cls of silence) {\n\t\t\t\t\t\t\tsimplefilter (Actions.ignore, __kwargtrans__ ({category: cls}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t__pragma__ ('<use>' +\n\t\t\t\t\t\t're' +\n\t\t\t\t\t'</use>')\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.ActionSet = ActionSet;\n\t\t\t\t\t\t__all__.Actions = Actions;\n\t\t\t\t\t\t__all__.CategoryMap = CategoryMap;\n\t\t\t\t\t\t__all__.WarningMessage = WarningMessage;\n\t\t\t\t\t\t__all__._OptionError = _OptionError;\n\t\t\t\t\t\t__all__.__warningregistry__ = __warningregistry__;\n\t\t\t\t\t\t__all__._add_filter = _add_filter;\n\t\t\t\t\t\t__all__._checkCatMatch = _checkCatMatch;\n\t\t\t\t\t\t__all__._filters_mutated = _filters_mutated;\n\t\t\t\t\t\t__all__._filters_version = _filters_version;\n\t\t\t\t\t\t__all__._formatwarning = _formatwarning;\n\t\t\t\t\t\t__all__._formatwarnmsg = _formatwarnmsg;\n\t\t\t\t\t\t__all__._formatwarnmsg_impl = _formatwarnmsg_impl;\n\t\t\t\t\t\t__all__._getaction = _getaction;\n\t\t\t\t\t\t__all__._getcategory = _getcategory;\n\t\t\t\t\t\t__all__._processoptions = _processoptions;\n\t\t\t\t\t\t__all__._setoption = _setoption;\n\t\t\t\t\t\t__all__._showwarning = _showwarning;\n\t\t\t\t\t\t__all__._showwarnmsg = _showwarnmsg;\n\t\t\t\t\t\t__all__._showwarnmsg_impl = _showwarnmsg_impl;\n\t\t\t\t\t\t__all__._warnings_defaults = _warnings_defaults;\n\t\t\t\t\t\t__all__.addWarningCategory = addWarningCategory;\n\t\t\t\t\t\t__all__.catch_warnings = catch_warnings;\n\t\t\t\t\t\t__all__.cls = cls;\n\t\t\t\t\t\t__all__.defaultaction = defaultaction;\n\t\t\t\t\t\t__all__.filters = filters;\n\t\t\t\t\t\t__all__.filterwarnings = filterwarnings;\n\t\t\t\t\t\t__all__.formatwarning = formatwarning;\n\t\t\t\t\t\t__all__.onceregistry = onceregistry;\n\t\t\t\t\t\t__all__.resetwarnings = resetwarnings;\n\t\t\t\t\t\t__all__.setShowWarning = setShowWarning;\n\t\t\t\t\t\t__all__.setWarningOptions = setWarningOptions;\n\t\t\t\t\t\t__all__.showwarning = showwarning;\n\t\t\t\t\t\t__all__.silence = silence;\n\t\t\t\t\t\t__all__.simplefilter = simplefilter;\n\t\t\t\t\t\t__all__.warn_explicit = warn_explicit;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t(function () {\n\t\tvar audio = {};\n\t\tvar logging = {};\n\t\tvar math = {};\n\t\tvar random = {};\n\t\t__nest__ (logging, '', __init__ (__world__.logging));\n\t\t__nest__ (math, '', __init__ (__world__.math));\n\t\t__nest__ (random, '', __init__ (__world__.random));\n\t\t__nest__ (audio, '', __init__ (__world__.audio));\n\t\tvar three = __init__ (__world__.org.threejs);\n\t\tvar Keyboard = __init__ (__world__.controls).Keyboard;\n\t\tvar ControlAxis = __init__ (__world__.controls).ControlAxis;\n\t\tvar Ship = __init__ (__world__.units).Ship;\n\t\tvar Asteroid = __init__ (__world__.units).Asteroid;\n\t\tvar Bullet = __init__ (__world__.units).Bullet;\n\t\tvar wrap = __init__ (__world__.utils).wrap;\n\t\tvar now = __init__ (__world__.utils).now;\n\t\tvar FPSCounter = __init__ (__world__.utils).FPSCounter;\n\t\tvar coroutine = __init__ (__world__.utils).coroutine;\n\t\tvar clamp = __init__ (__world__.utils).clamp;\n\t\tvar set_limits = __init__ (__world__.utils).set_limits;\n\t\tvar DEBUG = true;\n\t\tvar logger = logging.getLogger ('root');\n\t\tlogger.addHandler (logging.StreamHandler ());\n\t\tif (DEBUG) {\n\t\t\tlogger.setLevel (logging.INFO);\n\t\t\tlogger.info ('====== debug logging on =====');\n\t\t}\n\t\tvar waiter = function () {\n\t\t\tvar args = tuple ([].slice.apply (arguments).slice (0));\n\t\t\treturn tuple ([true, args [0]]);\n\t\t};\n\t\tvar done = function () {\n\t\t\tvar args = tuple ([].slice.apply (arguments).slice (0));\n\t\t\tprint ('done at', args [0]);\n\t\t};\n\t\tvar hfov = function (vfov, w, h) {\n\t\t\treturn ;\n\t\t};\n\t\tvar Graphics = __class__ ('Graphics', [object], {\n\t\t\tget __init__ () {return __get__ (this, function (self, w, h, canvas, fov) {\n\t\t\t\tif (typeof fov == 'undefined' || (fov != null && fov .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar fov = 53.13;\n\t\t\t\t};\n\t\t\t\tself.width = float (w);\n\t\t\t\tself.height = float (h);\n\t\t\t\tself.scene = three.Scene ();\n\t\t\t\tself.camera = three.PerspectiveCamera (fov, self.width / self.height, 1, 500);\n\t\t\t\tself.vfov = math.radians (fov);\n\t\t\t\tself.hfov = 2 * math.atan (math.tan (math.radians (fov) / 2.0) * ((w / h) * 1.0));\n\t\t\t\tself.camera.position.set (0, 0, 80);\n\t\t\t\tself.camera.lookAt (self.scene.position);\n\t\t\t\tself.renderer = three.WebGLRenderer (dict ({'Antialias': true}));\n\t\t\t\tself.renderer.setSize (self.width, self.height);\n\t\t\t\tcanvas.appendChild (self.renderer.domElement);\n\t\t\t});},\n\t\t\tget render () {return __get__ (this, function (self) {\n\t\t\t\tself.renderer.render (self.scene, self.camera);\n\t\t\t});},\n\t\t\tget add () {return __get__ (this, function (self, item) {\n\t\t\t\tself.scene.add (item.geo);\n\t\t\t});},\n\t\t\tget extent () {return __get__ (this, function (self) {\n\t\t\t\tvar v_extent = math.tan (self.vfov / 2.0) * 80;\n\t\t\t\tvar h_extent = math.tan (self.hfov / 2.0) * 80;\n\t\t\t\treturn tuple ([h_extent, v_extent]);\n\t\t\t});}\n\t\t});\n\t\tvar Audio = __class__ ('Audio', [object], {\n\t\t\tget __init__ () {return __get__ (this, function (self, audio_path) {\n\t\t\t\tif (typeof audio_path == 'undefined' || (audio_path != null && audio_path .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar audio_path = '';\n\t\t\t\t};\n\t\t\t\tvar pth = (function __lambda__ (p) {\n\t\t\t\t\treturn audio_path + p;\n\t\t\t\t});\n\t\t\t\tself.fire_rota = list ([audio.clip (pth ('344276__nsstudios__laser3.wav')), audio.clip (pth ('344276__nsstudios__laser3.wav')), audio.clip (pth ('344276__nsstudios__laser3.wav')), audio.clip (pth ('344276__nsstudios__laser3.wav'))]);\n\t\t\t\tself.explosion_rota = list ([audio.clip (pth ('108641__juskiddink__nearby-explosion-with-debris.wav')), audio.clip (pth ('108641__juskiddink__nearby-explosion-with-debris.wav')), audio.clip (pth ('108641__juskiddink__nearby-explosion-with-debris.wav')), audio.clip (pth ('108641__juskiddink__nearby-explosion-with-debris.wav'))]);\n\t\t\t\tself.thrust = audio.loop (pth ('146770__qubodup__rocket-boost-engine-loop.wav'));\n\t\t\t\tself.fail = audio.clip (pth ('172950__notr__saddertrombones.mp3'));\n\t\t\t\tself.thrust.play ();\n\t\t\t\tself.shoot_ctr = 0;\n\t\t\t\tself.explode_ctr = 0;\n\t\t\t});},\n\t\t\tget fire () {return __get__ (this, function (self) {\n\t\t\t\tself.fire_rota [__mod__ (self.shoot_ctr, 4)].play ();\n\t\t\t\tself.shoot_ctr++;\n\t\t\t});},\n\t\t\tget explode () {return __get__ (this, function (self) {\n\t\t\t\tself.explosion_rota [__mod__ (self.shoot_ctr, 4)].play ();\n\t\t\t\tself.shoot_ctr++;\n\t\t\t});}\n\t\t});\n\t\tvar Game = __class__ ('Game', [object], {\n\t\t\tget __init__ () {return __get__ (this, function (self, canvas, fullscreen) {\n\t\t\t\tif (typeof fullscreen == 'undefined' || (fullscreen != null && fullscreen .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar fullscreen = true;\n\t\t\t\t};\n\t\t\t\tself.keyboard = Keyboard ();\n\t\t\t\tif (fullscreen) {\n\t\t\t\t\tself.graphics = Graphics (window.innerWidth, window.innerHeight, canvas);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.graphics = Graphics (canvas.offsetWidth, (3 * canvas.offsetWidth) / 4, canvas);\n\t\t\t\t}\n\t\t\t\tself.extents = self.graphics.extent ();\n\t\t\t\tset_limits (...self.extents);\n\t\t\t\tself.create_controls ();\n\t\t\t\tself.ship = null;\n\t\t\t\tself.bullets = list ([]);\n\t\t\t\tself.asteroids = list ([]);\n\t\t\t\tself.helptext = null;\n\t\t\t\tself.resetter = null;\n\t\t\t\tself.setup ();\n\t\t\t\tself.last_frame = now ();\n\t\t\t\tself.audio = Audio ();\n\t\t\t\tself.lives = 3;\n\t\t\t\tself.score = 0;\n\t\t\t\tself.score_display = document.getElementById ('score');\n\t\t\t\tself.fps_counter = FPSCounter (document.getElementById ('FPS'));\n\t\t\t\tvar v_center = canvas.offsetHeight / 3;\n\t\t\t\tvar title = document.getElementById ('game_over');\n\t\t\t\ttitle.style.top = v_center;\n\t\t\t\tvar hud = document.getElementById ('hud');\n\t\t\t\thud.style.width = canvas.offsetWidth;\n\t\t\t\thud.style.height = canvas.offsetHeight;\n\t\t\t\tvar frame = document.getElementById ('game_frame');\n\t\t\t\tframe.style.min_height = canvas.offsetHeight;\n\t\t\t});},\n\t\t\tget create_controls () {return __get__ (this, function (self) {\n\t\t\t\tself.keyboard.add_handler ('spin', ControlAxis ('ArrowRight', 'ArrowLeft', __kwargtrans__ ({attack: 1, decay: 0.6})));\n\t\t\t\tself.keyboard.add_handler ('thrust', ControlAxis ('ArrowUp', 'ArrowDown', __kwargtrans__ ({attack: 0.65, decay: 2.5, deadzone: 0.1})));\n\t\t\t\tself.keyboard.add_handler ('fire', ControlAxis (' ', 'None', __kwargtrans__ ({attack: 10})));\n\t\t\t\tdocument.onkeydown = self.keyboard.key_down;\n\t\t\t\tdocument.onkeyup = self.keyboard.key_up;\n\t\t\t\tvar suppress_scroll = function (e) {\n\t\t\t\t\tif (__in__ (e.keyCode, list ([32, 37, 38, 39, 40]))) {\n\t\t\t\t\t\te.preventDefault ();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\twindow.addEventListener ('keydown', suppress_scroll, false);\n\t\t\t});},\n\t\t\tget setup () {return __get__ (this, function (self) {\n\t\t\t\tself.ship = Ship (self.keyboard, self);\n\t\t\t\tself.graphics.add (self.ship);\n\t\t\t\tvar rsign = function () {\n\t\t\t\t\tif (random.random () < 0.5) {\n\t\t\t\t\t\treturn -(1);\n\t\t\t\t\t}\n\t\t\t\t\treturn 1;\n\t\t\t\t};\n\t\t\t\tfor (var a = 0; a < 8; a++) {\n\t\t\t\t\tvar x = (random.random () - 0.5) * 2;\n\t\t\t\t\tvar y = random.random () - 0.5;\n\t\t\t\t\tvar z = 0;\n\t\t\t\t\tvar offset = three.Vector3 (x, y, z);\n\t\t\t\t\toffset.normalize ();\n\t\t\t\t\tvar push = random.randint (20, 60);\n\t\t\t\t\tvar offset = offset.multiplyScalar (push);\n\t\t\t\t\tvar r = (random.random () + 1.0) * 2.5;\n\t\t\t\t\tvar asteroid = Asteroid (r, offset);\n\t\t\t\t\tvar mx = ((random.random () + random.random ()) + random.random (2)) - 2.0;\n\t\t\t\t\tvar my = ((random.random () + random.random ()) + random.random (2)) - 2.0;\n\t\t\t\t\tasteroid.momentum = three.Vector3 (mx, my, 0);\n\t\t\t\t\tself.graphics.add (asteroid);\n\t\t\t\t\tself.asteroids.append (asteroid);\n\t\t\t\t}\n\t\t\t\tfor (var b = 0; b < 8; b++) {\n\t\t\t\t\tvar bullet = Bullet ();\n\t\t\t\t\tself.graphics.add (bullet);\n\t\t\t\t\tself.bullets.append (bullet);\n\t\t\t\t}\n\t\t\t\tself.helptext = self.help_display ();\n\t\t\t});},\n\t\t\tget tick () {return __get__ (this, function (self) {\n\t\t\t\tif (len (self.asteroids) == 0 || self.lives < 1) {\n\t\t\t\t\tdocument.getElementById ('game_over').style.visibility = 'visible';\n\t\t\t\t\tdocument.getElementById ('credits').style.visibility = 'visible';\n\t\t\t\t\tdocument.getElementById ('game_canvas').style.cursor = 'auto';\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\trequestAnimationFrame (self.tick);\n\t\t\t\tvar t = now () - self.last_frame;\n\t\t\t\tself.fps_counter.py_update (t);\n\t\t\t\tself.keyboard.py_update (t);\n\t\t\t\tif (self.ship.visible) {\n\t\t\t\t\tself.handle_input (t);\n\t\t\t\t}\n\t\t\t\tvar dead = list ([]);\n\t\t\t\tfor (var b of self.bullets) {\n\t\t\t\t\tif (b.position.z < 1000) {\n\t\t\t\t\t\tfor (var a of self.asteroids) {\n\t\t\t\t\t\t\tif (a.bbox.contains (b.position)) {\n\t\t\t\t\t\t\t\tvar d = a.geo.position.distanceTo (b.position);\n\t\t\t\t\t\t\t\tif (d < a.radius) {\n\t\t\t\t\t\t\t\t\tb.reset ();\n\t\t\t\t\t\t\t\t\tdead.append (a);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (self.ship.visible) {\n\t\t\t\t\tfor (var a of self.asteroids) {\n\t\t\t\t\t\tif (a.bbox.contains (self.ship.position)) {\n\t\t\t\t\t\t\tvar d = a.geo.position.distanceTo (self.ship.position);\n\t\t\t\t\t\t\tif (d < a.radius + 0.5) {\n\t\t\t\t\t\t\t\tself.resetter = self.kill ();\n\t\t\t\t\t\t\t\tprint ('!!', self.resetter);\n\t\t\t\t\t\t\t\tdead.append (a);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.resetter.advance (t);\n\t\t\t\t}\n\t\t\t\tfor (var d of dead) {\n\t\t\t\t\tself.asteroids.remove (d);\n\t\t\t\t\tvar new_score = int (100 * d.radius);\n\t\t\t\t\tself.update_score (new_score);\n\t\t\t\t\td.geo.visible = false;\n\t\t\t\t\tif (d.radius > 1.5) {\n\t\t\t\t\t\tself.audio.explode ();\n\t\t\t\t\t\tvar new_asteroids = random.randint (2, 5);\n\t\t\t\t\t\tfor (var n = 0; n < new_asteroids; n++) {\n\t\t\t\t\t\t\tvar new_a = Asteroid ((d.radius + 1.0) / new_asteroids, d.position);\n\t\t\t\t\t\t\tvar mx = (random.random () - 0.5) * 6;\n\t\t\t\t\t\t\tvar my = (random.random () - 0.5) * 4;\n\t\t\t\t\t\t\tnew_a.momentum = three.Vector3 ().copy (d.momentum);\n\t\t\t\t\t\t\tnew_a.momentum.add (three.Vector3 (mx, my, 0));\n\t\t\t\t\t\t\tself.graphics.add (new_a);\n\t\t\t\t\t\t\tself.asteroids.append (new_a);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (var b of self.bullets) {\n\t\t\t\t\tb.py_update (t);\n\t\t\t\t}\n\t\t\t\tself.ship.py_update (t);\n\t\t\t\twrap (self.ship.geo);\n\t\t\t\tfor (var item of self.asteroids) {\n\t\t\t\t\titem.py_update (t);\n\t\t\t\t\twrap (item.geo);\n\t\t\t\t}\n\t\t\t\tif (self.resetter !== null) {\n\t\t\t\t\tself.resetter.advance (t);\n\t\t\t\t}\n\t\t\t\tif (self.helptext !== null) {\n\t\t\t\t\tself.helptext.advance (t);\n\t\t\t\t}\n\t\t\t\tself.graphics.render ();\n\t\t\t\tself.last_frame = now ();\n\t\t\t});},\n\t\t\tget handle_input () {return __get__ (this, function (self, t) {\n\t\t\t\tif (self.keyboard.get_axis ('fire') >= 1) {\n\t\t\t\t\tvar mo = three.Vector3 ().copy (self.ship.momentum).multiplyScalar (t);\n\t\t\t\t\tif (self.fire (self.ship.position, self.ship.heading, mo)) {\n\t\t\t\t\t\tself.audio.fire ();\n\t\t\t\t\t}\n\t\t\t\t\tself.keyboard.py_clear ('fire');\n\t\t\t\t}\n\t\t\t\tvar spin = self.keyboard.get_axis ('spin');\n\t\t\t\tself.ship.spin (spin * t);\n\t\t\t\tvar thrust = self.keyboard.get_axis ('thrust');\n\t\t\t\tself.audio.thrust.volume = clamp (thrust * 5, 0, 1);\n\t\t\t\tself.ship.thrust (thrust * t);\n\t\t\t});},\n\t\t\tget fire () {return __get__ (this, function (self, pos, vector, momentum, t) {\n\t\t\t\tfor (var each_bullet of self.bullets) {\n\t\t\t\t\tif (each_bullet.geo.position.z >= 1000) {\n\t\t\t\t\t\teach_bullet.geo.position.set (pos.x, pos.y, pos.z);\n\t\t\t\t\t\teach_bullet.vector = vector;\n\t\t\t\t\t\teach_bullet.lifespan = 0;\n\t\t\t\t\t\teach_bullet.momentum = three.Vector3 ().copy (momentum).multiplyScalar (0.66);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});},\n\t\t\tget kill () {return __get__ (this, function (self) {\n\t\t\t\tself.lives--;\n\t\t\t\tself.ship.momentum = three.Vector3 (0, 0, 0);\n\t\t\t\tself.ship.position = three.Vector3 (0, 0, 0);\n\t\t\t\tself.ship.geo.setRotationFromEuler (three.Euler (0, 0, 0));\n\t\t\t\tself.keyboard.py_clear ('spin');\n\t\t\t\tself.keyboard.py_clear ('thrust');\n\t\t\t\tself.keyboard.py_clear ('fire');\n\t\t\t\tself.ship.visible = false;\n\t\t\t\tself.audio.fail.play ();\n\t\t\t\tvar can_reappear = now () + 3.0;\n\t\t\t\tvar reappear = function (t) {\n\t\t\t\t\tif (now () < can_reappear) {\n\t\t\t\t\t\treturn tuple ([true, 'waiting']);\n\t\t\t\t\t}\n\t\t\t\t\tfor (var a of self.asteroids) {\n\t\t\t\t\t\tif (a.bbox.contains (self.ship.position)) {\n\t\t\t\t\t\t\treturn tuple ([true, \"can't spawn\"]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn tuple ([false, 'OK']);\n\t\t\t\t};\n\t\t\t\tvar clear_resetter = function () {\n\t\t\t\t\tself.ship.visible = true;\n\t\t\t\t\tself.resetter = null;\n\t\t\t\t};\n\t\t\t\tvar reset = coroutine (reappear, clear_resetter);\n\t\t\t\tpy_next (reset);\n\t\t\t\treturn reset;\n\t\t\t});},\n\t\t\tget help_display () {return __get__ (this, function (self) {\n\t\t\t\tvar messages = 3;\n\t\t\t\tvar repeats = 2;\n\t\t\t\tvar elapsed = 0;\n\t\t\t\tvar count = 0;\n\t\t\t\tvar period = 2.25;\n\t\t\t\tvar display_stuff = function (t) {\n\t\t\t\t\tif (count < messages * repeats) {\n\t\t\t\t\t\telapsed += t / period;\n\t\t\t\t\t\tcount = int (elapsed);\n\t\t\t\t\t\tvar lintime = __mod__ (elapsed, 1);\n\t\t\t\t\t\tvar opacity = math.pow (math.sin (lintime * 3.1415), 2);\n\t\t\t\t\t\tlogger.info (lintime);\n\t\t\t\t\t\tdocument.getElementById ('instructions{}'.format (__mod__ (count, 3))).style.opacity = opacity;\n\t\t\t\t\t\treturn tuple ([true, opacity]);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn tuple ([false, 'OK']);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tvar done = function () {\n\t\t\t\t\tdocument.getElementById ('instructions1').style.visiblity = 'hidden';\n\t\t\t\t};\n\t\t\t\tvar displayer = coroutine (display_stuff, done);\n\t\t\t\tpy_next (displayer);\n\t\t\t\tlogger.debug ('displayer', displayer);\n\t\t\t\treturn displayer;\n\t\t\t});},\n\t\t\tget update_score () {return __get__ (this, function (self, score) {\n\t\t\t\tself.score += score;\n\t\t\t\tself.score_display.innerHTML = self.score;\n\t\t\t\tprint (self.score, self.score_display);\n\t\t\t});}\n\t\t});\n\t\tvar canvas = document.getElementById ('game_canvas');\n\t\tvar game = Game (canvas, true);\n\t\tgame.tick ();\n\t\t__pragma__ ('<use>' +\n\t\t\t'audio' +\n\t\t\t'controls' +\n\t\t\t'logging' +\n\t\t\t'math' +\n\t\t\t'org.threejs' +\n\t\t\t'random' +\n\t\t\t'units' +\n\t\t\t'utils' +\n\t\t'</use>')\n\t\t__pragma__ ('<all>')\n\t\t\t__all__.Asteroid = Asteroid;\n\t\t\t__all__.Audio = Audio;\n\t\t\t__all__.Bullet = Bullet;\n\t\t\t__all__.ControlAxis = ControlAxis;\n\t\t\t__all__.DEBUG = DEBUG;\n\t\t\t__all__.FPSCounter = FPSCounter;\n\t\t\t__all__.Game = Game;\n\t\t\t__all__.Graphics = Graphics;\n\t\t\t__all__.Keyboard = Keyboard;\n\t\t\t__all__.Ship = Ship;\n\t\t\t__all__.canvas = canvas;\n\t\t\t__all__.clamp = clamp;\n\t\t\t__all__.coroutine = coroutine;\n\t\t\t__all__.done = done;\n\t\t\t__all__.game = game;\n\t\t\t__all__.hfov = hfov;\n\t\t\t__all__.logger = logger;\n\t\t\t__all__.now = now;\n\t\t\t__all__.set_limits = set_limits;\n\t\t\t__all__.waiter = waiter;\n\t\t\t__all__.wrap = wrap;\n\t\t__pragma__ ('</all>')\n\t}) ();\n return __all__;\n}", "title": "" }, { "docid": "39d664d4a84516e3e4609be8cb665311", "score": "0.54124117", "text": "function app () {\n var __symbols__ = ['__py3.6__', '__esv5__'];\n var __all__ = {};\n var __world__ = __all__;\n var __nest__ = function (headObject, tailNames, value) {\n var current = headObject;\n if (tailNames != '') {\n var tailChain = tailNames.split ('.');\n var firstNewIndex = tailChain.length;\n for (var index = 0; index < tailChain.length; index++) {\n if (!current.hasOwnProperty (tailChain [index])) {\n firstNewIndex = index;\n break;\n }\n current = current [tailChain [index]];\n }\n for (var index = firstNewIndex; index < tailChain.length; index++) {\n current [tailChain [index]] = {};\n current = current [tailChain [index]];\n }\n }\n for (var attrib in value) {\n current [attrib] = value [attrib];\n }\n };\n __all__.__nest__ = __nest__;\n var __init__ = function (module) {\n if (!module.__inited__) {\n module.__all__.__init__ (module.__all__);\n module.__inited__ = true;\n }\n return module.__all__;\n };\n __all__.__init__ = __init__;\n var __get__ = function (self, func, quotedFuncName) {\n if (self) {\n if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {\n if (quotedFuncName) {\n Object.defineProperty (self, quotedFuncName, {\n value: function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n },\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n };\n }\n else {\n return func;\n }\n }\n else {\n return func;\n }\n }\n __all__.__get__ = __get__;\n var __getcm__ = function (self, func, quotedFuncName) {\n if (self.hasOwnProperty ('__class__')) {\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self.__class__] .concat (args));\n };\n }\n else {\n return function () {\n var args = [] .slice.apply (arguments);\n return func.apply (null, [self] .concat (args));\n };\n }\n }\n __all__.__getcm__ = __getcm__;\n var __getsm__ = function (self, func, quotedFuncName) {\n return func;\n }\n __all__.__getsm__ = __getsm__;\n var py_metatype = {\n __name__: 'type',\n __bases__: [],\n __new__: function (meta, name, bases, attribs) {\n var cls = function () {\n var args = [] .slice.apply (arguments);\n return cls.__new__ (args);\n };\n for (var index = bases.length - 1; index >= 0; index--) {\n var base = bases [index];\n for (var attrib in base) {\n var descrip = Object.getOwnPropertyDescriptor (base, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n }\n cls.__metaclass__ = meta;\n cls.__name__ = name.startsWith ('py_') ? name.slice (3) : name;\n cls.__bases__ = bases;\n for (var attrib in attribs) {\n var descrip = Object.getOwnPropertyDescriptor (attribs, attrib);\n Object.defineProperty (cls, attrib, descrip);\n }\n return cls;\n }\n };\n py_metatype.__metaclass__ = py_metatype;\n __all__.py_metatype = py_metatype;\n var object = {\n __init__: function (self) {},\n __metaclass__: py_metatype,\n __name__: 'object',\n __bases__: [],\n __new__: function (args) {\n var instance = Object.create (this, {__class__: {value: this, enumerable: true}});\n this.__init__.apply (null, [instance] .concat (args));\n return instance;\n }\n };\n __all__.object = object;\n var __class__ = function (name, bases, attribs, meta) {\n if (meta === undefined) {\n meta = bases [0] .__metaclass__;\n }\n return meta.__new__ (meta, name, bases, attribs);\n }\n __all__.__class__ = __class__;\n var __pragma__ = function () {};\n __all__.__pragma__ = __pragma__;\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__base__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'org.transcrypt.__base__';\n\t\t\t\t\tvar __Envir__ = __class__ ('__Envir__', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.interpreter_name = 'python';\n\t\t\t\t\t\t\tself.transpiler_name = 'transcrypt';\n\t\t\t\t\t\t\tself.transpiler_version = '3.6.101';\n\t\t\t\t\t\t\tself.target_subdir = '__javascript__';\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __envir__ = __Envir__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.__Envir__ = __Envir__;\n\t\t\t\t\t\t__all__.__envir__ = __envir__;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n\t__nest__ (\n\t\t__all__,\n\t\t'org.transcrypt.__standard__', {\n\t\t\t__all__: {\n\t\t\t\t__inited__: false,\n\t\t\t\t__init__: function (__all__) {\n\t\t\t\t\tvar __name__ = 'org.transcrypt.__standard__';\n\t\t\t\t\tvar Exception = __class__ ('Exception', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar kwargs = dict ();\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tdefault: kwargs [__attrib0__] = __allkwargs0__ [__attrib0__];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdelete kwargs.__kwargtrans__;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.__args__ = args;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.stack = kwargs.error.stack;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.stack = 'No stack trace available';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn '{}{}'.format (self.__class__.__name__, repr (tuple (self.__args__)));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '{}()'.format (self.__class__.__name__);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget __str__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tif (len (self.__args__) > 1) {\n\t\t\t\t\t\t\t\treturn str (tuple (self.__args__));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (len (self.__args__)) {\n\t\t\t\t\t\t\t\treturn str (self.__args__ [0]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IterableError = __class__ ('IterableError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, \"Can't iterate over non-iterable\", __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar StopIteration = __class__ ('StopIteration', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, error) {\n\t\t\t\t\t\t\tException.__init__ (self, 'Iterator exhausted', __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar ValueError = __class__ ('ValueError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar KeyError = __class__ ('KeyError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AssertionError = __class__ ('AssertionError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tif (message) {\n\t\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tException.__init__ (self, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar NotImplementedError = __class__ ('NotImplementedError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar IndexError = __class__ ('IndexError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar AttributeError = __class__ ('AttributeError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar py_TypeError = __class__ ('py_TypeError', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self, message, error) {\n\t\t\t\t\t\t\tException.__init__ (self, message, __kwargtrans__ ({error: error}));\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar Warning = __class__ ('Warning', [Exception], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar UserWarning = __class__ ('UserWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar DeprecationWarning = __class__ ('DeprecationWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar RuntimeWarning = __class__ ('RuntimeWarning', [Warning], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t});\n\t\t\t\t\tvar __sort__ = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key) {\n\t\t\t\t\t\t\titerable.sort ((function __lambda__ (a, b) {\n\t\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'a': var a = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'b': var b = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (key (a) > key (b) ? 1 : -(1));\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\titerable.sort ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (reverse) {\n\t\t\t\t\t\t\titerable.reverse ();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar sorted = function (iterable, key, reverse) {\n\t\t\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar key = null;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (typeof reverse == 'undefined' || (reverse != null && reverse .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\t\t\tvar reverse = false;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\tcase 'iterable': var iterable = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'key': var key = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\tcase 'reverse': var reverse = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (py_typeof (iterable) == dict) {\n\t\t\t\t\t\t\tvar result = copy (iterable.py_keys ());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar result = copy (iterable);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__sort__ (result, key, reverse);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t\tvar map = function (func, iterable) {\n\t\t\t\t\t\treturn (function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tvar __iterable0__ = iterable;\n\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t__accu0__.append (func (item));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ();\n\t\t\t\t\t};\n\t\t\t\t\tvar filter = function (func, iterable) {\n\t\t\t\t\t\tif (func == null) {\n\t\t\t\t\t\t\tvar func = bool;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (function () {\n\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\tvar __iterable0__ = iterable;\n\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\tif (func (item)) {\n\t\t\t\t\t\t\t\t\t__accu0__.append (item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t}) ();\n\t\t\t\t\t};\n\t\t\t\t\tvar __Terminal__ = __class__ ('__Terminal__', [object], {\n\t\t\t\t\t\t__module__: __name__,\n\t\t\t\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tself.buffer = '';\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tself.element = document.getElementById ('__terminal__');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tself.element = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.style.overflowX = 'auto';\n\t\t\t\t\t\t\t\tself.element.style.boxSizing = 'border-box';\n\t\t\t\t\t\t\t\tself.element.style.padding = '5px';\n\t\t\t\t\t\t\t\tself.element.innerHTML = '_';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget print () {return __get__ (this, function (self) {\n\t\t\t\t\t\t\tvar sep = ' ';\n\t\t\t\t\t\t\tvar end = '\\n';\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'sep': var sep = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'end': var end = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvar args = tuple ([].slice.apply (arguments).slice (1, __ilastarg0__ + 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar args = tuple ();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.buffer = '{}{}{}'.format (self.buffer, sep.join ((function () {\n\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\tvar __iterable0__ = args;\n\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\t\t\tvar arg = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t}) ()), end).__getslice__ (-(4096), null, 1);\n\t\t\t\t\t\t\tif (self.element) {\n\t\t\t\t\t\t\t\tself.element.innerHTML = self.buffer.py_replace ('\\n', '<br>').py_replace (' ', '&nbsp');\n\t\t\t\t\t\t\t\tself.element.scrollTop = self.element.scrollHeight;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tconsole.log (sep.join ((function () {\n\t\t\t\t\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\t\t\t\t\tvar __iterable0__ = args;\n\t\t\t\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\t\t\t\tvar arg = __iterable0__ [__index0__];\n\t\t\t\t\t\t\t\t\t\t__accu0__.append (str (arg));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn __accu0__;\n\t\t\t\t\t\t\t\t}) ()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});},\n\t\t\t\t\t\tget input () {return __get__ (this, function (self, question) {\n\t\t\t\t\t\t\tif (arguments.length) {\n\t\t\t\t\t\t\t\tvar __ilastarg0__ = arguments.length - 1;\n\t\t\t\t\t\t\t\tif (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty (\"__kwargtrans__\")) {\n\t\t\t\t\t\t\t\t\tvar __allkwargs0__ = arguments [__ilastarg0__--];\n\t\t\t\t\t\t\t\t\tfor (var __attrib0__ in __allkwargs0__) {\n\t\t\t\t\t\t\t\t\t\tswitch (__attrib0__) {\n\t\t\t\t\t\t\t\t\t\t\tcase 'self': var self = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t\tcase 'question': var question = __allkwargs0__ [__attrib0__]; break;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tself.print ('{}'.format (question), __kwargtrans__ ({end: ''}));\n\t\t\t\t\t\t\tvar answer = window.prompt ('\\n'.join (self.buffer.py_split ('\\n').__getslice__ (-(16), null, 1)));\n\t\t\t\t\t\t\tself.print (answer);\n\t\t\t\t\t\t\treturn answer;\n\t\t\t\t\t\t});}\n\t\t\t\t\t});\n\t\t\t\t\tvar __terminal__ = __Terminal__ ();\n\t\t\t\t\t__pragma__ ('<all>')\n\t\t\t\t\t\t__all__.AssertionError = AssertionError;\n\t\t\t\t\t\t__all__.AttributeError = AttributeError;\n\t\t\t\t\t\t__all__.DeprecationWarning = DeprecationWarning;\n\t\t\t\t\t\t__all__.Exception = Exception;\n\t\t\t\t\t\t__all__.IndexError = IndexError;\n\t\t\t\t\t\t__all__.IterableError = IterableError;\n\t\t\t\t\t\t__all__.KeyError = KeyError;\n\t\t\t\t\t\t__all__.NotImplementedError = NotImplementedError;\n\t\t\t\t\t\t__all__.RuntimeWarning = RuntimeWarning;\n\t\t\t\t\t\t__all__.StopIteration = StopIteration;\n\t\t\t\t\t\t__all__.py_TypeError = py_TypeError;\n\t\t\t\t\t\t__all__.UserWarning = UserWarning;\n\t\t\t\t\t\t__all__.ValueError = ValueError;\n\t\t\t\t\t\t__all__.Warning = Warning;\n\t\t\t\t\t\t__all__.__Terminal__ = __Terminal__;\n\t\t\t\t\t\t__all__.__name__ = __name__;\n\t\t\t\t\t\t__all__.__sort__ = __sort__;\n\t\t\t\t\t\t__all__.__terminal__ = __terminal__;\n\t\t\t\t\t\t__all__.filter = filter;\n\t\t\t\t\t\t__all__.map = map;\n\t\t\t\t\t\t__all__.sorted = sorted;\n\t\t\t\t\t__pragma__ ('</all>')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\n var __call__ = function (/* <callee>, <this>, <params>* */) {\n var args = [] .slice.apply (arguments);\n if (typeof args [0] == 'object' && '__call__' in args [0]) {\n return args [0] .__call__ .apply (args [1], args.slice (2));\n }\n else {\n return args [0] .apply (args [1], args.slice (2));\n }\n };\n __all__.__call__ = __call__;\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__base__));\n var __envir__ = __all__.__envir__;\n __nest__ (__all__, '', __init__ (__all__.org.transcrypt.__standard__));\n var Exception = __all__.Exception;\n var IterableError = __all__.IterableError;\n var StopIteration = __all__.StopIteration;\n var ValueError = __all__.ValueError;\n var KeyError = __all__.KeyError;\n var AssertionError = __all__.AssertionError;\n var NotImplementedError = __all__.NotImplementedError;\n var IndexError = __all__.IndexError;\n var AttributeError = __all__.AttributeError;\n var py_TypeError = __all__.py_TypeError;\n var Warning = __all__.Warning;\n var UserWarning = __all__.UserWarning;\n var DeprecationWarning = __all__.DeprecationWarning;\n var RuntimeWarning = __all__.RuntimeWarning;\n var __sort__ = __all__.__sort__;\n var sorted = __all__.sorted;\n var map = __all__.map;\n var filter = __all__.filter;\n __all__.print = __all__.__terminal__.print;\n __all__.input = __all__.__terminal__.input;\n var __terminal__ = __all__.__terminal__;\n var print = __all__.print;\n var input = __all__.input;\n __envir__.executor_name = __envir__.transpiler_name;\n var __main__ = {__file__: ''};\n __all__.main = __main__;\n var __except__ = null;\n __all__.__except__ = __except__;\n var __kwargtrans__ = function (anObject) {\n anObject.__kwargtrans__ = null;\n anObject.constructor = Object;\n return anObject;\n }\n __all__.__kwargtrans__ = __kwargtrans__;\n var __globals__ = function (anObject) {\n if (isinstance (anObject, dict)) {\n return anObject;\n }\n else {\n return dict (anObject)\n }\n }\n __all__.__globals__ = __globals__\n var __super__ = function (aClass, methodName) {\n for (var index = 0; index < aClass.__bases__.length; index++) {\n var base = aClass.__bases__ [index];\n if (methodName in base) {\n return base [methodName];\n }\n }\n throw new Exception ('Superclass method not found');\n }\n __all__.__super__ = __super__\n var property = function (getter, setter) {\n if (!setter) {\n setter = function () {};\n }\n return {get: function () {return getter (this)}, set: function (value) {setter (this, value)}, enumerable: true};\n }\n __all__.property = property;\n var __setProperty__ = function (anObject, name, descriptor) {\n if (!anObject.hasOwnProperty (name)) {\n Object.defineProperty (anObject, name, descriptor);\n }\n }\n __all__.__setProperty__ = __setProperty__\n function assert (condition, message) {\n if (!condition) {\n throw AssertionError (message, new Error ());\n }\n }\n __all__.assert = assert;\n var __merge__ = function (object0, object1) {\n var result = {};\n for (var attrib in object0) {\n result [attrib] = object0 [attrib];\n }\n for (var attrib in object1) {\n result [attrib] = object1 [attrib];\n }\n return result;\n };\n __all__.__merge__ = __merge__;\n var dir = function (obj) {\n var aList = [];\n for (var aKey in obj) {\n aList.push (aKey.startsWith ('py_') ? aKey.slice (3) : aKey);\n }\n aList.sort ();\n return aList;\n };\n __all__.dir = dir;\n var setattr = function (obj, name, value) {\n obj [name] = value;\n };\n __all__.setattr = setattr;\n var getattr = function (obj, name) {\n return name in obj ? obj [name] : obj ['py_' + name];\n };\n __all__.getattr = getattr;\n var hasattr = function (obj, name) {\n try {\n return name in obj || 'py_' + name in obj;\n }\n catch (exception) {\n return false;\n }\n };\n __all__.hasattr = hasattr;\n var delattr = function (obj, name) {\n if (name in obj) {\n delete obj [name];\n }\n else {\n delete obj ['py_' + name];\n }\n };\n __all__.delattr = (delattr);\n var __in__ = function (element, container) {\n if (container === undefined || container === null) {\n return false;\n }\n if (container.__contains__ instanceof Function) {\n return container.__contains__ (element);\n }\n else {\n return (\n container.indexOf ?\n container.indexOf (element) > -1 :\n container.hasOwnProperty (element)\n );\n }\n };\n __all__.__in__ = __in__;\n var __specialattrib__ = function (attrib) {\n return (attrib.startswith ('__') && attrib.endswith ('__')) || attrib == 'constructor' || attrib.startswith ('py_');\n };\n __all__.__specialattrib__ = __specialattrib__;\n var len = function (anObject) {\n if (anObject === undefined || anObject === null) {\n return 0;\n }\n if (anObject.__len__ instanceof Function) {\n return anObject.__len__ ();\n }\n if (anObject.length !== undefined) {\n return anObject.length;\n }\n var length = 0;\n for (var attr in anObject) {\n if (!__specialattrib__ (attr)) {\n length++;\n }\n }\n return length;\n };\n __all__.len = len;\n function __i__ (any) {\n return py_typeof (any) == dict ? any.py_keys () : any;\n }\n function __k__ (keyed, key) {\n var result = keyed [key];\n if (typeof result == 'undefined') {\n if (keyed instanceof Array)\n if (key == +key && key >= 0 && keyed.length > key)\n return result;\n else\n throw IndexError (key, new Error());\n else\n throw KeyError (key, new Error());\n }\n return result;\n }\n function __t__ (target) {\n return (\n target === undefined || target === null ? false :\n ['boolean', 'number'] .indexOf (typeof target) >= 0 ? target :\n target.__bool__ instanceof Function ? (target.__bool__ () ? target : false) :\n target.__len__ instanceof Function ? (target.__len__ () !== 0 ? target : false) :\n target instanceof Function ? target :\n len (target) !== 0 ? target :\n false\n );\n }\n __all__.__t__ = __t__;\n var float = function (any) {\n if (any == 'inf') {\n return Infinity;\n }\n else if (any == '-inf') {\n return -Infinity;\n }\n else if (any == 'nan') {\n return NaN;\n }\n else if (isNaN (parseFloat (any))) {\n if (any === false) {\n return 0;\n }\n else if (any === true) {\n return 1;\n }\n else {\n throw ValueError (\"could not convert string to float: '\" + str(any) + \"'\", new Error ());\n }\n }\n else {\n return +any;\n }\n };\n float.__name__ = 'float';\n float.__bases__ = [object];\n __all__.float = float;\n var int = function (any) {\n return float (any) | 0\n };\n int.__name__ = 'int';\n int.__bases__ = [object];\n __all__.int = int;\n var bool = function (any) {\n return !!__t__ (any);\n };\n bool.__name__ = 'bool';\n bool.__bases__ = [int];\n __all__.bool = bool;\n var py_typeof = function (anObject) {\n var aType = typeof anObject;\n if (aType == 'object') {\n try {\n return '__class__' in anObject ? anObject.__class__ : object;\n }\n catch (exception) {\n return aType;\n }\n }\n else {\n return (\n aType == 'boolean' ? bool :\n aType == 'string' ? str :\n aType == 'number' ? (anObject % 1 == 0 ? int : float) :\n null\n );\n }\n };\n __all__.py_typeof = py_typeof;\n var issubclass = function (aClass, classinfo) {\n if (classinfo instanceof Array) {\n for (var index = 0; index < classinfo.length; index++) {\n var aClass2 = classinfo [index];\n if (issubclass (aClass, aClass2)) {\n return true;\n }\n }\n return false;\n }\n try {\n var aClass2 = aClass;\n if (aClass2 == classinfo) {\n return true;\n }\n else {\n var bases = [].slice.call (aClass2.__bases__);\n while (bases.length) {\n aClass2 = bases.shift ();\n if (aClass2 == classinfo) {\n return true;\n }\n if (aClass2.__bases__.length) {\n bases = [].slice.call (aClass2.__bases__).concat (bases);\n }\n }\n return false;\n }\n }\n catch (exception) {\n return aClass == classinfo || classinfo == object;\n }\n };\n __all__.issubclass = issubclass;\n var isinstance = function (anObject, classinfo) {\n try {\n return '__class__' in anObject ? issubclass (anObject.__class__, classinfo) : issubclass (py_typeof (anObject), classinfo);\n }\n catch (exception) {\n return issubclass (py_typeof (anObject), classinfo);\n }\n };\n __all__.isinstance = isinstance;\n var callable = function (anObject) {\n return anObject && typeof anObject == 'object' && '__call__' in anObject ? true : typeof anObject === 'function';\n };\n __all__.callable = callable;\n var repr = function (anObject) {\n try {\n return anObject.__repr__ ();\n }\n catch (exception) {\n try {\n return anObject.__str__ ();\n }\n catch (exception) {\n try {\n if (anObject == null) {\n return 'None';\n }\n else if (anObject.constructor == Object) {\n var result = '{';\n var comma = false;\n for (var attrib in anObject) {\n if (!__specialattrib__ (attrib)) {\n if (attrib.isnumeric ()) {\n var attribRepr = attrib;\n }\n else {\n var attribRepr = '\\'' + attrib + '\\'';\n }\n if (comma) {\n result += ', ';\n }\n else {\n comma = true;\n }\n result += attribRepr + ': ' + repr (anObject [attrib]);\n }\n }\n result += '}';\n return result;\n }\n else {\n return typeof anObject == 'boolean' ? anObject.toString () .capitalize () : anObject.toString ();\n }\n }\n catch (exception) {\n return '<object of type: ' + typeof anObject + '>';\n }\n }\n }\n };\n __all__.repr = repr;\n var chr = function (charCode) {\n return String.fromCharCode (charCode);\n };\n __all__.chr = chr;\n var ord = function (aChar) {\n return aChar.charCodeAt (0);\n };\n __all__.ord = ord;\n var max = function (nrOrSeq) {\n return arguments.length == 1 ? Math.max.apply (null, nrOrSeq) : Math.max.apply (null, arguments);\n };\n __all__.max = max;\n var min = function (nrOrSeq) {\n return arguments.length == 1 ? Math.min.apply (null, nrOrSeq) : Math.min.apply (null, arguments);\n };\n __all__.min = min;\n var abs = Math.abs;\n __all__.abs = abs;\n var round = function (number, ndigits) {\n if (ndigits) {\n var scale = Math.pow (10, ndigits);\n number *= scale;\n }\n var rounded = Math.round (number);\n if (rounded - number == 0.5 && rounded % 2) {\n rounded -= 1;\n }\n if (ndigits) {\n rounded /= scale;\n }\n return rounded;\n };\n __all__.round = round;\n function __jsUsePyNext__ () {\n try {\n var result = this.__next__ ();\n return {value: result, done: false};\n }\n catch (exception) {\n return {value: undefined, done: true};\n }\n }\n function __pyUseJsNext__ () {\n var result = this.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n function py_iter (iterable) {\n if (typeof iterable == 'string' || '__iter__' in iterable) {\n var result = iterable.__iter__ ();\n result.next = __jsUsePyNext__;\n }\n else if ('selector' in iterable) {\n var result = list (iterable) .__iter__ ();\n result.next = __jsUsePyNext__;\n }\n else if ('next' in iterable) {\n var result = iterable\n if (! ('__next__' in result)) {\n result.__next__ = __pyUseJsNext__;\n }\n }\n else if (Symbol.iterator in iterable) {\n var result = iterable [Symbol.iterator] ();\n result.__next__ = __pyUseJsNext__;\n }\n else {\n throw IterableError (new Error ());\n }\n result [Symbol.iterator] = function () {return result;};\n return result;\n }\n function py_next (iterator) {\n try {\n var result = iterator.__next__ ();\n }\n catch (exception) {\n var result = iterator.next ();\n if (result.done) {\n throw StopIteration (new Error ());\n }\n else {\n return result.value;\n }\n }\n if (result == undefined) {\n throw StopIteration (new Error ());\n }\n else {\n return result;\n }\n }\n function __PyIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n __PyIterator__.prototype.__next__ = function () {\n if (this.index < this.iterable.length) {\n return this.iterable [this.index++];\n }\n else {\n throw StopIteration (new Error ());\n }\n };\n function __JsIterator__ (iterable) {\n this.iterable = iterable;\n this.index = 0;\n }\n __JsIterator__.prototype.next = function () {\n if (this.index < this.iterable.py_keys.length) {\n return {value: this.index++, done: false};\n }\n else {\n return {value: undefined, done: true};\n }\n };\n var py_reversed = function (iterable) {\n iterable = iterable.slice ();\n iterable.reverse ();\n return iterable;\n };\n __all__.py_reversed = py_reversed;\n var zip = function () {\n var args = [] .slice.call (arguments);\n for (var i = 0; i < args.length; i++) {\n if (typeof args [i] == 'string') {\n args [i] = args [i] .split ('');\n }\n else if (!Array.isArray (args [i])) {\n args [i] = Array.from (args [i]);\n }\n }\n var shortest = args.length == 0 ? [] : args.reduce (\n function (array0, array1) {\n return array0.length < array1.length ? array0 : array1;\n }\n );\n return shortest.map (\n function (current, index) {\n return args.map (\n function (current) {\n return current [index];\n }\n );\n }\n );\n };\n __all__.zip = zip;\n function range (start, stop, step) {\n if (stop == undefined) {\n stop = start;\n start = 0;\n }\n if (step == undefined) {\n step = 1;\n }\n if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {\n return [];\n }\n var result = [];\n for (var i = start; step > 0 ? i < stop : i > stop; i += step) {\n result.push(i);\n }\n return result;\n };\n __all__.range = range;\n function any (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n if (bool (iterable [index])) {\n return true;\n }\n }\n return false;\n }\n function all (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n if (! bool (iterable [index])) {\n return false;\n }\n }\n return true;\n }\n function sum (iterable) {\n var result = 0;\n for (var index = 0; index < iterable.length; index++) {\n result += iterable [index];\n }\n return result;\n }\n __all__.any = any;\n __all__.all = all;\n __all__.sum = sum;\n function enumerate (iterable) {\n return zip (range (len (iterable)), iterable);\n }\n __all__.enumerate = enumerate;\n function copy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = anObject [attrib];\n }\n }\n return result;\n }\n }\n __all__.copy = copy;\n function deepcopy (anObject) {\n if (anObject == null || typeof anObject == \"object\") {\n return anObject;\n }\n else {\n var result = {};\n for (var attrib in obj) {\n if (anObject.hasOwnProperty (attrib)) {\n result [attrib] = deepcopy (anObject [attrib]);\n }\n }\n return result;\n }\n }\n __all__.deepcopy = deepcopy;\n function list (iterable) {\n var instance = iterable ? [] .slice.apply (iterable) : [];\n return instance;\n }\n __all__.list = list;\n Array.prototype.__class__ = list;\n list.__name__ = 'list';\n list.__bases__ = [object];\n Array.prototype.__iter__ = function () {return new __PyIterator__ (this);};\n Array.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n else if (stop > this.length) {\n stop = this.length;\n }\n var result = list ([]);\n for (var index = start; index < stop; index += step) {\n result.push (this [index]);\n }\n return result;\n };\n Array.prototype.__setslice__ = function (start, stop, step, source) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n if (step == null) {\n Array.prototype.splice.apply (this, [start, stop - start] .concat (source));\n }\n else {\n var sourceIndex = 0;\n for (var targetIndex = start; targetIndex < stop; targetIndex += step) {\n this [targetIndex] = source [sourceIndex++];\n }\n }\n };\n Array.prototype.__repr__ = function () {\n if (this.__class__ == set && !this.length) {\n return 'set()';\n }\n var result = !this.__class__ || this.__class__ == list ? '[' : this.__class__ == tuple ? '(' : '{';\n for (var index = 0; index < this.length; index++) {\n if (index) {\n result += ', ';\n }\n result += repr (this [index]);\n }\n if (this.__class__ == tuple && this.length == 1) {\n result += ',';\n }\n result += !this.__class__ || this.__class__ == list ? ']' : this.__class__ == tuple ? ')' : '}';;\n return result;\n };\n Array.prototype.__str__ = Array.prototype.__repr__;\n Array.prototype.append = function (element) {\n this.push (element);\n };\n Array.prototype.py_clear = function () {\n this.length = 0;\n };\n Array.prototype.extend = function (aList) {\n this.push.apply (this, aList);\n };\n Array.prototype.insert = function (index, element) {\n this.splice (index, 0, element);\n };\n Array.prototype.remove = function (element) {\n var index = this.indexOf (element);\n if (index == -1) {\n throw ValueError (\"list.remove(x): x not in list\", new Error ());\n }\n this.splice (index, 1);\n };\n Array.prototype.index = function (element) {\n return this.indexOf (element);\n };\n Array.prototype.py_pop = function (index) {\n if (index == undefined) {\n return this.pop ();\n }\n else {\n return this.splice (index, 1) [0];\n }\n };\n Array.prototype.py_sort = function () {\n __sort__.apply (null, [this].concat ([] .slice.apply (arguments)));\n };\n Array.prototype.__add__ = function (aList) {\n return list (this.concat (aList));\n };\n Array.prototype.__mul__ = function (scalar) {\n var result = this;\n for (var i = 1; i < scalar; i++) {\n result = result.concat (this);\n }\n return result;\n };\n Array.prototype.__rmul__ = Array.prototype.__mul__;\n function tuple (iterable) {\n var instance = iterable ? [] .slice.apply (iterable) : [];\n instance.__class__ = tuple;\n return instance;\n }\n __all__.tuple = tuple;\n tuple.__name__ = 'tuple';\n tuple.__bases__ = [object];\n function set (iterable) {\n var instance = [];\n if (iterable) {\n for (var index = 0; index < iterable.length; index++) {\n instance.add (iterable [index]);\n }\n }\n instance.__class__ = set;\n return instance;\n }\n __all__.set = set;\n set.__name__ = 'set';\n set.__bases__ = [object];\n Array.prototype.__bindexOf__ = function (element) {\n element += '';\n var mindex = 0;\n var maxdex = this.length - 1;\n while (mindex <= maxdex) {\n var index = (mindex + maxdex) / 2 | 0;\n var middle = this [index] + '';\n if (middle < element) {\n mindex = index + 1;\n }\n else if (middle > element) {\n maxdex = index - 1;\n }\n else {\n return index;\n }\n }\n return -1;\n };\n Array.prototype.add = function (element) {\n if (this.indexOf (element) == -1) {\n this.push (element);\n }\n };\n Array.prototype.discard = function (element) {\n var index = this.indexOf (element);\n if (index != -1) {\n this.splice (index, 1);\n }\n };\n Array.prototype.isdisjoint = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.issuperset = function (other) {\n this.sort ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) == -1) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.issubset = function (other) {\n return set (other.slice ()) .issuperset (this);\n };\n Array.prototype.union = function (other) {\n var result = set (this.slice () .sort ());\n for (var i = 0; i < other.length; i++) {\n if (result.__bindexOf__ (other [i]) == -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n Array.prototype.intersection = function (other) {\n this.sort ();\n var result = set ();\n for (var i = 0; i < other.length; i++) {\n if (this.__bindexOf__ (other [i]) != -1) {\n result.push (other [i]);\n }\n }\n return result;\n };\n Array.prototype.difference = function (other) {\n var sother = set (other.slice () .sort ());\n var result = set ();\n for (var i = 0; i < this.length; i++) {\n if (sother.__bindexOf__ (this [i]) == -1) {\n result.push (this [i]);\n }\n }\n return result;\n };\n Array.prototype.symmetric_difference = function (other) {\n return this.union (other) .difference (this.intersection (other));\n };\n Array.prototype.py_update = function () {\n var updated = [] .concat.apply (this.slice (), arguments) .sort ();\n this.py_clear ();\n for (var i = 0; i < updated.length; i++) {\n if (updated [i] != updated [i - 1]) {\n this.push (updated [i]);\n }\n }\n };\n Array.prototype.__eq__ = function (other) {\n if (this.length != other.length) {\n return false;\n }\n if (this.__class__ == set) {\n this.sort ();\n other.sort ();\n }\n for (var i = 0; i < this.length; i++) {\n if (this [i] != other [i]) {\n return false;\n }\n }\n return true;\n };\n Array.prototype.__ne__ = function (other) {\n return !this.__eq__ (other);\n };\n Array.prototype.__le__ = function (other) {\n return this.issubset (other);\n };\n Array.prototype.__ge__ = function (other) {\n return this.issuperset (other);\n };\n Array.prototype.__lt__ = function (other) {\n return this.issubset (other) && !this.issuperset (other);\n };\n Array.prototype.__gt__ = function (other) {\n return this.issuperset (other) && !this.issubset (other);\n };\n function bytearray (bytable, encoding) {\n if (bytable == undefined) {\n return new Uint8Array (0);\n }\n else {\n var aType = py_typeof (bytable);\n if (aType == int) {\n return new Uint8Array (bytable);\n }\n else if (aType == str) {\n var aBytes = new Uint8Array (len (bytable));\n for (var i = 0; i < len (bytable); i++) {\n aBytes [i] = bytable.charCodeAt (i);\n }\n return aBytes;\n }\n else if (aType == list || aType == tuple) {\n return new Uint8Array (bytable);\n }\n else {\n throw py_TypeError;\n }\n }\n }\n var bytes = bytearray;\n __all__.bytearray = bytearray;\n __all__.bytes = bytearray;\n Uint8Array.prototype.__add__ = function (aBytes) {\n var result = new Uint8Array (this.length + aBytes.length);\n result.set (this);\n result.set (aBytes, this.length);\n return result;\n };\n Uint8Array.prototype.__mul__ = function (scalar) {\n var result = new Uint8Array (scalar * this.length);\n for (var i = 0; i < scalar; i++) {\n result.set (this, i * this.length);\n }\n return result;\n };\n Uint8Array.prototype.__rmul__ = Uint8Array.prototype.__mul__;\n function str (stringable) {\n if (typeof stringable === 'number')\n return stringable.toString();\n else {\n try {\n return stringable.__str__ ();\n }\n catch (exception) {\n try {\n return repr (stringable);\n }\n catch (exception) {\n return String (stringable);\n }\n }\n }\n };\n __all__.str = str;\n String.prototype.__class__ = str;\n str.__name__ = 'str';\n str.__bases__ = [object];\n String.prototype.__iter__ = function () {new __PyIterator__ (this);};\n String.prototype.__repr__ = function () {\n return (this.indexOf ('\\'') == -1 ? '\\'' + this + '\\'' : '\"' + this + '\"') .py_replace ('\\t', '\\\\t') .py_replace ('\\n', '\\\\n');\n };\n String.prototype.__str__ = function () {\n return this;\n };\n String.prototype.capitalize = function () {\n return this.charAt (0).toUpperCase () + this.slice (1);\n };\n String.prototype.endswith = function (suffix) {\n if (suffix instanceof Array) {\n for (var i=0;i<suffix.length;i++) {\n if (this.slice (-suffix[i].length) == suffix[i])\n return true;\n }\n } else\n return suffix == '' || this.slice (-suffix.length) == suffix;\n return false;\n };\n String.prototype.find = function (sub, start) {\n return this.indexOf (sub, start);\n };\n String.prototype.__getslice__ = function (start, stop, step) {\n if (start < 0) {\n start = this.length + start;\n }\n if (stop == null) {\n stop = this.length;\n }\n else if (stop < 0) {\n stop = this.length + stop;\n }\n var result = '';\n if (step == 1) {\n result = this.substring (start, stop);\n }\n else {\n for (var index = start; index < stop; index += step) {\n result = result.concat (this.charAt(index));\n }\n }\n return result;\n };\n __setProperty__ (String.prototype, 'format', {\n get: function () {return __get__ (this, function (self) {\n var args = tuple ([] .slice.apply (arguments).slice (1));\n var autoIndex = 0;\n return self.replace (/\\{(\\w*)\\}/g, function (match, key) {\n if (key == '') {\n key = autoIndex++;\n }\n if (key == +key) {\n return args [key] == undefined ? match : str (args [key]);\n }\n else {\n for (var index = 0; index < args.length; index++) {\n if (typeof args [index] == 'object' && args [index][key] != undefined) {\n return str (args [index][key]);\n }\n }\n return match;\n }\n });\n });},\n enumerable: true\n });\n String.prototype.isalnum = function () {\n return /^[0-9a-zA-Z]{1,}$/.test(this)\n }\n String.prototype.isalpha = function () {\n return /^[a-zA-Z]{1,}$/.test(this)\n }\n String.prototype.isdecimal = function () {\n return /^[0-9]{1,}$/.test(this)\n }\n String.prototype.isdigit = function () {\n return this.isdecimal()\n }\n String.prototype.islower = function () {\n return /^[a-z]{1,}$/.test(this)\n }\n String.prototype.isupper = function () {\n return /^[A-Z]{1,}$/.test(this)\n }\n String.prototype.isspace = function () {\n return /^[\\s]{1,}$/.test(this)\n }\n String.prototype.isnumeric = function () {\n return !isNaN (parseFloat (this)) && isFinite (this);\n };\n String.prototype.join = function (strings) {\n return strings.join (this);\n };\n String.prototype.lower = function () {\n return this.toLowerCase ();\n };\n String.prototype.py_replace = function (old, aNew, maxreplace) {\n return this.split (old, maxreplace) .join (aNew);\n };\n String.prototype.lstrip = function () {\n return this.replace (/^\\s*/g, '');\n };\n String.prototype.rfind = function (sub, start) {\n return this.lastIndexOf (sub, start);\n };\n String.prototype.rsplit = function (sep, maxsplit) {\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n var maxrsplit = result.length - maxsplit;\n return [result.slice (0, maxrsplit) .join (sep)] .concat (result.slice (maxrsplit));\n }\n else {\n return result;\n }\n }\n };\n String.prototype.rstrip = function () {\n return this.replace (/\\s*$/g, '');\n };\n String.prototype.py_split = function (sep, maxsplit) {\n if (sep == undefined || sep == null) {\n sep = /\\s+/;\n var stripped = this.strip ();\n }\n else {\n var stripped = this;\n }\n if (maxsplit == undefined || maxsplit == -1) {\n return stripped.split (sep);\n }\n else {\n var result = stripped.split (sep);\n if (maxsplit < result.length) {\n return result.slice (0, maxsplit).concat ([result.slice (maxsplit).join (sep)]);\n }\n else {\n return result;\n }\n }\n };\n String.prototype.startswith = function (prefix) {\n if (prefix instanceof Array) {\n for (var i=0;i<prefix.length;i++) {\n if (this.indexOf (prefix [i]) == 0)\n return true;\n }\n } else\n return this.indexOf (prefix) == 0;\n return false;\n };\n String.prototype.strip = function () {\n return this.trim ();\n };\n String.prototype.upper = function () {\n return this.toUpperCase ();\n };\n String.prototype.__mul__ = function (scalar) {\n var result = '';\n for (var i = 0; i < scalar; i++) {\n result = result + this;\n }\n return result;\n };\n String.prototype.__rmul__ = String.prototype.__mul__;\n function __contains__ (element) {\n return this.hasOwnProperty (element);\n }\n function __keys__ () {\n var keys = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n keys.push (attrib);\n }\n }\n return keys;\n }\n function __items__ () {\n var items = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n items.push ([attrib, this [attrib]]);\n }\n }\n return items;\n }\n function __del__ (key) {\n delete this [key];\n }\n function __clear__ () {\n for (var attrib in this) {\n delete this [attrib];\n }\n }\n function __getdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result == undefined) {\n result = this ['py_' + aKey]\n }\n return result == undefined ? (aDefault == undefined ? null : aDefault) : result;\n }\n function __setdefault__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n return result;\n }\n var val = aDefault == undefined ? null : aDefault;\n this [aKey] = val;\n return val;\n }\n function __pop__ (aKey, aDefault) {\n var result = this [aKey];\n if (result != undefined) {\n delete this [aKey];\n return result;\n } else {\n if ( aDefault === undefined ) {\n throw KeyError (aKey, new Error());\n }\n }\n return aDefault;\n }\n function __popitem__ () {\n var aKey = Object.keys (this) [0];\n if (aKey == null) {\n throw KeyError (\"popitem(): dictionary is empty\", new Error ());\n }\n var result = tuple ([aKey, this [aKey]]);\n delete this [aKey];\n return result;\n }\n function __update__ (aDict) {\n for (var aKey in aDict) {\n this [aKey] = aDict [aKey];\n }\n }\n function __values__ () {\n var values = [];\n for (var attrib in this) {\n if (!__specialattrib__ (attrib)) {\n values.push (this [attrib]);\n }\n }\n return values;\n }\n function __dgetitem__ (aKey) {\n return this [aKey];\n }\n function __dsetitem__ (aKey, aValue) {\n this [aKey] = aValue;\n }\n function dict (objectOrPairs) {\n var instance = {};\n if (!objectOrPairs || objectOrPairs instanceof Array) {\n if (objectOrPairs) {\n for (var index = 0; index < objectOrPairs.length; index++) {\n var pair = objectOrPairs [index];\n if ( !(pair instanceof Array) || pair.length != 2) {\n throw ValueError(\n \"dict update sequence element #\" + index +\n \" has length \" + pair.length +\n \"; 2 is required\", new Error());\n }\n var key = pair [0];\n var val = pair [1];\n if (!(objectOrPairs instanceof Array) && objectOrPairs instanceof Object) {\n if (!isinstance (objectOrPairs, dict)) {\n val = dict (val);\n }\n }\n instance [key] = val;\n }\n }\n }\n else {\n if (isinstance (objectOrPairs, dict)) {\n var aKeys = objectOrPairs.py_keys ();\n for (var index = 0; index < aKeys.length; index++ ) {\n var key = aKeys [index];\n instance [key] = objectOrPairs [key];\n }\n } else if (objectOrPairs instanceof Object) {\n instance = objectOrPairs;\n } else {\n throw ValueError (\"Invalid type of object for dict creation\", new Error ());\n }\n }\n __setProperty__ (instance, '__class__', {value: dict, enumerable: false, writable: true});\n __setProperty__ (instance, '__contains__', {value: __contains__, enumerable: false});\n __setProperty__ (instance, 'py_keys', {value: __keys__, enumerable: false});\n __setProperty__ (instance, '__iter__', {value: function () {new __PyIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, Symbol.iterator, {value: function () {new __JsIterator__ (this.py_keys ());}, enumerable: false});\n __setProperty__ (instance, 'py_items', {value: __items__, enumerable: false});\n __setProperty__ (instance, 'py_del', {value: __del__, enumerable: false});\n __setProperty__ (instance, 'py_clear', {value: __clear__, enumerable: false});\n __setProperty__ (instance, 'py_get', {value: __getdefault__, enumerable: false});\n __setProperty__ (instance, 'py_setdefault', {value: __setdefault__, enumerable: false});\n __setProperty__ (instance, 'py_pop', {value: __pop__, enumerable: false});\n __setProperty__ (instance, 'py_popitem', {value: __popitem__, enumerable: false});\n __setProperty__ (instance, 'py_update', {value: __update__, enumerable: false});\n __setProperty__ (instance, 'py_values', {value: __values__, enumerable: false});\n __setProperty__ (instance, '__getitem__', {value: __dgetitem__, enumerable: false});\n __setProperty__ (instance, '__setitem__', {value: __dsetitem__, enumerable: false});\n return instance;\n }\n __all__.dict = dict;\n dict.__name__ = 'dict';\n dict.__bases__ = [object];\n function __setdoc__ (docString) {\n this.__doc__ = docString;\n return this;\n }\n __setProperty__ (Function.prototype, '__setdoc__', {value: __setdoc__, enumerable: false});\n var __jsmod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.__jsmod__ = __jsmod__;\n var __mod__ = function (a, b) {\n if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.mod = __mod__;\n var __pow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.pow = __pow__;\n var __neg__ = function (a) {\n if (typeof a == 'object' && '__neg__' in a) {\n return a.__neg__ ();\n }\n else {\n return -a;\n }\n };\n __all__.__neg__ = __neg__;\n var __matmul__ = function (a, b) {\n return a.__matmul__ (b);\n };\n __all__.__matmul__ = __matmul__;\n var __mul__ = function (a, b) {\n if (typeof a == 'object' && '__mul__' in a) {\n return a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return b.__rmul__ (a);\n }\n else {\n return a * b;\n }\n };\n __all__.__mul__ = __mul__;\n var __truediv__ = function (a, b) {\n if (typeof a == 'object' && '__truediv__' in a) {\n return a.__truediv__ (b);\n }\n else if (typeof b == 'object' && '__rtruediv__' in b) {\n return b.__rtruediv__ (a);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return a / b;\n }\n };\n __all__.__truediv__ = __truediv__;\n var __floordiv__ = function (a, b) {\n if (typeof a == 'object' && '__floordiv__' in a) {\n return a.__floordiv__ (b);\n }\n else if (typeof b == 'object' && '__rfloordiv__' in b) {\n return b.__rfloordiv__ (a);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return b.__rdiv__ (a);\n }\n else {\n return Math.floor (a / b);\n }\n };\n __all__.__floordiv__ = __floordiv__;\n var __add__ = function (a, b) {\n if (typeof a == 'object' && '__add__' in a) {\n return a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return b.__radd__ (a);\n }\n else {\n return a + b;\n }\n };\n __all__.__add__ = __add__;\n var __sub__ = function (a, b) {\n if (typeof a == 'object' && '__sub__' in a) {\n return a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return b.__rsub__ (a);\n }\n else {\n return a - b;\n }\n };\n __all__.__sub__ = __sub__;\n var __lshift__ = function (a, b) {\n if (typeof a == 'object' && '__lshift__' in a) {\n return a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return b.__rlshift__ (a);\n }\n else {\n return a << b;\n }\n };\n __all__.__lshift__ = __lshift__;\n var __rshift__ = function (a, b) {\n if (typeof a == 'object' && '__rshift__' in a) {\n return a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return b.__rrshift__ (a);\n }\n else {\n return a >> b;\n }\n };\n __all__.__rshift__ = __rshift__;\n var __or__ = function (a, b) {\n if (typeof a == 'object' && '__or__' in a) {\n return a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return b.__ror__ (a);\n }\n else {\n return a | b;\n }\n };\n __all__.__or__ = __or__;\n var __xor__ = function (a, b) {\n if (typeof a == 'object' && '__xor__' in a) {\n return a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return b.__rxor__ (a);\n }\n else {\n return a ^ b;\n }\n };\n __all__.__xor__ = __xor__;\n var __and__ = function (a, b) {\n if (typeof a == 'object' && '__and__' in a) {\n return a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return b.__rand__ (a);\n }\n else {\n return a & b;\n }\n };\n __all__.__and__ = __and__;\n var __eq__ = function (a, b) {\n if (typeof a == 'object' && '__eq__' in a) {\n return a.__eq__ (b);\n }\n else {\n return a == b;\n }\n };\n __all__.__eq__ = __eq__;\n var __ne__ = function (a, b) {\n if (typeof a == 'object' && '__ne__' in a) {\n return a.__ne__ (b);\n }\n else {\n return a != b\n }\n };\n __all__.__ne__ = __ne__;\n var __lt__ = function (a, b) {\n if (typeof a == 'object' && '__lt__' in a) {\n return a.__lt__ (b);\n }\n else {\n return a < b;\n }\n };\n __all__.__lt__ = __lt__;\n var __le__ = function (a, b) {\n if (typeof a == 'object' && '__le__' in a) {\n return a.__le__ (b);\n }\n else {\n return a <= b;\n }\n };\n __all__.__le__ = __le__;\n var __gt__ = function (a, b) {\n if (typeof a == 'object' && '__gt__' in a) {\n return a.__gt__ (b);\n }\n else {\n return a > b;\n }\n };\n __all__.__gt__ = __gt__;\n var __ge__ = function (a, b) {\n if (typeof a == 'object' && '__ge__' in a) {\n return a.__ge__ (b);\n }\n else {\n return a >= b;\n }\n };\n __all__.__ge__ = __ge__;\n var __imatmul__ = function (a, b) {\n if ('__imatmul__' in a) {\n return a.__imatmul__ (b);\n }\n else {\n return a.__matmul__ (b);\n }\n };\n __all__.__imatmul__ = __imatmul__;\n var __ipow__ = function (a, b) {\n if (typeof a == 'object' && '__pow__' in a) {\n return a.__ipow__ (b);\n }\n else if (typeof a == 'object' && '__ipow__' in a) {\n return a.__pow__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rpow__ (a);\n }\n else {\n return Math.pow (a, b);\n }\n };\n __all__.ipow = __ipow__;\n var __ijsmod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__ismod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rpow__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return a % b;\n }\n };\n __all__.ijsmod__ = __ijsmod__;\n var __imod__ = function (a, b) {\n if (typeof a == 'object' && '__imod__' in a) {\n return a.__imod__ (b);\n }\n else if (typeof a == 'object' && '__mod__' in a) {\n return a.__mod__ (b);\n }\n else if (typeof b == 'object' && '__rmod__' in b) {\n return b.__rmod__ (a);\n }\n else {\n return ((a % b) + b) % b;\n }\n };\n __all__.imod = __imod__;\n var __imul__ = function (a, b) {\n if (typeof a == 'object' && '__imul__' in a) {\n return a.__imul__ (b);\n }\n else if (typeof a == 'object' && '__mul__' in a) {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'object' && '__rmul__' in b) {\n return a = b.__rmul__ (a);\n }\n else if (typeof a == 'string') {\n return a = a.__mul__ (b);\n }\n else if (typeof b == 'string') {\n return a = b.__rmul__ (a);\n }\n else {\n return a *= b;\n }\n };\n __all__.__imul__ = __imul__;\n var __idiv__ = function (a, b) {\n if (typeof a == 'object' && '__idiv__' in a) {\n return a.__idiv__ (b);\n }\n else if (typeof a == 'object' && '__div__' in a) {\n return a = a.__div__ (b);\n }\n else if (typeof b == 'object' && '__rdiv__' in b) {\n return a = b.__rdiv__ (a);\n }\n else {\n return a /= b;\n }\n };\n __all__.__idiv__ = __idiv__;\n var __iadd__ = function (a, b) {\n if (typeof a == 'object' && '__iadd__' in a) {\n return a.__iadd__ (b);\n }\n else if (typeof a == 'object' && '__add__' in a) {\n return a = a.__add__ (b);\n }\n else if (typeof b == 'object' && '__radd__' in b) {\n return a = b.__radd__ (a);\n }\n else {\n return a += b;\n }\n };\n __all__.__iadd__ = __iadd__;\n var __isub__ = function (a, b) {\n if (typeof a == 'object' && '__isub__' in a) {\n return a.__isub__ (b);\n }\n else if (typeof a == 'object' && '__sub__' in a) {\n return a = a.__sub__ (b);\n }\n else if (typeof b == 'object' && '__rsub__' in b) {\n return a = b.__rsub__ (a);\n }\n else {\n return a -= b;\n }\n };\n __all__.__isub__ = __isub__;\n var __ilshift__ = function (a, b) {\n if (typeof a == 'object' && '__ilshift__' in a) {\n return a.__ilshift__ (b);\n }\n else if (typeof a == 'object' && '__lshift__' in a) {\n return a = a.__lshift__ (b);\n }\n else if (typeof b == 'object' && '__rlshift__' in b) {\n return a = b.__rlshift__ (a);\n }\n else {\n return a <<= b;\n }\n };\n __all__.__ilshift__ = __ilshift__;\n var __irshift__ = function (a, b) {\n if (typeof a == 'object' && '__irshift__' in a) {\n return a.__irshift__ (b);\n }\n else if (typeof a == 'object' && '__rshift__' in a) {\n return a = a.__rshift__ (b);\n }\n else if (typeof b == 'object' && '__rrshift__' in b) {\n return a = b.__rrshift__ (a);\n }\n else {\n return a >>= b;\n }\n };\n __all__.__irshift__ = __irshift__;\n var __ior__ = function (a, b) {\n if (typeof a == 'object' && '__ior__' in a) {\n return a.__ior__ (b);\n }\n else if (typeof a == 'object' && '__or__' in a) {\n return a = a.__or__ (b);\n }\n else if (typeof b == 'object' && '__ror__' in b) {\n return a = b.__ror__ (a);\n }\n else {\n return a |= b;\n }\n };\n __all__.__ior__ = __ior__;\n var __ixor__ = function (a, b) {\n if (typeof a == 'object' && '__ixor__' in a) {\n return a.__ixor__ (b);\n }\n else if (typeof a == 'object' && '__xor__' in a) {\n return a = a.__xor__ (b);\n }\n else if (typeof b == 'object' && '__rxor__' in b) {\n return a = b.__rxor__ (a);\n }\n else {\n return a ^= b;\n }\n };\n __all__.__ixor__ = __ixor__;\n var __iand__ = function (a, b) {\n if (typeof a == 'object' && '__iand__' in a) {\n return a.__iand__ (b);\n }\n else if (typeof a == 'object' && '__and__' in a) {\n return a = a.__and__ (b);\n }\n else if (typeof b == 'object' && '__rand__' in b) {\n return a = b.__rand__ (a);\n }\n else {\n return a &= b;\n }\n };\n __all__.__iand__ = __iand__;\n var __getitem__ = function (container, key) {\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ (key);\n }\n else if ((typeof container == 'string' || container instanceof Array) && key < 0) {\n return container [container.length + key];\n }\n else {\n return container [key];\n }\n };\n __all__.__getitem__ = __getitem__;\n var __setitem__ = function (container, key, value) {\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ (key, value);\n }\n else if ((typeof container == 'string' || container instanceof Array) && key < 0) {\n container [container.length + key] = value;\n }\n else {\n container [key] = value;\n }\n };\n __all__.__setitem__ = __setitem__;\n var __getslice__ = function (container, lower, upper, step) {\n if (typeof container == 'object' && '__getitem__' in container) {\n return container.__getitem__ ([lower, upper, step]);\n }\n else {\n return container.__getslice__ (lower, upper, step);\n }\n };\n __all__.__getslice__ = __getslice__;\n var __setslice__ = function (container, lower, upper, step, value) {\n if (typeof container == 'object' && '__setitem__' in container) {\n container.__setitem__ ([lower, upper, step], value);\n }\n else {\n container.__setslice__ (lower, upper, step, value);\n }\n };\n __all__.__setslice__ = __setslice__;\n\t(function () {\n\t\tvar __name__ = '__main__';\n\t\tvar MAX_CONTENT_LENGTH = 1000;\n\t\tvar MAX_LINE_LENGTH = 500;\n\t\tvar MATE_SCORE = 10000;\n\t\tvar MATE_LIMIT = MATE_SCORE * 0.9;\n\t\tvar WINNING_MOVE_LIMIT = 1000;\n\t\tvar DOUBLE_EXCLAM_LIMIT = 500;\n\t\tvar EXCLAM_LIMIT = 350;\n\t\tvar PROMISING_LIMIT = 250;\n\t\tvar INTERESTING_LIMIT = 150;\n\t\tvar DRAWISH_LIMIT = 80;\n\t\tvar LICH_API_GAMES_EXPORT = 'games/export';\n\t\tvar uci_variant_to_variantkey = function (uci_variant, chess960) {\n\t\t\tif (typeof chess960 == 'undefined' || (chess960 != null && chess960 .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar chess960 = false;\n\t\t\t};\n\t\t\tif (uci_variant == 'chess') {\n\t\t\t\tif (chess960) {\n\t\t\t\t\treturn 'chess960';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn 'standard';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (uci_variant == 'giveaway') {\n\t\t\t\treturn 'antichess';\n\t\t\t}\n\t\t\tif (uci_variant == 'kingofthehill') {\n\t\t\t\treturn 'kingOfTheHill';\n\t\t\t}\n\t\t\tif (uci_variant == 'racingkings') {\n\t\t\t\treturn 'racingKings';\n\t\t\t}\n\t\t\tif (uci_variant == '3check') {\n\t\t\t\treturn 'threeCheck';\n\t\t\t}\n\t\t\treturn uci_variant;\n\t\t};\n\t\tvar scoreverbal = function (score) {\n\t\t\tif (abs (score) < MATE_LIMIT) {\n\t\t\t\treturn str (score);\n\t\t\t}\n\t\t\tif (score >= 0) {\n\t\t\t\treturn '#{}'.format (MATE_SCORE - score);\n\t\t\t}\n\t\t\treturn '#{}'.format (-(MATE_SCORE) - score);\n\t\t};\n\t\tvar scorecolor = function (score) {\n\t\t\tif (score > MATE_LIMIT) {\n\t\t\t\treturn '#0f0';\n\t\t\t}\n\t\t\tif (score > WINNING_MOVE_LIMIT) {\n\t\t\t\treturn '#0e0';\n\t\t\t}\n\t\t\tif (score > DOUBLE_EXCLAM_LIMIT) {\n\t\t\t\treturn '#0c0';\n\t\t\t}\n\t\t\tif (score > EXCLAM_LIMIT) {\n\t\t\t\treturn '#0a0';\n\t\t\t}\n\t\t\tif (score > PROMISING_LIMIT) {\n\t\t\t\treturn '#090';\n\t\t\t}\n\t\t\tif (score > INTERESTING_LIMIT) {\n\t\t\t\treturn '#070';\n\t\t\t}\n\t\t\tif (score > DRAWISH_LIMIT) {\n\t\t\t\treturn '#050';\n\t\t\t}\n\t\t\tif (score > 0) {\n\t\t\t\treturn '#033';\n\t\t\t}\n\t\t\tif (score > -(DRAWISH_LIMIT)) {\n\t\t\t\treturn '#330';\n\t\t\t}\n\t\t\tif (score > -(INTERESTING_LIMIT)) {\n\t\t\t\treturn '#500';\n\t\t\t}\n\t\t\tif (score > -(PROMISING_LIMIT)) {\n\t\t\t\treturn '#900';\n\t\t\t}\n\t\t\tif (score > -(EXCLAM_LIMIT)) {\n\t\t\t\treturn '#a00';\n\t\t\t}\n\t\t\tif (score > -(DOUBLE_EXCLAM_LIMIT)) {\n\t\t\t\treturn '#c00';\n\t\t\t}\n\t\t\tif (score > WINNING_MOVE_LIMIT) {\n\t\t\t\treturn '#e00';\n\t\t\t}\n\t\t\treturn '#f00';\n\t\t};\n\t\tvar View = __class__ ('View', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, callback, value) {\n\t\t\t\tif (typeof value == 'undefined' || (value != null && value .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar value = null;\n\t\t\t\t};\n\t\t\t\tself.callback = callback;\n\t\t\t\tself.value = value;\n\t\t\t});},\n\t\t\tget py_get () {return __get__ (this, function (self) {\n\t\t\t\treturn self.value;\n\t\t\t});},\n\t\t\tget set () {return __get__ (this, function (self, value) {\n\t\t\t\tself.value = value;\n\t\t\t\tself.callback ();\n\t\t\t});}\n\t\t});\n\t\tvar xor = function (b1, b2) {\n\t\t\tif (b1 && b2) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (b1 || b2) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t\tvar cpick = function (cond, vtrue, vfalse) {\n\t\t\tif (cond) {\n\t\t\t\treturn vtrue;\n\t\t\t}\n\t\t\treturn vfalse;\n\t\t};\n\t\tvar simulateserverlag = function (range, min_lag) {\n\t\t\tif (typeof range == 'undefined' || (range != null && range .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar range = 1000;\n\t\t\t};\n\t\t\tif (typeof min_lag == 'undefined' || (min_lag != null && min_lag .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar min_lag = 10;\n\t\t\t};\n\t\t\tif (__in__ ('localhost', window.location.host)) {\n\t\t\t\treturn int (min_lag + Math.random () * range);\n\t\t\t}\n\t\t\treturn min_lag;\n\t\t};\n\t\tvar choose = function (cond, choicetrue, choicefalse) {\n\t\t\tif (cond) {\n\t\t\t\treturn choicetrue;\n\t\t\t}\n\t\t\treturn choicefalse;\n\t\t};\n\t\tvar Vect = __class__ ('Vect', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, x, y) {\n\t\t\t\ttry {\n\t\t\t\t\tself.x = float (x);\n\t\t\t\t\tself.y = float (y);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tself.x = 0.0;\n\t\t\t\t\tself.y = 0.0;\n\t\t\t\t\tprint ('vect init failed on', x, y);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget p () {return __get__ (this, function (self, v) {\n\t\t\t\treturn Vect (self.x + v.x, self.y + v.y);\n\t\t\t});},\n\t\t\tget s () {return __get__ (this, function (self, s) {\n\t\t\t\treturn Vect (self.x * s, self.y * s);\n\t\t\t});},\n\t\t\tget m () {return __get__ (this, function (self, v) {\n\t\t\t\treturn self.p (v.s (-(1)));\n\t\t\t});},\n\t\t\tget copy () {return __get__ (this, function (self) {\n\t\t\t\treturn Vect (self.x, self.y);\n\t\t\t});},\n\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\treturn 'Vect[x: {}, y: {}]'.format (self.x, self.y);\n\t\t\t});}\n\t\t});\n\t\tvar getClientVect = function (ev) {\n\t\t\treturn Vect (ev.clientX, ev.clientY);\n\t\t};\n\t\tvar getglobalcssvar = function (key) {\n\t\t\treturn getComputedStyle (window.document.documentElement).getPropertyValue (key);\n\t\t};\n\t\tvar getglobalcssvarpxint = function (key, py_default) {\n\t\t\ttry {\n\t\t\t\tvar px = getglobalcssvar (key);\n\t\t\t\tvar pxint = int (px.py_replace ('px', ''));\n\t\t\t\treturn pxint;\n\t\t\t}\n\t\t\tcatch (__except0__) {\n\t\t\t\treturn py_default;\n\t\t\t}\n\t\t};\n\t\tvar striplonglines = function (content, maxlen) {\n\t\t\tif (typeof maxlen == 'undefined' || (maxlen != null && maxlen .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar maxlen = MAX_LINE_LENGTH;\n\t\t\t};\n\t\t\tvar lines = content.py_split ('\\n');\n\t\t\tvar strippedlines = list ([]);\n\t\t\tvar __iterable0__ = lines;\n\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\tvar line = __iterable0__ [__index0__];\n\t\t\t\tif (len (line) > maxlen) {\n\t\t\t\t\tvar sline = '{} ... [ truncated {} characters ]'.format (line.substring (0, maxlen), len (line) - maxlen);\n\t\t\t\t\tstrippedlines.append (sline);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tstrippedlines.append (line);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar content = '\\n'.join (strippedlines);\n\t\t\treturn content;\n\t\t};\n\t\tvar getScrollBarWidth = function () {\n\t\t\tvar outer = document.createElement ('div');\n\t\t\touter.style.visibility = 'hidden';\n\t\t\touter.style.width = '100px';\n\t\t\touter.style.msOverflowStyle = 'scrollbar';\n\t\t\tdocument.body.appendChild (outer);\n\t\t\tvar widthNoScroll = outer.offsetWidth;\n\t\t\touter.style.overflow = 'scroll';\n\t\t\tvar inner = document.createElement ('div');\n\t\t\tinner.style.width = '100%';\n\t\t\touter.appendChild (inner);\n\t\t\tvar widthWithScroll = inner.offsetWidth;\n\t\t\touter.parentNode.removeChild (outer);\n\t\t\treturn widthNoScroll - widthWithScroll;\n\t\t};\n\t\tvar randint = function (range) {\n\t\t\treturn int (Math.random () * range);\n\t\t};\n\t\tvar randscalarvalue = function (baselen, pluslen) {\n\t\t\tvar len = baselen + randint (pluslen);\n\t\t\tvar buff = '';\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tif (__mod__ (i, 2) == 1) {\n\t\t\t\t\tbuff += list (['a', 'e', 'i', 'o', 'u']) [randint (5)];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbuff += list (['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']) [randint (21)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buff;\n\t\t};\n\t\tvar uid = function () {\n\t\t\tvar uid = randscalarvalue (8, 0);\n\t\t\treturn uid;\n\t\t};\n\t\tvar getfromobj = function (obj, key, py_default) {\n\t\t\tif (__in__ (key, obj)) {\n\t\t\t\treturn obj [key];\n\t\t\t}\n\t\t\treturn py_default;\n\t\t};\n\t\tvar patchclasses = function (selfref, args) {\n\t\t\tvar py_items = args.py_get ('patchclasses', list ([]));\n\t\t\tvar __iterable0__ = py_items;\n\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\tvar parts = item.py_split ('/');\n\t\t\t\tvar membername = parts [0];\n\t\t\t\tvar action = parts [1];\n\t\t\t\tvar classname = parts [2];\n\t\t\t\tif (action == 'a') {\n\t\t\t\t\tselfref [membername].ac (classname);\n\t\t\t\t}\n\t\t\t\telse if (action == 'r') {\n\t\t\t\t\tselfref [membername].rc (classname);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tvar parsejson = function (jsonstr, callback, errcallback) {\n\t\t\ttry {\n\t\t\t\tvar obj = JSON.parse (jsonstr);\n\t\t\t\tcallback (obj);\n\t\t\t}\n\t\t\tcatch (__except0__) {\n\t\t\t\terrcallback ('error parsing json');\n\t\t\t}\n\t\t};\n\t\tvar putjsonbin = function (json, id, callback, errcallback) {\n\t\t\tvar method = 'POST';\n\t\t\tvar url = 'https://api.jsonbin.io/b';\n\t\t\tif (id == 'local') {\n\t\t\t\t// pass;\n\t\t\t}\n\t\t\telse if (!(id === null)) {\n\t\t\t\tvar url = (url + '/') + id;\n\t\t\t\tvar method = 'PUT';\n\t\t\t}\n\t\t\tvar args = {'method': method, 'headers': {'Content-Type': 'application/json', 'private': false}, 'body': json};\n\t\t\tfetch (url, args).then ((function __lambda__ (response) {\n\t\t\t\treturn response.text ().then ((function __lambda__ (content) {\n\t\t\t\t\treturn callback (content);\n\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\treturn errcallback (err);\n\t\t\t\t}));\n\t\t\t}), (function __lambda__ (err) {\n\t\t\t\treturn errcallback (err);\n\t\t\t}));\n\t\t};\n\t\tvar getjsonbin = function (id, callback, errcallback, version) {\n\t\t\tif (typeof version == 'undefined' || (version != null && version .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar version = 'latest';\n\t\t\t};\n\t\t\tvar args = {'method': 'GET', 'headers': {'Content-Type': 'application/json', 'private': false}};\n\t\t\tfetch ((('https://api.jsonbin.io/b/' + id) + '/') + version, args).then ((function __lambda__ (response) {\n\t\t\t\treturn response.text ().then ((function __lambda__ (content) {\n\t\t\t\t\treturn callback (content);\n\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\treturn errcalback (err);\n\t\t\t\t}));\n\t\t\t}), (function __lambda__ (err) {\n\t\t\t\treturn errcallback (err);\n\t\t\t}));\n\t\t};\n\t\tvar getjson = function (path, callback, errcallback) {\n\t\t\tvar args = {'method': 'GET', 'headers': {'Content-Type': 'application/json'}};\n\t\t\tfetch (path, args).then ((function __lambda__ (response) {\n\t\t\t\treturn response.text ().then ((function __lambda__ (content) {\n\t\t\t\t\treturn parsejson (content, callback, errcallback);\n\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\treturn errcalback (err);\n\t\t\t\t}));\n\t\t\t}), (function __lambda__ (err) {\n\t\t\t\treturn errcallback (err);\n\t\t\t}));\n\t\t};\n\t\tvar lichapiget = function (path, token, callback, errcallback) {\n\t\t\tvar args = {'method': 'GET'};\n\t\t\tif (!(token === null) && false) {\n\t\t\t\targs ['headers'] = {'Authorization': 'Bearer {}'.format (token)};\n\t\t\t}\n\t\t\tfetch ('https://lichess.org/' + path, args).then ((function __lambda__ (response) {\n\t\t\t\treturn response.text ().then ((function __lambda__ (content) {\n\t\t\t\t\treturn callback (content);\n\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\treturn errcalback (err);\n\t\t\t\t}));\n\t\t\t}), (function __lambda__ (err) {\n\t\t\t\treturn errcallback (err);\n\t\t\t}));\n\t\t};\n\t\tvar SCROLL_BAR_WIDTH = getScrollBarWidth ();\n\t\tvar ce = function (tag) {\n\t\t\treturn document.createElement (tag);\n\t\t};\n\t\tvar ge = function (id) {\n\t\t\treturn document.getElementById (id);\n\t\t};\n\t\tvar addEventListener = function (object, kind, callback) {\n\t\t\tobject.addEventListener (kind, callback, false);\n\t\t};\n\t\tvar e = __class__ ('e', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, tag) {\n\t\t\t\tself.e = ce (tag);\n\t\t\t});},\n\t\t\tget bc () {return __get__ (this, function (self, color) {\n\t\t\t\tself.e.style.backgroundColor = color;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget cp () {return __get__ (this, function (self) {\n\t\t\t\tself.e.style.cursor = 'pointer';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget cbc () {return __get__ (this, function (self, cond, colortrue, colorfalse) {\n\t\t\t\tself.e.style.backgroundColor = cpick (cond, colortrue, colorfalse);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget c () {return __get__ (this, function (self, color) {\n\t\t\t\tself.e.style.color = color;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget cc () {return __get__ (this, function (self, cond, colortrue, colorfalse) {\n\t\t\t\tself.e.style.color = cpick (cond, colortrue, colorfalse);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget zi () {return __get__ (this, function (self, zindex) {\n\t\t\t\tself.e.style.zIndex = zindex;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget op () {return __get__ (this, function (self, opacity) {\n\t\t\t\tself.e.style.opacity = opacity;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ms () {return __get__ (this, function (self) {\n\t\t\t\tself.e.style.fontFamily = 'monospace';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget a () {return __get__ (this, function (self, e) {\n\t\t\t\tself.e.appendChild (e.e);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget aa () {return __get__ (this, function (self, es) {\n\t\t\t\tvar __iterable0__ = es;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar e = __iterable0__ [__index0__];\n\t\t\t\t\tself.a (e);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget sa () {return __get__ (this, function (self, key, value) {\n\t\t\t\tself.e.setAttribute (key, value);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ra () {return __get__ (this, function (self, key) {\n\t\t\t\tself.e.removeAttribute (key);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget srac () {return __get__ (this, function (self, cond, key, value) {\n\t\t\t\tif (cond) {\n\t\t\t\t\tself.sa (key, value);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.ra (key);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget ga () {return __get__ (this, function (self, key) {\n\t\t\t\treturn self.e.getAttribute (key);\n\t\t\t});},\n\t\t\tget sv () {return __get__ (this, function (self, value) {\n\t\t\t\tself.e.value = value;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget html () {return __get__ (this, function (self, value) {\n\t\t\t\tself.e.innerHTML = value;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget x () {return __get__ (this, function (self) {\n\t\t\t\twhile (self.e.firstChild) {\n\t\t\t\t\tself.e.removeChild (self.e.firstChild);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget w () {return __get__ (this, function (self, w) {\n\t\t\t\tself.e.style.width = w + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget mw () {return __get__ (this, function (self, w) {\n\t\t\t\tself.e.style.minWidth = w + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget h () {return __get__ (this, function (self, h) {\n\t\t\t\tself.e.style.height = h + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget mh () {return __get__ (this, function (self, h) {\n\t\t\t\tself.e.style.minHeight = h + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget t () {return __get__ (this, function (self, t) {\n\t\t\t\tself.e.style.top = t + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget l () {return __get__ (this, function (self, l) {\n\t\t\t\tself.e.style.left = l + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget cl () {return __get__ (this, function (self, cond, ltrue, lfalse) {\n\t\t\t\tself.e.style.left = cpick (cond, ltrue, lfalse) + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ct () {return __get__ (this, function (self, cond, ttrue, tfalse) {\n\t\t\t\tself.e.style.top = cpick (cond, ttrue, tfalse) + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget pv () {return __get__ (this, function (self, v) {\n\t\t\t\treturn self.l (v.x).t (v.y);\n\t\t\t});},\n\t\t\tget pa () {return __get__ (this, function (self) {\n\t\t\t\tself.e.style.position = 'absolute';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget pr () {return __get__ (this, function (self) {\n\t\t\t\tself.e.style.position = 'relative';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ml () {return __get__ (this, function (self, ml) {\n\t\t\t\tself.e.style.marginLeft = ml + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget mr () {return __get__ (this, function (self, mr) {\n\t\t\t\tself.e.style.marginRight = mr + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget mt () {return __get__ (this, function (self, mt) {\n\t\t\t\tself.e.style.marginTop = mt + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget mb () {return __get__ (this, function (self, mb) {\n\t\t\t\tself.e.style.marginBottom = mb + 'px';\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ac () {return __get__ (this, function (self, klass) {\n\t\t\t\tself.e.classList.add (klass);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget acc () {return __get__ (this, function (self, cond, klass) {\n\t\t\t\tif (cond) {\n\t\t\t\t\tself.e.classList.add (klass);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget aac () {return __get__ (this, function (self, klasses) {\n\t\t\t\tvar __iterable0__ = klasses;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar klass = __iterable0__ [__index0__];\n\t\t\t\t\tself.e.classList.add (klass);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget rc () {return __get__ (this, function (self, klass) {\n\t\t\t\tself.e.classList.remove (klass);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget arc () {return __get__ (this, function (self, cond, klass) {\n\t\t\t\tif (cond) {\n\t\t\t\t\tself.e.classList.add (klass);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.e.classList.remove (klass);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget v () {return __get__ (this, function (self) {\n\t\t\t\treturn self.e.value;\n\t\t\t});},\n\t\t\tget focusme () {return __get__ (this, function (self) {\n\t\t\t\tself.e.focus ();\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget fl () {return __get__ (this, function (self) {\n\t\t\t\tsetTimeout (self.focusme, 50);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget ae () {return __get__ (this, function (self, kind, callback) {\n\t\t\t\tself.e.addEventListener (kind, callback);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget aef () {return __get__ (this, function (self, kind, callback) {\n\t\t\t\tself.e.addEventListener (kind, callback, false);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget disable () {return __get__ (this, function (self) {\n\t\t\t\treturn self.sa ('disabled', true);\n\t\t\t});},\n\t\t\tget enable () {return __get__ (this, function (self) {\n\t\t\t\treturn self.ra ('disabled');\n\t\t\t});},\n\t\t\tget able () {return __get__ (this, function (self, able) {\n\t\t\t\tif (able) {\n\t\t\t\t\treturn self.enable ();\n\t\t\t\t}\n\t\t\t\treturn self.disable ();\n\t\t\t});},\n\t\t\tget fs () {return __get__ (this, function (self, size) {\n\t\t\t\tself.e.style.fontSize = size + 'px';\n\t\t\t\treturn self;\n\t\t\t});}\n\t\t});\n\t\tvar Div = __class__ ('Div', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Div, '__init__') (self, 'div');\n\t\t\t});}\n\t\t});\n\t\tvar Span = __class__ ('Span', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Span, '__init__') (self, 'span');\n\t\t\t});}\n\t\t});\n\t\tvar Input = __class__ ('Input', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, kind) {\n\t\t\t\t__super__ (Input, '__init__') (self, 'input');\n\t\t\t\tself.sa ('type', kind);\n\t\t\t});}\n\t\t});\n\t\tvar Select = __class__ ('Select', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Select, '__init__') (self, 'select');\n\t\t\t});}\n\t\t});\n\t\tvar Option = __class__ ('Option', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, key, displayname, selected) {\n\t\t\t\tif (typeof selected == 'undefined' || (selected != null && selected .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar selected = false;\n\t\t\t\t};\n\t\t\t\t__super__ (Option, '__init__') (self, 'option');\n\t\t\t\tself.sa ('name', key);\n\t\t\t\tself.sa ('id', key);\n\t\t\t\tself.sv (key);\n\t\t\t\tself.html (displayname);\n\t\t\t\tif (selected) {\n\t\t\t\t\tself.sa ('selected', true);\n\t\t\t\t}\n\t\t\t});}\n\t\t});\n\t\tvar Slider = __class__ ('Slider', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget setmin () {return __get__ (this, function (self, min) {\n\t\t\t\tself.sa ('min', min);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setmax () {return __get__ (this, function (self, max) {\n\t\t\t\tself.sa ('max', max);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Slider, '__init__') (self, 'range');\n\t\t\t});}\n\t\t});\n\t\tvar CheckBox = __class__ ('CheckBox', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget setchecked () {return __get__ (this, function (self, checked) {\n\t\t\t\tself.e.checked = checked;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getchecked () {return __get__ (this, function (self) {\n\t\t\t\treturn self.e.checked;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, checked) {\n\t\t\t\tif (typeof checked == 'undefined' || (checked != null && checked .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar checked = false;\n\t\t\t\t};\n\t\t\t\t__super__ (CheckBox, '__init__') (self, 'checkbox');\n\t\t\t\tself.setchecked (checked);\n\t\t\t});}\n\t\t});\n\t\tvar TextArea = __class__ ('TextArea', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (TextArea, '__init__') (self, 'textarea');\n\t\t\t});},\n\t\t\tget setText () {return __get__ (this, function (self, content) {\n\t\t\t\tself.sv (content);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getText () {return __get__ (this, function (self) {\n\t\t\t\treturn self.v ();\n\t\t\t});}\n\t\t});\n\t\tvar Canvas = __class__ ('Canvas', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, width, height) {\n\t\t\t\t__super__ (Canvas, '__init__') (self, 'canvas');\n\t\t\t\tself.width = width;\n\t\t\t\tself.height = height;\n\t\t\t\tself.sa ('width', self.width);\n\t\t\t\tself.sa ('height', self.height);\n\t\t\t\tself.ctx = self.e.getContext ('2d');\n\t\t\t});},\n\t\t\tget lineWidth () {return __get__ (this, function (self, linewidth) {\n\t\t\t\tself.ctx.lineWidth = linewidth;\n\t\t\t});},\n\t\t\tget strokeStyle () {return __get__ (this, function (self, strokestyle) {\n\t\t\t\tself.ctx.strokeStyle = strokestyle;\n\t\t\t});},\n\t\t\tget fillStyle () {return __get__ (this, function (self, fillstyle) {\n\t\t\t\tself.ctx.fillStyle = fillstyle;\n\t\t\t});},\n\t\t\tget fillRect () {return __get__ (this, function (self, tlv, brv) {\n\t\t\t\tself.ctx.fillRect (tlv.x, tlv.y, brv.m (tlv).x, brv.m (tlv).y);\n\t\t\t});},\n\t\t\tget py_clear () {return __get__ (this, function (self) {\n\t\t\t\tself.ctx.clearRect (0, 0, self.width, self.height);\n\t\t\t});},\n\t\t\tget drawline () {return __get__ (this, function (self, fromv, tov) {\n\t\t\t\tself.ctx.beginPath ();\n\t\t\t\tself.ctx.moveTo (fromv.x, fromv.y);\n\t\t\t\tself.ctx.lineTo (tov.x, tov.y);\n\t\t\t\tself.ctx.stroke ();\n\t\t\t});}\n\t\t});\n\t\tvar Form = __class__ ('Form', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Form, '__init__') (self, 'form');\n\t\t\t});}\n\t\t});\n\t\tvar P = __class__ ('P', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (P, '__init__') (self, 'p');\n\t\t\t});}\n\t\t});\n\t\tvar Label = __class__ ('Label', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (Label, '__init__') (self, 'label');\n\t\t\t});}\n\t\t});\n\t\tvar FileInput = __class__ ('FileInput', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget setmultiple () {return __get__ (this, function (self, multiple) {\n\t\t\t\tself.srac (multiple, 'multiple', true);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getmultiple () {return __get__ (this, function (self) {\n\t\t\t\treturn self.ga ('multiple');\n\t\t\t});},\n\t\t\tget setaccept () {return __get__ (this, function (self, accept) {\n\t\t\t\treturn self.sa ('accept', accept);\n\t\t\t});},\n\t\t\tget getaccept () {return __get__ (this, function (self) {\n\t\t\t\treturn self.ga ('accept');\n\t\t\t});},\n\t\t\tget files () {return __get__ (this, function (self) {\n\t\t\t\treturn self.e.files;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (FileInput, '__init__') (self, 'file');\n\t\t\t});}\n\t\t});\n\t\tvar WINDOW_SAFETY_MARGIN = 10;\n\t\tvar Button = __class__ ('Button', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget clicked () {return __get__ (this, function (self) {\n\t\t\t\tself.callback (self.key);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, caption, callback, key) {\n\t\t\t\tif (typeof callback == 'undefined' || (callback != null && callback .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar callback = null;\n\t\t\t\t};\n\t\t\t\tif (typeof key == 'undefined' || (key != null && key .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar key = null;\n\t\t\t\t};\n\t\t\t\t__super__ (Button, '__init__') (self, 'button');\n\t\t\t\tself.sv (caption);\n\t\t\t\tif (!(callback === null)) {\n\t\t\t\t\tself.callback = callback;\n\t\t\t\t\tself.key = key;\n\t\t\t\t\tself.ae ('mousedown', self.clicked);\n\t\t\t\t}\n\t\t\t});}\n\t\t});\n\t\tvar RawTextInput = __class__ ('RawTextInput', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget keyup () {return __get__ (this, function (self, ev) {\n\t\t\t\tif (!(self.callback === null)) {\n\t\t\t\t\tif (ev.keyCode == 13) {\n\t\t\t\t\t\tif (!(self.entercallback === null)) {\n\t\t\t\t\t\t\tself.entercallback (self.v ());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (!(self.keycallback === null)) {\n\t\t\t\t\t\tself.keycallback (ev.keyCode, self.v ());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setText () {return __get__ (this, function (self, content) {\n\t\t\t\tself.sv (content);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getText () {return __get__ (this, function (self) {\n\t\t\t\treturn self.v ();\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (RawTextInput, '__init__') (self, 'text');\n\t\t\t\tself.entercallback = args.py_get ('entercallback', null);\n\t\t\t\tself.keycallback = args.py_get ('keycallback', null);\n\t\t\t\tself.cssclass = args.py_get ('tinpclass', 'defaultrawtextinput');\n\t\t\t\tself.ac (self.cssclass);\n\t\t\t\tself.ae ('keyup', self.keyup);\n\t\t\t});}\n\t\t});\n\t\tvar TextInputWithButton = __class__ ('TextInputWithButton', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget submitcallback () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.onsubmitcallback === null)) {\n\t\t\t\t\tvar v = self.tinp.v ();\n\t\t\t\t\tself.tinp.sv ('');\n\t\t\t\t\tself.onsubmitcallback (v);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (TextInputWithButton, '__init__') (self, 'div');\n\t\t\t\tvar contclass = args.py_get ('contclass', 'textinputcontainer');\n\t\t\t\targs ['tinpclass'] = args.py_get ('tinpclass', 'textinputtext');\n\t\t\t\tvar sbtnclass = args.py_get ('sbtnclass', 'textinputbutton');\n\t\t\t\tself.container = Div ().ac (contclass);\n\t\t\t\tself.onsubmitcallback = args.py_get ('submitcallback', null);\n\t\t\t\targs ['entercallback'] = self.submitcallback;\n\t\t\t\tself.tinp = RawTextInput (args);\n\t\t\t\tself.sbtn = Button ('Submit', self.submitcallback).ac (sbtnclass);\n\t\t\t\tself.container.aa (list ([self.tinp, self.sbtn]));\n\t\t\t\tself.a (self.container);\n\t\t\t});},\n\t\t\tget focus () {return __get__ (this, function (self) {\n\t\t\t\tself.tinp.fl ();\n\t\t\t\treturn self;\n\t\t\t});}\n\t\t});\n\t\tvar LogItem = __class__ ('LogItem', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget equalto () {return __get__ (this, function (self, logitem) {\n\t\t\t\treturn self.content == logitem.content && self.kind == logitem.kind;\n\t\t\t});},\n\t\t\tget getcontent () {return __get__ (this, function (self) {\n\t\t\t\tif (self.mul == 0) {\n\t\t\t\t\treturn self.content;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn \"<span class='logitemcontentmul'>+{}</span> {}\".format (self.mul, self.content);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget updatecontent () {return __get__ (this, function (self) {\n\t\t\t\tself.cdiv.html (self.getcontent ());\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, content, kind) {\n\t\t\t\tif (typeof kind == 'undefined' || (kind != null && kind .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar kind = 'normal';\n\t\t\t\t};\n\t\t\t\t__super__ (LogItem, '__init__') (self, 'div');\n\t\t\t\tself.kind = kind;\n\t\t\t\tself.mul = 0;\n\t\t\t\tself.tdiv = Div ().ac ('logtimediv').html ('{}'.format (new Date ().toLocaleTimeString ()));\n\t\t\t\tself.content = content;\n\t\t\t\tself.cdiv = Div ().ac ('logcontentdiv');\n\t\t\t\tif (len (self.content) > 0) {\n\t\t\t\t\tif (self.content [0] == '[' || self.content [0] == '{') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar json = JSON.parse (self.content);\n\t\t\t\t\t\t\tvar jsonstr = JSON.stringify (json, null, 2);\n\t\t\t\t\t\t\tself.content = ('<pre>' + jsonstr) + '</pre>';\n\t\t\t\t\t\t\tself.cdiv.ac ('logcontentjson');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t// pass;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.content = striplonglines (self.content);\n\t\t\t\tif (len (self.content) > MAX_CONTENT_LENGTH) {\n\t\t\t\t\tself.content = self.content.__getslice__ (0, MAX_CONTENT_LENGTH, 1);\n\t\t\t\t}\n\t\t\t\tself.cdiv.html (self.content);\n\t\t\t\tif (self.kind == 'cmd') {\n\t\t\t\t\tself.cdiv.ac ('logcontentcmd');\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'cmdinfo') {\n\t\t\t\t\tself.cdiv.ac ('logcontentcmdinfo');\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'cmdreadline') {\n\t\t\t\t\tself.cdiv.ac ('logcontentcmdreadline');\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'cmdstatusok') {\n\t\t\t\t\tself.cdiv.ac ('logcontentcmdstatusok');\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'cmdstatuserr') {\n\t\t\t\t\tself.cdiv.ac ('logcontentcmdstatuserr');\n\t\t\t\t}\n\t\t\t\tself.idiv = Div ().ac ('logitemdiv').aa (list ([self.tdiv, self.cdiv]));\n\t\t\t\tself.idiv.aa (list ([self.tdiv, self.cdiv]));\n\t\t\t\tself.a (self.idiv);\n\t\t\t});}\n\t\t});\n\t\tvar Log = __class__ ('Log', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (Log, '__init__') (self, 'div');\n\t\t\t\tself.width = args.py_get ('width', 600);\n\t\t\t\tself.height = args.py_get ('height', 400);\n\t\t\t\tself.maxitems = args.py_get ('maxitems', 100);\n\t\t\t\tself.ac ('logdiv');\n\t\t\t\tself.py_items = list ([]);\n\t\t\t\tself.resize (self.width, self.height);\n\t\t\t});},\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.width = width;\n\t\t\t\tself.height = height;\n\t\t\t\tself.w (self.width).mh (self.height);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.x ();\n\t\t\t\tvar __iterable0__ = py_reversed (self.py_items);\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\titem.updatecontent ();\n\t\t\t\t\tself.a (item);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget add () {return __get__ (this, function (self, item) {\n\t\t\t\tif (len (self.py_items) > 0) {\n\t\t\t\t\tvar last = self.py_items [len (self.py_items) - 1];\n\t\t\t\t\tif (last.equalto (item)) {\n\t\t\t\t\t\tlast.mul++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.py_items.append (item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.py_items.append (item);\n\t\t\t\t}\n\t\t\t\tif (len (self.py_items) > self.maxitems) {\n\t\t\t\t\tself.py_items = self.py_items.__getslice__ (1, null, 1);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget log () {return __get__ (this, function (self, item) {\n\t\t\t\tself.add (item);\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar Tab = __class__ ('Tab', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, key, displayname, element) {\n\t\t\t\tself.key = key;\n\t\t\t\tself.displayname = displayname;\n\t\t\t\tself.element = element;\n\t\t\t\tself.tabelement = null;\n\t\t\t});}\n\t\t});\n\t\tvar TabPane = __class__ ('TabPane', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (TabPane, '__init__') (self, 'div');\n\t\t\t\tself.id = args.py_get ('id', null);\n\t\t\t\tself.kind = args.py_get ('kind', 'child');\n\t\t\t\tself.width = args.py_get ('width', 600);\n\t\t\t\tself.height = args.py_get ('height', 400);\n\t\t\t\tself.marginleft = args.py_get ('marginleft', 0);\n\t\t\t\tself.margintop = args.py_get ('margintop', 0);\n\t\t\t\tself.tabsheight = args.py_get ('tabsheight', 40);\n\t\t\t\tself.tabsdiv = Div ().ac ('tabpanetabsdiv');\n\t\t\t\tself.contentdiv = Div ().ac ('tabpanecontentdiv');\n\t\t\t\tself.container = Div ().ac ('tabpanecontainer');\n\t\t\t\tself.container.aa (list ([self.tabsdiv, self.contentdiv]));\n\t\t\t\tself.a (self.container);\n\t\t\t\tself.tabs = list ([]);\n\t\t\t\tself.seltab = null;\n\t\t\t\tself.resize ();\n\t\t\t});},\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tif (typeof width == 'undefined' || (width != null && width .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar width = null;\n\t\t\t\t};\n\t\t\t\tif (typeof height == 'undefined' || (height != null && height .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar height = null;\n\t\t\t\t};\n\t\t\t\tif (self.kind == 'main') {\n\t\t\t\t\tself.width = window.innerWidth - 2 * WINDOW_SAFETY_MARGIN;\n\t\t\t\t\tself.height = window.innerHeight - 2 * WINDOW_SAFETY_MARGIN;\n\t\t\t\t\tself.marginleft = WINDOW_SAFETY_MARGIN;\n\t\t\t\t\tself.margintop = WINDOW_SAFETY_MARGIN;\n\t\t\t\t}\n\t\t\t\tif (!(width === null)) {\n\t\t\t\t\tself.width = width;\n\t\t\t\t}\n\t\t\t\tif (!(height === null)) {\n\t\t\t\t\tself.height = height;\n\t\t\t\t}\n\t\t\t\tself.contentheight = self.height - self.tabsheight;\n\t\t\t\tself.tabsdiv.w (self.width).h (self.tabsheight);\n\t\t\t\tself.contentdiv.w (self.width).h (self.contentheight);\n\t\t\t\tself.container.w (self.width).h (self.height).ml (self.marginleft).mt (self.margintop);\n\t\t\t\ttry {\n\t\t\t\t\tself.resizecontent (self.seltab.element);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget tabSelectedCallback () {return __get__ (this, function (self, tab) {\n\t\t\t\tself.selectByKey (tab.key);\n\t\t\t});},\n\t\t\tget setTabs () {return __get__ (this, function (self, tabs, key) {\n\t\t\t\tself.tabs = tabs;\n\t\t\t\tself.tabsdiv.x ();\n\t\t\t\tvar __iterable0__ = self.tabs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar tab = __iterable0__ [__index0__];\n\t\t\t\t\tvar tabelement = Div ().aac (list (['tabpanetab', 'noselect'])).html (tab.displayname);\n\t\t\t\t\tself.tabsdiv.a (tabelement);\n\t\t\t\t\ttab.tabelement = tabelement;\n\t\t\t\t\ttab.tabelement.ae ('mousedown', self.tabSelectedCallback.bind (self, tab));\n\t\t\t\t}\n\t\t\t\tif (!(self.key === null)) {\n\t\t\t\t\tvar storedkey = localStorage.getItem (self.id);\n\t\t\t\t\tif (!(storedkey === null)) {\n\t\t\t\t\t\tvar key = storedkey;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn self.selectByKey (key);\n\t\t\t});},\n\t\t\tget getTabByKey () {return __get__ (this, function (self, key, updateclass) {\n\t\t\t\tif (typeof updateclass == 'undefined' || (updateclass != null && updateclass .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar updateclass = false;\n\t\t\t\t};\n\t\t\t\tif (len (self.tabs) == 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tvar seltab = self.tabs [0];\n\t\t\t\tvar __iterable0__ = self.tabs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar tab = __iterable0__ [__index0__];\n\t\t\t\t\tif (updateclass) {\n\t\t\t\t\t\ttab.tabelement.rc ('tabpaneseltab');\n\t\t\t\t\t\tif (tab.key == key) {\n\t\t\t\t\t\t\ttab.tabelement.ac ('tabpaneseltab');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (tab.key == key) {\n\t\t\t\t\t\tvar seltab = tab;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn seltab;\n\t\t\t});},\n\t\t\tget innercontentheight () {return __get__ (this, function (self) {\n\t\t\t\treturn self.contentheight - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget innercontentwidth () {return __get__ (this, function (self) {\n\t\t\t\treturn self.width - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget resizecontent () {return __get__ (this, function (self, element) {\n\t\t\t\ttry {\n\t\t\t\t\telement.resize (self.innercontentwidth (), self.innercontentheight ());\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setTabElementByKey () {return __get__ (this, function (self, key, tabelement) {\n\t\t\t\tif (typeof tabelement == 'undefined' || (tabelement != null && tabelement .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar tabelement = null;\n\t\t\t\t};\n\t\t\t\tvar tab = self.getTabByKey (key, tabelement === null);\n\t\t\t\tif (tab == null) {\n\t\t\t\t\treturn self;\n\t\t\t\t}\n\t\t\t\tif (!(tabelement === null)) {\n\t\t\t\t\ttab.element = tabelement;\n\t\t\t\t\tif (tab == self.seltab) {\n\t\t\t\t\t\tself.contentdiv.x ().a (tab.element);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.seltab = tab;\n\t\t\t\t\tself.contentdiv.x ().a (tab.element);\n\t\t\t\t}\n\t\t\t\tself.resizecontent (tab.element);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget selectByKey () {return __get__ (this, function (self, key) {\n\t\t\t\tif (!(self.id === null)) {\n\t\t\t\t\tlocalStorage.setItem (self.id, key);\n\t\t\t\t}\n\t\t\t\treturn self.setTabElementByKey (key);\n\t\t\t});}\n\t\t});\n\t\tvar ComboOption = __class__ ('ComboOption', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, key, displayname) {\n\t\t\t\tself.key = key;\n\t\t\t\tself.displayname = displayname;\n\t\t\t});}\n\t\t});\n\t\tvar ComboBox = __class__ ('ComboBox', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget selectchangecallback () {return __get__ (this, function (self) {\n\t\t\t\tvar key = self.select.v ();\n\t\t\t\tif (!(self.changecallback === null)) {\n\t\t\t\t\tself.changecallback (key);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (ComboBox, '__init__') (self, 'div');\n\t\t\t\tself.selectclass = args.py_get ('selectclass', 'comboboxselect');\n\t\t\t\tself.optionfirstclass = args.py_get ('optionfirstclass', 'comboboxoptionfirst');\n\t\t\t\tself.optionclass = args.py_get ('optionclass', 'comboboxoption');\n\t\t\t\tself.changecallback = args.py_get ('changecallback', null);\n\t\t\t\tself.options = list ([]);\n\t\t\t\tself.container = Div ();\n\t\t\t\tself.select = Select ().aac (list (['comboboxselect', self.selectclass]));\n\t\t\t\tself.select.ae ('change', self.selectchangecallback);\n\t\t\t\tself.container.a (self.select);\n\t\t\t\tself.a (self.container);\n\t\t\t});},\n\t\t\tget setoptions () {return __get__ (this, function (self, options, selectedkey) {\n\t\t\t\tif (typeof selectedkey == 'undefined' || (selectedkey != null && selectedkey .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar selectedkey = null;\n\t\t\t\t};\n\t\t\t\tself.options = options;\n\t\t\t\tself.select.x ();\n\t\t\t\tvar first = true;\n\t\t\t\tvar __iterable0__ = self.options.py_items ();\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar __left0__ = __iterable0__ [__index0__];\n\t\t\t\t\tvar key = __left0__ [0];\n\t\t\t\t\tvar displayname = __left0__ [1];\n\t\t\t\t\tvar opte = Option (key, displayname, key == selectedkey);\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\topte.ac (self.optionfirstclass);\n\t\t\t\t\t\tvar first = false;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\topte.ac (self.optionclass);\n\t\t\t\t\t}\n\t\t\t\t\tself.select.a (opte);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});}\n\t\t});\n\t\tvar LinkedCheckBox = __class__ ('LinkedCheckBox', [Input], {\n\t\t\t__module__: __name__,\n\t\t\tget setchecked () {return __get__ (this, function (self, checked) {\n\t\t\t\tself.e.checked = checked;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getchecked () {return __get__ (this, function (self) {\n\t\t\t\treturn self.e.checked;\n\t\t\t});},\n\t\t\tget updatevar () {return __get__ (this, function (self) {\n\t\t\t\tself.parent [self.varname] = self.getchecked ();\n\t\t\t});},\n\t\t\tget changed () {return __get__ (this, function (self) {\n\t\t\t\tself.updatevar ();\n\t\t\t\tif (!(self.changecallback === null)) {\n\t\t\t\t\tself.changecallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, parent, varname, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LinkedCheckBox, '__init__') (self, 'checkbox');\n\t\t\t\tself.parent = parent;\n\t\t\t\tself.varname = varname;\n\t\t\t\tself.setchecked (self.parent [self.varname]);\n\t\t\t\tself.changecallback = args.py_get ('changecallback', null);\n\t\t\t\tself.ae ('change', self.changed);\n\t\t\t});}\n\t\t});\n\t\tvar LinkedTextInput = __class__ ('LinkedTextInput', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget updatevar () {return __get__ (this, function (self) {\n\t\t\t\tself.parent [self.varname] = self.getText ();\n\t\t\t});},\n\t\t\tget keyup () {return __get__ (this, function (self) {\n\t\t\t\tself.updatevar ();\n\t\t\t\tif (!(self.keyupcallback === null)) {\n\t\t\t\t\tself.keyupcallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setText () {return __get__ (this, function (self, content) {\n\t\t\t\tself.rawtextinput.setText (content);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getText () {return __get__ (this, function (self) {\n\t\t\t\treturn self.rawtextinput.getText ();\n\t\t\t});},\n\t\t\tget able () {return __get__ (this, function (self, enabled) {\n\t\t\t\tself.rawtextinput.able (enabled);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, parent, varname, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LinkedTextInput, '__init__') (self, 'div');\n\t\t\t\tself.parent = parent;\n\t\t\t\tself.varname = varname;\n\t\t\t\tself.value = self.parent [self.varname];\n\t\t\t\tself.rawtextinputclass = args.py_get ('textclass', 'defaultlinkedtextinputtext');\n\t\t\t\tself.rawtextinput = RawTextInput (dict ({'keycallback': self.keyup, 'entercallback': self.keyup, 'tinpclass': self.rawtextinputclass}));\n\t\t\t\tself.setText (self.value);\n\t\t\t\tpatchclasses (self, args);\n\t\t\t\tself.keyupcallback = args.py_get ('keyupcallback', null);\n\t\t\t\tself.a (self.rawtextinput);\n\t\t\t});}\n\t\t});\n\t\tvar LinkedSlider = __class__ ('LinkedSlider', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget changed () {return __get__ (this, function (self) {\n\t\t\t\tself.verify ();\n\t\t\t\tif (!(self.changecallback === null)) {\n\t\t\t\t\tself.changecallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget sliderchanged () {return __get__ (this, function (self) {\n\t\t\t\tif (self.sliderenabled) {\n\t\t\t\t\tself.value = self.slider.v ();\n\t\t\t\t\tself.valuetextinput.setText (self.value);\n\t\t\t\t\tself.verify ();\n\t\t\t\t\tif (!(self.changecallback === null)) {\n\t\t\t\t\t\tself.changecallback ();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setslider () {return __get__ (this, function (self) {\n\t\t\t\tself.sliderenabled = false;\n\t\t\t\tself.slider.setmin (self.minvalue);\n\t\t\t\tself.slider.setmax (self.maxvalue);\n\t\t\t\tself.slider.sv (self.value);\n\t\t\t\tself.sliderenabled = true;\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.container = Div ().aac (list (['linkedslidercontainerclass', self.containerclass]));\n\t\t\t\tself.valuetextinput = LinkedTextInput (self, 'value', dict ({'keyupcallback': self.changed, 'textclass': self.valuetextclass}));\n\t\t\t\tself.mintextinput = LinkedTextInput (self, 'minvalue', dict ({'keyupcallback': self.changed, 'textclass': self.mintextclass}));\n\t\t\t\tself.maxtextinput = LinkedTextInput (self, 'maxvalue', dict ({'keyupcallback': self.changed, 'textclass': self.maxtextclass}));\n\t\t\t\tself.slider = Slider ().aac (list (['linkedslidersliderclass', self.sliderclass]));\n\t\t\t\tself.slider.ae ('change', self.sliderchanged);\n\t\t\t\tself.container.aa (list ([self.valuetextinput, self.mintextinput, self.slider, self.maxtextinput]));\n\t\t\t\tself.x ().a (self.container);\n\t\t\t\tself.verify ();\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget verify () {return __get__ (this, function (self) {\n\t\t\t\ttry {\n\t\t\t\t\tself.value = int (self.value);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tself.value = 1;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tself.minvalue = int (self.minvalue);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tself.minvalue = 1;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tself.maxvalue = int (self.maxvalue);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tself.maxvalue = 100;\n\t\t\t\t}\n\t\t\t\tself.parent [self.varname] = self.value;\n\t\t\t\tself.parent [self.minvarname] = self.minvalue;\n\t\t\t\tself.parent [self.maxvarname] = self.maxvalue;\n\t\t\t\tself.setslider ();\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, parent, varname, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LinkedSlider, '__init__') (self, 'div');\n\t\t\t\tself.parent = parent;\n\t\t\t\tself.varname = varname;\n\t\t\t\tself.minvarname = 'min' + self.varname;\n\t\t\t\tself.maxvarname = 'max' + self.varname;\n\t\t\t\tself.value = self.parent [self.varname];\n\t\t\t\tself.minvalue = self.parent [self.minvarname];\n\t\t\t\tself.maxvalue = self.parent [self.maxvarname];\n\t\t\t\tself.changecallback = args.py_get ('changecallback', null);\n\t\t\t\tself.containerclass = args.py_get ('containerclass', 'linkedslidercontainerclass');\n\t\t\t\tself.valuetextclass = args.py_get ('valuetextclass', 'linkedslidervaluetextclass');\n\t\t\t\tself.mintextclass = args.py_get ('mintextclass', 'linkedslidermintextclass');\n\t\t\t\tself.sliderclass = args.py_get ('sliderclass', 'linkedslidersliderclass');\n\t\t\t\tself.maxtextclass = args.py_get ('maxtextclass', 'linkedslidermaxtextclass');\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar LinkedTextarea = __class__ ('LinkedTextarea', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget updatevar () {return __get__ (this, function (self) {\n\t\t\t\tself.parent [self.varname] = self.getText ();\n\t\t\t});},\n\t\t\tget keyup () {return __get__ (this, function (self) {\n\t\t\t\tself.updatevar ();\n\t\t\t});},\n\t\t\tget setText () {return __get__ (this, function (self, content) {\n\t\t\t\tself.textarea.setText (content);\n\t\t\t});},\n\t\t\tget getText () {return __get__ (this, function (self) {\n\t\t\t\treturn self.textarea.getText ();\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, parent, varname, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LinkedTextarea, '__init__') (self, 'div');\n\t\t\t\tself.parent = parent;\n\t\t\t\tself.varname = varname;\n\t\t\t\tself.textarea = TextArea ();\n\t\t\t\tself.textarea.ae ('keyup', self.keyup);\n\t\t\t\tself.text = args.py_get ('text', '');\n\t\t\t\tself.setText (self.text);\n\t\t\t\tpatchclasses (self, args);\n\t\t\t\tself.a (self.textarea);\n\t\t\t});}\n\t\t});\n\t\tvar LabeledLinkedCheckBox = __class__ ('LabeledLinkedCheckBox', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, label, parent, varname, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LabeledLinkedCheckBox, '__init__') (self, 'div');\n\t\t\t\tself.lcb = LinkedCheckBox (parent, varname, args);\n\t\t\t\tself.container = Div ().ac ('labeledlinkedcheckboxcontainer');\n\t\t\t\tself.ldiv = Div ().html (label);\n\t\t\t\tself.container.aa (list ([self.ldiv, self.lcb]));\n\t\t\t\tpatchclasses (self, args);\n\t\t\t\tself.a (self.container).ac ('labeledlinkedcheckbox');\n\t\t\t});}\n\t\t});\n\t\tvar LogPane = __class__ ('LogPane', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.width = width;\n\t\t\t\tself.height = height;\n\t\t\t\tself.contentheight = self.height;\n\t\t\t\tif (self.contentheight < self.mincontentheight) {\n\t\t\t\t\tself.contentheight = self.mincontentheight;\n\t\t\t\t}\n\t\t\t\tself.contentdiv.w (self.width).h (self.contentheight);\n\t\t\t\tself.w (self.width).h (self.height);\n\t\t\t\ttry {\n\t\t\t\t\tself.content.resize (self.innercontentwidth (), self.innercontentheight ());\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget innercontentheight () {return __get__ (this, function (self) {\n\t\t\t\treturn self.contentheight - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget innercontentwidth () {return __get__ (this, function (self) {\n\t\t\t\treturn self.width - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget setcontent () {return __get__ (this, function (self, element) {\n\t\t\t\tself.content = element;\n\t\t\t\tself.contentdiv.x ().a (self.content);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (LogPane, '__init__') (self, 'div');\n\t\t\t\tself.width = args.py_get ('width', 600);\n\t\t\t\tself.height = args.py_get ('height', 400);\n\t\t\t\tself.mincontentheight = args.py_get ('mincontentheight', 100);\n\t\t\t\tself.contentdiv = Div ().ac ('logpanecontentdiv');\n\t\t\t\tself.resize (self.width, self.height);\n\t\t\t\tself.aa (list ([self.contentdiv]));\n\t\t\t\tself.log = Log (dict ({}));\n\t\t\t\tself.setcontent (self.log);\n\t\t\t});}\n\t\t});\n\t\tvar SplitPane = __class__ ('SplitPane', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.width = width;\n\t\t\t\tself.height = height;\n\t\t\t\tself.controldiv.w (self.width).h (self.controlheight);\n\t\t\t\tself.contentheight = self.height - self.controlheight;\n\t\t\t\tif (self.contentheight < self.mincontentheight) {\n\t\t\t\t\tself.contentheight = self.mincontentheight;\n\t\t\t\t}\n\t\t\t\tself.contentdiv.w (self.width).h (self.contentheight);\n\t\t\t\tself.w (self.width).h (self.height);\n\t\t\t\ttry {\n\t\t\t\t\tself.content.resize (self.innercontentwidth (), self.innercontentheight ());\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget innercontentheight () {return __get__ (this, function (self) {\n\t\t\t\treturn self.contentheight - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget innercontentwidth () {return __get__ (this, function (self) {\n\t\t\t\treturn self.width - SCROLL_BAR_WIDTH;\n\t\t\t});},\n\t\t\tget setcontent () {return __get__ (this, function (self, element) {\n\t\t\t\tself.content = element;\n\t\t\t\tself.contentdiv.x ().a (self.content);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (SplitPane, '__init__') (self, 'div');\n\t\t\t\tself.width = args.py_get ('width', 600);\n\t\t\t\tself.height = args.py_get ('height', 400);\n\t\t\t\tself.controlheight = args.py_get ('controlheight', 100);\n\t\t\t\tself.mincontentheight = args.py_get ('mincontentheight', 100);\n\t\t\t\tself.controldiv = Div ().ac ('splitpanecontrolpanel');\n\t\t\t\tself.contentdiv = Div ().ac ('splitpanecontentdiv');\n\t\t\t\tself.resize (self.width, self.height);\n\t\t\t\tself.aa (list ([self.controldiv, self.contentdiv]));\n\t\t\t});}\n\t\t});\n\t\tvar ProcessConsole = __class__ ('ProcessConsole', [SplitPane], {\n\t\t\t__module__: __name__,\n\t\t\tget aliascallback () {return __get__ (this, function (self, key) {\n\t\t\t\tvar cmds = self.cmdaliases [key] ['cmds'];\n\t\t\t\tvar __iterable0__ = cmds;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar cmd = __iterable0__ [__index0__];\n\t\t\t\t\tself.submitcallback (cmd);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget submitcallback () {return __get__ (this, function (self, content) {\n\t\t\t\tself.log.log (LogItem (content, 'cmd'));\n\t\t\t\tif (self.cmdinpcallback === null) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tself.cmdinpcallback (content, self.key);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\targs ['controlheight'] = 80;\n\t\t\t\t__super__ (ProcessConsole, '__init__') (self, args);\n\t\t\t\tself.key = args.py_get ('key', null);\n\t\t\t\tself.cmdinpcallback = args.py_get ('cmdinpcallback', null);\n\t\t\t\tself.cmdinp = TextInputWithButton (dict ({'submitcallback': self.submitcallback}));\n\t\t\t\tself.cmdaliases = args.py_get ('cmdaliases', dict ({}));\n\t\t\t\tself.controldiv.a (self.cmdinp);\n\t\t\t\tvar __iterable0__ = self.cmdaliases.py_keys ();\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar cmdaliaskey = __iterable0__ [__index0__];\n\t\t\t\t\tvar cmdalias = self.cmdaliases [cmdaliaskey];\n\t\t\t\t\tvar btn = Button (cmdalias ['display'], self.aliascallback, cmdaliaskey);\n\t\t\t\t\tself.controldiv.a (btn);\n\t\t\t\t}\n\t\t\t\tself.log = Log (dict ({}));\n\t\t\t\tself.setcontent (self.log);\n\t\t\t});}\n\t\t});\n\t\tvar FileUploader = __class__ ('FileUploader', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget fileinputchanged () {return __get__ (this, function (self) {\n\t\t\t\tself.files = self.fileinput.files ();\n\t\t\t\tself.handlefiles ();\n\t\t\t});},\n\t\t\tget preventdefaults () {return __get__ (this, function (self, ev) {\n\t\t\t\tev.preventDefault ();\n\t\t\t\tev.stopPropagation ();\n\t\t\t});},\n\t\t\tget highlight () {return __get__ (this, function (self) {\n\t\t\t\tself.droparea.ac ('highlight');\n\t\t\t});},\n\t\t\tget unhighlight () {return __get__ (this, function (self) {\n\t\t\t\tself.droparea.rc ('highlight');\n\t\t\t});},\n\t\t\tget log () {return __get__ (this, function (self, html) {\n\t\t\t\tself.infoitems.append (html);\n\t\t\t\tself.infoitems.reverse ();\n\t\t\t\tself.info.html ('<br>'.join (self.infoitems));\n\t\t\t\tself.infoitems.reverse ();\n\t\t\t});},\n\t\t\tget loginfo () {return __get__ (this, function (self, content) {\n\t\t\t\ttry {\n\t\t\t\t\tvar json = JSON.parse (content);\n\t\t\t\t\tif (json ['success']) {\n\t\t\t\t\t\tvar path = '/uploads/{}'.format (json ['savefilename']);\n\t\t\t\t\t\tself.log (\"uploaded <span class='fileuploadfilename'>{}</span> <a href='{}' target='_blank' rel='noopener noreferrer'>{}</a>\".format (json ['filename'], path, path));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.log ('File upload failed.', json ['status']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tself.log ('Error parsing response as JSON.');\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget uploadfile () {return __get__ (this, function (self, file) {\n\t\t\t\tif (self.url === null) {\n\t\t\t\t\tprint ('no upload url');\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tvar formdata = new FormData ();\n\t\t\t\tformdata.append ('files', file);\n\t\t\t\tvar args = {'method': 'POST', 'body': formdata};\n\t\t\t\tfetch (self.url, args).then ((function __lambda__ (response) {\n\t\t\t\t\treturn response.text ().then ((function __lambda__ (content) {\n\t\t\t\t\t\treturn self.loginfo (content);\n\t\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\t\treturn self.loginfo (err);\n\t\t\t\t\t}));\n\t\t\t\t}), (function __lambda__ (err) {\n\t\t\t\t\treturn self.loginfo (err);\n\t\t\t\t}));\n\t\t\t});},\n\t\t\tget handlefiles () {return __get__ (this, function (self, files) {\n\t\t\t\tif (typeof files == 'undefined' || (files != null && files .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar files = self.files;\n\t\t\t\t};\n\t\t\t\tfor (var i = 0; i < files.length; i++) {\n\t\t\t\t\tprint ('uploading file {}'.format (i));\n\t\t\t\t\tself.uploadfile (files.item (i));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget handledrop () {return __get__ (this, function (self, ev) {\n\t\t\t\tself.dt = ev.dataTransfer;\n\t\t\t\tself.files = self.dt.files;\n\t\t\t\tself.handlefiles ();\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.x ();\n\t\t\t\tself.droparea = Div ().ac ('fileuploaddroparea');\n\t\t\t\tself.form = Form ().ac ('fileuploadform');\n\t\t\t\tself.desc = P ().ac ('fileuploadp').html ('Upload {}s with the file dialog or by dragging and dropping them onto the dashed region'.format (self.acceptdisplay));\n\t\t\t\tself.fileinput = FileInput ().ac ('fileuploadfileelem').setmultiple (self.multiple).setaccept (self.accept);\n\t\t\t\tself.fileinput.sa ('id', 'fileinputelement');\n\t\t\t\tself.fileinput.ae ('change', self.fileinputchanged);\n\t\t\t\tself.button = Label ().ac ('fileuploadbutton').sa ('for', 'fileinputelement').html ('Select some {}s'.format (self.acceptdisplay));\n\t\t\t\tself.form.aa (list ([self.desc, self.fileinput, self.button]));\n\t\t\t\tself.droparea.a (self.form);\n\t\t\t\tvar __iterable0__ = list (['dragenter', 'dragover', 'dragleave', 'drop']);\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar eventname = __iterable0__ [__index0__];\n\t\t\t\t\tself.droparea.aef (eventname, self.preventdefaults);\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = list (['dragenter', 'dragover']);\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar eventname = __iterable0__ [__index0__];\n\t\t\t\t\tself.droparea.aef (eventname, self.highlight);\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = list (['dragleave', 'drop']);\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar eventname = __iterable0__ [__index0__];\n\t\t\t\t\tself.droparea.aef (eventname, self.unhighlight);\n\t\t\t\t}\n\t\t\t\tself.droparea.aef ('drop', self.handledrop);\n\t\t\t\tself.info = Div ().ac ('fileuploadinfo');\n\t\t\t\tself.infoitems = list ([]);\n\t\t\t\tself.aa (list ([self.droparea, self.info]));\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\t__super__ (FileUploader, '__init__') (self, 'div');\n\t\t\t\tself.url = args.py_get ('url', null);\n\t\t\t\tself.multiple = args.py_get ('multiple', true);\n\t\t\t\tself.accept = args.py_get ('accept', 'image/*');\n\t\t\t\tself.acceptdisplay = args.py_get ('acceptdisplay', 'image');\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar schemaclipboard = null;\n\t\tvar SCHEMA_WRITE_PREFERENCE_DEFAULTS = list ([dict ({'key': 'addchild', 'display': 'Add child', 'default': true}), dict ({'key': 'remove', 'display': 'Remove', 'default': true}), dict ({'key': 'childsopened', 'display': 'Childs opened', 'default': false}), dict ({'key': 'editenabled', 'display': 'Edit enabled', 'default': true}), dict ({'key': 'editkey', 'display': 'Edit key', 'default': true}), dict ({'key': 'editvalue', 'display': 'Edit value', 'default': true}), dict ({'key': 'radio', 'display': 'Radio', 'default': false}), dict ({'key': 'slider', 'display': 'Slider', 'default': false}), dict ({'key': 'check', 'display': 'Check', 'default': false}), dict ({'key': 'showhelpashtml', 'display': 'Show help as HTML', 'default': true})]);\n\t\tvar SchemaWritePreference = __class__ ('SchemaWritePreference', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\tvar __iterable0__ = SCHEMA_WRITE_PREFERENCE_DEFAULTS;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tself [item ['key']] = item ['default'];\n\t\t\t\t}\n\t\t\t\tself.parent = null;\n\t\t\t\tself.changecallback = null;\n\t\t\t\tself.disabledlist = list ([]);\n\t\t\t});},\n\t\t\tget setparent () {return __get__ (this, function (self, parent) {\n\t\t\t\tself.parent = parent;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setchangecallback () {return __get__ (this, function (self, changecallback) {\n\t\t\t\tself.changecallback = changecallback;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget changed () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.changecallback === null)) {\n\t\t\t\t\tself.changecallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setdisabledlist () {return __get__ (this, function (self, disabledlist) {\n\t\t\t\tself.disabledlist = disabledlist;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget form () {return __get__ (this, function (self) {\n\t\t\t\tvar formdiv = Div ().ac ('noselect');\n\t\t\t\tvar mdl = self.disabledlist;\n\t\t\t\tif (!(self.parent === null)) {\n\t\t\t\t\tif (self.parent.parent === null) {\n\t\t\t\t\t\tvar mdl = mdl + list (['editkey']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = SCHEMA_WRITE_PREFERENCE_DEFAULTS;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tif (!(__in__ (item ['key'], mdl))) {\n\t\t\t\t\t\tformdiv.a (LabeledLinkedCheckBox (item ['display'], self, item ['key'], dict ({'patchclasses': list (['container/a/schemawritepreferenceformsubdiv']), 'changecallback': self.changed})));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn formdiv;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\tvar obj = dict ({});\n\t\t\t\tvar __iterable0__ = SCHEMA_WRITE_PREFERENCE_DEFAULTS;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tobj [item ['key']] = self [item ['key']];\n\t\t\t\t}\n\t\t\t\treturn obj;\n\t\t\t});}\n\t\t});\n\t\tvar DEFAULT_HELP = 'No help available for this item.';\n\t\tvar DEFAULT_ENABLED = true;\n\t\tvar SchemaItem = __class__ ('SchemaItem', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget parentsettask () {return __get__ (this, function (self) {\n\t\t\t\t// pass;\n\t\t\t});},\n\t\t\tget setparent () {return __get__ (this, function (self, parent) {\n\t\t\t\tself.parent = parent;\n\t\t\t\tself.parentsettask ();\n\t\t\t});},\n\t\t\tget getitem () {return __get__ (this, function (self) {\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget label () {return __get__ (this, function (self) {\n\t\t\t\treturn '';\n\t\t\t});},\n\t\t\tget baseobj () {return __get__ (this, function (self) {\n\t\t\t\tvar obj = dict ({'kind': self.kind, 'enabled': self.enabled, 'help': self.help, 'writepreference': self.writepreference.toobj ()});\n\t\t\t\treturn obj;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\treturn self.baseobj ();\n\t\t\t});},\n\t\t\tget topureobj () {return __get__ (this, function (self) {\n\t\t\t\tvar pureobj = dict ({});\n\t\t\t\treturn pureobj;\n\t\t\t});},\n\t\t\tget enablechangedtask () {return __get__ (this, function () {\n\t\t\t\t// pass;\n\t\t\t});},\n\t\t\tget enablecallback () {return __get__ (this, function (self) {\n\t\t\t\tself.enabled = self.enablecheckbox.getchecked ();\n\t\t\t\tif (!(self.childparent === null)) {\n\t\t\t\t\tif (self.childparent.writepreference.radio) {\n\t\t\t\t\t\tself.childparent.setradio (self);\n\t\t\t\t\t}\n\t\t\t\t\tself.childparent.enablechangedtask ();\n\t\t\t\t}\n\t\t\t\tself.enablechangedtask ();\n\t\t\t});},\n\t\t\tget setenabled () {return __get__ (this, function (self, enabled) {\n\t\t\t\tself.enabled = enabled;\n\t\t\t\tself.enablecheckbox.setchecked (self.enabled);\n\t\t\t});},\n\t\t\tget helpboxclicked () {return __get__ (this, function (self) {\n\t\t\t\tif (self.helpopen) {\n\t\t\t\t\tself.helphook.x ();\n\t\t\t\t\tself.helpopen = false;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.helpdiv = Div ().ac ('schemahelpdiv');\n\t\t\t\t\tself.helpcontentdiv = Div ().aac (list (['schemahelpcontentdiv', 'noselect'])).html (self.help);\n\t\t\t\t\tself.helpeditdiv = Div ().ac ('schemahelpeditdiv');\n\t\t\t\t\tself.helpedittextarea = LinkedTextarea (self, 'help', dict ({'patchclasses': list (['textarea/a/schemahelpedittextarea']), 'text': self.help}));\n\t\t\t\t\tself.helpeditdiv.a (self.helpedittextarea);\n\t\t\t\t\tif (self.writepreference.showhelpashtml) {\n\t\t\t\t\t\tself.helpdiv.a (self.helpcontentdiv);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.helpdiv.a (self.helpeditdiv);\n\t\t\t\t\t}\n\t\t\t\t\tself.helphook.a (self.helpdiv);\n\t\t\t\t\tself.helpopen = true;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget copyboxclicked () {return __get__ (this, function (self) {\n\t\t\t\tschemaclipboard.copy (self);\n\t\t\t});},\n\t\t\tget settingsboxclicked () {return __get__ (this, function (self) {\n\t\t\t\tif (self.settingsopen) {\n\t\t\t\t\tself.settingshook.x ();\n\t\t\t\t\tself.settingsopen = false;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.settingsdiv = Div ().ac ('schemasettingsdiv').a (self.writepreference.form ());\n\t\t\t\t\tself.settingshook.a (self.settingsdiv);\n\t\t\t\t\tself.settingsopen = true;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget removeboxclicked () {return __get__ (this, function (self) {\n\t\t\t\tself.childparent.remove (self);\n\t\t\t\t// pass;\n\t\t\t});},\n\t\t\tget writepreferencechangedtask () {return __get__ (this, function (self) {\n\t\t\t\t// pass;\n\t\t\t});},\n\t\t\tget writepreferencechanged () {return __get__ (this, function (self) {\n\t\t\t\tself.helpboxclicked ();\n\t\t\t\tself.helpboxclicked ();\n\t\t\t\tself.enablecheckbox.able (self.writepreference.editenabled);\n\t\t\t\tself.setchildparent (self.childparent);\n\t\t\t\tself.writepreferencechangedtask ();\n\t\t\t\tif (!(self.parent === null)) {\n\t\t\t\t\tself.parent.writepreferencechangedtask ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setchildparent () {return __get__ (this, function (self, childparent) {\n\t\t\t\tself.childparent = childparent;\n\t\t\t\tif (!(self.childparent === null) && self.writepreference.remove) {\n\t\t\t\t\tself.schemacontainer.x ().aa (list ([self.enablebox, self.element, self.helpbox, self.copybox, self.settingsbox, self.removebox]));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.schemacontainer.x ().aa (list ([self.enablebox, self.element, self.helpbox, self.copybox, self.settingsbox]));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget elementdragstart () {return __get__ (this, function (self, ev) {\n\t\t\t\tself.dragstartvect = getClientVect (ev);\n\t\t\t});},\n\t\t\tget elementdrag () {return __get__ (this, function (self, ev) {\n\t\t\t\t// pass;\n\t\t\t});},\n\t\t\tget move () {return __get__ (this, function (self, dir) {\n\t\t\t\tif (self.childparent === null) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tvar i = self.childparent.getitemindex (self);\n\t\t\t\tvar newi = i + dir;\n\t\t\t\tself.childparent.movechildi (i, newi);\n\t\t\t});},\n\t\t\tget elementdragend () {return __get__ (this, function (self, ev) {\n\t\t\t\tself.dragendvect = getClientVect (ev);\n\t\t\t\tvar diff = self.dragendvect.m (self.dragstartvect);\n\t\t\t\tvar dir = int (diff.y / getglobalcssvarpxint ('--schemabase'));\n\t\t\t\tself.move (dir);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (SchemaItem, '__init__') (self, 'div');\n\t\t\t\tself.parent = null;\n\t\t\t\tself.childparent = null;\n\t\t\t\tself.args = args;\n\t\t\t\tself.kind = 'item';\n\t\t\t\tself.enabled = args.py_get ('enabled', DEFAULT_ENABLED);\n\t\t\t\tself.help = args.py_get ('help', DEFAULT_HELP);\n\t\t\t\tself.writepreference = args.py_get ('writepreference', SchemaWritePreference ());\n\t\t\t\tself.writepreference.setparent (self);\n\t\t\t\tself.writepreference.setchangecallback (self.writepreferencechanged);\n\t\t\t\tself.element = Div ().ac ('schemaitem');\n\t\t\t\tself.schemacontainer = Div ().ac ('schemacontainer');\n\t\t\t\tself.enablebox = Div ().ac ('schemaenablebox');\n\t\t\t\tself.enablecheckbox = CheckBox (self.enabled).ac ('schemaenablecheckbox').ae ('change', self.enablecallback);\n\t\t\t\tself.enablecheckbox.able (self.writepreference.editenabled);\n\t\t\t\tself.enablebox.a (self.enablecheckbox);\n\t\t\t\tself.helpbox = Div ().aac (list (['schemahelpbox', 'noselect'])).ae ('mousedown', self.helpboxclicked).html ('?');\n\t\t\t\tself.copybox = Div ().aac (list (['schemacopybox', 'noselect'])).ae ('mousedown', self.copyboxclicked).html ('C');\n\t\t\t\tself.settingsbox = Div ().aac (list (['schemasettingsbox', 'noselect'])).ae ('mousedown', self.settingsboxclicked).html ('S');\n\t\t\t\tself.removebox = Div ().aac (list (['schemaremovebox', 'noselect'])).ae ('mousedown', self.removeboxclicked).html ('X');\n\t\t\t\tself.afterelementhook = Div ();\n\t\t\t\tself.settingsopen = args.py_get ('settingsopen', false);\n\t\t\t\tself.helpopen = args.py_get ('helpopen', false);\n\t\t\t\tself.settingshook = Div ();\n\t\t\t\tself.helphook = Div ();\n\t\t\t\tself.schemacontainer.aa (list ([self.enablebox, self.element, self.helpbox, self.copybox, self.settingsbox]));\n\t\t\t\tself.itemcontainer = Div ();\n\t\t\t\tself.itemcontainer.aa (list ([self.schemacontainer, self.helphook, self.settingshook, self.afterelementhook]));\n\t\t\t\tself.a (self.itemcontainer);\n\t\t\t\tself.dragelement = self.copybox;\n\t\t\t\tself.dragelement.sa ('draggable', true);\n\t\t\t\tself.dragelement.ae ('dragstart', self.elementdragstart);\n\t\t\t\tself.dragelement.ae ('drag', self.elementdrag);\n\t\t\t\tself.dragelement.ae ('dragend', self.elementdragend);\n\t\t\t\tself.dragelement.ae ('dragover', (function __lambda__ (ev) {\n\t\t\t\t\treturn ev.preventDefault ();\n\t\t\t\t}));\n\t\t\t});}\n\t\t});\n\t\tvar NamedSchemaItem = __class__ ('NamedSchemaItem', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget getitem () {return __get__ (this, function (self) {\n\t\t\t\treturn self.item;\n\t\t\t});},\n\t\t\tget label () {return __get__ (this, function (self) {\n\t\t\t\treturn self.key;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\treturn dict ({'kind': 'nameditem', 'key': self.key, 'item': self.item.toobj ()});\n\t\t\t});},\n\t\t\tget writepreferencechangedtask () {return __get__ (this, function (self) {\n\t\t\t\tself.linkedtextinput.able (self.item.writepreference.editkey);\n\t\t\t});},\n\t\t\tget keychanged () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.keychangedcallback === null)) {\n\t\t\t\t\tself.keychangedcallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setkeychangedcallback () {return __get__ (this, function (self, keychangedcallback) {\n\t\t\t\tself.keychangedcallback = keychangedcallback;\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setkey () {return __get__ (this, function (self, key) {\n\t\t\t\tself.key = key;\n\t\t\t\tself.linkedtextinput.setText (self.key);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (NamedSchemaItem, '__init__') (self, 'div');\n\t\t\t\tself.kind = 'nameditem';\n\t\t\t\tself.key = args.py_get ('key', '');\n\t\t\t\tself.item = args.py_get ('item', SchemaItem (args));\n\t\t\t\tself.keychangedcallback = null;\n\t\t\t\tself.item.setparent (self);\n\t\t\t\tself.namedcontainer = Div ().ac ('namedschemaitem');\n\t\t\t\tself.namediv = Div ().ac ('schemaitemname');\n\t\t\t\tself.linkedtextinput = LinkedTextInput (self, 'key', dict ({'textclass': 'namedschemaitemrawtextinput', 'keyupcallback': self.keychanged}));\n\t\t\t\tself.linkedtextinput.setText (self.key);\n\t\t\t\tself.linkedtextinput.able (self.item.writepreference.editkey);\n\t\t\t\tself.namediv.a (self.linkedtextinput);\n\t\t\t\tself.namedcontainer.aa (list ([self.namediv, self.item]));\n\t\t\t\tself.a (self.namedcontainer);\n\t\t\t});},\n\t\t\tget copy () {return __get__ (this, function (self, item) {\n\t\t\t\tself.item = schemafromobj (item.toobj ());\n\t\t\t\tself.item.parent = null;\n\t\t\t\tself.key = null;\n\t\t\t\tif (!(item.parent === null)) {\n\t\t\t\t\tself.key = item.parent.key;\n\t\t\t\t}\n\t\t\t});}\n\t\t});\n\t\tvar SchemaScalar = __class__ ('SchemaScalar', [SchemaItem], {\n\t\t\t__module__: __name__,\n\t\t\tget label () {return __get__ (this, function (self) {\n\t\t\t\treturn self.value;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\tvar obj = self.baseobj ();\n\t\t\t\tobj ['value'] = self.value;\n\t\t\t\tobj ['minvalue'] = self.minvalue;\n\t\t\t\tobj ['maxvalue'] = self.maxvalue;\n\t\t\t\treturn obj;\n\t\t\t});},\n\t\t\tget topureobj () {return __get__ (this, function (self) {\n\t\t\t\tvar obj = self.value;\n\t\t\t\treturn obj;\n\t\t\t});},\n\t\t\tget writepreferencechangedtask () {return __get__ (this, function (self) {\n\t\t\t\tself.build ();\n\t\t\t});},\n\t\t\tget enablechangedtask () {return __get__ (this, function (self) {\n\t\t\t\tif (self.writepreference.check) {\n\t\t\t\t\tif (self.enabled) {\n\t\t\t\t\t\tself.value = 'true';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.value = 'false';\n\t\t\t\t\t}\n\t\t\t\t\tself.linkedtextinput.setText (self.value);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tif (self.writepreference.slider) {\n\t\t\t\t\tself.enablecheckbox.rc ('schemacheckenablecheckbox');\n\t\t\t\t\tself.linkedslider = LinkedSlider (self, 'value', dict ({'containerclass': 'schemalinkedslidercontainerclass', 'valuetextclass': 'schemalinkedslidervaluetextclass', 'mintextclass': 'schemalinkedslidermintextclass', 'sliderclass': 'schemalinkedslidersliderclass', 'maxtextclass': 'schemalinkedslidermaxtextclass'}));\n\t\t\t\t\tself.element.x ().aa (list ([self.linkedslider]));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.enablebox.arc (self.writepreference.check, 'schemacheckenablecheckbox');\n\t\t\t\t\tself.linkedtextinput = LinkedTextInput (self, 'value', dict ({'textclass': 'schemascalarrawtextinput'}));\n\t\t\t\t\tself.linkedtextinput.able (self.writepreference.editvalue);\n\t\t\t\t\tself.element.x ().aa (list ([self.linkedtextinput]));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (SchemaScalar, '__init__') (self, args);\n\t\t\t\tself.kind = 'scalar';\n\t\t\t\tself.value = args.py_get ('value', '');\n\t\t\t\tself.minvalue = args.py_get ('minvalue', 1);\n\t\t\t\tself.maxvalue = args.py_get ('maxvalue', 100);\n\t\t\t\tself.element.ac ('schemascalar');\n\t\t\t\tself.writepreference.setdisabledlist (list (['addchild', 'childsopened', 'radio']));\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar SchemaCollection = __class__ ('SchemaCollection', [SchemaItem], {\n\t\t\t__module__: __name__,\n\t\t\tget removechildi () {return __get__ (this, function (self, i) {\n\t\t\t\tvar newchilds = list ([]);\n\t\t\t\tvar rchild = null;\n\t\t\t\tfor (var j = 0; j < len (self.childs); j++) {\n\t\t\t\t\tif (j == i) {\n\t\t\t\t\t\tvar rchild = self.childs [j];\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnewchilds.append (self.childs [j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.childs = newchilds;\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t\treturn rchild;\n\t\t\t});},\n\t\t\tget insertchildi () {return __get__ (this, function (self, i, child) {\n\t\t\t\tvar newchilds = list ([]);\n\t\t\t\tfor (var j = 0; j < len (self.childs) + 1; j++) {\n\t\t\t\t\tif (j == i) {\n\t\t\t\t\t\tnewchilds.append (child);\n\t\t\t\t\t}\n\t\t\t\t\tif (j < len (self.childs)) {\n\t\t\t\t\t\tnewchilds.append (self.childs [j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.childs = newchilds;\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t});},\n\t\t\tget movechildi () {return __get__ (this, function (self, i, newi) {\n\t\t\t\tif (len (self.childs) <= 0) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tif (newi < 0) {\n\t\t\t\t\tvar newi = 0;\n\t\t\t\t}\n\t\t\t\tif (newi >= len (self.childs)) {\n\t\t\t\t\tvar newi = len (self.childs) - 1;\n\t\t\t\t}\n\t\t\t\tvar rchild = self.removechildi (i);\n\t\t\t\tif (!(rchild === null)) {\n\t\t\t\t\tself.insertchildi (newi, rchild);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget getitemindex () {return __get__ (this, function (self, item) {\n\t\t\t\tfor (var i = 0; i < len (self.childs); i++) {\n\t\t\t\t\tif (self.childs [i].getitem () == item) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget parentsettask () {return __get__ (this, function (self) {\n\t\t\t\tself.opendiv.arc (!(self.parent === null), 'schemadictchildleftmargin');\n\t\t\t});},\n\t\t\tget enablechangedtask () {return __get__ (this, function (self) {\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t});},\n\t\t\tget buildchilds () {return __get__ (this, function (self) {\n\t\t\t\tvar labellist = list ([]);\n\t\t\t\tself.childshook.x ();\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tself.childshook.a (child);\n\t\t\t\t\tif (child.getitem ().enabled) {\n\t\t\t\t\t\tlabellist.append (child.label ());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar label = ' , '.join (labellist);\n\t\t\t\tself.openbutton.x ().a (Div ().ac ('schemacollectionopenbuttonlabel').html (label));\n\t\t\t});},\n\t\t\tget topureobj () {return __get__ (this, function (self) {\n\t\t\t\tvar pureobj = dict ({});\n\t\t\t\tif (self.writepreference.radio) {\n\t\t\t\t\tif (self.kind == 'dict') {\n\t\t\t\t\t\tvar pureobj = list (['', dict ({})]);\n\t\t\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\tvar nameditem = __iterable0__ [__index0__];\n\t\t\t\t\t\t\tvar key = nameditem.key;\n\t\t\t\t\t\t\tvar item = nameditem.item;\n\t\t\t\t\t\t\tif (item.enabled || item.writepreference.check) {\n\t\t\t\t\t\t\t\tvar pureobj = list ([key, item.topureobj ()]);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (self.kind == 'list') {\n\t\t\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\t\tif (item.enabled || item.writepreference.check) {\n\t\t\t\t\t\t\t\tvar pureobj = item.topureobj ();\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'dict') {\n\t\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\tvar nameditem = __iterable0__ [__index0__];\n\t\t\t\t\t\tvar key = nameditem.key;\n\t\t\t\t\t\tvar item = nameditem.item;\n\t\t\t\t\t\tif (item.enabled || item.writepreference.check) {\n\t\t\t\t\t\t\tpureobj [key] = item.topureobj ();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (self.kind == 'list') {\n\t\t\t\t\tvar pureobj = list ([]);\n\t\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\t\tif (item.enabled || item.writepreference.check) {\n\t\t\t\t\t\t\tpureobj.append (item.topureobj ());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn pureobj;\n\t\t\t});},\n\t\t\tget setradio () {return __get__ (this, function (self, item) {\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tvar childitem = child.getitem ();\n\t\t\t\t\tvar childeq = childitem == item;\n\t\t\t\t\tchilditem.enabled = childeq;\n\t\t\t\t\tchilditem.enablecheckbox.setchecked (childeq);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget remove () {return __get__ (this, function (self, item) {\n\t\t\t\tvar newlist = list ([]);\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tvar childeq = false;\n\t\t\t\t\tif (child.kind == 'nameditem') {\n\t\t\t\t\t\tvar childeq = child.item == item;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar childeq = child == item;\n\t\t\t\t\t}\n\t\t\t\t\tif (!(childeq)) {\n\t\t\t\t\t\tnewlist.append (child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.childs = newlist;\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t});},\n\t\t\tget getschemakinds () {return __get__ (this, function (self) {\n\t\t\t\tvar schemakinds = dict ({'create': 'Create new', 'scalar': 'Scalar', 'list': 'List', 'dict': 'Dict'});\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar nameditem = __iterable0__ [__index0__];\n\t\t\t\t\tvar key = nameditem.key;\n\t\t\t\t\tif (!(key == null)) {\n\t\t\t\t\t\tif (len (key) > 0) {\n\t\t\t\t\t\t\tschemakinds ['#' + key] = key;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn schemakinds;\n\t\t\t});},\n\t\t\tget updatecreatecombo () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.createcombo === null)) {\n\t\t\t\t\tself.createcombo.setoptions (self.getschemakinds ());\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget getchildbykey () {return __get__ (this, function (self, key) {\n\t\t\t\tif (!(self.kind == 'dict')) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar nameditem = __iterable0__ [__index0__];\n\t\t\t\t\tif (nameditem.key == key) {\n\t\t\t\t\t\treturn nameditem.item;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget createcallback () {return __get__ (this, function (self, key) {\n\t\t\t\tself.updatecreatecombo ();\n\t\t\t\tvar sch = SchemaScalar (dict ({}));\n\t\t\t\tif (key == 'list') {\n\t\t\t\t\tvar sch = SchemaList (dict ({}));\n\t\t\t\t}\n\t\t\t\telse if (key == 'dict') {\n\t\t\t\t\tvar sch = SchemaDict (dict ({}));\n\t\t\t\t}\n\t\t\t\tif (key [0] == '#') {\n\t\t\t\t\tvar truekey = key.__getslice__ (1, null, 1);\n\t\t\t\t\tvar titem = self.getchildbykey (truekey);\n\t\t\t\t\tif (titem == null) {\n\t\t\t\t\t\tprint ('error, no item with key', truekey);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar sch = schemafromobj (titem.toobj ());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsch.setchildparent (self);\n\t\t\t\tvar appendelement = sch;\n\t\t\t\tif (self.kind == 'dict') {\n\t\t\t\t\tvar appendelement = NamedSchemaItem (dict ({'item': sch})).setkeychangedcallback (self.updatecreatecombo);\n\t\t\t\t}\n\t\t\t\tself.childs.append (appendelement);\n\t\t\t\tself.buildchilds ();\n\t\t\t\tself.updatecreatecombo ();\n\t\t\t});},\n\t\t\tget pastebuttonclicked () {return __get__ (this, function (self) {\n\t\t\t\ttry {\n\t\t\t\t\tvar sch = schemafromobj (schemaclipboard.item.toobj ());\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\twindow.alert ('No item on clipboard to paste!');\n\t\t\t\t\treturn self;\n\t\t\t\t}\n\t\t\t\tsch.setchildparent (self);\n\t\t\t\tvar appendelement = sch;\n\t\t\t\tif (self.kind == 'dict') {\n\t\t\t\t\tvar appendelement = NamedSchemaItem (dict ({'item': sch})).setkeychangedcallback (self.updatecreatecombo);\n\t\t\t\t\tif (!(schemaclipboard.key === null)) {\n\t\t\t\t\t\tappendelement.setkey (schemaclipboard.key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.childs.append (appendelement);\n\t\t\t\tself.buildchilds ();\n\t\t\t\tself.updatecreatecombo ();\n\t\t\t});},\n\t\t\tget openchilds () {return __get__ (this, function (self) {\n\t\t\t\tif (self.opened) {\n\t\t\t\t\tself.opened = false;\n\t\t\t\t\tself.createhook.x ();\n\t\t\t\t\tself.childshook.x ();\n\t\t\t\t\tself.openbutton.rc ('schemacollectionopenbuttondone');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.opened = true;\n\t\t\t\t\tself.creatediv = Div ().ac ('schemaitem').ac ('schemacreate');\n\t\t\t\t\tself.createcombo = ComboBox (dict ({'changecallback': self.createcallback, 'selectclass': 'schemacreatecomboselect'}));\n\t\t\t\t\tself.updatecreatecombo ();\n\t\t\t\t\tself.pastebutton = Button ('Paste', self.pastebuttonclicked).ac ('schemapastebutton');\n\t\t\t\t\tself.creatediv.aa (list ([self.createcombo, self.pastebutton]));\n\t\t\t\t\tif (self.writepreference.addchild) {\n\t\t\t\t\t\tself.createhook.a (self.creatediv);\n\t\t\t\t\t}\n\t\t\t\t\tself.openbutton.ac ('schemacollectionopenbuttondone');\n\t\t\t\t\tself.buildchilds ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget writepreferencechangedtask () {return __get__ (this, function (self) {\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (SchemaCollection, '__init__') (self, args);\n\t\t\t\tself.kind = 'collection';\n\t\t\t\tself.opened = false;\n\t\t\t\tself.childs = args.py_get ('childs', list ([]));\n\t\t\t\tself.editmode = args.py_get ('editmode', false);\n\t\t\t\tself.childseditable = args.py_get ('childseditable', true);\n\t\t\t\tself.element.ac ('schemacollection');\n\t\t\t\tself.openbutton = Div ().aac (list (['schemacollectionopenbutton', 'noselect'])).ae ('mousedown', self.openchilds);\n\t\t\t\tself.element.aa (list ([self.openbutton]));\n\t\t\t\tself.createcombo = null;\n\t\t\t\tself.createhook = Div ();\n\t\t\t\tself.childshook = Div ();\n\t\t\t\tself.opendiv = Div ().ac ('schemacollectionopendiv');\n\t\t\t\tself.opendiv.aa (list ([self.createhook, self.childshook]));\n\t\t\t\tself.afterelementhook.a (self.opendiv);\n\t\t\t\tself.openchilds ();\n\t\t\t\tif (!(self.writepreference.childsopened)) {\n\t\t\t\t\tself.openchilds ();\n\t\t\t\t}\n\t\t\t});}\n\t\t});\n\t\tvar SchemaList = __class__ ('SchemaList', [SchemaCollection], {\n\t\t\t__module__: __name__,\n\t\t\tget getfirstselectedindex () {return __get__ (this, function (self) {\n\t\t\t\tvar i = 0;\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tif (item.enabled) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\tvar listobj = list ([]);\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tlistobj.append (item.toobj ());\n\t\t\t\t}\n\t\t\t\tvar obj = self.baseobj ();\n\t\t\t\tobj ['items'] = listobj;\n\t\t\t\treturn obj;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (SchemaList, '__init__') (self, args);\n\t\t\t\tself.kind = 'list';\n\t\t\t\tself.element.ac ('schemalist');\n\t\t\t\tself.writepreference.setdisabledlist (list (['editvalue', 'slider', 'check']));\n\t\t\t});}\n\t\t});\n\t\tvar SchemaDict = __class__ ('SchemaDict', [SchemaCollection], {\n\t\t\t__module__: __name__,\n\t\t\tget setchildatkey () {return __get__ (this, function (self, key, item) {\n\t\t\t\titem.setchildparent (self);\n\t\t\t\tvar nameditem = NamedSchemaItem (dict ({'key': key, 'item': item}));\n\t\t\t\tvar i = self.getitemindexbykey (key);\n\t\t\t\tif (i === null) {\n\t\t\t\t\tself.childs.append (nameditem);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.childs [i] = nameditem;\n\t\t\t\t}\n\t\t\t\tself.openchilds ();\n\t\t\t\tself.openchilds ();\n\t\t\t});},\n\t\t\tget getfirstselectedindex () {return __get__ (this, function (self) {\n\t\t\t\tvar i = 0;\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tif (item.item.enabled) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget getitemindexbykey () {return __get__ (this, function (self, key) {\n\t\t\t\tvar i = 0;\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tif (item.key == key) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget toobj () {return __get__ (this, function (self) {\n\t\t\t\tvar dictobj = list ([]);\n\t\t\t\tvar __iterable0__ = self.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tvar sch = dict ({'key': item.key, 'item': item.item.toobj ()});\n\t\t\t\t\tdictobj.append (sch);\n\t\t\t\t}\n\t\t\t\tvar obj = self.baseobj ();\n\t\t\t\tobj ['items'] = dictobj;\n\t\t\t\treturn obj;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (SchemaDict, '__init__') (self, args);\n\t\t\t\tself.kind = 'dict';\n\t\t\t\tself.element.ac ('schemadict');\n\t\t\t\tself.writepreference.setdisabledlist (list (['editvalue', 'slider', 'check']));\n\t\t\t});}\n\t\t});\n\t\tvar schemawritepreferencefromobj = function (obj) {\n\t\t\tvar swp = SchemaWritePreference ();\n\t\t\tvar __iterable0__ = SCHEMA_WRITE_PREFERENCE_DEFAULTS;\n\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\tswp [item ['key']] = getfromobj (obj, item ['key'], item ['default']);\n\t\t\t}\n\t\t\treturn swp;\n\t\t};\n\t\tvar schemafromobj = function (obj) {\n\t\t\tvar kind = getfromobj (obj, 'kind', 'dict');\n\t\t\tvar enabled = getfromobj (obj, 'enabled', DEFAULT_ENABLED);\n\t\t\tvar help = getfromobj (obj, 'help', DEFAULT_HELP);\n\t\t\tvar writepreference = schemawritepreferencefromobj (getfromobj (obj, 'writepreference', dict ({})));\n\t\t\tvar returnobj = dict ({});\n\t\t\tif (kind == 'scalar') {\n\t\t\t\tvar returnobj = SchemaScalar (dict ({'value': obj ['value'], 'minvalue': obj ['minvalue'], 'maxvalue': obj ['maxvalue'], 'writepreference': writepreference}));\n\t\t\t}\n\t\t\telse if (kind == 'list') {\n\t\t\t\tvar py_items = obj ['items'];\n\t\t\t\tvar childs = list ([]);\n\t\t\t\tvar __iterable0__ = py_items;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tvar sch = schemafromobj (item);\n\t\t\t\t\tchilds.append (sch);\n\t\t\t\t}\n\t\t\t\tvar returnobj = SchemaList (dict ({'childs': childs, 'writepreference': writepreference}));\n\t\t\t\tvar __iterable0__ = returnobj.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tchild.setchildparent (returnobj);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (kind == 'dict') {\n\t\t\t\tvar py_items = obj ['items'];\n\t\t\t\tvar childs = list ([]);\n\t\t\t\tvar __iterable0__ = py_items;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar itemobj = __iterable0__ [__index0__];\n\t\t\t\t\tvar key = itemobj ['key'];\n\t\t\t\t\tvar item = itemobj ['item'];\n\t\t\t\t\tvar sch = schemafromobj (item);\n\t\t\t\t\tvar namedsch = NamedSchemaItem (dict ({'key': key, 'item': sch, 'writepreference': writepreference}));\n\t\t\t\t\tchilds.append (namedsch);\n\t\t\t\t}\n\t\t\t\tvar returnobj = SchemaDict (dict ({'childs': childs, 'writepreference': writepreference}));\n\t\t\t\tvar __iterable0__ = returnobj.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tchild.item.setchildparent (returnobj);\n\t\t\t\t\tchild.setkeychangedcallback (returnobj.updatecreatecombo);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturnobj.setenabled (enabled);\n\t\t\treturnobj.help = help;\n\t\t\treturn returnobj;\n\t\t};\n\t\tvar getpathlistfromschema = function (sch, pathlist) {\n\t\t\tif (len (pathlist) <= 0) {\n\t\t\t\treturn sch;\n\t\t\t}\n\t\t\tvar key = pathlist [0];\n\t\t\tvar pathlist = pathlist.__getslice__ (1, null, 1);\n\t\t\tif (key == '#') {\n\t\t\t\tif (sch.kind == 'scalar') {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\telse if (sch.kind == 'list') {\n\t\t\t\t\tvar i = sch.getfirstselectedindex ();\n\t\t\t\t\tif (i == null) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn getpathlistfromschema (sch.childs [i], pathlist);\n\t\t\t\t}\n\t\t\t\telse if (sch.kind == 'dict') {\n\t\t\t\t\tvar i = sch.getfirstselectedindex ();\n\t\t\t\t\tif (i == null) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn getpathlistfromschema (sch.childs [i].item, pathlist);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (sch.kind == 'scalar') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse if (sch.kind == 'list') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse if (sch.kind == 'dict') {\n\t\t\t\tvar __iterable0__ = sch.childs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar child = __iterable0__ [__index0__];\n\t\t\t\t\tif (child.key == key) {\n\t\t\t\t\t\treturn getpathlistfromschema (child.item, pathlist);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\tvar getpathfromschema = function (sch, path) {\n\t\t\tvar pathlist = path.py_split ('/');\n\t\t\treturn getpathlistfromschema (sch, pathlist);\n\t\t};\n\t\tvar getscalarfromschema = function (sch, path) {\n\t\t\tvar found = getpathfromschema (sch, path);\n\t\t\tif (!(found === null)) {\n\t\t\t\tif (found.kind == 'scalar') {\n\t\t\t\t\treturn found.value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar found = getpathfromschema (sch, path + '/#');\n\t\t\tif (!(found === null)) {\n\t\t\t\tif (found.kind == 'scalar') {\n\t\t\t\t\treturn found.value;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\tvar schemafromucioptionsobj = function (obj) {\n\t\t\tvar ucioptions = SchemaDict (dict ({}));\n\t\t\tvar __iterable0__ = obj;\n\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\tvar opt = __iterable0__ [__index0__];\n\t\t\t\tvar key = opt ['key'];\n\t\t\t\tvar kind = opt ['kind'];\n\t\t\t\tvar py_default = opt ['default'];\n\t\t\t\tvar min = opt ['min'];\n\t\t\t\tvar max = opt ['max'];\n\t\t\t\tvar options = opt ['options'];\n\t\t\t\tvar item = SchemaScalar (dict ({'value': py_default}));\n\t\t\t\tif (kind == 'spin') {\n\t\t\t\t\titem.minvalue = min;\n\t\t\t\t\titem.maxvalue = max;\n\t\t\t\t\titem.writepreference.slider = true;\n\t\t\t\t\titem.build ();\n\t\t\t\t}\n\t\t\t\telse if (kind == 'check') {\n\t\t\t\t\titem.value = 'false';\n\t\t\t\t\tif (py_default) {\n\t\t\t\t\t\titem.value = 'true';\n\t\t\t\t\t}\n\t\t\t\t\titem.writepreference.check = true;\n\t\t\t\t\titem.setenabled (py_default);\n\t\t\t\t\titem.build ();\n\t\t\t\t}\n\t\t\t\telse if (kind == 'combo') {\n\t\t\t\t\tvar item = SchemaList (dict ({}));\n\t\t\t\t\titem.writepreference.radio = true;\n\t\t\t\t\tvar __iterable1__ = options;\n\t\t\t\t\tfor (var __index1__ = 0; __index1__ < len (__iterable1__); __index1__++) {\n\t\t\t\t\t\tvar comboopt = __iterable1__ [__index1__];\n\t\t\t\t\t\tvar comboitem = SchemaScalar (dict ({'value': comboopt}));\n\t\t\t\t\t\tcomboitem.setenabled (comboopt == py_default);\n\t\t\t\t\t\tcomboitem.setchildparent (item);\n\t\t\t\t\t\titem.childs.append (comboitem);\n\t\t\t\t\t}\n\t\t\t\t\titem.openchilds ();\n\t\t\t\t\titem.openchilds ();\n\t\t\t\t}\n\t\t\t\titem.setchildparent (ucioptions);\n\t\t\t\tvar nameditem = NamedSchemaItem (dict ({'key': key, 'item': item}));\n\t\t\t\tucioptions.childs.append (nameditem);\n\t\t\t}\n\t\t\treturn ucioptions;\n\t\t};\n\t\tvar schemaclipboard = NamedSchemaItem (dict ({}));\n\t\tvar DirBrowser = __class__ ('DirBrowser', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (DirBrowser, '__init__') (self, 'div');\n\t\t\t\tself.pathlist = list ([]);\n\t\t\t\tself.loadpathlist (self.pathlist);\n\t\t\t});},\n\t\t\tget loadpathlist () {return __get__ (this, function (self) {\n\t\t\t\tgetjson ('/dirlist/root/{}'.format (self.path ()), self.build, (function __lambda__ (err) {\n\t\t\t\t\treturn print (err);\n\t\t\t\t}));\n\t\t\t});},\n\t\t\tget toparentdir () {return __get__ (this, function (self) {\n\t\t\t\tif (len (self.pathlist) > 0) {\n\t\t\t\t\tself.pathlist.py_pop ();\n\t\t\t\t}\n\t\t\t\tself.loadpathlist ();\n\t\t\t});},\n\t\t\tget opendirfactory () {return __get__ (this, function (self, py_name) {\n\t\t\t\tvar opendir = function () {\n\t\t\t\t\tself.pathlist.append (py_name);\n\t\t\t\t\tself.loadpathlist ();\n\t\t\t\t};\n\t\t\t\treturn opendir;\n\t\t\t});},\n\t\t\tget path () {return __get__ (this, function (self) {\n\t\t\t\treturn '/'.join (self.pathlist);\n\t\t\t});},\n\t\t\tget namepath () {return __get__ (this, function (self, py_name) {\n\t\t\t\tif (len (self.pathlist) <= 0) {\n\t\t\t\t\treturn py_name;\n\t\t\t\t}\n\t\t\t\treturn '/'.join (list ([self.path (), py_name]));\n\t\t\t});},\n\t\t\tget refresh () {return __get__ (this, function (self) {\n\t\t\t\tself.loadpathlist ();\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self, statsobj) {\n\t\t\t\tself.x ();\n\t\t\t\tself.a (Button ('Refresh', self.refresh).ac ('dirbrowserrefreshbutton'));\n\t\t\t\tvar dirs = list ([]);\n\t\t\t\tvar files = list ([]);\n\t\t\t\tvar __iterable0__ = statsobj;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tif (item ['isdir']) {\n\t\t\t\t\t\tdirs.append (item);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tfiles.append (item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar sorteddirs = sorted (dirs, __kwargtrans__ ({key: (function __lambda__ (item) {\n\t\t\t\t\treturn item ['name'].toLowerCase ();\n\t\t\t\t})}));\n\t\t\t\tvar sortedfiles = sorted (files, __kwargtrans__ ({key: (function __lambda__ (item) {\n\t\t\t\t\treturn item ['name'].toLowerCase ();\n\t\t\t\t})}));\n\t\t\t\tvar sortedobj = list ([]);\n\t\t\t\tvar __iterable0__ = sorteddirs;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tsortedobj.append (item);\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = sortedfiles;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tsortedobj.append (item);\n\t\t\t\t}\n\t\t\t\tif (len (self.pathlist) > 0) {\n\t\t\t\t\tvar updiv = Div ().aac (list (['dirbrowseritem', 'dirbrowserdir', 'noselect'])).ae ('mousedown', self.toparentdir);\n\t\t\t\t\tupdiv.a (Div ().aac (list (['dirbrowsertoparent', 'dirbrowserdirname'])).html ('..'));\n\t\t\t\t\tself.a (updiv);\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = sortedobj;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar item = __iterable0__ [__index0__];\n\t\t\t\t\tvar itemdiv = Div ().aac (list (['dirbrowseritem', 'noselect']));\n\t\t\t\t\tvar namediv = Div ().ac ('dirbrowsername');\n\t\t\t\t\tvar sizediv = Div ().ac ('dirbrowsersize');\n\t\t\t\t\tif (item ['isdir']) {\n\t\t\t\t\t\tvar text = item ['name'];\n\t\t\t\t\t\titemdiv.ac ('dirbrowserdir').ae ('mousedown', self.opendirfactory (item ['name']));\n\t\t\t\t\t\tnamediv.ac ('dirbrowserdirname').html (text);\n\t\t\t\t\t\tsizediv.html ('dir');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar text = \"<a href='/file/{}' target='_blank' rel='noopener noreferrer'>{}</a>\".format (self.namepath (item ['name']), item ['name']);\n\t\t\t\t\t\titemdiv.ac ('dirbrowserfile');\n\t\t\t\t\t\tnamediv.html (text);\n\t\t\t\t\t\tsizediv.html ('{} bytes'.format (item ['st_size']));\n\t\t\t\t\t}\n\t\t\t\t\titemdiv.a (namediv);\n\t\t\t\t\titemdiv.a (Div ().ac ('dirbrowsermodat').html (new Date (item ['st_mtime'] * 1000).toLocaleString ()));\n\t\t\t\t\titemdiv.a (sizediv);\n\t\t\t\t\tvar rwxdiv = Div ().ac ('dirbrowserrwx').html (item ['st_mode_unix_rwx']);\n\t\t\t\t\titemdiv.a (rwxdiv);\n\t\t\t\t\tself.a (itemdiv);\n\t\t\t\t}\n\t\t\t});}\n\t\t});\n\t\tvar STANDARD_START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1';\n\t\tvar ANTICHESS_START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w - - 0 1';\n\t\tvar RACING_KINGS_START_FEN = '8/8/8/8/8/8/krbnNBRK/qrbnNBRQ w - - 0 1';\n\t\tvar HORDE_START_FEN = 'rnbqkbnr/pppppppp/8/1PP2PP1/PPPPPPPP/PPPPPPPP/PPPPPPPP/PPPPPPPP w kq - 0 1';\n\t\tvar THREE_CHECK_START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 3+3 0 1';\n\t\tvar CRAZYHOUSE_START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[] w KQkq - 0 1';\n\t\tvar PIECE_KINDS = list (['p', 'n', 'b', 'r', 'q', 'k']);\n\t\tvar WHITE = 1;\n\t\tvar BLACK = 0;\n\t\tvar VARIANT_OPTIONS = dict ({'standard': 'Standard', 'fromPosition': 'From Position', 'antichess': 'Antichess', 'atomic': 'Atomic', 'chess960': 'Chess960', 'crazyhouse': 'Crazyhouse', 'horde': 'Horde', 'kingOfTheHill': 'King of the Hill', 'racingKings': 'Racing Kings', 'threeCheck': 'Three Check'});\n\t\tvar PIECE_NAMES = dict ({'p': 'Pawn', 'n': 'Knight', 'b': 'Bishop', 'r': 'Rook', 'q': 'Queen', 'k': 'King'});\n\t\tvar PROMPIECEKINDS_STANDARD = list (['n', 'b', 'r', 'q']);\n\t\tvar PROMPIECEKINDS_ANTICHESS = list (['n', 'b', 'r', 'q', 'k']);\n\t\tvar prompiecekindsforvariantkey = function (variantkey) {\n\t\t\tif (variantkey == 'antichess') {\n\t\t\t\treturn PROMPIECEKINDS_ANTICHESS;\n\t\t\t}\n\t\t\treturn PROMPIECEKINDS_STANDARD;\n\t\t};\n\t\tvar piececolortocolorname = function (color) {\n\t\t\tif (color == WHITE) {\n\t\t\t\treturn 'White';\n\t\t\t}\n\t\t\telse if (color == BLACK) {\n\t\t\t\treturn 'Black';\n\t\t\t}\n\t\t\treturn 'Invalidcolor';\n\t\t};\n\t\tvar piecekindtopiecename = function (kind) {\n\t\t\tif (__in__ (kind, PIECE_NAMES)) {\n\t\t\t\treturn PIECE_NAMES [kind];\n\t\t\t}\n\t\t\treturn 'Invalidpiece';\n\t\t};\n\t\tvar getstartfenforvariantkey = function (variantkey) {\n\t\t\tif (variantkey == 'antichess') {\n\t\t\t\treturn ANTICHESS_START_FEN;\n\t\t\t}\n\t\t\tif (variantkey == 'racingKings') {\n\t\t\t\treturn RACING_KINGS_START_FEN;\n\t\t\t}\n\t\t\tif (variantkey == 'horde') {\n\t\t\t\treturn HORDE_START_FEN;\n\t\t\t}\n\t\t\tif (variantkey == 'threeCheck') {\n\t\t\t\treturn THREE_CHECK_START_FEN;\n\t\t\t}\n\t\t\tif (variantkey == 'crazyhouse') {\n\t\t\t\treturn CRAZYHOUSE_START_FEN;\n\t\t\t}\n\t\t\treturn STANDARD_START_FEN;\n\t\t};\n\t\tvar Piece = __class__ ('Piece', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, kind, color) {\n\t\t\t\tif (typeof kind == 'undefined' || (kind != null && kind .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar kind = null;\n\t\t\t\t};\n\t\t\t\tif (typeof color == 'undefined' || (color != null && color .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar color = null;\n\t\t\t\t};\n\t\t\t\tself.kind = kind;\n\t\t\t\tself.color = color;\n\t\t\t});},\n\t\t\tget isempty () {return __get__ (this, function (self) {\n\t\t\t\treturn self.kind === null;\n\t\t\t});},\n\t\t\tget ispiece () {return __get__ (this, function (self) {\n\t\t\t\treturn !(self.isempty ());\n\t\t\t});},\n\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\tif (self.isempty ()) {\n\t\t\t\t\treturn 'Piece[None]';\n\t\t\t\t}\n\t\t\t\treturn 'Piece[{} {}]'.format (piececolortocolorname (self.color), piecekindtopiecename (self.kind));\n\t\t\t});}\n\t\t});\n\t\tvar isvalidpieceletter = function (pieceletter) {\n\t\t\tif (__in__ (pieceletter, PIECE_KINDS)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (__in__ (pieceletter.toLowerCase (), PIECE_KINDS)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t\tvar piecelettertopiece = function (pieceletter) {\n\t\t\tif (isvalidpieceletter (pieceletter)) {\n\t\t\t\tvar pieceletterlower = pieceletter.toLowerCase ();\n\t\t\t\tif (pieceletterlower == pieceletter) {\n\t\t\t\t\treturn Piece (pieceletterlower, BLACK);\n\t\t\t\t}\n\t\t\t\treturn Piece (pieceletterlower, WHITE);\n\t\t\t}\n\t\t\tprint ('warning, piece letter not valid', pieceletter);\n\t\t\treturn Piece ();\n\t\t};\n\t\tvar getclassforpiece = function (p, style) {\n\t\t\tvar kind = p.kind;\n\t\t\tif (p.color == WHITE) {\n\t\t\t\tvar kind = 'w' + kind;\n\t\t\t}\n\t\t\treturn (style + 'piece') + kind;\n\t\t};\n\t\tvar Square = __class__ ('Square', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, file, rank) {\n\t\t\t\tself.file = file;\n\t\t\t\tself.rank = rank;\n\t\t\t});},\n\t\t\tget p () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn Square (self.file + sq.file, self.rank + sq.rank);\n\t\t\t});},\n\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\treturn 'Square[file: {} , rank: {}]'.format (self.file, self.rank);\n\t\t\t});},\n\t\t\tget copy () {return __get__ (this, function (self) {\n\t\t\t\treturn Square (self.file, self.rank);\n\t\t\t});}\n\t\t});\n\t\tvar Move = __class__ ('Move', [object], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, fromsq, tosq, prompiece) {\n\t\t\t\tif (typeof prompiece == 'undefined' || (prompiece != null && prompiece .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar prompiece = Piece ();\n\t\t\t\t};\n\t\t\t\tself.fromsq = fromsq;\n\t\t\t\tself.tosq = tosq;\n\t\t\t\tself.prompiece = prompiece;\n\t\t\t});},\n\t\t\tget __repr__ () {return __get__ (this, function (self) {\n\t\t\t\treturn 'Move [from: {} , to: {} , prom: {}]'.format (self.fromsq, self.tosq, self.prompiece);\n\t\t\t});}\n\t\t});\n\t\tvar PieceStore = __class__ ('PieceStore', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget dragstartfactory () {return __get__ (this, function (self, p, pdiv, pdivcopy) {\n\t\t\t\tvar dragstart = function (ev) {\n\t\t\t\t\tif (self.show) {\n\t\t\t\t\t\tev.preventDefault ();\n\t\t\t\t\t\treturn ;\n\t\t\t\t\t}\n\t\t\t\t\tself.parent.dragkind = 'set';\n\t\t\t\t\tself.parent.draggedsetpiece = p;\n\t\t\t\t\tself.parent.draggedpdiv = pdivcopy;\n\t\t\t\t\tself.parent.movecanvashook.x ();\n\t\t\t\t\tpdiv.op (0.7);\n\t\t\t\t};\n\t\t\t\treturn dragstart;\n\t\t\t});},\n\t\t\tget setstore () {return __get__ (this, function (self, store) {\n\t\t\t\tself.store = store;\n\t\t\t\tself.container.x ();\n\t\t\t\tself.pieces = dict ({});\n\t\t\t\tvar __iterable0__ = self.store.py_split ('');\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar pieceletter = __iterable0__ [__index0__];\n\t\t\t\t\tvar p = piecelettertopiece (pieceletter);\n\t\t\t\t\tif (p.color == self.color) {\n\t\t\t\t\t\tif (__in__ (p.kind, self.pieces)) {\n\t\t\t\t\t\t\tself.pieces [p.kind] ['mul']++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar pcdiv = Div ().pr ().w (self.piecesize).h (self.piecesize);\n\t\t\t\t\t\t\tvar pdiv = Div ().pa ().cp ().ac (getclassforpiece (p, self.parent.piecestyle)).w (self.piecesize).h (self.piecesize);\n\t\t\t\t\t\t\tvar pdivcopy = Div ().pa ().cp ().ac (getclassforpiece (p, self.parent.piecestyle)).w (self.piecesize).h (self.piecesize);\n\t\t\t\t\t\t\tpdiv.t (0).l (0).sa ('draggable', true).ae ('dragstart', self.dragstartfactory (p, pdiv, pdivcopy));\n\t\t\t\t\t\t\tpcdiv.a (pdiv);\n\t\t\t\t\t\t\tself.pieces [p.kind] = dict ({'mul': 1, 'p': p, 'pcdiv': pcdiv});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar __iterable0__ = self.pieces.py_items ();\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar __left0__ = __iterable0__ [__index0__];\n\t\t\t\t\tvar pkind = __left0__ [0];\n\t\t\t\t\tvar pdesc = __left0__ [1];\n\t\t\t\t\tvar muldiv = Div ().pa ().w (self.muldivsize).h (self.muldivsize).fs (self.muldivsize * 1.3).html ('{}'.format (pdesc ['mul']));\n\t\t\t\t\tmuldiv.l (self.piecesize - self.muldivsize).t (0).ac ('storemuldiv');\n\t\t\t\t\tpdesc ['pcdiv'].a (muldiv);\n\t\t\t\t\tself.container.a (pdesc ['pcdiv']);\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (PieceStore, '__init__') (self, 'div');\n\t\t\t\tself.show = args.py_get ('show', false);\n\t\t\t\tself.parent = args.py_get ('parent', BasicBoard (dict ({})));\n\t\t\t\tself.store = args.py_get ('store', '');\n\t\t\t\tself.color = args.py_get ('color', WHITE);\n\t\t\t\tself.container = args.py_get ('containerdiv', Div ());\n\t\t\t\tself.container.ac ('noselect');\n\t\t\t\tself.piecesize = args.py_get ('piecesize', self.parent.piecesize);\n\t\t\t\tself.muldivsize = int (self.piecesize / 2);\n\t\t\t\tself.a (self.container);\n\t\t\t\tself.setstore (self.store);\n\t\t\t});}\n\t\t});\n\t\tvar BasicBoard = __class__ ('BasicBoard', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget clearcanvases () {return __get__ (this, function (self) {\n\t\t\t\tself.movecanvas.py_clear ();\n\t\t\t\tself.piececanvashook.x ();\n\t\t\t});},\n\t\t\tget ucitosquare () {return __get__ (this, function (self, squci) {\n\t\t\t\ttry {\n\t\t\t\t\tvar file = squci.charCodeAt (0) - 'a'.charCodeAt (0);\n\t\t\t\t\tvar rank = self.lastrank - (squci.charCodeAt (1) - '1'.charCodeAt (0));\n\t\t\t\t\treturn Square (file, rank);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget ucitomove () {return __get__ (this, function (self, moveuci) {\n\t\t\t\tif (__in__ ('@', moveuci)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar parts = moveuci.py_split ('@');\n\t\t\t\t\t\tvar sq = self.ucitosquare (parts [1]);\n\t\t\t\t\t\tvar move = Move (sq, sq, Piece (parts [0].toLowerCase (), self.turn ()));\n\t\t\t\t\t\treturn move;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar move = Move (self.ucitosquare (moveuci.__getslice__ (0, 2, 1)), self.ucitosquare (moveuci.__getslice__ (2, 4, 1)));\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (len (moveuci) > 4) {\n\t\t\t\t\t\t\t\tmove.prompiece = Piece (moveuci [4].toLowerCase (), self.turn ());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\tprint ('could not parse prompiece');\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn move;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.squaresize = 35;\n\t\t\t\tself.calcsizes ();\n\t\t\t\twhile (self.totalheight () < height) {\n\t\t\t\t\tself.squaresize++;\n\t\t\t\t\tself.calcsizes ();\n\t\t\t\t}\n\t\t\t\tself.squaresize--;\n\t\t\t\tself.calcsizes ();\n\t\t\t\tself.build ();\n\t\t\t});},\n\t\t\tget totalheight () {return __get__ (this, function (self) {\n\t\t\t\tvar th = self.outerheight + cpick (self.showfen, self.fendivheight, 0);\n\t\t\t\tif (self.variantkey == 'crazyhouse') {\n\t\t\t\t\tth += 2 * self.squaresize;\n\t\t\t\t}\n\t\t\t\treturn th;\n\t\t\t});},\n\t\t\tget squareuci () {return __get__ (this, function (self, sq) {\n\t\t\t\tvar fileletter = String.fromCharCode (sq.file + 'a'.charCodeAt (0));\n\t\t\t\tvar rankletter = String.fromCharCode ((self.lastrank - sq.rank) + '1'.charCodeAt (0));\n\t\t\t\treturn fileletter + rankletter;\n\t\t\t});},\n\t\t\tget moveuci () {return __get__ (this, function (self, move) {\n\t\t\t\tvar fromuci = self.squareuci (move.fromsq);\n\t\t\t\tvar touci = self.squareuci (move.tosq);\n\t\t\t\tvar promuci = cpick (move.prompiece.isempty (), '', move.prompiece.kind);\n\t\t\t\treturn (fromuci + touci) + promuci;\n\t\t\t});},\n\t\t\tget islightfilerank () {return __get__ (this, function (self, file, rank) {\n\t\t\t\treturn __mod__ (file + rank, 2) == 0;\n\t\t\t});},\n\t\t\tget islightsquare () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn self.islightfilerank (sq.file, sq.rank);\n\t\t\t});},\n\t\t\tget squarelist () {return __get__ (this, function (self) {\n\t\t\t\tvar squarelist = list ([]);\n\t\t\t\tfor (var file = 0; file < self.numfiles; file++) {\n\t\t\t\t\tfor (var rank = 0; rank < self.numranks; rank++) {\n\t\t\t\t\t\tsquarelist.append (Square (file, rank));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn squarelist;\n\t\t\t});},\n\t\t\tget squarecoordsvect () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn Vect (sq.file * self.squaresize, sq.rank * self.squaresize);\n\t\t\t});},\n\t\t\tget squarecoordsmiddlevect () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn self.squarecoordsvect (sq).p (Vect (self.squaresize / 2, self.squaresize / 2));\n\t\t\t});},\n\t\t\tget piececoordsvect () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn self.squarecoordsvect (sq).p (Vect (self.squarepadding, self.squarepadding));\n\t\t\t});},\n\t\t\tget flipawaresquare () {return __get__ (this, function (self, sq) {\n\t\t\t\tif (self.flip) {\n\t\t\t\t\treturn Square (self.lastfile - sq.file, self.lastrank - sq.rank);\n\t\t\t\t}\n\t\t\t\treturn sq;\n\t\t\t});},\n\t\t\tget piecedragstartfactory () {return __get__ (this, function (self, sq, pdiv) {\n\t\t\t\tvar piecedragstart = function (ev) {\n\t\t\t\t\tif (self.promoting || self.show) {\n\t\t\t\t\t\tev.preventDefault ();\n\t\t\t\t\t\treturn ;\n\t\t\t\t\t}\n\t\t\t\t\tself.dragkind = 'move';\n\t\t\t\t\tself.draggedsq = sq;\n\t\t\t\t\tself.draggedpdiv = pdiv;\n\t\t\t\t\tself.movecanvashook.x ();\n\t\t\t\t\tpdiv.op (0.1);\n\t\t\t\t};\n\t\t\t\treturn piecedragstart;\n\t\t\t});},\n\t\t\tget piecedragfactory () {return __get__ (this, function (self) {\n\t\t\t\tvar piecedrag = function (ev) {\n\t\t\t\t\t// pass;\n\t\t\t\t};\n\t\t\t\treturn piecedrag;\n\t\t\t});},\n\t\t\tget piecedragendfactory () {return __get__ (this, function (self, sq, pdiv) {\n\t\t\t\tvar piecedragend = function (ev) {\n\t\t\t\t\tpdiv.op (0.5);\n\t\t\t\t};\n\t\t\t\treturn piecedragend;\n\t\t\t});},\n\t\t\tget piecedragoverfactory () {return __get__ (this, function (self, sq) {\n\t\t\t\tvar piecedragover = function (ev) {\n\t\t\t\t\tev.preventDefault ();\n\t\t\t\t};\n\t\t\t\treturn piecedragover;\n\t\t\t});},\n\t\t\tget ismovepromotion () {return __get__ (this, function (self, move) {\n\t\t\t\tvar fromp = self.getpieceatsquare (move.fromsq);\n\t\t\t\tif (fromp.kind == 'p' && fromp.color == self.turn ()) {\n\t\t\t\t\tif (self.iswhitesturn ()) {\n\t\t\t\t\t\tif (move.tosq.rank == 0) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (move.tosq.rank == self.lastrank) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});},\n\t\t\tget piecedropfactory () {return __get__ (this, function (self, sq) {\n\t\t\t\tvar piecedrop = function (ev) {\n\t\t\t\t\tev.preventDefault ();\n\t\t\t\t\tself.draggedpdiv.pv (self.piececoordsvect (self.flipawaresquare (sq)));\n\t\t\t\t\tself.draggedpdiv.zi (100);\n\t\t\t\t\tif (self.dragkind == 'move') {\n\t\t\t\t\t\tself.dragmove = Move (self.draggedsq, sq);\n\t\t\t\t\t\tif (self.ismovepromotion (self.dragmove)) {\n\t\t\t\t\t\t\tself.promoting = true;\n\t\t\t\t\t\t\tself.build ();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!(self.movecallback === null)) {\n\t\t\t\t\t\t\tself.movecallback (self.variantkey, self.fen, self.moveuci (self.dragmove));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (self.dragkind == 'set') {\n\t\t\t\t\t\tself.container.a (self.draggedpdiv);\n\t\t\t\t\t\tif (!(self.movecallback === null)) {\n\t\t\t\t\t\t\tvar setuci = '{}@{}'.format (self.draggedsetpiece.kind, self.squareuci (sq));\n\t\t\t\t\t\t\tself.movecallback (self.variantkey, self.fen, setuci);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn piecedrop;\n\t\t\t});},\n\t\t\tget buildsquares () {return __get__ (this, function (self) {\n\t\t\t\tself.container.x ();\n\t\t\t\tvar __iterable0__ = self.squarelist ();\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar sq = __iterable0__ [__index0__];\n\t\t\t\t\tvar sqclass = choose (self.islightsquare (sq), 'boardsquarelight', 'boardsquaredark');\n\t\t\t\t\tvar sqdiv = Div ().aac (list (['boardsquare', sqclass])).w (self.squaresize).h (self.squaresize);\n\t\t\t\t\tvar fasq = self.flipawaresquare (sq);\n\t\t\t\t\tsqdiv.pv (self.squarecoordsvect (fasq));\n\t\t\t\t\tsqdiv.ae ('dragover', self.piecedragoverfactory (sq));\n\t\t\t\t\tsqdiv.ae ('drop', self.piecedropfactory (sq));\n\t\t\t\t\tself.container.a (sqdiv);\n\t\t\t\t\tvar p = self.getpieceatsquare (sq);\n\t\t\t\t\tif (p.ispiece ()) {\n\t\t\t\t\t\tvar pdiv = Div ().ac ('boardpiece').w (self.piecesize).h (self.piecesize).pv (self.piececoordsvect (fasq));\n\t\t\t\t\t\tpdiv.ac (getclassforpiece (p, self.piecestyle)).sa ('draggable', true);\n\t\t\t\t\t\tpdiv.ae ('dragstart', self.piecedragstartfactory (sq, pdiv));\n\t\t\t\t\t\tpdiv.ae ('drag', self.piecedragfactory ());\n\t\t\t\t\t\tpdiv.ae ('dragend', self.piecedragendfactory (sq, pdiv));\n\t\t\t\t\t\tpdiv.ae ('dragover', self.piecedragoverfactory (sq));\n\t\t\t\t\t\tpdiv.ae ('drop', self.piecedropfactory (sq));\n\t\t\t\t\t\tpdiv.zi (10);\n\t\t\t\t\t\tif (self.variantkey == 'threeCheck') {\n\t\t\t\t\t\t\tif (p.kind == 'k') {\n\t\t\t\t\t\t\t\tvar mul = self.getthreelifesforcolor (p.color);\n\t\t\t\t\t\t\t\tvar lifesdiv = Div ().pa ().t (-(self.squaresize) / 10).l (self.squaresize / 2 + self.squaresize / 10).w (self.squaresize / 2).h (self.squaresize / 2);\n\t\t\t\t\t\t\t\tlifesdiv.ac ('boardthreechecklifesdiv').fs (self.squaresize / 1.5).html ('{}'.format (mul));\n\t\t\t\t\t\t\t\tlifesdiv.cc (p.color == WHITE, '#ff0', '#ff0');\n\t\t\t\t\t\t\t\tpdiv.a (lifesdiv);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tself.container.a (pdiv);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget getthreelifesforcolor () {return __get__ (this, function (self, color) {\n\t\t\t\tvar parts = self.threefen.py_split ('+');\n\t\t\t\tvar mul = 3;\n\t\t\t\tif (color == WHITE) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar mul = int (parts [2]);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\tprint ('warning, could not parse white lifes from', self.threefen);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (color == BLACK) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar mul = int (parts [0]);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\tprint ('warning, could not parse black lifes from', self.threefen);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn mul;\n\t\t\t});},\n\t\t\tget prompiececlickedfactory () {return __get__ (this, function (self, prompiecekind) {\n\t\t\t\tvar prompiececlicked = function () {\n\t\t\t\t\tself.dragmove.prompiece = Piece (prompiecekind, self.turn ());\n\t\t\t\t\tself.movecallback (self.variantkey, self.fen, self.moveuci (self.dragmove));\n\t\t\t\t};\n\t\t\t\treturn prompiececlicked;\n\t\t\t});},\n\t\t\tget buildprominput () {return __get__ (this, function (self) {\n\t\t\t\tvar promkinds = prompiecekindsforvariantkey (self.variantkey);\n\t\t\t\tvar promsq = self.dragmove.tosq.copy ();\n\t\t\t\tvar dir = cpick (promsq.rank >= self.numranks / 2, -(1), 1);\n\t\t\t\tvar ppks = prompiecekindsforvariantkey (self.variantkey);\n\t\t\t\tvar __iterable0__ = ppks;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar ppk = __iterable0__ [__index0__];\n\t\t\t\t\tvar fapromsq = self.flipawaresquare (promsq);\n\t\t\t\t\tvar pp = Piece (ppk, self.turn ());\n\t\t\t\t\tvar psqdiv = Div ().pa ().cp ().zi (150).w (self.squaresize).h (self.squaresize).ac ('boardpromotionsquare');\n\t\t\t\t\tpsqdiv.pv (self.squarecoordsvect (fapromsq));\n\t\t\t\t\tvar ppdiv = Div ().pa ().cp ().zi (200).w (self.piecesize).h (self.piecesize).ac (getclassforpiece (pp, self.piecestyle));\n\t\t\t\t\tppdiv.pv (self.piececoordsvect (fapromsq)).ae ('mousedown', self.prompiececlickedfactory (ppk));\n\t\t\t\t\tself.container.aa (list ([psqdiv, ppdiv]));\n\t\t\t\t\tvar promsq = promsq.p (Square (0, dir));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget promotecancelclick () {return __get__ (this, function (self) {\n\t\t\t\tself.promoting = false;\n\t\t\t\tself.build ();\n\t\t\t});},\n\t\t\tget drawmovearrow () {return __get__ (this, function (self, move, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\tif (move === null) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tvar strokecolor = args.py_get ('strokecolor', '#FFFF00');\n\t\t\t\tvar linewidth = args.py_get ('linewidth', 0.2) * self.squaresize;\n\t\t\t\tvar headwidth = args.py_get ('headwidth', 0.2) * self.squaresize;\n\t\t\t\tvar headheight = args.py_get ('headheight', 0.2) * self.squaresize;\n\t\t\t\tself.movecanvas.lineWidth (linewidth);\n\t\t\t\tself.movecanvas.strokeStyle (strokecolor);\n\t\t\t\tself.movecanvas.fillStyle (strokecolor);\n\t\t\t\tvar tomv = self.squarecoordsmiddlevect (self.flipawaresquare (move.tosq));\n\t\t\t\tself.movecanvas.drawline (self.squarecoordsmiddlevect (self.flipawaresquare (move.fromsq)), tomv);\n\t\t\t\tvar dv = Vect (headwidth, headheight);\n\t\t\t\tself.movecanvas.fillRect (tomv.m (dv), tomv.p (dv));\n\t\t\t\tif (!(move.prompiece.isempty ())) {\n\t\t\t\t\tvar pf = 4;\n\t\t\t\t\tvar dvp = Vect (linewidth * pf, linewidth * pf);\n\t\t\t\t\tmove.prompiece.color = self.turn ();\n\t\t\t\t\tvar ppdiv = Div ().pa ().cp ().ac (getclassforpiece (move.prompiece, self.piecestyle)).w ((linewidth * 2) * pf).h ((linewidth * 2) * pf);\n\t\t\t\t\tppdiv.pv (tomv.m (dvp));\n\t\t\t\t\tself.piececanvashook.a (ppdiv);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget drawuciarrow () {return __get__ (this, function (self, uci, args) {\n\t\t\t\tif (typeof args == 'undefined' || (args != null && args .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar args = dict ({});\n\t\t\t\t};\n\t\t\t\tself.drawmovearrow (self.ucitomove (uci), args);\n\t\t\t});},\n\t\t\tget buildgenmove () {return __get__ (this, function (self) {\n\t\t\t\tif (__in__ ('genmove', self.positioninfo)) {\n\t\t\t\t\tif (!(genmove == 'reset')) {\n\t\t\t\t\t\tvar genmoveuci = self.positioninfo ['genmove'] ['uci'];\n\t\t\t\t\t\tvar genmove = self.ucitomove (genmoveuci);\n\t\t\t\t\t\tif (!(genmove === null)) {\n\t\t\t\t\t\t\tgenmove.prompiece = Piece ();\n\t\t\t\t\t\t\tself.drawmovearrow (genmove);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.sectioncontainer = Div ().ac ('boardsectioncontainer').w (self.outerwidth);\n\t\t\t\tself.outercontainer = Div ().ac ('boardoutercontainer').w (self.outerwidth).h (self.outerheight);\n\t\t\t\tself.container = Div ().ac ('boardcontainer').w (self.width).h (self.height).t (self.margin).l (self.margin);\n\t\t\t\tself.outercontainer.a (self.container);\n\t\t\t\tself.buildsquares ();\n\t\t\t\tself.turndiv = Div ().pa ().w (self.turndivsize).h (self.turndivsize).cbc (self.iswhitesturn (), '#fff', '#000');\n\t\t\t\tif (self.variantkey == 'racingKings') {\n\t\t\t\t\tself.turndiv.ct (self.flip, 0, self.outerheight - self.turndivsize).cl (xor (self.isblacksturn (), self.flip), 0, self.outerwidth - self.turndivsize);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.turndiv.l (self.outerwidth - self.turndivsize).ct (xor (self.isblacksturn (), self.flip), 0, self.outerheight - self.turndivsize);\n\t\t\t\t}\n\t\t\t\tself.outercontainer.a (self.turndiv);\n\t\t\t\tif (self.promoting) {\n\t\t\t\t\tself.buildprominput ();\n\t\t\t\t\tself.container.ae ('mousedown', self.promotecancelclick);\n\t\t\t\t}\n\t\t\t\tself.fentext = RawTextInput (dict ({})).w (self.width).fs (10).setText (self.fen);\n\t\t\t\tself.fendiv = Div ().ac ('boardfendiv').h (self.fendivheight).a (self.fentext);\n\t\t\t\tif (self.variantkey == 'crazyhouse') {\n\t\t\t\t\tself.whitestorediv = Div ().ac ('boardstorediv').h (self.squaresize).w (self.outerwidth);\n\t\t\t\t\tself.blackstorediv = Div ().ac ('boardstorediv').h (self.squaresize).w (self.outerwidth);\n\t\t\t\t\tself.whitestore = PieceStore (dict ({'show': self.show, 'parent': self, 'color': WHITE, 'store': self.crazyfen, 'containerdiv': self.whitestorediv}));\n\t\t\t\t\tself.blackstore = PieceStore (dict ({'show': self.show, 'parent': self, 'color': BLACK, 'store': self.crazyfen, 'containerdiv': self.blackstorediv}));\n\t\t\t\t\tif (self.flip) {\n\t\t\t\t\t\tself.sectioncontainer.aa (list ([self.whitestorediv, self.outercontainer, self.blackstorediv]));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.sectioncontainer.aa (list ([self.blackstorediv, self.outercontainer, self.whitestorediv]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.sectioncontainer.aa (list ([self.outercontainer]));\n\t\t\t\t}\n\t\t\t\tif (self.showfen) {\n\t\t\t\t\tself.sectioncontainer.a (self.fendiv);\n\t\t\t\t}\n\t\t\t\tself.x ().a (self.sectioncontainer);\n\t\t\t\tself.movecanvas = Canvas (self.width, self.height).pa ().t (0).l (0);\n\t\t\t\tself.movecanvashook = Div ().pa ().t (0).l (0).zi (5).op (0.5);\n\t\t\t\tself.piececanvashook = Div ().pa ().t (0).l (0).zi (11).op (0.5);\n\t\t\t\tself.container.aa (list ([self.movecanvashook, self.piececanvashook]));\n\t\t\t\tself.movecanvashook.a (self.movecanvas);\n\t\t\t\tself.buildgenmove ();\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setflip () {return __get__ (this, function (self, flip) {\n\t\t\t\tself.flip = flip;\n\t\t\t\tself.build ();\n\t\t\t});},\n\t\t\tget calcsizes () {return __get__ (this, function (self) {\n\t\t\t\tself.lastfile = self.numfiles - 1;\n\t\t\t\tself.lastrank = self.numranks - 1;\n\t\t\t\tself.area = self.numfiles * self.numranks;\n\t\t\t\tself.width = self.numfiles * self.squaresize;\n\t\t\t\tself.height = self.numranks * self.squaresize;\n\t\t\t\tself.avgsize = (self.width + self.height) / 2;\n\t\t\t\tself.margin = self.marginratio * self.avgsize;\n\t\t\t\tself.squarepadding = self.squarepaddingratio * self.squaresize;\n\t\t\t\tself.piecesize = self.squaresize - 2 * self.squarepadding;\n\t\t\t\tself.outerwidth = self.width + 2 * self.margin;\n\t\t\t\tself.outerheight = self.height + 2 * self.margin;\n\t\t\t\tself.turndivsize = self.margin;\n\t\t\t\tself.fendivheight = 25;\n\t\t\t});},\n\t\t\tget parseargs () {return __get__ (this, function (self, args) {\n\t\t\t\tself.positioninfo = args.py_get ('positioninfo', dict ({}));\n\t\t\t\tself.show = args.py_get ('show', false);\n\t\t\t\tself.showfen = args.py_get ('showfen', true);\n\t\t\t\tself.squaresize = args.py_get ('squaresize', 45);\n\t\t\t\tself.squarepaddingratio = args.py_get ('squarepaddingratio', 0.04);\n\t\t\t\tself.marginratio = args.py_get ('marginratio', 0.02);\n\t\t\t\tself.numfiles = args.py_get ('numfiles', 8);\n\t\t\t\tself.numranks = args.py_get ('numranks', 8);\n\t\t\t\tself.piecestyle = args.py_get ('piecestyle', 'alpha');\n\t\t\t\tself.flip = args.py_get ('flip', false);\n\t\t\t\tself.movecallback = args.py_get ('movecallback', null);\n\t\t\t\tself.calcsizes ();\n\t\t\t});},\n\t\t\tget setpieceati () {return __get__ (this, function (self, i, p) {\n\t\t\t\tif (i >= 0 && i < self.area) {\n\t\t\t\t\tself.rep [i] = p;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, rep index out of range', i);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget getpieceati () {return __get__ (this, function (self, i) {\n\t\t\t\tif (i >= 0 && i < self.area) {\n\t\t\t\t\treturn self.rep [i];\n\t\t\t\t}\n\t\t\t\treturn Piece ();\n\t\t\t});},\n\t\t\tget getpieceatfilerank () {return __get__ (this, function (self, file, rank) {\n\t\t\t\tvar i = rank * self.numfiles + file;\n\t\t\t\treturn self.getpieceati (i);\n\t\t\t});},\n\t\t\tget getpieceatsquare () {return __get__ (this, function (self, sq) {\n\t\t\t\treturn self.getpieceatfilerank (sq.file, sq.rank);\n\t\t\t});},\n\t\t\tget setrepfromfen () {return __get__ (this, function (self, fen) {\n\t\t\t\tself.fen = fen;\n\t\t\t\tself.crazyfen = null;\n\t\t\t\tself.threefen = null;\n\t\t\t\tself.rep = (function () {\n\t\t\t\t\tvar __accu0__ = [];\n\t\t\t\t\tfor (var i = 0; i < self.area; i++) {\n\t\t\t\t\t\t__accu0__.append (Piece ());\n\t\t\t\t\t}\n\t\t\t\t\treturn __accu0__;\n\t\t\t\t}) ();\n\t\t\t\tvar fenparts = self.fen.py_split (' ');\n\t\t\t\tself.rawfen = fenparts [0];\n\t\t\t\tvar rawfenparts = self.rawfen.py_split ('/');\n\t\t\t\tif (self.variantkey == 'crazyhouse') {\n\t\t\t\t\tself.crazyfen = '';\n\t\t\t\t\tif (__in__ ('[', self.rawfen)) {\n\t\t\t\t\t\tvar cfenparts = self.rawfen.py_split ('[');\n\t\t\t\t\t\tself.rawfen = cfenparts [0];\n\t\t\t\t\t\tvar rawfenparts = self.rawfen.py_split ('/');\n\t\t\t\t\t\tvar cfenparts = cfenparts [1].py_split (']');\n\t\t\t\t\t\tself.crazyfen = cfenparts [0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar i = 0;\n\t\t\t\tvar __iterable0__ = rawfenparts;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar rawfenpart = __iterable0__ [__index0__];\n\t\t\t\t\tvar pieceletters = rawfenpart.py_split ('');\n\t\t\t\t\tvar __iterable1__ = pieceletters;\n\t\t\t\t\tfor (var __index1__ = 0; __index1__ < len (__iterable1__); __index1__++) {\n\t\t\t\t\t\tvar pieceletter = __iterable1__ [__index1__];\n\t\t\t\t\t\tif (isvalidpieceletter (pieceletter)) {\n\t\t\t\t\t\t\tself.setpieceati (i, piecelettertopiece (pieceletter));\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tvar mul = 0;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvar mul = int (pieceletter);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t\t\tprint ('warning, multiplicity could not be parsed from', pieceletter);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (var j = 0; j < mul; j++) {\n\t\t\t\t\t\t\t\tself.setpieceati (i, Piece ());\n\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i < self.area) {\n\t\t\t\t\tprint ('warning, raw fen did not fill board');\n\t\t\t\t}\n\t\t\t\telse if (i > self.area) {\n\t\t\t\t\tprint ('warning, raw fen exceeded board');\n\t\t\t\t}\n\t\t\t\tself.turnfen = 'w';\n\t\t\t\tif (len (fenparts) > 1) {\n\t\t\t\t\tself.turnfen = fenparts [1];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, no turn fen');\n\t\t\t\t}\n\t\t\t\tself.castlefen = '-';\n\t\t\t\tif (len (fenparts) > 2) {\n\t\t\t\t\tself.castlefen = fenparts [2];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, no castle fen');\n\t\t\t\t}\n\t\t\t\tself.epfen = '-';\n\t\t\t\tif (len (fenparts) > 3) {\n\t\t\t\t\tself.epfen = fenparts [3];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, no ep fen');\n\t\t\t\t}\n\t\t\t\tvar moveclocksi = cpick (self.variantkey == 'threeCheck', 5, 4);\n\t\t\t\tself.halfmoveclock = 0;\n\t\t\t\tif (len (fenparts) > moveclocksi) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tself.halfmoveclock = int (fenparts [moveclocksi]);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\tprint ('warning, half move clock could not be parsed from', fenparts [4]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, no half move fen');\n\t\t\t\t}\n\t\t\t\tself.fullmovenumber = 1;\n\t\t\t\tif (len (fenparts) > moveclocksi + 1) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tself.fullmovenumber = int (fenparts [moveclocksi + 1]);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\tprint ('warning, full move number could not be parsed from', fenparts [5]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprint ('warning, no full move fen');\n\t\t\t\t}\n\t\t\t\tif (self.variantkey == 'threeCheck') {\n\t\t\t\t\tif (len (fenparts) > 4) {\n\t\t\t\t\t\tself.threefen = fenparts [4];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.promoting = false;\n\t\t\t});},\n\t\t\tget turn () {return __get__ (this, function (self) {\n\t\t\t\tif (self.turnfen == 'w') {\n\t\t\t\t\treturn WHITE;\n\t\t\t\t}\n\t\t\t\treturn BLACK;\n\t\t\t});},\n\t\t\tget iswhitesturn () {return __get__ (this, function (self) {\n\t\t\t\treturn self.turn () == WHITE;\n\t\t\t});},\n\t\t\tget isblacksturn () {return __get__ (this, function (self) {\n\t\t\t\treturn self.turn () == BLACK;\n\t\t\t});},\n\t\t\tget initrep () {return __get__ (this, function (self, args) {\n\t\t\t\tself.variantkey = args.py_get ('variantkey', 'standard');\n\t\t\t\tself.setrepfromfen (args.py_get ('fen', getstartfenforvariantkey (self.variantkey)));\n\t\t\t});},\n\t\t\tget setfromfen () {return __get__ (this, function (self, fen, positioninfo) {\n\t\t\t\tif (typeof positioninfo == 'undefined' || (positioninfo != null && positioninfo .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar positioninfo = dict ({});\n\t\t\t\t};\n\t\t\t\tself.positioninfo = positioninfo;\n\t\t\t\tself.setrepfromfen (fen);\n\t\t\t\tself.build ();\n\t\t\t});},\n\t\t\tget reset () {return __get__ (this, function (self) {\n\t\t\t\tself.setfromfen (getstartfenforvariantkey (self.variantkey));\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (BasicBoard, '__init__') (self, 'div');\n\t\t\t\tself.positioninfo = dict ({});\n\t\t\t\tself.parseargs (args);\n\t\t\t\tself.initrep (args);\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar MultipvInfo = __class__ ('MultipvInfo', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget bestmovesanclickedfactory () {return __get__ (this, function (self, moveuci) {\n\t\t\t\tvar bestmovesanclicked = function () {\n\t\t\t\t\tif (!(self.bestmovesanclickedcallback === null)) {\n\t\t\t\t\t\tself.bestmovesanclickedcallback (moveuci);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn bestmovesanclicked;\n\t\t\t});},\n\t\t\tget scorebonus () {return __get__ (this, function (self) {\n\t\t\t\tif (__in__ ('scorebonus', self.infoi)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar scorebonus = int (self.infoi ['scorebonus']);\n\t\t\t\t\t\treturn scorebonus;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t// pass;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t});},\n\t\t\tget effscore () {return __get__ (this, function (self) {\n\t\t\t\treturn self.scorenumerical + self.scorebonus ();\n\t\t\t});},\n\t\t\tget bonussliderchanged () {return __get__ (this, function (self) {\n\t\t\t\tself.infoi ['scorebonus'] = self.bonusslider.v ();\n\t\t\t\tself.build ();\n\t\t\t\tif (!(self.bonussliderchangedcallback === null)) {\n\t\t\t\t\tself.bonussliderchangedcallback ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.bestmoveuci = self.infoi ['bestmoveuci'];\n\t\t\t\tself.bestmovesan = self.infoi ['bestmovesan'];\n\t\t\t\tself.scorenumerical = self.infoi ['scorenumerical'];\n\t\t\t\tself.pvsan = self.infoi ['pvsan'];\n\t\t\t\tself.pvpgn = self.infoi ['pvpgn'];\n\t\t\t\tself.depth = self.infoi ['depth'];\n\t\t\t\tself.nps = self.infoi ['nps'];\n\t\t\t\tself.container = Div ().ac ('multipvinfocontainer');\n\t\t\t\tself.idiv = Div ().ac ('multipvinfoi').html ('{}.'.format (self.i));\n\t\t\t\tself.bestmovesandiv = Div ().ac ('multipvinfobestmovesan').html (self.bestmovesan);\n\t\t\t\tself.bestmovesandiv.ae ('mousedown', self.bestmovesanclickedfactory (self.bestmoveuci));\n\t\t\t\tself.scorenumericaldiv = Div ().ac ('multipvinfoscorenumerical').html ('{}'.format (scoreverbal (self.effscore ())));\n\t\t\t\tself.bonussliderdiv = Div ().ac ('multipvinfobonussliderdiv');\n\t\t\t\tself.bonusslider = Slider ().setmin (-(500)).setmax (500).ac ('multipvinfobonusslider').sv (self.scorebonus ());\n\t\t\t\tself.bonusslider.ae ('change', self.bonussliderchanged);\n\t\t\t\tself.bonussliderdiv.a (self.bonusslider);\n\t\t\t\tself.depthdiv = Div ().ac ('multipvinfodepth').html ('{}'.format (self.depth));\n\t\t\t\tself.miscdiv = Div ().ac ('multipvinfomisc').html ('nps {}'.format (self.nps));\n\t\t\t\tself.pvdiv = Div ().ac ('multipvinfopv').html (self.pvpgn);\n\t\t\t\tself.container.aa (list ([self.idiv, self.bestmovesandiv, self.scorenumericaldiv, self.bonussliderdiv, self.depthdiv, self.miscdiv, self.pvdiv]));\n\t\t\t\tself.bestmovesandiv.c (scorecolor (self.effscore ()));\n\t\t\t\tself.scorenumericaldiv.c (scorecolor (self.effscore ()));\n\t\t\t\tself.x ().a (self.container);\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, infoi) {\n\t\t\t\t__super__ (MultipvInfo, '__init__') (self, 'div');\n\t\t\t\tself.bestmovesanclickedcallback = null;\n\t\t\t\tself.bonussliderchangedcallback = null;\n\t\t\t\tself.infoi = infoi;\n\t\t\t\tself.i = self.infoi ['i'];\n\t\t\t\tself.build ();\n\t\t\t});}\n\t\t});\n\t\tvar PgnInfo = __class__ ('PgnInfo', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, parent) {\n\t\t\t\t__super__ (PgnInfo, '__init__') (self, 'div');\n\t\t\t\tself.headers = list ([]);\n\t\t\t\tself.parent = parent;\n\t\t\t});},\n\t\t\tget getheader () {return __get__ (this, function (self, key, py_default) {\n\t\t\t\tvar __iterable0__ = self.headers;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar header = __iterable0__ [__index0__];\n\t\t\t\t\tif (header [0] == key) {\n\t\t\t\t\t\treturn header [1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn py_default;\n\t\t\t});},\n\t\t\tget playerlink () {return __get__ (this, function (self, username) {\n\t\t\t\treturn \"<a href='https://lichess.org/@/{}' target='_blank' rel='noopener noreferrer'>{}</a>\".format (username, username);\n\t\t\t});},\n\t\t\tget parsecontent () {return __get__ (this, function (self) {\n\t\t\t\tvar lines = self.content.py_split ('\\n');\n\t\t\t\tself.headers = list ([]);\n\t\t\t\tvar __iterable0__ = lines;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar line = __iterable0__ [__index0__];\n\t\t\t\t\tif (line [0] == '[') {\n\t\t\t\t\t\tvar parts = line.__getslice__ (1, null, 1).py_split ('\"');\n\t\t\t\t\t\tvar key = parts [0].py_split (' ') [0];\n\t\t\t\t\t\tvar value = parts [1].py_split ('\"') [0];\n\t\t\t\t\t\tself.headers.append (tuple ([key, value]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.white = self.getheader ('White', '?');\n\t\t\t\tself.black = self.getheader ('Black', '?');\n\t\t\t\tself.result = self.getheader ('Result', '?');\n\t\t\t\tself.site = self.getheader ('Site', '');\n\t\t\t\tself.whiteelo = self.getheader ('WhiteElo', '?');\n\t\t\t\tself.whiteratingdiff = self.getheader ('WhiteRatingDiff', '?');\n\t\t\t\tself.blackelo = self.getheader ('BlackElo', '?');\n\t\t\t\tself.blackratingdiff = self.getheader ('BlackRatingDiff', '?');\n\t\t\t\tself.variant = self.getheader ('Variant', 'Standard');\n\t\t\t\tself.timecontrol = self.getheader ('TimeControl', '?');\n\t\t\t\tself.id = self.site.py_split ('/').__getslice__ (-(1), null, 1) [0];\n\t\t\t});},\n\t\t\tget idclicked () {return __get__ (this, function (self) {\n\t\t\t\tself.parent.pgntext.setpgn (self.content);\n\t\t\t\tself.parent.sioreq (dict ({'kind': 'parsepgn', 'owner': 'board', 'data': self.content}));\n\t\t\t});},\n\t\t\tget mecolor () {return __get__ (this, function (self) {\n\t\t\t\tif (self.white == self.parent.username) {\n\t\t\t\t\treturn WHITE;\n\t\t\t\t}\n\t\t\t\tif (self.black == self.parent.username) {\n\t\t\t\t\treturn BLACK;\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t});},\n\t\t\tget mewhite () {return __get__ (this, function (self) {\n\t\t\t\treturn self.mecolor () == WHITE;\n\t\t\t});},\n\t\t\tget meblack () {return __get__ (this, function (self) {\n\t\t\t\treturn self.mecolor () == BLACK;\n\t\t\t});},\n\t\t\tget hasme () {return __get__ (this, function (self) {\n\t\t\t\treturn !(self.mecolor () === null);\n\t\t\t});},\n\t\t\tget score () {return __get__ (this, function (self) {\n\t\t\t\tif (self.result == '1-0') {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tif (self.result == '0-1') {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0.5;\n\t\t\t});},\n\t\t\tget mescore () {return __get__ (this, function (self) {\n\t\t\t\tif (self.hasme ()) {\n\t\t\t\t\tif (self.mewhite ()) {\n\t\t\t\t\t\treturn self.score ();\n\t\t\t\t\t}\n\t\t\t\t\treturn 1 - self.score ();\n\t\t\t\t}\n\t\t\t\treturn self.score ();\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.x ().ac ('pgninfocontainer');\n\t\t\t\tself.tcdiv = Div ().ac ('pgninfotcdiv').html ('{} {}'.format (self.timecontrol, self.variant));\n\t\t\t\tself.whitediv = Div ().ac ('pgninfoplayerdiv').html (self.playerlink (self.white));\n\t\t\t\tself.whiteelodiv = Div ().ac ('pgninfoplayerelodiv').html ('{} {}'.format (self.whiteelo, self.whiteratingdiff));\n\t\t\t\tself.whitediv.acc (self.meblack (), 'pgninfotheyplayerdiv');\n\t\t\t\tself.blackdiv = Div ().ac ('pgninfoplayerdiv').html (self.playerlink (self.black));\n\t\t\t\tself.blackelodiv = Div ().ac ('pgninfoplayerelodiv').html ('{} {}'.format (self.blackelo, self.blackratingdiff));\n\t\t\t\tself.blackdiv.acc (self.mewhite (), 'pgninfotheyplayerdiv');\n\t\t\t\tself.resultdiv = Div ().ac ('pgninforesultdiv').html (self.result);\n\t\t\t\tself.iddiv = Div ().ac ('pgninfoiddiv').html (self.id);\n\t\t\t\tself.iddiv.ae ('mousedown', self.idclicked);\n\t\t\t\tvar mescore = self.mescore ();\n\t\t\t\tif (mescore == 1) {\n\t\t\t\t\tself.ac ('pgninfowhitewin');\n\t\t\t\t}\n\t\t\t\telse if (mescore == 0) {\n\t\t\t\t\tself.ac ('pgninfoblackwin');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.ac ('pgninfodraw');\n\t\t\t\t}\n\t\t\t\tself.aa (list ([self.tcdiv, self.whitediv, self.whiteelodiv, self.blackdiv, self.blackelodiv, self.resultdiv, self.iddiv]));\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setcontent () {return __get__ (this, function (self, content) {\n\t\t\t\tself.content = content;\n\t\t\t\tself.parsecontent ();\n\t\t\t\treturn self.build ();\n\t\t\t});}\n\t\t});\n\t\tvar PgnList = __class__ ('PgnList', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self, parent) {\n\t\t\t\t__super__ (PgnList, '__init__') (self, 'div');\n\t\t\t\tself.parent = parent;\n\t\t\t});},\n\t\t\tget build () {return __get__ (this, function (self) {\n\t\t\t\tself.x ();\n\t\t\t\tvar __iterable0__ = self.gamecontents;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar gamecontent = __iterable0__ [__index0__];\n\t\t\t\t\tself.a (PgnInfo (self.parent).setcontent (gamecontent));\n\t\t\t\t}\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget setcontent () {return __get__ (this, function (self, content) {\n\t\t\t\tself.content = content;\n\t\t\t\tself.gamecontents = self.content.py_split ('\\n\\n\\n').__getslice__ (0, -(1), 1);\n\t\t\t\treturn self.build ();\n\t\t\t});}\n\t\t});\n\t\tvar PgnText = __class__ ('PgnText', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget __init__ () {return __get__ (this, function (self) {\n\t\t\t\t__super__ (PgnText, '__init__') (self, 'div');\n\t\t\t\tself.ac ('pgntextcontainer');\n\t\t\t\tself.textarea = TextArea ();\n\t\t\t\tself.a (self.textarea);\n\t\t\t\tself.resize (600, 300);\n\t\t\t});},\n\t\t\tget setpgn () {return __get__ (this, function (self, pgn) {\n\t\t\t\tself.textarea.setText (pgn);\n\t\t\t\treturn self;\n\t\t\t});},\n\t\t\tget getpgn () {return __get__ (this, function (self) {\n\t\t\t\treturn self.textarea.getText ();\n\t\t\t});},\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.width = width;\n\t\t\t\tself.height = height;\n\t\t\t\tself.textarea.w (width - 15).h (height - 15);\n\t\t\t\treturn self;\n\t\t\t});}\n\t\t});\n\t\tvar Board = __class__ ('Board', [e], {\n\t\t\t__module__: __name__,\n\t\t\tget flipcallback () {return __get__ (this, function (self) {\n\t\t\t\tself.basicboard.setflip (!(self.basicboard.flip));\n\t\t\t});},\n\t\t\tget resetcallback () {return __get__ (this, function (self) {\n\t\t\t\tself.basicboard.reset ();\n\t\t\t});},\n\t\t\tget setfromfen () {return __get__ (this, function (self, fen, positioninfo, edithistory) {\n\t\t\t\tif (typeof positioninfo == 'undefined' || (positioninfo != null && positioninfo .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar positioninfo = dict ({});\n\t\t\t\t};\n\t\t\t\tif (typeof edithistory == 'undefined' || (edithistory != null && edithistory .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar edithistory = true;\n\t\t\t\t};\n\t\t\t\tvar restartanalysis = false;\n\t\t\t\tif (self.analyzing.py_get ()) {\n\t\t\t\t\tself.stopanalyzecallback ();\n\t\t\t\t\tvar restartanalysis = true;\n\t\t\t\t}\n\t\t\t\tif (edithistory && __in__ ('genmove', positioninfo)) {\n\t\t\t\t\tvar genmove = positioninfo ['genmove'];\n\t\t\t\t\tif (genmove == 'reset') {\n\t\t\t\t\t\tself.history = list ([]);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tself.history.append (dict ({'fen': self.basicboard.fen, 'positioninfo': self.positioninfo}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.positioninfo = positioninfo;\n\t\t\t\tself.movelist = cpick (__in__ ('movelist', self.positioninfo), self.positioninfo ['movelist'], list ([]));\n\t\t\t\tself.basicboard.setfromfen (fen, self.positioninfo);\n\t\t\t\tself.buildpositioninfo ();\n\t\t\t\tself.analysisinfodiv.x ();\n\t\t\t\tif (restartanalysis) {\n\t\t\t\t\tself.analyzecallbackfactory () ();\n\t\t\t\t}\n\t\t\t\tself.getstoredanalysisinfo ();\n\t\t\t});},\n\t\t\tget getstoredanalysisinfo () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.analyzing.py_get ())) {\n\t\t\t\t\tself.sioreq (dict ({'kind': 'retrievedb', 'owner': 'board', 'path': 'analysisinfo/{}/{}'.format (self.basicboard.variantkey, self.positioninfo ['zobristkeyhex'])}));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setvariantcombo () {return __get__ (this, function (self) {\n\t\t\t\tself.variantcombo.setoptions (VARIANT_OPTIONS, self.basicboard.variantkey);\n\t\t\t});},\n\t\t\tget sioreq () {return __get__ (this, function (self, obj) {\n\t\t\t\tif (!(self.socket === null)) {\n\t\t\t\t\tself.socket.emit ('sioreq', obj);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget posclickedfactory () {return __get__ (this, function (self, i) {\n\t\t\t\tvar poslicked = function () {\n\t\t\t\t\tself.gamei = i;\n\t\t\t\t\tvar pinfo = self.positioninfos [i];\n\t\t\t\t\tself.setfromfen (pinfo ['fen'], pinfo ['positioninfo']);\n\t\t\t\t\tfor (var j = 0; j < len (self.positioninfos); j++) {\n\t\t\t\t\t\tself.posdivs [j].arc (j == self.gamei, 'boardposdivselected');\n\t\t\t\t\t}\n\t\t\t\t\tself.history = list ([]);\n\t\t\t\t};\n\t\t\t\treturn poslicked;\n\t\t\t});},\n\t\t\tget selectgamei () {return __get__ (this, function (self, i) {\n\t\t\t\tif (len (self.positioninfos) > 0) {\n\t\t\t\t\tself.posclickedfactory (i) ();\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget gamehere () {return __get__ (this, function (self) {\n\t\t\t\tself.selectgamei (self.gamei);\n\t\t\t});},\n\t\t\tget gametobegin () {return __get__ (this, function (self) {\n\t\t\t\tself.gamei = 0;\n\t\t\t\tself.selectgamei (self.gamei);\n\t\t\t});},\n\t\t\tget gameback () {return __get__ (this, function (self) {\n\t\t\t\tself.gamei--;\n\t\t\t\tif (self.gamei < 0) {\n\t\t\t\t\tself.gamei = 0;\n\t\t\t\t}\n\t\t\t\tself.selectgamei (self.gamei);\n\t\t\t});},\n\t\t\tget gameforward () {return __get__ (this, function (self) {\n\t\t\t\tself.gamei++;\n\t\t\t\tif (self.gamei >= len (self.positioninfos)) {\n\t\t\t\t\tself.gamei = len (self.positioninfos) - 1;\n\t\t\t\t}\n\t\t\t\tself.selectgamei (self.gamei);\n\t\t\t});},\n\t\t\tget gametoend () {return __get__ (this, function (self) {\n\t\t\t\tself.gamei = len (self.positioninfos) - 1;\n\t\t\t\tself.selectgamei (self.gamei);\n\t\t\t});},\n\t\t\tget buildgame () {return __get__ (this, function (self) {\n\t\t\t\tself.gamediv.x ();\n\t\t\t\tself.posdivs = list ([]);\n\t\t\t\tvar i = 0;\n\t\t\t\tvar __iterable0__ = self.positioninfos;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar pinfo = __iterable0__ [__index0__];\n\t\t\t\t\tvar fen = pinfo ['fen'];\n\t\t\t\t\tvar posinfo = pinfo ['positioninfo'];\n\t\t\t\t\tvar genmove = '*';\n\t\t\t\t\tif (__in__ ('genmove', posinfo)) {\n\t\t\t\t\t\tvar genmove = posinfo ['genmove'] ['san'];\n\t\t\t\t\t}\n\t\t\t\t\tvar posdiv = Div ().ac ('boardposdiv');\n\t\t\t\t\tself.posdivs.append (posdiv);\n\t\t\t\t\tposdiv.ae ('mousedown', self.posclickedfactory (i));\n\t\t\t\t\tvar movediv = Div ().ac ('boardposmovediv').html (genmove);\n\t\t\t\t\tvar fendiv = Div ().ac ('boardposfendiv');\n\t\t\t\t\tvar showboard = BasicBoard (dict ({'show': true, 'showfen': false, 'positioninfo': posinfo, 'fen': fen, 'squaresize': 20, 'flip': self.flip}));\n\t\t\t\t\tfendiv.a (showboard);\n\t\t\t\t\tposdiv.aa (list ([movediv, fendiv]));\n\t\t\t\t\tself.gamediv.a (posdiv);\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tself.gamei = 0;\n\t\t\t\tself.gamehere ();\n\t\t\t});},\n\t\t\tget siores () {return __get__ (this, function (self, response) {\n\t\t\t\ttry {\n\t\t\t\t\tif (__in__ ('dataobj', response)) {\n\t\t\t\t\t\tvar dataobj = response ['dataobj'];\n\t\t\t\t\t\tif (__in__ ('variantkey', dataobj)) {\n\t\t\t\t\t\t\tself.variantchanged (dataobj ['variantkey']);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (__in__ ('analysisinfo', dataobj)) {\n\t\t\t\t\t\t\tself.processanalysisinfo (dataobj ['analysisinfo'], true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (__in__ ('historyobj', response)) {\n\t\t\t\t\t\tvar historyobj = response ['historyobj'];\n\t\t\t\t\t\tvar uci_variant = historyobj ['uci_variant'];\n\t\t\t\t\t\tvar chess960 = historyobj ['chess960'];\n\t\t\t\t\t\tvar pgn = historyobj ['pgn'];\n\t\t\t\t\t\tvar pgninfo = PgnInfo (self).setcontent (pgn);\n\t\t\t\t\t\tvar vk = uci_variant_to_variantkey (uci_variant, chess960);\n\t\t\t\t\t\tself.variantchanged (vk, false);\n\t\t\t\t\t\tself.flip = pgninfo.meblack ();\n\t\t\t\t\t\tself.basicboard.setflip (self.flip);\n\t\t\t\t\t\tself.positioninfos = historyobj ['positioninfos'];\n\t\t\t\t\t\tself.buildgame ();\n\t\t\t\t\t\tself.tabpane.selectByKey ('analysis');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\tprint ('error processing siores', response);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget variantchanged () {return __get__ (this, function (self, variantkey, docallback) {\n\t\t\t\tif (typeof docallback == 'undefined' || (docallback != null && docallback .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar docallback = true;\n\t\t\t\t};\n\t\t\t\tself.basicboard.variantkey = variantkey;\n\t\t\t\tself.basicboard.reset ();\n\t\t\t\ttry {\n\t\t\t\t\tself.basicboard.resize (self.resizewidth, self.resizeheight);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tself.resizetabpanewidth (self.resizewidth);\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t// pass;\n\t\t\t\t}\n\t\t\t\tif (!(self.variantchangedcallback === null) && docallback) {\n\t\t\t\t\tself.variantchangedcallback (self.basicboard.variantkey);\n\t\t\t\t}\n\t\t\t\tself.basicresize ();\n\t\t\t\tself.buildpositioninfo ();\n\t\t\t\tself.setvariantcombo ();\n\t\t\t\tself.sioreq (dict ({'kind': 'storedb', 'path': 'board/variantkey', 'dataobj': dict ({'variantkey': self.basicboard.variantkey})}));\n\t\t\t});},\n\t\t\tget setvariantcallback () {return __get__ (this, function (self) {\n\t\t\t\tself.variantchanged (self.basicboard.variantkey);\n\t\t\t});},\n\t\t\tget moveclickedfactory () {return __get__ (this, function (self, move) {\n\t\t\t\tvar moveclicked = function () {\n\t\t\t\t\tif (!(self.moveclickedcallback === null)) {\n\t\t\t\t\t\tself.moveclickedcallback (self.basicboard.variantkey, self.basicboard.fen, move ['uci']);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn moveclicked;\n\t\t\t});},\n\t\t\tget buildpositioninfo () {return __get__ (this, function (self) {\n\t\t\t\tself.movelistdiv.x ().h (self.totalheight ());\n\t\t\t\tvar __iterable0__ = self.movelist;\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar move = __iterable0__ [__index0__];\n\t\t\t\t\tvar movediv = Div ().ac ('bigboardshowmove').html (move ['san']);\n\t\t\t\t\tmovediv.ae ('mousedown', self.moveclickedfactory (move));\n\t\t\t\t\tself.movelistdiv.a (movediv);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget delcallback () {return __get__ (this, function (self) {\n\t\t\t\tif (len (self.history) > 0) {\n\t\t\t\t\tvar item = self.history.py_pop ();\n\t\t\t\t\tself.setfromfen (item ['fen'], item ['positioninfo'], false);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget totalheight () {return __get__ (this, function (self) {\n\t\t\t\treturn self.basicboard.totalheight () + self.controlpanelheight;\n\t\t\t});},\n\t\t\tget controlwidth () {return __get__ (this, function (self) {\n\t\t\t\treturn max (self.basicboard.outerwidth, self.controlpanelwidth);\n\t\t\t});},\n\t\t\tget totalwidth () {return __get__ (this, function (self) {\n\t\t\t\treturn self.controlwidth () + self.movelistdivwidth;\n\t\t\t});},\n\t\t\tget basicresize () {return __get__ (this, function (self) {\n\t\t\t\tself.controlpanel.w (self.controlwidth ()).mw (self.controlwidth ());\n\t\t\t\tself.sectioncontainer.w (self.controlwidth ());\n\t\t\t\tself.tabpane.resize (null, self.totalheight ());\n\t\t\t});},\n\t\t\tget resizetabpanewidth () {return __get__ (this, function (self, width) {\n\t\t\t\tself.tabpane.resize (max (width - self.totalwidth (), 600), null);\n\t\t\t});},\n\t\t\tget resizetask () {return __get__ (this, function (self) {\n\t\t\t\tself.resizewidth = self.resizeorigwidth;\n\t\t\t\tself.resizeheight = self.resizeorigheight - self.controlpanelheight;\n\t\t\t\tself.basicboard.resize (self.resizewidth, self.resizeheight);\n\t\t\t\tself.basicresize ();\n\t\t\t\tself.buildpositioninfo ();\n\t\t\t\tself.resizetabpanewidth (self.resizeorigwidth);\n\t\t\t});},\n\t\t\tget resize () {return __get__ (this, function (self, width, height) {\n\t\t\t\tself.resizeorigwidth = width;\n\t\t\t\tself.resizeorigheight = height;\n\t\t\t\tself.resizetask ();\n\t\t\t});},\n\t\t\tget analyzecallbackfactory () {return __get__ (this, function (self, all, depthlimit, timelimit) {\n\t\t\t\tif (typeof all == 'undefined' || (all != null && all .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar all = false;\n\t\t\t\t};\n\t\t\t\tif (typeof depthlimit == 'undefined' || (depthlimit != null && depthlimit .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar depthlimit = null;\n\t\t\t\t};\n\t\t\t\tif (typeof timelimit == 'undefined' || (timelimit != null && timelimit .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar timelimit = null;\n\t\t\t\t};\n\t\t\t\tvar analyzecallback = function () {\n\t\t\t\t\tself.anyinfo = false;\n\t\t\t\t\tself.depthlimit = depthlimit;\n\t\t\t\t\tself.timelimit = timelimit;\n\t\t\t\t\tself.analysisstartedat = new Date ().getTime ();\n\t\t\t\t\tself.bestmoveuci = null;\n\t\t\t\t\tself.analyzing.set (true);\n\t\t\t\t\tif (!(self.enginecommandcallback === null)) {\n\t\t\t\t\t\tvar mpv = cpick (all, 200, self.getmultipv ());\n\t\t\t\t\t\tself.enginecommandcallback ('analyze {} {} {}'.format (self.basicboard.variantkey, mpv, self.basicboard.fen));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn analyzecallback;\n\t\t\t});},\n\t\t\tget stopanalyzecallback () {return __get__ (this, function (self) {\n\t\t\t\tself.analyzing.set (false);\n\t\t\t\tself.basicboard.clearcanvases ();\n\t\t\t\tif (!(self.enginecommandcallback === null)) {\n\t\t\t\t\tself.enginecommandcallback ('stopanalyze');\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget analysismoveclicked () {return __get__ (this, function (self, moveuci) {\n\t\t\t\tif (!(self.moveclickedcallback === null)) {\n\t\t\t\t\tself.moveclickedcallback (self.basicboard.variantkey, self.basicboard.fen, moveuci);\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget buildanalysisinfodiv () {return __get__ (this, function (self) {\n\t\t\t\tself.analysisinfodiv.x ();\n\t\t\t\tself.basicboard.clearcanvases ();\n\t\t\t\tself.maxdepth = 0;\n\t\t\t\tvar minfos = list ([]);\n\t\t\t\tvar __iterable0__ = self.analysisinfo ['pvitems'];\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar infoi = __iterable0__ [__index0__];\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar minfo = MultipvInfo (infoi);\n\t\t\t\t\t\tminfo.bestmovesanclickedcallback = self.analysismoveclicked;\n\t\t\t\t\t\tminfo.bonussliderchangedcallback = self.buildanalysisinfodiv;\n\t\t\t\t\t\tif (minfo.depth > self.maxdepth) {\n\t\t\t\t\t\t\tself.maxdepth = minfo.depth;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tminfos.append (minfo);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (__except0__) {\n\t\t\t\t\t\t// pass;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar i = 1;\n\t\t\t\tvar __iterable0__ = sorted (minfos, __kwargtrans__ ({key: (function __lambda__ (item) {\n\t\t\t\t\treturn item.effscore ();\n\t\t\t\t}), reverse: true}));\n\t\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\t\tvar minfo = __iterable0__ [__index0__];\n\t\t\t\t\tminfo.i = i;\n\t\t\t\t\tminfo.build ();\n\t\t\t\t\tif (i == 1) {\n\t\t\t\t\t\tself.bestmoveuci = minfo.bestmoveuci;\n\t\t\t\t\t}\n\t\t\t\t\tvar iw = 1 / (5 * i);\n\t\t\t\t\tself.basicboard.drawuciarrow (minfo.bestmoveuci, dict ({'strokecolor': scorecolor (minfo.effscore ()), 'linewidth': iw, 'headheight': iw}));\n\t\t\t\t\tself.analysisinfodiv.a (minfo);\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget processanalysisinfo () {return __get__ (this, function (self, obj, force) {\n\t\t\t\tif (typeof force == 'undefined' || (force != null && force .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\t\tvar force = false;\n\t\t\t\t};\n\t\t\t\tif (!(self.analyzing) && !(force)) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tself.anyinfo = true;\n\t\t\t\tvar elapsed = new Date ().getTime () - self.analysisstartedat;\n\t\t\t\tself.analysisinfo = obj;\n\t\t\t\tself.buildanalysisinfodiv ();\n\t\t\t\tif (self.analyzing.py_get () && !(self.depthlimit === null) || !(self.timelimit === null)) {\n\t\t\t\t\tvar depthok = self.depthlimit === null || self.maxdepth >= self.depthlimit;\n\t\t\t\t\tvar timeok = self.timelimit === null || elapsed >= self.timelimit;\n\t\t\t\t\tif (depthok && timeok) {\n\t\t\t\t\t\tself.stopandstoreanalysis ();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget stopandstoreanalysis () {return __get__ (this, function (self) {\n\t\t\t\tself.stopanalyzecallback ();\n\t\t\t\tif (!(self.anyinfo)) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tself.storeanalysiscallback ();\n\t\t\t});},\n\t\t\tget makeanalyzedmovecallback () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.bestmoveuci === null)) {\n\t\t\t\t\tif (!(self.moveclickedcallback === null)) {\n\t\t\t\t\t\tself.moveclickedcallback (self.basicboard.variantkey, self.basicboard.fen, self.bestmoveuci);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget storeanalysiscallback () {return __get__ (this, function (self) {\n\t\t\t\tif (!(self.analysisinfo === null)) {\n\t\t\t\t\tself.sioreq (dict ({'kind': 'storedb', 'path': 'analysisinfo/{}/{}'.format (self.basicboard.variantkey, self.analysisinfo ['zobristkeyhex']), 'dataobj': dict ({'analysisinfo': self.analysisinfo})}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twindow.alert ('No analysis to store.');\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget getmultipv () {return __get__ (this, function (self) {\n\t\t\t\ttry {\n\t\t\t\t\tvar multipv = int (self.multipvcombo.select.v ());\n\t\t\t\t\treturn multipv;\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\treturn self.defaultmultipv;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget analyzingchangedcallback () {return __get__ (this, function (self) {\n\t\t\t\tself.analysiscontrolpanelbottom.cbc (self.analyzing.py_get (), '#afa', '#edd');\n\t\t\t});},\n\t\t\tget getconfigscalar () {return __get__ (this, function (self, path, py_default) {\n\t\t\t\tif (self.configschema === null) {\n\t\t\t\t\treturn py_default;\n\t\t\t\t}\n\t\t\t\tvar found = getscalarfromschema (self.configschema, path);\n\t\t\t\tif (found === null) {\n\t\t\t\t\treturn py_default;\n\t\t\t\t}\n\t\t\t\treturn found;\n\t\t\t});},\n\t\t\tget getconfigbool () {return __get__ (this, function (self, path, py_default) {\n\t\t\t\tvar s = self.getconfigscalar (path, null);\n\t\t\t\tif (s === null) {\n\t\t\t\t\treturn py_default;\n\t\t\t\t}\n\t\t\t\tif (s == 'true') {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (s == 'false') {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn py_default;\n\t\t\t});},\n\t\t\tget getconfigint () {return __get__ (this, function (self, path, py_default) {\n\t\t\t\tvar s = self.getconfigscalar (path, null);\n\t\t\t\tif (s === null) {\n\t\t\t\t\treturn py_default;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tvar i = int (s);\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t\tcatch (__except0__) {\n\t\t\t\t\treturn py_default;\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget gamesloadedok () {return __get__ (this, function (self, content) {\n\t\t\t\tself.pgnlist = PgnList (self).setcontent (content);\n\t\t\t\tself.gamesdiv.x ();\n\t\t\t\tself.gamesdiv.a (Button ('Reload', self.loadgames));\n\t\t\t\tself.gamesdiv.a (self.gamesloadingdiv.x ());\n\t\t\t\tself.gamesdiv.a (self.pgnlist);\n\t\t\t});},\n\t\t\tget loadgames () {return __get__ (this, function (self) {\n\t\t\t\tself.gamesloadingdiv.html ('Games loading...');\n\t\t\t\tif (!(self.username === null)) {\n\t\t\t\t\tlichapiget ('{}/{}?max={}'.format (LICH_API_GAMES_EXPORT, self.username, self.maxgames), self.usertoken, self.gamesloadedok, (function __lambda__ (err) {\n\t\t\t\t\t\treturn print (err);\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t});},\n\t\t\tget setconfigschema () {return __get__ (this, function (self, configschema) {\n\t\t\t\tself.configschema = configschema;\n\t\t\t\tself.username = self.getconfigscalar ('global/username', null);\n\t\t\t\tself.usertoken = self.getconfigscalar ('global/usertoken', null);\n\t\t\t\tself.showfen = self.getconfigbool ('global/showfen', true);\n\t\t\t\tself.maxgames = self.getconfigint ('global/maxgames', 25);\n\t\t\t\tself.basicboard.showfen = self.showfen;\n\t\t\t\tself.resizetask ();\n\t\t\t\tself.loadgames ();\n\t\t\t});},\n\t\t\tget storeforward () {return __get__ (this, function (self) {\n\t\t\t\tself.storeanalysiscallback ();\n\t\t\t\tself.gameforward ();\n\t\t\t});},\n\t\t\tget storemake () {return __get__ (this, function (self) {\n\t\t\t\tself.storeanalysiscallback ();\n\t\t\t\tself.makeanalyzedmovecallback ();\n\t\t\t});},\n\t\t\tget __init__ () {return __get__ (this, function (self, args) {\n\t\t\t\t__super__ (Board, '__init__') (self, 'div');\n\t\t\t\tself.maxgames = 25;\n\t\t\t\tself.resizeorigwidth = 800;\n\t\t\t\tself.resizeorigheight = 400;\n\t\t\t\tself.showfen = true;\n\t\t\t\tself.flip = false;\n\t\t\t\tself.gamesloadingdiv = Div ();\n\t\t\t\tself.positioninfos = list ([]);\n\t\t\t\tself.pgnlist = null;\n\t\t\t\tself.username = null;\n\t\t\t\tself.usertoken = null;\n\t\t\t\tself.configschema = null;\n\t\t\t\tself.depthlimit = null;\n\t\t\t\tself.analysisinfo = null;\n\t\t\t\tself.defaultmultipv = 3;\n\t\t\t\tself.bestmoveuci = null;\n\t\t\t\tself.analyzing = View (self.analyzingchangedcallback, false);\n\t\t\t\tself.history = list ([]);\n\t\t\t\tself.basicboard = BasicBoard (args);\n\t\t\t\tself.controlpanel = Div ().ac ('boardcontrolpanel');\n\t\t\t\tself.controlpanelheight = getglobalcssvarpxint ('--boardcontrolpanelheight');\n\t\t\t\tself.controlpanelwidth = 260;\n\t\t\t\tself.controlpanel.a (Button ('Flip', self.flipcallback));\n\t\t\t\tself.variantcombo = ComboBox (dict ({'changecallback': self.variantchanged, 'selectclass': 'variantselect', 'optionfirstclass': 'variantoptionfirst', 'optionclass': 'variantoption'}));\n\t\t\t\tself.setvariantcombo ();\n\t\t\t\tself.variantchangedcallback = args.py_get ('variantchangedcallback', null);\n\t\t\t\tself.moveclickedcallback = args.py_get ('moveclickedcallback', null);\n\t\t\t\tself.enginecommandcallback = args.py_get ('enginecommandcallback', null);\n\t\t\t\tself.socket = args.py_get ('socket', null);\n\t\t\t\tself.controlpanel.a (self.variantcombo).w (self.basicboard.outerwidth).mw (self.basicboard.outerwidth);\n\t\t\t\tself.controlpanel.a (Button ('Del', self.delcallback));\n\t\t\t\tself.controlpanel.a (Button ('Reset', self.setvariantcallback));\n\t\t\t\tself.sectioncontainer = Div ().ac ('bigboardsectioncontainer').w (self.basicboard.outerwidth);\n\t\t\t\tself.sectioncontainer.aa (list ([self.controlpanel, self.basicboard]));\n\t\t\t\tself.verticalcontainer = Div ().ac ('bigboardverticalcontainer');\n\t\t\t\tself.movelistdivwidth = 100;\n\t\t\t\tself.movelistdiv = Div ().ac ('bigboardmovelist').w (self.movelistdivwidth).mw (self.movelistdivwidth);\n\t\t\t\tself.analysisdiv = Div ();\n\t\t\t\tself.analysiscontrolpaneltop = Div ().ac ('bigboardanalysiscontrolpanel');\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('#', self.gamehere).ac ('analysiscontrol'));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('<<', self.gametobegin).ac ('analysiscontrol'));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('<', self.gameback).ac ('analysiscontrol').w (60));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('>', self.gameforward).ac ('analysiscontrol').w (60));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('>>', self.gametoend).ac ('analysiscontrol'));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('Store >', self.storeforward).ac ('analysismake'));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('Store Make', self.storemake).ac ('analysismake'));\n\t\t\t\tself.analysiscontrolpaneltop.a (Button ('Store Stop', self.stopandstoreanalysis).ac ('analysisstop'));\n\t\t\t\tself.analysiscontrolpanelbottom = Div ().ac ('bigboardanalysiscontrolpanel');\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('#', self.getstoredanalysisinfo).ac ('analysisanalyze'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Analyze', self.analyzecallbackfactory ()).ac ('analysisanalyze'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Analyze all', self.analyzecallbackfactory (true)).ac ('analysisanalyze'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Quick all', self.analyzecallbackfactory (true, 5, null)).ac ('analysisanalyze'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Make', self.makeanalyzedmovecallback).ac ('analysismake'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Stop', self.stopanalyzecallback).ac ('analysisstop'));\n\t\t\t\tself.analysiscontrolpanelbottom.a (Button ('Store', self.storeanalysiscallback).ac ('analysisstore'));\n\t\t\t\tvar mopts = dict ({});\n\t\t\t\tfor (var i = 1; i < 21; i++) {\n\t\t\t\t\tmopts [str (i)] = 'MultiPV {}'.format (i);\n\t\t\t\t}\n\t\t\t\tself.multipvcombo = ComboBox (dict ({'selectclass': 'boardmultipvcomboselect', 'optionfirstclass': 'boardmultipvcombooptionfirst', 'optionclass': 'boardmultipvcombooption'})).setoptions (mopts, str (self.defaultmultipv));\n\t\t\t\tself.analysiscontrolpanelbottom.a (self.multipvcombo);\n\t\t\t\tself.analysisdiv.aa (list ([self.analysiscontrolpaneltop, self.analysiscontrolpanelbottom]));\n\t\t\t\tself.analysisinfodiv = Div ();\n\t\t\t\tself.analysisdiv.a (self.analysisinfodiv);\n\t\t\t\tself.gamesdiv = Div ();\n\t\t\t\tself.gamediv = Div ();\n\t\t\t\tself.pgntext = PgnText ();\n\t\t\t\tself.tabpane = TabPane (dict ({'kind': 'normal', 'id': 'board'})).setTabs (list ([Tab ('analysis', 'Analysis', self.analysisdiv), Tab ('game', 'Game', self.gamediv), Tab ('pgn', 'Pgn', self.pgntext), Tab ('games', 'Games', self.gamesdiv)]), 'analysis');\n\t\t\t\tself.verticalcontainer.aa (list ([self.sectioncontainer, self.movelistdiv, self.tabpane]));\n\t\t\t\tself.a (self.verticalcontainer);\n\t\t\t\tself.basicresize ();\n\t\t\t\tself.buildpositioninfo ();\n\t\t\t\tself.sioreq (dict ({'kind': 'retrievedb', 'owner': 'board', 'path': 'board/variantkey'}));\n\t\t\t});}\n\t\t});\n\t\tif (window.location.protocol == 'https:') {\n\t\t\tvar ws_scheme = 'wss://';\n\t\t}\n\t\telse {\n\t\t\tvar ws_scheme = 'ws://';\n\t\t}\n\t\tvar SUBMIT_URL = ws_scheme + window.location.host;\n\t\tvar queryparamsstring = window.location.search;\n\t\tvar queryparams = dict ({});\n\t\tif (len (queryparamsstring) > 1) {\n\t\t\tvar queryparamsstring = queryparamsstring.__getslice__ (1, null, 1);\n\t\t\tvar mainparts = queryparamsstring.py_split ('&');\n\t\t\tvar __iterable0__ = mainparts;\n\t\t\tfor (var __index0__ = 0; __index0__ < len (__iterable0__); __index0__++) {\n\t\t\t\tvar mainpart = __iterable0__ [__index0__];\n\t\t\t\tvar parts = mainpart.py_split ('=');\n\t\t\t\tqueryparams [parts [0]] = parts [1];\n\t\t\t}\n\t\t}\n\t\tvar ENGINE_CMD_ALIASES = dict ({'start': dict ({'display': 'R', 'cmds': list (['r'])}), 'stop': dict ({'display': 'S', 'cmds': list (['s'])}), 'parseuci': dict ({'display': 'Parse UCI options', 'cmds': list (['r', 'parseuci'])}), 'd15': dict ({'display': 'd15', 'cmds': list (['go depth 15'])})});\n\t\tvar BOT_CMD_ALIASES = dict ({'start': dict ({'display': 'R', 'cmds': list (['r'])}), 'stop': dict ({'display': 'S', 'cmds': list (['s'])}), 'loadconfig': dict ({'display': 'LC', 'cmds': list (['s', 'r'])})});\n\t\tvar CBUILD_CMD_ALIASES = dict ({'stop': dict ({'display': 'S', 'cmds': list (['s'])}), 'example': dict ({'display': 'example build', 'cmds': list (['-e antichess --variant antichess --nextlichessdb -a'])}), 'help': dict ({'display': 'help', 'cmds': list (['-h'])})});\n\t\tvar socket = null;\n\t\tvar processconsoles = dict ({'engine': null, 'bot': null, 'cbuild': null});\n\t\tvar mainlogpane = null;\n\t\tvar maintabpane = null;\n\t\tvar mainboard = null;\n\t\tvar configschema = SchemaDict (dict ({}));\n\t\tvar srcdiv = Div ().ms ().fs (20);\n\t\tvar schemajson = null;\n\t\tvar getlocalconfig = function () {\n\t\t\tsocket.emit ('sioreq', dict ({'kind': 'getlocalconfig'}));\n\t\t};\n\t\tvar showsrc = function () {\n\t\t\tvar srcjsoncontent = JSON.stringify (serializeconfig (), null, 2);\n\t\t\tsrcdiv.html (('<pre>' + srcjsoncontent) + '</pre>');\n\t\t\tmaintabpane.selectByKey ('src');\n\t\t};\n\t\tvar serializeconfig = function () {\n\t\t\tvar obj = dict ({'config': configschema.topureobj (), 'configschema': configschema.toobj ()});\n\t\t\treturn obj;\n\t\t};\n\t\tvar deserializeconfig = function (obj) {\n\t\t\tvar schemaobj = dict ({});\n\t\t\ttry {\n\t\t\t\tif (__in__ ('configschema', obj)) {\n\t\t\t\t\tvar schemaobj = obj ['configschema'];\n\t\t\t\t}\n\t\t\t\tconfigschema = schemafromobj (schemaobj);\n\t\t\t}\n\t\t\tcatch (__except0__) {\n\t\t\t\tprint ('deserialize config obj failed for', obj);\n\t\t\t}\n\t\t};\n\t\tvar deserializeconfigcontent = function (content) {\n\t\t\ttry {\n\t\t\t\tvar obj = JSON.parse (content);\n\t\t\t\tdeserializeconfig (obj);\n\t\t\t}\n\t\t\tcatch (__except0__) {\n\t\t\t\tprint ('deserializing config content failed for', content);\n\t\t\t}\n\t\t\tmaintabpane.setTabElementByKey ('config', buildconfigdiv ());\n\t\t};\n\t\tvar buildconfigdiv = function () {\n\t\t\tvar configsplitpane = SplitPane (dict ({'controlheight': 50}));\n\t\t\tconfigsplitpane.controldiv.aa (list ([Button ('Serialize', serializecallback).fs (24), Button ('Reload', reloadcallback).fs (16), Button ('Show source', showsrc).fs (16)])).bc ('#ddd');\n\t\t\tvar configschemacontainerdiv = Div ().ac ('configschemacontainerdiv').a (configschema);\n\t\t\tconfigsplitpane.setcontent (configschemacontainerdiv);\n\t\t\treturn configsplitpane;\n\t\t};\n\t\tvar getbincallback = function (content) {\n\t\t\tdeserializeconfigcontent (content);\n\t\t};\n\t\tvar getbinerrcallback = function (err) {\n\t\t\tprint ('get bin failed with', err);\n\t\t};\n\t\tvar mainlog = function (logitem) {\n\t\t\tmainlogpane.log.log (logitem);\n\t\t};\n\t\tvar log = function (content, dest) {\n\t\t\tif (typeof dest == 'undefined' || (dest != null && dest .hasOwnProperty (\"__kwargtrans__\"))) {;\n\t\t\t\tvar dest = 'engine';\n\t\t\t};\n\t\t\tvar li = LogItem (('<pre>' + content) + '</pre>');\n\t\t\tprocessconsoles [dest].log.log (li);\n\t\t};\n\t\tvar cmdinpcallback = function (cmd, key) {\n\t\t\tsocket.emit ('sioreq', dict ({'kind': 'cmd', 'key': key, 'data': cmd}));\n\t\t};\n\t\tvar serializeputjsonbincallback = function (content) {\n\t\t\ttry {\n\t\t\t\tvar obj = JSON.parse (content);\n\t\t\t\tvar binid = 'local';\n\t\t\t\tif (__in__ ('id', obj)) {\n\t\t\t\t\tvar binid = obj ['id'];\n\t\t\t\t}\n\t\t\t\telse if (__in__ ('parentId', obj)) {\n\t\t\t\t\tvar binid = obj ['parentId'];\n\t\t\t\t}\n\t\t\t\tif (!(binid == 'local')) {\n\t\t\t\t\tsocket.emit ('sioreq', dict ({'kind': 'storebinid', 'data': binid}));\n\t\t\t\t}\n\t\t\t\tvar href = (((window.location.protocol + '//') + window.location.host) + '/?id=') + binid;\n\t\t\t\tdocument.location.href = href;\n\t\t\t}\n\t\t\tcatch (__except0__) {\n\t\t\t\tprint ('there was an error parsing json', content);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\tvar serializeputjsonbinerrcallback = function (err) {\n\t\t\tprint ('there was an error putting to json bin', err);\n\t\t};\n\t\tvar serializecallback = function () {\n\t\t\tvar json = JSON.stringify (serializeconfig (), null, 2);\n\t\t\tsocket.emit ('sioreq', dict ({'kind': 'storeconfig', 'data': json}));\n\t\t};\n\t\tvar reloadcallback = function () {\n\t\t\tdocument.location.href = '/';\n\t\t};\n\t\tvar mainboardmovecallback = function (variantkey, fen, moveuci) {\n\t\t\tsetTimeout ((function __lambda__ (ev) {\n\t\t\t\treturn socket.emit ('sioreq', dict ({'kind': 'mainboardmove', 'variantkey': variantkey, 'fen': fen, 'moveuci': moveuci}));\n\t\t\t}), simulateserverlag ());\n\t\t};\n\t\tvar mainboardvariantchangedcallback = function (variantkey) {\n\t\t\tsetTimeout ((function __lambda__ (ev) {\n\t\t\t\treturn socket.emit ('sioreq', dict ({'kind': 'mainboardsetvariant', 'variantkey': variantkey}));\n\t\t\t}), simulateserverlag ());\n\t\t};\n\t\tvar mainboardmoveclickedcallback = function (variantkey, fen, moveuci) {\n\t\t\tsetTimeout ((function __lambda__ (ev) {\n\t\t\t\treturn socket.emit ('sioreq', dict ({'kind': 'mainboardmove', 'variantkey': variantkey, 'fen': fen, 'moveuci': moveuci}));\n\t\t\t}), simulateserverlag ());\n\t\t};\n\t\tvar mainboardenginecommandcallback = function (sline) {\n\t\t\tsocket.emit ('sioreq', dict ({'kind': 'cmd', 'key': 'engine', 'data': sline}));\n\t\t};\n\t\tvar build = function () {\n\t\t\tprocessconsoles ['engine'] = ProcessConsole (dict ({'key': 'engine', 'cmdinpcallback': cmdinpcallback, 'cmdaliases': ENGINE_CMD_ALIASES}));\n\t\t\tprocessconsoles ['bot'] = ProcessConsole (dict ({'key': 'bot', 'cmdinpcallback': cmdinpcallback, 'cmdaliases': BOT_CMD_ALIASES}));\n\t\t\tprocessconsoles ['cbuild'] = ProcessConsole (dict ({'key': 'cbuild', 'cmdinpcallback': cmdinpcallback, 'cmdaliases': CBUILD_CMD_ALIASES}));\n\t\t\tmainlogpane = LogPane ();\n\t\t\tmainboard = Board (dict ({'movecallback': mainboardmovecallback, 'variantchangedcallback': mainboardvariantchangedcallback, 'moveclickedcallback': mainboardmoveclickedcallback, 'enginecommandcallback': mainboardenginecommandcallback, 'socket': socket}));\n\t\t\tmaintabpane = TabPane (dict ({'kind': 'main', 'id': 'main'})).setTabs (list ([Tab ('engineconsole', 'Engine console', processconsoles ['engine']), Tab ('botconsole', 'Bot console', processconsoles ['bot']), Tab ('cbuildconsole', 'Cbuild console', processconsoles ['cbuild']), Tab ('upload', 'Upload', FileUploader (dict ({'url': '/upload'}))), Tab ('dirbrowser', 'Dirbrowser', DirBrowser ()), Tab ('board', 'Board', mainboard), Tab ('config', 'Config', buildconfigdiv ()), Tab ('log', 'Log', mainlogpane), Tab ('src', 'Src', srcdiv), Tab ('about', 'About', Div ().ac ('appabout').html ('Lichess GUI bot.'))]), 'botconsole');\n\t\t\tge ('maintabdiv').innerHTML = '';\n\t\t\tge ('maintabdiv').appendChild (maintabpane.e);\n\t\t};\n\t\tvar onconnect = function () {\n\t\t\tmainlog (LogItem ('socket connected ok', 'cmdstatusok'));\n\t\t\tsocket.emit ('sioreq', dict ({'data': 'socket connected'}));\n\t\t\tgetlocalconfig ();\n\t\t\tsocket.emit ('sioreq', dict ({'kind': 'mainboardsetvariant', 'variantkey': 'standard'}));\n\t\t};\n\t\tvar onevent = function (json) {\n\t\t\tvar dest = null;\n\t\t\tvar logitem = null;\n\t\t\tif (__in__ ('kind', json)) {\n\t\t\t\tvar kind = json ['kind'];\n\t\t\t\tif (kind == 'procreadline') {\n\t\t\t\t\tvar dest = json ['prockey'];\n\t\t\t\t\tvar sline = json ['sline'];\n\t\t\t\t\tvar logitem = LogItem (sline, 'cmdreadline');\n\t\t\t\t\tif (dest == 'bot') {\n\t\t\t\t\t\tif (len (sline) > 0) {\n\t\t\t\t\t\t\tif (sline [0] == '!') {\n\t\t\t\t\t\t\t\tvar logitem = LogItem ('bot error:' + sline.__getslice__ (1, null, 1), 'cmdstatuserr');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (kind == 'ucioptionsparsed') {\n\t\t\t\t\tvar ucioptionsobj = json ['ucioptions'];\n\t\t\t\t\tvar ucischema = schemafromucioptionsobj (ucioptionsobj);\n\t\t\t\t\tvar selfprofile = getpathfromschema (configschema, 'profile/#');\n\t\t\t\t\tif (selfprofile === null) {\n\t\t\t\t\t\twindow.alert ('Warning: no profile selected to store UCI options.');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tselfprofile.setchildatkey ('ucioptions', ucischema);\n\t\t\t\t\t\tmaintabpane.setTabElementByKey ('config', buildconfigdiv ());\n\t\t\t\t\t\tmaintabpane.selectByKey ('config');\n\t\t\t\t\t\twindow.alert ('UCI options stored in current profile.');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (kind == 'analysisinfo') {\n\t\t\t\t\tmainboard.processanalysisinfo (json ['analysisinfo']);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (__in__ ('response', json)) {\n\t\t\t\tvar status = '?';\n\t\t\t\tvar response = json ['response'];\n\t\t\t\tif (__in__ ('key', response)) {\n\t\t\t\t\tvar dest = response ['key'];\n\t\t\t\t}\n\t\t\t\telse if (kind == 'check') {\n\t\t\t\t\titem.value = 'false';\n\t\t\t\t\tif (py_default) {\n\t\t\t\t\t\titem.value = 'true';\n\t\t\t\t\t}\n\t\t\t\t\titem.writepreference.check = true;\n\t\t\t\t\titem.setenabled (py_default);\n\t\t\t\t\titem.build ();\n\t\t\t\t}\n\t\t\t\tif (__in__ ('kind', response)) {\n\t\t\t\t\tvar kind = response ['kind'];\n\t\t\t\t\tif (kind == 'setlocalconfig') {\n\t\t\t\t\t\tvar data = response ['data'];\n\t\t\t\t\t\tdeserializeconfigcontent (data);\n\t\t\t\t\t\tmainboard.setconfigschema (configschema);\n\t\t\t\t\t}\n\t\t\t\t\telse if (kind == 'configstored') {\n\t\t\t\t\t\twindow.alert (('Config storing status: ' + status) + '.');\n\t\t\t\t\t\tmainboard.setconfigschema (configschema);\n\t\t\t\t\t}\n\t\t\t\t\telse if (kind == 'setmainboardfen') {\n\t\t\t\t\t\tvar fen = response ['fen'];\n\t\t\t\t\t\tvar positioninfo = response ['positioninfo'];\n\t\t\t\t\t\tmainboard.setfromfen (fen, positioninfo);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (__in__ ('owner', response)) {\n\t\t\t\t\tvar owner = response ['owner'];\n\t\t\t\t\tif (owner == 'board') {\n\t\t\t\t\t\tmainboard.siores (response);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (__in__ ('owner', response)) {\n\t\t\t\t\tvar owner = response ['owner'];\n\t\t\t\t\tif (owner == 'board') {\n\t\t\t\t\t\tmainboard.siores (response);\n\t\t\t\t\t}\n\t\t\t\t\titem.openchilds ();\n\t\t\t\t\titem.openchilds ();\n\t\t\t\t}\n\t\t\t\titem.setchildparent (ucioptions);\n\t\t\t\tvar nameditem = NamedSchemaItem (dict ({'key': key, 'item': item}));\n\t\t\t\tucioptions.childs.append (nameditem);\n\t\t\t}\n\t\t\tif (logitem === null || dest === null) {\n\t\t\t\tvar jsonstr = JSON.stringify (json, null, 2);\n\t\t\t\tmainlog (LogItem (jsonstr));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprocessconsoles [dest].log.log (logitem);\n\t\t\t}\n\t\t};\n\t\tvar windowresizehandler = function () {\n\t\t\tmaintabpane.resize ();\n\t\t};\n\t\tconsole.log ('creating socket for submit url [ {} ]'.format (SUBMIT_URL));\n\t\tvar socket = io.connect (SUBMIT_URL);\n\t\tconsole.log ('socket created ok');\n\t\tbuild ();\n\t\tsocket.on ('connect', onconnect);\n\t\tsocket.on ('siores', (function __lambda__ (json) {\n\t\t\treturn onevent (json);\n\t\t}));\n\t\taddEventListener (window, 'resize', windowresizehandler);\n\t\t__pragma__ ('<all>')\n\t\t\t__all__.ANTICHESS_START_FEN = ANTICHESS_START_FEN;\n\t\t\t__all__.BLACK = BLACK;\n\t\t\t__all__.BOT_CMD_ALIASES = BOT_CMD_ALIASES;\n\t\t\t__all__.BasicBoard = BasicBoard;\n\t\t\t__all__.Board = Board;\n\t\t\t__all__.Button = Button;\n\t\t\t__all__.CBUILD_CMD_ALIASES = CBUILD_CMD_ALIASES;\n\t\t\t__all__.CRAZYHOUSE_START_FEN = CRAZYHOUSE_START_FEN;\n\t\t\t__all__.Canvas = Canvas;\n\t\t\t__all__.CheckBox = CheckBox;\n\t\t\t__all__.ComboBox = ComboBox;\n\t\t\t__all__.ComboOption = ComboOption;\n\t\t\t__all__.DEFAULT_ENABLED = DEFAULT_ENABLED;\n\t\t\t__all__.DEFAULT_HELP = DEFAULT_HELP;\n\t\t\t__all__.DOUBLE_EXCLAM_LIMIT = DOUBLE_EXCLAM_LIMIT;\n\t\t\t__all__.DRAWISH_LIMIT = DRAWISH_LIMIT;\n\t\t\t__all__.DirBrowser = DirBrowser;\n\t\t\t__all__.Div = Div;\n\t\t\t__all__.ENGINE_CMD_ALIASES = ENGINE_CMD_ALIASES;\n\t\t\t__all__.EXCLAM_LIMIT = EXCLAM_LIMIT;\n\t\t\t__all__.FileInput = FileInput;\n\t\t\t__all__.FileUploader = FileUploader;\n\t\t\t__all__.Form = Form;\n\t\t\t__all__.HORDE_START_FEN = HORDE_START_FEN;\n\t\t\t__all__.INTERESTING_LIMIT = INTERESTING_LIMIT;\n\t\t\t__all__.Input = Input;\n\t\t\t__all__.LICH_API_GAMES_EXPORT = LICH_API_GAMES_EXPORT;\n\t\t\t__all__.Label = Label;\n\t\t\t__all__.LabeledLinkedCheckBox = LabeledLinkedCheckBox;\n\t\t\t__all__.LinkedCheckBox = LinkedCheckBox;\n\t\t\t__all__.LinkedSlider = LinkedSlider;\n\t\t\t__all__.LinkedTextInput = LinkedTextInput;\n\t\t\t__all__.LinkedTextarea = LinkedTextarea;\n\t\t\t__all__.Log = Log;\n\t\t\t__all__.LogItem = LogItem;\n\t\t\t__all__.LogPane = LogPane;\n\t\t\t__all__.MATE_LIMIT = MATE_LIMIT;\n\t\t\t__all__.MATE_SCORE = MATE_SCORE;\n\t\t\t__all__.MAX_CONTENT_LENGTH = MAX_CONTENT_LENGTH;\n\t\t\t__all__.MAX_LINE_LENGTH = MAX_LINE_LENGTH;\n\t\t\t__all__.Move = Move;\n\t\t\t__all__.MultipvInfo = MultipvInfo;\n\t\t\t__all__.NamedSchemaItem = NamedSchemaItem;\n\t\t\t__all__.Option = Option;\n\t\t\t__all__.P = P;\n\t\t\t__all__.PIECE_KINDS = PIECE_KINDS;\n\t\t\t__all__.PIECE_NAMES = PIECE_NAMES;\n\t\t\t__all__.PROMISING_LIMIT = PROMISING_LIMIT;\n\t\t\t__all__.PROMPIECEKINDS_ANTICHESS = PROMPIECEKINDS_ANTICHESS;\n\t\t\t__all__.PROMPIECEKINDS_STANDARD = PROMPIECEKINDS_STANDARD;\n\t\t\t__all__.PgnInfo = PgnInfo;\n\t\t\t__all__.PgnList = PgnList;\n\t\t\t__all__.PgnText = PgnText;\n\t\t\t__all__.Piece = Piece;\n\t\t\t__all__.PieceStore = PieceStore;\n\t\t\t__all__.ProcessConsole = ProcessConsole;\n\t\t\t__all__.RACING_KINGS_START_FEN = RACING_KINGS_START_FEN;\n\t\t\t__all__.RawTextInput = RawTextInput;\n\t\t\t__all__.SCHEMA_WRITE_PREFERENCE_DEFAULTS = SCHEMA_WRITE_PREFERENCE_DEFAULTS;\n\t\t\t__all__.SCROLL_BAR_WIDTH = SCROLL_BAR_WIDTH;\n\t\t\t__all__.STANDARD_START_FEN = STANDARD_START_FEN;\n\t\t\t__all__.SUBMIT_URL = SUBMIT_URL;\n\t\t\t__all__.SchemaCollection = SchemaCollection;\n\t\t\t__all__.SchemaDict = SchemaDict;\n\t\t\t__all__.SchemaItem = SchemaItem;\n\t\t\t__all__.SchemaList = SchemaList;\n\t\t\t__all__.SchemaScalar = SchemaScalar;\n\t\t\t__all__.SchemaWritePreference = SchemaWritePreference;\n\t\t\t__all__.Select = Select;\n\t\t\t__all__.Slider = Slider;\n\t\t\t__all__.Span = Span;\n\t\t\t__all__.SplitPane = SplitPane;\n\t\t\t__all__.Square = Square;\n\t\t\t__all__.THREE_CHECK_START_FEN = THREE_CHECK_START_FEN;\n\t\t\t__all__.Tab = Tab;\n\t\t\t__all__.TabPane = TabPane;\n\t\t\t__all__.TextArea = TextArea;\n\t\t\t__all__.TextInputWithButton = TextInputWithButton;\n\t\t\t__all__.VARIANT_OPTIONS = VARIANT_OPTIONS;\n\t\t\t__all__.Vect = Vect;\n\t\t\t__all__.View = View;\n\t\t\t__all__.WHITE = WHITE;\n\t\t\t__all__.WINDOW_SAFETY_MARGIN = WINDOW_SAFETY_MARGIN;\n\t\t\t__all__.WINNING_MOVE_LIMIT = WINNING_MOVE_LIMIT;\n\t\t\t__all__.__name__ = __name__;\n\t\t\t__all__.addEventListener = addEventListener;\n\t\t\t__all__.build = build;\n\t\t\t__all__.buildconfigdiv = buildconfigdiv;\n\t\t\t__all__.ce = ce;\n\t\t\t__all__.choose = choose;\n\t\t\t__all__.cmdinpcallback = cmdinpcallback;\n\t\t\t__all__.configschema = configschema;\n\t\t\t__all__.cpick = cpick;\n\t\t\t__all__.deserializeconfig = deserializeconfig;\n\t\t\t__all__.deserializeconfigcontent = deserializeconfigcontent;\n\t\t\t__all__.e = e;\n\t\t\t__all__.ge = ge;\n\t\t\t__all__.getClientVect = getClientVect;\n\t\t\t__all__.getScrollBarWidth = getScrollBarWidth;\n\t\t\t__all__.getbincallback = getbincallback;\n\t\t\t__all__.getbinerrcallback = getbinerrcallback;\n\t\t\t__all__.getclassforpiece = getclassforpiece;\n\t\t\t__all__.getfromobj = getfromobj;\n\t\t\t__all__.getglobalcssvar = getglobalcssvar;\n\t\t\t__all__.getglobalcssvarpxint = getglobalcssvarpxint;\n\t\t\t__all__.getjson = getjson;\n\t\t\t__all__.getjsonbin = getjsonbin;\n\t\t\t__all__.getlocalconfig = getlocalconfig;\n\t\t\t__all__.getpathfromschema = getpathfromschema;\n\t\t\t__all__.getpathlistfromschema = getpathlistfromschema;\n\t\t\t__all__.getscalarfromschema = getscalarfromschema;\n\t\t\t__all__.getstartfenforvariantkey = getstartfenforvariantkey;\n\t\t\t__all__.isvalidpieceletter = isvalidpieceletter;\n\t\t\t__all__.lichapiget = lichapiget;\n\t\t\t__all__.log = log;\n\t\t\t__all__.mainboard = mainboard;\n\t\t\t__all__.mainboardenginecommandcallback = mainboardenginecommandcallback;\n\t\t\t__all__.mainboardmovecallback = mainboardmovecallback;\n\t\t\t__all__.mainboardmoveclickedcallback = mainboardmoveclickedcallback;\n\t\t\t__all__.mainboardvariantchangedcallback = mainboardvariantchangedcallback;\n\t\t\t__all__.mainlog = mainlog;\n\t\t\t__all__.mainlogpane = mainlogpane;\n\t\t\t__all__.mainpart = mainpart;\n\t\t\t__all__.mainparts = mainparts;\n\t\t\t__all__.maintabpane = maintabpane;\n\t\t\t__all__.onconnect = onconnect;\n\t\t\t__all__.onevent = onevent;\n\t\t\t__all__.parsejson = parsejson;\n\t\t\t__all__.parts = parts;\n\t\t\t__all__.patchclasses = patchclasses;\n\t\t\t__all__.piececolortocolorname = piececolortocolorname;\n\t\t\t__all__.piecekindtopiecename = piecekindtopiecename;\n\t\t\t__all__.piecelettertopiece = piecelettertopiece;\n\t\t\t__all__.processconsoles = processconsoles;\n\t\t\t__all__.prompiecekindsforvariantkey = prompiecekindsforvariantkey;\n\t\t\t__all__.putjsonbin = putjsonbin;\n\t\t\t__all__.queryparams = queryparams;\n\t\t\t__all__.queryparamsstring = queryparamsstring;\n\t\t\t__all__.randint = randint;\n\t\t\t__all__.randscalarvalue = randscalarvalue;\n\t\t\t__all__.reloadcallback = reloadcallback;\n\t\t\t__all__.schemaclipboard = schemaclipboard;\n\t\t\t__all__.schemafromobj = schemafromobj;\n\t\t\t__all__.schemafromucioptionsobj = schemafromucioptionsobj;\n\t\t\t__all__.schemajson = schemajson;\n\t\t\t__all__.schemawritepreferencefromobj = schemawritepreferencefromobj;\n\t\t\t__all__.scorecolor = scorecolor;\n\t\t\t__all__.scoreverbal = scoreverbal;\n\t\t\t__all__.serializecallback = serializecallback;\n\t\t\t__all__.serializeconfig = serializeconfig;\n\t\t\t__all__.serializeputjsonbincallback = serializeputjsonbincallback;\n\t\t\t__all__.serializeputjsonbinerrcallback = serializeputjsonbinerrcallback;\n\t\t\t__all__.showsrc = showsrc;\n\t\t\t__all__.simulateserverlag = simulateserverlag;\n\t\t\t__all__.socket = socket;\n\t\t\t__all__.srcdiv = srcdiv;\n\t\t\t__all__.striplonglines = striplonglines;\n\t\t\t__all__.uci_variant_to_variantkey = uci_variant_to_variantkey;\n\t\t\t__all__.uid = uid;\n\t\t\t__all__.windowresizehandler = windowresizehandler;\n\t\t\t__all__.ws_scheme = ws_scheme;\n\t\t\t__all__.xor = xor;\n\t\t__pragma__ ('</all>')\n\t}) ();\n return __all__;\n}", "title": "" }, { "docid": "5b29bba8ab6194b138ed4f08119d28b3", "score": "0.5411573", "text": "* genFromBuffers () {\n throw new Error('not implemented')\n }", "title": "" }, { "docid": "8e53440a0835266071a13f60513de8f0", "score": "0.54105836", "text": "function Generator() {} // 82", "title": "" }, { "docid": "5c9fbc5002d91b0ac1bec5ae1cb679ed", "score": "0.53786457", "text": "function i(n){return!!n.constructor&&\"function\"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)}", "title": "" }, { "docid": "50a1ee99c03837a267edbcdbb82eb2b7", "score": "0.5361859", "text": "function registerPolyfills() {\n\n if (typeof Object.assign !== 'function') {\n // Must be writable: true, enumerable: false, configurable: true\n Object.defineProperty(Object, \"assign\", {\n value: function assign(target, varArgs) { // .length of function is 2\n 'use strict';\n if (target == null) { // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var to = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var nextSource = arguments[index];\n\n if (nextSource != null) { // Skip over if undefined or null\n for (var nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n return to;\n },\n writable: true,\n configurable: true\n });\n }\n if (!Array.prototype.findIndex) {\n Object.defineProperty(Array.prototype, 'findIndex', {\n value: function (predicate) {\n // 1. Let O be ? ToObject(this value).\n if (this == null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var o = Object(this);\n\n // 2. Let len be ? ToLength(? Get(O, \"length\")).\n var len = o.length >>> 0;\n\n // 3. If IsCallable(predicate) is false, throw a TypeError exception.\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n\n // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.\n var thisArg = arguments[1];\n\n // 5. Let k be 0.\n var k = 0;\n\n // 6. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ! ToString(k).\n // b. Let kValue be ? Get(O, Pk).\n // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).\n // d. If testResult is true, return k.\n var kValue = o[k];\n if (predicate.call(thisArg, kValue, k, o)) {\n return k;\n }\n // e. Increase k by 1.\n k++;\n }\n\n // 7. Return -1.\n return -1;\n },\n configurable: true,\n writable: true\n });\n }\n\n if (!Function.prototype.bind) {\n Function.prototype.bind = function (oThis) {\n if (typeof this !== 'function') {\n // closest thing possible to the ECMAScript 5\n // internal IsCallable function\n throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');\n }\n\n var aArgs = Array.prototype.slice.call(arguments, 1),\n fToBind = this,\n fNOP = function () { },\n fBound = function () {\n return fToBind.apply(this instanceof fNOP\n ? this\n : oThis,\n aArgs.concat(Array.prototype.slice.call(arguments)));\n };\n\n if (this.prototype) {\n // Function.prototype doesn't have a prototype property\n fNOP.prototype = this.prototype;\n }\n fBound.prototype = new fNOP();\n\n return fBound;\n };\n }\n\n if (!Math.sign) {\n Math.sign = function(x) {\n return ((x > 0) - (x < 0)) || +x;\n };\n }\n}", "title": "" }, { "docid": "a823724c755401b8296fe8b590643d7c", "score": "0.5322939", "text": "function r(n){return!!n.constructor&&typeof n.constructor.isBuffer==\"function\"&&n.constructor.isBuffer(n)}", "title": "" }, { "docid": "8bf9187596a93a6be28b1817e3b0aba6", "score": "0.52622104", "text": "function Generator() {} // 84", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "526188664644f0c76267dd549a86c256", "score": "0.5256201", "text": "function r(){}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "e6b6c01b84b0263bdb9be83233cf1d55", "score": "0.52391523", "text": "function r(e){return!!e.constructor&&\"function\"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}", "title": "" }, { "docid": "0a3946053c61ac379fc1dc66adb075c3", "score": "0.5235749", "text": "function Util() {}", "title": "" }, { "docid": "e876e880dbeae221875eb9ef0cc8da20", "score": "0.5227796", "text": "function Generator() {} // 81", "title": "" }, { "docid": "9a08ee641c010d89d90ad15128e11716", "score": "0.5212665", "text": "function o0(stdlib,e,o1) {\n try {\n\"use asm\";\n}catch(o85){}\n function e(o2,o3) {\n try {\no421.o155[0xFF68] = +o11;\n}catch(e){}\n try {\no3 = +e;\n}catch(e){}\n try {\nreturn +((o421.o494 <= 0) ? 0x7E : 0xFE);\n}catch(e){}\n }\n \n var o203 = Math.function () {\n try {\no7.o8(Array.prototype.hasOwnProperty('entries'), \"Array.prototype should have an entries method\");\n}catch(e){}\n try {\no7.o8(Array.prototype.hasOwnProperty('keys'), \"Array.prototype should have a keys method\");\n}catch(e){}\n try {\no7.o8(Array.prototype.hasOwnProperty('values'), \"Array.prototype should have a values method\");\n}catch(e){}\n try {\no7.o8(Array.prototype.hasOwnProperty(Symbol.iterator), \"Array.prototype should have an @@iterator method\");\n}catch(e){}\n\n try {\no7.o9(0, Array.prototype.entries.length, \"entries method takes zero arguments\");\n}catch(e){}\n try {\no7.o9(0, Array.prototype.keys.length, \"keys method takes zero arguments\");\n}catch(e){}\n try {\no7.o9(0, Array.prototype.values.length, \"values method takes zero arguments\");\n}catch(e){}\n\n try {\no7.o8(Array.prototype.values === Array.prototype[Symbol.iterator], \"Array.prototype's @@iterator is the same function as its values() method\");\n}catch(e){}\n }\n \n var o7 = [add,add,add,add];\n \n \n try {\nreturn { \n o4 : o4\n };\n}catch(e){}\n}", "title": "" }, { "docid": "c3b7b2ae1c7e46bccdd727343abacebc", "score": "0.5206365", "text": "function WebGL() {\n \"use strict\";\n}", "title": "" }, { "docid": "28816ed00545fbb468d9c05bf9a02c4c", "score": "0.5197935", "text": "function Shim() {}", "title": "" }, { "docid": "e7f934445d5a8040f21626bdf1d23b7e", "score": "0.5178456", "text": "function Mn(t,e){return t(e={exports:{}},e.exports),e.exports}", "title": "" }, { "docid": "17ce006d6ec9963f5d2c5b13ad427fc6", "score": "0.51530373", "text": "function Buffer() {\n}", "title": "" }, { "docid": "a29f0b188346ddb82fd528f42987ae02", "score": "0.5123572", "text": "function r() { }", "title": "" }, { "docid": "990c121cbf4c2a478a13692e0748086b", "score": "0.5087964", "text": "function r(t){return!!t.constructor&&\"function\"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}", "title": "" }, { "docid": "d2d1849a7802691ac33544a8b93ec4b6", "score": "0.5085576", "text": "function runtime(){require(\"./runtime\");}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "344b14eea51ac25183beaa0488250c1d", "score": "0.5073765", "text": "function Module() {}", "title": "" }, { "docid": "b741b7ed439c3e253ba77bed8db5d981", "score": "0.5065566", "text": "function Ji(){return Ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ji.apply(this,arguments)}", "title": "" }, { "docid": "e0f2636bdbadb8f3d42274a2efc24ed8", "score": "0.50608915", "text": "function Yv(){return Yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yv.apply(this,arguments)}", "title": "" }, { "docid": "89b80a8699b889750b54c70bededd27b", "score": "0.50517535", "text": "function u(u,p){const v=u.vertex.code,c=u.fragment.code;1!==p.output&&3!==p.output||(u.include(_Transform_glsl_js__WEBPACK_IMPORTED_MODULE_1__[\"Transform\"],{linearDepth:!0}),u.include(_attributes_TextureCoordinateAttribute_glsl_js__WEBPACK_IMPORTED_MODULE_7__[\"TextureCoordinateAttribute\"],p),u.include(_shading_VisualVariables_glsl_js__WEBPACK_IMPORTED_MODULE_4__[\"VisualVariables\"],p),u.include(_output_OutputDepth_glsl_js__WEBPACK_IMPORTED_MODULE_6__[\"OutputDepth\"],p),u.include(_Slice_glsl_js__WEBPACK_IMPORTED_MODULE_2__[\"Slice\"],p),u.vertex.uniforms.add(\"nearFar\",\"vec2\"),u.varyings.add(\"depth\",\"float\"),p.hasColorTexture&&u.fragment.uniforms.add(\"tex\",\"sampler2D\"),v.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main(void) {\n vpos = calculateVPos();\n vpos = subtractOrigin(vpos);\n vpos = addVerticalOffset(vpos, localOrigin);\n gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);\n forwardTextureCoordinates();\n }\n `),u.include(_util_AlphaDiscard_glsl_js__WEBPACK_IMPORTED_MODULE_5__[\"DiscardOrAdjustAlpha\"],p),c.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main(void) {\n discardBySlice(vpos);\n ${p.hasColorTexture?_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vec4 texColor = texture2D(tex, vuv0);\n discardOrAdjustAlpha(texColor);`:\"\"}\n outputDepth(depth);\n }\n `)),2===p.output&&(u.include(_Transform_glsl_js__WEBPACK_IMPORTED_MODULE_1__[\"Transform\"],{linearDepth:!1}),u.include(_attributes_NormalAttribute_glsl_js__WEBPACK_IMPORTED_MODULE_8__[\"NormalAttribute\"],p),u.include(_attributes_VertexNormal_glsl_js__WEBPACK_IMPORTED_MODULE_9__[\"VertexNormal\"],p),u.include(_attributes_TextureCoordinateAttribute_glsl_js__WEBPACK_IMPORTED_MODULE_7__[\"TextureCoordinateAttribute\"],p),u.include(_shading_VisualVariables_glsl_js__WEBPACK_IMPORTED_MODULE_4__[\"VisualVariables\"],p),p.hasColorTexture&&u.fragment.uniforms.add(\"tex\",\"sampler2D\"),u.vertex.uniforms.add(\"viewNormal\",\"mat4\"),u.varyings.add(\"vPositionView\",\"vec3\"),v.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main(void) {\n vpos = calculateVPos();\n vpos = subtractOrigin(vpos);\n ${0===p.normalType?_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:\"\"}\n vpos = addVerticalOffset(vpos, localOrigin);\n gl_Position = transformPosition(proj, view, vpos);\n forwardTextureCoordinates();\n }\n `),u.include(_Slice_glsl_js__WEBPACK_IMPORTED_MODULE_2__[\"Slice\"],p),u.include(_util_AlphaDiscard_glsl_js__WEBPACK_IMPORTED_MODULE_5__[\"DiscardOrAdjustAlpha\"],p),c.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main() {\n discardBySlice(vpos);\n ${p.hasColorTexture?_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vec4 texColor = texture2D(tex, vuv0);\n discardOrAdjustAlpha(texColor);`:\"\"}\n\n ${3===p.normalType?_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vec3 normal = screenDerivativeNormal(vPositionView);`:_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vec3 normal = normalize(vNormalWorld);\n if (gl_FrontFacing == false) normal = -normal;`}\n gl_FragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);\n }\n `)),4===p.output&&(u.include(_Transform_glsl_js__WEBPACK_IMPORTED_MODULE_1__[\"Transform\"],{linearDepth:!1}),u.include(_attributes_TextureCoordinateAttribute_glsl_js__WEBPACK_IMPORTED_MODULE_7__[\"TextureCoordinateAttribute\"],p),u.include(_shading_VisualVariables_glsl_js__WEBPACK_IMPORTED_MODULE_4__[\"VisualVariables\"],p),p.hasColorTexture&&u.fragment.uniforms.add(\"tex\",\"sampler2D\"),v.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main(void) {\n vpos = calculateVPos();\n vpos = subtractOrigin(vpos);\n vpos = addVerticalOffset(vpos, localOrigin);\n gl_Position = transformPosition(proj, view, vpos);\n forwardTextureCoordinates();\n }\n `),u.include(_Slice_glsl_js__WEBPACK_IMPORTED_MODULE_2__[\"Slice\"],p),u.include(_util_AlphaDiscard_glsl_js__WEBPACK_IMPORTED_MODULE_5__[\"DiscardOrAdjustAlpha\"],p),u.include(_output_OutputHighlight_glsl_js__WEBPACK_IMPORTED_MODULE_3__[\"OutputHighlight\"]),c.add(_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n void main() {\n discardBySlice(vpos);\n ${p.hasColorTexture?_shaderModules_interfaces_js__WEBPACK_IMPORTED_MODULE_0__[\"glsl\"]`\n vec4 texColor = texture2D(tex, vuv0);\n discardOrAdjustAlpha(texColor);`:\"\"}\n outputHighlight();\n }\n `))}", "title": "" }, { "docid": "95c83684d25f58b42d65a98ed25551cd", "score": "0.5037144", "text": "function c() {}", "title": "" }, { "docid": "ca9eeda339cc62fecd92228661ee6e65", "score": "0.5024567", "text": "function CanvasUtils() {}", "title": "" }, { "docid": "7da0b07f1a16345abbd286803d1b463c", "score": "0.5022558", "text": "make() {}", "title": "" }, { "docid": "3ee383b53d934a903018b1b24d1dc2a2", "score": "0.501397", "text": "function o(x){var a={},_=new c({max:100});function S(e,t){var r=t.documentLoader,r=void 0===r?x.documentLoader:r,t=n(t,[\"documentLoader\"]);return Object.assign({},{documentLoader:r},t,e)}return x.compact=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){var i,o,a,s,u,c,l,f,h,d,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p.length<2)throw new TypeError(\"Could not compact, too few arguments.\");e.next=2;break;case 2:if(null===r)throw new v(\"The compaction context must not be null.\",\"jsonld.CompactError\",{code:\"invalid local context\"});e.next=4;break;case 4:if(null===t)return e.abrupt(\"return\",null);e.next=6;break;case 6:if((n=S(n,{base:w(t)?t:\"\",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new E(\"_:b\"),contextResolver:new O({sharedCache:_})})).link&&(n.skipExpansion=!0),n.compactToRelative||delete n.base,!n.skipExpansion){e.next=13;break}i=t,e.next=16;break;case 13:return e.next=15,x.expand(t,n);case 15:i=e.sent;case 16:return e.next=18,x.processContext(A(n),r,n);case 18:return o=e.sent,e.next=21,C({activeCtx:o,element:i,options:n,compactionMap:n.compactionMap});case 21:a=e.sent,n.compactArrays&&!n.graph&&I(a)?1===a.length?a=a[0]:0===a.length&&(a={}):n.graph&&m(a)&&(a=[a]),m(r)&&\"@context\"in r&&(r=r[\"@context\"]),r=j.clone(r),I(r)||(r=[r]),s=r,r=[];for(u=0;u<s.length;++u)(!m(s[u])||0<Object.keys(s[u]).length)&&r.push(s[u]);if(c=0<r.length,1===r.length&&(r=r[0]),I(a))l=L({activeCtx:o,iri:\"@graph\",relativeTo:{vocab:!0}}),f=a,a={},c&&(a[\"@context\"]=r),a[l]=f;else if(m(a)&&c)for(d in h=a,a={\"@context\":r},h)a[d]=h[d];return e.abrupt(\"return\",a);case 33:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),x.expand=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i,o,a,s,u,c,l,f=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(f.length<1)throw new TypeError(\"Could not expand, too few arguments.\");e.next=2;break;case 2:if(!1===(r=S(r,{keepFreeFloatingNodes:!1,contextResolver:new O({sharedCache:_})})).expansionMap&&(r.expansionMap=void 0),n={},i=[],\"expandContext\"in r&&(a=j.clone(r.expandContext),m(a)&&\"@context\"in a?n.expandContext=a:n.expandContext={\"@context\":a},i.push(n.expandContext)),w(t)){e.next=11;break}n.input=j.clone(t),e.next=17;break;case 11:return e.next=13,x.get(t,r);case 13:a=e.sent,o=a.documentUrl,n.input=a.document,a.contextUrl&&(n.remoteContext={\"@context\":a.contextUrl},i.push(n.remoteContext));case 17:\"base\"in r||(r.base=o||\"\"),s=A(r),u=0,c=i;case 20:if(u<c.length)return l=c[u],e.next=24,P({activeCtx:s,localCtx:l,options:r});e.next=28;break;case 24:s=e.sent;case 25:u++,e.next=20;break;case 28:return e.next=30,h({activeCtx:s,element:n.input,options:r,expansionMap:r.expansionMap});case 30:return l=e.sent,m(l)&&\"@graph\"in l&&1===Object.keys(l).length?l=l[\"@graph\"]:null===l&&(l=[]),I(l)||(l=[l]),e.abrupt(\"return\",l);case 34:case\"end\":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),x.flatten=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){var i,o,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a.length<1)return e.abrupt(\"return\",new TypeError(\"Could not flatten, too few arguments.\"));e.next=2;break;case 2:return r=\"function\"!=typeof r&&r||null,n=S(n,{base:w(t)?t:\"\",contextResolver:new O({sharedCache:_})}),e.next=6,x.expand(t,n);case 6:if(o=e.sent,i=d(o),null===r)return e.abrupt(\"return\",i);e.next=10;break;case 10:return n.graph=!0,n.skipExpansion=!0,e.next=14,x.compact(i,r,n);case 14:return o=e.sent,e.abrupt(\"return\",o);case 16:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),x.frame=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){var i,o,a,s,u,c,l,f=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(f.length<2)throw new TypeError(\"Could not frame, too few arguments.\");e.next=2;break;case 2:if(n=S(n,{base:w(t)?t:\"\",embed:\"@once\",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new O({sharedCache:_})}),w(r))return e.next=6,x.get(r,n);e.next=9;break;case 6:i=e.sent,r=i.document,i.contextUrl&&((c=r[\"@context\"])?I(c)?c.push(i.contextUrl):c=[c,i.contextUrl]:c=i.contextUrl,r[\"@context\"]=c);case 9:return o=r&&r[\"@context\"]||{},e.next=12,x.processContext(A(n),o,n);case 12:return a=e.sent,n.hasOwnProperty(\"omitGraph\")||(n.omitGraph=N(a,1.1)),n.hasOwnProperty(\"pruneBlankNodeIdentifiers\")||(n.pruneBlankNodeIdentifiers=N(a,1.1)),e.next=17,x.expand(t,n);case 17:return s=e.sent,(u=k({},n)).isFrame=!0,u.keepFreeFloatingNodes=!0,e.next=23,x.expand(r,u);case 23:return l=e.sent,c=Object.keys(r).map(function(e){return R(a,e,{vocab:!0})}),u.merged=!c.includes(\"@graph\"),u.is11=N(a,1.1),l=g(s,l,u),u.graph=!n.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0,e.next=34,x.compact(l,o,u);case 34:return l=e.sent,u.link={},l=b(l,u),e.abrupt(\"return\",l);case 38:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),x.link=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i={},r&&(i[\"@context\"]=r),i[\"@embed\"]=\"@link\",e.abrupt(\"return\",x.frame(t,i,n));case 4:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),x.normalize=x.canonize=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length<1)throw new TypeError(\"Could not canonize, too few arguments.\");e.next=2;break;case 2:if(!(\"inputFormat\"in(r=S(r,{base:w(t)?t:\"\",algorithm:\"URDNA2015\",skipExpansion:!1,contextResolver:new O({sharedCache:_})})))){e.next=8;break}if(\"application/n-quads\"!==r.inputFormat&&\"application/nquads\"!==r.inputFormat)throw new v(\"Unknown canonicalization input format.\",\"jsonld.CanonizeError\");e.next=6;break;case 6:return n=l.parse(t),e.abrupt(\"return\",s.canonize(n,r));case 8:return delete(i=k({},r)).format,i.produceGeneralizedRdf=!1,e.next=13,x.toRDF(t,i);case 13:return i=e.sent,e.abrupt(\"return\",s.canonize(i,r));case 15:case\"end\":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),x.fromRDF=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length<1)throw new TypeError(\"Could not convert from RDF, too few arguments.\");e.next=2;break;case 2:if(r=S(r,{format:w(t)?\"application/n-quads\":void 0}),i=r.format,n=r.rdfParser,!i){e.next=11;break}if(n=n||a[i]){e.next=9;break}throw new v(\"Unknown input format.\",\"jsonld.UnknownFormat\",{format:i});case 9:e.next=12;break;case 11:n=function(){return t};case 12:return e.next=14,n(t);case 14:return i=e.sent,e.abrupt(\"return\",p(i,r));case 16:case\"end\":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),x.toRDF=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length<1)throw new TypeError(\"Could not convert to RDF, too few arguments.\");e.next=2;break;case 2:if(!(r=S(r,{base:w(t)?t:\"\",skipExpansion:!1,contextResolver:new O({sharedCache:_})})).skipExpansion){e.next=7;break}n=t,e.next=10;break;case 7:return e.next=9,x.expand(t,r);case 9:n=e.sent;case 10:if(i=y(n,r),!r.format){e.next=17;break}if(\"application/n-quads\"===r.format||\"application/nquads\"===r.format)return e.next=15,l.serialize(i);e.next=16;break;case 15:return e.abrupt(\"return\",e.sent);case 16:throw new v(\"Unknown output format.\",\"jsonld.UnknownFormat\",{format:r.format});case 17:return e.abrupt(\"return\",i);case 18:case\"end\":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),x.createNodeMap=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.length<1)throw new TypeError(\"Could not create node map, too few arguments.\");e.next=2;break;case 2:return r=S(r,{base:w(t)?t:\"\",contextResolver:new O({sharedCache:_})}),e.next=5,x.expand(t,r);case 5:return n=e.sent,e.abrupt(\"return\",D(n,r));case 7:case\"end\":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),x.merge=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){var i,o,a,s,u,c,l,f,h,d,p,v,y,g,b,m,w=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(w.length<1)throw new TypeError(\"Could not merge, too few arguments.\");e.next=2;break;case 2:if(I(t)){e.next=4;break}throw new TypeError('Could not merge, \"docs\" must be an array.');case 4:return r=\"function\"!=typeof r&&r||null,n=S(n,{contextResolver:new O({sharedCache:_})}),e.next=8,Promise.all(t.map(function(e){var t=k({},n);return x.expand(e,t)}));case 8:i=e.sent,o=!0,\"mergeNodes\"in n&&(o=n.mergeNodes),a=n.issuer||new E(\"_:b\"),s={\"@default\":{}},u=0;case 14:if(!(u<i.length)){e.next=33;break}if(m=j.relabelBlankNodes(i[u],{issuer:new E(\"_:b\"+u+\"-\")}),M(m,c=o||0===u?s:{\"@default\":{}},\"@default\",a),c===s){e.next=30;break}e.t0=regeneratorRuntime.keys(c);case 20:if((e.t1=e.t0()).done){e.next=30;break}if(l=e.t1.value,f=c[l],l in s){e.next=26;break}return s[l]=f,e.abrupt(\"continue\",20);case 26:for(d in h=s[l],f)d in h||(h[d]=f[d]);e.next=20;break;case 30:++u,e.next=14;break;case 33:for(p=B(s),v=[],y=Object.keys(p).sort(),g=0;g<y.length;++g)b=p[y[g]],T(b)||v.push(b);if(null===r)return e.abrupt(\"return\",v);e.next=39;break;case 39:return n.graph=!0,n.skipExpansion=!0,e.next=43,x.compact(v,r,n);case 43:return m=e.sent,e.abrupt(\"return\",m);case 45:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),Object.defineProperty(x,\"documentLoader\",{get:function(){return x._documentLoader},set:function(e){return x._documentLoader=e}}),x.documentLoader=function(){var t=i(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw new v(\"Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.\",\"jsonld.LoadDocumentError\",{code:\"loading document failed\",url:t});case 1:case\"end\":return e.stop()}},e)}));return function(e){return t.apply(this,arguments)}}(),x.get=function(){var r=i(regeneratorRuntime.mark(function e(t,r){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(\"function\"==typeof r.documentLoader?r:x).documentLoader,e.next=3,n(t);case 3:if(i=e.sent,e.prev=4,i.document){e.next=7;break}throw new v(\"No remote document found at the given URL.\",\"jsonld.NullRemoteDocument\");case 7:w(i.document)&&(i.document=JSON.parse(i.document)),e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(4),new v(\"Could not retrieve a JSON-LD document from the URL.\",\"jsonld.LoadDocumentError\",{code:\"loading document failed\",cause:e.t0,remoteDoc:i});case 13:return e.abrupt(\"return\",i);case 14:case\"end\":return e.stop()}},e,null,[[4,10]])}));return function(e,t){return r.apply(this,arguments)}}(),x.processContext=function(){var n=i(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S(n,{base:\"\",contextResolver:new O({sharedCache:_})}),null===r)return e.abrupt(\"return\",A(n));e.next=3;break;case 3:return r=j.clone(r),m(r)&&\"@context\"in r||(r={\"@context\":r}),e.abrupt(\"return\",P({activeCtx:t,localCtx:r,options:n}));case 6:case\"end\":return e.stop()}},e)}));return function(e,t,r){return n.apply(this,arguments)}}(),x.getContextValue=q(56).getContextValue,x.documentLoaders={},x.documentLoaders.node=q(480),x.documentLoaders.xhr=q(483),x.useDocumentLoader=function(e){if(!(e in x.documentLoaders))throw new v('Unknown document loader type: \"'+e+'\"',\"jsonld.UnknownDocumentLoader\",{type:e});x.documentLoader=x.documentLoaders[e].apply(x,Array.prototype.slice.call(arguments,1))},x.registerRDFParser=function(e,t){a[e]=t},x.unregisterRDFParser=function(e){delete a[e]},x.registerRDFParser(\"application/n-quads\",l.parse),x.registerRDFParser(\"application/nquads\",l.parse),x.registerRDFParser(\"rdfa-api\",f.parse),x.url=q(40),x.util=j,Object.assign(x,j),(x.promises=x).RequestQueue=q(129),x.JsonLdProcessor=q(484)(x),U&&void 0===t.JsonLdProcessor&&Object.defineProperty(t,\"JsonLdProcessor\",{writable:!0,enumerable:!1,configurable:!0,value:x.JsonLdProcessor}),F?x.useDocumentLoader(\"node\"):\"undefined\"!=typeof XMLHttpRequest&&x.useDocumentLoader(\"xhr\"),x}", "title": "" }, { "docid": "21650f8e4192c25178654eb0d0316eb8", "score": "0.50120294", "text": "get itself() {\n return System.get(System.decanonicalize(\"lively.modules/index.js\"));\n }", "title": "" }, { "docid": "21650f8e4192c25178654eb0d0316eb8", "score": "0.50120294", "text": "get itself() {\n return System.get(System.decanonicalize(\"lively.modules/index.js\"));\n }", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.50039995", "text": "initialize() {}", "title": "" }, { "docid": "d588b4437f06c3807eac1bc17c01d016", "score": "0.500051", "text": "function Utils() {\n\n}", "title": "" }, { "docid": "797b760c74d74bf586faa38628995410", "score": "0.4999948", "text": "function freezeIntrinsics(global) {\n seal(global.Object.prototype);\n}", "title": "" }, { "docid": "61ca88693656d589c172066000bfffa2", "score": "0.49965966", "text": "initialize() {\n }", "title": "" }, { "docid": "a9872c018c50c5cb78520c46ec5afc9e", "score": "0.49921292", "text": "function d(s){if(s){const{planes:r,points:e}=s;return{planes:[Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[0]),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[1]),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[2]),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[3]),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[4]),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(r[5])],points:[Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[0]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[1]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[2]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[3]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[4]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[5]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[6]),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"b\"])(e[7])]}}return{planes:[Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])(),Object(_plane_js__WEBPACK_IMPORTED_MODULE_7__[\"c\"])()],points:[Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])(),Object(_vec3f64_js__WEBPACK_IMPORTED_MODULE_0__[\"c\"])()]}}", "title": "" }, { "docid": "8b20aeff02af61f1be184f033efd622d", "score": "0.4980084", "text": "function main() {\n\n}", "title": "" }, { "docid": "8b20aeff02af61f1be184f033efd622d", "score": "0.4980084", "text": "function main() {\n\n}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" }, { "docid": "586732913259f371782836682c53342e", "score": "0.4975522", "text": "constructor() {}", "title": "" } ]
391ce53bb0faa85894bd2cc0d2b87ddc
Callback for Search Results Manager after results are cleared. We simply clear any active info window.
[ { "docid": "dadd0c19bd1539ee5a7f2b0c02c967e2", "score": "0.7907035", "text": "function geeClearSearchResults() {\n geeMap.closeInfoWindow();\n }", "title": "" } ]
[ { "docid": "a4bb97393d0c1927d55739569adb70e1", "score": "0.7496644", "text": "function clearSearchResults() {\n\t\tqueryBox.value = \"\";\n\t\tresultContainer.innerHTML = \"\";\n\t\tnewsContainer.classList.remove(\"toggle-results\");\n\t}", "title": "" }, { "docid": "d26a32cbab05e9d032b297ce18131b8e", "score": "0.73879963", "text": "function clearResults()\n{\n\t $('#' + resultsId).html('');\n\t $('#' + resultsId).hide();\n}", "title": "" }, { "docid": "b4f31f9ceb187810d4f948c9ca11b1c8", "score": "0.7372134", "text": "function app_clear_results() {\r\n // DOM: Clear previous results\r\n $(\"#app_articles_display\").empty();\r\n}", "title": "" }, { "docid": "8db177ebbcddfcef0f71db45026171d0", "score": "0.73661506", "text": "function clearSearchResults() {\n $('#searchResults').empty();\n $('#searchResultsContainer').hide();\n}", "title": "" }, { "docid": "ee0f0dd7dedc06d3bb00ef3f039ba25e", "score": "0.7330293", "text": "function clearResults() {\r\n $('#searchresults').empty();\r\n}", "title": "" }, { "docid": "5a1c9fd683b300841a7287dfc89ec96b", "score": "0.73206353", "text": "function clearSearchResults() {\n $(\"#results\").html(\"\");\n}", "title": "" }, { "docid": "4c2c28d61e6dd86b0aeefe137f8c1c26", "score": "0.72897613", "text": "function clearResults() {\n /* Remove all prev items. */\n $(\".results .cui__selector--direct__item\").remove();\n\n $(\"h2\").empty();\n}", "title": "" }, { "docid": "0450fb36b20a99205a455f54e4c97603", "score": "0.71785283", "text": "clearResults() {\n this.render_container.html(\"\");\n this.hasResults = false;\n }", "title": "" }, { "docid": "5260bc4c99533c12889504cf7c27f713", "score": "0.7158638", "text": "function resetSearchResult() {\n resultsContainerProducts.innerHTML = \"\";\n}", "title": "" }, { "docid": "5d54d700d11bc5e189643849b1e01a32", "score": "0.71543664", "text": "function clearResults() {\n resultInfo.remove();\n noResult.remove();\n imageDiv.remove();\n\n}", "title": "" }, { "docid": "2c1e4b455ed336ca8bed2d0d4077eeb7", "score": "0.7098307", "text": "function clearPreviousResults() {\n\t\t$('#getResults').children('div').remove();\n\t}", "title": "" }, { "docid": "66266aa8dc771c5e9989b5fcb54330f2", "score": "0.70943546", "text": "_clearSearchResults() {\n // reseet arrow navigation helper to enable form submit on enter\n this._navigationHelper.resetIterator();\n\n // remove all result popovers\n const results = document.querySelectorAll(SEARCH_WIDGET_RESULTS_SELECTOR);\n Iterator.iterate(results, result => result.remove());\n }", "title": "" }, { "docid": "bf1c604a817a962b79c2a61ee6aef4d0", "score": "0.70896643", "text": "clearResults() {\n this.searchText = '';\n this.nbpResults = [];\n this.showResults = false;\n }", "title": "" }, { "docid": "6b087d4f3e937d17ea4ea56c6f0006f2", "score": "0.70638317", "text": "clearResults() {\n this.render_container.html('');\n this.hasResults = false;\n }", "title": "" }, { "docid": "82f0ff88e79d3ac7d05b53b16bbc8b36", "score": "0.70426226", "text": "function deleteResults() {\n window.results = [];\n\n $('#result-message').hide();\n $('#result-message-extra').hide();\n $('#underscore-toggle').hide();\n $('#delete-results').hide();\n\n console.info('Removed results!');\n }", "title": "" }, { "docid": "64add6845d0ea7925559acd4981962e7", "score": "0.701454", "text": "function clearResults() {\n\tdocument.getElementById(\"wikipedia-viewer__results\").innerHTML = \"\";\n}", "title": "" }, { "docid": "550b30a1c9ba0276be430af26b0a005b", "score": "0.6948764", "text": "function clearResults() {\n selectElement('.search-results').innerHTML = '';\n}", "title": "" }, { "docid": "8f119abda28f36db0448be075909d01f", "score": "0.6942843", "text": "function clear(){self.searchTerm='';search();}", "title": "" }, { "docid": "72b59bdc37b1b69dbeb8d919437d6645", "score": "0.69165576", "text": "function closeDomainSearchResult() {\n $('result').empty();\n}", "title": "" }, { "docid": "2a5193f3ab0bd188926be0240147093d", "score": "0.6913652", "text": "function clearSearch() {\n if (vm.query == \"\") {\n vm.results = {};\n vm.results.show = false;\n vm.selectedLocation = false;\n }\n }", "title": "" }, { "docid": "1337c96ab9d3744a240b2dec7644e825", "score": "0.6876443", "text": "function reset() {\n _map.clearOverlays();\n $(\"#results\").empty();\n}", "title": "" }, { "docid": "260664745a633641d21aca7ee2da3823", "score": "0.68668294", "text": "function clearSearchResults() {\n $(\"#srh-results__list\").remove();\n $(\"#srh-results__poster\").remove();\n}", "title": "" }, { "docid": "fea70ed8c49ee0edb020e150b111a703", "score": "0.68523735", "text": "clearResults() {\n\t\tthis.setState({\n\t\t\tquery: '',\n\t\t\tresults: [],\n\t\t\tresultsTotal: ''\n\t\t})\n\t}", "title": "" }, { "docid": "409b0f233c7c517be9a048f8c1755e50", "score": "0.6849151", "text": "clearSearchResult() {\r\n const navSearchResultContainer = document.querySelector(\".nav-search-results\");\r\n\r\n while (navSearchResultContainer.children.length > 0) {\r\n navSearchResultContainer.removeChild(navSearchResultContainer.children[0]);\r\n }\r\n }", "title": "" }, { "docid": "bb261a34d5845f8afe5f1e98a1d8dfb0", "score": "0.683191", "text": "function clearResults() {\n selectedPoints = [];\n mapPanel.layers().remove(mapPanel.layers().get(2));\n var instructionsLabel = ui.Label('Select regions to view annual NDVI trend');\n resultsPanel.widgets().reset([instructionsLabel]);\n}", "title": "" }, { "docid": "706319cc9b50bc73703ee8d17404bf6d", "score": "0.68141603", "text": "function handleClearSearchPoiMarkers() {\n map.clearMarkers(map.POI);\n }", "title": "" }, { "docid": "0e5c4d97e67970201731269217412c20", "score": "0.6797206", "text": "function clearSearch()\t{\n\tgoWelcome();\n\tjQuery.ajax({\n\t\turl:resetNodesRwgURL\n\t});\n\t\n\topenAnalyses = []; //all analyses will be closed, so clear this array\n\t\n\t\n\tjQuery(\"#search-ac\").val(\"\");\n\t\n\tcurrentSearchTerms = new Array();\n\tcurrentCategories = new Array();\n\tcurrentSearchOperators = new Array();\n\t\n\t// Change the category picker back to ALL and set autocomplete to not have a category (ALL by default)\n\tdocument.getElementById(\"search-categories\").selectedIndex = 0;\n\tjQuery('#search-ac').autocomplete('option', 'source', sourceURL);\n\n\tshowSearchTemplate();\n\tshowSearchResults(); //reload the full search results\n\t\n}", "title": "" }, { "docid": "9130d09bddd6e17e2f3e881c4595506e", "score": "0.67667335", "text": "function removeAllGResult(){\n \tfor(i in RESULT.items){\n if(RESULT.items[i] != null){\n map.removeOverlay(RESULT.items[i].marker);\n }\n }\n RESULT.clear();\n }", "title": "" }, { "docid": "5156f9ef0fe284e877008b26a9c240d4", "score": "0.6692061", "text": "clear() {\r\n this.results = [];\r\n this.selectByIndex(0);\r\n }", "title": "" }, { "docid": "dbf623823b0bacf9ae45ed069a9f0784", "score": "0.6691259", "text": "function wxSearchClear() {\n var temData = __that.data.wxSearchData;\n // update the data\n temData.value = \"\";\n temData.tipKeys = [];\n //update the view\n __that.setData({\n wxSearchData: temData\n });\n}", "title": "" }, { "docid": "68afe25b9bc938e71d78d0a12aafa53c", "score": "0.66595364", "text": "function clearResults(){\n while(resultsDiv.firstChild)\n resultsDiv.removeChild(resultsDiv.firstChild);\n}", "title": "" }, { "docid": "0859dcbaff9c4696ee700d5fa5cf6a42", "score": "0.66547304", "text": "function clearResults() {\n localStorage.setItem(\"leaderboard\", null);\n viewLeaderboard();\n}", "title": "" }, { "docid": "1df8dc6b62dbcce07e29ced48cc1dfd1", "score": "0.66304785", "text": "function clearResults() {\n name.value = \"\";\n cost.value = \"\";\n resultsDiv.style.display = \"none\";\n}", "title": "" }, { "docid": "da649ce677603a23977c3e51ece75abe", "score": "0.6618368", "text": "function clearResults(markers){\n for (var m in markers){\n markers[m].setMap(null)\n }\n markers = [];\n}", "title": "" }, { "docid": "c8b5f4cf1a2127bd30b16c1948f918df", "score": "0.65969396", "text": "function closeResults() {\n\twhile (autocompleteItems.firstChild) {\n\t\tautocompleteItems.removeChild(autocompleteItems.firstChild);\n\t}\n}", "title": "" }, { "docid": "7b8c158268838998032c97a962c7552f", "score": "0.6595119", "text": "function clearResults(){\n while(qsa(\"article\").length > 1){\n qsa(\"article\")[1].remove();\n }\n qs(\"article\").innerText = \"\";\n qs(\"article\").classList = \".hidden\";\n }", "title": "" }, { "docid": "9383aab9d5e1381c08bc1dd99ff73878", "score": "0.6584946", "text": "function clearEventbriteResults(){\n eventbriteResults.innerHTML = \"\";\n }", "title": "" }, { "docid": "f4b9031fdbb7e4c8def29fe7e0b20123", "score": "0.6583708", "text": "function clearSearchPage(){\n resetSearchPage();\n}", "title": "" }, { "docid": "e7d763693cbbacbab9e25df8b31565ef", "score": "0.6583216", "text": "clearClick() {\n\t\tvar that = this;\n\t\t$('.filter button').click(function() {\n\t\t\t$(that.filterItem).removeClass('active');\n\t\t\tthat.results.parent().show();\n\t\t});\n\t}", "title": "" }, { "docid": "4292c56161fd6a48aa636201385d7fb7", "score": "0.6577199", "text": "function reset() {\n\tmarkers(initialMarkers);\n\tmarkerNames(initialMarkerNames);\n\tsetAllMarkers(map);\n\tmap.setCenter(startingPos);\n\tinfowindow.close();\n\ttypes(initialTypes);\n\tsearchResultsArray(initialSearchResultsArray);\n}", "title": "" }, { "docid": "b1835a2446684e7cd5cef00bd1c617ed", "score": "0.65650076", "text": "function handleClearSearchAddressMarkers() {\n map.clearMarkers(map.SEARCH);\n }", "title": "" }, { "docid": "403816874b5dceee346c12de98bb966f", "score": "0.65515816", "text": "function clearContent() {\n\t// clears splash elements and removes any results or details currently displayed; used to transition to new page\n\thideSplash();\n\t$('.results').html('');\n\t$('.detail-view').html('');\n\t$('.results').show();\n\t$('.detail-view').show();\n\tshowTopBarSearch();\n}", "title": "" }, { "docid": "81074d92dda269264820fc0c5587181f", "score": "0.65321434", "text": "function clearResults() {\n selectedPoints = [];\n Map.layers().remove(Map.layers().get(\n 2));\n var instructionsLabel = ui.Label(\n 'Annual tree loss in protected areas'\n );\n resultsPanel.widgets().reset([\n instructionsLabel\n ]);\n}", "title": "" }, { "docid": "9ebbdd8010284a0eb9e856d22b149df7", "score": "0.6521099", "text": "function clearLocations() {\n infoWindow.close();\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers.length = 0;\n\n locationSelect.innerHTML = \"\";\n var option = document.createElement(\"option\");\n option.value = \"none\";\n option.innerHTML = \"See all results:\";\n locationSelect.appendChild(option);\n locationSelect.style.visibility = \"visible\";\n}", "title": "" }, { "docid": "d2953469fc66b816cb4dae05934f9ea0", "score": "0.6515504", "text": "deselectAllResults () {\n this.removeCssClassesForState(MobileStates.DETAIL_SHOWN);\n\n document.querySelectorAll('.yxt-Card--pinFocused').forEach((el) => {\n el.classList.remove('yxt-Card--pinFocused');\n });\n\n removeElement(this._detailCard);\n\n this.core.storage.set(StorageKeys.LOCATOR_SELECTED_RESULT, null);\n }", "title": "" }, { "docid": "2159e5de3076b0cc1ccadf24cec6f837", "score": "0.6507663", "text": "function clearLocations() {\n info_Window = new google.maps.InfoWindow();\n info_Window.close();\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers.length = 0;\n }", "title": "" }, { "docid": "72184fa0d92104950fb44beb1fd93aec", "score": "0.6493002", "text": "function clearResults() {\n $('#resultsChain').empty();\n $('#resultsImgChain').empty();\n $('#spellList1').find(\"option:gt(0)\").remove();\n $('#spellList2').find(\"option:gt(0)\").remove();\n\n // $('#spellList1').empty();\n // $('#spellList2').empty();\n $('#spellList1').hide();\n $('#spellList2').hide();\n}", "title": "" }, { "docid": "e8d5ff0b7186a322a3689ad5dc176dba", "score": "0.64813143", "text": "function clearResultsTable() {\n $(\"#query-results-head\").html(\"\");\n $(\"#query-results-body\").html(\"\");\n}", "title": "" }, { "docid": "4d912b1afdbfef7ef1f1a3cedc563518", "score": "0.6477856", "text": "function clearResult() {\n resultDisplay.innerHTML = \"\";\n}", "title": "" }, { "docid": "d4ff1466c8f949f4aad2abf01aa04c5c", "score": "0.6470051", "text": "function clearResults () {\n $('.searchBox').append(\"<img id='clearIcon' src='assets/icon.png'>\")\n $('#clearIcon').click(function () {\n $('#searchResult').empty()\n $('#search').val('')\n $('#clearIcon').remove()\n })\n}", "title": "" }, { "docid": "158ec983886b1b23410b1e01ffd0a212", "score": "0.646458", "text": "function clearThePage(){\n results = [null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n console.log(results)\n resultDiv.innerHTML = '';\n graphDiv.innerHTML = '';\n}", "title": "" }, { "docid": "625c08bea32c44553370d6e25c54fb58", "score": "0.6448291", "text": "function clearResults() \r\n{\r\n const results = document.getElementById(\"results\");\r\n\r\n while (results.childNodes[0]) {\r\n results.removeChild(results.childNodes[0]);\r\n }\r\n}", "title": "" }, { "docid": "125c9086c57f2c6a7a2bce6fe507182c", "score": "0.6447751", "text": "function search(){let rl=document.getElementById('search-results');if(rl != null){search_result.removeChild(rl);showResultsList();}else{showResultsList();}}", "title": "" }, { "docid": "ad75bece809e22123a7f6a36625a2437", "score": "0.63884056", "text": "function clearResult() {\n $(\"#result\").html(\"\");\n }", "title": "" }, { "docid": "1d9f669a2f66937b305f954ffa4c99e6", "score": "0.6383265", "text": "function clearResultsandErrors () {\n \t\tresultsbox.text(EMPTY);\n \t\talertbox.addClass('hide').text(EMPTY);\n \t}", "title": "" }, { "docid": "57bef2feecb160d9078588abc72dbe74", "score": "0.6373151", "text": "function clearLocations(){\n infoWindow.close();\n // loop through markers and set each to null \n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers.length = 0; // set list length to 0\n}", "title": "" }, { "docid": "f083f0dbc1ae3b3755c35a7d807d85d9", "score": "0.6352444", "text": "function clearSearch() {\r\n resultTable.innerHTML = '';\r\n resultHeading.className = 'hidden';\r\n}", "title": "" }, { "docid": "26c0a0dd82324cebcb1b4395e779cef3", "score": "0.6342466", "text": "function resetPlaceSearch() {\n $('#place_info').empty();\n\n $('#place_info').append(placeInfoText);\n\n $('#place_search').val('');\n}", "title": "" }, { "docid": "33327f271be9a987e07f0d71d794e593", "score": "0.63325393", "text": "function resetSearch() {\n\tpageToken = '';\n\t$(\"#tiles_holder\").html('');\n\tgetPlayListForUser();\n}", "title": "" }, { "docid": "a34ffc100aaff9219e6befcb12cabb28", "score": "0.6328099", "text": "function clearTableau() {\n\tdocument.getElementById('results-container').innerHTML = \"\";\n\tdocument.getElementById('results-container').className = \"\";\n}", "title": "" }, { "docid": "b35b5c75d58d2656baa33d4fa1f57fa0", "score": "0.6327032", "text": "function tocSearchClear() {\n var t;\n //oList.itemsSearch = 0;\n _id('toc_search_text').value = '';\n _id('toc_search_icon').classList.remove('s_clr');\n setWait(CB_LIST);\n setTimeout( function() {\n if (t = _id('toc_search_items') ) oToc.nav.removeChild(t);\n oToc.items.style.display = '';\n oToc.clickedA = null;\n oToc.clickedLI = null;\n if (aDOMCur) toc_ShowClicked(aDOMCur);\n setWait();\n }, 10);\n}", "title": "" }, { "docid": "48222dcc2928346e0ccc82a3c98c7acc", "score": "0.6321334", "text": "function clearPageQuery() {\n\t$(\"#currentPage\").val(\"\");\n\tqueryDistributeInfo();\n}", "title": "" }, { "docid": "7f26f23b7da29d94c473dbe66898f68b", "score": "0.6313172", "text": "reset() {\n this._results = [];\n this._resultsCache = {};\n this._isSearching = false;\n this.updateQuery(\"\");\n }", "title": "" }, { "docid": "4fe9b4d299adb92e9441c4c50bb464b5", "score": "0.6278846", "text": "function removeResult(){\n resultsSection.innerHTML = \"\";\n}", "title": "" }, { "docid": "79f01e97baf48fcf5996f75326c48199", "score": "0.6270136", "text": "function clearAll() {\n\t\tmap.clearOverLays();\n\t\tdocument.getElementById(\"searchDiv\").innerHTML = \"\";\n\t\tdocument.getElementById(\"resultDiv\").style.display = \"none\";\n\t\tdocument.getElementById(\"statisticsDiv\").innerHTML = \"\";\n\t\tdocument.getElementById(\"statisticsDiv\").style.display = \"none\";\n\t\tdocument.getElementById(\"promptDiv\").innerHTML = \"\";\n\t\tdocument.getElementById(\"promptDiv\").style.display = \"none\";\n\t\tdocument.getElementById(\"suggestsDiv\").innerHTML = \"\";\n\t\tdocument.getElementById(\"suggestsDiv\").style.display = \"none\";\n\t\tdocument.getElementById(\"lineDataDiv\").innerHTML = \"\";\n\t\tdocument.getElementById(\"lineDataDiv\").style.display = \"none\";\n\t}", "title": "" }, { "docid": "e60a1b5967102807d4384b241e803143", "score": "0.62625813", "text": "function allSearchesFinished(result) {\n finishSearchInProgressPopup();\n displaySearchResultsSummary(result);\n scrollDownToBottomOfPage();\n }", "title": "" }, { "docid": "c3db3e311edebaab5ab2917438d5b737", "score": "0.62466264", "text": "function clearResult() {\n result = '';\n resultDisplay.innerHTML = '';\n}", "title": "" }, { "docid": "0fcd6283777579bff8f3a3dbd17f546d", "score": "0.6237837", "text": "function clear() {\t\t\n\t\t\tresetData();\n refreshTotalCount();\n\t\t\tsetFocus();\n\t\t}", "title": "" }, { "docid": "bc91d724aad302b44e0f72bbffce2e88", "score": "0.62258804", "text": "function resetSearch() {\n $(\"#reset_button\").click(function() {\n $(\"#gsearch\").trigger(\"reset\");\n $(\"#query-info\").hide();\n });\n}", "title": "" }, { "docid": "1f10771693a9b97cc0ad77651a22c61a", "score": "0.62070376", "text": "function resetResultsDisplay () {\n document.querySelector('.flex-container').innerHTML = '';\n document.querySelector('.label-result').innerHTML = '';\n document.querySelector('.label-result').classList.remove('visible');\n }", "title": "" }, { "docid": "9ae711d923e7e4cee42ce068097b10d0", "score": "0.6199972", "text": "function clearSearch() {\n document.getElementById(\"search\").reset();\n document.getElementById(\"results\").innerHTML = currentTableStart;\n}", "title": "" }, { "docid": "53c69e2cc2b2e8dff45d811d13379f38", "score": "0.6198843", "text": "function clearSearchInWordsList() {\n // Clean search\n document.getElementById('searchedPanel').className = 'hidden';\n document.getElementById('searchedPanel').innerHTML = '';\n\tdocument.getElementById('wordsList').className = '';\n document.getElementById('scrollWordsList').className = '';\n\tdocument.getElementById('beginSearch').value = '';\n document.getElementById('containSearch').value = '';\n document.getElementById('endSearch').value = '';\n\tshowOrHideSearchBars();\n}", "title": "" }, { "docid": "bf11a50ed458e153a42879a5f0df4f30", "score": "0.6193727", "text": "function resetSearchItems(){\r\n\tremoveSearchStatement();\r\n\tremoveFullDetailsBody();\r\n\tgetInfo();\r\n\tdocument.getElementById('keywordSearchBox').value = '';\r\n\tevent.preventDefault();\r\n}", "title": "" }, { "docid": "e48f3a35de936a90932244f7af493673", "score": "0.6193605", "text": "function clearInfoWins() {\n\n vm.locations().forEach(function(location) {\n location.infoWindow.close();\n });\n\n}", "title": "" }, { "docid": "b324be2f129b4d56fe212fe5a13746f7", "score": "0.61845094", "text": "function resetAll ()\n { \n grpOffset = 0;\n processing = 0;\n grpnLocStr = \"\";\n gresponse = {};\n $(\"#resultsDiv\").empty();\n }", "title": "" }, { "docid": "8a43e8d02daa756cd969d6fea0bf0cb1", "score": "0.6184117", "text": "function clean() {\n // Clear infowindows\n if(currentInfowindow) {\n currentInfowindow.setMap(null);\n }\n\n // Get rid of highlight on markers\n for (var i = 0; i < markers.length; i++) {\n if (markers[i].getIcon() !== defaultIcon) {\n markers[i].setIcon(defaultIcon);\n }\n }\n}", "title": "" }, { "docid": "f8690154d267237cf2110d2a20798f5f", "score": "0.61784834", "text": "function removeResults() {\n\t/* Check if there are any items already listed from a previous search. */\n\t/* If so, clear gistArray and remove all items displayed under search results. */\n\twhile (gistArray.length > 0) {\n\t\tgistArray.pop();\n\t}\n\tvar searchItemsDisplayed = document.getElementById(\"results\").getElementsByTagName(\"p\");\n\twhile (searchItemsDisplayed.length > 0) {\n\t\tsearchItemsDisplayed[0].remove();\n\t}\n}", "title": "" }, { "docid": "5e0154cb5593f72e832e68ac18686570", "score": "0.6175402", "text": "function clearSearch() {\n if(SEARCH_LAYER != null)\n SEARCH_LAYER.removeAllFeatures();\n}", "title": "" }, { "docid": "a3433a01f5cb861067611e0f2d108a1f", "score": "0.616443", "text": "clearAutocompleteMatches_() {\n this.result_ = null;\n this.$.matches.unselect();\n this.pageHandler_.stopAutocomplete(/*clearResult=*/ true);\n // Autocomplete sends updates once it is stopped. Invalidate those results\n // by setting the |this.lastQueriedInput_| to its default value.\n this.lastQueriedInput_ = null;\n }", "title": "" }, { "docid": "781662d7e640ebe45fdc1759c14c36ab", "score": "0.61558455", "text": "function hideSearchResults() {\n var div = document.getElementById(\"searchResults\");\n div.style.display = \"none\";\n clearSearchResultsList();\n}", "title": "" }, { "docid": "2048a7ce38b34d1c0e61cc74c20a7784", "score": "0.6152642", "text": "function cleanSearchInformation(){\r\r\n dojo.byId(\"searchPoi\").value = \"\";\r\r\n dojo.fadeOut({\r\r\n node: \"message\",\r\r\n duration: 1000\r\r\n }).play();\r\r\n}", "title": "" }, { "docid": "1dd25ef839ac8d6dcad6235826f5e62c", "score": "0.61402804", "text": "clearAll() {\n\t\tthis.clearResults()\n\t\tthis.clearSelected()\n\t\tthis.clearInput()\n\t}", "title": "" }, { "docid": "66ff0f933230d8eb466a506fcaa550bf", "score": "0.6125628", "text": "function clearMapSelection(){\n if (current_infoWindow != null){\n current_infoWindow.close();\n }\n if (current_marker!=null) {\n current_marker.setMap(null);\n }\n if (home_infoWindow!=null) {\n home_infoWindow.close();\n }\n if (polyline!=null) {\n polyline.setMap(null);\n }\n directionsDisplay.setMap(null);\n}", "title": "" }, { "docid": "9be1d8454a50d1230b5b27ef185f043f", "score": "0.6122064", "text": "function clearRecords()\n {\n window.status = \"clearing the records, it may take a minute, please wait.....\"\n document.searchResultsForm.Message.style.visibility=\"visible\";\n document.searchResultsForm.actSelected.value = \"clearRecords\";\n document.searchResultsForm.submit();\n }", "title": "" }, { "docid": "0e633bea867f0424370a73b3469d0faf", "score": "0.60998684", "text": "function searchResults()\n\t {\n\t infoWindow.close();\n\n\t // Returns query selected by user so it can be used by the 'place_changed' event\n\t place = autocomplete.getPlace();\n\n\t if (place.geometry.viewport) \n\t {\n\t map.fitBounds(place.geometry.viewport);\n\t }\n\n\t else \n\t {\n\t map.setCenter(place.geometry.location);\n\t map.setZoom(17);\n\t google.maps.event.addListener(marker, 'click', placeMarker(event));\n\t }\n\t }", "title": "" }, { "docid": "bb7493ab9f9c311e16f58d6f5e213ebd", "score": "0.60956305", "text": "removeAll(){\n\t\t\tthis.results = [];\n\t\t\tthis.sideNavService.removeAll(this.displayType);\n\t\t}", "title": "" }, { "docid": "aea666b1d8b67d95be7578b6b6537420", "score": "0.6092106", "text": "resetFiltersAndHTML() {\n document.getElementById(\"resultSection\").innerHTML = \"\";\n searchFilter.pop(searchFilter[0]);\n launchFactory();\n }", "title": "" }, { "docid": "0a72cab1428ce5e140493e9650e4986e", "score": "0.60887897", "text": "function clearSuggestions() {\n $('suggestions-box-container').innerHTML = '';\n restrictedIds = [];\n selectedIndex = -1;\n}", "title": "" }, { "docid": "4f15f77ae86b04993d0507436a5c22c4", "score": "0.6084429", "text": "dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n // If a query hasn't been executed yet, no need to call endSearch\n if (this._displayState.query) {\n void this._activeProvider.endSearch();\n }\n this._searchWidget.dispose();\n this._disposed.emit(undefined);\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_2__[\"Signal\"].clearData(this);\n }", "title": "" }, { "docid": "41994730aa9f589d5826474ff5434bfa", "score": "0.60833716", "text": "function clearMessage() {\n if(resultsOutput) {\n resultsOutput.addClass('hidden');\n };\n}", "title": "" }, { "docid": "fd3859d29307cad9bcd54709db340560", "score": "0.6079659", "text": "function spoolSearch_onload() {\n\tsearchForm.reset();\t\n}", "title": "" }, { "docid": "a9794b3043ead84aa1f09afa220d8354", "score": "0.6076535", "text": "function clearSearch(){\n while(search_result.firstChild){\n search_result.removeChild(search_result.firstChild);\n }\n \n }", "title": "" }, { "docid": "abb949b25f0e5d9d75de765f92fb9a6c", "score": "0.60735124", "text": "function clearValue () {\n\t clearSelectedItem();\n\t clearSearchText();\n\t }", "title": "" }, { "docid": "d2be57509fb4d7fc369fd3c00993512b", "score": "0.6071852", "text": "function renderSearch() {\n $(\"#historyList\").empty();\n displaySearch();\n}", "title": "" }, { "docid": "3f35f0b077ede9c2c1e240f27b1b60fe", "score": "0.6043368", "text": "async flushSearchResults() {\n\t\tif (MyOptions.getSaveHistResults()) { let saveResults = [...this.searchResults]; this.searchResults = []; await MYDB.addToDB('searching', 'results', saveResults); }\n\t}", "title": "" }, { "docid": "4bdc05f638a1ddd05ddda4bb2760dd7a", "score": "0.60410565", "text": "function clearItemSearchInput() {\n getProjectItems();\n $(\"#item-search-input\").val(''); \n}", "title": "" }, { "docid": "46cfdd9e9f8d52f189952dc2b6b274b5", "score": "0.6031342", "text": "function clearValue () {\n clearSelectedItem();\n clearSearchText();\n }", "title": "" }, { "docid": "46cfdd9e9f8d52f189952dc2b6b274b5", "score": "0.6031342", "text": "function clearValue () {\n clearSelectedItem();\n clearSearchText();\n }", "title": "" }, { "docid": "2b659b55cb77e1af52750f15b20a5d6f", "score": "0.6030374", "text": "function searchRefresh() {\n\t$('.local-search').val('');\n\t$('.local-search').keyup();\n}", "title": "" } ]
1d313cbc1dd485da63ceec35ef411f94
Returns a function, that, as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds. If `immediate` is passed, trigger the function on the leading edge, instead of the trailing.
[ { "docid": "a7657ec74a75f1c6bf7277dae548f54b", "score": "0.5872664", "text": "function debounce(func, wait, immediate) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar context = this, args = arguments;\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(function() {\n\t\t\t\ttimeout = null;\n\t\t\t\tif (!immediate) func.apply(context, args);\n\t\t\t}, wait);\n\t\t\tif (immediate && !timeout) func.apply(context, args);\n\t\t};\n\t}", "title": "" } ]
[ { "docid": "bf4794a70c0abce96f360df1be88710b", "score": "0.6051653", "text": "function debounce(func, wait, immediate) {\n let timeout;\n setInterval(() => timeout = null, wait);\n return function () {\n let context = this, args = arguments;\n let later = function () {\n if (!immediate) func.apply(context, args);\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "c1ce5b4a5527a495cbf2abb6c5332aa9", "score": "0.59846777", "text": "debounce(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this, args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "966207f1885e7fa6803801be8d75d133", "score": "0.5972345", "text": "function debounce(func, wait, immediate) {\n var timeout;\n \n return function executedFunction() {\n var context = this;\n var args = arguments;\n \n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n \n var callNow = immediate && !timeout;\n \n clearTimeout(timeout);\n \n timeout = setTimeout(later, wait);\n \n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "77485b15e37f0df49659a01b52603dd6", "score": "0.59616035", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\n return function executedFunction() {\n var context = this;\n var args = arguments;\n\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, wait);\n\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "291194ea8ec4ac24f69045c03bb2ff90", "score": "0.59615606", "text": "function debounce(fn, wait, immediate) {\n var timeout;\n\n wait || (wait = 100);\n\n return function () {\n var context = this, args = arguments;\n\n var later = function() {\n timeout = null;\n\n if ( !immediate ) {\n fn.apply(context, args);\n }\n };\n\n var callNow = immediate && !timeout;\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, wait);\n\n if ( callNow ) {\n fn.apply(context, args);\n }\n };\n}", "title": "" }, { "docid": "c545043eea7858abc47a1ce3e04f6297", "score": "0.59399086", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\n return function executedFunction() {\n var context = this;\n var args = arguments;\n\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, wait);\n\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "870966ae617a1c79ac66656c8fbc6390", "score": "0.5938124", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\n\treturn function executedFunction() {\n\t\tvar context = this;\n\t\tvar args = arguments;\n\n\t\tvar later = function () {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\n\t\tvar callNow = immediate && !timeout;\n\n\t\tclearTimeout(timeout);\n\n\t\ttimeout = setTimeout(later, wait);\n\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "d3d2f143c7d437c5788649e0b4ce4181", "score": "0.5928712", "text": "function debounce(func, wait, immediate) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar context = this,\n\t\t\t\targs = arguments;\n\t\t\tvar later = function() {\n\t\t\t\ttimeout = null;\n\t\t\t\tif (!immediate) func.apply(context, args);\n\t\t\t};\n\t\t\tvar callNow = immediate && !timeout;\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(later, wait);\n\t\t\tif (callNow) func.apply(context, args);\n\t\t};\n\t}", "title": "" }, { "docid": "33f121ddbf5a670c4e09a6c65d805c14", "score": "0.5923706", "text": "static debounce(func, wait, immediate) {\n let timeout;\n return function () {\n let context = this, args = arguments;\n let later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "751bf27a92b4181a082389445fb71809", "score": "0.592279", "text": "function debounce( func, wait, immediate ) {\n let timer = null;\n return ( ...args ) => {\n args = arguments;\n let context = this;\n let later = () => {\n if( !immediate ) { func.apply( context, args ) }\n }\n\n clearTimeout( timer )\n timer = setTimeout( later, wait );\n\n const callNow = immediate && !timer;\n if( callNow ) { func.apply( context, args ) }\n }\n}", "title": "" }, { "docid": "3dc34420961d087fd6b7edec47bf0d43", "score": "0.59191453", "text": "function debounce( func, wait, immediate ) {\n let timeout = undefined;\n return ( ...args ) => {\n args = arguments;\n let context = this;\n let later = () => {\n if( !immediate ) { func.apply( context, args ) }\n }\n\n clearTimeout( timeout );\n timeout = setTimeout( later, wait );\n\n const callNow = immediate && !timeout;\n if( callNow ) { func.apply( context, args ) }\n }\n}", "title": "" }, { "docid": "393b5204167c1ad0882b5cc823bd7119", "score": "0.5914797", "text": "debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "3a833a20499b35a58356a99df9aa2d77", "score": "0.59102", "text": "function debounce( func, wait, immediate ) {\r\n\tvar timeout;\r\n\treturn function() {\r\n\t\tvar context = this, args = arguments;\r\n\t\tvar later = function() {\r\n\t\t\ttimeout = null;\r\n\t\t\tif ( !immediate ) {\r\n\t\t\t\tfunc.apply( context, args );\r\n\t\t\t}\r\n\t\t};\r\n\t\tvar callNow = immediate && !timeout;\r\n\t\tclearTimeout( timeout );\r\n\t\ttimeout = setTimeout( later, wait );\r\n\t\tif ( callNow ) {\r\n\t\t\tfunc.apply( context, args );\r\n\t\t}\r\n\t};\r\n}", "title": "" }, { "docid": "1d49330440a1f0503f320d0090e8cfdb", "score": "0.5892727", "text": "function debounce(func, wait, immediate) {\r\n\tvar timeout;\r\n\treturn function() {\r\n\t\tvar context = this, args = arguments;\r\n\t\tvar later = function() {\r\n\t\t\ttimeout = null;\r\n\t\t\tif (!immediate) func.apply(context, args);\r\n\t\t};\r\n\t\tvar callNow = immediate && !timeout;\r\n\t\tclearTimeout(timeout);\r\n\t\ttimeout = setTimeout(later, wait);\r\n\t\tif (callNow) func.apply(context, args);\r\n\t};\r\n}", "title": "" }, { "docid": "e143f1fa26fe90ae7ea698d3959a5526", "score": "0.5887533", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "4d406bfad9f69e98319b4feb1039169f", "score": "0.5883822", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "4d406bfad9f69e98319b4feb1039169f", "score": "0.5883822", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "c928d445dc55aba557bbd29e217c614e", "score": "0.5883409", "text": "function debounce(wait, func, immediate) {\n\tvar timeout;\n\treturn function () {\n\t\tvar context = this,\n\t\t args = arguments;\n\t\tvar later = function later() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "222afed5731f4a3fea56e7f9e4cb37cf", "score": "0.58779985", "text": "function debounce(func, wait, immediate) {\r\n var timeout;\r\n return function() {\r\n var context = this, args = arguments;\r\n var later = function() {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n }", "title": "" }, { "docid": "a7c5d6d387bfc5e8dacf18ac1586b1ef", "score": "0.58762586", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "a7c5d6d387bfc5e8dacf18ac1586b1ef", "score": "0.58762586", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "a7c5d6d387bfc5e8dacf18ac1586b1ef", "score": "0.58762586", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "a7c5d6d387bfc5e8dacf18ac1586b1ef", "score": "0.58762586", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "0cbc52e2c0712130786fe329610d6ef0", "score": "0.5875753", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "0cbc52e2c0712130786fe329610d6ef0", "score": "0.5875753", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "0cbc52e2c0712130786fe329610d6ef0", "score": "0.5875753", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "09aead0254fca8f80276b529f1f3f698", "score": "0.58732545", "text": "function debounce(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this, args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "9661fe96a9eb2917b97d3a5e4209073a", "score": "0.5870357", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "62264931a6ccda2b95db3ca7bf04e89f", "score": "0.58631915", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "f5d2b4044226f704c92a4d2c1b194e89", "score": "0.58630675", "text": "function debounce(func, wait, immediate) {\r\n var timeout;\r\n return function() {\r\n var context = this;\r\n var args = arguments;\r\n var later = function() {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n}", "title": "" }, { "docid": "b66d0b67edcfd31459c2366334b89cf3", "score": "0.5862536", "text": "function __debounce(func, wait, immediate) {\r\n var args,\r\n result,\r\n thisArg,\r\n timeoutId;\r\n\r\n function delayed() {\r\n timeoutId = null;\r\n if (!immediate) {\r\n result = func.apply(thisArg, args);\r\n }\r\n }\r\n\r\n return function () {\r\n var isImmediate = immediate && !timeoutId;\r\n args = arguments;\r\n thisArg = this;\r\n\r\n clearTimeout(timeoutId);\r\n timeoutId = setTimeout(delayed, wait);\r\n\r\n if (isImmediate) {\r\n result = func.apply(thisArg, args);\r\n }\r\n return result;\r\n };\r\n }", "title": "" }, { "docid": "beade16b97bffd14e994425023fa7adf", "score": "0.5859924", "text": "function debounce (func, wait, immediate) {\n var timeout\n return function () {\n var context = this\n var args = arguments\n var later = function () {\n timeout = null\n if (!immediate) {\n func.apply(context, args)\n }\n }\n var callNow = immediate && !timeout\n window.clearTimeout(timeout)\n timeout = window.setTimeout(later, wait)\n if (callNow) {\n func.apply(context, args)\n }\n }\n}", "title": "" }, { "docid": "9eae69bd57b0f43a7885f0fc482499b9", "score": "0.58566856", "text": "function debounce(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this;\n let args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n }", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "a768170fcfd15cbd989cd90740c6c328", "score": "0.58550704", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "da1d44e3d347335d2156a6886975e50b", "score": "0.58539844", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\n // This is the function that is actually executed when\n // the DOM event is triggered.\n return function executedFunction() {\n // Store the context of this and any\n // parameters passed to executedFunction\n var context = this;\n var args = arguments;\n\n // The function to be called after\n // the debounce time has elapsed\n var later = function() {\n // null timeout to indicate the debounce ended\n timeout = null;\n\n // Call function now if you did not on the leading end\n if (!immediate) func.apply(context, args);\n };\n\n // Determine if you should call the function\n // on the leading or trail end\n var callNow = immediate && !timeout;\n\n // This will reset the waiting every function execution.\n // This is the step that prevents the function from\n // being executed because it will never reach the\n // inside of the previous setTimeout\n clearTimeout(timeout);\n\n // Restart the debounce waiting period.\n // setTimeout returns a truthy value (it differs in web vs node)\n timeout = setTimeout(later, wait);\n\n // Call immediately if you're dong a leading\n // end execution\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "4ba42d668573e5a0166782ae672872f5", "score": "0.58450997", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }", "title": "" }, { "docid": "2d47dc2d180baffb23cc87bcd56ff4ae", "score": "0.58437145", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this,\n\t\t\targs = arguments;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t}, wait);\n\t\tif (immediate && !timeout) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "e0acf428a46ee9aefa80f71c5d8ddabd", "score": "0.58427954", "text": "function debounce(func, wait, immediate) {\n let timeout\n return function () {\n const context = this,\n args = arguments\n const later = function () {\n timeout = null\n if (!immediate)\n func.apply(context, args)\n };\n const callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait)\n if (callNow)\n func.apply(context, args)\n };\n }", "title": "" }, { "docid": "b7a784deb73b4db85b25ebceb603ab1d", "score": "0.5840268", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "95f2a1550b57559739f9f3b5c7e82739", "score": "0.5836915", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "95f2a1550b57559739f9f3b5c7e82739", "score": "0.5836915", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "fb86e39784b67160ed721ee3a3f0f435", "score": "0.583391", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "1cee58313904883d379b461ccdf9c8c0", "score": "0.5832682", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "8a8fef3d9e45f8b28176c8322bc88d0a", "score": "0.58309627", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\n return function () {\n var context = this,\n args = arguments,\n callNow = immediate && !timeout,\n later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "8612a5faa0a86b15aa081657e202123e", "score": "0.5830659", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "d2b2dde6c7f5c48c29da56faed6bbc5b", "score": "0.58300614", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "d2b2dde6c7f5c48c29da56faed6bbc5b", "score": "0.58300614", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "62191f9f193df699500cc78b734f3829", "score": "0.58291477", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n }, wait);\n if (immediate && !timeout) {\n func.apply(context, args);\n }\n };\n }", "title": "" }, { "docid": "4462f31abcac9064c350be5a4dc1cd5b", "score": "0.5829095", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "e1f5bb2cfec3e4212c58bfd9e3d6566f", "score": "0.5828533", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "e1f5bb2cfec3e4212c58bfd9e3d6566f", "score": "0.5828533", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "b72cb5fe6f2145dab6e4b443e48623b0", "score": "0.5822617", "text": "function debounce(func, wait, immediate) {\n var timeout\n return function() {\n var context = this, args = arguments\n var later = function() {\n timeout = null\n if (!immediate) func.apply(context, args)\n }\n var callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait)\n if (callNow) func.apply(context, args)\n }\n}", "title": "" }, { "docid": "9f39e7adf959117a0427ac2cf732cd47", "score": "0.58225524", "text": "function debounce(func, wait=700, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "46cb23cbcae06b11e43e2e2b2a40ecf8", "score": "0.5821405", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "84b521e972e59682a2eebed3965edcd8", "score": "0.5820514", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t}, wait);\n\t\tif (immediate && !timeout) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "84b521e972e59682a2eebed3965edcd8", "score": "0.5820514", "text": "function debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t}, wait);\n\t\tif (immediate && !timeout) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "8f451aabe78a58e3bfc782b1667e7869", "score": "0.5819871", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "09948022d97a8cc6c72778608cb33c2d", "score": "0.5817586", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "e06ae940c1d133e40c1a407dbb9dfbcf", "score": "0.5815825", "text": "function $debounce(fn, wait, immediate) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar context = this,\n\t\t\t\targs = $slice(arguments),\n\t\t\t\tlater = function() {\n\t\t\t\t\ttimeout = null;\n\t\t\t\t\tif (!immediate) {\n\t\t\t\t\t\tfn.apply(context, args);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\tif (immediate && !timeout) {\n\t\t\t\tfn.apply(context, args);\n\t\t\t}\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(later, wait);\n\t\t};\n\t}", "title": "" }, { "docid": "8ff63f5108e7bcf1c3c9de4c4de5649a", "score": "0.58154523", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "8ff63f5108e7bcf1c3c9de4c4de5649a", "score": "0.58154523", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "8ff63f5108e7bcf1c3c9de4c4de5649a", "score": "0.58154523", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n clearTimeout(timeout);\n timeout = setTimeout(function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (immediate && !timeout) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "711167d496e5c022a66488f7b759422c", "score": "0.58139795", "text": "function debounce(func, wait, immediate)\r\n{\r\n var timeout;\r\n return function()\r\n {\r\n var context = this, args = arguments;\r\n var later = function()\r\n {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow)\r\n {\r\n func.apply(context, args);\r\n };\r\n };\r\n}", "title": "" }, { "docid": "44abff5177791b1efb766d3bf66a4009", "score": "0.5812952", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "44abff5177791b1efb766d3bf66a4009", "score": "0.5812952", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "57a8ac79a7127b3894958e5bbd80c047", "score": "0.5812109", "text": "function debounce(func, wait = 10, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "57a8ac79a7127b3894958e5bbd80c047", "score": "0.5812109", "text": "function debounce(func, wait = 10, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "5934baed655a8915c64195924b7c66fb", "score": "0.5803447", "text": "function debounce(func, wait = 20, immediate = true) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" }, { "docid": "75ae241673be21ee6afdf131369fe676", "score": "0.5802306", "text": "function debounce(func, wait = 10, immediate = true) {\n let timeout;\n return function() {\n let context = this, args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "5349666d1712e47477d7d61ea4fbfaa2", "score": "0.58017266", "text": "function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n var args;\n var context;\n var timestamp;\n var result;\n var later = function () {\n var last = +new Date() - timestamp;\n if (last < wait) {\n timeout = setTimeout(later, wait - last);\n }\n else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = +new Date();\n var callNow = immediate && !timeout;\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n return result;\n };\n}", "title": "" }, { "docid": "5349666d1712e47477d7d61ea4fbfaa2", "score": "0.58017266", "text": "function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n var args;\n var context;\n var timestamp;\n var result;\n var later = function () {\n var last = +new Date() - timestamp;\n if (last < wait) {\n timeout = setTimeout(later, wait - last);\n }\n else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = +new Date();\n var callNow = immediate && !timeout;\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n return result;\n };\n}", "title": "" }, { "docid": "5349666d1712e47477d7d61ea4fbfaa2", "score": "0.58017266", "text": "function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n var args;\n var context;\n var timestamp;\n var result;\n var later = function () {\n var last = +new Date() - timestamp;\n if (last < wait) {\n timeout = setTimeout(later, wait - last);\n }\n else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = +new Date();\n var callNow = immediate && !timeout;\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n return result;\n };\n}", "title": "" }, { "docid": "5349666d1712e47477d7d61ea4fbfaa2", "score": "0.58017266", "text": "function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n var args;\n var context;\n var timestamp;\n var result;\n var later = function () {\n var last = +new Date() - timestamp;\n if (last < wait) {\n timeout = setTimeout(later, wait - last);\n }\n else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = +new Date();\n var callNow = immediate && !timeout;\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n return result;\n };\n}", "title": "" }, { "docid": "06c0c48250e84608e3e932d612d76bfe", "score": "0.5801135", "text": "function debounce(func, wait = 20, immediate = true) {\r\n var timeout;\r\n return function() {\r\n var context = this, args = arguments;\r\n var later = function() {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n }", "title": "" }, { "docid": "d57c6118ef2d83f9091aa25610ab8960", "score": "0.5798006", "text": "function debounce(func, wait, immediate){\n let timeout;\n return function(){\n let context = this;\n let args = arguments;\n let later = function(){\n timeout = null;\n if (!immediate){\n func.apply(context, args);\n }\n }\n\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n\n timeOut = setTimeout(later, wait);\n if (callNow){\n func.apply(context, args);\n }\n }\n}", "title": "" }, { "docid": "84551de1effe71d303ecc6832530ed48", "score": "0.5797863", "text": "function debounce(func, wait, immediate) {\n var timeout\n return function() {\n var context = this,\n args = arguments\n var later = function() {\n timeout = null\n if (!immediate) func.apply(context, args)\n }\n var callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait)\n if (callNow) func.apply(context, args)\n }\n}", "title": "" }, { "docid": "a94e92956f23a3e0a2bb39c13de2e61d", "score": "0.5794159", "text": "function debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate)\n func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow)\n func.apply(context, args);\n };\n}", "title": "" }, { "docid": "14c37a6ef1ca56b1d85496d4fda55fb4", "score": "0.5793083", "text": "function debounce(func, wait = 20, immediate = true) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "ce73684687e1126c67443dca5fa1668f", "score": "0.5791049", "text": "function debounce(func, wait = 20, immediate = true) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar context = this, args = arguments;\n\t\t\tvar later = function() {\n\t\t\t timeout = null;\n\t\t\t if ( !immediate ) func.apply(context, args);\n\t\t\t};\n\t\t\tvar callNow = immediate && !timeout;\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(later, wait);\n\t\t\tif ( callNow ) func.apply(context, args);\n\t\t};\n\t}", "title": "" }, { "docid": "efbb9973bcb67942ea84e273f2fa43e1", "score": "0.5786297", "text": "function debounce(func, wait, immediate) {\r\n if (immediate === void 0) { immediate = false; }\r\n var timeout;\r\n var args;\r\n var context;\r\n var timestamp;\r\n var result;\r\n var later = function () {\r\n var last = +new Date() - timestamp;\r\n if (last < wait) {\r\n timeout = setTimeout(later, wait - last);\r\n }\r\n else {\r\n timeout = null;\r\n if (!immediate) {\r\n result = func.apply(context, args);\r\n context = args = null;\r\n }\r\n }\r\n };\r\n return function () {\r\n context = this;\r\n args = arguments;\r\n timestamp = +new Date();\r\n var callNow = immediate && !timeout;\r\n if (!timeout) {\r\n timeout = setTimeout(later, wait);\r\n }\r\n if (callNow) {\r\n result = func.apply(context, args);\r\n context = args = null;\r\n }\r\n return result;\r\n };\r\n}", "title": "" }, { "docid": "5c35f5a461ee31e0874702be81f4dc8a", "score": "0.57831514", "text": "function debounce(func, wait, immediate) {\n let timeout;\n return function () {\n const context = this,\n args = arguments;\n const later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "5c35f5a461ee31e0874702be81f4dc8a", "score": "0.57831514", "text": "function debounce(func, wait, immediate) {\n let timeout;\n return function () {\n const context = this,\n args = arguments;\n const later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "b969ae1aef9e208ecade69480f11a0bc", "score": "0.5780422", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\n // This is the function that is actually executed when\n // the DOM event is triggered.\n return function executedFunction() {\n // Store the context of this and any\n // parameters passed to executedFunction\n var context = this;\n var args = arguments;\n\n // The function to be called after\n // the debounce time has elapsed\n var later = function() {\n // null timeout to indicate the debounce ended\n timeout = null;\n\n // Call function now if you did not on the leading end\n if (!immediate) func.apply(context, args);\n };\n\n // Determine if you should call the function\n // on the leading or trail end\n var callNow = immediate && !timeout;\n\n // This will reset the waiting every function execution.\n // This is the step that prevents the function from\n // being executed because it will never reach the\n // inside of the previous setTimeout\n clearTimeout(timeout);\n\n // Restart the debounce waiting period.\n // setTimeout returns a truthy value (it differs in web vs node)\n timeout = setTimeout(later, wait);\n\n // Call immediately if you're dong a leading\n // end execution\n if (callNow) func.apply(context, args);\n };\n}", "title": "" }, { "docid": "82483074cb37054e054c26d7a335bba4", "score": "0.57770973", "text": "debounce(func, wait, immediate) {\r\n \tlet timeout;\r\n \treturn function() {\r\n \t\tlet context = this, args = arguments;\r\n \t\tlet later = function() {\r\n \t\t\ttimeout = null;\r\n \t\t\tif (!immediate) func.apply(context, args);\r\n \t\t};\r\n \t\tlet callNow = immediate && !timeout;\r\n \t\tclearTimeout(timeout);\r\n \t\ttimeout = setTimeout(later, wait);\r\n \t\tif (callNow) func.apply(context, args);\r\n \t};\r\n }", "title": "" }, { "docid": "3375c82faf08d5c6e2d4bd1364c66589", "score": "0.577557", "text": "function debounce(func, wait, immediate) {\n\n \"use strict\";\n\n var timeout;\n\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n\n };\n\n}", "title": "" }, { "docid": "f1282bf3fb0308515f0dfc01adaaffaa", "score": "0.5773195", "text": "function debounce(func, wait = 20, immediate = true) {\r\n\r\n var timeout;\r\n\r\n return function() {\r\n var context = this, args = arguments;\r\n var later = function() {\r\n timeout = null;\r\n if(!immediate) {\r\n func.apply(context, args);\r\n }\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if(callNow) {\r\n func.apply(context, args);\r\n }\r\n };\r\n}", "title": "" }, { "docid": "3b448db7a2be3391225264b1f8d44a4a", "score": "0.5772975", "text": "function debounce(func, wait, immediate) {\n var timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}", "title": "" } ]
23b8f179295ebc4e8828ae4872f9f7f3
CAROUSEL CREATOR: CONTROLS AND INJECTS SLIDES Modifies properties, not the individual data points. Updates existing with called weather data. Copies modified to arrayOfSlidesHTML called later for presentation. For the FIRST city in the TARGET_CITIES_ARRAY, a new slide is created and copied to the arrayOfSlidesHTML BUT NOT INJECTED since createCityWeatherDisplaySlide function has already updated the DOM as a sideeffect. If there's MORE THAN ONE city in the TARGET_CITIES_ARRAY, since completeSlide0HTML was already assigned to arrayOfSlidesHTML[0] position remaining slides are created and added to arrayOfSlidesHTML Iterates over arrayOfSlidesHTML, wraps and injects remaining slides into DOM at the "JSinjectionTargetSlideMountPoint" Returns true to main program function (setting UIupdated to true)
[ { "docid": "289da84dbe95499455a8e790926fd3ef", "score": "0.77264965", "text": "function createCityWeatherDisplayCarousel(finalizedCityWeatherInformationObject, TARGET_CITIES_ARRAY){\n let arrayOfSlidesHTML = [];\n for (let city in finalizedCityWeatherInformationObject){\n //Create (and inject as side-effect) first slide and copy it to arrayOfSlidesHTML\n if(Object.keys(finalizedCityWeatherInformationObject)[0] == city){\n let halfCompleteSlide0HTML = createCityWeatherDisplaySlide(city, finalizedCityWeatherInformationObject);\n document.getElementById(\"JSinjectionTargetSlideCreationPoint\").setAttribute('class', 'carousel-item active');\n //First slide copies the entire slide (<div class=\"carousel item\">) (innerHTML of MountPoint)\n //because it replaces innerHTML of JSinjectionTargetSlideMountPoint \n //(others require a createElement and therefore only copy innerHTML of CreationPoint)\n document.getElementById(\"JSinjectionTargetSlideCreationPoint\").innerHTML = halfCompleteSlide0HTML;\n let completeSlide0HTML = document.getElementById(\"JSinjectionTargetSlideMountPoint\").innerHTML;\n arrayOfSlidesHTML.push(completeSlide0HTML);\n } \n // ONLY EXECUTED IF THERE'S MORE THAN ONE TARGET CITY\n else {\n //Create and inject indicator (a Bootstrap Carousel requirement)\n let slideIndex = TARGET_CITIES_ARRAY.indexOf(city);\n let HTMLforNewSlideIndicator = document.createElement('li');\n HTMLforNewSlideIndicator.setAttribute('data-target','#targetCity');\n HTMLforNewSlideIndicator.setAttribute('data-slide-to',slideIndex);\n document.getElementById(\"JSinjectionTargetSlideIndicator\").appendChild(HTMLforNewSlideIndicator);\n //Update existing slide with new city data\n //I chose the SlideCreationPoint (incomplete carousel slide) because I will wrap \n //the slide in an \"item\" div (twitter bootstrap requirement) below\n let HalfCompleteSlideHTML = createCityWeatherDisplaySlide(city, finalizedCityWeatherInformationObject);\n document.getElementById(\"JSinjectionTargetSlideCreationPoint\").innerHTML = HalfCompleteSlideHTML;\n //Copy freshly created slide into arrayOfSlidesHTML\n //because injecting slides above slide0 via appendChild and createELement \n let nextSlideHTML = document.getElementById(\"JSinjectionTargetSlideCreationPoint\").innerHTML;\n arrayOfSlidesHTML.push(nextSlideHTML);\n }\n }\n // IF THERE'S MORE THAN ONE SLIDE, INJECT STORED SLIDES INTO THE PAGE\n if (TARGET_CITIES_ARRAY.length > 0){\n // inject first array member into existing HTML slide\n document.getElementById(\"JSinjectionTargetSlideMountPoint\").innerHTML = arrayOfSlidesHTML[0];\n // inject remaining array members into newly created HTML slides \n for (let iterator = 1; iterator < TARGET_CITIES_ARRAY.length; iterator++){\n let HTMLforNextNewSlide = document.createElement('div');\n HTMLforNextNewSlide.setAttribute('class', 'carousel-item');\n HTMLforNextNewSlide.innerHTML = arrayOfSlidesHTML[iterator];\n document.getElementById(\"JSinjectionTargetSlideMountPoint\").appendChild(HTMLforNextNewSlide);\n }\n }\nreturn true; //sets UIupdated to true\n}", "title": "" } ]
[ { "docid": "b7494d50bd2627c313d5a1e64475e86b", "score": "0.6419568", "text": "function createCityWeatherDisplaySlide(city, finalizedCityWeatherInformationObject){\n document.getElementById(\"targetCityName\").innerHTML = city; \n document.getElementById(\"todaysIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todaysIconCode));\n document.getElementById(\"todaysCurrentTempNumber\").innerHTML = finalizedCityWeatherInformationObject[city].todaysCurrentTemp;\n document.getElementById(\"todaysLowTempNumber\").innerHTML = finalizedCityWeatherInformationObject[city].todaysLow;\n document.getElementById(\"todaysHighTempNumber\").innerHTML = finalizedCityWeatherInformationObject[city].todaysHigh;\n document.getElementById(\"todaysDescription\").innerHTML = finalizedCityWeatherInformationObject[city].todaysDescription;\n document.getElementById(\"todayPlusOneIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todayPlusOneIconCode));\n document.getElementById(\"dayPlusOne\").innerHTML = numberToDay(finalizedCityWeatherInformationObject[city].todayPlusOneDate);\n document.getElementById(\"lowPlusOne\").innerHTML =finalizedCityWeatherInformationObject[city].todayPlusOneLow;\n document.getElementById(\"highPlusOne\").innerHTML = finalizedCityWeatherInformationObject[city].todayPlusOneHigh;\n document.getElementById(\"todayPlusTwoIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todayPlusTwoIconCode));\n document.getElementById(\"dayPlusTwo\").innerHTML = numberToDay(finalizedCityWeatherInformationObject[city].todayPlusTwoDate);\n document.getElementById(\"lowPlusTwo\").innerHTML =finalizedCityWeatherInformationObject[city].todayPlusTwoLow;\n document.getElementById(\"highPlusTwo\").innerHTML = finalizedCityWeatherInformationObject[city].todayPlusTwoHigh;\n document.getElementById(\"todayPlusThreeIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todayPlusThreeIconCode));\n document.getElementById(\"dayPlusThree\").innerHTML = numberToDay(finalizedCityWeatherInformationObject[city].todayPlusThreeDate);\n document.getElementById(\"lowPlusThree\").innerHTML =finalizedCityWeatherInformationObject[city].todayPlusThreeLow;\n document.getElementById(\"highPlusThree\").innerHTML = finalizedCityWeatherInformationObject[city].todayPlusThreeHigh;\n document.getElementById(\"todayPlusFourIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todayPlusFourIconCode));\n document.getElementById(\"dayPlusFour\").innerHTML = numberToDay(finalizedCityWeatherInformationObject[city].todayPlusFourDate);\n document.getElementById(\"lowPlusFour\").innerHTML =finalizedCityWeatherInformationObject[city].todayPlusFourLow;\n document.getElementById(\"highPlusFour\").innerHTML = finalizedCityWeatherInformationObject[city].todayPlusFourHigh;\n document.getElementById(\"todayPlusFiveIcon\").setAttribute('src', imageRenderer(finalizedCityWeatherInformationObject[city].todayPlusFiveIconCode));\n document.getElementById(\"dayPlusFive\").innerHTML = numberToDay(finalizedCityWeatherInformationObject[city].todayPlusFiveDate);\n document.getElementById(\"lowPlusFive\").innerHTML =finalizedCityWeatherInformationObject[city].todayPlusFiveLow;\n document.getElementById(\"highPlusFive\").innerHTML = finalizedCityWeatherInformationObject[city].todayPlusFiveHigh;\n let modifiedSlideHTML = document.getElementById(\"JSinjectionTargetSlideCreationPoint\").innerHTML;\n return modifiedSlideHTML;\n}", "title": "" }, { "docid": "6c0ed352b9b2061454d80139e4917f71", "score": "0.580626", "text": "function buildWeatherMain(){\n let selectedCity = buildHTML(\"section\", \"col-12 col-lg-5 selected-city\");\n currentWeatherEl.appendChild(selectedCity);\n let card = buildHTML(\"div\", \"card\");\n selectedCity.appendChild(card);\n let cardBody = buildHTML(\"div\", \"card-body d-flex flex-column align-items-center\");\n card.appendChild(cardBody);\n\n cardBody.appendChild(buildHTML(\"h2\", \"card-title\", `${requestedWeatherData.cityName}`));\n\n let currentDateRaw = new Date(requestedWeatherData.dailyForecast[0].dt*1000);\n let currentDate = currentDateRaw.toLocaleDateString(\"en\");\n cardBody.appendChild(buildHTML(\"h5\", \"current-date\", `${currentDate}`));\n\n let weatherIcon = `https://openweathermap.org/img/wn/${requestedWeatherData.dailyForecast[0].weather[0].icon}@2x.png`\n let weatherIconEl = buildHTML(\"img\", \"col-1 weather-img\");\n weatherIconEl.setAttribute(\"src\", weatherIcon);\n cardBody.appendChild(weatherIconEl);\n\n cardBody.appendChild(buildHTML(\"p\", \"temperature\", `Temperature: ${requestedWeatherData.currentTemp}`));\n cardBody.appendChild(buildHTML(\"p\", \"humidity\", `Humidity: ${requestedWeatherData.currentHumidity}`));\n cardBody.appendChild(buildHTML(\"p\", \"windspeed\", `Wind Speed: ${requestedWeatherData.currentWind}`));\n\n let uvClass = requestedWeatherData.currentUVI <= 3 ? \"UVindex-low p-2\" : requestedWeatherData.currentUVI <= 7 ? \"UVindex-med p-2\" : \"UVindex-high p-2\";\n cardBody.appendChild(buildHTML(\"p\", uvClass, `UV Index: ${requestedWeatherData.currentUVI}`));\n}", "title": "" }, { "docid": "34ec30ab2d8f8021aa1e7630ed53eb8a", "score": "0.5586173", "text": "function showCityBuildCompletions() {\n var focused = referenceCityID();\n var isles = <div id=\"islandLinks\"></div>;\n var isle = $X('id(\"changeCityForm\")/ul/li[@class=\"viewIsland\"]');\n var lis = get(\"citynames\");\n var ids = owncityIDs();\n var names = cityNames(); // do other stuff with those not ours. later [TODO]\n if (names.length > 1) {\n var images = [];\n var links = <div style=\"left: -50%; position: absolute;\"></div>;\n }\n for (var i = 0; i < ids.length; i++) { //TODO: place island-links elsewhere for cities that do not belong to us. use properly saved kronos-cityids for this.\n var id = ids[i];\n var url = config.getCity(\"u\", 0, ids[i]);\n var res = config.getIsle(\"r\", \"\", config.getCity(\"i\", 0, id));\n var li = lis[i];\n var t = config.getCity(\"t\", 0, ids[i]);\n if (t && t > Date.now() && url) {\n t = secsToDHMS((t - Date.now()) / 1e3, 0);\n node({ tag: \"a\", className: \"ellipsis\", href: url, append: li, text: t });\n }\n li.title = \" \"; // to remove the town hall tooltip\n\n if (res) {\n var has = {}; has[res] = \"\";\n var img = visualResources(has, { size: 0.5, noMargin: 1 });\n var from = isleForCity(referenceCityID());\n var time = travelTime(from, null, isleForCity(id))\n time = secsToDHMS(time < 3600 || time >= 86400 ? time : time + 3599, 0);\n if (\"island\" != urlParse(\"view\") && id == focused)\n time = \"\";\n li.innerHTML = time + img + li.innerHTML;\n\n if (links) { // island link bar\n var a = <a href={urlTo(\"island\", { city: id })} title={names[i]}\n class=\"island-link\" rel={\"i\" + id}></a>;\n images.push(img); // as we can't set innerHTML of an E4X node\n links.* += a;\n }\n\n img = $X('img', li);\n img.style.margin = \"0 3px\";\n img.style.background = \"none\";\n if (id == focused) {\n var current = $X('preceding::div[contains(@class,\"dropbutton\")]', li);\n current.insertBefore(img.cloneNode(true), current.firstChild);\n if (a) a.@style += \" outline: 1px solid #FFF;\";\n }\n }\n }\n if (!links || !isle) return;\n var width = \"width: \"+ (lis.length * 33) + \"px\";\n isles.@style += width;\n links.@style += width;\n isles += links;\n //prompt(!links || !isle, isles);\n isle.innerHTML += isles.toXMLString();\n $x('div/div/a', isle).forEach(kludge);\n $x('div/div//text()', isle).forEach(rm);\n\n function kludge(a, i) {\n a.innerHTML = images[i];\n img = $X('img', a);\n img.height = 10;\n img.width = 13;\n }\n}", "title": "" }, { "docid": "740bdc06316eacdabc46586a6c49f885", "score": "0.55185014", "text": "function buildWeatherDiv(){\n let selectedCity = buildHTML(\"div\", \"col-12 col-lg-8 selected-city\");\n currentWeatherEl.appendChild(selectedCity);\n let card = buildHTML(\"div\", \"card\");\n selectedCity.appendChild(card);\n let cardBody = buildHTML(\"div\", \"card-body d-flex flex-column justify-content-center\");\n card.appendChild(cardBody);\n\n cardBody.appendChild(buildHTML(\"h2\", \"card-title\", `${requestedWeatherData.cityName}`));\n\n let currentDateRaw = new Date(requestedWeatherData.dailyForecast[0].dt*1000);\n let currentDate = currentDateRaw.toLocaleDateString(\"en\");\n cardBody.appendChild(buildHTML(\"h5\", \"current-date\", `${currentDate}`));\n\n let weatherIcon = `https://openweathermap.org/img/wn/${requestedWeatherData.dailyForecast[0].weather[0].icon}@2x.png`\n let weatherIconEl = buildHTML(\"img\", \"col-1 weather-img\");\n weatherIconEl.setAttribute(\"src\", weatherIcon);\n cardBody.appendChild(weatherIconEl);\n\n cardBody.appendChild(buildHTML(\"p\", \"temperature\", `Temperature: ${requestedWeatherData.currentTemp}`));\n cardBody.appendChild(buildHTML(\"p\", \"humidity\", `Humidity: ${requestedWeatherData.currentHumidity}`));\n cardBody.appendChild(buildHTML(\"p\", \"windspeed\", `Wind Speed: ${requestedWeatherData.currentWind}`));\n\n let uvIndex = requestedWeatherData.currentUVI <= 3 ? \"UVindex-low p-2\" : requestedWeatherData.currentUVI <= 7 ? \"UVindex-med p-2\" : \"UVindex-high p-2\";\n cardBody.appendChild(buildHTML(\"p\", uvIndex, `UV Index: ${requestedWeatherData.currentUVI}`));\n}", "title": "" }, { "docid": "e40b0f05e965b145d6a446b08506cfe2", "score": "0.5487678", "text": "function createCityDetails(parent) {\n parent.append($(`<div id=\"cityDetails\" class=\"flex-col border border-gray-300 h-1/3 p-8\"> \n <div class='flex justify-start text-3xl'> ${cityNameHTML} ${currentDateHTML}${currentWeatherIcon}\n </div></div>`));\n $(\"#currentWeatherIcon\").hide();\n\n myElements.forEach(function(elementItem) {\n $(\"#cityDetails\").append($(getElementHtml(elementItem)));\n $(`#${elementItem.label}`).hide();\n });\n}", "title": "" }, { "docid": "1b83afe8b9e3d0be21fae919923d2e20", "score": "0.5448822", "text": "function createCityWeatherForcast(town, response) {\n let weatherForcastContainer = document.getElementsByClassName(\"weatherForecast\");\n let cityContainer = document.createElement('div');\n let cityName = document.createElement('div');\n let weatherDescription = document.createElement('div');\n let weatherDisplay = document.createElement('div');\n let weatherImage = document.createElement('img');\n let weatherTempContainer = document.createElement('div');\n \n weatherDisplay.className = 'weatherCity';\n weatherTempContainer.className = 'temp';\n cityContainer.className = 'col-sm-3 justify-content-center d-flex';\n cityName.innerText = town.name + ', ' + response.data[0].temp + '°C';\n\n weatherDescription.innerText = response.data[0].weather.description;\n weatherImage.setAttribute(\"src\", \"./wwwroot/images/icons/weathericons/\"+response.data[0].weather.icon+\".png\");\n weatherImage.setAttribute(\"alt\", response.data[0].weather.description);\n weatherDisplay.appendChild(cityName);\n weatherDisplay.appendChild(weatherDescription);\n weatherDisplay.appendChild(weatherImage);\n \n cityContainer.appendChild(weatherDisplay);\n cityContainer.appendChild(weatherTempContainer);\n \n weatherForcastContainer[0].appendChild(cityContainer);\n}", "title": "" }, { "docid": "eac5a1b189eaf7c8385164e2dc43c60f", "score": "0.53486145", "text": "function renderCities(cityList) {\n //empty html container\n $('#cities').empty()\n\n //create a new Li for each city name\n for (var i = 0; i < 6; i++) {\n var cityName = $(\"<li>\").addClass(\"list-group-item list-group-item-action p-2 h6 cityHistory\").text(cityList[i])\n $('#cities').append(cityName);\n }\n\n //enable click function to each newly created item\n $(\".cityHistory\").click(function () {\n var history = $(this).text()\n getweatherdata(history);\n })\n}", "title": "" }, { "docid": "2ba0511ff192827f5d75efa9ebd28e62", "score": "0.52900565", "text": "displayCities(cities) {\n if (!cities.join) {\n cities = [cities];\n }\n cities.forEach((item) => {\n let areasNames = [];\n let areas = '';\n\n const iColor = item.isIndustrial ? constants.activeColor : constants.noActiveColor;\n const cColor = item.isCriminal ? constants.activeColor : constants.noActiveColor;\n const pColor = item.isPolluted ? constants.activeColor : constants.noActiveColor;\n\n const iActive = item.isIndustrial ? 'true' : 'false';\n const cActive = item.isCriminal ? 'true' : 'false';\n const pActive = item.isPolluted ? 'true' : 'false';\n\n const iD = item.id;\n item.cityAreas.forEach((item) => {\n areasNames.push(item.name);\n areas += `<div class=\"areasdown\" data-id=${iD}>\n <button class=\"delete-area\" data-id=${ item.id}></button>\n <button class=\"edit-area\" data-id=${ item.id} data-target=\"#areaModal\" data-toggle=\"modal\"></button>\n <span class=\"areadown-name\">${ item.name}</span>\n <span class=\"description\">${ item.description}</span>\n <span class=\"citizenamount\">${ item.citizenAmount + ' people'}</span>\n </div>`;\n });\n areasNames = areasNames.length < 1 ? constants.noAreas : areasNames.join(', ');\n\n const string =\n `<div class=\"panel-group\" id=\"accordion\" role=\"tablist\" aria-multiselectable=\"true\">\n <div class=\"panel panel-default\">\n <div class=\"toggle-container\" role=\"button\" data-toggle=\"collapse\" data-parent=\"#accordion\" href=${ '#collapse' + item.id}\n aria-expanded=\"false\" aria-controls=${ 'collapse' + item.id}></div>\n <div class=\"panel-heading\" role=\"tab\" id=\"headingOne\">\n <button class=\"delete-city\" data-id=${ item.id}></button>\n <button class=\"edit-city\" data-id=${ item.id} data-target=\"#myModal\" data-toggle=\"modal\"></button>\n \n <a>\n ${ item.name}\n </a>\n <div class=\"areas\"><span id=${item.id + 'areas'}>${areasNames}</span></div>\n <div class=\"marks\">\n <button id=\"i-button\" data-id=${ item.id} style=\"background:${iColor}\" class=\"attributes\" data-act=${iActive}>I</button>\n <button id=\"c-button\" data-id=${ item.id} style=\"background:${cColor}\" class=\"attributes\" data-act=${cActive}>C</button>\n <button id=\"p-button\" data-id=${ item.id} style=\"background:${pColor}\" class=\"attributes\" data-act=${pActive}>P</button>\n </div> \n </div>\n <div id=${ 'collapse' + item.id} class=\"panel-collapse collapse\" role=\"tabpanel\" aria-labelledby=\"headingOne\">\n <div class=\"panel-body\">\n <div class=\"newarea\">\n <button type=\"button\" class=\"newareabutton btn btn-primary btn-sm\" id=\"add-new-area\"\n data-toggle=\"modal\" data-target=\"#areaModal\" data-id=${ item.id}>Add New Area</button>\n </div> \n ${ areas}\n </div>\n </div>\n </div>\n </div>`;\n\n this.wrapper.insertAdjacentHTML('beforeend', string);\n });\n }", "title": "" }, { "docid": "ff5b8371561021ee786b6b9f78df2c9d", "score": "0.52844065", "text": "function updateCityRadiusSliderHandler() {\n cityRadiusArray = getCityRadiusArray(\n +minCityRadiusInput.value,\n +maxCityRadiusInput.value\n );\n\n cityVolumeClassArray = createCityVolumeClassArray(cityRadiusArray, nodeJenks);\n updateCityVolume(legendLists, cityVolumeClassArray);\n legendCityVolumeCircles = getCityVolumeCircles(legendLists);\n updateLegendCityRadiusByZoom(map.getZoom(), legendCityVolumeCircles);\n\n nodes.features.forEach(node => {\n addCityRadiusAttr(node, cityRadiusArray);\n });\n\n renderNodes(map, nodes, loadingClassArray);\n\n customLayers = map.getStyle().layers.slice(151, 169);\n customSources = map.getStyle().sources;\n delete customSources.composite;\n }", "title": "" }, { "docid": "0330bae0afa871f124a725692a218f45", "score": "0.5278051", "text": "function populateCities() {\n\t\tfetch(\"https://webster.cs.washington.edu/cse154/weather.php?mode=cities\", displayCities);\n\t\tdocument.getElementById(\"loadingnames\").style.display = \"none\";\n\t}", "title": "" }, { "docid": "73e22618881d749cf211668121bfd8cf", "score": "0.5240457", "text": "function displaySearchedCity(){\n $(\".city-card-body\").empty();\n // for loop over the cityarry and then dynamically append each item in the array to the city-card-body. \n for (var i = 0; i < cityArray.length; i++) {\n var cityName = $(\"<p>\");\n // Adding a class of new-city-p to <p>\n cityName.addClass(\"new-city-p\");\n cityName.attr(cityArray[i]);\n // Providing the <p> text\n cityName.text(cityArray[i]);\n // Adding the button to the buttons-view div\n $(\".city-card-body\").append(cityName);\n // ending bracket for displaySearchedCity function\n }\n\n\n}", "title": "" }, { "docid": "1448cbe0e80574b19d054f56d042d56b", "score": "0.52160853", "text": "async function mainProgramLoop(state){\n \n function displayMessageOnLoadingScreen(message, instruction = \"\"){\n document.getElementById(\"loadingMessage\").innerHTML = message + \"<br><br>\" + instruction;\n }\n\n //QUIT LOOP IF UI ALREADY UPDATED\n if(state.UIupdated == true){\n let message = \"Quitting loop, already updated\"\n displayMessageOnLoadingScreen(message); \n return state;\n }\n\n //CALL WEATHER API \n // If the API has not been called\n // then try call API (getCityWeatherData function)\n // getCityWeatherData returns finalizedCityWeatherInformationObject\n // hence its assignment to its namesake.\n // If the promise resolves, i.e. no error is thrown,\n // then set the APIcallSuccess flag to true,\n // and then inject the data into slides and update the UI\n // createCityWeatherDisplayCarousel returns true when done\n // hence it's it's invocation as an expression of state.UIupdated\n // Finally, remove the loading screen (set display none) \n if(state.APIcallMade == false){ \n let message = \"Please wait while the weather data is called\"+\"<br>\"+\n \"Currently checking \" + state.TARGET_CITIES_ARRAY.length + \" cities...\";\n displayMessageOnLoadingScreen(message)\n\n //THE SUCCESSFUL PROGRAM ROUTE:\n // 1. call API\n // 2. create slides with returned data and inject into DOM\n // 3. remove loading screen\n try {\n state.APIcallMade = true;\n state.finalizedCityWeatherInformationObject = \n await getCityWeatherData(state.TARGET_CITIES, state.API_KEY, state.WEATHERBIT_API_URL);\n state.APIcallSuccess = true;\n state.UIupdated = \n createCityWeatherDisplayCarousel(state.finalizedCityWeatherInformationObject, state.TARGET_CITIES_ARRAY);\n document.getElementById(\"loadingContainer\").style.display = \"none\";\n document.getElementById(\"loadingCircleContainer\").style.display = \"none\"; \n } \n //HANDLING AN API CALL ERROR \n // Error returned from callWeatherAPI via getCityWeatherData\n // Display a particular message depening on the class of \n // HTTP response (status code band)\n // return state for next loop \n // (could track number of attempts or periodically poll in future)\n catch(error){\n state.APIcallSuccess = false;\n state.APIcallStatusCode = error.status;\n state.APIcallStatusText = \"JQueryXMLHTTPRequest failed with error code \" \n + error.status + \": \" + error.statusText + \". <br>\" + error.responseJSON.error;\n if (300 <= state.APIcallStatusCode && state.APIcallStatusCode <= 399){\n let instruction = \"A redirection error occured, try refreshing the page at a later time.\";\n displayMessageOnLoadingScreen(state.APIcallStatusText, instruction);\n return state;\n }\n if (400 <= state.APIcallStatusCode && state.APIcallStatusCode <= 499){\n let instruction = \"A client side error occured, contact the app developer before trying again.\"\n displayMessageOnLoadingScreen(state.APIcallStatusText, instruction);\n return state;\n }\n if (500 <= state.APIcallStatusCode && state.APIcallStatusCode <= 599){\n let instruction = \"A client server error occured, try refreshing the page at a later time or contact app developer.\"\n displayMessageOnLoadingScreen(state.APIcallStatusText, instruction);\n return state;\n }\n else{\n let instruction = \"An unknown error occured.\"\n displayMessageOnLoadingScreen(instruction); \n return state;\n }\n }\n } // CallWeatherAPI Route (if statement)\n }", "title": "" }, { "docid": "9e0506c342ef988233cedf26e04755ea", "score": "0.5214485", "text": "function getWeather() {\n\n $.ajax({\n method: \"GET\",\n url: weatherURL + \"city=\" + city + \"&key=\" + weatherKey\n }).then(function (res) {\n\n //set varaiables\n var high, description, icon, code;\n\n var cityResponse = res.city_name\n\n for (var i = 0; i <= 7; i++) {\n var goodDay = false;\n var weatherContent;\n code = res.data[i].weather.code;\n high = Math.round((res.data[i].max_temp * (9 / 5)) + 32);\n description = res.data[i].weather.description;\n icon = res.data[i].weather.icon;\n wind = res.data[i].wind_spd;\n windspeed = Math.round(wind);\n\n var slideContainer = $('#dynamic-slide')\n\n if (slideContainer == true) {\n // $('#dynamic-slide').remove();\n $(\"#dynamic-slide\").slick('slickRemove', i)\n console.log(\"Removed \" + i)\n }\n\n // if the current weather code is in our array, then its a good day for a beer! \n if (goodWeather.indexOf(code) != -1) {\n goodDay = true;\n // Adding variables for date so we can reformat it\n var responseDate = res.data[i].valid_date;\n //monthDay grabs only the month and the day from response\n var monthDay = responseDate.substr(5)\n // year grabs only the year\n var year = responseDate.substr(0, 4)\n // final date combine both with a dash in between the day and year\n var finalDate = monthDay + \"-\" + year\n\n var imageGood = /*html*/ `<img src=\"assets/images/sunny-icon.svg\" alt=\"Great Day Icon\">\n `\n // create forecast card for a good day\n weatherContent = /*html*/ `\n <div id =\"dynamic-slide\" class=\"card good-day rounderCorners pos-relative\">\n <p class=\"text-right pos-absolute date\">${finalDate} <br> ${cityResponse}</p>\n <div class=\"grid-x padding25\">\n <div id=\"icon\" class=\"cell medium-2 padding25\">${imageGood}</div>\n <div id=\"day-status\" class=\" cell medium-7\">\n <h2>Today is a Great Day For A Beer!</h2>\n </div>\n </div>\n <div class=\"condition-info-good padding-y-15\">\n <div class=\"grid-x\">\n <div id=\"conditions\" class=\"cell medium-8 margin-0\">\n <ul>\n <li>\n <p><b>High:</b> ${high}°</p>\n </li>\n <li>\n <p><b>Conditions:</b> <img\n style=\"width:40px; display:inline;\" src=\"https://www.weatherbit.io/static/img/icons/${icon}.png\"> ${description}</p>\n </li>\n <li>\n <p><b>Wind Speed:</b> ${windspeed} </p>\n </li>\n </ul>\n </div>\n <div id=\"view-breweries\" class=\"cell medium-4 text-right\">\n <button id=\"breweryBtn\" class=\"button rounderCorners margin-0 view-breweries\">View Local\n Breweries</button>\n </div>\n </div>\n </div>\n </div>\n `\n }\n else {\n // Adding variables for date so we can reformat it\n var responseDate = res.data[i].valid_date;\n //monthDay grabs only the month and the day from response\n var monthDay = responseDate.substr(5)\n // year grabs only the year\n var year = responseDate.substr(0, 4)\n // final date combine both with a dash in between the day and year\n var finalDate = monthDay + \"-\" + year\n var imageBad = /*html*/ `<img src=\"assets/images/stormy-icon.svg\" alt=\"Bad Day Icon\">\n `\n //create forecast card for a bad day\n weatherContent = /*html*/ `\n <div id =\"dynamic-slide\" class=\"card bad-day rounderCorners pos-relative\">\n <p class=\"text-right pos-absolute date\">${finalDate} <br> ${cityResponse}</p>\n <div class=\"grid-x padding25\">\n <div id=\"icon\" class=\"cell medium-2 padding25\">${imageBad}</div>\n <div id=\"day-status\" class=\"cell medium-7\">\n <h2>Today is NOT a Great Day For A Beer...</h2>\n </div>\n </div>\n <div class=\"condition-info-bad padding-y-15\">\n <div class=\"grid-x\">\n <div id=\"conditions\" class=\"cell margin-0\">\n <ul>\n <li>\n <p><b>High:</b> ${high}°</p>\n </li>\n <li>\n <p><b>Conditions:</b> <img\n style=\"width:40px; display:inline;\" src=\"https://www.weatherbit.io/static/img/icons/${icon}.png\"> ${description}</p>\n </li>\n <li>\n <p><b>Wind Speed:</b> ${windspeed}</p>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n `\n }\n // on Append we just simply name the variable above\n $(\"#forecast\").append(weatherContent)\n\n }\n //function for the slick slider\n // if the slider has already been initialized, we have to \"un-initialize\" and then reinitialize \n if ($(\"#forecast\").hasClass(\"slick-initialized\")) {\n $('#forecast').slick('removeSlide', null, null, true);\n $(\"#forecast\").slick('unslick')\n $(\"#forecast\").slick({\n lazyLoad: 'ondemand', // ondemand progressive anticipated\n infinite: true\n });\n } else {\n $(\"#forecast\").slick({\n lazyLoad: 'ondemand', // ondemand progressive anticipated\n infinite: true\n });\n }\n })\n}", "title": "" }, { "docid": "0be8636633cff5de84610909ba203459", "score": "0.51970947", "text": "function updateSlideContent(coffeeDetails) {\n var oneDetail = coffeeDetails.split(\"_\");\n\n //display general data\n $(\"#slide h4\").html(oneDetail[0]);\n $(\"#slide p.google-map\").html(oneDetail[1]);\n\n //display the map data\n var mapOutput = '<iframe width=\"100%\" height=\"450\" frameborder=\"0\" style=\"border:0\" src=\"https://www.google.com/maps/embed/v1/place?key=AIzaSyDlI_svxqzPA4F944kcyUEnC6-roh51lfc &q=' + oneDetail[1] + '\" allowfullscreen></iframe>';\n $(\"#slide .google-map-wrapper\").html(mapOutput);\n\n getYoutubeResults(oneDetail[0]);\n getWikipediaResults(oneDetail[0]);\n\n}", "title": "" }, { "docid": "7015f8b2e630e363a2cea9c710b8c573", "score": "0.518644", "text": "function updateCityWeather(data, timezoneOffset, $container) {\n\n\t\t// create dom elements\n\n\t\tvar $weather = $('<p>', { class: 'weather-city__hour' });\n\t\t$container.append($weather);\n\n\t\tvar $weatherTime = $('<div>', { class: 'weather-city__time text-muted' });\n\t\t$weather.append($weatherTime);\n\n\t\tvar $weatherTemperature = $('<div>', { class: 'weather-city__temperature' });\n\t\t$weather.append($weatherTemperature);\n\n\t\tvar $weatherDescription = $('<div>', { class: 'weather-city__description' });\n\t\t$weather.append($weatherDescription);\n\n\t\t// fill with data\n\t\tvar date = new Date(data.dt * 1000);\n\t\tdate.setTime(date.getTime() + timezoneOffset);\n\t\t$weatherTime.html(date.getHours() + ':' + date.getMinutes());\n\t\t$weatherTemperature.html(kelvinToCelsius(data.main.temp).toFixed(1) + '<small> C° </small>');\n\t\t$weatherDescription.html(' (' +data.weather[0].main + ') ');\n\t}", "title": "" }, { "docid": "af4e4bb8997c756080b72c695fd9ccd2", "score": "0.5159527", "text": "function displayCity(response) {\n let h1 = document.querySelector(\"h1\");\n h1.innerHTML = response.data.name;\n let currentTemp = document.querySelector(\"h2\");\n currentTemp.innerHTML = Math.round(response.data.main.temp);\n let descriptionDay = document.querySelector(\"#description\");\n descriptionDay.innerHTML = response.data.weather[0].description;\n let minTemp = document.querySelector(\"#minTemp\");\n minTemp.innerHTML = Math.round(response.data.main.temp_min);\n let maxTemp = document.querySelector(\"#maxTemp\");\n maxTemp.innerHTML = Math.round(response.data.main.temp_max);\n let feelsLike = document.querySelector(\"#feelsLike\");\n feelsLike.innerHTML = Math.round(response.data.main.feels_like);\n let humitidy = document.querySelector(\"#humidity\");\n humidity.innerHTML = response.data.main.humidity;\n\n celsiusTemp = response.data.main.temp;\n let iconElement = document.querySelector(\"#iconHeading\");\n iconElement.setAttribute(\n \"src\",\n `http://openweathermap.org/img/wn/${response.data.weather[0].icon}@2x.png`\n );\n getForecast(response.data.coord);\n}", "title": "" }, { "docid": "a47d5cd4cf07e24e019428819936de2a", "score": "0.5145695", "text": "function showCityWeather(cityName) {\n\n cityName = cityName.toUpperCase()\n\n if (!searchedCities.includes(cityName)) {\n searchedCities.push(cityName)\n renderSearchedCities()\n }\n\n localStorage.setItem('lastViewedCity', cityName)\n localStorage.setItem('searchedCities', JSON.stringify(searchedCities))\n\n // AJAX functions for the APIs\n $.get(`https://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=32a6bd8e1707690576a18bee7c728812&units=imperial`)\n .then(function (response)\n // need to pull the Temperature, Humidity, Wind Speed, and Icon\n {\n var weatherTemp = response.main.temp;\n var weatherHumid = response.main.humidity;\n var weatherWindSpeed = response.wind.speed;\n var NameofCity = response.name;\n var cityLat = response.coord.lat;\n var cityLong = response.coord.lon;\n var icon = response.weather[0].icon\n\n var date = new Date().toDateString()\n cityNameHeading.innerHTML = NameofCity + ` (${date})` \n cityTemperatureP.innerHTML = weatherTemp;\n cityHumidityP.innerHTML = weatherHumid;\n cityWindSpeedP.innerHTML = weatherWindSpeed;\n\n weatherIcon.setAttribute('src', `https://openweathermap.org/img/wn/${icon}@2x.png`)\n\n // UVI API => pass coordinates from weather API to UVI API to get UV index\n $.get(`https://api.openweathermap.org/data/2.5/uvi?appid=32a6bd8e1707690576a18bee7c728812&lat=${cityLat}&lon=${cityLong}`)\n .then(function (response) {\n\n var cityUVIndexP = document.querySelector(\"#uv\")\n \n // UV Severity code\n var uvSeverity;\n if (response.value<=2){\n uvSeverity = \"uv-low\"\n } else if (response.value<=7){\n uvSeverity = \"uv-moderate\"\n } else{\n uvSeverity = \"uv-severe\"\n } \n cityUVIndexP.outerHTML = `<span id=\"uv\" class=\"${uvSeverity}\">${response.value}</span>`\n\n });\n\n // 5 day forcast \n $.get(`https://api.openweathermap.org/data/2.5/forecast?q=${cityName}&appid=32a6bd8e1707690576a18bee7c728812&units=imperial`)\n .then(function (response) {\n\n forecastDateOne.innerHTML = response.list[0].dt_txt.substring(0, 10)\n forecastTempOne.innerHTML = \"Temperature: \" + response.list[0].main.temp\n forecastHumidityOne.innerHTML = \"Humidity: \" + response.list[0].main.humidity + \"%\"\n forecastDayOneIcon.setAttribute(\"src\", `https://openweathermap.org/img/wn/${response.list[0].weather[0].icon}@2x.png`)\n\n forecastDateTwo.innerHTML = response.list[8].dt_txt.substring(0, 10)\n forecastTempTwo.innerHTML = \"Temperature: \" + response.list[8].main.temp\n forecastHumidityTwo.innerHTML = \"Humidity: \" + response.list[8].main.humidity + \"%\"\n forecastDayTwoIcon.setAttribute(\"src\", `https://openweathermap.org/img/wn/${response.list[8].weather[0].icon}@2x.png`)\n\n forecastDateThree.innerHTML = response.list[16].dt_txt.substring(0, 10)\n forecastTempThree.innerHTML = \"Temperature: \" + response.list[16].main.temp\n forecastHumidityThree.innerHTML = \"Humidity: \" + response.list[16].main.humidity + \"%\"\n forecastDayThreeIcon.setAttribute(\"src\", `https://openweathermap.org/img/wn/${response.list[16].weather[0].icon}@2x.png`)\n\n forecastDateFour.innerHTML = response.list[24].dt_txt.substring(0, 10)\n forecastTempFour.innerHTML = \"Temperature: \" + response.list[24].main.temp\n forecastHumidityFour.innerHTML = \"Humidity: \" + response.list[24].main.humidity + \"%\"\n forecastDayFourIcon.setAttribute(\"src\", `https://openweathermap.org/img/wn/${response.list[24].weather[0].icon}@2x.png`)\n\n\n forecastDateFive.innerHTML = response.list[36].dt_txt.substring(0, 10)\n forecastTempFive.innerHTML = \"Temperature: \" + response.list[36].main.temp\n forecastHumidityFive.innerHTML = \"Humidity: \" + response.list[36].main.humidity + \"%\"\n forecastDayFiveIcon.setAttribute(\"src\", `https://openweathermap.org/img/wn/${response.list[36].weather[0].icon}@2x.png`)\n\n });\n });\n\n}", "title": "" }, { "docid": "4b82fc73859092d2f300f10ed0dd2c09", "score": "0.5145347", "text": "function renderCities() {\n $(\"#cityList\").empty();\n $(\"#cityInput\").val(\"\");\n\n var i;\n for (i = 0; i < cityList.length; i++) {\n var a = $(\"<a>\");\n a.addClass(\n \"list-group-item list-group-item-action list-group-item-primary city\"\n );\n a.attr(\"data-name\", cityList[i]);\n a.text(cityList[i]);\n $(\"#cityList\").prepend(a);\n }\n}", "title": "" }, { "docid": "8415e91b95d1bf5c71019816d8baee41", "score": "0.5136437", "text": "function manageWeatherData(weatherDataObject) {\n\t// Try Catch used to find errors within this function and the other functions called within\t\n\ttry {\n\t\t\t// ** VARIABLES **\n\t\tlet weatherAPIData = weatherDataObject;\n\n\t\tconsole.log(\"Weather Data ...\");\n\t\tconsole.log(weatherAPIData);\n\n\t\t// filling Slides with values from the arrays created from API Response Data:\n\t\t//1st SLIDE\n\t\tfor(let [APIkey, APIvalue] of Object.entries(weatherAPIData.sys)) {\n\t\t\tif (APIkey\t== \"country\"){\n\t\t\t\tdocument.querySelector(\"#weather_slide_1\").innerHTML = weatherAPIData.name.substring(0, 20); // COUNTRY\n\t\t\t\tdocument.querySelector(\"#weather_slide_title_1\").innerHTML = \n\t\t\t\tAPIkey.toString() + \": \" + APIvalue.toString();\n\t\t\t}\n\t\t}\n\t\t\n\t\t// 2nd SLIDE\n\t\tdocument.querySelector(\"#weather_slide_2\").innerHTML = weatherAPIData.weather[0].main; // CONDITIONS\n\t\tdocument.querySelector(\"#weather_slide_title_2\").innerHTML = \"Conditions\";\n\n\t\t// 3rd SLIDE\n\t\tdocument.querySelector(\"#weather_slide_3\").innerHTML = globalVariableStorage.populationGlobal.population; //POPULATION\n\t\tdocument.querySelector(\"#weather_slide_title_3\").innerHTML = \"Population\";\n\n\t\t// 4th & 5th SLIDE\n\t\tfor(let [key, value] of Object.entries(weatherAPIData.main)) {\n\t\t\tfiltered_key = key.toString().replace('_', ' ');\n\t\t\tif (key\t== \"temp\"){\n\t\t\t\tdocument.querySelector(\"#weather_slide_4\").innerHTML = value.toString() + \"°\"; // TEMP SLIDE\n\t\t\t\tdocument.querySelector(\"#weather_slide_title_4\").innerHTML = filtered_key;\n\t\t\t} else if (key == \"temp_max\"){\n\t\t\t\tdocument.querySelector(\"#weather_slide_5\").innerHTML = value.toString() + \"°\";\t// MAX_TEMP SLIDE\n\t\t\t\tdocument.querySelector(\"#weather_slide_title_5\").innerHTML = filtered_key; \n\t\t\t} \n\t\t}\n\n\t\t// Resetting Weather SlideShow Index & calling the slideshow function\n\t\tweatherDataSlides('show', 1);\n\n\t\t// Handles the Google Maps API (param = passing the coords of the users desired location)\n\t\tinitialiseGoogleMaps(globalVariableStorage.coordinatesForMapsAPI);\n\n\t} catch (weatherDataError){\n\t\t// creates an alert if an exception is raised, also console logs the error.\n\t\tconsole.log('Exception Raised managing and displaying current weather API data ...');\n\t\tconsole.log(weatherDataError);\n\t\tclearInterval(globalVariableStorage.weatherSlideShowTimer)\n\t\talert(\"Exception Raised while displaying the Current Weather Data, \" +\n\t\t\t\"Page may not display as intended ... See Console for details\");\n\t}\n}", "title": "" }, { "docid": "61fd49db75248ebef75d35b1b47abdbc", "score": "0.5108087", "text": "function updateMainCity(response) {\n document.querySelector(\"#current-city\").innerHTML = response.data.name;\n celsiusTemperature = response.data.main.temp;\n document.querySelector(\".actual-temp\").innerHTML = Math.round(\n celsiusTemperature\n );\n document.querySelector(\"#humidity\").innerHTML = Math.round(\n response.data.main.humidity\n );\n document.querySelector(\"#wind\").innerHTML = Math.round(\n response.data.wind.speed\n );\n document.querySelector(\"#description\").innerHTML =\n response.data.weather[0].description;\n\n let icon = response.data.weather[0].icon;\n let currentWeatherIcon = document.querySelector(\"#icon-current\");\n currentWeatherIcon.innerHTML = ` <img src=\"http://openweathermap.org/img/wn/${icon}@2x.png\" alt=\"Cweather\">`\n\n let latitude = response.data.coord.lat;\n let longitude = response.data.coord.lon;\n createForecastUrl(latitude, longitude); // API url for the forecast requeries these parameters. \n}", "title": "" }, { "docid": "baae85282123a3beee6ef3d1acb32a9d", "score": "0.5097014", "text": "function createCarousel() {\n\n\t\t\tvar slide = [];\n\n\t\t\tfor (var i = 0; i < currentMap[0].checkpoints.length; i++) {\n\t\t\t\t//background: url('+ currentMap[0].checkpoints[i].image +') no-repeat center center; background-size: cover;\n\t\t\t\tslide = '<div class=\"slide full-height\" id=\"slide'+(i + 1)+'\" data-zoom=\"'+currentMap[0].checkpoints[i].zoomLevel+'\">\\\n\t\t\t\t\t\t\t<div class=\"landscape-image full-height\" style=\"backgroundColor:#000;\"></div>\\\n\t\t\t\t\t\t </div>';\n\n\t\t\t\t $('#carousel').append(slide);\n\n\n\t\t\t};\n\n\t\t\tsetTimeout(function(){\n\n\t\t\t\t$('#carousel').slick({\n\t\t\t\t\tdots: false,\n\t\t\t\t\tspeed: 200,\n\t\t\t\t\tinfinite: true,\n\t\t\t\t\tadaptiveHeight: true,\n\t\t\t\t\tcenterMode: false,\n\t\t\t\t\tslidesToShow: 1,\n\t\t\t\t\tnextArrow: '.next',\n \t\t\t\t\tprevArrow: '.previous'\n\t\t\t\t});\n\n\t\t\t}, 500);\n\n\t\t}", "title": "" }, { "docid": "cac616444b2666d587cf84b36cdd3c32", "score": "0.5096697", "text": "function initialise() {\n // Adding all cities in the dropdown\n cardList = Object.keys(data);\n for (const cityKey in data) {\n let cityObject = data[cityKey];\n let cityElement = document.createElement('option');\n cityElement.setAttribute('value', cityObject.cityName);\n cityDrop.appendChild(cityElement);\n }\n\n //Render All Cards\n cardList.forEach((key, index) => {\n let cityDetails = data[key];\n let card = document.createElement('li');\n card.setAttribute('class', 'card');\n card.classList.add(`card-${index}`);\n card.innerHTML = `<div class=\"card-title\">\n <h3>${cityDetails.cityName}</h3>\n <h3>\n <img\n class=\"card-icon\"\n src=${getCardWeatherIcon(cityDetails.temperature)}\n alt=\"\"\n />\n ${cityDetails.temperature}\n </h3>\n </div>\n <div class=\"card-content\">\n <h5 class=\"card-time\">${getCardTime(cityDetails.dateAndTime)}</h5>\n <h5 class=\"card-date\">${getCardDate(cityDetails.dateAndTime)}</h5>\n <p>\n <img\n class=\"card-icon\"\n src=\"./assets/htmlcss/Weather Icons/humidityIcon.svg\"\n alt=\"\"\n />\n ${cityDetails.humidity}\n </p>\n <p>\n <img\n class=\"card-icon\"\n src=\"./assets/htmlcss/Weather Icons/precipitationIcon.svg\"\n alt=\"\"\n />\n ${cityDetails.precipitation}\n </p>\n </div>`;\n card.style.backgroundImage = `url('../assets/htmlcss/Icons for cities/${key}.svg')`;\n cardContainer.appendChild(card);\n });\n\n //Render All GRid Items\n cardList.forEach((key, index) => {\n let cityDetails = data[key];\n let contItem = document.createElement('li');\n contItem.setAttribute('class', 'cont-item');\n contItem.innerHTML = `<div class=\"cont-item-title\">\n <div class=\"cont-name\">${cityDetails.timeZone.split('/')[0]}</div>\n <div class=\"cont-temp\">\n <img\n class=\"cont-temp-icon\"\n src=${getWeatherIcon(\n parseInt(cityDetails.temperature.split('°')[0])\n )}\n alt=\"\"\n />\n ${cityDetails.temperature}\n </div>\n </div>\n <div class=\"cont-content\">\n <div class=\"cont-city-name\">${cityDetails.cityName},&nbsp;${getCardTime(\n cityDetails.dateAndTime\n )}</div>\n <div class=\"cont-humidity\">\n <img\n src=\"./assets/htmlcss/Weather Icons/humidityIcon.svg\"\n alt=\"\"\n class=\"cont-humidity-icon\"\n />\n ${cityDetails.humidity}\n </div>\n </div>`;\n contGrid.appendChild(contItem);\n });\n}", "title": "" }, { "docid": "00f20c4a015bcd2915a7e743b860bd2b", "score": "0.5058161", "text": "function fillCityInfo() {\n //api key\n const apiKey = \"8885e952b1990b5bf855eb797f5fe06b\";\n //url path for the open weather api\n const pathurl = \"https://api.openweathermap.org/data/2.5/weather?q=\" + inputVal + \"&appid=\" + apiKey + \"&units=metric\";\n //ajax call\n $.ajax({\n url: pathurl,\n type: \"GET\",\n dataType: \"json\",\n success: function (result) {\n checkCityAlreadyExist();\n $(\"#city_name\").empty();\n $(\"#displayInfo\").empty();\n $(\".card-deck\").empty();\n var d = new Date();\n var strDate = (d.getMonth() + 1) + \"/\" + d.getDate() + \"/\" + d.getFullYear();\n const icon = \"https://openweathermap.org/img/wn/\" + result.weather[0][\"icon\"] + \"@2x.png\";\n var getInfo = \"<h3>\" + result.name + \" (\" + strDate + \")<img src=\" + icon + \" style='display:inline;width:40px;' class='img-responsive'></h3>\";\n $(\"#city_name\").append(getInfo);\n\n const temp = document.createElement(\"li\");\n temp.innerHTML = \"Temprature: \" + ((((((result.main.temp))) * 9) / 5) + 32).toFixed(2) + String.fromCharCode(176) + \"F\";\n const humidity = document.createElement(\"li\");\n humidity.innerHTML = \"Humidity: \" + result.main.humidity + \"%\";\n const windSpeed = document.createElement(\"li\");\n windSpeed.innerHTML = \"Wind Speed: \" + result.wind.speed.toFixed(1) + \" MPH\";\n const UVindex = document.createElement(\"li\");\n var lat = result.coord.lat;\n var lon = result.coord.lon;\n var uv = \"https://api.openweathermap.org/data/2.5/uvi?appid=\" + apiKey + \"&lat=\" + lat + \"&lon=\" + lon;\n //ajax call to get the uv index for the current city\n $.ajax({\n url: uv,\n method: \"GET\",\n }).then(function (res) {\n var uvI = res.value;\n //check the uv index and change the color for normal moderate and high\n if (uvI >= 0 && uvI <= 2.9) {\n UVindex.innerHTML = \"UV Index: <mark style='background-color:green'>\" + uvI + \"</mark>\";\n }\n else if (uvI >= 3 && uvI <= 5.9) {\n UVindex.innerHTML = \"UV Index: <mark style='background-color:yellow'>\" + uvI + \"</mark>\";\n } \n else if (uvI >= 6 && uvI <=7.9) {\n UVindex.innerHTML = \"UV Index: <mark style='background-color:orange'>\" + uvI + \"</mark>\";\n }\n else if (uvI >= 8 && uvI <=10.9) {\n UVindex.innerHTML = \"UV Index: <mark style='background-color:red'>\" + uvI + \"</mark>\";\n }\n else if (uvI >=11) {\n UVindex.innerHTML = \"UV Index: <mark style='background-color:violet'>\" + uvI + \"</mark>\";\n }\n });\n $(\"#displayInfo\").append(temp);\n $(\"#displayInfo\").append(humidity);\n $(\"#displayInfo\").append(windSpeed);\n $(\"#displayInfo\").append(UVindex);\n $(\"#border\").addClass(\"border\");\n fillFiveDayData();\n\n },\n error: function (result) {\n //if the user enter the wrong city name alert the user\n $(\".alertInfo\").addClass(\"alert\");\n $(\".alertInfo\").addClass(\"alert-info\");\n $(\".alertInfo\").text(\"Enter the correct city..\");\n $(\"#searchCity\").val(\"\");\n }\n });\n\n }", "title": "" }, { "docid": "8f0933d6a6aac456e88b62311bc41abd", "score": "0.5046392", "text": "function placeInActorsTemplate(){\n console.log(actorBioAndFilmInfo)\n //let html = actorBioAndFilmInfo.map(actors => template2(actors)).join('');\n let html = template2(actorBioAndFilmInfo);\n let destination = document.querySelector('.tiymdb-actors');\n destination.innerHTML = html;\n let closeToggle = document.querySelector(\"#close\");\n closeToggle.addEventListener(\"click\", toggleSlider);\n}", "title": "" }, { "docid": "f62b49b722cc656203e278fa55a88a4b", "score": "0.50116193", "text": "function createCurrentForecast(){\n const divCity = document.createElement('div');\n divCity.setAttribute('id','weather-info-city');\n const divForecast = document.createElement('div');\n divForecast.setAttribute('id','weather-info-forecast')\n const divDiscription = document.createElement('div');\n divDiscription.setAttribute('id','weather-info-description');\n const divIcon = document.createElement('img');\n divIcon.setAttribute('id','weather-info-icon');\n divIcon.classList.add(\"weather-info-icon\");\n\n forecastContainer.appendChild(divCity);\n forecastContainer.appendChild(divForecast);\n forecastContainer.appendChild(divDiscription);\n forecastContainer.appendChild(divIcon);\n\n document.getElementById(\"weather-info-city\").innerHTML = weather.city;\n document.getElementById(\"weather-info-forecast\").innerHTML = weather.forecast + \" C°\";\n document.getElementById(\"weather-info-description\").innerHTML = weather.description;\n document.getElementById(\"weather-info-icon\").src = new URL(`http://openweathermap.org/img/wn/${weather.icon}@2x.png`);\n\n\n}", "title": "" }, { "docid": "bbfb89b989a506589cd66855b951c7c8", "score": "0.50044703", "text": "function displayCityWeather(cityNames) {\n var close = \"\";\n if (settings === 1) {\n close = '<a href=\"#\" class=\"close\" onclick=\"deleteDiv(this)\"></a>'\n }\n document.getElementById(\"displayWeather\").innerHTML = \"\";\n while (cityNames[i]) {\n window.fetch(`http://api.openweathermap.org/data/2.5/weather?q=${cityNames[i]}&units=metric&appid=21b10dd0ee5f3d6bd052c6f63604129a`)\n .then(function(res) {\n var getJson = res.json();\n return getJson;\n })\n .then(function(resJson) {\n var iconcode = resJson.weather[0].icon;\n document.getElementById(\"displayWeather\").innerHTML += `<div id=\"${resJson.name}\" class=\"widget\">${close}<div class =\"name\">${resJson.name}, ${resJson.sys.country}</div><div class=\"temp\">temperature: ${resJson.main.temp}°C</div><img id=\"wicon\" src=\"http://openweathermap.org/img/w/${iconcode}.png\" alt=\"Weather icon\"></div>`;\n return resJson;\n })\n i = i + 1;\n } \n}", "title": "" }, { "docid": "6873325e1bd20cfac01553f32c6ad01d", "score": "0.4991656", "text": "function updateData(id) {\n title.style.borderBottom = '2px solid rgb(48, 212, 178)';\n patTimes.style.display = 'block';\n $('.pInd').remove();\n\n // Search for parsed location ID in object\n for (var i = 0; i < data.length; ++i) {\n if (data[i].locId == id) {\n \n pos = i;\n\n title.innerHTML = data[i].name;\n subtitle.innerHTML = 'Weather:'\n\n // Display areas\n weatherOutput.style.display = 'block';\n tempOutput.style.display = 'block';\n\n if (data[i].images == false) {\n console.log('no images.');\n carousel.style.display = 'none';\n\n } else {\n carousel.style.display = 'block';\n\n // Add images to slidewhow\n img1.setAttribute('src', data[i].images[0]);\n img2.setAttribute('src', data[i].images[1]);\n img3.setAttribute('src', data[i].images[2]);\n img4.setAttribute('src', data[i].images[3]);\n // Show slider\n }\n\n // Show / hide delete button for default / user inputed points\n if (data[i].default == true) {\n rmArr.style.display = 'none';\n } if (data[i].default == false) {\n rmArr.style.display = 'block';\n }\n\n // Concatenate API call URL\n var apiCall = 'http://api.openweathermap.org/data/2.5/weather?lat=' + data[i].lat + '&lon=' + data[i].lon + '&units=metric&appid=' + secret.openWeather;\n uvCall = 'http://api.openweathermap.org/data/2.5/uvi?appid=' + secret.openWeather + '=' + data[i].lat + '&lon=' + data[i].lon;\n\n // Call API using var apiCall, then parse JSON object into function\n $.getJSON(apiCall, weatherCallback);\n\n for (var x = 0; x < data[i].patrolled.length; ++x) {\n if (data[i].patrolled[x] == 0) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n mon.appendChild(img);\n }\n if (data[i].patrolled[x] == 1) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n tue.appendChild(img);\n }\n if (data[i].patrolled[x] == 2) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n wed.appendChild(img);\n\n }\n if (data[i].patrolled[x] == 3) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n thu.appendChild(img);\n }\n if (data[i].patrolled[x] == 4) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n fri.appendChild(img);\n }\n if (data[i].patrolled[x] == 5) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n sat.appendChild(img);\n }\n if (data[i].patrolled[x] == 6) {\n var img = document.createElement('img');\n img.setAttribute('class', 'pInd');\n img.src = tick;\n sun.appendChild(img);\n }\n }\n }\n }\n}", "title": "" }, { "docid": "7a86f826e56e92b32124223817f20228", "score": "0.496673", "text": "async function getCityWeatherData (TARGET_CITIES, API_KEY, WEATHERBIT_API_URL){\n let finalizedCityWeatherInformationObject = {};\n for (let targetCity in TARGET_CITIES){\n let currentCityName = targetCity;\n let currentCityLat = TARGET_CITIES[targetCity].lat;\n let currentCityLon = TARGET_CITIES[targetCity].lon;\n console.log(\"getCityWeatherData is running for \"+currentCityName)\n try{\n finalizedCityWeatherInformationObject[targetCity] = await callWeatherAPI(\n currentCityName,\n currentCityLat,\n currentCityLon,\n API_KEY,\n WEATHERBIT_API_URL\n );\n }\n catch (error){\n return error; //returns to MainProgramLoop catch\n }\n }\n return finalizedCityWeatherInformationObject;\n}", "title": "" }, { "docid": "81da73c38eec471b7a8a981e7dcd57a4", "score": "0.4962843", "text": "function renderCities() {\n $('#cityList').empty();\n $('#search-value').val('');\n\n for (i = 0; i < cityList.length; i++) {\n var a = $('<a>');\n a.addClass(\n 'list-group-item list-group-item-action list-group-item-primary city'\n );\n a.attr('data-name', cityList[i]);\n a.text(cityList[i]);\n $('#cityList').prepend(a);\n }\n}", "title": "" }, { "docid": "6328dfef8f8518710eae439ae042716f", "score": "0.4959358", "text": "function main() {\n\t\t\"use strict\";\n\t\t// Make #project-carousel update #project-summary-text div on 'slide' \n\t\tvar projectCarousel = \"#project-carousel\";\n\t\tvar pCarouselInner = \"#carousel-inner\";\n\t\tvar summaryParagraph = \"#project-summary-text\";\n\t\tpCarUpdate(projectCarousel, pCarouselInner, summaryParagraph);\n\t}", "title": "" }, { "docid": "f4a1442398c7fb9fbba65b79a9f50e35", "score": "0.49374568", "text": "function initMapServices() {\r\n crwgPopup = new PopupTemplate({ //Popup for CRWG_Projects\r\n format: {dateFormat: 'shortDate'},\r\n title: \"Reported Projects\",\r\n description: \"<b>Project Name</b>: {Project_Name}</br>\" + \"<b>Project Org</b>: {Project_Org}</br>\" +\r\n \"<b>Population Affected</b>: {Population_Affected}</br>\" + \"<b>Criterial Manual Used</b>: {Criteria_Manuals}</br>\" +\r\n \"<b>Funding Sources</b>: {Funding_Sources}</br>\" + \"<b>Project Start Date</b>: {Project_Start_Date:DateFormat(selector: 'date', fullYear: true)}</br>\" +\r\n \"<b>Project Start Date</b>: {Project_Complete_Date:DateFormat(selector: 'date', fullYear: true)}</br>\" +\r\n \"<b>Public Notification</b>: {Public_Outreach}</br>\" + \"<b>Created By</b>: {Created_By}</br>\" + \"<b>Created on</b>:{Created_On}</br\"\r\n });\r\n DEBUG && console.log(\"initMapservices\"); \r\n crwgData = new ArcGISDynamicMapServiceLayer(url_crwgData, {});\r\n socioDemographic = new ArcGISDynamicMapServiceLayer(url_socioDemographic, {});\r\n crwg_projects = new FeatureLayer(url_crwg_projects, {\r\n mode: FeatureLayer.MODE_ONDEMAND,\r\n outFields: [\"*\"],\r\n infoTemplate: crwgPopup\r\n });\r\n tocListener = map.on('layers-add-result', initTOC);\r\n map.addLayers([crwgData, socioDemographic]);\r\n }", "title": "" }, { "docid": "f6f96cb08d02d98e6dbb962978b42966", "score": "0.49335462", "text": "renderSlides() {\n if (!this.data || !this.template) return;\n\n this.currentSlide = 0;\n this.slideContainer.innerHTML = '';\n\n this.slides = this.data.map((item) => {\n const slide = document.createElement('div');\n slide.className = 'slide';\n this.slideContainer.append(slide);\n\n const renderedTemplate = this.template(item);\n slide.innerHTML = renderedTemplate;\n\n return slide;\n });\n\n this.scrollTo(0);\n }", "title": "" }, { "docid": "29920a14bf91c1d1742871ef917b52ca", "score": "0.4924015", "text": "function weatherDataSlides(input, n) {\n\t\t// * VARIABLES *\n\t//Assigning DOM elements to variables\n\tlet top_right_panel = document.querySelector(\"#weather_API_top_right_panel\");\n\tlet bottom_left_panel = document.querySelector(\"#weather_API_bottom_left_panel\");\n\n\tlet slides = document.querySelectorAll(\".weather_slides\");\n\tlet dot_Container = document.querySelector(\"#weather_slideshow_dot_container\");\n\tlet dots = document.querySelectorAll(\".weather_slideshow_dot\");\n\tlet weather_data = document.querySelectorAll(\".animation_target_primary\");\n\tlet weather_data_title = document.querySelectorAll(\".animation_target_secondary\");\n\tlet prev = document.querySelectorAll(\".weather_arrow_prev\");\n\tlet next = document.querySelectorAll(\".weather_arrow_next\");\n\t\n\t// Manages the vaslues passed into the function, determining the required action.\n\tswitch(input){\n\t\tcase 'dot':\n\t\t\tcurrentSlide(n);\n\t\t\tbreak;\n\n\t\tcase 'show':\n\t\t\tcurrentSlide(n);\n\t\t\tprev[0].onclick = () => { plusSlides(-1) }; // listener for arrow buttons navigate -1 Slides\n\t\t\tnext[0].onclick = () => { plusSlides(1) };\t// listener for arrow buttons navigate +1 Slides\n\t\t\tbreak;\n\t}\n\n\t// Displays the next slide in the list.\n\tfunction plusSlides(n) {\n\t\tshowWeatherSlides(globalVariableStorage.weatherSlideIndex += n);\n\t};\n\t// Displays the slide at value (n).\n\tfunction currentSlide(n) {\n\t\tshowWeatherSlides(globalVariableStorage.weatherSlideIndex = n);\n\t};\n\n\t// Manages the automation of the slideshow. using setIntervals()\n\tfunction weatherSlideshowTimer() {\n\t\tif (globalVariableStorage.pageLoadSlideBoolean == true ) {\n\t\t\tglobalVariableStorage.weatherSlideShowTimer = setInterval(() => { \n\t\t\t\tplusSlides(1);\n\t\t\t}, 6000);\n\n\t\t\tglobalVariableStorage.pageLoadSlideBoolean = false;\n\n\t\t}else {\n\t\t\tclearInterval(globalVariableStorage.weatherSlideShowTimer);\n\t\t\tglobalVariableStorage.weatherSlideShowTimer = setInterval(() => {\n\t\t\t\tplusSlides(1);\n\t\t\t}, 6000);\n\t\t}\n\t};\n\n\t// Handles the animations / transitions when a slide progresses.\n\tfunction weatherSlideshowAnimation(slide, title) {\n\t\tslide.animate(\n\t\t\t[\n\t\t\t\t{transform: 'translateX(40%)', opacity: '0.1'},\n\t\t\t\t{transform: 'translateX(0%)', opacity: '1'},\n\t\t\t\t{fontsize: '3em', opacity: '1'},\n\t\t\t\t{transform: 'translateX(0%)', opacity: '1'},\n\t\t\t\t{transform: 'translateX(0%)', opacity: '1'},\n\t\t\t\t{transform: 'translateX(-40%)', opacity: '0.1'},\n\t\t\t], { duration: 6000 });\n\n\t\ttitle.animate(\n\t\t\t[\n\t\t\t\t{opacity: '0.1', visibility: 'visible'},\n\t\t\t\t{opacity: '1'},\n\t\t\t\t{opacity: '1'},\n\t\t\t\t{opacity: '1'},\n\t\t\t\t{opacity: '0.1', visibility: 'hidden'},\n\t\t\t], { duration: 6000 });\t\n\t};\n\n\t// Handles displaying the slides each time a new slide is requested.\n\tfunction showWeatherSlides(slideRequest) {\n\t\t//Displays slide content\n\t\tprev[0].style.visibility = \"visible\";\n\t\tnext[0].style.visibility = \"visible\";\n\t\tdot_Container.style.visibility = \"visible\";\n\n\t\t// Makes On Screen Panels Visible (Top Right & Bottom Left Panels)\n\t\ttop_right_panel.className = top_right_panel.className.replace(\"d-none\", \"\");\n\t\tbottom_left_panel.className = bottom_left_panel.className.replace(\"d-none\", \"\");\n\n\t\t// code to handle if slide is too low / High\n\t\tif (slideRequest > slides.length) {globalVariableStorage.weatherSlideIndex = 1}\n\t\tif (slideRequest < 1) {globalVariableStorage.weatherSlideIndex = slides.length}\n\n\t\t// Sets ALL Slides display to none when showSlides() is called\n\t\tfor (i = 0; i < slides.length; i++) {\t\n\t\t\tslides[i].style.display = \"none\";\n\t\t}\n\n\t\t// Sets ALL dots display to none when showSlides() is called\n\t\tfor (i = 0; i < dots.length; i++) {\n\t\t\tdots[i].style.visibility = \"visible\";\n\t\t \tdots[i].className = dots[i].className.replace(\" active-dot\", \"\");\n\t\t}\n\n\t\t// Displays the dot and slide at what ever location/index weatherSlideIndex is set at\n\t\tslides[globalVariableStorage.weatherSlideIndex-1].style.display = \"block\";\n\t\tdots[globalVariableStorage.weatherSlideIndex-1].className += \" active-dot\";\n\n\t\t// Calling Slideshow transition / Animation Logic\n\t\tweatherSlideshowAnimation(weather_data[globalVariableStorage.weatherSlideIndex-1], \n\t\t\tweather_data_title[globalVariableStorage.weatherSlideIndex-1]);\n\t\t\n\t\t//Calling Slideshow Automation / Timer\n\t\tweatherSlideshowTimer();\n\t};\n}", "title": "" }, { "docid": "c0f9c885e3c8691d80075564da3c3cdb", "score": "0.49221766", "text": "function populateCities(){\n \t// get the cities for the current state\n \tvar cities=stateData[states.value]\n \tconsole.log(cities)\n \n \t//loop through the cities\n \tfor(var i = 0; i < cities.length; i++){\n \t\tvar li = document.getElementById(\"city\"+(i+1))\n \t\tli.innerHTML = cities[i]\n \t}\n }", "title": "" }, { "docid": "fc2af6b135c0938fa0125fb7aa993357", "score": "0.49207902", "text": "function displaySearchCity(matchedCities){\n if (matchedCities.length > 0){\n const display = matchedCities.map(city => {\n const citydisp =\n `\n <div class=\"city-list\" id=\"city-list\">\n ${city}\n </div>\n ` ;\n return citydisp;\n }).join(\"\");\n\n matchList.innerHTML = display; \n \n $(\".city-list\").click((e) => {\n search.value = `${e.target.innerText}`;\n matchList.innerHTML='';\n });\n \n addCity.onclick = () => {\n\n const new_search = search.value.replace(/ /g, \"_\");\n \n const regionUrls = [\n `https://worldtimeapi.org/api/timezone/Africa/${new_search}`,\n `https://worldtimeapi.org/api/timezone/America/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Antarctica/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Asia/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Atlantic/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Autstralia/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Europe/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Pacific/${new_search}`,\n `https://worldtimeapi.org/api/timezone/Indian/${new_search}`,\n `https://worldtimeapi.org/api/timezone/America/Argentina/${new_search}`\n ]\n\n Promise.all(regionUrls.map(url => \n fetch(url)\n .then((res) => res.json())\n .catch(error => console.log(error))\n ))\n\n .then((data) => {\n \n\n const getCityTime = () => {\n\n const getExactCityTime = () => {\n\n const timeArr = [\n data[0].datetime,\n data[1].datetime,\n data[2].datetime,\n data[3].datetime,\n data[4].datetime,\n data[5].datetime,\n data[6].datetime,\n data[7].datetime,\n data[8].datetime,\n data[9].datetime\n ]\n\n \n const filterTimeArr = timeArr.filter(item => item !== undefined)\n\n const date = moment.parseZone(\"\" + filterTimeArr[0]);\n let hours = \"\" + date.hours();\n let minutes = \"\" + date.minutes();\n let daytime = hours >= 12 ? \"PM\":\"AM\";\n hours = hours % 12;\n hours = hours.length < 2 ? \"0\" + hours:hours;\n hours = hours ? hours : 12;\n minutes = minutes.length < 2 ? \"0\"+minutes:minutes;\n return `${hours}:${minutes} <span>${daytime}</span>`; \n }\n\n let cityTime = `\n <div class=\"col-lg-4 clock-col\" id=\"clock-col\">\n <div class=\"round-clock\">\n <div class=\"inner-round\">\n <small id=\"check\">${search.value}</small>\n <p id=\"check-time\">${getExactCityTime()}</p>\n </div>\n </div>\n </div>\n `\n \n return cityTime;\n }\n\n if(matchedCities.indexOf(search.value) > -1){\n worldTime.innerHTML += getCityTime();\n worldTimeArr.push(getCityTime());\n localStorage.setItem('cityClock', JSON.stringify(worldTimeArr.slice(0, 3)));\n\n } else {\n alert(\"The city you entered does not exist\")\n }\n \n \n \n if (worldTimeArr.length > 3){\n localStorage.clear();\n alert(\"You can only add a maximum of 3 clocks. You can start over again\");\n location.reload();\n }\n \n if(worldTime.childElementCount > 3){\n worldTime.innerHTML = getCityTime();\n }\n\n // worldTime.ondblclick = (e) => {\n // e.target.style.display = \"none\";\n // cityClock.splice(cityClock.indexOf(cityTime), 1);\n // localStorage.setItem('cityClock', JSON.stringify(worldTimeArr));\n // // localStorage.clear()\n // } \n \n \n }) \n }\n\n refresh.onclick = () =>{\n localStorage.clear();\n location.reload();\n }\n}\n}", "title": "" }, { "docid": "95b56bf297489ae7f40f043fc86b2ac0", "score": "0.4915036", "text": "function dealWithCityData(cityData) {\n\t\t// console.log('cityData =', cityData);\n\t\t// console.log('cityData =', symbolDictionary[cityData.weather[0].icon] );\n\t\tcityNameTitle.html(\n\t\t\tcityData.name + \" \" + '<i class=\"wi ' + symbolDictionary[cityData.weather[0].icon] + ' main-icon\"></i>'\n\t\t);\n\n\t\tcityTemp.html(\"Temperature: \" + cityData.main.temp + '<span class=\"units\"> ºCelsius </span>');\n\t\tcityHumid.html(\"Humidity: \" + cityData.main.humidity + '<span class=\"units\"> % </span>');\n\t\tcityWind.html(\"Wind Speed: \" + cityData.wind.speed + '<span class=\"units\"> meter/sec </span>');\n\n\t\t// get lat and long coordinates to search for uv from second api\n\t\tcityLon = cityData.coord.lon\n\t\tcityLat = cityData.coord.lat\n\t\t// console.log([cityLat, cityLon]);\n\t\treturn [cityLat, cityLon];\n\t}", "title": "" }, { "docid": "2bb5f4ba4327dc7d3e368b40a7512e41", "score": "0.49022338", "text": "function populateSlides(callback) {\r\n\r\n\t\tvar $slides = $('.reveal .slides');\r\n\t\tvar $backgrounds = $('.reveal .backgrounds')\r\n\r\n\t\tvar newSlidesArray = \"\";\r\n\t\tvar newBackgrounds = \"\";\r\n\r\n\t\tvar $dataSlides = $('#data');\r\n\r\n\t\tvar $startSlides = $selectedSlides.find('section.sortableSlide');\r\n\t\tvar n = $startSlides.length;\r\n\t\tfor (var i = 0; i < n; i++)\r\n\t\t{\r\n\t\t\tvar $slide = $($startSlides[i]);\r\n\t\t\tvar data = $slide.data();\r\n\t\t\tvar sourceSlideHTML;\r\n\t\t\tvar $sourceSlide;\r\n\r\n\t\t\tvar $existingSlide = $slides.find('[data-id=\"'+data.id+'\"]');\r\n\t\t\tif ($existingSlide.length)\r\n\t\t\t{\r\n\t\t\t\tsourceSlideHTML = $existingSlide.outerHTML();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tsourceSlideHTML = $dataSlides.find('[data-id=\"'+data.id+'\"]').outerHTML();\r\n\t\t\t}\r\n\r\n\t\t\t$sourceSlide = $(sourceSlideHTML);\r\n\t\t\tnewSlidesArray += sourceSlideHTML;\r\n\t\t\tvar sourceData = $sourceSlide.data();\r\n\t\t\tvar backgroundImage = sourceData.backgroundImage;\r\n\t\t\tvar attachment = sourceData.backgroundType == Templates.BACKGROUND_TYPE_RIGHT ? '' : 'fixed';\r\n\t\t\tif (backgroundImage != \"img/\")\r\n\t\t\t\tnewBackgrounds += '<div data-id=\"'+data.id+'\" style=\"background: url('+backgroundImage+') no-repeat center center '+attachment+'; background-size: cover\"></div>';\r\n\t\t\telse\r\n\t\t\t\tnewBackgrounds += '<div></div>';\r\n\t\t}\t\t\r\n\r\n\t\t$slides.html(newSlidesArray);\r\n\t\t$backgrounds.html(newBackgrounds);\r\n\t}", "title": "" }, { "docid": "18d8f0f4979db0d2a73a65216834c876", "score": "0.4899937", "text": "function generateCard(city) {\n var newCard = $(`<div id=\"card1\" class=\"col-md-4\"><div class=\"card\"><h5 id=\"city-name\">${city}</h5><div class='map' id=\"newMap\"></div><div class=\"card-info-box\">\n <h4 id=\"accommodation-name${cardIdx}\"></h4>\n <p>Price <span id=\"price-id${cardIdx}\"></span> </p><p>Rating <span id=\"rating-id${cardIdx}\"></span></p><button href=\"#\" class=\"btn btn-outline-dark\">More Info</button>\n\n </div><div id=\"carouselExampleControls${cardIdx}\" class=\"carousel slide\" data-ride=\"carousel\"><div class=\"carousel-inner\">\n <div class=\"carousel-item active\"><img id=\"img-accommodation-0-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-1.jpeg\" alt=\"First slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-1-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-2.jpeg\" alt=\"Second slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-2-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-3-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-4-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-5-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-6-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-7-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-8-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n <div class=\"carousel-item\"><img id=\"img-accommodation-9-${cardIdx}\" class=\"d-block w-100\" src=\"assets/img/hotel-3.jpeg\" alt=\"Third slide\"></div>\n </div><a class=\"carousel-control-prev\" href=\"#carouselExampleControls${cardIdx}\" role=\"button\" data-slide=\"prev\"><span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span><span class=\"sr-only\">Previous</span></a><a class=\"carousel-control-next\" href=\"#carouselExampleControls${cardIdx}\" role=\"button\" data-slide=\"next\"><span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span><span class=\"sr-only\">Next</span></a></div></div></div>`);\n\n\n $('#bodyRow').append(newCard);\n}", "title": "" }, { "docid": "568d3f0dc3d758615da05450a44c503a", "score": "0.48981446", "text": "function renderCities(){\n citiesArea.innerHTML = \"\"\n for(var i = 0; i< searches.length ; i++) {\n var span = document.createElement('span');\n var txt = document.createTextNode(searches[i]);\n span.className = 'd-block bg-light p-2 mb-1';\n span.appendChild(txt);\n span.addEventListener('click' ,function(){\n getWeather(this.textContent)\n removeActiveClass()\n this.classList.add(\"active\")\n })\n citiesArea.appendChild(span);\n\n document.querySelector('.cities-list span:first-child').classList.add('active');\n }\n}", "title": "" }, { "docid": "0b0152d9ef4d73c093cf70e4aa99ded8", "score": "0.48811355", "text": "function showWeather(response) {\n console.log(response);\n let cityName = document.querySelector(\"#city-name\");\n let pageTitle = document.querySelector(\"title\");\n cityName.innerHTML = `${response.data.name}`;\n pageTitle.innerHTML = `Current Weather in ${response.data.name}`;\n\n let currTemp = document.getElementById(\"current-temp\");\n currTemp.innerHTML = `${Math.round(response.data.main.temp)}°`;\n\n let feelsLike = document.getElementById(\"feels-like-temp\");\n feelsLike.innerHTML = `${Math.round(response.data.main.feels_like)}°`;\n feelsLike.classList.add(\"bold\");\n\n let currCond = document.getElementById(\"current-cond\");\n currCond.innerHTML = `${response.data.weather[0].main}`;\n currCond.classList.add(\"bold\");\n\n let currHumidity = document.getElementById(\"current-humidity\");\n currHumidity.innerHTML = `${response.data.main.humidity}%`;\n currHumidity.classList.add(\"bold\");\n\n let currWindDir = document.getElementById(\"current-wind-dir\");\n currWindDir.innerHTML = `${windDirCompass(response.data.wind.deg)}`;\n currWindDir.classList.add(\"bold\");\n\n let currWindSpeed = document.getElementById(\"current-wind-speed\");\n currWindSpeed.innerHTML = `${Math.round(response.data.wind.speed)} mph`;\n currWindSpeed.classList.add(\"bold\");\n\n let currentConditionIcon = document.querySelector(\"#cond-icon\");\n let conditionId = response.data.weather[0].id;\n let time = response.data.dt;\n let sunset = response.data.sys.sunset;\n let sunrise = response.data.sys.sunrise;\n console.log(conditionId, time, sunrise, sunset);\n currentConditionIcon.setAttribute(\n \"class\",\n `${weatherIcon(conditionId, time, sunset, sunrise)}`\n );\n\n backgroundChange(time, sunrise, sunset);\n getForecast(response.data.coord);\n}", "title": "" }, { "docid": "0b5ce825370c5a1cc7589ef0ccb95ace", "score": "0.48761514", "text": "function setSlidesAndWrapper() {\n var i;\n zwiperSlides = zwiperContainer.querySelectorAll('.' + zwiperSettings.slide);\n console.log('Number of slides: ', zwiperSlides.length);\n\n // create wrapper that serves as the sliding element\n zwiperWrapper = document.createElement('div');\n addClass(zwiperWrapper, 'zwiper-wrapper');\n\n for (i = 0; i < zwiperSlides.length; i += 1) {\n zwiperWrapper.appendChild(zwiperSlides[i]);\n }\n\n zwiperContainer.appendChild(zwiperWrapper);\n\n // set width for each of the slides\n for (i = 0; i < zwiperSlides.length; i += 1) {\n zwiperSlides[i].setAttribute('style', 'width: ' + zwiperContainerWidth + 'px;');\n }\n\n // wrapper is container width * nr of slides\n zwiperWrapper.setAttribute('style', 'width: ' + (zwiperContainerWidth * zwiperSlides.length) + 'px;');\n zwiperWrapper.style[prefixProp.transform] = 'translate3D(0,0,0)';\n }", "title": "" }, { "docid": "5d0faf52da4946b5965d18b5729c8758", "score": "0.48749", "text": "function displayCityInfo() {\r\n\r\n var city = $(this).attr(\"data-name\");\r\n console.log(city);\r\n $(\"#weather-forecast\").empty();\r\n \r\n //function to display current weather conditions on selected city\r\n function displayWeather(){\r\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?\" + \"q=\" + city + \"&appid=\" + \"166a433c57516f51dfab1f7edaed8413\";\r\n\r\n $.ajax({\r\n url: queryURL,\r\n method: \"GET\"\r\n }).then(function(response) {\r\n //console log to view object returned by API call\r\n console.log(response);\r\n \r\n var cityDiv = $(\"<div class='city'>\");\r\n //convert degrees K to degrees F\r\n var Ftemp = (response.main.temp - 273.15) *1.8 +32;;\r\n var humidity = (response.main.humidity);\r\n var windSpeed = (response.wind.speed);\r\n \r\n //generates html to page\r\n var hOne = $(\"<h3>\").text(\"Current weather conditions for \" + city);\r\n var pOne = $(\"<p>\").text(\"Temperature: \" + Ftemp.toFixed(0) + \" °F\");\r\n var pTwo = $(\"<p>\").text(\"Humidity: \" + humidity + \"%\");\r\n var pThree = $(\"<p>\").text(\"Wind Speed: \" + windSpeed.toFixed(0) + \" m.p.h.\");\r\n var hTwo = $(\"<h4>\").text(\"5-Day Forecast for \" + city);\r\n \r\n cityDiv.append(hOne, pOne, pTwo, pThree, hTwo);\r\n \r\n //removes prior weather info and updates with latest city click\r\n $(\"#current-weather\").empty();\r\n $(\"#current-weather\").prepend(cityDiv);\r\n\r\n uvNice(response.coord.lat, response.coord.lon);\r\n });\r\n };\r\n \r\n //currently still in development to show UV Index under current weather conditions\r\n function uvNice(lat,lon) {\r\n \r\n var queryURL = \"https://api.openweathermap.org/data/2.5/uvi?appid=166a433c57516f51dfab1f7edaed8413\" + lat + \"&lon=\" + lon;\r\n\r\n $.ajax({\r\n url: queryURL,\r\n method: \"GET\"\r\n }).then(function(response) {\r\n \r\n console.log(response);\r\n \r\n });\r\n };\r\n // API call to return 5-day forecast for selected city\r\n function fiveDay() {\r\n console.log(city);\r\n var queryURL = \"https://api.openweathermap.org/data/2.5/forecast?\" + \"q=\" + city + \"&appid=\" + \"166a433c57516f51dfab1f7edaed8413\";\r\n\r\n $.ajax({\r\n url: queryURL,\r\n method: \"GET\"\r\n }).then(function(response) {\r\n \r\n console.log(response);\r\n\r\n // create loop through array for forecasted tempts at noon daily\r\n for (var i = 0; i < response.list.length; i++) {\r\n \r\n if (response.list[i].dt_txt.indexOf(\"12:00:00\") !== -1) {\r\n \r\n // create card content for weather forecast\r\n var col = $(\"<div class='col-md-2'>\");\r\n var card = $(\"<div class='bg-primary text-white'>\");\r\n var body = $(\"<div class='card-body p-2'>\");\r\n \r\n var date = $(\"<h5>\").addClass(\"card-title\").text(new Date(response.list[i].dt_txt).toLocaleDateString());\r\n \r\n var png = $(\"<img>\").attr(\"src\", \"http://openweathermap.org/img/w/\" + response.list[i].weather[0].icon + \".png\");\r\n \r\n var pOne = $(\"<p>\").addClass(\"card-text\").text(\"Temp: \" + ((response.list[i].main.temp_max - 273.15) * 1.8 + 32).toFixed(0)+ \" °F\");\r\n var pTwo = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + response.list[i].main.humidity + \"%\");\r\n \r\n //appends data to the page\r\n $(\"#weather-forecast\").append(col);\r\n \r\n col.append(card.append(body.append(date, png, pOne, pTwo)));\r\n $(\"#weather-forecast\").prepend(col);\r\n }\r\n }\r\n });\r\n }\r\n\r\n displayWeather();\r\n fiveDay();\r\n }", "title": "" }, { "docid": "e0a22f98e90b84192ec3f67496a6c56f", "score": "0.48687142", "text": "function displayCityWeather(response, uvResponse, forecastResponse) {\n $(\"#city-data > p\").remove();\n var weatherIcon = $(\"<img>\").attr(\n \"src\",\n \"http://openweathermap.org/img/wn/\" + response.weather[0].icon + \".png\"\n );\n $(\"#city-name\").text(response.name + \" (\" + moment().format(\"M/D/Y\") + \")\");\n $(\"#city-name\").append(weatherIcon);\n var temp = $(\"<p>\").text(\"Temperature: \" + response.main.temp + \"\\xB0F\");\n var humidity = $(\"<p>\").text(\"Humidity: \" + response.main.humidity + \"%\");\n var windSpeed = $(\"<p>\").text(\"Wind Speed: \" + response.wind.speed + \" MPH\");\n var uvSpan = $(\"<span>\")\n .text(uvResponse.value)\n .addClass(\"rounded\");\n if (uvResponse.value <= 3) {\n uvSpan.attr(\"style\", \"background-color: lightgreen\");\n } else if (uvResponse.value > 3 && uvResponse.value <= 7) {\n uvSpan.attr(\"style\", \"background-color: lightsalmon\");\n } else if (uvResponse.value > 7) {\n uvSpan.attr(\"style\", \"background-color: red\");\n }\n var uvIndex = $(\"<p>\")\n .text(\"UV Index: \")\n .append(uvSpan);\n $(\"#city-data\").append(temp);\n $(\"#city-data\").append(humidity);\n $(\"#city-data\").append(windSpeed);\n $(\"#city-data\").append(uvIndex);\n // This part generates the cards\n $(\"#forecast-list\").empty();\n $(\"#forecast > h3\").remove();\n $(\"#forecast\").prepend($(\"<h3>\").text(\"5-day forecast: \"));\n for (let i of forecastResponse.list) {\n // Next line limits the # of results for each day\n if (/12:00:00/.test(i.dt_txt)) {\n var forecastDiv = $(\"<div>\").addClass(\"card\");\n var date = /^\\d+-\\d+-\\d+/.exec(i.dt_txt)[0];\n var formattedDate = moment(date).format(\"M/D/Y\");\n forecastDiv.append(\n $(\"<h5>\")\n .addClass(\n \"card-ti tle\"\n )\n .text(formattedDate)\n );\n forecastDiv.append(\n $(\"<img>\").attr(\n \"src\",\n \"http://openweathermap.org/img/wn/\" + i.weather[0].icon + \".png\"\n )\n );\n forecastDiv.append(\n $(\"<p>\").text(\"Temperature: \" + i.main.temp + \"\\xB0F\")\n );\n forecastDiv.append($(\"<p>\").text(\"Humidity: \" + i.main.humidity + \"%\"));\n var cardColumn = $(\"<div>\").addClass(\"col-sm-2\");\n cardColumn.append(forecastDiv);\n $(\"#forecast-list\").append(cardColumn);\n }\n }\n}", "title": "" }, { "docid": "dcf386112d358c3b6f05cd137a2e1625", "score": "0.48675492", "text": "function ShowCityTemp(response) {\n let located_city = document.querySelector(\"h2\");\n let FullDate = document.querySelector(\"#full-date\");\n let month = update.getMonth() + 1;\n let Day = update.getDate();\n let year = update.getFullYear();\n let fullDate = `${month}/${Day}/${year}`;\n let dateElement = document.querySelector(\"#time\");\n let windDirect = document.querySelector(\"#direction\");\n let wind = document.querySelector(\"#wind\");\n let precip = document.querySelector(\"#precip\");\n let temp = document.querySelector(\".current\");\n let iconElement = document.querySelector(\"#icon\");\n let iconInfo = document.querySelector(\"#iconInfo\");\n let iconID = response.data.weather[0].icon;\n let highTemp = document.querySelector(\"#high\");\n let lowTemp = document.querySelector(\"#low\");\n let RealFeel = document.querySelector(\"#Real-feel\");\n let sunrise = document.querySelector(\"#sunrise\");\n let sunset = document.querySelector(\"#sunset\");\n ////////////////////////////////////////////////////\n FahrenheitTemp = response.data.main.temp;\n HighTemp = response.data.main.temp_max;\n LowTemp = Math.round(response.data.main.temp_min);\n Feel = response.data.main.feels_like;\n located_city.innerHTML = response.data.name;\n temp.innerHTML = Math.round(FahrenheitTemp);\n dateElement.innerHTML = formatDate(response.data.dt * 1000);\n FullDate.innerHTML = fullDate;\n windDirect.innerHTML = response.data.wind.deg;\n wind.innerHTML = Math.round(response.data.wind.speed);\n precip.innerHTML = response.data.main.humidity;\n iconElement.setAttribute(\n \"src\",\n `http://openweathermap.org/img/wn/${iconID}@2x.png`\n );\n iconInfo.innerHTML = response.data.weather[0].description.toUpperCase();\n highTemp.innerHTML = Math.round(HighTemp);\n lowTemp.innerHTML = Math.round(LowTemp);\n RealFeel.innerHTML = Math.round(Feel);\n sunrise.innerHTML = FormatHours(response.data.sys.sunrise * 1000);\n sunset.innerHTML = FormatHours(response.data.sys.sunset * 1000);\n //FUnction Calls for Funny sayings function\n let Ftemp = temp.innerHTML;\n Funny(Ftemp);\n let InfoIcon = iconInfo.innerHTML;\n FunnyPT2(InfoIcon);\n //Function for wind direcitions\n let windCode = windDirect.innerHTML;\n windDirection(windCode);\n console.log(windCode);\n}", "title": "" }, { "docid": "d2c8b84107e26e1af217e2e7f55e53cf", "score": "0.48673564", "text": "function showTempAndCity(response) {\n document.querySelector(\"#your-city\").innerHTML = response.data.name;\n let temperature = Math.round(response.data.main.temp);\n let tempChange = document.querySelector(\"#maindaytemp\");\n tempChange.innerHTML = `${temperature}`;\n let wind = Math.round(response.data.wind.speed) * 3.6;\n let humidity = Math.round(response.data.main.humidity);\n let desription = (response.data.weather[0].main);\n let windChange = document.querySelector(\"#otherweather\");\n let descriptionChange = document.querySelector (\"#maindescription\");\n windChange.innerHTML = `Humidity: ${humidity} % <br /> Wind: ${wind} km/h`;\n descriptionChange.innerHTML = `${desription}`;\n\n celsiusTemp = response.data.main.temp;\n\n let iconChange = document.querySelector (\"#icon-today\");\n if(response.data.weather[0].icon === \"01d\" || response.data.weather[0].icon === \"01n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-sun weathermain\");\n } else if(response.data.weather[0].icon === \"02d\" || response.data.weather[0].icon === \"02n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-cloud-sun weathermain\");\n } else if(response.data.weather[0].icon === \"03d\" || response.data.weather[0].icon === \"03n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-cloud weathermain\");\n } else if(response.data.weather[0].icon === \"04d\" || response.data.weather[0].icon === \"04n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-cloud weathermain\");\n } else if(response.data.weather[0].icon === \"09d\" || response.data.weather[0].icon === \"09n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-cloud-showers-heavy weathermain\");\n } else if(response.data.weather[0].icon === \"10d\" || response.data.weather[0].icon === \"10n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-cloud-rain weathermain\");\n } else if(response.data.weather[0].icon === \"11d\" || response.data.weather[0].icon === \"11n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-bolt weathermain\");\n } else if(response.data.weather[0].icon === \"13d\" || response.data.weather[0].icon === \"13n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-snowflake weathermain\");\n } else if(response.data.weather[0].icon === \"50d\" || response.data.weather[0].icon === \"50n\") {\n iconChange.setAttribute(\"class\", \"col-6 fas fa-water weathermain\");\n };\n\n}", "title": "" }, { "docid": "3a4aeafe3a45553a7077bcbf0f9eb424", "score": "0.48639676", "text": "function createWeatherElements(createElement, createWeatherTemplate, locations) {\n return locations\n .filter(location => location.id !== null && location.city !== undefined)\n .map(createWeatherTemplate)\n .map(createElement);\n }", "title": "" }, { "docid": "247d17d1c0240130a8ca9576ed984fe9", "score": "0.48592073", "text": "getWeather(selectedCity) {\n this.service.getWeather(selectedCity).then(data => {\n let weatherResult = JSON.parse(data);\n this.location = selectedCity;\n weatherResult = weatherResult.query.results.channel.item.forecast;\n weatherResult = Utils.sliceArray(0,7,weatherResult);\n this.weatherListPanel.innerHTML = '';\n for(let i in weatherResult) {\n this.constructWeatherListHtml(weatherResult[i])\n }\n });\n }", "title": "" }, { "docid": "63516664e23e9669bdd616291090f67b", "score": "0.48374796", "text": "gatherTranslatedData() {\n let startPosition;\n const clonedIdPrefix = this.carouselService.clonedIdPrefix;\n const activeSlides = this.slidesData\n .filter(slide => slide.isActive === true)\n .map(slide => {\n const id = slide.id.indexOf(clonedIdPrefix) >= 0 ? slide.id.slice(clonedIdPrefix.length) : slide.id;\n return {\n id: id,\n width: slide.width,\n marginL: slide.marginL,\n marginR: slide.marginR,\n center: slide.isCentered\n };\n });\n startPosition = this.carouselService.relative(this.carouselService.current());\n this.slidesOutputData = {\n startPosition: startPosition,\n slides: activeSlides\n };\n }", "title": "" }, { "docid": "37bcf8fb86393cd31e8303cf0f7ace60", "score": "0.4822278", "text": "function initCityLayer() {\n\n cityLayer = layer.createSubLayer({\n sql: \"SELECT * FROM \" + window.gw.environment + \" WHERE alttypeslug = 'City'\",\n cartocss: \"#layer { marker-fill: red; }\", // TODO: Hardcoded\n interactivity: 'cartodb_id, slug'\n });\n\n subLayers.push(cityLayer);\n\n cityTooltip = new cdb.geo.ui.Tooltip({\n layer: cityLayer,\n template: '<div class=\"cartodb-tooltip-content-wrapper\"> <div class=\"cartodb-tooltip-content\"><p>{{slug}}</p></div></div>',\n width: 200,\n position: 'bottom|right'\n });\n }", "title": "" }, { "docid": "3557bf25d47542283845848684263357", "score": "0.47984383", "text": "function renderCities() {\n $(\"#city-list\").empty();\n for (let i = 0; i < cities.length; i++) {\n var cityButton = $(\"<a>\")\n cityButton.addClass(\"list-group-item list-group-item-action\")\n cityButton.attr(\"data-name\", cities[i]);\n cityButton.text(cities[i]);\n $(\"city-list\").append(cityButton);\n }\n}", "title": "" }, { "docid": "1711b5b62715f4a3981b54b82ff85e9f", "score": "0.47971934", "text": "function renderCities() {\n\n $(\".pastSearchContainer\").empty();\n\n for (let i = 0; i < cities.length; i++) {\n\n let pastCitySearches = $(\"<button>\").text(cities[i]);\n $(\".pastSearchContainer\").append(pastCitySearches);\n\n }\n\n}", "title": "" }, { "docid": "74f558adf0642ec7fd638821151b7b85", "score": "0.4794939", "text": "function callWeather(city) {\n // Call for initial city's weather\n $.get(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}&units=imperial`, data => {\n let icon = \"https://openweathermap.org/img/wn/\" + data.weather[0].icon + \"@2x.png\";\n let latitude = data.coord.lat;\n let longitutde = data.coord.lon;\n cityDate.text(`${city} (${moment().format('L')})`);\n iconCity.attr('src', icon);\n temp.text(`Temperature: ${data.main.temp} °F`);\n humidity.text(`Humidity: ${data.main.humidity}%`);\n speed.text(`Wind Speed: ${data.wind.speed} MPH`)\n // Call for initial city's UV index\n $.get(`https://api.openweathermap.org/data/2.5/onecall?lat=${latitude}&lon=${longitutde}&appid=${apiKey}`, dataUV => {\n let uvi = dataUV.current.uvi;\n let uviRound = Math.round(uvi);\n uv.text(`UV Index: ${uvi}`);\n if (uviRound == 0) {\n uv.css(\"background-color\", \"blue\");\n uv.css(\"color\", \"white\");\n } else if (uviRound == 1) {\n uv.css(\"background-color\", \"green\");\n } else if (uviRound == 2) {\n uv.css(\"background-color\", \"lime\");\n } else if (uviRound == 3) {\n uv.css(\"background-color\", \"yellow\");\n } else if (uviRound == 4) {\n uv.css(\"background-color\", \"orange\");\n } else if (uviRound == 5) {\n uv.css(\"background-color\", \"darkred\");\n } else if (uviRound == 6) {\n uv.css(\"background-color\", \"red\");\n } else if (uviRound == 7) {\n uv.css(\"background-color\", \"purple\");\n } else if (uviRound == 8) {\n uv.css(\"background-color\", \"violet\");\n } else if (uviRound == 9) {\n uv.css(\"background-color\", \"pink\");\n } else if (uviRound == 10) {\n uv.css(\"background-color\", \"silver\");\n }\n })\n // Call for initial city's forecast\n $.get(`https://api.openweathermap.org/data/2.5/forecast?q=${cityName}&appid=${apiKey}&units=imperial`, dataFuture => {\n for (let i = 1; i <= 5; i++) {\n let newDate = moment().add(i, \"days\");\n let select = $(`.${i}`);\n let date = dataFuture.list[6 * i];\n let iconDate = \"https://openweathermap.org/img/wn/\" + date.weather[0].icon + \"@2x.png\";\n select.html(\n `<h3>${newDate.format(\"L\")}</h3>\n <img src=\"${iconDate}\"></img> \n Temp: ${date.main.temp} °F \\n\n Humidity: ${date.main.humidity}%\n `\n );\n }\n });\n })\n .fail(error =>{\n // Error prevention\n alert(\"Put in valid city!\");\n console.log(error);\n searchArray.shift();\n storage();\n addToArray();\n });\n}", "title": "" }, { "docid": "a6a5b3457522058d3c86c41bc113be1f", "score": "0.47832823", "text": "function buttonClickHandler(){\n var day1Array = [];\n console.log(\"Clicked!\");\n citySearched = $(\"#city-input\").val();\n // make an api call to retrieve info for City searched for\n queryURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + citySearched + \"&appid=\" + APIKey + tempConversion;\n let cities = localStorage.getItem(\"cities\");\n if(!cities) {\n cities = [];\n }\n else {\n cities = JSON.parse(cities);\n }\n //create a list of cities searched\n cities.push(citySearched);\n localStorage.setItem(\"cities\", JSON.stringify(cities));\n const item = $(`<li class=\"list-group-item\">${citySearched}</li>`);\n $(\"#cityStored\").append(item); \n \n //make an api call and passing the lat and long to get the uv index\n $.ajax({url: queryURL, method: \"GET\"}).then(function(response) {\n const uvUrl = `http://api.openweathermap.org/data/2.5/uvi?appid=${APIKey}&lat=${response.city.coord.lat}&lon=${response.city.coord.lon}`\n $.ajax({url: uvUrl, method: \"GET\"}).then(res => {\n console.log(response.list[0].main.temp);\n //create the card data \n let cardData = $(\n `<h2>${citySearched}<span> ${new Date(response.list[0].dt_txt).toLocaleDateString()}</span><img class=\"icon\" src=${response.list[0].icon}></h2>\n <h5>Temperature: ${response.list[0].main.temp} </h5> \n <h5>Humidity: ${response.list[0].main.humidity}</h5> \n <h5>Wind Speed: ${response.list[0].wind.speed}</h5> \n <h5>UV Index: ${res.value}</h5>`\n );\n $(\"#city-data\").empty();\n //fill the card data with the response from above \n $(\"#city-data\").append(cardData);\n })\n console.log(response.list[0]);\n var i;\n //getting info for the weather icon\n for (i = 0; i < response.list.length; i+=8) {\n day1Array.push(Object.assign(response.list[i], {icon: `http://openweathermap.org/img/wn/${response.list[i].weather[0].icon}@2x.png`}));\n } \n console.log(day1Array);\n //creating the 5-day forecast\n if ($(\"#five-day\").has(\"div\").length === 0){\n createForecast(day1Array);\n }\n else {\n $(\"#five-day > .col-sm-2\").each(function(index, element){\n console.log(\"pair:\",index, element);\n $(element).find('.temp').text(day1Array[index].main.temp);\n $(element).find('.icon').attr(\"src\", day1Array[index].icon);\n $(element).find('.humidity').text(day1Array[index].main.humidity); \n });\n }\n\n \n });\n day1Array = [];\n }", "title": "" }, { "docid": "d7bf6013c04aeaf4aac55aa904b2b151", "score": "0.4770127", "text": "function initialize(){\n cities();\n}", "title": "" }, { "docid": "8e9acd968cc139bd748549f0622c9903", "score": "0.47565913", "text": "static createVehicleElements(vehicleObjsArr) {\n if(vehicleObjsArr.length === 0) {\n //show helper callout with instructions if no vehicles at all\n $('.tap-target').tapTarget('open')\n } else {\n //show the vehicle list <ul> since we have a vehicle now.\n document.querySelector(\"#vehicle-list\").setAttribute(\"style\", \"display: block;\")\n //process through each vehicle object, create a vehicle instance, then render the vehicle. \n vehicleObjsArr.forEach(vehicleData => {\n let newVehicleInst = new Vehicle(vehicleData)\n newVehicleInst.renderVehicle()\n });\n }\n //Enables Materialize Collapsible, Dropdown, Modal, floatingActionButton after creating all the elements\n $('.collapsible').collapsible();\n $(\".dropdown-trigger\").dropdown({ hover: false});\n $('.fixed-action-btn').floatingActionButton({ hoverEnabled: false});\n $('.modal').modal();\n }", "title": "" }, { "docid": "92a281d19c17239d9fe79bed72e00789", "score": "0.47548205", "text": "function currentCondition(response) {\n // get the temperature and convert to fahrenheit \n var tempF = (response.main.temp - 273.15) * 1.80 + 32;\n tempF = Math.floor(tempF);\n // Setting div ID currentCity to empty\n $('#currentCity').empty();\n\n // Setting up HTML layout for the Current Conditions section\n var card = $(\"<div>\").addClass(\"card\");\n var cardBody = $(\"<div>\").addClass(\"card-body\");\n var city = $(\"<h4>\").addClass(\"card-title\").text(response.name + \" \" + date.toLocaleDateString('en-US'));\n var temperature = $(\"<p>\").addClass(\"card-text\").text(\"Temperature: \" + tempF + \" °F\");\n var humidity = $(\"<p>\").addClass(\"card-text\").text(\"Humidity: \" + response.main.humidity + \"%\");\n var wind = $(\"<p>\").addClass(\"card-text\").text(\"Wind Speed: \" + response.wind.speed + \" MPH\");\n var image = $(\"<img>\").attr(\"src\", \"https://openweathermap.org/img/w/\" + response.weather[0].icon + \".png\");\n var uvIdx = $('<p>').addClass('uvIdx');\n var latitude = response.coord.lat;\n var lon = response.coord.lon;\n // UV Index function to grab the UVI from the API\n function getuvIdx() {\n var uvIdxUrl =\n 'https://api.openweathermap.org/data/2.5/uvi?lat=' + latitude + '&lon=' + lon + apiKey;\n $.ajax({\n url: uvIdxUrl,\n method: 'GET'\n }).then(function (response) {\n // Setting up UV Index HTML\n var uviClass = $(\".uvIdx\");\n var uvi = response.value;\n var uviSpan = \"<span id='uvi'>\" + uvi + \"</span>\";\n uviClass.append(\"<p> UV Index: \" + uviSpan);\n // Depending on UV Index it will display the warning colors green, yellow, orange, red, and purple\n if (uvi < 3) {\n $(\"#uvi\").attr(\"style\", \"background-color: green;\");\n } else if (uvi < 6) {\n $(\"#uvi\").attr(\"style\", \"background-color: yellow; color: black;\");\n } else if (uvi < 8) {\n $(\"#uvi\").attr(\"style\", \"background-color: orange; color: black;\");\n } else if (uvi < 11) {\n $(\"#uvi\").attr(\"style\", \"background-color: red;\");\n } else if (11 <= uvi) {\n $(\"#uvi\").attr(\"style\", \"background-color: purple;\");\n }\n });\n }\n // Call UV Index Function\n getuvIdx();\n // Appending HTML together to display the current forecast\n city.append(image);\n cardBody.append(city, temperature, humidity, wind, uvIdx);\n card.append(cardBody);\n $(\"#currentCity\").append(card);\n}", "title": "" }, { "docid": "288d28b8353ed7502d21057e4cd7e0a9", "score": "0.4750784", "text": "function buildForecast(){\n let forecast = buildHTML(\"section\", \"d-flex col-12 flex-wrap justify-content-center mt-5 forecast\");\n currentWeatherEl.appendChild(forecast);\n\n let forecastHeader = buildHTML(\"div\", \"col-12\");\n forecast.appendChild(forecastHeader);\n forecastHeader.appendChild(buildHTML(\"h4\", \"forecast-title\", \"5-Day Forecast:\"));\n \n for (let i = 1; i < 6; i++){\n let forecastCard = buildHTML(\"div\", \"card d-flex flex-column align-items-center m-2\");\n forecastCard.setAttribute(\"style\", \"width: 15rem;\");\n forecast.appendChild(forecastCard);\n\n // Convert the Unix timestamps in requestedWeatherData to YYYY-MM-DD\n let forecastDateRaw = new Date(requestedWeatherData.dailyForecast[i].dt*1000);\n let forecastDate = forecastDateRaw.toLocaleDateString(\"en\");\n\n forecastCard.appendChild(buildHTML(\"h5\", \"card-title\", forecastDate));\n \n let weatherIcon = `https://openweathermap.org/img/wn/${requestedWeatherData.dailyForecast[i].weather[0].icon}@2x.png`\n let weatherIconEl = buildHTML(\"img\", \"col-4 weather-img\");\n weatherIconEl.setAttribute(\"src\", weatherIcon);\n forecastCard.appendChild(weatherIconEl);\n\n forecastCard.appendChild(buildHTML(\"p\", \"temperature\", `Temperature: ${requestedWeatherData.dailyForecast[i].temp.day} C`));\n forecastCard.appendChild(buildHTML(\"p\", \"humidity\", `Humidity: ${requestedWeatherData.dailyForecast[i].humidity}%`));\n }\n}", "title": "" }, { "docid": "1816f9933c1c61bb096b923727dd3222", "score": "0.47507742", "text": "function buildHtmlAndInteractions(init, lrnUtils) {\n\n const width = 600,\n height = 500,\n sens = 0.25;\n\n //Set the projection\n const projection = d3.geo.orthographic()\n .scale(245)\n .rotate([0, 0])\n .translate([width / 2, height / 2])\n .clipAngle(90);\n const path = d3.geo.path().projection(projection);\n\n // Build the globe DOM elements\n const svg = d3.select('.question-container').append('svg')\n .attr('id', 'globe')\n .attr('width', width)\n .attr('height', height);\n\n // Render water paths on the globe\n svg.append('path')\n .datum({ type: 'Sphere' })\n .attr('class', 'water')\n .attr('d', path);\n\n // Add a tooltip to display country names on hover\n const countryTooltip = d3.select('body').append('div').attr('class', 'countryTooltip');\n\n // Load the required geo and country name data\n queue()\n .defer(d3.json, 'helpers/geo/world-110m.json')\n .defer(d3.tsv, 'helpers/geo/world-110m-country-names.tsv')\n .await(ready);\n\n function ready(error, world, countryData) {\n\n const countries = topojson.feature(world, world.objects.countries).features;\n\n // Build hash for looking up country names by id\n const countryById = {};\n countryData.forEach(function(d) {\n countryById[ d.id ] = d.name;\n });\n\n // Render land paths on the globe\n world = svg.selectAll('path.land')\n .data(countries)\n .enter().append('path')\n .attr('class', 'land')\n .attr('d', path)\n .attr('id', d => d.id);\n\n // Rerender globe on drag event\n svg.selectAll('path').call(d3.behavior.drag()\n .origin(function() {\n const r = projection.rotate();\n return { x: r[0] / sens, y: -r[1] / sens };\n })\n .on('drag', function() {\n const rotate = projection.rotate();\n projection.rotate([d3.event.x * sens, -d3.event.y * sens, rotate[2]]);\n svg.selectAll('path.land').attr('d', path);\n }));\n\n // Country event handlers\n svg.selectAll('path.land')\n // Display country name in tooltip on hover\n .on('mouseover', function(d) {\n countryTooltip.text( countryById[d.id] )\n .style('left', (d3.event.pageX + 7) + 'px')\n .style('top', (d3.event.pageY - 15) + 'px')\n .style('display', 'block')\n .style('opacity', 1);\n })\n // Hide country name tooltip on mouseout\n .on('mouseout', function(d) {\n countryTooltip.style('opacity', 0)\n .style('display', 'none');\n })\n // Move country name tooltip with cursor\n .on('mousemove', function(d) {\n countryTooltip.style('left', (d3.event.pageX + 7) + 'px')\n .style('top', (d3.event.pageY - 15) + 'px');\n })\n\n //Country click event handler\n .on('click', function() {\n // If this is actually a drag event, do nothing.\n if (d3.event.defaultPrevented) return;\n\n // Set question response to selected country\n response = countryById[ this.getAttribute('id') ];\n\n // Clear previously applied response validation styling\n d3.select('.focused').classed('invalid', false)\n .classed('valid', false);\n\n const focusedCountry = countries.find(country => {\n return country.id === parseInt( this.getAttribute('id') );\n });\n const focusedCentroid = d3.geo.centroid( focusedCountry );\n\n //Globe rotating\n (function transition() {\n d3.transition()\n .duration(1000)\n .tween('rotate', function() {\n const r = d3.interpolate(\n projection.rotate(),\n [-focusedCentroid[0], -focusedCentroid[1]]\n );\n return function(t) {\n projection.rotate( r(t) );\n svg.selectAll('path').attr('d', path)\n .classed('focused', d => d.id === focusedCountry.id);\n };\n });\n })();\n });\n };\n\n return $('#globe');\n }", "title": "" }, { "docid": "1a4a4f09eb45ec150e99b5377d9287ec", "score": "0.47506598", "text": "function getWeather(userCity) {\n\n var url = `https://api.openweathermap.org/data/2.5/weather?q=${userCity}&APPID=${apiKey}&units=imperial`;\n\n currentCity.text(userCity + \" \" + currentDate + \" \");\n\n $.ajax({\n url: url,\n method: \"GET\"\n }).done(function (response) {\n console.log(\"current city response\", response);\n\n function renderCurrentConditions() {\n\n var iconcode = response.weather[0].icon;\n\n var iconurl = \"http://openweathermap.org/img/w/\" + iconcode + \".png\";\n icon.attr('src', iconurl);\n currentCity.append(icon);\n\n\n $(\"#city-temp\").text(\"Temperature: \" + response.main.temp + \"°F\");\n $(\"#city-humidity\").text(\"Humidity: \" + response.main.humidity + \"%\");\n $(\"#city-wind-speed\").text(\"Wind Speed: \" + response.wind.speed);\n\n }\n\n var latitude = response.coord.lat;\n var longitude = response.coord.lon;\n\n var uvIndexUrl = `https://api.openweathermap.org/data/2.5/uvi?lat=${latitude}&;lon=${longitude}&APPID=${apiKey}`;\n renderCurrentConditions();\n\n $.ajax({\n url: uvIndexUrl,\n method: \"GET\"\n }).done(function (response) {\n console.log(response);\n $(\"#error\").addClass(\"hide\");\n $(\"#city-uv-index\").text(\"UV Index: \" + response.value);\n $(\"#welcome\").addClass(\"hide\");\n $(\"#weather\").removeClass(\"hide\");\n\n });\n }).fail(function (error){\n $(\"#error\").removeClass(\"hide\");\n $(\"#welcome\").addClass(\"hide\");\n $(\"#weather\").addClass(\"hide\");\n $(\"#forecast\").addClass(\"hide\");\n $(\"#cards\").addClass(\"hide\");\n\n console.log(\"City does not exist\", error);\n });\n\n\n // =================== GET 5 DAY FORECAST FROM OPENWEATHER APIs ===================\n\n var forecastUrl = `https://api.openweathermap.org/data/2.5/forecast?q=${userCity}&mode=json&APPID=${apiKey}&units=imperial`;\n\n $.ajax({\n url: forecastUrl,\n method: \"GET\"\n }).done(function (response) {\n console.log(\"forecast info\", response);\n\n var j = 1;\n for (var i = 5; i < response.list.length; i = i + 8) {\n $(\"#day-\" + j).text(response.list[i].dt_txt);\n var iconcode = response.list[i].weather[0].icon;\n var iconurl = \"http://openweathermap.org/img/w/\" + iconcode + \".png\";\n $(\"#icon-\" + j).attr(\"src\", iconurl);\n $(\"#temp-\" + j).text(\"Temp: \" + response.list[i].main.temp + \"°F\");\n $(\"#humidity-\" + j).text(\"Humidity: \" + response.list[i].main.humidity + \"%\");\n j++;\n }\n $(\"#error\").addClass(\"hide\");\n $(\"#forecast\").removeClass(\"hide\");\n $(\"#cards\").removeClass(\"hide\");\n\n });\n\n }", "title": "" }, { "docid": "39202b74baf5acdf5e90e100b7862211", "score": "0.47452775", "text": "function weatherWidgetHTMLConstruction(id, json, city){\n var count = 0;\n MaxTemp = {}; MinTemp = {}; allDays = [];\n var widget_type = $(id + ' .gadget').attr(\"weather_widget_type\");\n var html = '';\n var now = new Date();\n var day = now.getDay();\n var temp_sign = $(id + ' .gadget').attr(\"temperature\");\n\n //get the maximum temperature\n getMaxMinTemp(json);\n //onsole.log(JSON.stringify(json['list']));\n //reset the alldays array for min temp functionality\n //get the minimum temprature\n //getMinTemp(json);\n //Getting the current time in different country\n var getTime = json.list[1].dt_txt.split(' ')[1].split(\":\")[0];\n // var currHour = now.getHours();\n // var getTime = getCurrData(currHour);\n json.list.forEach(function(forecast, i) {\n //var currHour = now.getHours();\n var apiTime = forecast.dt_txt.split(' ');\n var hour = apiTime[1].split(':');\n //var getTime = getCurrData(currHour);\n if (hour[0] == getTime) {\n count++;\n if (count == 1) {\n //$(id + ' .inner-top-left .weather-icon img').attr('src', \"https://openweathermap.org/themes/openweathermap/assets/vendor/owm/img/widgets/\" + forecast.weather[0].icon + \".png\");\n if (location.protocol === \"https:\") {\n $(id + ' .inner-top-left .weather-icon img').attr('src', \"https://openweathermap.org/img/wn/\" + forecast.weather[0].icon + \"@4x.png\");\n } else {\n $(id + ' .inner-top-left .weather-icon img').attr('src', \"http://openweathermap.org/img/wn/\" + forecast.weather[0].icon + \"@4x.png\");\n }\n $(id + ' .inner-top-left .weather-city').html(dayNames[day] + \", \" + city[0] + \" \" + city[1]);\n\n if (temp_sign == 'f') {\n var temp = Math.round(forecast.main.temp * 9 / 5 + 32);\n var temp_html = \" \" + temp + String.fromCharCode(176) + 'F' + \" \";\n } else {\n var temp_html = \" \" + Math.round(forecast.main.temp) + String.fromCharCode(176) + 'C' + \" \";\n }\n $(id + ' .inner-top-right .first-day-temp').html(temp_html);\n $(id + ' .inner-top-right .first-day-type').html(forecast.weather[0].description + \" \");\n html = \" wind \" + Math.round(forecast.wind.speed) + \" m/s \";\n\n $(id + ' .inner-top-right .first-day-description').html(html);\n }\n //check if the day is starts from 2nd\n if (count >= 2) {\n //to get the current day + next 4 days, checking condition for days not more than 6\n if (day <= 6) {\n day++;\n if (day == 7) {\n day = 0\n }\n }\n $(id + ' .downwrap .weather-day-' + count + ' .downwrap-day').text(dayNames[day]);\n// $(id + ' .downwrap .weather-day-' + count + ' .downwrap-icon img').attr('src', \"https://openweathermap.org/themes/openweathermap/assets/vendor/owm/img/widgets/\" + forecast.weather[0].icon + \".png\");\n\n if (location.protocol === \"https:\") {\n $(id + ' .downwrap .weather-day-' + count + ' .downwrap-icon img').attr('src', \"https://openweathermap.org/img/wn/\" + forecast.weather[0].icon + \"@2x.png\");\n } else {\n $(id + ' .downwrap .weather-day-' + count + ' .downwrap-icon img').attr('src', \"http://openweathermap.org/img/wn/\" + forecast.weather[0].icon + \"@2x.png\");\n }\n if (temp_sign == 'f') {\n var temp_min = Math.round(MinTemp[apiTime[0]] * 9 / 5 + 32);\n var temp_max = Math.round(MaxTemp[apiTime[0]] * 9 / 5 + 32);\n $(id + ' .downwrap .weather-day-' + count + ' .downwrap-temp').text(temp_min + String.fromCharCode(176) + \"/\" + temp_max + String.fromCharCode(176) + 'F');\n } else {\n $(id + ' .downwrap .weather-day-' + count + ' .downwrap-temp').text(Math.round(MinTemp[apiTime[0]]) + String.fromCharCode(176) + \"/\" + Math.round(MaxTemp[apiTime[0]]) + String.fromCharCode(176) + 'C');\n }\n }\n }\n if (widget_type == \"one\"){\n for (var j = 2; j< 6; j++){\n $(id + ' .downwrap .weather-day-' + j + ' .downwrap-day').hide();\n $(id + ' .downwrap .weather-day-' + j + ' .downwrap-icon img').hide();\n $(id + ' .downwrap .weather-day-' + j + ' .downwrap-temp').hide();\n }\n }else{\n for (var k = 2; k< 6; k++){\n $(id + ' .downwrap .weather-day-' + k + ' .downwrap-day').show();\n $(id + ' .downwrap .weather-day-' + k + ' .downwrap-icon img').show();\n $(id + ' .downwrap .weather-day-' + k + ' .downwrap-temp').show();\n }\n }\n });\n}", "title": "" }, { "docid": "3faf68efd8b0c5f69c36749b2eb0c2ba", "score": "0.47419757", "text": "function buildForecast(){\n let forecast = buildHTML(\"section\", \"d-flex flex-wrap justify-content-center align-content-center col-12 mt-5 forecast\");\n currentWeatherEl.appendChild(forecast);\n\n let forecastHeader = buildHTML(\"div\", \"col-12\");\n forecast.appendChild(forecastHeader);\n forecastHeader.appendChild(buildHTML(\"h4\", \"forecast-title d-flex flex-column align-items-center\", \"Your 5-Day Forecast\"));\n \n for (let i = 1; i < 6; i++){\n let forecastCard = buildHTML(\"div\", \"card d-flex flex-column align-items-center col-6 col-lg-8 m-2\");\n forecastCard.setAttribute(\"style\", \"width: 15rem;\");\n forecast.appendChild(forecastCard);\n\n // Convert the timestamps to YYYY-MM-DD\n let forecastDateRaw = new Date(requestedWeatherData.dailyForecast[i].dt*1000);\n let forecastDate = forecastDateRaw.toLocaleDateString(\"en\");\n\n forecastCard.appendChild(buildHTML(\"h5\", \"card-title\", forecastDate));\n \n let weatherIcon = `https://openweathermap.org/img/wn/${requestedWeatherData.dailyForecast[i].weather[0].icon}@2x.png`\n let weatherIconEl = buildHTML(\"img\", \"col-4 weather-img\");\n weatherIconEl.setAttribute(\"src\", weatherIcon);\n forecastCard.appendChild(weatherIconEl);\n\n forecastCard.appendChild(buildHTML(\"p\", \"temperature\", `Temperature: ${requestedWeatherData.dailyForecast[i].temp.day} C`));\n forecastCard.appendChild(buildHTML(\"p\", \"humidity\", `Humidity: ${requestedWeatherData.dailyForecast[i].humidity}%`));\n }\n}", "title": "" }, { "docid": "61e84827134140beeae4665c756d0f5f", "score": "0.47399628", "text": "async function publicBuild(lat, lng){\n let data = await weather.fetch(lat, lng, false);\n let sorted = weather.sortDays(data);\n\n let menu = document.getElementById(\"menu\");\n let details = document.getElementById(\"details\");\n\n build.clear();\n\n // today + get all info\n let today = sorted.dates[sorted.names[0]][0];\n build.rightNow(map, today);\n\n\n // each day\n for (var i = 0; i < defaults.days(); i++) {\n let thisDay = sorted.dates[sorted.names[i]];\n\n // get date names\n var todayName;\n if(i == 0){\n todayName = \"Idag\";\n } else {\n var currentDate = new Date();\n currentDate.setDate(currentDate.getDate() + i);\n let thisDate = currentDate.getDay();\n todayName = text.getDay(thisDate).substring(0,3);\n }\n\n // create menu\n let day_info = build.dayMenu(thisDay);\n\n // create detail view container\n let detailContainer = document.createElement(\"div\");\n detailContainer.classList.add(\"detailContainer\");\n\n let newEle = build.createElement(\"div\", \"menu-item\", \"\");\n newEle.addEventListener('click', function(m){\n let allMenuItems = document.querySelectorAll(\".menu-item\");\n allMenuItems.forEach( function(e){ e.classList.remove(\"active\"); });\n m.target.classList.add(\"active\");\n\n let allContainers = document.querySelectorAll(\".detailContainer\");\n allContainers.forEach( function(e){ e.classList.remove(\"visible\"); });\n detailContainer.classList.add(\"visible\");\n });\n\n let newEleTemp = build.createElement(\"p\", \"menu-temp\", day_info.averageTemp + \"°\");\n let newEleImg = build.createElement(\"div\", \"menu-img\", \"\");\n newEleImg.classList.add(day_info.weatherImg);\n newEleImg.classList.add(\"menu-img\");\n let newEleDay = build.createElement(\"p\", \"menu-day\", todayName);\n\n newEle.append(newEleDay);\n newEle.append(newEleImg);\n newEle.append(newEleTemp);\n menu.append(newEle);\n\n // create Detail view\n for (var j = 0; j < thisDay.length; j++) {\n\n let dayData = build.dayDetails(thisDay[j]);\n\n let detailWrapper = document.createElement(\"div\");\n detailWrapper.classList.add(\"details-item\");\n\n let newDetTextContainer = document.createElement(\"div\");\n newDetTextContainer.classList.add(\"details-textContainer\");\n\n let newDetTime = document.createElement(\"div\");\n newDetTime.classList.add(\"details-time\");\n newDetTime.innerHTML = dayData.time;\n\n let newDetName = document.createElement(\"p\");\n newDetName.classList.add(\"details-name\");\n newDetName.innerHTML = dayData.name;\n\n let newDetImg = document.createElement(\"div\");\n newDetImg.classList.add(\"details-img\");\n newDetImg.classList.add(dayData.img);\n\n let newDetTemp = document.createElement(\"p\");\n newDetTemp.classList.add(\"details-temp\");\n newDetTemp.innerHTML = dayData.temp;\n\n newDetTextContainer.append(newDetTime);\n newDetTextContainer.append(newDetName);\n detailWrapper.append(newDetTextContainer);\n detailWrapper.append(newDetImg);\n detailWrapper.append(newDetTemp);\n detailContainer.append(detailWrapper);\n details.append(detailContainer);\n } // end of detail view\n } // end of each day\n\n // after everything is loaded, hide the loading screen\n loadingScreen.hide();\n } // end of build function", "title": "" }, { "docid": "38330e0dd8717417ba96619da685e72d", "score": "0.47316763", "text": "function load_city_tracts(city_name, onloaded_tracts)\n{\n var info = {muni_geoid: null, display_name: null};\n \n jQuery.ajax(CR_API_BASE+'/geo/elasticsearch?size=1&sumlevs=160&q='+escape(city_name),\n {success: onloaded_place});\n \n function onloaded_place(json)\n {\n info.muni_geoid = json.results[0].full_geoid;\n info.display_name = json.results[0].display_name;\n\n jQuery.ajax(CR_API_BASE+'/geo/show/tiger2013?geo_ids=140|'+escape(info.muni_geoid),\n {success: onloaded_geojson});\n }\n\n function onloaded_geojson(geojson)\n {\n var feature,\n tracts = [];\n \n while(geojson.features.length)\n {\n feature = geojson.features.shift();\n feature.id = feature.properties.geoid;\n \n if(feature.properties.aland > 0)\n {\n tracts.push(new Tract(feature.properties.geoid, feature));\n }\n }\n \n onloaded_tracts(info.muni_geoid, info.display_name, tracts);\n }\n}", "title": "" }, { "docid": "40ac047e6ced866a755372c841f3a78b", "score": "0.47284862", "text": "function initializeMapCities() {\n showInitialCities();\n \n MAP.addListener(\"zoom_changed\", function() {\n if (MAP.getZoom() > MAP.minZoom) {\n showTeleportCities();\n } else {\n clearMarkers();\n }\n });\n }", "title": "" }, { "docid": "2ecb1d0d1e8e75430b18f9badc7e6b09", "score": "0.47135827", "text": "function runCalls() {\n\n generateWeatherData(citySearchValue.value)\n findWeather();\n renderNewButtons();\n}", "title": "" }, { "docid": "0810d27adfde460eea22d5dd2f655e35", "score": "0.47124082", "text": "function populateWeather() {\n let city = searchedCity.value.trim();\n let apiKey = 'bf35508c0373c0cd74246faad2a78d1d';\n let url = `https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${apiKey}`;\n fetch(url)\n .then(function (response) {\n return response.json();\n }).then(function (json) {\n console.log(json);\n\n let thisCity = json.city.name;\n\n cityName.innerHTML = thisCity;\n\n let imageZeroId = json.list[0].weather[0].icon;\n let imageOneId = json.list[7].weather[0].icon;\n let imageTwoId = json.list[15].weather[0].icon;\n let imageThreeId = json.list[23].weather[0].icon;\n let imageFourId = json.list[31].weather[0].icon;\n let imageFiveId = json.list[39].weather[0].icon;\n\n let descriptionZero = json.list[0].weather[0].description;\n let descriptionOne = json.list[7].weather[0].description;\n let descriptionTwo = json.list[15].weather[0].description;\n let descriptionThree = json.list[23].weather[0].description;\n let descriptionFour = json.list[31].weather[0].description;\n let descriptionFive = json.list[39].weather[0].description;\n\n let imageZeroUrl = `http://openweathermap.org/img/wn/${imageZeroId}@2x.png`;\n let imageOneUrl = `http://openweathermap.org/img/wn/${imageOneId}@2x.png`;\n let imageTwoUrl = `http://openweathermap.org/img/wn/${imageTwoId}@2x.png`;\n let imageThreeUrl = `http://openweathermap.org/img/wn/${imageThreeId}@2x.png`;\n let imageFourUrl = `http://openweathermap.org/img/wn/${imageFourId}@2x.png`;\n let imageFiveUrl = `http://openweathermap.org/img/wn/${imageFiveId}@2x.png`;\n\n dayZeroIcon.innerHTML = `<img src='${imageZeroUrl}' /><p>Expect ${descriptionZero}.</p>`;\n dayOneIcon.innerHTML = `<img src='${imageOneUrl}' /><p>Expect ${descriptionOne}.</p>`;\n dayTwoIcon.innerHTML = `<img src='${imageTwoUrl}' /><p>Expect ${descriptionTwo}.</p>`;\n dayThreeIcon.innerHTML = `<img src='${imageThreeUrl}' /><p>Expect ${descriptionThree}.</p>`;\n dayFourIcon.innerHTML = `<img src='${imageFourUrl}' /><p>Expect ${descriptionFour}.</p>`;\n dayFiveIcon.innerHTML = `<img src='${imageFiveUrl}' /><p>Expect ${descriptionFive}.</p>`;\n\n let dateTwo = json.list[15].dt_txt;\n let dateThree = json.list[23].dt_txt;\n let dateFour = json.list[31].dt_txt;\n let dateFive = json.list[39].dt_txt;\n\n dayTwoDate.innerHTML = `${dateTwo} Eastern`;\n dayThreeDate.innerHTML = `${dateThree} Eastern`;\n dayFourDate.innerHTML = `${dateFour} Eastern`;\n dayFiveDate.innerHTML = `${dateFive} Eastern`;\n\n let tempKelvinZero = json.list[0].main.temp;\n let tempKelvinOne = json.list[7].main.temp;\n let tempKelvinTwo = json.list[15].main.temp;\n let tempKelvinThree = json.list[23].main.temp;\n let tempKelvinFour = json.list[31].main.temp;\n let tempKelvinFive = json.list[39].main.temp;\n\n let tempFahrenheitZero = convertToFahrenheit(tempKelvinZero);\n let tempFahrenheitOne = convertToFahrenheit(tempKelvinOne);\n let tempFahrenheitTwo = convertToFahrenheit(tempKelvinTwo);\n let tempFahrenheitThree = convertToFahrenheit(tempKelvinThree);\n let tempFahrenheitFour = convertToFahrenheit(tempKelvinFour);\n let tempFahrenheitFive = convertToFahrenheit(tempKelvinFive);\n\n dayZeroTemp.innerHTML = `${tempFahrenheitZero}&deg;F`;\n dayOneTemp.innerHTML = `${tempFahrenheitOne}&deg;F`;\n dayTwoTemp.innerHTML = `${tempFahrenheitTwo}&deg;F`;\n dayThreeTemp.innerHTML = `${tempFahrenheitThree}&deg;F`;\n dayFourTemp.innerHTML = `${tempFahrenheitFour}&deg;F`;\n dayFiveTemp.innerHTML = `${tempFahrenheitFive}&deg;F`;\n\n let humidityZero = json.list[0].main.humidity;\n let humidityOne = json.list[7].main.humidity;\n let humidityTwo = json.list[15].main.humidity;\n let humidityThree = json.list[23].main.humidity;\n let humidityFour = json.list[31].main.humidity;\n let humidityFive = json.list[39].main.humidity;\n\n dayZeroHumidity.innerHTML = `${humidityZero}% humidity`;\n dayOneHumidity.innerHTML = `${humidityOne}% humidity`;\n dayTwoHumidity.innerHTML = `${humidityTwo}% humidity`;\n dayThreeHumidity.innerHTML = `${humidityThree}% humidity`;\n dayFourHumidity.innerHTML = `${humidityFour}% humidity`;\n dayFiveHumidity.innerHTML = `${humidityFive}% humidity`;\n\n let windSpeedZero = json.list[0].wind.speed;\n let windSpeedOne = json.list[7].wind.speed;\n let windSpeedTwo = json.list[15].wind.speed;\n let windSpeedThree = json.list[23].wind.speed;\n let windSpeedFour = json.list[31].wind.speed;\n let windSpeedFive = json.list[39].wind.speed;\n\n dayZeroWindSpeed.innerHTML = `${windSpeedZero} mph wind`;\n dayOneWindSpeed.innerHTML = `${windSpeedOne} mph wind`;\n dayTwoWindSpeed.innerHTML = `${windSpeedTwo} mph wind`;\n dayThreeWindSpeed.innerHTML = `${windSpeedThree} mph wind`;\n dayFourWindSpeed.innerHTML = `${windSpeedFour} mph wind`;\n dayFiveWindSpeed.innerHTML = `${windSpeedFive} mph wind`;\n\n let cityLatitude = json.city.coord.lat;\n let cityLongtiude = json.city.coord.lon;\n\n let uvIndexUrl = `http://api.openweathermap.org/data/2.5/uvi?appid=${apiKey}&lat=${cityLatitude}&lon=${cityLongtiude}`;\n\n fetch(uvIndexUrl)\n .then(function (response) {\n return response.json();\n }).then(function (uvjson) {\n console.log(uvjson);\n\n let uvIndexNumber = uvjson.value;\n\n dayZeroUVIndex.innerHTML = `UV Index: ${uvIndexNumber}`;\n }\n )\n }\n );\n searchedCity.value = '';\n}", "title": "" }, { "docid": "32b2aeedb9a4675a49c734c7c7aa40ea", "score": "0.470817", "text": "function renderCities() {\n $(\".city-list\").empty();\n\n for (var i = 0; i < cities.length; i++) {\n\n var a = $(\"<button>\");\n a.addClass(\"city-btn\");\n a.attr(\"data-name\", cities[i]);\n a.text(cities[i]);\n $(\".city-list\").append(a);\n }\n\n}", "title": "" }, { "docid": "8c86e5c2096d489b33672e54dbf8495f", "score": "0.47079673", "text": "function getCurrentConditions(response) {\n // creates a variable from the api temp and the formula to turn it into Farenheit\n var tempF = (response.main.temp - 273.15) * 1.8 + 32;\n tempF = Math.floor(tempF);\n// empty div \n $(\"#currentCity\").empty();\n// jquery creates elements to return the data from the api \n const card = $(\"<div>\").addClass(\"card\");\n const cardBody = $(\"<div>\").addClass(\"card-body\");\n const city = $(\"<h4>\")\n .addClass(\"card-title\")\n .text(response.name);\n const cityDate = $(\"<h4>\")\n .addClass(\"card-title\")\n .text(date.toLocaleDateString(\"en-US\"));\n const temperature = $(\"<p>\")\n .addClass(\"card-text current-temp\")\n .html(\"Temperature: \" + tempF + \"&deg; F\");\n const humidity = $(\"<p>\")\n .addClass(\"card-text current-humidity\")\n .text(\"Humidity: \" + response.main.humidity + \"%\");\n const wind = $(\"<p>\")\n .addClass(\"card-text current-wind\")\n .text(\"Wind Speed: \" + response.wind.speed + \" MPH\");\n const image = $(\"<img>\").attr(\n \"src\",\n \"https://openweathermap.org/img/w/\" + response.weather[0].icon + \".png\"\n );\n// appends the data from the api on the page in the current city div\n city.append(cityDate, image);\n cardBody.append(city, temperature, humidity, wind);\n card.append(cardBody);\n $(\"#currentCity\").append(card);\n}", "title": "" }, { "docid": "0e3bff320b73a0a3bd36ef94e63b95c6", "score": "0.47054753", "text": "function displayWeather(city, render) {\n // console.log(savedCities);\n var APIkey = \"8bb29e39d1793c0fac57e32626a2237c\";\n\n var queryURL =\n \"https://api.openweathermap.org/data/2.5/weather?q=\" +\n city +\n \"&appid=\" +\n APIkey;\n\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (response) {\n // console.log(queryURL);\n console.log(response);\n lat = response.coord.lat;\n lon = response.coord.lon;\n console.log(lat);\n console.log(lon);\n var tempF = ((response.main.temp - 273.15) * 1.8 + 32).toFixed(2);\n $(\".cityName\").text(response.name + \" (\" + currentDate + \")\");\n $(\".weatherIcon\").attr((\"src\", response.weather[0]));\n $(\".temp\").text(\"Temprature: \" + tempF);\n $(\".humidity\").text(\"Humidity: \" + response.main.humidity);\n $(\".wind\").text(\"Wind Speed: \" + response.wind.speed);\n displayUVIndex(lat, lon);\n\n if (render) {\n citiesArr.push(response.name);\n console.log(citiesArr, \"displayweather\");\n localStorage.setItem(\"cities\", JSON.stringify(citiesArr));\n renderCities();\n }\n // Save cities to local storage to display searched cities\n });\n }", "title": "" }, { "docid": "b54fc6e83aa68193f6061449f87916ec", "score": "0.4700987", "text": "generateBanner(arr, container) {\n\n /* set index to one so it displays the first slider element */\n let index = 1;\n\n /* function for changing slide to the next one in line */\n let nextSlide = (n) => {\n /* it gets the current index, and adds function parameter number */\n bannerSlides(index += n);\n }\n\n /* function for getting and changing slides */\n let bannerSlides = (n) => {\n /* get all div's with the class 'banner-slide' and all spans with the class 'dot' */\n let slides = $('div.banner-slide');\n let dots = $('span.dot');\n\n /* when the banner has went through all slides, reset to first slide */\n if (n > slides.length) {\n index = 1;\n } else if (n < 1){\n index = slides.length;\n }\n\n /* hide all slides which is not displayed */\n for (let i = 0; i < slides.length; i++) {\n slides[i].style.display = 'none';\n }\n\n /* add class current to dot number matching slide number */\n for (let i = 0; i < dots.length; i++) {\n dots[i].className = dots[i].className.replace(' current', '');\n }\n\n /* show slide which is on display, and set corresponding dot to 'current' */\n slides[index-1].style.display = 'block';\n dots[index-1].className += ' current';\n }\n \n /* function for generating all slides based on the types array */\n let generateSlides = (arr, container) => {\n /* iterate through array */\n arr.forEach(function(item) {\n /* if item in array has id of 1, we remove the hidden (display none) class */\n if (item.id == 1) {\n let generateSlide = `<div class=\"banner-slide banner-animation\">\n <!-- preserves UD by adding alt text to image -->\n <img class=\"banner-img\" src=\"${item.imgUrl}\" alt=\"${item.alt}\">\n <div class=\"banner-caption\">\n <h1>${item.name}</h1>\n </div>\n </div>`;\n\n /* append slide to appropirate container */\n $(container).append(generateSlide);\n \n /* if item in array does not have the id 1, generate slides, but with hidden class */\n } else {\n let generateSlide = `<div class=\"banner-slide hidden banner-animation\">\n <!-- preserves UD by adding alt text to image -->\n <img class=\"banner-img\" src=\"${item.imgUrl}\" alt=\"${item.alt}\">\n <div class=\"banner-caption\">\n <h1>${item.name}</h1>\n </div>\n </div>`;\n\n /* append slide to appropirate container */\n $(container).append(generateSlide); \n }\n });\n }\n\n /* function for generating correct amount of dots */\n let generateDots = (arr, container) => {\n arr.forEach(function(item) {\n /* if item in array has id of 1, we set the corresponding dot as 'current' (active) */\n if (item.id == 1) {\n let generateDot = `<span class=\"dot current\"></span>`;\n \n /* append dot to appropirate container */\n $(container).append(generateDot);\n \n /* if item does not have the id 1, generate a normal dot */\n } else {\n let generateDot = `<span class=\"dot\"></span>`;\n\n /* append dot to appropirate container */\n $(container).append(generateDot);\n }\n });\n }\n\n /* variable for storing banner structure, formatted for readability */\n let generateBanner = `<div class=\"banner-container\">\n <div class=\"banner-slides\">\n <!-- slides created by DOM -->\n </div>\n <div class=\"banner-meta\">\n <div class=\"banner-btns\">\n <button type=\"button\" class=\"prev-slide\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" class=\"icon-cheveron-left-circle\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" class=\"primary\"/>\n <path class=\"secondary\" d=\"M13.7 15.3a1 1 0 0 1-1.4 1.4l-4-4a1 1 0 0 1 0-1.4l4-4a1 1 0 0 1 1.4 1.4L10.42 12l3.3 3.3z\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"next-slide\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" class=\"icon-cheveron-right-circle\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" class=\"primary\"/>\n <path class=\"secondary\" d=\"M10.3 8.7a1 1 0 0 1 1.4-1.4l4 4a1 1 0 0 1 0 1.4l-4 4a1 1 0 0 1-1.4-1.4l3.29-3.3-3.3-3.3z\"/>\n </svg>\n </button>\n </div>\n <div class=\"banner-dots\">\n <!-- dots created by DOM -->\n </div>\n </div>\n </div>`\n\n /* append banner to appropirate container */\n $(container).append(generateBanner);\n\n /* call functions to generate slides and dots */\n generateSlides(arr, $('div.banner-slides'));\n generateDots(arr, 'div.banner-dots');\n\n /* call function to start banner carrousel */\n bannerSlides(index);\n\n /* event handlers for clicking next/prev slide buttons */\n $('button.prev-slide').on('click', function() {\n nextSlide(-1);\n });\n\n $('button.next-slide').on('click', function() {\n nextSlide(1);\n });\n\n /* interval loop to change slide every 5 seconds */\n setInterval(function() {\n nextSlide(1)\n }, 5000);\n }", "title": "" }, { "docid": "a2cc6bda654017aa0beaaa4ec169bc14", "score": "0.46958992", "text": "build(){\r\n\r\n\t\t// Create a slide and save images reference\r\n\t\t// @image_content { url } - the image url\r\n\t\t// @first_el { boolean } - if true add \"is_current\" class to the slide\r\n\t\t// @return { htmlElement } - the html for image\r\n\t\tconst addImagePart = ( image_content, first_el ) => {\r\n\r\n\t\t\tlet ekjs_slide = document.createElement(\"li\");\r\n\t\t\tekjs_slide.setAttribute(\"class\", \"ekjs_slide\");\r\n\r\n\t\t\t// first slide is visible\r\n\t\t\tif( first_el ){\r\n\t\t\t\tekjs_slide.classList.add(\"is_current\");\r\n\t\t\t}\r\n\r\n\t\t\tlet ekjs_image_container = document.createElement(\"div\");\r\n\t\t\tekjs_image_container.setAttribute(\"class\", \"ekjs_image_container\");\r\n\r\n\t\t\tlet ekjs_image = document.createElement(\"img\");\r\n\t\t\tekjs_image.setAttribute(\"class\", \"ekjs_image\");\r\n\t\t\tconst ekjs_image_alt = \"une image representant les ateliers\";\r\n\t\t\tekjs_image.setAttribute(\"alt\", ekjs_image_alt );\r\n\t\t\tekjs_image.setAttribute(\"src\", image_content );\r\n\r\n\t\t\tekjs_image_container.appendChild( ekjs_image );\r\n\t\t\tekjs_slide.appendChild( ekjs_image_container );\r\n\r\n\t\t\tthis.image_list.push( ekjs_image ); // Save images\r\n\r\n\t\t\treturn ekjs_slide;\r\n\t\t}\r\n\r\n\t\t// Create the slide texts\r\n\t\t// @title_content { string } - the title of the slide\r\n\t\t// @text_content { string } - the text of the slide\r\n\t\t// @return { htmlElement } - the html for title and text\r\n\t\tconst addTextPart = ( title_content, text_content, first_el )=> {\r\n\r\n\t\t\tlet ekjs_info_container = document.createElement(\"li\");\r\n\t\t\tekjs_info_container.setAttribute(\"class\", \"ekjs_info_container\");\r\n\r\n\t\t\tlet ekjs_info = document.createElement(\"div\");\r\n\t\t\tekjs_info.setAttribute(\"class\", \"ekjs_info\");\r\n\r\n\t\t\tlet ekjs_info_title_container = document.createElement(\"h3\");\r\n\t\t\tekjs_info_title_container.setAttribute(\"class\", \"ekjs_info_title_container\");\r\n\r\n\t\t\tlet ekjs_info_title = document.createElement(\"span\");\r\n\t\t\tekjs_info_title.setAttribute(\"class\", \"ekjs_info_title is_current\");\r\n\t\t\tekjs_info_title.textContent = title_content;\r\n\r\n\t\t\tlet ekjs_info_text = document.createElement(\"p\");\r\n\t\t\tekjs_info_text.setAttribute(\"class\", \"ekjs_info_text is_current\");\r\n\t\t\tekjs_info_text.textContent = text_content;\r\n\r\n\t\t\tif( first_el ){\r\n\r\n\t\t\t\tekjs_info_title.classList.add(\"is_current\");\r\n\t\t\t\tekjs_info_text.classList.add(\"is_current\");\r\n\t\t\t\tekjs_info.classList.add(\"is_current\");\r\n\r\n\t\t\t}\r\n\r\n\t\t\tekjs_info_title_container.appendChild( ekjs_info_title );\r\n\t\t\tekjs_info.appendChild( ekjs_info_title_container );\r\n\t\t\tekjs_info.appendChild( ekjs_info_text );\r\n\t\t\tekjs_info_container.appendChild( ekjs_info );\r\n\r\n\t\t\treturn ekjs_info_container;\r\n\r\n\t\t}\r\n\r\n\t\t// Create the slider backbone\r\n\t\tconst createConcreate = ()=> {\r\n\r\n\t\t\tthis.concreate = document.createElement(\"div\");\r\n\t\t\tthis.concreate.setAttribute(\"class\", \"eokojs\");\r\n\t\t\tthis.concreate.innerHTML = template ;\r\n\r\n\t\t}\r\n\r\n\t\t// Build the complete slider\r\n\t\tconst putAllTogether = ()=> {\r\n\r\n\t\t\tcreateConcreate();\r\n\t\t\tconst images_container = this.concreate.querySelector('.ekjs_slides_container');\r\n\t\t\tconst texts_container = this.concreate.querySelector('.ekjs_infos');\r\n\r\n\t\t\tlet image_part = '';\r\n\t\t\tlet text_part = '';\r\n\t\t\tthis.options.forEach( ( item, index, array ) => {\r\n\r\n\t\t\t\tif( index == 0 ){\r\n\t\t\t\t\timage_part = addImagePart( item.image_content, true );\r\n\t\t\t\t\ttext_part = addTextPart( item.title_content , item.text_content, true) ;\r\n\t\t\t\t}else{\r\n\t\t\t\t\timage_part = addImagePart( item.image_content );\r\n\t\t\t\t\ttext_part = addTextPart( item.title_content, item.text_content);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\timages_container.appendChild( image_part );\r\n\t\t\t\ttexts_container.appendChild( text_part );\r\n\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tconst initPagination = ()=>{\r\n\r\n\t\t\tthis.current_num.textContent = '1';\r\n\t\t\tthis.total_slide.textContent = '' + this.nb_slide;\r\n\t\t}\r\n\r\n\t\t//========================================================\r\n\r\n\t\tputAllTogether();\r\n\t\tthis.getHtmls();\r\n\t\tinitPagination();\r\n\r\n\r\n\t}", "title": "" }, { "docid": "050d78c08169979e22eeeb2317545c0c", "score": "0.4691826", "text": "function init() {\n if (searchedCities[0] !== undefined) {\n city = searchedCities[0];\n displayCurrentWeather();\n }\n }", "title": "" }, { "docid": "77f64773191cab2363c86b02fb055d7d", "score": "0.46907067", "text": "function cityData() {\n\t\tappearance(\"loadinglocation\", \"none\"); // hide the loading gif\n\t\tif (this.status == 200) {\n\t\t\tvar name = this.responseXML.querySelector(\"name\").textContent; // get city name\n\t\t\tvar date = Date(); // get current time \n\t\t\tvar weather = this.responseXML.querySelector(\"symbol\").getAttribute(\"name\"); \n\t\t\tvar temp = this.responseXML.querySelector(\"temperature\").getAttribute(\"value\");\n\t\t\ttemp = Math.round(temp) + \"&#8457\";\n\n\t\t\t// put all the desriptions of a city into an array\n\t\t\tvar description = [name, date, weather, temp];\n\t\t\t\n\t\t\tfor (var i = 0; i < 4; i++) {\n\t\t\t\tvar div = document.createElement(\"div\");\n\t\t\t\tdiv.innerHTML = description[i];\n\t\t\t\t\n\t\t\t\tif (i < 3) { // put them into the location div\n\t\t\t\t\tdocument.getElementById(\"location\").appendChild(div);\n\t\t\t\t} else { // the temperature info \n\t\t\t\t\tdocument.getElementById(\"currentTemp\").appendChild(div);\n\t\t\t\t}\n\t\t\t\tif (i == 0) {\n\t\t\t\t\tdiv.classList.add(\"title\"); // add a class of title to city name\n\t\t\t\t}\n\t\t\t} \n\t\t} else if (this.status == 410) {\n\t\t\tshowIcons(\"none\");\n\t\t\tappearance(\"nodata\", \"\"); // show the error message for 410 error\n\n\t\t} else {\n\t\t\terror(this.status, this.statusText, this.responseText);\n\t\t}\n\t}", "title": "" }, { "docid": "ec0f1ed590dce3999a8b4662f7ee163a", "score": "0.46895066", "text": "function insertWeatherData( weather ) {\n // CURRENT DAY WEATHER DATA\n currentCityNameEl.innerHTML = userInput.value;\n currentDateEl.innerHTML = convertUnixDate(weather.current.dt);\n currentCityTempEl.innerHTML = weather.current.temp + \"ºF\";\n currentCityHumEl.innerHTML = weather.current.humidity + \"&percnt;\";\n currentCityWindEl.innerHTML = weather.current.wind_speed + \"mph\";\n currentCityUVEl.innerHTML = weather.current.uvi; // update text bg color based on value\n // changes UV element based on high, low, ok values\n if (weather.current.uvi < 3) {\n currentCityUVEl.classList.add('uvLow')\n } else if (weather.current.uvi > 9) {\n currentCityUVEl.classList.add('uvHigh')\n } else {\n currentCityUVEl.classList.add('uvOK')\n }\n currentCityImgEl.innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.current.weather[0].icon + '@2x.png\" alt=\"current weather\">';\n // FIVE DAY DATE DATA \n document.getElementById('dayOneDate').innerHTML = convertUnixDate(weather.daily[1].dt);\n document.getElementById('dayTwoDate').innerHTML = convertUnixDate(weather.daily[2].dt);\n document.getElementById('dayThreeDate').innerHTML = convertUnixDate(weather.daily[3].dt);\n document.getElementById('dayFourDate').innerHTML = convertUnixDate(weather.daily[4].dt);\n document.getElementById('dayFiveDate').innerHTML = convertUnixDate(weather.daily[5].dt);\n // FIVE DAY IMAGE DATA \n document.getElementById('dayOneImg').innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.daily[1].weather[0].icon + '.png\" alt=\"weather forecast\">';\n document.getElementById('dayTwoImg').innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.daily[2].weather[0].icon + '.png\" alt=\"weather forecast\">';\n document.getElementById('dayThreeImg').innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.daily[3].weather[0].icon + '.png\" alt=\"weather forecast\">';\n document.getElementById('dayFourImg').innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.daily[4].weather[0].icon + '.png\" alt=\"weather forecast\">';\n document.getElementById('dayFiveImg').innerHTML = '<img src=\"https://openweathermap.org/img/wn/' + weather.daily[5].weather[0].icon + '.png\" alt=\"weather forecast\">';\n // FIVE DAY TEMP DATA \n document.getElementById('dayOneTemp').innerHTML = weather.daily[1].temp.day;\n document.getElementById('dayTwoTemp').innerHTML = weather.daily[2].temp.day;\n document.getElementById('dayThreeTemp').innerHTML = weather.daily[3].temp.day;\n document.getElementById('dayFourTemp').innerHTML = weather.daily[4].temp.day;\n document.getElementById('dayFiveTemp').innerHTML = weather.daily[5].temp.day;\n // FIVE DAY HUMIDITY DATA \n document.getElementById('dayOneHum').innerHTML = weather.daily[1].humidity;\n document.getElementById('dayTwoHum').innerHTML = weather.daily[2].humidity;\n document.getElementById('dayThreeHum').innerHTML = weather.daily[3].humidity;\n document.getElementById('dayFourHum').innerHTML = weather.daily[4].humidity;\n document.getElementById('dayFiveHum').innerHTML = weather.daily[5].humidity;\n}", "title": "" }, { "docid": "3b95bfda2053c19fce7cbd97323bae1e", "score": "0.46878326", "text": "function getCityWeather(currentCity) {\n var queryURLCity = \"https://api.openweathermap.org/data/2.5/weather?q=\" + currentCity + \"&appid=\" + myApiKey;\n\n $.ajax({\n url: queryURLCity,\n method: \"GET\"\n })\n .then(function (response) {\n console.log(\"This is the city info:\\n\")\n console.log(response);\n var cityLat = response.coord.lat;\n var cityLon = response.coord.lon;\n\n\n// start AJAX subquery for ALLone call\n var queryURLAllone = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + cityLat + \"&lon=\" + cityLon + \"&appid=\" + myApiKey + \"&units=imperial\";\n $.ajax({\n url: queryURLAllone,\n method: \"GET\"\n })\n .then(function (weatherData) {\n console.log(\"This is the weather data:\\n\")\n console.log(weatherData);\n //debugger;\n\n// setup weatherConditions to allow for dynamic background image \n var weatherConditions = \"\";\n var weatherCondArray = weatherData.current.weather;\n\n for (var i = 0; i < weatherCondArray.length; i++) {\n weatherConditions += weatherCondArray[i].main + \" \";\n\n } \n console.log(weatherConditions);\n\n// Display Current Weather Data\n $(\"#display-current\").css({backgroundImage: `url(\"./assets/img/pic.${weatherCondArray[0].main}.jpg\")`});\n $(\".curr-city\").text(\"Weather for \" + response.name + \" - \" + moment(weatherData.current.dt * 1000).format(\"dddd, MMMM Do\"));\n $(\".curr-condition\").text(\"Conditions: \" + weatherConditions);\n $(\".curr-temp\").text(\"Temp: \" + Math.floor(weatherData.current.temp) + \" F\");\n $(\".curr-wind\").text(\"Wind Speed: \" + Math.floor(weatherData.current.wind_speed) + \" mph\");\n $(\".curr-humid\").text(\"Humidity: \" + weatherData.current.humidity + \"%\");\n $(\".curr-uv\").text(\"UV Index: \" + Math.floor(weatherData.current.uvi));\n\n\n// Display Five Day Forecast Data\n $(\"#5day-forecast\").empty();\n\n for (i = 1; i < 6; i++) {\n var forecastDay = moment(weatherData.daily[i].dt * 1000).format(\"MMM D\");\n console.log(forecastDay);\n\n var forecastCard = $(`\n <div class=\"forecast-row\">\n <div class=\"forecast\">\n <h5 class=\"card-title\">${forecastDay}</h5>\n <p>Temp: ${Math.floor(weatherData.daily[i].temp.day)} F</p>\n <p>Wind: ${Math.floor(weatherData.daily[i].wind_speed)} mph</p>\n <p>Humidity: ${weatherData.daily[i].humidity}%</p>\n <p>UV Index: ${Math.floor(weatherData.daily[i].uvi)}</p>\n </div> \n </div>\n `)\n console.log(forecastCard);\n $(\"#5day-forecast\").append(forecastCard);\n }\n }) \n\n })\n}", "title": "" }, { "docid": "067ea067613f018dc4fff9fd674846d6", "score": "0.46866652", "text": "function renderButtons() {\n\n // Deleting the cities prior to adding new cities\n $(\"#buttons-view\").empty();\n console.log(\"Cities array: \"+cities);\n\n // Looping through the array of cities\n for (var i = 0; i < cities.length; i++) {\n\n // Then dynamicaly generating buttons for each city in the array\n var a = $(\"<button>\");\n // Adding a class of city-btn to our button\n a.addClass(\"city-btn\");\n // Adding a data-attribute\n a.attr(\"data-name\", cities[i]);\n // Providing the initial button text\n a.text(cities[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n }", "title": "" }, { "docid": "fbf9d6e9f3bbba0efd825083bd0ab4a0", "score": "0.46778286", "text": "function displayWeatherData() {\n // Target the div to append dynamically created divs to\n var todayWeatherSection = $(\".todayWeatherSection\");\n // Clear section of any html\n todayWeatherSection.empty();\n // $(\".fiveDaySection\").empty();\n $(\".fiveDaySection\").children().not(':first').remove();\n // Store api key\n var APIKey = \"5af80191049a5aac0e5b1a43d2d1ccfe\";\n // Store queryURL with the proper strings\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?q=\" + inputValue + \"&appid=\" + APIKey;\n\n // If the inputValue is not empty\n if (inputValue !== \"\" && searchHistoryArr.indexOf(inputValue) == -1) {\n // Push it into the array\n searchHistoryArr.push(inputValue);\n // Store array into localstorage and render to screen\n storeSearchHistory();\n renderSearchHistory();\n // Then clear the input field\n $(\"#cityInput\").val(\"\");\n }\n\n // Use ajax to get data for the city\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (response) {\n\n // Use response to get the necessary data: City name, Temperature in Fahrenheit, Humidity, Wind speed, and Coordinates (to use for UV Index)\n var curCity = response.name;\n var curCountry = response.sys.country;\n // var curDateTime = moment().format('MMM Do, h:mm a'); // Get current time using moment.js\n var curKelvinTemp = response.main.temp;\n var curFahrenheit = ((curKelvinTemp - 273.15) * 1.80 + 32).toFixed();\n var curHumidity = response.main.humidity;\n var curWindSpeed = response.wind.speed;\n var curWeatherIcon = \"https://openweathermap.org/img/wn/\" + response.weather[0].icon + \"@2x.png\";\n var curWeatherDes = response.weather[0].description;\n var cityLat = response.coord.lat;\n var cityLon = response.coord.lon;\n\n // Render data and display to the screen\n renderData();\n\n // Create a function to render data\n function renderData() {\n // Create divs and add classes\n var currentWeatherData = $(\"<div>\").addClass(\"uk-grid\");\n var currentDataText = $(\"<div>\").addClass(\"uk-width-1-2 uk-text-secondary dataText\");\n var currentDataGraphic = $(\"<div>\").addClass(\"uk-width-1-2 uk-flex uk-flex-column uk-flex-middle weatherGraphic\");\n var currentDataCity = $(\"<div>\").addClass(\"uk-text-bold uk-text-large\");\n var currentDataTemp = $(\"<div>\").addClass(\"uk-heading-2xlarge uk-margin-remove tempVal\");\n var currentDataTempUnit = $(\"<span>\").addClass(\"uk-heading-large uk-text-top tempUnit\");\n var currentDataHumidity = $(\"<div>\").addClass(\"otherInfo\");\n var currentHumidityLabel = $(\"<span>\").addClass(\"uk-text-small\");\n var currentHumidityVal = $(\"<span>\").addClass(\"uk-text-bold\");\n var currentDataWindSpeed = $(\"<div>\").addClass(\"otherInfo\");\n var currentWindSpeedLabel = $(\"<span>\").addClass(\"uk-text-small\");\n var currentWindSpeedVal = $(\"<span>\").addClass(\"uk-text-bold\");\n var currentWeatherImage = $(\"<img>\");\n var currentWeatherDescription = $(\"<p>\").addClass(\"weatherDes uk-text-small uk-margin-remove uk-padding-large uk-padding-remove-vertical\");\n\n\n // Set contexts\n currentDataCity.text(curCity + \", \" + curCountry); // Get city from response\n currentDataTemp.text(curFahrenheit); // Get temp from response\n currentDataTempUnit.html(\"&#176F\");\n currentHumidityLabel.text(\"Humidity: \");\n currentHumidityVal.text(curHumidity + \"%\");\n currentWindSpeedLabel.text(\"Wind Speed: \");\n currentWindSpeedVal.text(curWindSpeed + \"kph\");\n currentWeatherImage.attr({ \"data-src\": curWeatherIcon, alt: \"Weather Icon\", \"uk-img\": \"\", width: \"200px\" });\n currentWeatherDescription.text(curWeatherDes);\n\n // Append to each other\n currentDataWindSpeed.append(currentWindSpeedLabel).append(currentWindSpeedVal);\n currentDataHumidity.append(currentHumidityLabel).append(currentHumidityVal);\n currentDataTemp.append(currentDataTempUnit);\n currentDataText.append(currentDataCity).append(currentDataTemp).append(currentDataHumidity).append(currentDataWindSpeed);\n currentDataGraphic.append(currentWeatherImage).append(currentWeatherDescription);\n currentWeatherData.append(currentDataText).append(currentDataGraphic);\n todayWeatherSection.append(currentWeatherData);\n\n\n // To display searched city's local date and time\n var apiKeyTimezone = \"KDN1W1M1XRYJ\";\n var queryURLTimezone = \"https://api.timezonedb.com/v2.1/get-time-zone?key=\" + apiKeyTimezone + \"&format=json\" + \"&by=position\" + \"&lat=\" + cityLat + \"&lng=\" + cityLon;\n\n $.ajax({\n url: queryURLTimezone,\n method: \"GET\"\n }).then(function (response) {\n // Request for the city's local date and time\n var cityDateTimeUnformated = response.formatted;\n // Create an instance of each date and time\n var cityDateInstance = new Date(cityDateTimeUnformated);\n // Get Month\n var cityMonth = forecastMonths[cityDateInstance.getMonth()];\n // Get Day of month\n var cityDayOfMonth = forecastDates[cityDateInstance.getDate() - 1];\n // Get the hour\n var cityHour = forecastTimes[cityDateInstance.getHours()];\n // Get minutes\n var cityMinutes = cityDateInstance.getMinutes();\n // If minutes is less than 10, add a 0 in front of it\n if (cityMinutes < 10) {\n cityMinutes = \"0\" + cityMinutes;\n }\n // Get am or pm\n var cityTimePeriod;\n if (cityDateInstance.getHours() >= 0 && cityDateInstance.getHours() < 12) {\n cityTimePeriod = \"am\";\n } else {\n cityTimePeriod = \"pm\";\n }\n // Format the date and time\n var cityDateTimeFormatted = cityMonth + \" \" + cityDayOfMonth + \", \" + cityHour + \":\" + cityMinutes + \" \" + cityTimePeriod;\n // Create a div to add the formatted date and time to\n var currentDataDate = $(\"<div>\").text(cityDateTimeFormatted);\n // Prepend it to the currentDataText div\n currentDataText.prepend(currentDataDate);\n\n\n renderBackground();\n // Create a function to change the background gradient depending on city's local time\n function renderBackground() {\n // Target divs\n var todayWeather = $(\"#todayWeather\");\n // Get cityHour in 24-hr format\n var cityHour = cityDateInstance.getHours();\n // Adjust color based on the city's local hour\n if (cityHour >= 6 && cityHour < 19) {\n todayWeather.css(\"background-image\", \"var(--daytime)\");\n currentWeatherDescription.addClass(\"uk-mute\");\n } else {\n todayWeather.css(\"background-image\", \"var(--nighttime)\");\n currentWeatherDescription.addClass(\"uk-light\");\n }\n }\n })\n\n\n // Store the queryURL needed to get the data for UV Index\n var queryURL2 = \"https://api.openweathermap.org/data/2.5/uvi?appid=\" + APIKey + \"&lat=\" + cityLat + \"&lon=\" + cityLon;\n // Use a separate ajax call for getting the UV Index with a different queryURL\n $.ajax({\n url: queryURL2,\n method: \"GET\"\n }).then(function (response) {\n // Get the UV Index value and store in a variable\n var uvIndexVal = response.value;\n // Render the UV Index and display on screen\n renderUVIndex();\n\n // Create a function that would render the UV Index\n function renderUVIndex() {\n // Target the div where to append the UV Index\n var currentDataText = $(\".dataText\");\n\n // Create divs and add class\n var currentDataUVIndex = $(\"<div>\").addClass(\"otherInfo\");\n var currentUVIndexLabel = $(\"<span>\").addClass(\"uk-text-small\");\n var currentUVIndexVal = $(\"<span>\").addClass(\"uk-text-bold uvIndex\");\n // Set contexts\n currentUVIndexLabel.text(\"UV Index: \");\n currentUVIndexVal.text(uvIndexVal);\n // Create conditionals for color coding\n if (uvIndexVal >= 0 && uvIndexVal < 3) {\n currentUVIndexVal.css(\"color\", \"var(--very-low)\");\n } else if (uvIndexVal >= 3 && uvIndexVal < 5) {\n currentUVIndexVal.css(\"color\", \"var(--low)\");\n } else if (uvIndexVal >= 5 && uvIndexVal < 7) {\n currentUVIndexVal.css(\"color\", \"var(--moderate)\");\n } else if (uvIndexVal >= 7 && uvIndexVal < 10) {\n currentUVIndexVal.css(\"color\", \"var(--high)\");\n } else if (uvIndexVal >= 10) {\n currentUVIndexVal.css(\"color\", \"var(--very-high)\");\n }\n\n // Append\n currentDataUVIndex.append(currentUVIndexLabel).append(currentUVIndexVal);\n currentDataText.append(currentDataUVIndex);\n }\n })\n\n }\n\n\n // Store the queryURL needed to get the data for the 5-day forecast\n var queryURL3 = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + inputValue + \"&appid=\" + APIKey;\n\n // Use a separate ajax call for getting the UV Index with a different queryURL\n $.ajax({\n url: queryURL3,\n method: \"GET\"\n }).then(function (response) {\n\n // Target fiveDaySection\n var fiveDaySection = $(\".fiveDaySection\");\n\n // Get list array\n var listArray = response.list;\n\n renderForecast();\n // Create a function to render data for the forecast\n function renderForecast() {\n // Loop through array\n for (var i = 0; i < listArray.length; i++) {\n // Find the date and time data\n var futureDate = listArray[i].dt_txt;\n // Create an instance of each date and time\n var dateInstance = new Date(futureDate);\n // Get the hours\n var futureHour = dateInstance.getHours();\n // If the hours is greater than the current hour\n if (futureHour === 12) {\n // Then get the date, weather icon, temperature, humidity\n // Turn date to format Saturday, Mar 28\n var forecastDay = forecastWeekdays[dateInstance.getDay()];\n var forecastMonth = forecastMonths[dateInstance.getMonth()];\n var forecastDate = dateInstance.getDate();\n var forecastDayDate = forecastDay + \", \" + forecastMonth + \" \" + forecastDate;\n var forecastIcon = listArray[i].weather[0].icon;\n var forecastIconUrl = \"https://openweathermap.org/img/wn/\" + forecastIcon + \"@2x.png\";\n var forecastTempK = listArray[i].main.temp;\n var forecastHumidity = listArray[i].main.humidity;\n // Convert temp to F\n var forecastTempF = ((forecastTempK - 273.15) * 1.80 + 32).toFixed();\n // Create divs and add classes\n var forecastCardWrapper = $(\"<div>\").addClass(\"uk-width-1-5@m uk-width-1-3@s uk-light forecastCardWrapper\");\n var forecastCard = $(\"<div>\").addClass(\"uk-card uk-card-body uk-flex uk-flex-column uk-flex-middle forecastCard\");\n var forecastDateSpan = $(\"<span>\").addClass(\"uk-text-bold forecastDate\");\n var forecastIconImg = $(\"<img>\");\n var forecastTempDiv = $(\"<div>\").addClass(\"uk-heading-medium uk-margin-remove\");\n var forecastTempUnitSpan = $(\"<span>\").addClass(\"uk-heading-small uk-text-top\");\n var forecastHumidityDiv = $(\"<div>\").addClass(\"humidityForecast\");\n var forecastHumidityLabel = $(\"<span>\").addClass(\"uk-text-small\");\n var forecastHumidityVal = $(\"<span>\").addClass(\"uk-text-bold\");\n // Set the contexts\n forecastDateSpan.text(forecastDayDate);\n forecastIconImg.attr({ \"data-src\": forecastIconUrl, alt: \"Weather icon\", width: \"40px\", \"uk-img\": \"\" });\n forecastTempDiv.text(forecastTempF);\n forecastTempUnitSpan.html(\"&#176F\");\n forecastHumidityLabel.text(\"Humidity: \");\n forecastHumidityVal.text(forecastHumidity + \"%\");\n\n // Append\n forecastHumidityDiv.append(forecastHumidityLabel).append(forecastHumidityVal);\n forecastTempDiv.append(forecastTempUnitSpan);\n forecastCard.append(forecastDateSpan).append(forecastIconImg).append(forecastTempDiv).append(forecastHumidityDiv);\n forecastCardWrapper.append(forecastCard);\n fiveDaySection.append(forecastCardWrapper);\n }\n\n }\n\n }\n\n })\n\n })\n // Clear the input field\n $(\"#cityInput\").val(\"\");\n\n }", "title": "" }, { "docid": "5cf00afd6dd967545bf948341e6c9802", "score": "0.46764585", "text": "function currentWeatherAPI(inputCity){\n //clears current weather data if any pre-exists\n if($(\".card-body\")){\n $(\".card-body\").empty()\n }\n \n \n //API call\n var currentWeatherUrl = 'https://api.openweathermap.org/data/2.5/weather?q=' + inputCity + '&units=imperial&appid=fe69a8ae1bfba9fa932a4b4358617cbf'\n fetch(currentWeatherUrl)\n .then(function (response){\n return response.json();\n })\n\n //creates elements of top card dynamically\n .then(function (data){\n if(inputCity){\n var todayCard = $(\".card-body\")\n var iconCode = `${data.weather[0].icon}`\n var iconURL = \"https://openweathermap.org/img/wn/\" + iconCode + \".png\" \n let tempRounded = Math.round(data.main.temp)\n let cardOneTitle = $(\"<h2 class='card-title'></h2>\").appendTo(todayCard).text(inputCity + \" \" + \"(\"+today+\")\")\n $(\"<img id='weatherIcon' src='' alt='weather icon'>\").appendTo(cardOneTitle).attr('src',iconURL)\n $(\"<p class='card-text'></p>\").appendTo(todayCard).text(\"Temperature: \" + tempRounded +\"F\")\n $(\"<p class='card-text'></p>\").appendTo(todayCard).text(`Humidity: ${data.main.humidity}%`)\n $(\"<p class='card-text'></p>\").appendTo(todayCard).text(`Wind Speed: ${data.wind.speed}`)\n $(\"<p class='card-text'></p>\").appendTo(todayCard).text(\"UV Index: \")\n \n\n }\n \n })\n \n \n convertCityLatLong(inputCity); \n\n\n}", "title": "" }, { "docid": "9a4c280345404c7db10c631e6c8af08d", "score": "0.46747562", "text": "function addToDOM() {\n createSlides()\n slides.forEach( (slide, index) => {\n document.body.appendChild(slide)\n if (index !== 0) {\n slide.classList.add('hide')\n }\n })\n}", "title": "" }, { "docid": "ba34385bd1a68d114d3f277d3caaf477", "score": "0.46732807", "text": "function createIWContent(id, isLive) {\n if(document.getElementById(\"select-car\").value !=0)\n usersCarConns = carModels[document.getElementById(\"select-car\").value];\n\n //Showing a info windows when you click on the marker\n connectorsString = generateConnectorString(id, isLive);\n console.log(jsonData[id].csmd.Contact_info);\n contentString =\n \"<div id=\\\"station-tooltip\\\">\"+\n \"<div id=\\\"topBox\\\">\"+\n \"</div>\"+\n \"<div id=\\\"secondRow\\\">\" +\n \"<img class='img-to-load' src=\\\"\"+ getStationImage(id) + \"\\\"/>\" +\n \"<div id='placeNameIcons' style='color:blue;'>\"+\n \"<h3>\"+ jsonData[id].csmd.name + \"(ID:\" + id + \")</h3>\" +\n \"<p><strong>Tilgjengelighet</strong> \"+ jsonData[id].attr.st[2].trans.replace('\\r\\n','<br />')+\"</p>\" +\n \"</div>\"+\n \"<div class='markerColor' style='background-color:\"+ (faultyConns / jsonData[id].csmd.Number_charging_points == 1 ? \"red\" : (isLive ? (isStationOccupiedStatus(id) < occupiedLimit ? \"yellow\":\"lightgreen\") : \"blue\")) + \";'>\"+\n \"</div>\"+\n \"</div>\"+\n \"<div id='secondContainer'>\"+\n \"<div id='infoLeft'>\"+\n \"<p><strong>Adresse:</strong> \"+ jsonData[id].csmd.Street.replace('\\r\\n','<br />') +\" \" + jsonData[id].csmd.House_number.replace('\\r\\n','<br />') + \", \" + jsonData[id].csmd.Zipcode.replace('\\r\\n','<br />') + \" \" + jsonData[id].csmd.City.replace('\\r\\n','<br />') +\"</p>\"+\n \"<p><strong>Lokasjonsbeskrivelse:</strong> \"+ jsonData[id].csmd.Description_of_location +\"</p>\" +\n \"<p><strong>Eier:</strong> \" + jsonData[id].csmd.Owned_by.replace('\\r\\n','<br />') +\"</p>\" +\n \"<p><strong>Kommentarer:</strong> \"+ jsonData[id].csmd.User_comment.replace('\\r\\n','<br />')+\"</p>\" +\n (jsonData[id].csmd.Contact_info != null ? \"<p><strong>Kontakt info:</strong> \"+ jsonData[id].csmd.Contact_info.replace('\\r\\n','<br />')+\"</p>\" : \"\") +\n \"</div>\"+\n \"<div id='chargingPoints'>\"+\n \"<p style='border-bottom:1px solid gray;margin-bottom:0;'><strong>Ladepunkter:</strong> \"+ jsonData[id].csmd.Number_charging_points + \" </p>\" +\n \"<div> \"+\n connectorsString +\n \"</div>\" +\n \"</div>\"+\n \"</div>\"+\n\n \"<div id='lowerContainer'>\"+\n '<button onclick=\"addWaypoint(\\'' + id + '\\')\" >Legg til i rute</button>' +\n '<button onclick=\"navigateFromUser(geopos, this)\" value=\"'+ jsonData[id].csmd.Position.replace(/[()]/g,\"\") +'\">Ta meg hit</button>'+\n\n '<button onclick=\"addToFavorites(\\'' + id + '\\')\" >Legg til favoritt</button>' +\n \"</div>\"+\n \"</div>\";\n return contentString;\n}", "title": "" }, { "docid": "8cc572fe465e7407d1617ad8d8ddbe46", "score": "0.46726587", "text": "function getCities(){\n let cities;\n if(localStorage.getItem('cities') === null){\n cities = [];\n } else {\n cities = JSON.parse(localStorage.getItem('cities'));\n }\n\n cities.forEach(city => {\n // create div container for p and i elements\n const divEl = document.createElement('div');\n // add classname to divEl\n divEl.className = 'city-collection';\n //create paragraph element\n const paragraph = document.createElement('p');\n // append paragraph text node to paragraph\n paragraph.appendChild(document.createTextNode(city));\n // add classname to paragraph\n paragraph.className = 'text-city';\n // create i element\n const icon = document.createElement('i');\n // add classname to icon\n icon.className = 'fas fa-trash delete-city';\n // append paragraph and icon to div element\n divEl.insertAdjacentElement('afterbegin', paragraph)\n divEl.insertAdjacentElement('beforeend', icon);\n // append div element to list of cities\n listOfCities.appendChild(divEl);\n })\n}", "title": "" }, { "docid": "dc8a641c0c0c8dc75f6c2a47a55e45d8", "score": "0.46708834", "text": "function searchCity() {\n \n var searchTerm = userInput.val()\n console.log(searchTerm)\n var key = \"bda2f2ea374379c994c54cc335a5e52b\";\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?q=\" + searchTerm + \"&units=metric&APPID=\" + key;\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(response)\n \n // This is capturing the Longitude and Latitude of the cities so i can use it for the second Request.\n userLat = response.coord.lat\n userLon = response.coord.lon\n\n // This code sets all the target cities information in the Big section.\n currentCityName.html(response.name + \" (\" + today + \") \" + '<img src=\"Assets/' + response.weather[0].icon + '@2x.png\"></img>')\n currentCityTemp.html(\"Temperature: \" + response.main.temp + \" °C\")\n currentCityHumidity.html(\"Humidity: \" + response.main.humidity + \" % \")\n currentCityWind.html(\"Wind Speed: \" + response.wind.speed + \" MPH\")\n\n // Code below is a different API request that is executed once the first one returns because i need the Lat and Longitude to go into this request.\n var UVkey = \"bda2f2ea374379c994c54cc335a5e52b\";\n var UVqueryURL = \"https://api.openweathermap.org/data/2.5/uvi?appid=\" + UVkey + \"&lat=\" + userLat + \"&lon=\" + userLon;\n\n // This Request is for the UV Index, as it is a seperate API\n $.ajax({\n url: UVqueryURL,\n method: \"GET\"\n }).then(function(UVresponse) {\n console.log(UVresponse)\n currentCityUV.html(UVresponse.value);\n currentCityUVDiv.removeClass( \"hide\" );\n /// Sets the class for UV depending on Values\n if (UVresponse.value < 3.3) {\n currentCityUV.attr(\"class\", \"UV-green\")\n console.log(\"green\")\n } else if (UVresponse.value > 6.6) {\n currentCityUV.attr(\"class\", \"UV-red\")\n console.log(\"red\")\n } else {\n currentCityUV.attr(\"class\", \"UV-yellow\")\n console.log(\"yellow\")\n }\n }\n )\n }\n )\n }", "title": "" }, { "docid": "c454bdb60bba0dcbdd80597faf8fb97b", "score": "0.4666187", "text": "function displayCity() {\n // Here we run our AJAX call to the OpenWeatherMap API\n\n const API = \"51d7968cfee71b16dc19326d1a6ed198\";\n\n\n var queryURL = 'https://api.openweathermap.org/data/2.5/weather?q=tucson&units=imperial' + \"&APPID=\" + API;\n\n $.ajax({\n url: queryURL,\n method: \"GET\",\n dataType: \"jsonp\",\n success: function(response) {\n console.log(response);\n }\n })\n // We store all of the retrieved data inside of an object called \"response\"\n .done(function(response) {\n console.log('response' + response);\n\n $(\".city\").html(\"<h1>Weather in \" + response.name + \"</h1>\");\n $(\".city-card\").html(response.name);\n $(\".date\").text(Date());\n let weatherIcon = $(\"<img src='http://openweathermap.org/img/w/\" + response.weather[0].icon + \".png' alt='Icon depicting current weather.'>\");\n weatherIcon.attr('id', 'weatherIcon');\n $('#icon').html(weatherIcon);\n\n let descriptionNav = response.weather[0].description;\n\n $('#nav-description').text(descriptionNav)\n $(\"#temperature\").text(response.main.temp.toFixed(1) + \"°(F)\");\n $(\"#humidity\").text(\"Humidity: \" + response.main.humidity + \"%\");\n $(\"#max-temp\").text(\"Max Temp: \" + response.main.temp_max + \"°(F)\");\n $(\"#min-temp\").text(\"Min Temp: \" + response.main.temp_min + \"°(F)\");\n\n $(\"#wind\").text(\"Wind: \" + response.wind.speed + \" mph\");\n $(\"#rain\").text(\"Rain: \" + response.rain);\n // $(\"#icon\").html(\"time of day \" + response.weather[0].icon);\n $(\"#sunrise\").text(\"Sunrise: \" + response.sys.sunrise);\n // Log the queryURL\n console.log(queryURL);\n\n // Log the resulting object\n console.log(response);\n console.log(response.weather[0].description);\n });\n\n }", "title": "" }, { "docid": "fbd3e2de6f87083f9e67bcc5e6f98160", "score": "0.46640664", "text": "function showWeatherSlides(slideRequest) {\n\t\t//Displays slide content\n\t\tprev[0].style.visibility = \"visible\";\n\t\tnext[0].style.visibility = \"visible\";\n\t\tdot_Container.style.visibility = \"visible\";\n\n\t\t// Makes On Screen Panels Visible (Top Right & Bottom Left Panels)\n\t\ttop_right_panel.className = top_right_panel.className.replace(\"d-none\", \"\");\n\t\tbottom_left_panel.className = bottom_left_panel.className.replace(\"d-none\", \"\");\n\n\t\t// code to handle if slide is too low / High\n\t\tif (slideRequest > slides.length) {globalVariableStorage.weatherSlideIndex = 1}\n\t\tif (slideRequest < 1) {globalVariableStorage.weatherSlideIndex = slides.length}\n\n\t\t// Sets ALL Slides display to none when showSlides() is called\n\t\tfor (i = 0; i < slides.length; i++) {\t\n\t\t\tslides[i].style.display = \"none\";\n\t\t}\n\n\t\t// Sets ALL dots display to none when showSlides() is called\n\t\tfor (i = 0; i < dots.length; i++) {\n\t\t\tdots[i].style.visibility = \"visible\";\n\t\t \tdots[i].className = dots[i].className.replace(\" active-dot\", \"\");\n\t\t}\n\n\t\t// Displays the dot and slide at what ever location/index weatherSlideIndex is set at\n\t\tslides[globalVariableStorage.weatherSlideIndex-1].style.display = \"block\";\n\t\tdots[globalVariableStorage.weatherSlideIndex-1].className += \" active-dot\";\n\n\t\t// Calling Slideshow transition / Animation Logic\n\t\tweatherSlideshowAnimation(weather_data[globalVariableStorage.weatherSlideIndex-1], \n\t\t\tweather_data_title[globalVariableStorage.weatherSlideIndex-1]);\n\t\t\n\t\t//Calling Slideshow Automation / Timer\n\t\tweatherSlideshowTimer();\n\t}", "title": "" }, { "docid": "7cc2b37dbc8448a0776d4752467b626f", "score": "0.46640146", "text": "function tourSelected(tourId) {\n //variables to get the html elements that will host the dynamic content\n var tourDetailsDiv = document.getElementById(\"tourDetails\");\n var h2PointA = document.getElementById(\"h2-pointA\");\n var h2PointB = document.getElementById(\"h2-pointB\");\n var h2PointC = document.getElementById(\"h2-pointC\");\n var pPointA = document.getElementById(\"p-pointA\");\n var pPointB = document.getElementById(\"p-pointB\");\n var pPointC = document.getElementById(\"p-pointC\");\n var imgPointA = document.getElementById(\"img-pointA\");\n var imgPointB = document.getElementById(\"img-pointB\");\n var imgPointC = document.getElementById(\"img-pointC\");\n var aPointA = document.getElementById(\"a-pointA\");\n var aPointB = document.getElementById(\"a-pointB\");\n var aPointC = document.getElementById(\"a-pointC\"); \n \n tourDetailsDiv.style.display='block';\n tourDetailsDiv.scrollIntoView();\n\n //update the html elements of Tour sectiion by tourId value\n //set the locations array that will be marked on the map \n if (tourId == \"tour1\")\n {\n locations = [\n { lat: -23.556985456407368, lng: -46.6458763984729 },\n { lat: -23.544558309148307, lng: -46.643824730683605 },\n { lat: -23.550114427773106, lng: -46.64513414697759 }\n ]; \n h2PointA.innerHTML = \"Bixiga neighbourhood\";\n h2PointB.innerHTML = \"Itália Building\";\n h2PointC.innerHTML = \"Famiglia Mancini\";\n\n pPointA.innerHTML = \"Bixiga is a neighbourhood in the center of the city of São Paulo, Brazil. It is located within the district of Bela Vista. Bixiga is known for having been a hub for Italian immigrants. The origins of the neighborhood can be traced to the foundation of the city. Nowadays, Bixiga is considered part of the official district of Bela Vista, but appeared on city maps with the Bixiga designation until 1943. It was incorporated into Bela Vista with the passing of Law 1242, in 1910. The area between the historic core, Paulista Avenue, 23 de Maio Avenue and 9 de Julho Avenue became, in 1878, the Chácara do Bexiga (Bexiga Farmstead), owned by Antônio José Leite Braga.\";\n pPointB.innerHTML = \"Built in 1956, the Itália Building has long been the highest in the city, with 165 me is one of the most visited attractions in the capital, due to 360º view of the city that its terrace, where is located the restaurant Terrace Italy provides.With 44 floors, 19 elevators, 52 000 m², seating for ten thousand and four thousand windows on its facade, the building is protected by Heritage. Inside there is a library, a games room and also the Teatro Italy.\";\n pPointC.innerHTML = \"On charming and romantic Rua Avanhandava – a leafy, almost European-feeling side street in Centro – this traditional trattoria is one of the city's most atmospheric, with throngs of Chianti fiascos hanging from the ceiling and an old-school family-style Italian ambience. In reality portions serve three, which is how many you'll need to divvy up the perusing of the gigantic menu of pasta, meat and seafood dishes.\";\n \n imgPointA.src = \"assets/images/tours/bixiga.jpg\"; \n imgPointB.src = \"assets/images/tours/terraco_ita.jpg\"; \n imgPointC.src = \"assets/images/tours/famiglia_mancini.jpg\"; \n\n aPointA.href = \"http://www.portaldobixiga.com.br/\";\n aPointB.href = \"https://www.edificioitalia.com.br/\";\n aPointC.href = \"http://www.famigliamancini.com.br/\";\n }\n else if(tourId == \"tour2\")\n {\n locations = [\n { lat: -23.56117795896671, lng: -46.655838987458196 },\n { lat: -23.560658526904586, lng: -46.6946764027999 },\n { lat: -23.54929767878088, lng: -46.612906331635756}\n ]; \n h2PointA.innerHTML = \"Museum of Art of São Paulo – MASP\";\n h2PointB.innerHTML = \"Tomie Ohtake Institute\";\n h2PointC.innerHTML = \"Immigration Museum of São Paulo State\";\n\n pPointA.innerHTML = \"Located in the heart of the city, Paulista Avenue, the Museu de Arte de São Paulo Assis Chateaubriand – is one of the most important museums in the Southern Hemisphere and one of the main postcards of the city. It is on the list of the ten most visited tourist attractions of São Paulo, with a collection of about eight thousand pieces.It features works by great names of the national painting (Candido Portinari, Di Cavalcanti, Anita Malfatti and Almeida Junior) and international (Raphael, Mantegna, Botticceli, Delacroix, Renoir, Monet, Cézanne, Picasso, Modigliani, Toulouse-Lautrec, Van Gogh, Matisse and Chagall). The inauguration took place in 1968 and 1982, the MASP was listed by Condephaat – Council of Historical Heritage Protection, Archaeological, Artistic and Tourist of the State and in 2003 by IPHAN.\";\n pPointB.innerHTML = \"Opened in 2001, the Instituto Tomie Ohtake has no permanent collection, but hosts exhibitions of contemporary art, which are reference in the last 50 years, and works of the artist who gives name to the space. Designed by architect Ruy Ohtake, the complex has avant-garde architecture. Its 65 000 m² are divided between work, culture and leisure. With total area of ​​7,500 m², it has seven exhibition rooms, four workshops, a bookstore, an object store, documentation area, auditorium, restaurant, café, theater and cinema.\";\n pPointC.innerHTML = \"The Museum of the São Paulo State Immigration is primarily responsible for preserving the memory of the people who arrived in Brazil in the mid- nineteenth and twentieth centuries, and that their work helped build and transform the state capital and the country.Acting as a meeting point of different immigrant communities, the origins of the current museum date back to 1887, when it was founded the Immigrants Lodge, a place that had the duty to receive and forward to working travelers brought by the government. One of the main sights of the city, not only the historical value, but also for its centuries-old architecture, the museum has rich attractions such as the wall on which are etched in wood over 14,000 surnames, from different corners of the globe.\";\n \n imgPointA.src = \"assets/images/tours/masp.jpg\"; \n imgPointB.src = \"assets/images/tours/tomie_ohtake.jpg\"; \n imgPointC.src = \"assets/images/tours/museu_imigracao.jpg\"; \n\n aPointA.href = \"https://masp.org.br/\";\n aPointB.href = \"https://www.institutotomieohtake.org.br/\";\n aPointC.href = \"https://museudaimigracao.org.br/\"; \n }\n else if(tourId == \"tour3\")\n {\n locations = [\n { lat: -23.587327692598006, lng: -46.655691683582624 },\n { lat: -23.533938300775326, lng: -46.639746945276805 },\n { lat: -23.581564931258065, lng: -46.66705397411149 }\n ]; \n\n h2PointA.innerHTML = \"Ibirapuera Park\";\n h2PointB.innerHTML = \"São Paulo Hall\";\n h2PointC.innerHTML = \"Skye Bar & Restaurant\";\n\n pPointA.innerHTML = \"Opened in 1954, the Ibirapuera Park is not only the most visited and well-known park in São Paulo, as well as one of the most important areas of culture and leisure city. Conceived by icons such as Oscar Niemeyer, along the lines of the world’s great parks, the Ibirapuera attracts all kinds of public. Since athletes, who go to enjoy the jogging track, a bike lane, the bike rack, the courts and soccer fields ; even those who go in search of culture and attend the OCA, Auditorium, African Museum, Biennale, MAM, among others.It is very easy to understand why this is one of the favorite places in the city: offers snack bars, seating areas, children’s playground, multimedia source and activities all day long. For those seeking only a moment of tranquility in the midst of nature, this is also the ideal place since it is home to several animal and plant species.\";\n pPointB.innerHTML = \"Built with concrete structure and brick masonry in Louis XVI style with sculptures and minute details, the Julio Prestes would be the starting station of the railway Sorocabana, the main coffee shipping vein in São Paulo.Headquarters of the State Symphony Orchestra of São Paulo, occupying total area of ​​25,000 m², the area offers similarity between the volumes, geometry and proportions found in areas recognized genre in the world. The Sala São Paulo today is considered the best concert hall in Latin America.\";\n pPointC.innerHTML = \"It is located right beside Restaurante Skye, with their sophisticated decoration and typical Brazilian, French, Italian and Japanese dishes. In the bar, the bar food menu consists mainly of varieties of pizzas and sushi, while drinks range from common to the more exotic, such as blends of vodka with wasabi.Both are run by Chef Emmanuel Bassoleil, French chef at the head of Unique’s hotel kitchen since its grand opening in 2002.The atmosphere is relaxed and modern with a varied public from different nationalities and all ages, from younger crowds to couples.Dinner plates are served in a nightclub atmosphere, with DJs getting starting at 9pm, and who mainly play electronic music.Access is independent of the hotel entrance, by panoramic elevator. It usually gets crowded on weekends.\";\n \n imgPointA.src = \"assets/images/tours/ibirapuera.jpg\"; \n imgPointB.src = \"assets/images/tours/saopaulo_hall.jpg\"; \n imgPointC.src = \"assets/images/tours/skye_bar.jpg\"; \n\n aPointA.href = \"https://www.prefeitura.sp.gov.br/cidade/secretarias/meio_ambiente/parques/regiao_sul/index.php?p=14062\";\n aPointB.href = \"http://www.salasaopaulo.art.br/home.aspx\";\n aPointC.href = \"https://www.hotelunique.com/en/restaurant-bar/skye/\"; \n }\n else if(tourId == \"tour4\")\n {\n locations = [\n { lat: -23.541612431424202, lng: -46.629461104799795 },\n { lat: -23.591206545074716, lng: -46.68975778945486 },\n { lat: -23.561011814622862, lng: -46.65653011829159 }\n ]; \n\n h2PointA.innerHTML = \"Municipal Market\";\n h2PointB.innerHTML = \"JK Iguatemi - Shopping\";\n h2PointC.innerHTML = \"Paulista Avenue\";\n\n pPointA.innerHTML = \"The major feature at downtown is the popular market. Rua 25 de Março attracts people from all over Brazil that seek feedstock, handcraft and even carnival costumes. Mercado Municipal, right next to it, is a mandatory stop to buy spices, food and beverage. On the surroundings of Rua José Paulino, at Bom Retiro, and on Brás there is a clothing market. Rua São Caetano, traditionally known as Bride’s Street, is entirely dedicated to dresses and wedding accessories. For those who seek electronics and car accessories, there is Rua Santa Ifigênia.\";\n pPointB.innerHTML = \"The gathering of international best brand luxury stores is the main focus of Shopping Malls Cidade Jardim, JK and Iguatemi. Besides brands like Armani, Chanel, and Tiffany & Co., each center has special stores: Cidade Jardim hosts the only Lego store in SP, while Iguatemi has unique boutiques from stylist Diane Von Furstenberg and shoe designer Christian Louboutin. Now at Shopping Mall JK Iguatemi, a new luxury place in the city, there are TopShop and Miu Miu, which are already consolidated all over the globe.\";\n pPointC.innerHTML = \"The most popular avenue of the city concentrates all that is best in São Paulo. It is possible to visit museums and cultural centers, find a park amid great skyscrapers, check book launchings, enjoy the happy hour in one of its many bars, enjoy the evening at nightclubs, watch theatrical performances and movie sessions of the most diverse productions, and go shopping: all in one place! Even with all the excitement, Avenida Paulista allows contact with nature: the Trianon Park offers benches, spaces for walking and eventual cultural performances such as concerts, meetings for discussions and small plays, to relax amidst the remaining flora Atlantic forest. Another interesting option is Park Mario Covas, where the Central of Tourist Information – CIT is located.\";\n \n imgPointA.src = \"assets/images/tours/mercado.jpg\"; \n imgPointB.src = \"assets/images/tours/jk_iguatemi.jpg\"; \n imgPointC.src = \"assets/images/tours/paulista.jpg\"; \n\n aPointA.href = \"https://portaldomercadao.com.br/\";\n aPointB.href = \"https://iguatemi.com.br/jkiguatemi/\";\n }\n\n //reinit the map\n initMap();\n}", "title": "" }, { "docid": "06388c0366e697effff63def4375d43f", "score": "0.46626067", "text": "async function callWeatherAPI (currentCityName, currentCityLat, currentCityLon, API_KEY, WEATHERBIT_API_URL) {\n let compiledCityWeatherInformationObject = {};\n try {\n var jQueryXMLHTTPResponse = await $.ajax({\n dataType: \"json\",\n url: WEATHERBIT_API_URL,\n data: {\n key: API_KEY,\n lon: currentCityLon,\n lat: currentCityLat\n }\n });\n const [weatherbitResponse1, weatherbitResponse2, weatherbitResponse3,\n weatherbitResponse4, weatherbitResponse5, weatherbitResponse6,\n ...weatherbitResponseRemaining10] = await jQueryXMLHTTPResponse.data;\n return compiledCityWeatherInformationObject[currentCityName] = {\n \"todaysIconCode\": weatherbitResponse1.weather['code'], \n \"todaysCurrentTemp\": Math.round(weatherbitResponse1['temp']),\n \"todaysLow\": Math.round(weatherbitResponse1['min_temp']),\n \"todaysHigh\": Math.round(weatherbitResponse1['max_temp']),\n \"todaysDescription\": weatherbitResponse1.weather['description'], \n \"todaysDate\": weatherbitResponse1['valid_date'],\n \"todayPlusOneDate\": weatherbitResponse2['valid_date'],\n \"todayPlusOneIconCode\": weatherbitResponse2.weather['code'],\n \"todayPlusOneLow\": Math.round(weatherbitResponse2['min_temp']),\n \"todayPlusOneHigh\": Math.round(weatherbitResponse2['max_temp']),\n \"todayPlusTwoDate\": weatherbitResponse3['valid_date'],\n \"todayPlusTwoIconCode\": weatherbitResponse3.weather['code'],\n \"todayPlusTwoLow\": Math.round(weatherbitResponse3['min_temp']),\n \"todayPlusTwoHigh\": Math.round(weatherbitResponse3['max_temp']),\n \"todayPlusThreeDate\": weatherbitResponse4['valid_date'],\n \"todayPlusThreeIconCode\": weatherbitResponse4.weather['code'],\n \"todayPlusThreeLow\": Math.round(weatherbitResponse4['min_temp']),\n \"todayPlusThreeHigh\": Math.round(weatherbitResponse4['max_temp']),\n \"todayPlusFourDate\": weatherbitResponse5['valid_date'],\n \"todayPlusFourIconCode\": weatherbitResponse5.weather['code'],\n \"todayPlusFourLow\": Math.round(weatherbitResponse5['min_temp']),\n \"todayPlusFourHigh\": Math.round(weatherbitResponse5['max_temp']),\n \"todayPlusFiveDate\": weatherbitResponse6['valid_date'],\n \"todayPlusFiveIconCode\": weatherbitResponse6.weather['code'],\n \"todayPlusFiveLow\": Math.round(weatherbitResponse6['min_temp']),\n \"todayPlusFiveHigh\": Math.round(weatherbitResponse6['max_temp'])\n }\n }\n catch (error) {\n return error; //Returns to getCityWeatherData catch\n }\n}", "title": "" }, { "docid": "0457169001902223f11acbb5697ed80a", "score": "0.4656407", "text": "function runWeatherAJAX(divId) {\n $.ajax({\n url: weatherQueryURL,\n method: \"GET\"\n }).then(function (weatherResponse) {\n $(\"#eventContainer\").append(\"<div class = 'DestroyMe' id = AwesomeNewDiv\" + divId + \">\");\n $(\"#AwesomeNewDiv\" + divId).append(\"<h3>5-Day Weather Forecast for \" + weatherResponse.city.name + \"</h3>\");\n $(\"#AwesomeNewDiv\" + divId).append(\"<div class = 'carousel' id=CarouselDiv\" + divId + \">\");\n\n for (i = 0; i < (weatherResponse.list).length; i++) {\n counterCarousel++;\n $(\"#CarouselDiv\" + divId).append(\"<div class = 'carousel-item cyan white-text' href='#' id=CarouselItem\" + counterCarousel + \">\");\n $(\"#CarouselItem\" + counterCarousel).append(\"<p class='white-text'>\" + weatherResponse.list[i].dt_txt + \"</p>\");\n $(\"#CarouselItem\" + counterCarousel).append(\"<p><img src = 'https://openweathermap.org/img/w/\" + weatherResponse.list[i].weather[0].icon + \".png' class='floatLeft' alt='WeatherIcon'></p>\");\n $(\"#CarouselItem\" + counterCarousel).append(\"<h5>\" + weatherResponse.list[i].weather[0].description + \"</h5>\");\n $(\"#CarouselItem\" + counterCarousel).append(\"<p class='white-text'>Temp= \" + weatherResponse.list[i].main.temp + \"°F</p>\");\n }\n $('#CarouselDiv' + divId).carousel();\n }, function () {\n console.log(\"Error, weather ajax call city not found\");\n alert(\"City Not Found, Click 'clear all searches' button to proceed\");\n });\n }", "title": "" }, { "docid": "b91d8905b76035ae345ecc9403e03f5e", "score": "0.46377903", "text": "function variableCityCurrentCall(location) {\n var queryURL = \"https://api.openweathermap.org/data/2.5/weather?q=\" + location + \"&units=imperial&appid=715ee435d9e6cc809bc1cb6b62581405\";\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (response) {\n $(\"#cityName h2\").html(response.name);\n $(\"#currentForecast .card-text:first\").append(\"<span> Time: </span>\" + response.dt + \" UTC (Unix time) <img src='https://openweathermap.org/img/wn/\" + response.weather[0].icon + \"@2x.png'><br>\");\n $(\"#currentForecast .card-text:first\").append(\"<span> Temperature: </span>\" + response.main.temp + \"&#8457<br>\");\n $(\"#currentForecast .card-text:first\").append(\"<span> Temp feels like: </span>\" + response.main.feels_like + \"&#8457<br>\");\n $(\"#currentForecast .card-text:first\").append(\"<span> Humidity: </span>\" + response.main.humidity + \"&#37;<br>\");\n $(\"#currentForecast .card-text:first\").append(\"<span> Weather Condition: </span>\" + response.weather[0].main + \", \" + response.weather[0].description + \"<br>\");\n $(\"#currentForecast .card-text:first\").append(\"<span> Windspead & Direction: </span>\" + response.wind.speed + \" mph\" + \" at \" + response.wind.deg + \"&deg;<br>\");\n //using the current weather response to get lat and lon, inorder to get UV index response\n var queryURL2 = \"https://api.openweathermap.org/data/2.5/uvi?lat=\" + response.coord.lat + \"&lon=\" + response.coord.lon + \"&appid=715ee435d9e6cc809bc1cb6b62581405\";\n $.ajax({\n url: queryURL2,\n method: \"GET\"\n }).then(function (response) {\n $(\"#currentForecast .card-text:first\").append(\"<span> UV Index: </span> <div class='uvIndex'>\" + response.value + \"</div> <br>\");\n });\n //closes parent ajax call\n });\n //closes variableCityCurrentCall()\n }", "title": "" }, { "docid": "1fdafb18c57d3a3b98d0457762d31e2b", "score": "0.46365795", "text": "function showCity() {\n\t flatwoodsParagraph.textContent=\"\";\n\t\t cityParagraph.textContent=\"This alley in Bloomington was great for these photos\";\n\t\t gymParagraph.textContent=\"\";\n\t\t ownParagraph.textContent=\"\";\n\t\t figureImage.src=\"images/venuepemberton.jpg\";\n\t\t figcaption.textContent=\"Downtown Bloomington\";\n\t }", "title": "" }, { "docid": "9c4068e4eaf3911fa8708c9b115fee03", "score": "0.46343762", "text": "cityInfo() {\n this.cityTemplate = `<p>\n <span>City ID: ${this.city.id}</span> |\n <span>City Name: <span contenteditable=\"true\" class=\"editable\">${this.city.name}</span></span> |\n <span>City Location: ${this.city.location}</span>\n </p>`\n\n $('[data-element=\"city\"]').html(this.cityTemplate)\n }", "title": "" }, { "docid": "d79d36b868c9bf8b8cf7584d8bb21573", "score": "0.46315652", "text": "function currentConditions(city) {\n var queryUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=imperial&appid=${apiKey}`;\n \n $.ajax({\n url: queryUrl,\n method: \"GET\"\n }).then(function(cityResponse){\n console.log(cityResponse);\n $(\"#cityInfo\").empty();\n\n var iconPic = cityResponse.weather[0].icon;\n var iconURL = `https://openweathermap.org/img/w/${iconPic}.png`;\n var currentCity = $(`\n <h2 id= \"currentCity\">\n ${cityResponse.name} ${today} <img src=\"${iconURL}\" /></h2>\n <p>Temp: ${cityResponse.main.temp} F</p>\n <p>Humidity: ${cityResponse.main.humidity}%</p>\n <p>Wind: ${cityResponse.wind.speed}MPH</p>\n `);\n $(\"#cityInfo\").append(currentCity);\n \n \n //HEAT INDEX\n var lat = cityResponse.coord.lat;\n var lon = cityResponse.coord.lon;\n var uviURL = `https://api.openweathermap.org/data/2.5/uvi?lat=${lat}&lon=${lon}&appid=${apiKey}`;\n \n $.ajax({\n url: uviURL,\n method:\"GET\"\n }).then(function(uviResponse){\n console.log(uviResponse);\n \n var heatIndex = uviResponse.value;\n var heatIndexP = $(`<p>Heat Index: <span id =\"heatIndexColor\" class=\"px-4 py-4 square\">${heatIndex}</span></p>`);\n // NOTE FOR MYSELF NEEDS TO APPEND B4 CONDITION SO THAT THE ID EXSISTS\n // When you view the UV index needs to show a color regarding what condition it is\n $(\"#cityInfo\").append(heatIndexP);\n if (heatIndex < 2) {\n $(\"#heatIndexColor\").addClass(\"uvfavorable\");\n }else if (heatIndex >= 2 && heatIndex <=6) {\n $(\"#heatIndexColor\").addClass(\"uvmoderate\");\n }else if(heatIndex >= 6 && heatIndex <=12) {\n $(\"#heatIndexColor\").addClass(\"uvsevere\");\n }\n \n\n nextDaysCondition(lat, lon);\n })\n \n// HEAT INDEX COLOR CORD ISNT WORKING YET NEED TO FINISH IT CONDITIONAL ?\n\n })\n \n}", "title": "" }, { "docid": "cdb7ca0987ee22d5a9f3aea356d428c6", "score": "0.46293423", "text": "function displayCity(city, weatherData) {\n\n var divElement = document.createElement(\"Div\");\n var cityElement = document.createElement(\"Div\");\n var humidityElement = document.createElement(\"Div\");\n var windSpeedElement = document.createElement(\"Div\");\n var tempElement = document.createElement(\"Div\");\n var cardElement = document.createElement(\"Div\");\n cardElement.classList.add(\"card\");\n divElement.classList.add(\"card-body\");\n tempElement.classList.add(\"temp\");\n cityElement.classList.add(\"city\");\n humidityElement.classList.add(\"humidity\");\n windSpeedElement.classList.add(\"windSpeed\");\n cityElement.innerHTML = city + \" \" + moment().format(\"MM/DD/YYYY\")\n humidityElement.innerHTML = \"Humidity : \" + weatherData.main.humidity\n windSpeedElement.innerHTML = \"Wind Speed : \" + weatherData.wind.speed\n tempElement.innerHTML = \"Temperture : \" + weatherData.main.temp + \" F\"\n\n divElement.append(cityElement);\n divElement.append(windSpeedElement);\n divElement.append(humidityElement);\n divElement.append(tempElement);\n cardElement.append(divElement);\n $(\".searchHistory\").prepend(cardElement);\n}", "title": "" }, { "docid": "b99626f1e67f95676027b17332503f27", "score": "0.46291375", "text": "function buildPage(){\n // Task 1 - Feed data to WC, Dial, Image, Meters to feet and hourly temps functions\n \n //buildWC called and put in web page\n let windSpeed = storage.getItem(\"windSpeed\");\n let temperature = storage.getItem(\"temperature\");\n let ws = windSpeed.charAt(0);\n let feelsLike = buildWC(ws, temperature);\n document.getElementById(\"feelsLike\").innerHTML = feelsLike;\n document.getElementById(\"speed\").innerHTML = windSpeed;\n console.log(\"Wind Speed is \" + windSpeed);\n console.log(\"Current temperature is \" + temperature);\n \n //windDial called and put in web page\n let windDirection = storage.getItem(\"windDirection\");\n windDial(windDirection);\n console.log(\"Wind direction is \" + windDirection);\n document.getElementById(\"direction\").innerHTML = windDirection;\n let windGust = storage.getItem(\"windGust\");\n document.getElementById(\"gusts\").innerHTML = windGust;\n console.log(\"Wind gusts are \" + windGust);\n \n\n //Change summary image and title and background image\n let curWeather = storage.getItem(\"curWeather\");\n let condition = getCondition(curWeather);\n changeSummaryImage(condition);\n console.log(\"Current weather is \" + curWeather);\n document.getElementById(\"weatherTitle\").innerHTML = curWeather;\n let elevation = storage.getItem(\"elevation\");\n let meters = convertMeters(elevation);\n document.getElementById(\"elevation\").innerHTML = meters;\n console.log(\"The elevation is \" + elevation);\n\n //Hourly temp functions\n let date = new Date(); \n let nextHour = date.getHours() + 1;\n // Call hourly information from API and format using functions\n let hourlyStorage = storage.getItem(\"hourly\");\n let hourlyData = hourlyStorage.split(\",\");\n hourlyTemp.innerHTML = buildHourlyData(nextHour, hourlyData);\n \n // Task 2 - Populate location information\n //Location city and state\n let fullName = storage.getItem(\"locName\") + \", \" + storage.getItem(\"locState\");\n document.getElementById(\"locName\").innerHTML = fullName;\n console.log(\"Location name is \" + fullName);\n \n //Change Title on tab\n let fullNameNode = document.createTextNode(fullName);\n pageTitle.insertBefore(fullNameNode, pageTitle.childNodes[0]);\n document.getElementById(\"pageTitle\").innerHTML = fullName;\n\n //Get latitude and longitude format beautifully and put in page\n let lat = storage.getItem(\"latitude\");\n let long = storage.getItem(\"longitude\");\n lat = Math.round(lat * 100)/100;\n long = Math.round(long * 100)/100; \n document.getElementById(\"lat\").innerHTML = lat + \"&deg; N, \";\n document.getElementById(\"long\").innerHTML = long + \"&deg; W\";\n console.log(\"Latitude and Longitude are \" + lat + \", \" + long);\n \n // Task 3 - Populate weather information\n let hiTemp = storage.getItem(\"hiTemp\");\n let lowTemp = storage.getItem(\"lowTemp\");\n document.getElementById(\"hot\").innerHTML = hiTemp + \"&deg; F\";\n document.getElementById(\"cold\").innerHTML = lowTemp + \"&deg; F\";\n document.getElementById(\"currentTemp\").innerHTML = temperature;\n console.log(\"The High today is \" + hiTemp);\n console.log(\"The Low today is \" + lowTemp);\n console.log(\"The Current temperature is \" + temperature);\n\n // Task 4 - Hide status and show main\n pageContent.setAttribute('class', '');\n statusMessage.setAttribute('class', 'hide');\n }", "title": "" }, { "docid": "f486066ab4355fde328c6f0b3dc23578", "score": "0.46277955", "text": "function afterButtonPress(data)\n{\n\t// Initialising blank strings as the output and outputCities variables\n\tlet output = \"\";\n\tlet outputCities = \"\";\n\n\t//Code to alert the user if they choose a country with only one airport\n\tif(data.length == 1)\n\t{\n\t\talert(\"This country only has one airport, try another\");\n\t\tlocation.reload();\n\t}\n\n\t//Puts the airport ID and name into the relevant arrays\n\tfor (let i = 0; i < data.length; i++)\n { \n\t\tcitiesArray.push(data[i].name);\n\t\tcitiesIdArray.push(data[i].airportId);\n\t}\n\t\n\t// For the length of the cities array, the following code will run\n\tfor(let i = 0; i < citiesArray.length; i++)\n\t{\n\t\t// An option for the city will be added to the dropdown list \n\t\toutputCities += `<option value = \"${citiesArray[i]}\">`\n\t}\n\n\t// Defining the output\n\toutput = `<div>\n\t\t\t\t<p style = font-size:15px>Type Your City Below</p>\n\t\t\t\t<input list = \"cities\" name = \"citiesName\" id = \"citiesId\">\n\t\t\t\t<datalist id = \"cities\">\n\t\t\t\t\t<div id = citiesDropdown></div>\n\t\t\t\t\t${outputCities}\n\t\t\t\t</datalist>\n\t\t\t</div>\n\t\t\t<br>\n\t\t\t<div>\n\t\t\t\t<button class=\"mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect\" style = \"color:black;\" id = \"startPlanTrip\" onclick = \"toSelectingLocations()\">\n\t\t\t\t\tStart Planning Trip\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<br>\n\t\t\t<div>\n\t\t\t\t<button class=\"mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect\" style = \"color:black;\" onclick = \"cancel()\">\n\t\t\t\t\tCancel\n\t\t\t\t</button>\n\t\t\t</div>`;\n\n\tdocument.getElementById(\"replaceOnPress\").innerHTML = output;\n}", "title": "" }, { "docid": "645f9a6b966787e1f4f056d47c7a6a2e", "score": "0.46275163", "text": "function createCarousel() {\n var slider = document.querySelector('.slider');\n const moviesLength = data.movies.length;\n for (let i = 0; i < moviesLength; i++) {\n var slide = document.createElement('div');\n slide.setAttribute('id', i);\n slide.setAttribute('data-toggle', 'modal');\n slide.setAttribute('data-target', '#myModal');\n slide.setAttribute('onClick', 'openMovieModal(' + i + ')');\n if (i == 0) {\n slide.classList.add('active'); \n }\n slide.classList.add('slide');\n var img = document.createElement('img');\n img.setAttribute('src', data.movies[i].image);\n var content = document.createElement('div');\n content.classList.add('content');\n content.innerHTML = '<h1>' + data.movies[i].title + '</h1>' +\n '<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellendus magni perferendis perspiciatis.</p>';\n\n slide.appendChild(img);\n slide.appendChild(content);\n slider.appendChild(slide);\n\n }\n}", "title": "" }, { "docid": "10c91e552d62114fe8130a207b37d87a", "score": "0.4627277", "text": "function projectInfo1() {\n projects(); // closes all opened extra content\n document.getElementById(\"project1\").innerHTML = `\n<div id=\"carouselExampleCaptions1\" class=\"carousel slide\" data-ride=\"carousel\">\n <div class=\"carousel-inner\">\n <div class=\"carousel-item active\">\n <img src=\"assets/images/projects/magistrates/em01.jpg\" class=\"project-main-image d-block w-75\" alt=\"Ex. Magistrates Court, Caerphilly\">\n <div class=\"carousel-caption d-none d-md-block\"></div>\n </div>\n <div class=\"carousel-item\">\n <img src=\"assets/images/projects/magistrates/em02.jpg\" class=\"project-main-image d-block w-75\" alt=\"IMAGE\">\n <div class=\"carousel-caption d-none d-md-block\"></div>\n </div>\n <div class=\"carousel-item\">\n <img src=\"assets/images/projects/magistrates/em03.jpg\" class=\"project-main-image d-block w-75\" alt=\"...\">\n <div class=\"carousel-caption d-none d-md-block\"></div> \n </div>\n </div>\n <a class=\"carousel-control-prev\" href=\"#carouselExampleCaptions1\" role=\"button\" data-slide=\"prev\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Previous</span>\n </a>\n <a class=\"carousel-control-next\" href=\"#carouselExampleCaptions1\" role=\"button\" data-slide=\"next\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Next</span>\n </a>\n</div>\n<h3 class=\"centered\">Ex. Magistrates Court, Caerphilly</h3>\n <ul>\n <li>\n Location: Caerphilly\n </li>\n <li>\n Contractor: Jehu\n </li>\n <li>\n Client: Linc-Cymru\n </li>\n </ul>\n <p>A 34 unit apartment block and associated housing on the site of the former Magistrates Court, Mountain Road, Caerphilly. A challenging, loadbearing masonry, Passivhaus project, with piled foundations and heave precautions on this original infilled quarry, overshadowed with many trees to the boundaries.</p>\n <div class=\"centered padding\">\n <button class=\"button cancel\" onclick=\"projects();\">&times; close</button>\n </div> \n `;\n }", "title": "" }, { "docid": "fce278ece6603bb328707033085f9bbd", "score": "0.46252745", "text": "function displayImg(cityName, weatherCondition) { // The function takes in cityName and weatherCondition as arguments to construct the query\n\n // Clear div containing images\n $(\".carousel-inner\").empty();\n\n var apiKey = \"duheouvYAukp2dG98jzVI1Y2VnHKe-PnTeWRmeKt5ss\";\n // API Query call\n var queryURL = \"https://api.unsplash.com/search/photos?query=\" + cityName + ' ' + weatherCondition + \"&count=10&orientation=landscape&client_id=\" + apiKey;\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n })\n .then(function (response) {\n console.log(\"unsplash url - \" + queryURL);\n\n // For-loop to create tags for images and append to carousel\n for (var i = 0; i < response.results.length; i++) {\n //Create div tag that will contain img and append carousel-item classes\n var divImg = $(\"<div>\").addClass(\"carousel-item\");\n divImg.attr(\"id\", i);\n\n //Create img tag that will contain city img and append d-block w-100 classes\n var cityImg = $(\"<img>\").addClass(\"d-block w-100\");\n $(cityImg).attr(\"src\", `${response.results[i].urls.regular}`);\n $(cityImg).attr(\"alt\", cityName);\n\n // Append cityImg to divImg\n $(divImg).append(cityImg);\n // Append divImg to carousel-inner class\n $(\".carousel-inner\").append(divImg);\n\n $(\"#0\").addClass(\"active\");\n }\n\n // Here, we call the store data function and pass in the cityName explicitly. The function does not rely on the global variable.\n storeData(cityName);\n });\n}", "title": "" }, { "docid": "f76701685adab7305754fde86e03a7d8", "score": "0.46227837", "text": "function displayTeleportCityInfo(cityDetails) {\n if (cityDetails[`closestUrbanCity`] === null) {\n $(`.teleport_info`).append(`<h2>There are no large cities close to ${cityDetails[`cityName`]}.</h2>`);\n } \n else {\n if (cityDetails[`closestUrbanCity`] !== cityDetails[`cityName`]) {\n $(`.teleport_info`).append(`<h2>We have extensive data on ${cityDetails[`closestUrbanCity`]}, a nearby city. Click on a category for more details.</h2>`);\n }\n else {\n $(`.teleport_info`).append(`<h2>We have extensive data on this city. Click on a category for more details.</h2>`);\n }\n const cityKey = convertNameToReferenceKey(cityDetails[`closestUrbanCity`]);\n $(`.teleport_info`).append(`<div class=teleport_widget><a class=\"teleport-widget-link\" href=\"https://teleport.org/cities/${cityKey}/\">Life quality score</a><script async class=\"teleport-widget-script\" data-url=\"https://teleport.org/cities/${cityKey}/widget/scores/?currency=USD&citySwitcher=false\" data-max-width=\"770\" src=\"https://teleport.org/assets/firefly/widget-snippet.min.js\"></script>\n </div>`);\n }\n }", "title": "" }, { "docid": "834c4154f72da6ef88e9949326ad6f63", "score": "0.46206674", "text": "function displayCityName(cityName) {\n var displayURL = \"https://api.openweathermap.org/data/2.5/weather?q=\" + cityName + \"&units=imperial&appid=\" + API_KEY;\n $.ajax({\n url: displayURL,\n method: \"GET\"\n }).then(function (response) {\n $(\".city\").html(\"<h1>\" + response.name + \"</h1>\");\n $(\".temp\").text(\"Temperature: \" + response.main.temp + \"F\");\n $(\".humidity\").text(\"Humidity: \" + response.main.humidity + \"%\");\n $(\".wind\").text(\"Wind speed: \" + response.wind.speed + \"s\");\n $(\".mainIcon\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.weather[0].icon + \"@2x.png\");\n $(\".description\").text(response.weather[0].description);\n // provides UV data\n var UVurl = \"https://api.openweathermap.org/data/2.5/uvi?lat=\" + response.coord.lat + \"&lon=\" + response.coord.lon + \"&appid=\" + API_KEY;\n\n $.ajax({\n url: UVurl,\n method: \"GET\"\n }).then(function (response) {\n $(\".uv\").text(\"UV index: \" + response.value);\n var UV = response.value;\n if (UV > 7) {\n $(\".uv\").attr(\"class\", \"uv high\");\n } else if (UV > 5) {\n $(\".uv\").attr(\"class\", \"uv moderate\");\n } else {\n $(\".uv\").attr(\"class\", \"uv low\");\n }\n });\n var forecastURL = \"https://api.openweathermap.org/data/2.5/forecast?q=\" + cityName + \"&units=imperial&appid=\" + API_KEY\n $.ajax({\n url: forecastURL,\n method: \"GET\"\n }).then(function (response) {\n console.log(response);\n $(\".date0\").text(response.list[5].dt_txt);\n $(\".icon0\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[5].weather[0].icon + \"@2x.png\");\n $(\".description0\").text(response.list[5].weather[0].description);\n $(\".date1\").text(response.list[13].dt_txt);\n $(\".icon1\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[13].weather[0].icon + \"@2x.png\");\n $(\".description1\").text(response.list[13].weather[0].description);\n $(\".date2\").text(response.list[21].dt_txt);\n $(\".icon2\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[21].weather[0].icon + \"@2x.png\");\n $(\".description2\").text(response.list[21].weather[0].description);\n $(\".date3\").text(response.list[29].dt_txt);\n $(\".icon3\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[29].weather[0].icon + \"@2x.png\");\n $(\".description3\").text(response.list[29].weather[0].description);\n $(\".date4\").text(response.list[37].dt_txt);\n $(\".icon4\").attr(\"src\", \"https://openweathermap.org/img/wn/\" + response.list[37].weather[0].icon + \"@2x.png\");\n $(\".description4\").text(response.list[37].weather[0].description);\n $(\".forecastTemp0\").text(\"Temp: \" + response.list[5].main.temp + \"F\");\n $(\".forecastTemp1\").text(\"Temp: \" + response.list[13].main.temp + \"F\");\n $(\".forecastTemp2\").text(\"Temp: \" + response.list[21].main.temp + \"F\");\n $(\".forecastTemp3\").text(\"Temp: \" + response.list[29].main.temp + \"F\");\n $(\".forecastTemp4\").text(\"Temp: \" + response.list[37].main.temp + \"F\");\n $(\".forecastHum0\").text(\"Humidity: \" + response.list[5].main.humidity + \"%\");\n $(\".forecastHum1\").text(\"Humidity: \" + response.list[13].main.humidity + \"%\");\n $(\".forecastHum2\").text(\"Humidity: \" + response.list[21].main.humidity + \"%\");\n $(\".forecastHum3\").text(\"Humidity: \" + response.list[29].main.humidity + \"%\");\n $(\".forecastHum4\").text(\"Humidity: \" + response.list[37].main.humidity + \"%\");\n\n });\n })\n}", "title": "" }, { "docid": "a5b8d815fa082f1f30d4e69966fd1895", "score": "0.4617511", "text": "function displayCityInfo() {\n console.log(city);\n var queryURL = 'https://api.openweathermap.org/data/2.5/weather?q=' + city + '&units=imperial&appid=99adabcd9b9526ae2fc8e7bbc24f5de4';\n\n $('#city-date').empty();\n $('#wicon').attr('src', '');\n $('#temp').empty();\n $('#humidity').empty();\n $('#windspeed').empty();\n\n $.ajax({\n url:queryURL,\n method: 'GET'\n }).then(function(response) {\n var farTemp = response.main.temp\n var cityName = response.name;\n var humidity = response.main.humidity;\n var windSpeed = response.wind.speed;\n var iconCode = response.weather[0].icon;\n var iconUrl = 'http://openweathermap.org/img/w/' + iconCode + '.png';\n\n $('#city-date').append(cityName + ' ');\n $('#city-date').append(moment().format('[(]M/D/YYYY[)]'));\n $('#wicon').attr('src', iconUrl);\n $('#temp').append('Temperature: ' + farTemp);\n $('#humidity').append('Humidity: ' + humidity);\n $('#windspeed').append('Wind Speed: ' + windSpeed + ' MPH');\n\n var lat = response.coord.lat;\n var long = response.coord.lon;\n\n uvIndex(lat, long);\n\n });\n}", "title": "" } ]
e8634e90d88bd20bddda7e1cb0ebeecd
Format as a string suitable for debugging.
[ { "docid": "0855bff6e312a4df99e8a150dc745ef6", "score": "0.0", "text": "toString () {\n return `${this.responseHeaderToString()}\\n\\n${this.getPrettyfiedBody()}`\n }", "title": "" } ]
[ { "docid": "13c603402a00e27affac7eb21d4bfa55", "score": "0.6850485", "text": "function format(f) {\n var i;\n if (typeof f !== 'string') {\n var objects = [];\n for (i = 0; i < arguments.length; i++) {\n objects.push(util.inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n i = 1;\n var args = arguments;\n var str = String(f).replace(/%[sdj]/g, function(x) {\n switch (x) {\n case '%s':\n return String(args[i++]);\n case '%d':\n return Number(args[i++]);\n case '%j':\n return JSON.stringify(args[i++]);\n default:\n return x;\n }\n });\n for (var len = args.length, x = args[i]; i < len; x = args[++i]) {\n if (x === null || typeof x !== 'object') {\n str += ' ' + x;\n }\n else {\n str += ' ' + util.inspect(x);\n }\n }\n\n return str;\n}", "title": "" }, { "docid": "d4ba7d890c83b4587dc195636a7196a4", "score": "0.67125505", "text": "function _formatVarString() {\n var args = Array.prototype.slice.call(arguments);\n if(args.length > 0 && args[0].toString() != '[object Object]') {\n\t var pattern = new RegExp('{([1-' + args.length + '])}', 'g');\n\t return String(args[0]).replace(pattern, function(match, index) { return args[index]; });\n }\n return \"\";\n\t}", "title": "" }, { "docid": "6af1667dc5621dc74c3a282768df5c00", "score": "0.63767743", "text": "format(str) {\n\n }", "title": "" }, { "docid": "e32fda9541b25c663c404d49b0e8b8da", "score": "0.63047683", "text": "format() {\n return this.native.format();\n }", "title": "" }, { "docid": "8cba11a82e573ee74e7324e85af21c3e", "score": "0.62948513", "text": "format() {\n return `F ${this.name}${this.usage === '' ? '' : ` ${this.usage}`}`;\n }", "title": "" }, { "docid": "8e4ccbb1237fc7e912a7165f7d2e6aee", "score": "0.6172628", "text": "get fileFormat() {\n return format\n .printf(info => {\n /**\n * @type {Array<any>}\n */\n let splat = info[Symbol.for('splat')];\n return `${info.timestamp} [${info.label}] ${info.level}: ` +\n `${info.message} ${splat ? splat.map(el=> el instanceof Error ? el.constructor.name + '\\n' + el.message + el.stack :JSON.stringify(el)).join(''):''}`;\n });\n }", "title": "" }, { "docid": "87c91bdbd14d1925f4cb1622ad993f6f", "score": "0.60540974", "text": "function toString(opts) {\n opts = opts || {};\n var res, lines, s = '', record = opts.record, stack;\n\n if(opts.pad && hasNewline(opts.msg, opts.parameters)) {\n var lines = opts.msg.split('\\n');\n lines.forEach(function(line) {\n res = format(opts, '' + line, [], opts.record, true);\n line = util.format.apply(\n util, [res.msg].concat(res.parameters.slice(0)));\n if(!/\\n$/.test(line)) {\n line += EOL;\n }\n s += line;\n })\n }else{\n res = format(opts);\n s = util.format.apply(\n util, [res.msg].concat(res.parameters.slice(0))) + EOL;\n }\n\n stack = getStack(record);\n\n if(stack) {\n stack.forEach(function(line) {\n res = format(opts, repeat(2) + line, [], opts.record, true);\n line = util.format.apply(\n util, [res.msg].concat(res.parameters.slice(0)));\n if(!/\\n$/.test(line)) {\n line += EOL;\n }\n s += line;\n })\n }\n\n return s;\n}", "title": "" }, { "docid": "aed14706c4ffeb549439f3d8cc43670d", "score": "0.60425764", "text": "getDebugString(group) {\n const chars = [];\n let i = 0;\n\n for (let j = 0; j < this.bits.length; j++) {\n chars.push(`${this.bits[j]}`);\n i++;\n if (i === group) {\n chars.push(' ');\n i = 0;\n }\n }\n\n return chars.join('');\n }", "title": "" }, { "docid": "bc07178063c59b75ae8d13d819776f7f", "score": "0.60394764", "text": "toString() {\n let result = '';\n if (this.isValid()) {\n result = `${this.major}.${this.minor}`;\n if (!isNaN(this.patch)) {\n result += `.${this.patch}`;\n }\n }\n return result;\n }", "title": "" }, { "docid": "f437fa6220a608262550919d227f1d71", "score": "0.59908307", "text": "function prettify_general (str){\n return require('util').puts(require('util').inspect(str, false ,20, true));\n}", "title": "" }, { "docid": "d9f12ab288e7c4396c801954f97e0ff8", "score": "0.5903232", "text": "toString() {\n return `\n ${this.firstName} ${this.lastName}:\n Phone: ${this.phone}\n Office phone: ${this.officePhone}\n Email: ${this.email}`\n }", "title": "" }, { "docid": "4ac0acc5119e9028a2454e2523c5c14f", "score": "0.58928734", "text": "debug (format, ...args) {\n this._platform._message('debug', this._namePrefix, format, ...args)\n }", "title": "" }, { "docid": "8998d984cf73003bc512c45c85e6e272", "score": "0.5873587", "text": "function toString()\n{\n let baleString = \"\";\n let fieldNames = Object.keys(PROPERTIES);\n\n // Loop through the fieldNames and build the string \n for (let name of fieldNames)\n {\n baleString += name + \":\" + this[name] +\";\";\n }\n\n return baleString;\n}", "title": "" }, { "docid": "f1102f7f1d04ae82146560a93f13fb8e", "score": "0.58548677", "text": "toString(){\n return `Block - \n Timestamp : ${this.timestamp}\n Last Hash : ${this.lastHash.substring(0,10)}\n Hash : ${this.hash.substring(0,10)}\n Nonce : ${this.nonce}\n Difficulty : ${this.difficulty}\n Data : ${this.data}\n `;\n }", "title": "" }, { "docid": "bb5ad4469faf45d7339ee45c41ef280e", "score": "0.58422774", "text": "toString() {\n return `\n Employee Name: ${this.getFirstName()} ${this.getLastName()}\n Social Security Number: ${this.getSocialSecurityNumber()}\n `;\n }", "title": "" }, { "docid": "415069864fd1ab4eebab92aeb120fa0d", "score": "0.5838717", "text": "static formatPolyfill () {\n // String formatter polyfill\n if (!String.prototype.format) {\n String.prototype.format = function() {\n let args = arguments;\n return this.replace(/{(\\d+)}/g, function(match, number) {\n return typeof args[number] != 'undefined' ? args[number] : match;\n })\n }\n }\n }", "title": "" }, { "docid": "571a3bb98dac9b76baa259869a990d96", "score": "0.58161336", "text": "format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n let result = {\n type: ((this.baseType === \"tuple\") ? \"tuple\" : this.type),\n name: (this.name || undefined)\n };\n if (typeof (this.indexed) === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.components) {\n result.components = this.components.map((comp) => JSON.parse(comp.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.baseType === \"array\") {\n result += this.arrayChildren.format(format);\n result += \"[\" + (this.arrayLength < 0 ? \"\" : String(this.arrayLength)) + \"]\";\n }\n else {\n if (this.baseType === \"tuple\") {\n if (format !== FormatTypes.sighash) {\n result += this.type;\n }\n result += \"(\" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== FormatTypes.sighash) {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === FormatTypes.full && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }", "title": "" }, { "docid": "571a3bb98dac9b76baa259869a990d96", "score": "0.58161336", "text": "format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n let result = {\n type: ((this.baseType === \"tuple\") ? \"tuple\" : this.type),\n name: (this.name || undefined)\n };\n if (typeof (this.indexed) === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.components) {\n result.components = this.components.map((comp) => JSON.parse(comp.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.baseType === \"array\") {\n result += this.arrayChildren.format(format);\n result += \"[\" + (this.arrayLength < 0 ? \"\" : String(this.arrayLength)) + \"]\";\n }\n else {\n if (this.baseType === \"tuple\") {\n if (format !== FormatTypes.sighash) {\n result += this.type;\n }\n result += \"(\" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== FormatTypes.sighash) {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === FormatTypes.full && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }", "title": "" }, { "docid": "623caa6bb901274aee2c6ff394d567c4", "score": "0.5808139", "text": "function __straformat(fmt) {\n var args;\n if (is('Arguments', arguments[1])) {\n args = arguments[1];\n }\n else {\n args = Array.slice(arguments, 1);\n }\n return fmt.replace(/{(\\d+)(\\:\\w*)?}/g, function (match, idx) {\n return typeof args[idx] != 'undefined'\n ? args[Number(idx)]\n : match\n ;\n });\n}", "title": "" }, { "docid": "8a19a4094a5d3586a4c12430cadbf9f5", "score": "0.5806711", "text": "function __strdformat(fmt, repls) {\n return fmt.replace(/{(\\w+)}/g, function (match, key) {\n return typeof repls[key] != 'undefined'\n ? repls[key]\n : match\n })\n}", "title": "" }, { "docid": "2a9feb0c3cf7832336ac949069d82022", "score": "0.57786715", "text": "function outputFormat(value, sign) {\n var space = 5;\n\n if (sign === \"#\") {\n value = value.toString();\n space -= value.length;\n } else if (sign === \"teamName\") {\n space = 31;\n space -= value.length;\n } else if (sign === \"grp\") {\n space = 9;\n space -= value.length;\n } else if (sign === \"rank\") {\n value = value.toString();\n space = 10;\n space -= value.length;\n } else if (sign === \"teamCL\") {\n space = 27;\n space -= value.length;\n } else {\n value = value.toString();\n space -= value.length;\n }\n\n for (var i = 1; i <= space; i++) {\n value = value + \" \";\n }\n\n return value;\n }", "title": "" }, { "docid": "2f15344b289425fc5e08bd41d342f73e", "score": "0.5775328", "text": "getFormattedAddress(){\n if(this._address!=undefined){\n return '<pre>'+this._address+'</pre>';\n }else{\n return undefined;\n }\n }", "title": "" }, { "docid": "8b0fa3eef46835bdbdcddfd4afdf7d6c", "score": "0.5775295", "text": "toString() {\n //printing data using ES6 template string\n return `Block -\n Timestamp : ${this.timestamp}\n Last Hash : ${this.last_hash.substring(0, 10)}\n Hash : ${this.hash.substring(0, 10)}\n Nonce : ${this.nonce}\n Difficulty : ${this.difficulty}\n Data : ${this.data}`;\n }", "title": "" }, { "docid": "78419b1b489d4f57a46e4bbe4d9ea9a6", "score": "0.57540894", "text": "toString() {\n let result = \"--------------------------------------\";\n result += \"\\n\";\n result += \"--------------------------------------\";\n result += \"\\n\";\n result += properties.name + \" \" + properties.version;\n result += \"\\n\";\n result += \"--------------------------------------\";\n result += \"\\n\";\n result += \"Sources : \" + this.parameters.src || \"\";\n result += \"\\n\";\n result += \"Destination : \" + this.parameters.destination || \"\";\n result += \"\\n\";\n result += \"Templates locations : \" + this.parameters.templateLocation || \"\";\n result += \"\\n\";\n result += \"Config file : \" + this.parameters.configFileLocation || \"\";\n result += \"\\n\";\n if (this.parameters.watch) {\n result += \"Watcher enabled\";\n result += \"\\n\";\n }\n result += \"PDF Options : \";\n result += \"\\n\";\n result += JSON.stringify(this.parameters.pdfConfig) || {};\n result += \"\\n\";\n return result;\n }", "title": "" }, { "docid": "420499861be47b5da985d42da5e80671", "score": "0.5737953", "text": "function formatString(format) {\n var args = Array.prototype.slice.call(arguments, 1);\n return format.replace(/{(\\d+)}/g, function(match, number) {\n return typeof args[number] !== 'undefined'\n ? args[number]\n : match;\n });\n}", "title": "" }, { "docid": "0b2ecfdf6a6d937a729f785204012244", "score": "0.5723112", "text": "function toStr(s){\n\n\tvar str = \"\";\n\tvar sep = \"<br />\";\n\tif(s.macsrc != \"\")\n\t\tstr = str.concat(\"mac src: \").concat(s.macsrc).concat(sep);\n\tif(s.macdst != \"\")\n\t\tstr = str.concat(\"mac dst: \").concat(s.macdst).concat(sep);\n\tif(s.ipsrc != \"\")\n\t\tstr = str.concat(\"ip src: \").concat(s.ipsrc).concat(sep);\n\tif(s.ipdst != \"\")\n\t\tstr = str.concat(\"ip dst: \").concat(s.ipdst).concat(sep);\n\tif(s.vlanid != \"\")\n\t\tstr = str.concat(\"vlan id: \").concat(s.vlanid).concat(sep);\n\tif(s.portsrc != \"\")\n\t\tstr = str.concat(\"port src: \").concat(s.portsrc).concat(sep);\n\tif(s.portdst != \"\")\n\t\tstr = str.concat(\"port dst: \").concat(s.portdst).concat(sep);\n\tif(s.protocol != \"\")\n\t\tstr = str.concat(\"protocol: \").concat(s.protocol).concat(sep);\n\t\n\treturn str;\n}", "title": "" }, { "docid": "00d3e41c50a4619fb1a1bdede6b0153d", "score": "0.5722927", "text": "_toStringDetails() {\n return '';\n }", "title": "" }, { "docid": "cc1e023d1314fb2031afc5342a2717c4", "score": "0.5718832", "text": "toString() {\n // ignore error range if source is \"inline content\"\n if (this.source === templatesParser_1.TemplatesParser.inlineContentId) {\n return `[${DiagnosticSeverity[this.severity]}] ${this.source} ${this.message.toString()}`;\n }\n else {\n return `[${DiagnosticSeverity[this.severity]}] ${this.source} ${this.range.toString()}: ${this.message.toString()}`;\n }\n }", "title": "" }, { "docid": "edabfbb268225b1558c5fc5064dd85a9", "score": "0.5718234", "text": "toString () {\n let l = excerpt(this.input, this.pos)\n let prefix1 = `line ${this.line} (column ${this.column}): `\n let prefix2 = \"\"\n for (let i = 0; i < prefix1.length + l.prologText.length; i++)\n prefix2 += \" \"\n let msg = \"Parsing Error: \" + this.message + \"\\n\" +\n prefix1 + l.prologText + l.tokenText + l.epilogText + \"\\n\" +\n prefix2 + \"^\"\n return msg\n }", "title": "" }, { "docid": "63b81805784614d7a8ef7d3854f935cd", "score": "0.5717629", "text": "toString () {\n return `${this.name} | ${this.protein}g P :: ${this.carbs}g C :: ${this.fat}g F`\n }", "title": "" }, { "docid": "98e49a7e3274cf8c7ca24703b6441db4", "score": "0.571006", "text": "function formatParameters() {\n if (!this.params) return '';\n return '(' + this.params.map(function (param) {\n return formatParameter(param);\n }).join(', ') + ')';\n }", "title": "" }, { "docid": "a1d03fe503d9b386d0555af09c30710f", "score": "0.5708233", "text": "toString() {\n return \"\\nFirst Name: \" + this.firstName + \" \\nLast Name: \" + this.lastName + \" \\nAddress: \" + this.address + \" \\nCity: \" + this.city\n + \" \\nState: \" + this.state + \" \\nZipcode: \" + this.zip + \" \\nPhone Number: \" + this.phoneNumber + \" \\nEmail: \" + this.email;\n }", "title": "" }, { "docid": "42cfbde3e2b3ec51739d2fc6113cdeb9", "score": "0.5698016", "text": "debug(format, ...params) {\n }", "title": "" }, { "docid": "1bcca6c1b3b25cfa2fdc78516eb3c2cc", "score": "0.56887907", "text": "function debug(object, separator, sort, includeObject, objectSeparator) {\n if (object == null) {\n return \"null\";\n }\n sort = booleanValue(sort == null ? true : sort);\n includeObject = booleanValue(includeObject == null ? true : sort);\n separator = separator || \"\\n\";\n objectSeparator = objectSeparator || \"--------------------\";\n\n //Get the properties\n var properties = new Array();\n for (var property in object) {\n var part = property + \" = \";\n try {\n part += object[property];\n } catch (e) {\n part += \"<Error retrieving value>\";\n }\n properties[properties.length] = part;\n }\n //Sort if necessary\n if (sort) {\n properties.sort();\n }\n //Build the output\n var out = \"\";\n if (includeObject) {\n try {\n out = object.toString() + separator;\n } catch (e) {\n out = \"<Error calling the toString() method>\"\n }\n if (!isEmpty(objectSeparator)) {\n out += objectSeparator + separator;\n }\n }\n out += properties.join(separator);\n return out;\n}", "title": "" }, { "docid": "e6626f0f8ee03d38e4268b0b7ec1d5c6", "score": "0.5684536", "text": "function format()\n\t{\n\t\t//ex = ex.replace(/\"(\\w*?)\":/gi,'$1:');\t\t//un-quote keys\n\t\tex = ex.replace(/([{,]\\s+)\"([\\w_]+?)\":/gi, function(all, sep, key)\n\t\t{\n\t\t\tif ('null undefined'.indexOf(key) != -1) return all;\n\t\t\treturn sep + key + \":\"\n\t\t});\n\n\n\t\tex = ex.replace(/(\\w*: \\[)([\\s\\S]*?])/gi, \t//collapse Arrays to single line\n\t\tfunction(all, name, value)\n\t\t{\n\t\t\treturn '' + name + value.replace(/\\s*/g, '');\n\t\t});\n\n\t\tex = ex.replace(/\\[(.*?)\\]/mg,function(all)\t//for single line Arrays\n\t\t{\t\t\t\t\t\t\t\t\t\t\t//add space after comma\n\t\t\treturn all.replace(/,/g, ', ')\n\t\t});\n\t\tex = ex.replace(/, $/mg, ',')\n\t}", "title": "" }, { "docid": "02617b684b92fc913fe7115c1bfdc231", "score": "0.56779456", "text": "format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n let result = {\n type: this.baseType === \"tuple\" ? \"tuple\" : this.type,\n name: this.name || undefined\n };\n\n if (typeof this.indexed === \"boolean\") {\n result.indexed = this.indexed;\n }\n\n if (this.components) {\n result.components = this.components.map(comp => JSON.parse(comp.format(format)));\n }\n\n return JSON.stringify(result);\n }\n\n let result = \"\"; // Array\n\n if (this.baseType === \"array\") {\n result += this.arrayChildren.format(format);\n result += \"[\" + (this.arrayLength < 0 ? \"\" : String(this.arrayLength)) + \"]\";\n } else {\n if (this.baseType === \"tuple\") {\n if (format !== FormatTypes.sighash) {\n result += this.type;\n }\n\n result += \"(\" + this.components.map(comp => comp.format(format)).join(format === FormatTypes.full ? \", \" : \",\") + \")\";\n } else {\n result += this.type;\n }\n }\n\n if (format !== FormatTypes.sighash) {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n\n if (format === FormatTypes.full && this.name) {\n result += \" \" + this.name;\n }\n }\n\n return result;\n }", "title": "" }, { "docid": "d425d46f543387a312a540546cdbe046", "score": "0.5668761", "text": "function getDebugMessage(ingredientLineObj) {\n if (ingredientLineObj == null || ingredientLineObj.measurementAmt == null) {\n return \"Could not parse line into amt + unit + ingredient\";\n }\n var amt = ingredientLineObj.measurementAmt;\n if (amt == null) {\n amt = \"n/a\";\n } else {\n amt = roundDecimal(amt);\n }\n var unit = ingredientLineObj.measurementUnit;\n if (unit == null) {\n unit = \"n/a\";\n }\n var ingredient = ingredientLineObj.databaseIngredientName;\n var parsedIngredient = ingredientLineObj.parsedIngredientName;\n if (ingredient == null) {\n ingredient = \"n/a\";\n } else if (ingredient != parsedIngredient) {\n ingredient = parsedIngredient + \" --> \" + ingredient;\n }\n var ingrInfo = ingredientLineObj.databaseIngredientInfo;\n if (ingrInfo == null) {\n var ingredientAfterUnit = ingredientLineObj.parsedEverythingAfterUnit;\n ingrInfo = '<button type=\"button\"'\n + ' class=\"btn btn-primary\"'\n + ' data-toggle=\"modal\"'\n + ' data-ingredient=\"' + ingredientAfterUnit + '\"'\n + ' data-target=\"#addIngredientModal\">'\n + ' Add ingredient to database'\n + ' </button>';\n } else {\n ingrInfo = JSON.stringify(ingrInfo, null, 4);\n }\n return \"amount: \" + amt\n + \" <br/> unit: \" + unit\n + \" <br/> ingredient: \" + ingredient\n + \" <br/> database ingredient entry: \" + ingrInfo;\n}", "title": "" }, { "docid": "a0cd226b66522720390dd0f42414393c", "score": "0.5662644", "text": "function toString(){\n var string = '';\n\n for(var key in data){\n string += '| Key: ' + key + ' Value: ' + data[key] + ' ';\n }\n\n return string;\n }", "title": "" }, { "docid": "e8f939b808db19a3273758da8f72c6bc", "score": "0.5659225", "text": "flagsToString() {\n const parts = [];\n parts.push(this.size + \" bytes\");\n if ((this.flags & Flags.NON_IBM) !== 0) {\n parts.push(\"non-IBM\");\n }\n if ((this.flags & Flags.BAD_CRC) !== 0) {\n parts.push(\"bad CRC\");\n }\n parts.push(\"side \" + ((this.flags & Flags.SIDE) === 0 ? 0 : 1));\n if ((this.flags & Flags.DOUBLE_DENSITY) !== 0) {\n parts.push(\"double density\");\n }\n else {\n parts.push(\"single density\");\n }\n return parts.join(\", \");\n }", "title": "" }, { "docid": "aba243ea736ad609b13aa83fc8759d59", "score": "0.5636406", "text": "function printdebug(){\r\n\t\tconsole.log(note, length, delay, isRest);\r\n\t}", "title": "" }, { "docid": "9b3d5cf6573df06629a449915ca71249", "score": "0.56319284", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "9b3d5cf6573df06629a449915ca71249", "score": "0.56319284", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "7d59985a75aded4783df03fd495099a2", "score": "0.5628756", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "7d59985a75aded4783df03fd495099a2", "score": "0.5628756", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "7d59985a75aded4783df03fd495099a2", "score": "0.5628756", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "7d59985a75aded4783df03fd495099a2", "score": "0.5628756", "text": "function inspect () {\n\t if (!this.isValid()) {\n\t return 'moment.invalid(/* ' + this._i + ' */)';\n\t }\n\t var func = 'moment';\n\t var zone = '';\n\t if (!this.isLocal()) {\n\t func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t zone = 'Z';\n\t }\n\t var prefix = '[' + func + '(\"]';\n\t var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t var suffix = zone + '[\")]';\n\n\t return this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "451b7364eb1fca12ac7227e09a71c184", "score": "0.5628424", "text": "pretty() {\n\n return JSON.stringify(this.query, null, 4)\n }", "title": "" }, { "docid": "576db325db61a6810b82b1fec8d954b3", "score": "0.56253844", "text": "toString() {\n console.log(`Le cercle a un rayon de ${this.radius}cm , et les coordonnées du point sont: (x = ${this.point.getX()}; y = ${this.point.getY()})`);\n }", "title": "" }, { "docid": "29412430ccdc9b658973745313b6e18c", "score": "0.56202257", "text": "toString(){\n let r = \"FIELD: \\n\" + \"WIDTH \" + this.widthCell + '\\n' + \"HEIGHT \" + this.heightCell + '\\n' + \"ROWS \" + this.nbLine + '\\n' + \"COLUMNS \" + this.nbCol +'\\n';\n\n for (let i = 0; i < this.board.length; i++){\n r += this.board[i] + '\\n'\n }\n return r;\n }", "title": "" }, { "docid": "a40b87b0abdba08e5f0a62e6c4db3821", "score": "0.5618965", "text": "toString() {\n return `Block -\n Timestamp : ${this.timeStamp}\n Lash Hash : ${this.lastHash.substring(0,15)}\n Hash : ${this.hash.substring(0,15)}\n Nonce : ${this.nonce}\n Difficulty: ${this.difficulty}\n Data : ${this.data}`;\n }", "title": "" }, { "docid": "c735ff06ad1f620361c832dd19701df4", "score": "0.5618661", "text": "function inspect() {\n\t\tif (!this.isValid()) {\n\t\t\treturn 'moment.invalid(/* ' + this._i + ' */)';\n\t\t}\n\t\tvar func = 'moment';\n\t\tvar zone = '';\n\t\tif (!this.isLocal()) {\n\t\t\tfunc = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n\t\t\tzone = 'Z';\n\t\t}\n\t\tvar prefix = '[' + func + '(\"]';\n\t\tvar year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n\t\tvar datetime = '-MM-DD[T]HH:mm:ss.SSS';\n\t\tvar suffix = zone + '[\")]';\n\n\t\treturn this.format(prefix + year + datetime + suffix);\n\t}", "title": "" }, { "docid": "47839a14531fcb0de02c3b8a601869d9", "score": "0.56151146", "text": "toString( indent = \"\" ) {\n\t\t\tconst key = Object.keys(ItemFormat).find(k => ItemFormat[k] === this.format);\n\n\t\t\tconst len = ItemFormat.isSizeable(this.format) ? this.size : '';\n\n\t\t\tif ( !( validator.isString( indent ) ) ){\n indent = \"\";\n }\n\n switch (this.format) {\n case ItemFormat.A:\n let base = `${indent}${key}<${len}> ${this.name}`;\n return + ( !this.value) ? base : `${base} [${this.value}]`;\n\n case ItemFormat.List:\n let str = `${key} ${this.name}`;\n this.value.forEach( x => str += '\\n' + indent + x.toString( indent + \" \" ) )\n return indent + str\n }\n\n if (!ItemFormat.isSizeable(this.format)) {\n return ( this.value instanceof Array ) ? \n `${indent}${key}<${this.value.length}> ${this.name} [${this.value}]`:\n `${indent}${key} ${this.name} [${this.value}]`;\n }\n\t\t}", "title": "" }, { "docid": "46e710f0aeb768518087ec73379c4dbc", "score": "0.5611381", "text": "function basicFormat(source) {\n //null argument, return empty string\n if (isEmpty(source))\n return \"\";\n \n //it's a string, return it as-is\n if (typeof source == \"string\")\n return String(source);\n\n //it has a formatter, use that\n if (source && source.format)\n return source.format();\n \n //it's an array, use it as one - recursive call\n if (source && source.length) \n return String.format.apply(source[0], Array.prototype.slice.call(arguments, 0, 1));\n\n //force it to a string\n return String(source);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" }, { "docid": "eb4367bff85326ef257d33df524c5132", "score": "0.5605183", "text": "function inspect () {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment';\n var zone = '';\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n var prefix = '[' + func + '(\"]';\n var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';\n var datetime = '-MM-DD[T]HH:mm:ss.SSS';\n var suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }", "title": "" } ]
0ca604aeb67882c248015f888b9878ad
6.change the Html of an element specified by its ID
[ { "docid": "2c36fcddb6f0bc8e5b56531f9c2e3ad7", "score": "0.740017", "text": "function changeElement(id,content)\n{\n document.getElementById(id).innerHTML = content ;\n}", "title": "" } ]
[ { "docid": "5266841cdd946bcc4d3f868ca6910dff", "score": "0.76785934", "text": "function updateHTML(elmId, value) {\n document.getElementById(elmId).innerHTML = value;\n }", "title": "" }, { "docid": "e2c91fa4f68863b7e92e010ad1bc4a08", "score": "0.7611458", "text": "function setHtml(id, text){\n\tvar obj = document.getElementById(id);\n\tif (obj)\n\t\tobj.innerHTML = text;\n}", "title": "" }, { "docid": "a13482744026bafa85452042f5c047d9", "score": "0.75139457", "text": "function updateHTML(elmId, value) {\n\tdocument.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "a13482744026bafa85452042f5c047d9", "score": "0.75139457", "text": "function updateHTML(elmId, value) {\n\tdocument.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "a13482744026bafa85452042f5c047d9", "score": "0.75139457", "text": "function updateHTML(elmId, value) {\n\tdocument.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "2fe7047eff32bc1600fec32db914ccd1", "score": "0.7510479", "text": "function setHtml(id, text) {\n var tag = document.getElementById(id);\n if (tag) {\n tag.innerHTML = text;\n }\n}", "title": "" }, { "docid": "4e213884f0e6a3117c2000131792e597", "score": "0.7440399", "text": "function updateHTML(elmId, value) {\n document.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "4e213884f0e6a3117c2000131792e597", "score": "0.7440399", "text": "function updateHTML(elmId, value) {\n document.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "4e213884f0e6a3117c2000131792e597", "score": "0.7440399", "text": "function updateHTML(elmId, value) {\n document.getElementById(elmId).innerHTML = value;\n}", "title": "" }, { "docid": "eabf474dafb48214e11fa1ef26205494", "score": "0.7302584", "text": "function updateHtml(id, text) {\n let e = document.getElementById(id);\n if (e) {\n e.innerHTML = text;\n } else {\n console.log('Element ' + id + ' does not exist.');\n }\n}", "title": "" }, { "docid": "984d838cec290231e473587dea48628d", "score": "0.7265328", "text": "replace(id, html) {\n\t\t\tlet element = document.getElementById(id);\n\t\t\t\n\t\t\tmorphdom(element, html);\n\t\t}", "title": "" }, { "docid": "040ed8c529b97390e08a3681f7d7ea18", "score": "0.72408074", "text": "function setInnerHTML(id,html) {\n document.getElementById(id).innerHTML = html;\n}", "title": "" }, { "docid": "600209ca3638899b7e92397d1f6242ae", "score": "0.7238754", "text": "function setInnerHTML(id, val)\n{\n\tvar obj = el(id);\n\tif (obj)\n\t{\n\t\tobj.innerHTML = val;\n\t}\n}", "title": "" }, { "docid": "5875f502c27aa05296effdb6859a1cbf", "score": "0.71847713", "text": "function setHTMLbyID(myHTML, myID){\r\n\tmyElement = document.getElementById(myID);\r\n\tif (myElement) {\r\n\t\tmyElement.innerHTML = myHTML;\r\n\t}\t\r\n}", "title": "" }, { "docid": "22566e07fc6f1f28e840f22ee13fda7f", "score": "0.7089448", "text": "function escribirHTML(id, contenido){\n\tdocument.getElementById(id).innerHTML = contenido;\n}", "title": "" }, { "docid": "35f5a79dab75dde485dd567180cade54", "score": "0.697031", "text": "function elementReplaceText(elementId,text){\n document.getElementById(elementId).innerHTML = text;\n}", "title": "" }, { "docid": "0f676d45d720a7c86b05ca7a006d1255", "score": "0.69581306", "text": "function setInnerHTML(id, value) {\n var element = document.getElementById(id);\n element.innerHTML = value;\n}", "title": "" }, { "docid": "7686bd6b505573c6da555b3b26db8665", "score": "0.68338686", "text": "function updateElement(elementId, choice) {\n var element = document.getElementById(elementId);\n element.innerHTML = choice;\n}", "title": "" }, { "docid": "9fca818a9a1098d5d738ee71168bb5cd", "score": "0.68142617", "text": "function changeInnerHtml(elem, html) {\n elem.innerHTML = html;\n}", "title": "" }, { "docid": "8c61eef09f6f2973cba08b512b9cec45", "score": "0.68084896", "text": "function setTextToElement(text, id){\n document.getElementById(id).innerText = text;\n}", "title": "" }, { "docid": "f383146290993f41e243aef2b1fee18c", "score": "0.6768646", "text": "function setElement(elemid, value) {\n window.document.getElementById(elemid).innerHTML = value;\n}", "title": "" }, { "docid": "c842b0fc3f84a58bba22e32458d3de82", "score": "0.67539245", "text": "function editElement(element, text)\t{\n\tdocument.getElementById(element).innerHTML = text;\n}", "title": "" }, { "docid": "10982698c69b2bafaf4933ad6a16fd17", "score": "0.67049915", "text": "function updateHTML(val, id = 'container') {\r\n document.getElementById(id).innerHTML = val;\r\n}", "title": "" }, { "docid": "db2e8bff5504dc00cefdc61a92436c04", "score": "0.6670472", "text": "function updateElement(ID, contents){\n\tdocument.getElementById(ID).innerHTML = contents;\n\t\n}", "title": "" }, { "docid": "baa328f12f06d58333366c7734192e55", "score": "0.66113883", "text": "function update(id, content) {\r\n document.getElementById(id).innerHTML = content;\r\n}", "title": "" }, { "docid": "92f5150b309637beca8c3c4224833834", "score": "0.65799993", "text": "function changeValue(theid, message){\n $(theid).html(message); \n}", "title": "" }, { "docid": "fdfb4bbb8b21ff150768b2ceb6768e6c", "score": "0.6554617", "text": "function addHtml(id, text){\n\tvar obj = document.getElementById(id);\n\tif (obj)\n\t\tobj.innerHTML += text;\n}", "title": "" }, { "docid": "2c87709fac1c42ec89f560992b721742", "score": "0.65300405", "text": "function put(id, value) {\n let element = document.getElementById(id);\n if (element != null) {\n element.innerHTML = value;\n }\n}", "title": "" }, { "docid": "7fed85c3a0090b1525688e9a7c05eb08", "score": "0.65227765", "text": "function update(id, content){\n document.getElementById(id).innerHTML = content\n}", "title": "" }, { "docid": "1d552978e902f69e617ad1ef0245da3f", "score": "0.64665407", "text": "function elUpdate(element, content) {\n document.getElementById(element).innerHTML = content;\n}", "title": "" }, { "docid": "d19fc0678a38d78cfc5534a82ecbd62b", "score": "0.6423414", "text": "function replaceElement(element ,innerHTML) {\nconst tag = document.querySelector(element);\ntag.innerHTML = innerHTML\n}", "title": "" }, { "docid": "eae1a95f08ed05d489b4d64f61950f66", "score": "0.63797253", "text": "function setHtml(fieldName, value) {\n var element = document.getElementById(fieldName);\n\n element.innerHTML = value;\n element.className = 'visible'; // Just some cosmetic stuff.\n }", "title": "" }, { "docid": "0fa45afbf6e62efb4d6e343064424d37", "score": "0.6373944", "text": "function dom_change(x,y){\n return document.getElementById(x).innerHTML=y;\n}", "title": "" }, { "docid": "c3db65eee77a0a8deff2f9c6d85657a7", "score": "0.6369132", "text": "function SetText(id,text)\r\n\t{\r\n\t\tdocument.getElementById(id).innerHTML = text;\r\n\t}", "title": "" }, { "docid": "d88d08e374d6423c7cdce4da6a50af8e", "score": "0.6364523", "text": "function update(val,id) {\n document.getElementById(id).innerHTML = val;\n}", "title": "" }, { "docid": "f0019a863fc79f7734b702caaa37479b", "score": "0.6361315", "text": "function updateDom (_id) {\r\n\r\n\t\tvar thisNode = nodeAt(_id)[0];\r\n\t\t\r\n\t\t\tthisNode.dom.setValue(thisNode.value);\r\n\t\t\tthisNode.dom.setName(thisNode.name);\r\n\t\t\tthisNode.dom.setId(thisNode.id);\r\n\t\t\tthisNode.dom.setType(thisNode.type);\r\n\r\n\t\t// TODO: selected/cursor states here?\r\n\t}", "title": "" }, { "docid": "34ec1a09ea0a638bb143a1d35180d975", "score": "0.62845504", "text": "function replaceWithContent(id){\r\n\ttag = document.getElementById(id);\r\n\tif (!tag) return false;\r\n\tt_parent = tag.parentNode;\r\n\tif (!t_parent) return false;\r\n\tfor(var i=0; i <tag.childNodes.length; i++){\r\n\t\tchild = tag.childNodes[i].cloneNode(true);\r\n\t\tt_parent.insertBefore(child, tag);\r\n\t}\r\n\tt_parent.removeChild(tag);\r\n}", "title": "" }, { "docid": "c0f7b4a1d00c88189aff45fb61b71908", "score": "0.62497884", "text": "function changeElement1() {\n document.getElementById(\"cha\").innerHTML = \"I changed this text\";\n}", "title": "" }, { "docid": "8c19de696cc8bd3b71dec158376fdf56", "score": "0.6238899", "text": "function htmlInsert(id, htmlData) {\n\tdocument.getElementById(id).innerHTML = htmlData;\n}", "title": "" }, { "docid": "e309fb68f7b29465df2e8fa4b11062fa", "score": "0.62351775", "text": "function injectId(id, html) {\n html.__html__ =\n '<div style=\"display: contents;\" id=\"'+id+'\">' + html.__html__ + '</div>';\n return html;\n }", "title": "" }, { "docid": "5747bf53d3af6b8fae30e8e8511d54ac", "score": "0.6232922", "text": "function insertElement(id,elemento){\r\n\tgetElement(id).innerHTML = elemento\r\n}", "title": "" }, { "docid": "bfe2c45a6f5a5f030ca1cd20a479448c", "score": "0.61999464", "text": "function replace_content(id) {\n var inner_div = $('<div id=\"' + id + '\">');\n $('#' + id).replaceWith(inner_div);\n return inner_div;\n }", "title": "" }, { "docid": "fad4c79091148f43749a483d984118a8", "score": "0.61908793", "text": "function setInnerHTML(element, html) {\n element[innerHTML()] = html;\n}", "title": "" }, { "docid": "fad4c79091148f43749a483d984118a8", "score": "0.61908793", "text": "function setInnerHTML(element, html) {\n element[innerHTML()] = html;\n}", "title": "" }, { "docid": "5cad1fa62320da7b2b98a4dd24255bf1", "score": "0.6183394", "text": "function insertHTML(htmlId, htmlValue) {\n document.getElementById(`${htmlId}`).innerHTML = htmlValue;\n}", "title": "" }, { "docid": "62f2736b62302cc5c42376db56f667da", "score": "0.61625147", "text": "function changeUserInfo (id)\n{\n\tdocument.getElementById(id).innerHTML = changeUserInfoHTML; //this line modifies the the content of the userTravHistPanel\n}", "title": "" }, { "docid": "c87b8789619ca76dbfaf578fe3e843a4", "score": "0.6158628", "text": "function do_modify_html_it(doc, element, match_re, replace_string) {\r\n match_re = new RegExp(match_re);\r\n if (element.innerHTML) {\r\nelement.innerHTML = element.innerHTML.replace(match_re, replace_string);\r\n };\r\n}", "title": "" }, { "docid": "f181a6466b3e435b7e4ea3f4c4ee333c", "score": "0.6156962", "text": "function changeInnerHTML(domElement, innerHtmlString ) {\n\tdomElement.innerHTML = innerHtmlString;\n}", "title": "" }, { "docid": "46992bd7baf06709bf37d5681f04b990", "score": "0.6153215", "text": "function replHTML(id,property){\n\t'use strict';\n\tvar output = id;\n\tif(typeof property !== 'undefined'){\n\t\toutput.innerHTML = property;\n\t}else{\n\t\tconsole.log(\"Fail!!! Function replHTML failed to pass 'property' properly. Double-check your variables.\");\n\t}\n}", "title": "" }, { "docid": "6ab8408e28283564d134c383e1149fa6", "score": "0.6146557", "text": "function reload(id){\n\t\tvar container = document.getElementById(id);\n\t\tvar content = container.innerHTML;\n\t\tcontainer.innerHTML= content; \t\n\t //this line is to watch the result in console , you can remove it later\t\n\t\tconsole.log(id); \n\t}", "title": "" }, { "docid": "16183376439aa5f1d5b7cb89bed93448", "score": "0.6126312", "text": "function setInnerHTML(element, html) {\n element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;\n}", "title": "" }, { "docid": "16183376439aa5f1d5b7cb89bed93448", "score": "0.6126312", "text": "function setInnerHTML(element, html) {\n element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;\n}", "title": "" }, { "docid": "746b47f387611ed84d6be48192607bbb", "score": "0.61206526", "text": "function write(id, str) {\n\tdocument.getElementById(id).innerHTML = str;\n}", "title": "" }, { "docid": "eb00962b41ddd7b177588acef12b03c9", "score": "0.60878855", "text": "function printToElement(id,text){\n try{\n document.getElementById(id).innerHTML=text;\n }catch(e){\n console.log(id+' <- this element does not exsist with this ID.');\n }\n}", "title": "" }, { "docid": "eb00962b41ddd7b177588acef12b03c9", "score": "0.60878855", "text": "function printToElement(id,text){\n try{\n document.getElementById(id).innerHTML=text;\n }catch(e){\n console.log(id+' <- this element does not exsist with this ID.');\n }\n}", "title": "" }, { "docid": "5812ae632423a9c1802043453aa6a9d1", "score": "0.6086093", "text": "function changeTxt(ID,TXT) {\r\n document.getElementById(\"\"+ID+\"\").innerHTML = TXT; \r\n}", "title": "" }, { "docid": "f362e293144852f3d237a77462974643", "score": "0.60834223", "text": "function $r(id) \n\t{\n\t\tvar element = $o(id);\n\t\telement.outerHTML = \"\";\n\t\tdelete element;\n\t}", "title": "" }, { "docid": "a9f995a06dd859beac3300bdf012b5f1", "score": "0.60617775", "text": "html(newHtml){\n this.elements.forEach(element => {\n element.innerHTML = newHtml\n })\n return this\n }", "title": "" }, { "docid": "75a41990e114cfd1ac1c5e9fc1f8a78e", "score": "0.6055115", "text": "function setValue(id, value) {\n document.querySelector(id).innerHTML += value;\n}", "title": "" }, { "docid": "c199e0b30011154dd87ed552902930c2", "score": "0.60494757", "text": "function setText(id, text){\n document.getElementById(id).innerText = text;\n}", "title": "" }, { "docid": "bb7a563f017848a4e681f516894fef64", "score": "0.6041607", "text": "function setError(id, error) {\n document.getElementById(id).innerHTML = error;\n}", "title": "" }, { "docid": "ecfc744dde2c5a41e995145621087220", "score": "0.60106564", "text": "function clearElement(id) {\r\n getElement(id).innerHTML = '';\r\n}", "title": "" }, { "docid": "dc8f0de863fba64f0175774e3f3ef26f", "score": "0.6010195", "text": "function Change(){\n var para1=document.getElementById(\"para1\");\n para1.innerHTML=\"Hae there\";\n}", "title": "" }, { "docid": "f8002d4dfada53f04c44137feb9b8727", "score": "0.59959996", "text": "function getEByIdButton(){\n\n document.getElementById(\"mydiv\").innerHTML = \"mohammed safaa\";\n}", "title": "" }, { "docid": "702fe08534300f980629f8d63c19cbe7", "score": "0.5965623", "text": "function changeMe(){\n\tdocument.getElementById('vi').innerHTML= \"I lied\"\n}", "title": "" }, { "docid": "f2e65d4c82de324bd78e00ce2eebb3c5", "score": "0.5954083", "text": "function ShowSlideValue(newValue,ElementID){\n document.getElementById(ElementID).innerHTML=newValue;\n}", "title": "" }, { "docid": "4be87f3fd75f0ef6bc8fcaec6278f3c3", "score": "0.5931288", "text": "function seterror(id, error) {\n document.getElementById(id).innerHTML = error;\n}", "title": "" }, { "docid": "9996732eb6c27a8753054fc6eefe3c1a", "score": "0.59127504", "text": "function updateContent(element, content){\n element.innerHTML = content;\n}", "title": "" }, { "docid": "4d0a08ce362f3a80e0e383f3eb14b20a", "score": "0.5909803", "text": "function displayEditMenu(id) {\n var x = document.getElementById(`x3-edit-${id}`)\n x.innerHTML = `<form id='x3-edit-form-${id}'>\n <div class=\"w3-section\">\n <label>URL</label>\n <input id=\"x3-edit-url-${id}\" class=\"w3-input w3-border\" type=\"text\" required name=\"url\">\n </div>\n <div class=\"w3-section\">\n <label>Caption</label>\n <input id=\"x3-edit-caption-${id}\" class=\"w3-input w3-border\" type=\"text\" required name=\"caption\">\n </div>\n <button onclick='editMemes(${id})' class=\"w3-button w3-block w3-dark-grey\" type=\"button\">Edit Meme</button>\n </form><br>`\n}", "title": "" }, { "docid": "8a33ab3b82d08d863ba4926c87c3a877", "score": "0.5908662", "text": "function setValue(id,val) {\n document.getElementById(id).innerText = val;\n}", "title": "" }, { "docid": "52b068c45a61e8ab1345f21c54f5d5dc", "score": "0.59016913", "text": "function wr (id, val)\n{\n var x;\n if ((x=document.getElementById(id))) {\n x.innerHTML=val;\n return 1;\n }\n return 0;\n}", "title": "" }, { "docid": "3aad7e01abaa00c670c5ecadc8429c52", "score": "0.5885975", "text": "function outputReplace(target, content) { //Replaces existing target content with new content\n document.getElementById(target).innerHTML = content;\n}", "title": "" }, { "docid": "4e700da16965c598d3e8d28a388a4be3", "score": "0.58802706", "text": "function replace_me(target,data) {\n console.debug('[replace_me] target: ',target);\n if(jQuery('#'+target).length ==0) {\n console.error('[replace_me] Invalid target id %s. Selector failed', target);\n }\n else {\n jQuery('#'+target).html(data);\n }\n}", "title": "" }, { "docid": "e4c0ea746fb1a3b7140ed0f06e7a8e19", "score": "0.5880108", "text": "function switchContent(id){\n\tfor(contentId of contentIds){\n\t\tdocument.getElementById(contentId).style.display= 'none';\n\t}\n\t\n\tdocument.getElementById(id).style.display= 'block';\n}", "title": "" }, { "docid": "9cf8abe73c3e41995ff959d59801e58a", "score": "0.587785", "text": "function setInnerHtml(element, content) {\n MSApp.execUnsafeLocalFunction(function () {\n element.innerHTML = content;\n });\n}", "title": "" }, { "docid": "6e826af9e909a99f9ccaa28dcebe9403", "score": "0.58762443", "text": "function customReplace(id, src) {\n if (id == 'form1:openPositionZone:openPositionTable') {\n //create a temporary div\n var temp = document.createElement('div');\n\n //populate the temporary div with the src markup\n temp.innerHTML = DynaFaces.trim(src);\n\n //temp.firstChild is the src markup's root node\n var revisedOpenTableNode = temp.firstChild;\n\n //find and replace specific elements in the current price and floating profit columns\n replaceNodesByIdSuffix(revisedOpenTableNode, idSuffixesToReplace);\n }\n else {\n //just call the default replaceElement function\n Element.replace(id, src);\n }\n}", "title": "" }, { "docid": "60fa039cb412bc8ce12beee773d66029", "score": "0.58552045", "text": "function elementSetter(element, value) {\n try {\n document.getElementById(element).innerText = value\n } catch (e) {}\n}", "title": "" }, { "docid": "d06736e0711716d1f461c8d284739830", "score": "0.5835891", "text": "function updateText(id, text) {\n document.getElementById(id).children[1].value = text;\n}", "title": "" }, { "docid": "b38da93555755995ad4d47da4aaf7785", "score": "0.583493", "text": "function relabel(id_name, new_value)\r\n{\r\n $(\"#\"+id_name).text(new_value);\r\n}", "title": "" }, { "docid": "a9bdfa9ebde05c462b976676b35deffd", "score": "0.58320916", "text": "function setHelpText(id, text) {\n\t$('#' + id).parent().parent('div').find('span:nth-child(2)').html(text);\n}", "title": "" }, { "docid": "79905124b732997c1b1d4dae5557a548", "score": "0.5826974", "text": "function setVal(id, val) {\n\talert( id + \" : \" + val);\n\t$('#'+id).text(val);\n}", "title": "" }, { "docid": "2c5fc955a8ea1d206a6d936d63ae9946", "score": "0.58209753", "text": "function setSelectedFieldTitleToEditArea(id){\n\t var currentFeildTitle = $('#'+id);\n $('#'+placeHolder).text(currentFeildTitle[zeroIndex].placeholder);\n}", "title": "" }, { "docid": "f45924fc3aaac8a76fea94934c81b382", "score": "0.58044803", "text": "function replaceWHtml() {\n $('#h3Tag').html('<h6>Now I am an h6</h6>');\n}", "title": "" }, { "docid": "f3ec9bf56ae07c86d17d878b8a3da5b6", "score": "0.5800219", "text": "function clearEl(id) {\r\n if(ie4){\r\n \t whichEl = eval(\"document.all.elField\" + id);\r\n whichEl.innerHTML = \"&nbsp;\";\r\n \t} else if (dom) {\r\n whichEl = eval(\"document.getElementById(\\\"elField\" + id + \"\\\")\");\r\n whichEl.innerHTML = \"&nbsp;\";\r\n }\r\n }", "title": "" }, { "docid": "1a6bad3467a280b6dc9fda0ef6df3256", "score": "0.5791", "text": "function updateTag(tagtype,tagid,str){\n\ttry{\n\t\tif(tagtype=='div' || tagtype=='span'){\n\t\t\tdocument.getElementById(tagid).innerHTML=str;\n\t\t}\n\t\telse{\n\t\t\tdocument.getElementById(tagid).value=str;\n\t\t}\n\t}\n\tcatch(err){\n\t\t//--\n\t\twindow.alert('update err.');\n\t}\n\n}", "title": "" }, { "docid": "6895546d7099dce71308d8baf529999d", "score": "0.57878995", "text": "function updateFieldListItem( id, newHTML ) {\n\tvar li = $( '#templateField_' + id );\n\tli.replaceWith( newHTML );\n}", "title": "" }, { "docid": "37d81f74faa2b36d9f2bcba1b1eeccc5", "score": "0.5786408", "text": "function changeContent(id) {\r\n word.innerHTML = list[id].Word;\r\n pronunciation.innerHTML = \"(\" + list[id].Pronunciation + \")\";\r\n partOfSpeech.innerHTML = partOfSpeechTranslate(list[id].PartOfSpeech);\r\n definition.innerHTML = list[id].Definition;\r\n frequency.innerHTML = frequencies[id];\r\n}", "title": "" }, { "docid": "629767116aaa096991869308f479b560", "score": "0.5780417", "text": "function updateHTML() {\r\n clearAllHTML();\r\n generateAllHTML();\r\n}", "title": "" }, { "docid": "7235936348595906f6d520f3fb6b83fc", "score": "0.57771194", "text": "function getvalue(id, text) {\n // finds the HTML element with \"id\" and changes the element content (innerHTML) to ...\n document.getElementById(id).innerHTML = text;\n}", "title": "" }, { "docid": "b10d9b5b87432ea629c3e2c3ed299d74", "score": "0.5774117", "text": "function setElement(el){ \n\t\tif(this.element && this.element !== el) \n\t\t\tunregisterDOMEvents(); \n\t\tif(!el) throw new Error(\"You cannot set an element without passing one \") ; \n\t\tvar _id= '';\n\t\tif(!el.id) {\n\t\t\t _id= '__gelement_' + _NIDX++; \n\t\t\ttry { el.setAttribute('id', _id); } \n\t\t\tcatch (e) {}\n\t\t\tthis.id= _id; \n\t\t}\n\t\t\telse this.id= el.id; \n\t\tthis.element= el; \n\t}", "title": "" }, { "docid": "3c416297a9189df8f99be2bb673c8e7f", "score": "0.57680035", "text": "function replaceExistingWithNewHtml(newTextElements){\r\n \r\n \t//loop through newTextElements\r\n \tfor ( var i=newTextElements.length-1; i>=0; --i ){\r\n \r\n \t\t//check that this begins with <span\r\n \t\tif(newTextElements[i].indexOf(\"<span\")>-1){\r\n \t\t\t\r\n \t\t\t//get the name - between the 1st and 2nd quote mark\r\n \t\t\tstartNamePos=newTextElements[i].indexOf('\"')+1;\r\n \t\t\tendNamePos=newTextElements[i].indexOf('\"',startNamePos);\r\n \t\t\tname=newTextElements[i].substring(startNamePos,endNamePos);\r\n \t\t\t\r\n \t\t\t//get the content - everything after the first > mark\r\n \t\t\tstartContentPos=newTextElements[i].indexOf('>')+1;\r\n \t\t\tcontent=newTextElements[i].substring(startContentPos);\r\n \t\t\t\r\n \t\t\t//Now update the existing Document with this element\r\n \t\t\t\r\n\t \t\t\t//check that this element exists in the document\r\n\t \t\t\tif(document.getElementById(name)){\r\n\t \t\t\t\r\n\t \t\t\t//\talert(\"Replacing Element:\"+name);\r\n\t \t\t\t//\tdocument.getElementById('paraFrm').setAttribute('target','main');\r\n\t \t\t\t\tdocument.getElementById(name).innerHTML = content;\r\n\t \t\t\t\t\r\n\t \t\t\t} else {\r\n\t \t\t\t\t \r\n\t \t\t\t}\r\n \t\t}\r\n \t}\r\n \t//alert( \"Records Modified Successfully \");\r\n }", "title": "" }, { "docid": "c905091551093f758d935ee671e0fc49", "score": "0.5761055", "text": "function markElementAsNoteEdited(id) {\n let editee = document.getElementById(id)\n editee.setAttribute(\"note_edited\", true)\n getElementsWithEditedNote()\n}", "title": "" }, { "docid": "1ef9a3d49a68a867dc7b9deaad42bb83", "score": "0.57490194", "text": "function payBalance (id)\n{\n\tdocument.getElementById(id).innerHTML = payBalanceHTML; //this line modifies the the content of the userTravHistPanel\n}", "title": "" }, { "docid": "9677c12ad0b61efaf81558ee2a881f61", "score": "0.57460946", "text": "function getInnerHTML(id)\n{\n\tvar obj = el(id);\n\treturn obj ? obj.innerHTML : null;\n}", "title": "" }, { "docid": "33c3b56c558f055edea76696c5378d3b", "score": "0.57362455", "text": "function changeValue(id, newValue) {\r\n document.getElementById(id).value = newValue;\r\n}", "title": "" }, { "docid": "6c5f040a8d0a8e5615bac47fa7413422", "score": "0.57294875", "text": "function update_btn(old_btn_id, new_btn_id, btn_content){\n $(old_btn_id).removeAttr('id');\n $('.load-more a').attr({\n id : new_btn_id\n });\n $('#' + new_btn_id).html(btn_content);\n }", "title": "" }, { "docid": "f48cd6bdf40430601c69dcba540f29da", "score": "0.572501", "text": "function setAssetText(id){\n\n var title = Drupal.settings.fund_charting.title;\n var url = Drupal.settings.fund_charting.url;\n \n var text = Drupal.settings.fund_charting.text;\n \n var html = \"<h2><a target=\\\"_top\\\" href='\"+url[id].trim()+\n\t\"'>\"+title[id].trim()+\"</a></h2><p class='hide-for-small'>\"+\n\ttext[id].trim()+\"&nbsp;</p><p ><a target=\\\"_top\\\" class='assetSplitCTABtn' href='\"+\n\turl[id].trim()+\"'>More Info</a></p>\";\n $('#irishlife-fc-asset-group-text').html(html);\n }", "title": "" }, { "docid": "b704a7f3c35780017dd5e18573be9353", "score": "0.5711031", "text": "function populateElement(element, content = '', classes = false, id = false) {\n if (classes) {\n element.className = classes;\n }\n if (id) {\n element.id = id;\n }\n element.textContent = content;\n return element;\n}", "title": "" }, { "docid": "903280c50ca915e4a1adcddba4664cde", "score": "0.57086706", "text": "function replaceElementWithNews(elementID, newsName) {\n doPost('getNews', newsName, (response) => {\n document.getElementById(elementID).innerHTML = marked(response, { sanitize: true });\n });\n}", "title": "" }, { "docid": "8186b5377c4c864c861343957829557e", "score": "0.5706989", "text": "function UhOh(html,elid) {\n\thtml += \"<h2>Please <a href='#' onclick='window.location.reload()'>reload the page</a> try again. If this error persists, please E-mail to [email protected]!</h2>\";\n\t$(elid).html('<div style=\"color:DarkRed !important;background-color:white\">'+html+'</div>');\n\t$.modal.close();\n}", "title": "" } ]
bdaa8d7c3d86b96b07c19331d58e6e15
Retrieves assets from a site that are in a particular status and then renders them as a table
[ { "docid": "8e1ec4a3c5712e35d97284861be2fe7c", "score": "0.5596819", "text": "function loadGadget(criteria) {\n if(tableDiv.find(\".dataTables_wrapper\").length > 0)\n {\n tableDiv.find(\".dataTables_wrapper\").remove();\n }\n // get the data and then pass it to createStatusTable to create the table\n let searchCriteriaObj = {\"query\": \"\", \"folderPath\": \"//Folders/$System$/Assets\", \"sortColumn\":\"sys_title\",\"sortOrder\":\"asc\", \"formatId\":-1};\n\n var searchFields = [];\n if (criteria.assetType !== \"@all\")\n searchFields.push({\"key\": \"sys_contenttypeid\", \"value\" : criteria.assetType});\n if (criteria.workflow !== \"@all\")\n searchFields.push({\"key\": \"sys_workflowid\", \"value\" : criteria.workflow});\n if (criteria.state !== \"@all\")\n searchFields.push({\"key\": \"sys_contentstateid\", \"value\" : criteria.state});\n if (criteria.lasteditedby !== \"@all\")\n searchFields.push({\"key\": \"sys_contentlastmodifier\", \"value\" : criteria.lasteditedby});\n\n searchCriteriaObj.searchFields = {\"entry\":searchFields};\n\n PercSearchService\n .getAsyncSearchResult({\"SearchCriteria\":searchCriteriaObj},\n function(status, data){\n if(status === true) {\n tableData = perc_utils.convertCXFArray(data.PagedItemList.childrenInPage);\n createStatusTable(tableData);\n } else {\n displayErrorMessage(data);\n }\n // on success or error be sure to re-attach events\n addClickEvents();\n\n });\n }", "title": "" } ]
[ { "docid": "a74d162979339260155642d82480b348", "score": "0.61305666", "text": "function getStatuses() {\n stream.html('<div class=\"loader\"></div>');\n $.get(\"/statuses?for_user_id=\" + currentUserID, function(response) {\n stream.html(response.data);\n });\n }", "title": "" }, { "docid": "05234ab8ad59f0c34f375824ba7cfce1", "score": "0.5952809", "text": "function getStatus() {\n Rails.ajax({\n url: '/dashboard/status.json',\n type: 'get',\n success: function(data) {\n $('#projects').html(data.projects);\n $('#tasks').html(data.tasks);\n $('#tasks-waiting').html(data.waiting);\n $('#tasks-review').html(data.review);\n $('#tasks-completed').html(data.completed);\n }\n })\n}", "title": "" }, { "docid": "e54f39e152829a7ae3358fd5fdecf4f9", "score": "0.5905991", "text": "async function getAssetTypesByStatus(req, res) {\n return serviceAssetType.getAssetTypesByStatus(req, res);\n}", "title": "" }, { "docid": "eaa38f8dbba77f40bf5cdd34763f9606", "score": "0.57061315", "text": "function queryStatus(){\n\tAjax(\"Assets/query.php\"\n\t\t,{'query': {'type':'status'}, access_token:url.access_token}\n\t\t,function(data){\t\n\t\t\t//updateBars(\"90\", \"50\", \"95\", \"50\", \"3\", \"120\");\n\t\t\tupdateBars(data[1].battery, data[1].wifi, data[1].cpu, data[1].gps, data[1].sph, data[1].fps);\n\t\t}\n\t);\n}", "title": "" }, { "docid": "dcd22b9ae4c6902132fbe794945be817", "score": "0.56660074", "text": "fetchJobsByStatus (jobStatus) {\n return Api().get(`/jobs/driver/${jobStatus}`)\n }", "title": "" }, { "docid": "fc81dc7d996ef1f6650bb7cf582530a0", "score": "0.55949014", "text": "function getDeployStatus() {\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function() {\n if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {\n // console.log(xmlHttp.responseText);\n try {\n statuses = JSON.parse(xmlHttp.responseText);\n // console.log(statuses);\n liveStatus = statuses.live;\n previewStatus = statuses.preview;\n setStatusClasses();\n } catch(e) {\n }\n }\n }\n xmlHttp.open(\"GET\", '/actions/cra-by-fy/deploy/deploy-status', true); // true for asynchronous\n xmlHttp.send(null);\n }", "title": "" }, { "docid": "24b66c5a7f26ffbceb6ff60eb931b2cc", "score": "0.5571982", "text": "displayVnTable() {\n\n let vnData = this.projDt.vulnerabilities;\n let tbody = this.vnTableEl.querySelector('tbody')\n\n\n tbody.innerHTML = \"\";\n vnData.forEach(vn => {\n\n let tr = document.createElement('tr');\n \n tr.innerHTML = ` \n <td>${vn.date}</td>\n <td>${vn.uid}</td>\n <td>${vn.vnTitle}</td>\n <td> <span class=\"status\">${vn.status}</span></td>\n <td>${vn.risk}</td>\n `;\n \n \n tbody.append(tr);\n \n let statusCol = tr.querySelector(\".status\");\n \n \n switch(vn.status){\n case \"Corrigida\":\n statusCol.className = \"statusFixed\"\n break;\n case \"Corrigindo\":\n statusCol.className = \"statusFixing\"\n break;\n case \"Não Corrigida\":\n statusCol.className = \"statusNotFixed\"\n break;\n }\n \n })\n\n\n \n \n \n\n \n\n\n\n\n }", "title": "" }, { "docid": "8a60a05e3915d4af988aed8a1c42eb24", "score": "0.5539921", "text": "function dashboard(cb) {\n comm.http('/api/json', 'GET', url, _cb({\n 'ok': function (result) {\n var jobs = JSON.parse(result.data).jobs, data = [];\n if (jobs && jobs.length > 0) {\n jobs.forEach(function (job) {\n data.push({ status: status[job.color], name: job.name });\n });\n }\n return data;\n }\n }, cb));\n }", "title": "" }, { "docid": "ee79acdc3df866980f56272190ac86bf", "score": "0.5505171", "text": "function visualizeInfByStatus() {\n console.log(\"test\");\n $.ajax({\n url: urlRest + \"report-status\",\n type: \"GET\",\n datatype: \"JSON\",\n success: function (respuesta) {\n console.log(respuesta);\n visualizeTableByStatus(respuesta);\n },\n });\n}", "title": "" }, { "docid": "4a89865c2ce8f65c3095011e307f34da", "score": "0.5438004", "text": "function getAssets() {\n // solo nos traemos la info de 20 monedas, devuelve una promesa\n return fetch(`${url}/assets?limit=20`)\n .then((res) => res.json()) //otra promesa en formato json\n .then((res) => res.data); //el objeto con la info de las monedas\n}", "title": "" }, { "docid": "16ed57b93c023b867951228bcac0de50", "score": "0.5434769", "text": "function getProgressStatus(){\n\tJQ.getScript(get_status_url, function(){});\n}", "title": "" }, { "docid": "cea36aad6d7d4457059aaab192291b43", "score": "0.5404888", "text": "function ConsultarDados() {\n $.getJSON('http://localhost:55524/api/test', data => {\n var tableBody = $('#table-body');\n var innerHtml = '';\n\n data.forEach(item => {\n innerHtml += '<tr>';\n innerHtml += '<td>' + item.Id + '</td>';\n innerHtml += '<td>' + item.Name + '</td>';\n innerHtml += '<td>' + item.Status.toString().toUpperCase() + '</td>';\n innerHtml += '</tr>';\n });\n\n tableBody.html(innerHtml);\n });\n}", "title": "" }, { "docid": "b0593408de6eb19c45cb70d274fe7366", "score": "0.54012203", "text": "async do(headers = {}) {\n\t\tlet res = await this.c.get(\"/v2/assets\", this.query, headers);\n\t\treturn res.body;\n\t}", "title": "" }, { "docid": "9c0970b55a06a133cbaa63a4a57ae20b", "score": "0.5370877", "text": "function showStatusList() {\n\tvar db = getLocalDB();\n\tdb.transaction(function(tx){\n\t\ttx.executeSql(\"SELECT MID, Last_Name, First_Name, Start, Done FROM ES ORDER BY Done ASC, listOrder ASC, Last_Name, First_Name\", [], function(tx, qryResults){\n\t\t\tvar numRows = qryResults.rows.length;\n\t\t\tvar dbRecords = qryResults.rows;\n\t\t\tvar status = '';\n\t\t\tvar tdTxt = '';\n\t\t\t$('#tblESList').html('');\n\t\t\tfor (var i=0; i<numRows;i++) {\n\t\t\t\tif (dbRecords.item(i).Done == '1'){\n\t\t\t\t\tstatus = 'Complete';\n\t\t\t\t} else {\n\t\t\t\t\tstatus = 'Incomplete';\n\t\t\t\t}\n\t\t\t\ttdTxt = '<tr class=\"'+status+'\"><td width=\"50%\">'+dbRecords.item(i).First_Name + ' ' + dbRecords.item(i).Last_Name+'</td><td width=\"25%\">'+dbRecords.item(i).Start+'</td><td width=\"25%\">'+status+'</td></tr>';\n\t\t\t\t$('#tblESList').append(tdTxt);\n\t\t\t}\n\t\t\t$('.Incomplete:last td').css('border-bottom', '2px solid #ac1a2f');\n\t\t}, errorCallback);\n\t}, errorCallback);\n} // END showStatusList", "title": "" }, { "docid": "72cad9fdaa0b7ad9bbc095db873cdc39", "score": "0.5337219", "text": "function showResources() {\n $.get(\"/CienciasBasicas/Resources\",\n {\n action: \"view\",\n mode: \"table\"\n },\n function (data, status) {\n $(\"#cont2\").html(data);\n });\n}", "title": "" }, { "docid": "83b808ba35ea851313349c01650700db", "score": "0.5336124", "text": "static async getBooksByStatus(status) {\n let res = await this.request(`mybooks/status/${status}`);\n return res.myBooks;\n }", "title": "" }, { "docid": "be5523ef507824b0b2eba7e6b807444b", "score": "0.5307643", "text": "function getStatus() {\r\n\t\t$.getJSON('/status', function(status) {\r\n\t\t\tupdateStatistics(status);\r\n\t\t\tdrawSolution(status.cities);\r\n\t\t\tsetTimeout(getStatus, 1000);\r\n\t\t});\r\n\t}", "title": "" }, { "docid": "fc66c1537d0d887a9a62efb07dff9a99", "score": "0.52806437", "text": "async function getRankingsByStatus(req, res) {\n try {\n const status = req.params.status;\n const rankings = await Ranking.findAll({ where: { status } });\n successMsg(res, 200, 'correcto', rankings);\n } catch (error) {\n errorMsg(res, 500, 'Ha ocurrido un error', error);\n }\n}", "title": "" }, { "docid": "f888d03a497bb15fe7e1f34f1ad1538c", "score": "0.52633923", "text": "function showTotalOrders(status, table){\n fetch('server/http_request/total_orders.php?status='+status+'&table='+table)\n .then(resp => resp.json())\n .then(resp => {\n if(table == 'orders'){\n if(status == 'sin_iniciar') document.getElementById('total_pedidos_sin_iniciar').innerHTML = resp;\n if(status == 'en_proceso') document.getElementById('total_pedidos_en_proceso').innerHTML = resp;\n if(status == 'completado') document.getElementById('total_pedidos_completados').innerHTML = resp;\n }\n\n if(table == 'dow'){\n if(status == 'sin_iniciar') document.getElementById('total_pedidos_sin_iniciar_dow').innerHTML = resp;\n if(status == 'en_proceso') document.getElementById('total_pedidos_en_proceso_dow').innerHTML = resp;\n if(status == 'completado') document.getElementById('total_pedidos_completados_dow').innerHTML = resp;\n }\n })\n .catch(error => {\n console.log('ERROR en petición http de total_orders.php', error);\n });\n}", "title": "" }, { "docid": "4510900c76142165844ec83e756ba6ce", "score": "0.5248858", "text": "async componentStatuses() { return ITEMS(await this.api.componentstatuses.get()) }", "title": "" }, { "docid": "df28d5f800f6e1fc0298f7ec520b50ff", "score": "0.52451533", "text": "function getStatuses() {\n\t\t$http.get('/api/statuses')\n\t\t.success(function(result) {\n\t\t\t$scope.statuses = result;\n\t\t})\n\t}", "title": "" }, { "docid": "235a2e627c78686aa6b0ba3c6f64f297", "score": "0.5240432", "text": "function getTaskResults(statusUrl) {\n var url = statusUrl;\n return $http.get(url);\n }", "title": "" }, { "docid": "2bd43e88b9b56868d72752296b873890", "score": "0.5210474", "text": "function getDashboardInfo() {\n // Obtener datos desde un servidor\n fetch(\"https://cdn.rawgit.com/jesusmartinoza/Fuse-Workshop/9731ceb3/raw_api.json\")\n .then(function(response) {\n // Devuelve la respuesta con Headers\n return response.json(); // Parsear el body a JSON\n })\n .then(function(response) {\n books.clear();\n if(response.success) {\n books.addAll(response.data.popular);\n activities.addAll(response.data.activities);\n special.addAll(response.data.special);\n }\n })\n}", "title": "" }, { "docid": "29fdb8f9205bef5d584c6eba6dcdb59a", "score": "0.51978546", "text": "function updateStatusFct(){\n $.getJSON( $('body').attr('data-status-url') )\n .done(function( json ) {\n $('#status-overview').html(json.body);\n })\n .fail(function( jqxhr, textStatus, error ) {\n const err = textStatus + \", \" + error;\n $('#status-overview').html('<i class=\"fa fa-circle text-red\"></i> ' + err);\n });\n }", "title": "" }, { "docid": "d878567ed0a113d0e4e570b26df4f716", "score": "0.51972574", "text": "function getAssets() {\n return fetch(`${url}/assets?limit=20`)\n .then((res) => res.json())\n .then((res) => res.data);\n}", "title": "" }, { "docid": "c97588ff4c12bd640b4bd236f5551e1e", "score": "0.5167938", "text": "function renderOnlineFollowers(){\n $.getJSON(followsURL, function(data2){\n for(i = 0; i < data2.follows.length; i++){\n if(data2.follows[i].channel.status){ \n writeRows(data2);\n } \n } \n }); \n}", "title": "" }, { "docid": "2268498745542a7863e8e863ab4a6089", "score": "0.5140134", "text": "function getAsistTable(com){\n $(\"#data-tables\").html(loadingIcon);\n\tif ((com == null) || (com === \"\")){\n $(\"#data-tables\").html(\"\");\n\t} else {\n\t\t$.ajax({\n\t\t type: \"get\",\n\t\t\turl: \"./asistencia/participaciones?com=\"+com,\n\t\t\tsuccess: function(data, status) {\n\t\t if (status == \"success\"){\n\t\t $(\"#data-tables\").html(data);\n\t\t $(\"#atl-asist\").html($(\".row-par .btn-info\").length);\t\t \n\t\t }\n\t\t }\n\t\t});\t\t\t\n\t}\n}", "title": "" }, { "docid": "72fd6e61d818163e5c2924a00d1cfa03", "score": "0.51184213", "text": "function renderTable(statusRows){\n let rows = statusRows;\n let footer = [\n \"TOTAL\",\n (function(){\n return rows.reduce(function(prev,curr){\n return prev+parseInt(curr.Success)\n },0)\n }()),\n (function(){\n return rows.reduce(function(prev,curr){\n return prev+((curr.fail==='-') ? 0 : curr.fail);\n },0);\n }()),\n (function(){\n var total = rows.reduce(function(prev,curr){\n return prev+parseInt(curr.percentage)\n },0);\n return (total/(rows.length*1)).toFixed(2) + \"%\";\n }())];\n\n var t1 = Table(header,statusRows,footer,{\n borderStyle : 1,\n borderColor : \"blue\",\n paddingBottom : 0,\n headerAlign : \"center\",\n align : \"center\",\n color : \"white\"\n });\n console.log(t1.render());\n}", "title": "" }, { "docid": "8925e54dfd3494eacc2a4b18f53ef48c", "score": "0.51137197", "text": "function GetAssetsReportFun() {\n var sum_la_base_amount = '', sum_us_base_amount = '', sum_ba_base_amount = '', sum_ca_base_amount = '',\n ba_register_count, ca_register_count, us_register_count, tr = '';\n GetAssetsReport(token, function (response) {\n if (response.errcode == '0') {\n var data = response.rows;\n sum_us_base_amount = data.sum_us_base_amount;\n sum_ba_base_amount = data.sum_ba_base_amount;\n sum_ca_base_amount = data.sum_ca_base_amount;\n sum_la_base_amount = Number(sum_us_base_amount) + Number(sum_ba_base_amount) + Number(sum_ca_base_amount);\n ba_register_count = data.ba_register_count;\n ca_register_count = data.ca_register_count;\n us_register_count = data.us_register_count;\n if (sum_us_base_amount == null) {\n sum_us_base_amount = 0;\n }\n if (sum_ba_base_amount == null) {\n sum_ba_base_amount = 0;\n }\n if (sum_ca_base_amount == null) {\n sum_ca_base_amount = 0;\n }\n if (sum_la_base_amount == null) {\n sum_la_base_amount = 0;\n }\n if (ba_register_count == 0) {\n ba_register_count = 0;\n }\n if (ca_register_count == 0) {\n ca_register_count = 0;\n }\n if (us_register_count == 0) {\n us_register_count = 0;\n }\n tr += '<tr>' +\n '<td><span class=\"sum_la_base_amount\">' + sum_la_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_la_base_amount\">' + sum_us_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_la_base_amount\">' + sum_ba_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_la_base_amount\">' + sum_ca_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '</tr>';\n $('#amount_report').html(tr);\n var trInfo = '';\n var sum_us_recharge_base_amount = data.sum_us_recharge_base_amount,\n sum_us_withdraw_base_amount = data.sum_us_withdraw_base_amount,\n sum_ba_recharge_base_amount = data.sum_ba_recharge_base_amount,\n sum_ba_withdraw_base_amount = data.sum_ba_withdraw_base_amount,\n sum_ca_recharge_base_amount = data.sum_ca_recharge_base_amount,\n sum_ca_withdraw_base_amount = data.sum_ca_withdraw_base_amount;\n\n if (sum_us_recharge_base_amount == null) {\n sum_us_recharge_base_amount = 0\n }\n if (sum_us_withdraw_base_amount == null) {\n sum_us_withdraw_base_amount = 0\n }\n if (sum_ba_recharge_base_amount == null) {\n sum_ba_recharge_base_amount = 0\n }\n if (sum_ba_withdraw_base_amount == null) {\n sum_ba_withdraw_base_amount = 0\n }\n if (sum_ca_recharge_base_amount == null) {\n sum_ca_recharge_base_amount = 0\n }\n if (sum_ca_withdraw_base_amount == null) {\n sum_ca_withdraw_base_amount = 0\n }\n\n trInfo += '<tr>' +\n '<td><span class=\"sum_us_recharge_base_amount\">' + sum_us_recharge_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_us_withdraw_base_amount\">' + sum_us_withdraw_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_ba_recharge_base_amount\">' + sum_ba_recharge_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_ba_withdraw_base_amount\">' + sum_ba_withdraw_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_ca_recharge_base_amount\">' + sum_ca_recharge_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_ca_withdraw_base_amount\">' + sum_ca_withdraw_base_amount + '</span><span class=\"base_type\">BTC</span></td>' +\n '</tr>';\n $('#amount_reportInfo').html(trInfo);\n\n var trGift = '';\n var G = (data.gift_row[0].t),\n IG = (data.gift_row[1].IG),\n NDG = (data.gift_row[2].NDG),\n NDBG = (data.gift_row[3].NDBG),\n NDAG = (data.gift_row[4].NDAG);\n var giftRegister = Number(NDG) + Number(NDBG) + Number(NDAG);\n\n\n\n trGift += '<tr>' +\n '<td><span class=\"sum_us_recharge_base_amount\">' + G + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_us_withdraw_base_amount\">' + IG + '</span><span class=\"base_type\">BTC</span></td>' +\n '<td><span class=\"sum_us_recharge_base_amount\">' + giftRegister + '</span><span class=\"base_type\">BTC</span></td>' +\n\n // '<td><span class=\"sum_ba_recharge_base_amount\">' + NDG + '</span><span class=\"base_type\">BTC</span></td>' +\n // '<td><span class=\"sum_ba_withdraw_base_amount\">' + NDBG + '</span><span class=\"base_type\">BTC</span></td>' +\n // '<td><span class=\"sum_ca_recharge_base_amount\">' + NDAG + '</span><span class=\"base_type\">BTC</span></td>' +\n '</tr>';\n $('#amount_gift').html(trGift);\n\n DonutFun(us_register_count, ba_register_count, ca_register_count);\n var dataChartObj = {}, dataChart = [];\n dataChartObj.y = new Date().Format('yyyy-MM-dd'),\n dataChartObj.u = sum_us_base_amount,\n dataChartObj.b = sum_ba_base_amount,\n dataChartObj.c = sum_ca_base_amount;\n dataChart.push(dataChartObj);\n LineFun(dataChart);\n }\n }, function (response) {\n LayerFun(response.errcode);\n });\n }", "title": "" }, { "docid": "6b6e12efe025d4500b9eb2e0898b2492", "score": "0.5110408", "text": "function checkJobStatus() {\n\n $.ajax({\n type: \"GET\",\n url: '?action=checkStatus',\n async: false,\n success: function(data) {\n var obj = eval('(' + data + ')');\n var temp = [];\n $.each(obj, function(k, v) {\n\n if (typeof(k) != 'undefined' && typeof(v) != 'undefined') {\n temp.push(k);\n\n var item = $('[data-base-ip^=\"' + k.replace('192.168.', '') + '\"]');\n if (item.length > 0 && typeof(item) != 'undefined' && typeof(temp[k]) != 'undefined') {\n switch (v) {\n case 'fatalError':\n temp[k]['status'] = 'Fatal Error';\n break;\n case 'fileNotFound':\n temp[k]['status'] = 'File Not Found';\n break;\n case 'cameraNotFound':\n temp[k]['status'] = 'Camera Not Found';\n break;\n case 'failedBeforeStart':\n temp[k]['status'] = 'Failed Before Start';\n break;\n case 'renderCompleted':\n temp[k]['status'] = 'Render Completed.';\n break;\n case 'invalidFlag':\n temp[k]['status'] = 'Invalid Flag Passed';\n break;\n }\n temp[k]['item'] = item;\n\n }\n }\n\n });\n stats = temp;\n },\n error: function(data) {\n console.log(data);\n }\n\n });\n\n return stats;\n\n}", "title": "" }, { "docid": "1af9bd75c03094c80bc7d05697db7a54", "score": "0.5100928", "text": "function showBoatOverview() {\n $(\"#tableShowBoatOverview\").show();\n $(\"#tableBoatOverviewBody\").empty();\n totalTime =0;\n totalIncome=0;\n $.get('api/overviews/boatOverviews', function(boatUsages){\n $.each(boatUsages, function(index, boatUsage) {\n $('#tableBoatOverviewBody').append('<tr><td>' + boatUsage.boatNumber + '</td>' + '<td>' +\n boatUsage.type + '</td>' + '<td>' +\n boatUsage.numberOfSeats + '</td><td>' + Math.floor(boatUsage.totalTime/60) + \" h \" + boatUsage.totalTime % 60 + \" m\" + '</td><td>' +\n boatUsage.income.toFixed(2) + '</td></tr>');\n //total overviews accumulated inside the loop\n totalTime += boatUsage.totalTime;\n totalIncome += boatUsage.income;\n });\n $('#tableBoatOverviewBody').append('<tr style=\"background-color:powderblue; color:red;font-size:25px\"><td></td><td></td>' +\n '<td>' + \"Total\" + '</td><td>' + Math.floor(totalTime/60) + \" h \" + totalTime % 60 + \" m\" +\n '</td><td>' + totalIncome.toFixed(2) + '</td></tr>');\n });\n}", "title": "" }, { "docid": "c2da347c339a370d2d80cf944a84cf8f", "score": "0.5094574", "text": "function getLibraryStats() {\n $.ajax({\n type: 'GET',\n url: WEBDIR + \"plexpy/get_home_stats\",\n success: function (data) {\n $(\"#watchstats\").html(null);\n var items = \"\";\n var itemTitle = \"\";\n var itemType = \"\";\n var itemCount = 0;\n var classApply = \"\";\n $.each(data, function (index, value) {\n if(index < 8)\n {\n itemTitle = setTitle(value.stat_id);\n itemType = setType(value.stat_type, value.stat_id);\n switch(value.stat_id){\n case \"top_movies\":\n itemCount = value.rows[0].total_plays;\n classApply = \"stat-poster pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=85&h=125&thumb='+encodeURIComponent(value.rows[0].thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"popular_movies\":\n itemCount = value.rows[0].users_watched;\n classApply = \"stat-poster pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=85&h=125&thumb='+encodeURIComponent(value.rows[0].thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"top_tv\":\n itemCount = value.rows[0].total_plays;\n classApply = \"stat-poster pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=85&h=125&thumb='+encodeURIComponent(value.rows[0].grandparent_thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"popular_tv\":\n itemCount = value.rows[0].users_watched;\n classApply = \"stat-poster pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=85&h=125&thumb='+encodeURIComponent(value.rows[0].grandparent_thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"top_music\":\n itemCount = value.rows[0].total_plays;\n classApply = \"stat-cover pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=80&h=80&thumb='+encodeURIComponent(value.rows[0].grandparent_thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"popular_music\":\n itemCount = value.rows[0].users_watched;\n classApply = \"stat-cover pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=80&h=80&thumb='+encodeURIComponent(value.rows[0].grandparent_thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"last_watched\":\n itemCount = value.rows[0].friendly_name + \"</br>\" + moment(value.rows[0].last_watched).format(\"MM/DD/YYYY\");\n classApply = \"stat-poster pull-left\";\n var thumb = WEBDIR + 'plex/GetThumb?w=85&h=125&thumb='+encodeURIComponent(value.rows[0].thumb);\n var image = \"<img src=\\\"\" + thumb + \"\\\"/>\";\n break;\n case \"top_users\":\n itemCount = value.rows[0].total_plays;\n classApply = \"stat-cover pull-left\";\n var image = \"<img src=\\\"\" + value.rows[0].user_thumb + \"\\\"/>\";\n break;\n case \"top_platforms\":\n itemCount = value.rows[0].total_plays;\n classApply = \"stat-cover pull-left\";\n break;\n }\n\n\n\n if ((index % 4) == 0) items += '<div class=\"row-fluid\">';\n items += '<div class=\"span3 p-lr-sm well stat-holder\">' +\n '<div class=\"'+classApply+'\">' + image +\n '</div>' +\n '<div class=\"stat-highlights\">' +\n '<h2>' + itemTitle + '</h2>' +\n //'<p>' + value.rows[0].title + value.rows[0].friendly_name +'</p>';\n '<p>' + value.rows[0].title +'</p>';\n if(value.stat_id == \"last_watched\"){\n items += itemCount\n }\n else{\n items += '<h3 class=\"clear-fix\">' + itemCount + '</h3> '\n }\n items += itemType +\n '</div>' +\n '</div>';\n if ((index % 4) == 3) items += '</div>';\n }\n })\n $(\"#watchstats\").html(items);\n\n },\n\n timeout: 2000\n })\n}", "title": "" }, { "docid": "7e33ad0a5c030b031a942ebc21fd62aa", "score": "0.5090326", "text": "function vega_storyStatus(elem)\n{\n var classes = vega_$(elem).find('.storyItem').attr('class');\n for (var i in VEGA_STATUSES)\n if (VEGA_STATUSES.hasOwnProperty(i) && classes.indexOf(VEGA_STATUSES[i]) != -1)\n return VEGA_STATUSES[i];\n \n return '';\n}", "title": "" }, { "docid": "76cc0ee6058b5e58985b528ac784daaf", "score": "0.50846905", "text": "function displayInProgress() {\n\tvar filter = \"state=IN_PROGRESS\";\n\tdataService.getAllImports(\"#status\", filter, function(data) {\n\t\tfor (var i = 0; i < data.operation.length; i++) {\n\t\t\tvar op = data.operation[i];\n\t\t\tvar item = op.item;\n\t\t\tvar id = op.id;\n\t\t\tvar filename = item.name;\n\t\t\tvar progress = op.progress;\n\t\t\t$(\"#dataTable > tbody:last\").append('<tr id=\"data-row-' + id + '\" style=\"border: 1px solid #E9E9E9;\"><td>' + filename + progressActions(id) + '<div id=\"data-action-row-' + id + '\" style=\"width: 165px; float: right;\">' + progressHtml(progress) + '</div></td></tr>');\n\t\t\taddDataProgressCheck(id);\n\t\t}\n\t});\n}", "title": "" }, { "docid": "94fa92b106d01fe5fd0da8afe022e712", "score": "0.50845194", "text": "function fillActivitiesTable(type) {\n\tvar activityTable = '';\n\t$.getJSON('/ajax/activities.json', function(data) {\n\t\tactivityTable += '<table class=\"table table-hover table-bordered\">';\n\t\t$.each(data, function() {\n\t\t\tif($.inArray(this.title, userCompletedAssignments) !== -1) {\n\t\t\t\tactivityTable += '<tr class=\"success\"><td><p><a href=\"' + type + '/' + this.title +'\">' + this.title + '</a><br/>'+ this.description +'</p></td></tr>';\n\t\t\t} else {\n\t\t\t\tactivityTable += '<tr><td><p><a href=\"' + type + '/' + this.title +'\">' + this.title + '</a><br/>'+ this.description +'</p></td></tr>';\n\t\t\t}\n\t\t});\n\t\tactivityTable += '</table>';\n\t\t$('.activitiesTable').html(activityTable);\n\t})\n}", "title": "" }, { "docid": "41cbecfd93f23abaae3459de4402bbcd", "score": "0.5078095", "text": "function loadPending() {\n var table = document.getElementById( \"result\" );\n\n // Clear error\n document.getElementById( \"error\" ).innerHTML = \"\";\n\n // We want the pending/reviewed status of each\n // submission, so we divide the submissions into blocks\n // of 50, then fetch their categories (w/ an intelligent\n // use of clcategories so we don't fetch extra ones),\n // then display them using the submission-specific\n // element ids that we already put in the table cells\n var linksNodeList = document.querySelectorAll( \"#result tr td:first-child a\" );\n var links = [];\n for( i = 0; i < linksNodeList.length; i++ ) {\n links.push( linksNodeList[ i ] );\n }\n var revidQueryParam, page, ourTitles;\n for( i = 0; i < links.length; i += STEP_LENGTH ) {\n titles = links.slice( i, i + STEP_LENGTH )\n .map( function ( link ) { return link.href; } )\n .map( function ( href ) { return /https:\\/\\/en.wikipedia.org\\/wiki\\/(.+)/.exec( href )[ 1 ]; } )\n .map( function ( title ) { return title.replace( \"&\", \"%26\" ).replace( \"+\", \"%2B\" ); } );\n revidQueryParam = titles\n .join( \"|\" );\n ( function ( ourTitles ) {\n loadJsonp( API_ROOT + \"?action=query&titles=\" +\n revidQueryParam + \"&prop=categories&clcategories=Category:Pending AfC submissions\" + API_SUFFIX ).then( function ( data ) {\n if ( !data.query || !data.query.pages ) {\n return;\n }\n for( var pageid in data.query.pages ) {\n page = data.query.pages[ pageid ];\n var pending = page.hasOwnProperty( \"categories\" );\n //console.log(pending + JSON.stringify(page));\n var elId = \"status-\" +\n page.title.replace( / /g, \"-\" )\n .replace( /'/g, \"-\" ).replace( /\\+/g, \"-\" );\n var el = document.getElementById( elId );\n if( el ) {\n ourTitles.splice( ourTitles.indexOf( page.title ), 1);\n el.innerHTML = pending ? \"Pending\" : \"Reviewed\";\n el.className += pending ? \"pending\" : \"\";\n } else {\n console.log( \"No matching element for element \" + elId );\n }\n }\n } );\n } )( titles );\n }\n }", "title": "" }, { "docid": "20a2058e47d2b3fcf6f02e5f5ecd5f4b", "score": "0.5076661", "text": "async function fetchStatusReport() {\n var data = await $.getJSON(\"status_report?token=3efbdfd5be1d284d8b3dd660cc31f839\").then();\n statusReport = data.status_report;\n if (data.description === \"times up\") {\n // times up\n gameOver();\n }\n }", "title": "" }, { "docid": "19c34dcd80a364983d518d7bb54686e0", "score": "0.5068792", "text": "_displayStatus() {\n // TODO: Use WebAPI auto caching (advanced feature, not implemented yet)\n if (discotron.BotStatusController.tag === undefined) {\n discotron.WebAPI.queryBot(\"discotron-dashboard\", \"get-bot-info\").then((data) => {\n document.querySelector(\"#bot-avatar\").src = data.avatar;\n document.querySelector(\"#bot-name\").textContent = data.tag;\n\n discotron.BotStatusController.tag = data.tag;\n discotron.BotStatusController.avatar = data.avatar;\n }).catch(console.error);\n } else {\n document.querySelector(\"#bot-avatar\").src = discotron.BotStatusController.avatar;\n document.querySelector(\"#bot-name\").textContent = discotron.BotStatusController.tag;\n }\n\n discotron.WebAPI.queryBot(\"discotron-dashboard\", \"get-bot-config\").then((data) => {\n let status, classStatus;\n\n if (data.status === 0) {\n status = \"Online\";\n classStatus = \"bot-status-online\";\n } else {\n status = \"Offline (Status: \" + data.status + \")\";\n classStatus = \"bot-status-offline\";\n }\n\n document.getElementById(\"bot-name\").innerHTML += \"<span class=\\\"bot-status \" + classStatus + \"\\\">\" + status + \"</span>\";\n document.getElementById(\"bot-presence\").value = data.presenceText;\n document.getElementById(\"maintenance-enabled\").checked = data.maintenance;\n }).catch(console.error);\n }", "title": "" }, { "docid": "89cd4b759b8e32197c8cb93950f333e0", "score": "0.50614834", "text": "function getStatuses() {\n return statuses;\n }", "title": "" }, { "docid": "636bd3adbaea521942e0fc27cf5527c5", "score": "0.5054088", "text": "function getKoalas(){\n //console.log( 'in getKoalas' );\n // ajax call to server to get koalas\n let sortByCol = $('#sortInput').val();\n //console.log('sortByCol is', sortByCol);\n \n $.ajax ({\n method: 'GET',\n url: `/koalas/${sortByCol}/`\n }).then(function(response) {\n const listOfKoalas = response;\n //console.log(listOfKoalas);\n \n $('#viewKoalas').empty();\n for(let koala of listOfKoalas) {\n //append each koala to the table\n //console.log(`${koala.ready_to_transfer}`);\n $('#viewKoalas').append(`<tr>\n <td class=\"name\">${koala.name}</td>\n <td>${koala.gender}</td>\n <td>${koala.age}</td>\n <td class=\"status\">${koala.ready_to_transfer}</td>\n <td><button class=\"transfer-button\"\n data-transfer=\"${koala.id}\">Change Status</button></td>\n <td>${koala.notes}</td>\n <td><button class=\"delete-button\"\n data-koalaId=\"${koala.id}\">Remove</button></td>\n </tr>`\n )\n let lastRowStatus = $('#viewKoalas').children().last().children('.status').html();\n let lastTableRow = $('#viewKoalas').children().last();\n //console.log(lastRowStatus);\n //console.log(lastTableRow);\n if( lastRowStatus == 'true') {\n //console.log('conditional passes');\n lastTableRow.addClass('ready');\n }\n } \n });\n} // end getKoalas", "title": "" }, { "docid": "12aad78cc1599ebdd8e5254dfac6714a", "score": "0.5051106", "text": "function getStatusList() {\n const requestOptions = {\n method: \"GET\",\n headers: httpHeaders.authorization()\n };\n return fetch(`${config.apiUrl}/task-statuses/get-statuses`, requestOptions);\n}", "title": "" }, { "docid": "efe567c2e4620d3d68c6950bb851c6fd", "score": "0.50469947", "text": "async getJobStatus() {\n let jobId = localStorage.getItem(\"jobId\");\n axios.get(`${API_URL}/job/${jobId}/status`)\n //.then(res => res.ok ? res.data.jobStatus : -1)\n .then(res => res.data)\n .then(data => data.status)\n .catch(err => 0)\n\n }", "title": "" }, { "docid": "b6097d065957bee8bf806d84c6427dac", "score": "0.50375235", "text": "function getIc9To10AmRecords(key, status) {\n fetch(`/getRecords?key=${key}&status=${status}`, {\n method: \"GET\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n })\n .then((res) => res.json())\n .then((resJson) => {\n let records = resJson.records.data;\n if (records.length > 0) {\n if (status === \"ICD-9-BPA code\") {\n displayIC9To10AmRecord(records);\n } else {\n displayIC10AMTo9Record(records);\n }\n } else {\n window.alert(\"Record not found\");\n }\n })\n .catch((error) => {\n const errors = {\n responseMessage: error.response.data,\n status: error.response.status,\n };\n window.alert(\"something went wrong\");\n });\n}", "title": "" }, { "docid": "504124512bdb1031dbe68c04ad97e7d1", "score": "0.5035003", "text": "function getApiStatus(numRecordsAll, updated, status) {\n\t$(\"#status_APIstatus\").text(status).hide().fadeIn();\n\tvar tempDate = new Date(updated);\n\tvar lastUpdate = moment(tempDate).format(\"M/D/YYYY @ hh:MM a\");\n\t$(\"#status_date\").text(lastUpdate).hide().fadeIn();\n\n\tvar options = {  \n\t\tuseEasing: true,\n\t\t  useGrouping: true,\n\t\t  separator: ',',\n\t\t  decimal: '.',\n\t\t  prefix: '',\n\t\t  suffix: ''\n\t};\n\tvar numRecordsCount = new CountUp(\"status_numRecords\", 0, numRecordsAll, 0, 1.5, options);\n\tnumRecordsCount.start();\n}", "title": "" }, { "docid": "407bc6abaf4f0604c2b69dc83d9edbfb", "score": "0.50277007", "text": "function stat() {\n setTimeout(function() {\n $.get(\"/download/stat\").done(function(data) {\n if (data.status && data.status === \"done\") {\n $(\"#progress\").css(\"width\", \"100%\")\n $(\"#stat_text\").text(\"Done\")\n } else if (data.todo > 0) {\n $(\"#progress\").css(\"width\", data.done / data.total * 100 + \"%\")\n $(\"#progress\").css(\"background-color\", \"orangered\")\n $(\"#stat_text\").text(\n \"Fetching article info \" +\n data.done +\n \" of \" +\n data.total +\n \" (\" +\n data.imageQueue +\n \" images found)\"\n )\n stat()\n } else {\n $(\"#progress\").css(\n \"width\",\n data.imageDone / data.imageTotal * 100 + \"%\"\n )\n $(\"#progress\").css(\"background-color\", \"limegreen\")\n $(\"#stat_text\").text(\n \"Fetching images (\" + data.imageDone + \" of \" + data.imageTotal + \")\"\n )\n stat()\n }\n })\n }, 500)\n}", "title": "" }, { "docid": "2fa07a82377c0e7951eeb3a36891a632", "score": "0.50275046", "text": "function getStatus(){\n\tvar file = $.getJSON(\"https://techhounds.com/FRC%20Fantasy/databases/AverageOPRS.json\"),\n\t\tchecker = $.when(file);\n\tchecker.done(function() {\n\t\tconsole.log(file.response);\n\t});\n}", "title": "" }, { "docid": "17f7934776b5af100073c397233097d5", "score": "0.5024099", "text": "function drawCollectionsTable () {\n var collectionsTable = $('#collectionsTableID').dataTable();\n collectionsTable.fnClearTable();\n $.getJSON(\"/_api/collection/\", function(data) {\n var items=[];\n $.each(data.collections, function(key, val) {\n var tempStatus = val.status;\n if (tempStatus == 1) {\n tempStatus = \"new born collection\";\n }\n else if (tempStatus == 2) {\n tempStatus = \"<font color=orange>unloaded</font>\";\n items.push(['<button class=\"enabled\" id=\"delete\"><img src=\"/_admin/html/media/icons/round_minus_icon16.png\" width=\"16\" height=\"16\"></button><button class=\"enabled\" id=\"load\"><img src=\"/_admin/html/media/icons/connect_icon16.png\" width=\"16\" height=\"16\"></button><button><img src=\"/_admin/html/media/icons/zoom_icon16_nofunction.png\" width=\"16\" height=\"16\" class=\"nofunction\"></img></button><button><img src=\"/_admin/html/media/icons/doc_edit_icon16_nofunction.png\" width=\"16\" height=\"16\" class=\"nofunction\"></img></button>', \n val.id, val.name, tempStatus, \"-\", \"-\"]);\n }\n else if (tempStatus == 3) {\n tempStatus = \"<font color=green>loaded</font>\";\n var alive; \n var size; \n \n $.ajax({\n type: \"GET\",\n url: \"/_api/collection/\" + val.id + \"/figures\",\n contentType: \"application/json\",\n processData: false,\n async: false, \n success: function(data) {\n size = data.figures.journals.fileSize + data.figures.datafiles.fileSize; \n alive = data.figures.alive.count; \n },\n error: function(data) {\n }\n });\n \n items.push(['<button class=\"enabled\" id=\"delete\"><img src=\"/_admin/html/media/icons/round_minus_icon16.png\" width=\"16\" height=\"16\" title=\"Delete\"></button><button class=\"enabled\" id=\"unload\"><img src=\"/_admin/html/media/icons/not_connected_icon16.png\" width=\"16\" height=\"16\" title=\"Unload\"></button><button class=\"enabled\" id=\"showdocs\"><img src=\"/_admin/html/media/icons/zoom_icon16.png\" width=\"16\" height=\"16\" title=\"Show Documents\"></button><button class=\"enabled\" id=\"edit\" title=\"Edit\"><img src=\"/_admin/html/media/icons/doc_edit_icon16.png\" width=\"16\" height=\"16\"></button>', \n val.id, val.name, tempStatus, bytesToSize(size), alive]);\n }\n else if (tempStatus == 4) {\n tempStatus = \"in the process of being unloaded\"; \n items.push(['<button id=\"delete\"><img src=\"/_admin/html/media/icons/round_minus_icon16_nofunction.png\" class=\"nofunction\" width=\"16\" height=\"16\"></button><button class=\"enabled\" id=\"load\"><img src=\"/_admin/html/media/icons/connect_icon16.png\" width=\"16\" height=\"16\"></button><button><img src=\"/_admin/html/media/icons/zoom_icon16_nofunction.png\" width=\"16\" height=\"16\" class=\"nofunction\"></img></button><button><img src=\"/_admin/html/media/icons/doc_edit_icon16_nofunction.png\" width=\"16\" height=\"16\" class=\"nofunction\"></img></button>', \n val.id, val.name, tempStatus, \"\", \"\"]);\n }\n else if (tempStatus == 5) {\n tempStatus = \"deleted\"; \n items.push([\"\", val.id, val.name, tempStatus, \"\", \"\"]);\n }\n/* else {\n tempStatus = \"corrupted\"; \n items.push([\"\", \"<font color=red>\"+ val.id + \"</font>\", \"<font color=red>\"+ val.name + \"</font>\", \"<font color=red>\" + tempStatus + \"</font>\", \"\", \"\"]);\n }*/\n });\n $('#collectionsTableID').dataTable().fnAddData(items);\n showCursor();\n });\n}", "title": "" }, { "docid": "0ad35f91556bf42d8ef8189a310c6f43", "score": "0.5013854", "text": "function displayStatusReport() {\n //console.log(\"Week:\" + statusReport.team.week);\n //console.table(statusReport.hubs);\n //console.log(statusReport);\n }", "title": "" }, { "docid": "5ce52aab485a02e0b6ab000f2ede39e7", "score": "0.5012577", "text": "async function getStatus(transactionStatus){\r\n return request.get({\r\n url: transactionStatus,\r\n headers: {'Content-Type': 'application/json'},\r\n resolveWithFullResponse: true\r\n }).then(function(response){\r\n return response;\r\n }).catch(function(error){\r\n return error;\r\n });\r\n}", "title": "" }, { "docid": "0e4064a5df2664e82417834bb1f4aaf3", "score": "0.5007048", "text": "function showStatus(data) {\n var result = document.getElementById('result');\n\n if(data) {\n var status = parseHTML(data).querySelector('#Table3');\n result.appendChild(status);\n } else {\n result = document.getElementById('error');\n }\n\n // Show status and hide the form\n result.classList.remove('hidden');\n document.getElementById('running-status').classList.add('hidden');\n}", "title": "" }, { "docid": "2102ec69cde757c27812bb590d11ec2e", "score": "0.5003216", "text": "function getItems(siteUrl)\n {\n \n $.ajax({\n \n url: siteUrl,\n type: \"GET\",\n headers: {\n \"accept\": \"application/json;odata=verbose\",\n },\n success: function (data) {\n console.log(data.d.results); \n // bindDataTable(data.d.results);\n },\n error: function (error) {\n alert(JSON.stringify(error));\n }\n });\n\n }", "title": "" }, { "docid": "cfa426e02a13b0918fc7c66797356654", "score": "0.4999209", "text": "function getStats() {\r\n $.ajax({\r\n url: 'https://corona.lmao.ninja/v2/all',\r\n type: \"get\",\r\n data: {},\r\n success: function (response) {\r\n const dateUpdated = new Date(response.updated).toString();\r\n document.querySelector('#statsOverview').innerHTML = 'Global';\r\n document.querySelector('#confirmed').innerHTML = response.cases;\r\n document.querySelector('#recovered').innerHTML = response.recovered;\r\n document.querySelector('#deaths').innerHTML = response.deaths;\r\n document.querySelector('#todayReported').innerHTML = response.todayCases;\r\n document.querySelector('#todayDeaths').innerHTML = response.todayDeaths\r\n\r\n document.querySelector('#updatedAt').innerHTML = `Last Updated At: ${dateUpdated}`;\r\n },\r\n error: function (xhr) {\r\n alert('Oops!!! Something went terribly wrong. We have sent out a higly trained team of monkeys to handle this situation.')\r\n }\r\n });\r\n}", "title": "" }, { "docid": "0e00c2219b6780a190e6c5f9250ca4f0", "score": "0.49967748", "text": "function getUrlStatusImageElem(urlStatus) {\n\t\t// For Benign status no image is added\n\t\tif ((urlStatus == \"\") || (urlStatus.toUpperCase() == \"BENIGN\") || (urlStatus.toUpperCase() == \"UNKNOWN\")) \n\t\t\treturn \"\";\n\n\t\tvar statusImages = {\n\t\t\tMALICIOUS: {\n\t\t\t\timg: \"images/Malicious_Badge.svg\",\n\t\t\t},\n\t\t\tSUSPICIOUS: {\n\t\t\t\timg: \"images/Suspicious_Badge.svg\",\n\t\t\t}\n\t\t}\n\t\treturn '<img src=\"' + statusImages[urlStatus.toUpperCase()].img + '\" class=\"status\">';\n\t}", "title": "" }, { "docid": "38381e7d3f3571b2d4cfca51c026a928", "score": "0.49929693", "text": "function getStatus(res, mysql, context, complete){\n mysql.pool.query(\"SELECT status_id AS id, status AS name FROM life_status ORDER BY status\", function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n context.status = results;\n complete();\n });\n }", "title": "" }, { "docid": "af648b50df19e4bf0825c6f57889d1a3", "score": "0.49901894", "text": "function renderBoats(httpResult) {\n companies = httpResult.results;\n companyCount = httpResult.count;\n currentCompanyIndex = 0;\n\n switch(httpResult.status) {\n case STATUS_NOT_FOUND:\n buildBoat(lastSearchString); // Note: potential race condition, consider sending company as a prop\n break;\n\n case STATUS_SUCCESS:\n case STATUS_PARTIAL_UPDATE_REQUIRED:\n case STATUS_FULL_UPDATE_REQUIRED:\n killIsland();\n killBoats();\n killOcto();\n console.log(companies);\n\n $.each(companies, function(index, company) {\n // Render single item\n var renderFlag = company.gd_ceo && company.gd_ceo.image && company.gd_ceo.image.src;\n var boatContainerId = generateUniqueBoatId(index);\n var visible = (index === 0);\n // Todo: Depending on boat status we want to display either a full construction, or a boat and hammer\n // Status: floating|rising|falling, sailing|lifting|leaking, submerged|surfacing|sinking, sunk, unknown\n var boatSize = 'bucket';\n if (company.fc_aprox_employees) {\n if (company.fc_aprox_employees >= 100) {\n boatSize = 'canoe';\n }\n }\n displayBoat(boatSize, company.boat_status, boatContainerId, renderFlag, visible, index, false);\n });\n\n if (companyCount > 1) {\n // Todo: Arrows + more boats :P\n }\n\n analytics.track('Rendered boats', {\n companies: companies\n });\n break;\n default:\n searchError({status: 500});\n break;\n }\n}", "title": "" }, { "docid": "c983b07e6a93d573d71629896773dcd8", "score": "0.49843028", "text": "function get_assets()\n\t{\n\t\t$.ajax({\n\t\t\turl: roundwareServerUrl + '/api/2/assets/?media_type=audio&submitted=true&project_id=' + project_id,\n\t\t\tdataType: 'json',\n\t\t\ttype: 'GET',\n\t\t\tbeforeSend: function(xhr) {\n xhr.setRequestHeader('Authorization', roundwareAuthToken);\n },\n\t\t\tsuccess: function(data) {\n assets = data;\n\t\t\t\tmain_callback();\n\t\t\t},\n\t\t\terror: function(data) {\n\t\t\t\tconsole.error('could not retrieve assets');\n\t\t\t}\n\t\t});\n\t}", "title": "" }, { "docid": "0f583eff1aa100896d2ee00138682277", "score": "0.49453858", "text": "function addHtml(status, thisChannelUrl, stream) { \n $.getJSON(thisChannelUrl, function(item) {\n var name = item.display_name;\n var logoUrl = item.logo;\n var itemUrl = item.url;\n var html = \"<div class=\\\"list-item\\\"><img src=\\\"\" + logoUrl +\n \"\\\" class=\\\"streamer-img\\\"><h3 class=\\\"name\\\">\" +\n \"<a href=\\\"\" + itemUrl + \"\\\"target=\\\"_blank\\\">\" + name +\n \"</a></h3><h3 class=\\\"status\" + status + \"</h3></div>\";\n if(stream === \"online\"){\n $('#container-body').prepend(html);\n }\n else{\n $('#container-body').append(html);\n }\n });\n }", "title": "" }, { "docid": "c7f4ae6fcbd453a949f14e0469289605", "score": "0.4926298", "text": "function initStatusDivs() {\n var guid_list = getGuidListCookie();\n if (guid_list instanceof Array) {\n guid_list.forEach(function(entry) {\n addStatusDiv(entry);\n });\n\n $('#short-status-info-header').show();\n $('#'+guid_list[guid_list.length - 1]).show();\n }\n updateAllStatusInformation();\n}", "title": "" }, { "docid": "b361e537dda5d04b0ae0373f737355a6", "score": "0.49254587", "text": "function renderFromLs(){\n for (let i = 0; i < arrOfObj.length; i++) {\n let trEl = document.createElement('tr');\n\n let nameTd = document.createElement('td');\n nameTd.textContent = arrOfObj[i].name;\n let gradeTd = document.createElement('td');\n gradeTd.textContent = getRandomNum(0, 100);\n let courseTd = document.createElement('td');\n courseTd.textContent = arrOfObj[i].course;\n let statusTd = document.createElement('td');\n statusTd.textContent = status();\n\n trEl.appendChild(nameTd);\n trEl.appendChild(gradeTd);\n trEl.appendChild(courseTd);\n trEl.appendChild( statusTd);\n\n table.appendChild(trEl);\n }\n}", "title": "" }, { "docid": "45b037da6c47b806a33b6ca5f7bb479c", "score": "0.49243203", "text": "async do(headers = {}) {\n\t\tlet res = await this.c.get(\"/v2/assets/\" + this.index + \"/transactions\", this.query, headers);\n\t\treturn res.body;\n\t}", "title": "" }, { "docid": "20a1b47d3708be9adba42a8b9f7072ae", "score": "0.49240726", "text": "function dataStatus() {\n var status = [\n {\n id: \"code-pattern\",\n div: \"Pattern\",\n text: \"Pattern\"\n },\n {\n id: \"extras-Occurrences\",\n text: \"Occurrences\",\n var1: \"Occurrences\"\n },\n\n {\n id: \"status-advisory\",\n div: \"Status\",\n text: \"Advisory\",\n date: \"no\"\n },\n {\n id: \"status-fixed\",\n text: \"Fixed\",\n var1: \"fixed\"\n },\n {\n id: \"status-notfixed\",\n text: \"Not Fixed\",\n var1: \"failed_retesting\"\n },\n {\n id: \"status-new\",\n text: \"New\",\n var1: \"new\"\n },\n {\n id: \"status-not\",\n text: \"Not Retested\",\n var1: \"needs_retesting\"\n },\n {\n id: \"status-wip\",\n div: \"Work In Progress\",\n text: \"WIP\",\n date: \"no\"\n },\n {\n id: \"status-wipName\",\n text: \"WIP - Name\",\n date: \"name\"\n },\n {\n id: \"code-modIns\",\n div: \"Special\",\n text: \"Module/Instance\"\n },\n {\n id: \"special-typeDev\",\n text: \"Type: DEV\",\n var1: \"Type: DEV\",\n loc: \"1\"\n },\n {\n id: \"special-typeDes\",\n text: \"Type: DESIGN\",\n var1: \"Type: DESIGN\",\n loc: \"1\"\n },\n {\n id: \"status-wcag-a\",\n text: \"WCAG: A\"\n },\n {\n id: \"status-wcag-aa\",\n text: \"WCAG: AA\"\n },\n {\n id: \"status-wcag-aaa\",\n text: \"WCAG: AAA\"\n }\n ];\n return status;\n}", "title": "" }, { "docid": "950da133a9400935641b4364ca67f996", "score": "0.49219453", "text": "getTablesWithStatus(status) {\n return status === dbStatus.deleted ?\n this.comparisonSource.tableList.filter(x => x.status === status || !status) :\n this.comparisonTarget.tableList.filter(x => x.status === status || !status);\n }", "title": "" }, { "docid": "48a9cb75ecd957da75d38eabe2069234", "score": "0.4920227", "text": "function load21thCenRaceTable() {\n var url = getAPIBaseURL() + '/race/21';\n\n fetch(url, { method: 'get' })\n\n .then((response) => response.json())\n\n .then(function(list_of_21_races) {\n var tableBody = '';\n // Add table title\n tableBody += '<tr>';\n tableBody += '<th>' + 'Race Name' + '</th>';\n tableBody += '<th>' + 'Date' + '</th>';\n tableBody += '<th>' + 'Country' + '</th>';\n tableBody += '<th>' + 'Location' + '</th>';\n tableBody += '<th>' + 'Circuit Name' + '</th>';\n tableBody += '</tr>';\n for (var k = 0; k < list_of_21_races.length; k++) {\n var race = list_of_21_races[k];\n tableBody += '<tr>';\n // Add table contents\n tableBody += '<td>' + '<a href=' + race['URL'] + '>' + race['Name'] + '</a>' + '</td>';\n tableBody += '<td>' + race['Date'] + '</td>';\n tableBody += '<td>' + race['Country'] + '</td>';\n tableBody += '<td>' + race['Location'] + '</td>';\n tableBody += '<td>' + race['Circuit'] + '</td>';\n tableBody += '</tr>';\n }\n var race21ListElement = document.getElementById('21centuryRace');\n if (race21ListElement) {\n race21ListElement.innerHTML = tableBody;\n }\n })\n\n .catch(function(error) {\n console.log(error);\n });\n}", "title": "" }, { "docid": "91b3883c4032a3880f602e99093f3130", "score": "0.49200442", "text": "function getCompaniesList() {\n $.ajax({\n url: companyApiEndpoint,\n\n beforeSend: function() {\n $('#companies-table').find('tbody').append(loadingDataRow.join(''));\n },\n\n complete: function() {\n $('#loading').remove();\n },\n success: function(companyAPI) {\n\n $('#companies-table').find('tbody').html('');\n\n $.each(companyAPI, function(index, company) {\n $.ajax({\n url: userApi+company.user_id,\n\n beforeSend: function() {\n },\n\n success: function(user) {\n $('#companies-table').find('tbody').append([\n '<tr>',\n '<td>',company.name,'</td>',\n '<td>',company.bs,'</td>',\n '<td>',company.catch_phrase,'</td>',\n '<td>',user.name,'</td>',\n '</tr>'\n ].join(''));\n },\n error: function(error) {\n }\n });\n });\n },\n error: function(error) {\n }\n });\n }", "title": "" }, { "docid": "3a7bc6dc0f43aebbdd9cd57d18e3d1e3", "score": "0.4917108", "text": "function _showSystemStatuses() {\n let data = [];\n let index;\n\n return _dbPromise.then(function(db) {\n if (!db || showingPosts) {\n return;\n }\n\n index = db.transaction(\"statuses\").objectStore(\"statuses\").index(\"date\");\n\n return index.openCursor(null, \"prev\").then(function getStatus(cursor) {\n if (!cursor) return;\n\n data.push(cursor.value);\n return cursor.continue().then(getStatus);\n }).then(function () {\n if (data.length > 0) {\n _addStatuses(data);\n }\n });\n });\n }", "title": "" }, { "docid": "6ad47a3d048486291be2f4932df14a4e", "score": "0.491039", "text": "function fetchData(url) {\n return fetch(url)\n .then(checkStatus)\n .then(response => response.json())\n .catch((response) => {\n const pageHeader = document.getElementsByClassName('header-text-container');\n pageHeader[0].children[0].textContent = response;\n pageHeader[0].children[0].style.color = 'red';\n\n })\n}", "title": "" }, { "docid": "b099f28c85bd64477e14d1746ded290d", "score": "0.49101886", "text": "function get_tenants(){\n Sijax.request('tenant_list');\n $('#tenant_list').html('<img src=\"/static/images/loading.gif\" style=\"height:20px\" />');\n}", "title": "" }, { "docid": "9c0240a6335838748d091030614e5066", "score": "0.49095553", "text": "function getStats() {\n var user = $(\"#username\").val();\n var repository = $(\"#repository\").val();\n\n var url = apiRoot + \"repos/\" + user + \"/\" + repository + \"/releases\";\n $.getJSON(url, showStats).fail(showStats);\n}", "title": "" }, { "docid": "773a2e4205d9f12a0013c5d9a0df59f2", "score": "0.49090752", "text": "function loadAssetsFromServer() {\n console.log(\"LOAD ASSETS FROM SERVER\");\n\n // take off loading gif\n document.getElementsByClassName('loading_gif')[0].style.display = 'none';\n\n for (let i = 0; i < imageArray.length; i += 1) {\n const imageSrc = imageArray[i].dataset.src;\n setServerImage(imageSrc);\n }\n // report time it took to load assets from server\n document.getElementById('time_total_from_server').innerHTML = `Time it took to load from server: ${new Date() - browserOpenTime} ms `;\n}", "title": "" }, { "docid": "88667de921ac90c56fa0dcc187f74d93", "score": "0.4908239", "text": "function getItemAssets(item){\n callAssetAPI(item.data[0][\"nasa_id\"]);\n}", "title": "" }, { "docid": "80636b00db10934d10e50d5644eb70c5", "score": "0.4906155", "text": "async function getListOfAssets(type, bbox, pageSize = 1000) {\n if (bbox == undefined) bbox = { north: 90, west: -180, south: -90, east: 180 }\n let headers = { authorization: 'Bearer ' + token, 'predix-zone-id': Object.values(tenant.zones)[0] }\n let query = '/metadata/assets/search?bbox=' + bbox.north + ':' + bbox.west + ',' + bbox.south + ':' + bbox.east + '&size=' + pageSize\n\n if (Object.keys(tenant.zones).includes(type)) query += '&q=eventTypes:' + type\n else if (['IMAGE', 'VIDEO'].includes(type)) query += '&q=mediaType:' + type\n else if (['CAMERA', 'ENV_SENSOR', 'NODE', 'EM_SENSOR'].includes(type)) query += '&q=assetType:' + type\n\n let i = 0\n let maxPages = 2\n let result = []\n do {\n let data = await fetchJSON(tenant.service + query + '&page=' + i, { headers })\n if ((data.content.length > 0) && (data.content !== undefined)) {\n result.push(data.content)\n maxPages = data.totalPages\n }\n i++\n } while (i < maxPages);\n return result\n}", "title": "" }, { "docid": "599db654a94de09a690a654d3f0429d8", "score": "0.49032235", "text": "function load20thCenRaceTable() {\n var url = getAPIBaseURL() + '/race/20';\n\n fetch(url, { method: 'get' })\n\n .then((response) => response.json())\n\n .then(function(list_of_20_races) {\n var tableBody = '';\n // Add table title\n tableBody += '<tr>';\n tableBody += '<th>' + 'Race Name' + '</th>';\n tableBody += '<th>' + 'Date' + '</th>';\n tableBody += '<th>' + 'Country' + '</th>';\n tableBody += '<th>' + 'Location' + '</th>';\n tableBody += '<th>' + 'Circuit Name' + '</th>';\n tableBody += '</tr>';\n for (var k = 0; k < list_of_20_races.length; k++) {\n var race = list_of_20_races[k];\n // Add table contents\n tableBody += '<tr>';\n tableBody += '<td>' + '<a href=' + race['URL'] + '>' + race['Name'] + '</a>' + '</td>';\n tableBody += '<td>' + race['Date'] + '</td>';\n tableBody += '<td>' + race['Country'] + '</td>';\n tableBody += '<td>' + race['Location'] + '</td>';\n tableBody += '<td>' + race['Circuit'] + '</td>';\n tableBody += '</tr>';\n }\n var race20ListElement = document.getElementById('20centuryRace');\n if (race20ListElement) {\n race20ListElement.innerHTML = tableBody;\n }\n })\n\n .catch(function(error) {\n console.log(error);\n });\n}", "title": "" }, { "docid": "5b780a12b1a45102464458062bd8d143", "score": "0.4899204", "text": "async function fetchTableById() {\n\t\tconst res = await fetch(`/api/${exactTable}/2`);\n\n\t\tif (!res.ok || res.status !== 200) {\n\t\t\tconsole.log(`Data fetch error: ${res.status}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log(res);\n\n\t\tconst data = await res.json();\n\n\t\tdocument.getElementById(\"root\");\n\t\t/* \n\t\tfetch table by page\n\n\t\t*/\n\t\tconsole.log(\"Name of a Album #2: \" + data.Title);\n\t}", "title": "" }, { "docid": "524c0c7bc7cecc9ae6b37042fd250436", "score": "0.48967135", "text": "function handleGet(data, status){\n\tif (data.success) {\n\t\trows = JSON.parse(JSON.stringify(data.data));\n\t\tupdateTable(rows);\n\t}\n}", "title": "" }, { "docid": "1236c1c4164e8da937d19a58b6793ff5", "score": "0.4895601", "text": "function adjustActivityStatus(){\n for(var streamer in streams){\n var id = \"#\" + streams[streamer] + \" .status\";\n $(id).html(getActivityStatus(entries[streams[streamer]]));\n }\n }", "title": "" }, { "docid": "bcad3fcdacdccb39e34927012fa2be56", "score": "0.48862404", "text": "async function getPersonTypesByStatus(req, res) {\n let status = req.params.status;\n await PersonType.findAll({ where: { status } })\n .then(types => {\n if (types.length === 0) {\n return res.status(200).json({\n ok: false,\n message: `No hay tipos de persona registrados con el status ${status}`,\n });\n } else {\n res.status(200).json({\n ok: true,\n message: 'correcto',\n types\n });\n }\n })\n .catch(err => {\n console.log(err);\n res.status(500).json({\n ok: false,\n message: 'Ha ocurrido un error',\n error: err.message\n });\n });\n}", "title": "" }, { "docid": "a427e4ddffd59d5f6aa1a47444363c8f", "score": "0.48762518", "text": "function getStandings(){\n if (\"caches\" in window){\n caches.match(ENDPOINT_STANDINGS).then(response => {\n if (response){\n response.json().then(data => {\n showStandings(data);\n });\n }\n });\n }\n\n showPreloader();\n fetchApi(ENDPOINT_STANDINGS)\n .then(status)\n .then(json)\n .then(data => {\n showStandings(data);\n })\n .catch(error);\n}", "title": "" }, { "docid": "9b985ba06649537e41e920daf355827e", "score": "0.48677853", "text": "function getNodeStatus(id){\n\t// asking for files directly is good for caching\n\tvar jsonFilePath = jsonDirectory + \"PI\" + id + \".json\";\n // get file directly\n $.getJSON(jsonFilePath, function(jsonData) {\n\t\t\t// update content\n\t\t\t$(\"#\" + id).html(buildInfoTable(jsonData));\n });\n}", "title": "" }, { "docid": "dcced7bb88d949aaa201eb998f7a25ca", "score": "0.4867517", "text": "function loadAssetsInfo() {\n //Loading spalsh screen\n mainWindow.loadFile(path.join(__dirname, 'public/loading.html'))\n\n //create webContants\n let wc = mainWindow.webContents\n\n //suessfull loding page afer dom created\n wc.once('did-finish-load' , () => {\n mainWindow.loadURL(appConfig['assetsInfoUrl'])\n })\n\n //if not loading page redirect error page\n wc.on('did-fail-load', (error, code)=> {\n //console.log(code)\n mainWindow.loadFile(path.join(__dirname, 'public/offline.html'))\n })\n}", "title": "" }, { "docid": "f176a1c84036643edd99063360dae634", "score": "0.48661056", "text": "async function getParticipantTypesByStatus(req, res) {\n let status = req.params.status;\n await ParticipantType.findAll({ where: { status } })\n .then(types => {\n if (types.length === 0) {\n return res.status(200).json({\n ok: false,\n message: `No hay tipos de participante registrados con el estatus ${status}`,\n });\n } else {\n res.status(200).json({\n ok: true,\n message: 'correcto',\n types\n });\n }\n })\n .catch(err => {\n console.log(err);\n res.status(500).json({\n ok: false,\n message: 'Ha ocurrido un error',\n error: err.message\n });\n });\n}", "title": "" }, { "docid": "1e0b08c5647c0ed743f9f4b231c0d378", "score": "0.48641062", "text": "function status() {\n F.functions.log(\"\\n[/api/status/] status\");\n let self = this;\n let query = 'SELECT @rid FROM state LET $max = ( SELECT max(sortOrder) FROM state WHERE approved = true ) WHERE sortOrder = $max.max[0];';\n F.functions.query(query)\n .then(function (response) {\n let status = '#' + response[0].rid.cluster + ':' + response[0].rid.position;\n let params = {order: self.body.id, score: self.body.score, comment: self.body.comment, status: status};\n F.functions.json_response(self, 200, params);\n })\n .catch(function (error) {\n console.warn(\"[Error] \", error);\n F.functions.sendCrash(error);\n F.functions.json_response(self, 400, error);\n });\n}", "title": "" }, { "docid": "cd14da43f5843b3806bb746fe6402a4d", "score": "0.48638204", "text": "function workflowstatus() {\n apiService.get('/api/statusSistema/workflowstatus', null,\n workflowstatusLoadCompleted,\n workflowstatusLoadFailed);\n }", "title": "" }, { "docid": "023de9aaf917415a99e6bcd7b24d5b07", "score": "0.4861115", "text": "function populateSiteStatusDetails(obj, table, rowId, type) {\r\n\tfor (var i = 0; i < obj.length; i++) {\r\n\t\tif (i > 0) {\r\n\t\t\taddRow(table, rowId);\r\n\t\t}\r\n\r\n\t\tvar keys = Object.keys(obj[i]);\r\n\r\n\t\tfor (var j = 0; j < keys.length; j++) {\r\n\t\t\tvar el = keys[j]+\"[\"+i+\"]\";\r\n\t\t\tvar at = obj[i][keys[j]];\r\n\r\n\t\t\tif (type == \"details\") {\r\n\t\t\t\tdocument.getElementById(el).innerHTML = at;\r\n\t\t\t}\r\n\t\t\telse if (type == \"editor\") {\r\n\t\t\t\tdocument.getElementById(el).value = at;\r\n\t\t\t}\r\n\r\n\t\t\tif (el.indexOf(\"allocation\") >= 0) {\r\n\t\t\t\tcolorize(document.getElementById(el), at);\r\n\t\t\t}\r\n\r\n\t\t\tif (el.indexOf(\"cap\") >= 0) {\r\n\t\t\t\tcolorize(document.getElementById(el), at);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "9616af0fb89b7595136a3a73200bf9be", "score": "0.48582333", "text": "function getresultstatus(list,response){\n for (count=0;count<list.length;count++){\n https.get(`https://terriblytinytales.com/testapi?rollnumber=${list[count]}`,function(res){\n let data='';\n res.on('data',(chunk)=>{\n data+=chunk; \n })\n res.on('end',()=>{\n table.push(data)\n if(table.length==list.length){\n response.send({table:table,list:list}) \n table=[];\n } \n }) \n }).on('error',(error)=>{\n console.log(error)\n response.send({error:error}) \n }) \n }\n}", "title": "" }, { "docid": "6c58eb9ebc6ccb962aed794fdc9ee4f9", "score": "0.48561522", "text": "function loadListView(dataRows) {\r\n\r\n var strRows = \"\";\r\n \r\n $.each(dataRows, function(i, item) {\r\n var iconSrc;\r\n strRows += \"<tr id='swimrow\" + i + \"'>\";\r\n strRows += \"<td class='col-md-6'>\";\r\n strRows += \"<span class='facRow'><a href='#' onclick='showLinkOnMap(\"+ item.aid + \",\" + item.lat + \",\" + item.lng + \")'>\" + item.name + \"</a></span>\";\r\n \r\n $.each(item.services, function(j, service) {\r\n iconSrc = statusIcons[service.status].icon;\r\n strRows += \"<span class='srvRow'><img class='lstIcon' src='\" + iconSrc + \"'>\" + service.name + \"</span>\";\r\n //strRows += \" +\r\n });\r\n strRows += \"</td>\" ;\r\n //if (item.status && statusIcons[item.status]) {\r\n //iconSrc = statusIcons[item.status].icon;\r\n //strRows += \"<td style='text-align:center' class='col-md-1'><img src='\" + iconSrc + \"'></td>\";\r\n strRows += \"<td class='col-md-3'>\" + item.address + \"</td>\" ;\r\n strRows += \"<td class='col-md-3'><span class='srvRow'>&nbsp;</span>\";\r\n\t\t $.each(item.services, function(j, service) { \r\n strRows += \"<span class='srvRow'>\" + service.access + \"</span>\";\r\n });\r\n\t\tstrRows += \"</td>\" ;\r\n strRows += \"</tr>\";\r\n\r\n //} else {\r\n // console.log(item.id, item.status)\r\n // }\r\n });\r\n \r\n strRows = (strRows ===\"\") ? \"<tr><td class='noData' colspan='4'>No Facilities found. Please check search options and try again</td></tr>\" : strRows;\r\n $(\"#listingTable tbody\").html(strRows).trigger('update');\r\n var $table = $(\"#listingTable\").tablesorter(\r\n {theme: 'blue', \r\n widthFixed : false, \r\n widgets: [\"filter\"], \r\n widgetOptions : { filter_columnFilters: true, \r\n filter_cssFilter : '', \r\n filter_childRows : false, \r\n filter_ignoreCase : true, \r\n filter_reset : '.reset', \r\n filter_searchDelay : 300, \r\n filter_startsWith : false, \r\n filter_hideFilters : false } \r\n });\r\n\r\n}", "title": "" }, { "docid": "abb281adf24fcc255926faa440830577", "score": "0.48507616", "text": "function updateAddAssetTable(table, value) {\n var data = [];\n data[0] = '<input type=\"checkbox\" />';\n if(!HB2.admin.isEmpty(value.splash)) {\n data[1] = '<img src=\"' + value.splash + '\" alt=\"splash\" width=\"50px\" height=\"40px\" />';\n } else {\n console.info('ERROR en AddAssetTable [1]');\n data[1] = '<span>Please Reload</span>';\n // LANZAR POP UP DE ERROR. AUTOCARGAR LA PAGINA.\n }\n if(!HB2.admin.isEmpty(value.asset)) {\n data[2] = '<span id=\"' + value.id + '\">' + value.name + '</span>';\n } else {\n console.info('ERROR en AddAssetTable [2]');\n data[2] = '<span>Please Reload</span>';\n }\n\n table.fnAddData(data);\n table[0].style.width = '100%';\n return table;\n }", "title": "" }, { "docid": "b1fc1110f8dbc35e5962811c3006e2c9", "score": "0.48503438", "text": "function loadAsset(id) {\n flagAssets = true;\n var criteria = {};\n var fields = {};\n criteria.playlist = id;\n fields.splash = 1;\n fields.name = 1;\n var sort = 1;\n console.log('Get Playlists: ');\n $.ajax({\n url : '/playlist/assets',\n type : 'GET',\n async : false,\n data : 'id=' + id + '&criteria=' + $.toJSON(criteria) + '&fields=' + $.toJSON(fields) + '&sort=' + sort,\n dataType : 'json',\n success : function(data, textStatus, jqXHR) {\n console.info('data: ', data);\n setJSONAssets(data.result);\n },\n error : function(jqXHR, textStatus, errorThrown) {\n console.info(textStatus);\n console.info(errorThrown);\n }\n });\n }", "title": "" }, { "docid": "ce2b8e739dda54b29e4f4e863e9d4559", "score": "0.4847487", "text": "function findAll(status) {\n return async (req, res, next) => {\n try {\n //checks access rights on rented movies list\n if (status === 'rented') {\n errors.workerAccessOnly(req.worker);\n }\n\n //loads movies or sends a error if not found\n const { title } = req.query;\n const movies = await gets.movies(status, title);\n\n //sends result\n res.send(movies);\n } catch (err) {\n next(err);\n }\n };\n}", "title": "" }, { "docid": "5198dbf42fdb9e8b864aa65af43ffdd7", "score": "0.4847067", "text": "function refreshStatus()\n{\n xhrGet(\"api/jax-rs/refreshStatus\", function(responseText){\n\tvar statusDate = new Date();\n\tvar lastStatusLine = getLastStatusLine(responseText);\n\tdocument.getElementById(\"lastStatusLine\").innerHTML = lastStatusLine;\n\ttopTens();\n\tdocument.getElementById(\"FullAppStat\").innerHTML = \"<h2>Full Application Status - \" + statusDate + \"</h2>\";\n\tvar outstat = statusBuilder(responseText);\n document.getElementById(\"id00\").innerHTML = outstat;\n }, function(err){\n\t console.log(err);\n });\n}", "title": "" }, { "docid": "685cd526194686dac3ce03d85d6aa44b", "score": "0.4845282", "text": "function showLoadedStatus($home){\n hideStatuses($home);\n }", "title": "" }, { "docid": "9b84bf8f42534c9f634d631245d3cf69", "score": "0.4837576", "text": "function getSectionsData(url, container, favButton, favFunction, type) {\n fetch(url)\n .then((response) => response.json())\n .then((content) => {\n renderAllGifos(content, container, favButton, favFunction, type);\n })\n .catch((error) => console.log(error));\n}", "title": "" }, { "docid": "749dfd5b5c0c84cfb591448f284a4f4a", "score": "0.48367026", "text": "function loadStatusPedido() {\n\n var config = {\n params: {\n workflowStatusId: 12\n }\n };\n apiService.get('/api/statusSistema/statusPorWorkflow', config,\n loadStatusPedidoSucesso,\n loadStatusPedidoFalha);\n }", "title": "" }, { "docid": "c736c3c99b58d58aaa3566e23cb22b27", "score": "0.48231587", "text": "_load() {\n\n if (this._loading === undefined) {\n this._loading = false;\n }\n if (this._loading) return;\n this._loading = true;\n\n this._table().children('caption').addClass('updating');\n\n Fwk.web_service_GET(\n \"/replication/qserv/worker/status\",\n {timeout_sec: 2, version: Common.RestAPIVersion},\n (data) => {\n this._display(data.chunks, data.schedulers_to_chunks, data.status);\n Fwk.setLastUpdate(this._table().children('caption'));\n this._table().children('caption').removeClass('updating');\n this._loading = false;\n },\n (msg) => {\n console.log('request failed', this.fwk_app_name, msg);\n this._table().children('caption').html('<span style=\"color:maroon\">No Response</span>');\n this._table().children('caption').removeClass('updating');\n this._loading = false;\n }\n );\n }", "title": "" }, { "docid": "942edd4691367f43e816f05176aa942d", "score": "0.4822601", "text": "getStatusInfo() {\n let obj = this;\n let url = config.statusInfoUrl;\n return fetch(url).then((data) => {\n return data;\n });\n }", "title": "" }, { "docid": "f0fee6b61ac6db512c3ad7d8c340c569", "score": "0.48214224", "text": "function renderStats(stats) {\n\t//hide the loading bar\n\t$('.js-loading').addClass('hidden');\n\n\t//show the table\n\t$('.table').removeClass('hidden');\n\n\t//go through all the td elements in the table and if they have a data=stats and it exists in the stats\n\t//array, use this as the content\n\t$('table td').each(function( index ) {\n\t\tvar statKey = $(this).data('stats');\n\t\tvar stat = stats[statKey];\n\n\t\tif (stat) {\n\t\t\t//if the index has _gb in concat on the hr ending\n\t\t\tif (statKey.indexOf(\"_gb\") !== -1) {\n\t\t\t\tstat = stats[statKey] + ' GB';\n\t\t\t}\n\t\t\t$(this).text(stat);\t\t\n\t\t}\n\t});\n}", "title": "" }, { "docid": "b4a98db65fe123c2b64648d54762172c", "score": "0.48187837", "text": "function getPropostasUniversitario(id, status) {\n $.ajax({\n url: link + \"propostas/universitario/\" + id + \"?status=\" + status, type: \"GET\", success: function (resp) {\n retornaPropostasUniversitario(resp)\n }, statusCode: {\n 404: function () {\n nenhumaProsposta(status)\n }\n }, contentType: \"application/json\"\n });\n\n}", "title": "" }, { "docid": "feaf37471abc216b4376cae8fea278cc", "score": "0.4814854", "text": "function getSiteStatusReports() {\r\n\tvar arr = [];\r\n\t\r\n\tfor (var i = 0; i < _WSOCS.length; i++) {\r\n\t\tvar obj = buildSiteObjectFromMessage(document.getElementById(_WSOCS[i].site+\"-site-status-text\").value);\r\n\t\tarr.push(obj);\r\n\t}\r\n\t\r\n\treturn arr;\r\n}", "title": "" }, { "docid": "7f3b6ba495e2ad52cbc76f2f2c2f1d68", "score": "0.4811712", "text": "renderStatuses() {\n return this.state.statuses.map((status) => {\n return (\n <Status\n content={ status.content }\n image={ status.image }\n user={ status.user }\n key={ status.id }\n receiver={ status.receiver }\n userData={ status.userData }\n receiverData={ status.receiverData }\n commentsCount={ status.commentsCount }\n createdAt={ status.createdAt }\n likesCount={ status.likesCount }\n type={ status.type }\n isNew={ status.isNew ? status.isNew : false }\n id={ status.id }\n />\n );\n });\n }", "title": "" }, { "docid": "d8a7b0b0d50b8f9d5748e1dcb4705943", "score": "0.48071754", "text": "function getStatusInfo()\n{\n log.debug('Retrieving import status information...');\n\n $.getJSON(statusURI, function(data)\n {\n try\n {\n previousData = currentData;\n currentData = data;\n }\n catch (e)\n {\n log.error('Exception while retrieving status information: ' + e);\n }\n\n if (currentData != null)\n {\n document.getElementById(\"currentStatus\").textContent = currentData.processingState;\n document.getElementById(\"currentStatus\").style.color = stateToColour(currentData.processingState);\n \n // If we're idle, stop the world\n if (currentData.inProgress === false)\n {\n log.debug('Import complete, shutting down UI.');\n\n // Kill all the spinners, charts and timers\n favicon.stopAnimate();\n favicon.change(webAppContext + \"/images/bulkimport/logo.png\");\n\n if (nodesPerSecondChart != null) nodesPerSecondChart.stop();\n if (nodesPerSecondChartTimer != null) { clearInterval(nodesPerSecondChartTimer); nodesPerSecondChartTimer = null; }\n if (bytesPerSecondChart != null) bytesPerSecondChart.stop();\n if (bytesPerSecondChartTimer != null) { clearInterval(bytesPerSecondChartTimer); bytesPerSecondChartTimer = null; }\n if (importStatusTimer != null) { clearInterval(importStatusTimer); importStatusTimer = null; }\n if (refreshTextTimer != null) { clearInterval(refreshTextTimer); refreshTextTimer = null; }\n\n // Update the text one last time\n refreshTextElements(currentData);\n \n // Update the status\n document.getElementById(\"estimatedDuration\").textContent = \"\";\n document.getElementById(\"detailsCurrentlyImporting\").textContent = \"\";\n\n // Hide buttons and show initiate another import link\n hideElement(document.getElementById(\"pauseImportButton\"));\n hideElement(document.getElementById(\"resumeImportButton\"));\n hideElement(document.getElementById(\"stopImportButton\"));\n showElement(document.getElementById(\"initiateAnotherImport\", false));\n }\n else // We're not idle, so update stuff\n {\n // Check if we've just been paused or resumed\n if (currentData.paused != previousData.paused)\n {\n if (currentData.paused)\n {\n favicon.stopAnimate();\n nodesPerSecondChart.stop();\n bytesPerSecondChart.stop();\n }\n else\n {\n startSpinner();\n nodesPerSecondChart.start();\n bytesPerSecondChart.start();\n }\n }\n\n if (currentData.estimatedRemainingDuration !== undefined)\n {\n document.getElementById(\"estimatedDuration\").textContent = \", estimated completion in \" + currentData.estimatedRemainingDuration + \".\";\n }\n else\n {\n document.getElementById(\"estimatedDuration\").textContent = \", estimated completion in <unknown>.\";\n }\n }\n }\n else\n {\n log.warn('No data received from server.');\n }\n });\n}", "title": "" }, { "docid": "b4e82d54e90f35061af0fa8a80238917", "score": "0.48056373", "text": "function bucketGetAll(request, response) {\n Bucket.find({})\n .sort(\"bOrder\")\n .then(bucketData => {\n response.render(\"bucket-index\", {\n bucket: bucketData\n });\n })\n .catch(err => {\n console.log(err);\n });\n}", "title": "" } ]
cf43ec718445d32dd681ff1ccc136fd7
gives obj a getset for its unique name based on arr
[ { "docid": "de935a6c04081737d754e753df49fda2", "score": "0.0", "text": "function bindName(obj = null, arr = [], callback = noop) {\n\tobj._name = \"\"\n\tobj.name_changes = newPubSub()\n\tif (!arr.names) {\n\t\tarr.names = new Set()\n\t\tproject.onclear.subscribe(() => {\n\t\t\tarr.names.clear()\n\t\t})\n\t}\n\tobj.ondelete.subscribe(() => {\n\t\tarr.names.delete(obj._name)\n\t})\n\n\tobjgetset(obj, \"name\", () => {\n\t\treturn obj._name\n\t}, (v) => {\n\t\tif (!v || v === obj._name)\n\t\t\treturn\n\t\tlet old_name = obj._name\n\t\tarr.names.delete(old_name)\n\n\t\tobj._name = getUniqueName(arr.names, v)\n\t\tarr.names.add(obj._name)\n\t\tobj.name_changes.publish(obj._name)\n\t\tcallback(obj._name)\n\n\t\tif (!old_name)\n\t\t\treturn\n\n\t\tws.expect(obj._name) // send to core\n\t\tws.get(\"rename\" + obj.type, old_name, obj._name).then((_name) => {\n\t\t\tif (obj._name !== _name)\n\t\t\t\tconsole.error(\"obj.name\", name, \"!==\", _name)\n\t\t})\n\t})\n}", "title": "" } ]
[ { "docid": "8c2926798170601ef3a4630fb53d6903", "score": "0.6301532", "text": "function SetOf(arr) {\n var obj = {};\n for (var i = 0; i < arr.length; i++) {\n obj[arr[i]] = arr[i];\n }\n return obj;\n}", "title": "" }, { "docid": "7b4b36b33ae4f4dce36d2ce035df9b97", "score": "0.61749554", "text": "function set(arr) {\n\treturn [...new Set(arr)];\n}", "title": "" }, { "docid": "7b4b36b33ae4f4dce36d2ce035df9b97", "score": "0.61749554", "text": "function set(arr) {\n\treturn [...new Set(arr)];\n}", "title": "" }, { "docid": "0a86407a7fbe72ef11372d45c8ee66d9", "score": "0.6032731", "text": "function filterSet(arr) {\n\t if (arr.length) {\n\t var referenceObject = arr[0],\n\t propertyNames = getPropertyNames(referenceObject);\n\t propertyNames.forEach(function(prop) {\n\t if (typeof referenceObject[prop] == 'function') defineMethod(arr, prop, arguments);\n\t else defineAttribute(arr, prop);\n\t });\n\t }\n\t return renderImmutable(arr);\n\t}", "title": "" }, { "docid": "b87789f6a00fce3d2ecadd9d4a6a11af", "score": "0.5992921", "text": "function lookup(arr) {\n var obj = {}\n for (var i = 0, l = arr.length; i < l; i++) {\n obj[''+arr[i]] = true\n }\n return obj\n}", "title": "" }, { "docid": "b87789f6a00fce3d2ecadd9d4a6a11af", "score": "0.5992921", "text": "function lookup(arr) {\n var obj = {}\n for (var i = 0, l = arr.length; i < l; i++) {\n obj[''+arr[i]] = true\n }\n return obj\n}", "title": "" }, { "docid": "94d8c7c0015402c4f1174dd75a1aaed9", "score": "0.5955739", "text": "function _set(obj) {\n return exports.PREFIX.set + ':' + _array.call(this, Array.from(obj));\n}", "title": "" }, { "docid": "016430278ca476d03becc4e041c8da7c", "score": "0.5754848", "text": "function pick(obj, arr){\n newObj = {};\n for (let i=0; i<arr.length; i++){\n if (arr[i] in obj) newObj[arr[i]] = obj[arr[i]];\n }\n return newObj;\n}", "title": "" }, { "docid": "2dd1f0d61f8d1b0104e7afc1527d147a", "score": "0.57365227", "text": "function indexBy(array,propName){var result={};forEach(array,function(item){result[item[propName]] = item;});return result;} // extracted from underscore.js", "title": "" }, { "docid": "01ae8b2d19a1be132e6867e9e9abcc35", "score": "0.57091606", "text": "array(){\n let arr = [];\n for (let key in this.set){\n arr.push(key);\n }\n return arr;\n }", "title": "" }, { "docid": "8597c76ab178a2822e2d6f475152fbea", "score": "0.5685643", "text": "function duplicados(arr, prop) {\n var novoArray = [];\n var lookup = {};\n\n for (var i in arr) {\n lookup[arr[i][prop]] = arr[i];\n }\n for (i in lookup) {\n novoArray.push(lookup[i]);\n }\n return novoArray;\n}", "title": "" }, { "docid": "53f9cc2747931a464074c18c212001ec", "score": "0.56706166", "text": "function addToSet(set,array){\nif(setPrototypeOf){\n// Make 'in' and truthy checks like Boolean(set.constructor)\n// independent of any properties defined on Object.prototype.\n// Prevent prototype setters from intercepting set as a this value.\nsetPrototypeOf(set,null);\n}\n\nvar l=array.length;\nwhile(l--){\nvar element=array[l];\nif(typeof element==='string'){\nvar lcElement=stringToLowerCase(element);\nif(lcElement!==element){\n// Config presets (e.g. tags.js, attrs.js) are immutable.\nif(!isFrozen(array)){\narray[l]=lcElement;\n}\n\nelement=lcElement;\n}\n}\n\nset[element]=true;\n}\n\nreturn set;\n}", "title": "" }, { "docid": "fbf5726fd65737a5b704a44bd35c367c", "score": "0.56604284", "text": "function pick(obj, arr){\n var newObj = {};\n for(var i = 0; i < arr.length; i++){\n if (obj.hasOwnProperty(arr[i])) {\n newObj[arr[i]] = obj[arr[i]]\n }\n }\n return newObj;\n}", "title": "" }, { "docid": "74158e7b243d106eebb934d8a2b6315c", "score": "0.5651114", "text": "function select(obj, arr){\n var x = {}\n for(var key in obj) {\n for (var i = 0; i < arr.length; i++) {\n if(key === arr[i])\n x[key] = obj[key]\n } \n } \n return x;\n }", "title": "" }, { "docid": "595b3f40691c1c2d11d9b1540c3bc53b", "score": "0.55734205", "text": "function OwnerID(){}// http://jsperf.com/copy-array-inline", "title": "" }, { "docid": "595b3f40691c1c2d11d9b1540c3bc53b", "score": "0.55734205", "text": "function OwnerID(){}// http://jsperf.com/copy-array-inline", "title": "" }, { "docid": "595b3f40691c1c2d11d9b1540c3bc53b", "score": "0.55734205", "text": "function OwnerID(){}// http://jsperf.com/copy-array-inline", "title": "" }, { "docid": "595b3f40691c1c2d11d9b1540c3bc53b", "score": "0.55734205", "text": "function OwnerID(){}// http://jsperf.com/copy-array-inline", "title": "" }, { "docid": "79edfed3bd14caa3c2d0b2a60b603340", "score": "0.5554049", "text": "function OwnerID() {} // http://jsperf.com/copy-array-inline", "title": "" }, { "docid": "97ac7cdc182b14e6e2a736596bad3dd8", "score": "0.5530973", "text": "function findUniqueValue(obj, name, val) {\n let idTest = name + val;\n let valTest = name;\n let unique = []\n obj.forEach((d) => {\n let findItem = unique.find(x => x[valTest] === d[valTest]);\n if (!findItem)\n unique.push({ [name]: d[name], [idTest]: d[idTest] });\n });\n\n return unique;\n}", "title": "" }, { "docid": "38e44b0f4f289e2b20adc0c1953207fe", "score": "0.549501", "text": "_getObjectByName(array, name) {\n return array.filter((x) => x.name === name)[0];\n }", "title": "" }, { "docid": "2f2f99185d00aecc4baa7142b79cd4a4", "score": "0.5469634", "text": "[createFunctionName('set', collection, false)](object) {\n return setObjectToArray(object, self[collection], findField)\n }", "title": "" }, { "docid": "fc887d5469da07ff4fc53141a60270dc", "score": "0.54677635", "text": "function addToSet(set, array) {\r\n if (setPrototypeOf) {\r\n // Make 'in' and truthy checks like Boolean(set.constructor)\r\n // independent of any properties defined on Object.prototype.\r\n // Prevent prototype setters from intercepting set as a this value.\r\n setPrototypeOf(set, null);\r\n }\r\n\r\n var l = array.length;\r\n while (l--) {\r\n var element = array[l];\r\n if (typeof element === 'string') {\r\n var lcElement = stringToLowerCase(element);\r\n if (lcElement !== element) {\r\n // Config presets (e.g. tags.js, attrs.js) are immutable.\r\n if (!isFrozen(array)) {\r\n array[l] = lcElement;\r\n }\r\n\r\n element = lcElement;\r\n }\r\n }\r\n\r\n set[element] = true;\r\n }\r\n\r\n return set;\r\n }", "title": "" }, { "docid": "3bc42fb3f8eb703f4942ab10bfcd7867", "score": "0.5456102", "text": "get elem () { return this[elem]; }", "title": "" }, { "docid": "79963a33ed8859733ea56a9022305dfd", "score": "0.5419629", "text": "function getsetA(val) {\n\t\tif (!arguments.length) {\n\t\t\treturn this._a;\n\t\t}\n\t\tthis._a = val;\n\t}", "title": "" }, { "docid": "81b644fb542ef5a48a0d0f983d22c1f2", "score": "0.5405808", "text": "getSet(name) {\n if (!this.sets[name]) {\n this.sets[name] = new SingleSelectionSet();\n }\n return this.sets[name];\n }", "title": "" }, { "docid": "5f7a8334ba11b507cec96fe703e049a3", "score": "0.54003567", "text": "function addToSet(set, array) {\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n var l = array.length;\n while (l--) {\n var element = array[l];\n if (typeof element === 'string') {\n var lcElement = stringToLowerCase(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n }", "title": "" }, { "docid": "5f7a8334ba11b507cec96fe703e049a3", "score": "0.54003567", "text": "function addToSet(set, array) {\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n var l = array.length;\n while (l--) {\n var element = array[l];\n if (typeof element === 'string') {\n var lcElement = stringToLowerCase(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n }", "title": "" }, { "docid": "5f7a8334ba11b507cec96fe703e049a3", "score": "0.54003567", "text": "function addToSet(set, array) {\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n var l = array.length;\n while (l--) {\n var element = array[l];\n if (typeof element === 'string') {\n var lcElement = stringToLowerCase(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n }", "title": "" }, { "docid": "b27e9cdcebe5020288232c258f7f54f6", "score": "0.5395392", "text": "function uniqueAddDependency(a, set) {\n var exist = false;\n\n if (Array.isArray(set)) {\n for (var i = 0; i < set.length; i++) {\n if (set[i].str() == a.str()) {\n exist = true;\n break;\n }\n }\n }\n\n if (!exist) {\n set[set.length] = a;\n }\n return set;\n}", "title": "" }, { "docid": "e68fdc072f944136a29ffe45b91acf62", "score": "0.53766656", "text": "function set(arr=[],index, value)\n{\n return arr[index] = value;\n}", "title": "" }, { "docid": "013fa627b49993eef6bd6e4651dbf85f", "score": "0.536998", "text": "function getUnique(arr, comp) {\n let unique = [];\n let uniqueObj = {};\n for (let i in arr) {\n let objId = arr[i][comp];\n if (uniqueObj[objId]) {\n uniqueObj[objId].weight = uniqueObj[objId].weight + 1;\n } else {\n uniqueObj[objId] = arr[i];\n uniqueObj[objId].weight = 1;\n }\n }\n\n for (let i in uniqueObj) {\n unique.push(uniqueObj[i]);\n }\n return unique;\n }", "title": "" }, { "docid": "edf0b495d381c5e23a12e4a5c494c4eb", "score": "0.5341433", "text": "function addToSet(set, array) {\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n var l = array.length;\n while (l--) {\n var element = array[l];\n if (typeof element === 'string') {\n var lcElement = stringToLowerCase(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n}", "title": "" }, { "docid": "e0200f375bd7f5a70617bb6565f77dec", "score": "0.5330456", "text": "set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0!==s){for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]);}else this.inner[n]=[[t,e]];}", "title": "" }, { "docid": "307b4afe1f84e8db9a8665bd1e515c2f", "score": "0.5319281", "text": "function ObjSet() {\r\n this.vals = {};\r\n}", "title": "" }, { "docid": "72328f0185368cfd1224daf226e2b9f0", "score": "0.525514", "text": "function ArraySet(){this._array=[];this._set=Object.create(null);}", "title": "" }, { "docid": "ff5e150160020de0e11c22164e0be4e8", "score": "0.52464724", "text": "static SetObjectArrayElement() {}", "title": "" }, { "docid": "bcec015b06629d6c5e7fb1254275ac0e", "score": "0.5240415", "text": "function _setAdd(arr, obj, propName) {\n var fn, dupes = [];\n if (propName) {\n fn = function(testObj) {\n return testObj[propName] === obj[propName]\n };\n } else {\n fn = function(testObj) {\n return testObj === obj;\n }\n }\n dupes = arr.filter(fn);\n if (dupes.length === 0) {\n arr.push(obj);\n }\n return dupes.length === 0\n }", "title": "" }, { "docid": "2f0a23795f365a3071a33fbacbe1fab9", "score": "0.522124", "text": "function ArraySet(){this._array = [];this._set = {};}", "title": "" }, { "docid": "eda422b00d14faf0a03c94ab2f646889", "score": "0.52119875", "text": "getObject(value, arr, prop) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i][prop] === value) {\n return arr[i];\n\n }\n }\n return -1; //to handle the case where the value doesn't exist\n }", "title": "" }, { "docid": "9953315c46db470317199e8ef7915ffe", "score": "0.5211142", "text": "function findUnique(arr, prop) {\n let uniqueObj = {};\n for (let i = 0; i < arr.length; i++) {\n if (!uniqueObj.hasOwnProperty(prop)) {\n uniqueObj[arr[i][prop]] = 0;\n }\n }\n return Object.keys(uniqueObj);\n}", "title": "" }, { "docid": "9098dc3f65f122a87426ef6ac58f7e1b", "score": "0.5209298", "text": "function makeSet(numberOfSets){\n\tlet i = 0;\n\tlet storageArray = {};\n\tfor(i; i<numberOfSets; i++){\n\t\tstorageArray[i] = i;\n\t}\n\treturn storageArray;\n}", "title": "" }, { "docid": "c3f845c68dbeed6fac4cd904c8ebef53", "score": "0.520684", "text": "function findMISWithEQID(eqid, arr) {\n for (let i = 0; i < arr.length; i++) {\n if (Object.keys(arr[i])[0] === eqid) {\n return Object.values(arr[i])[0];\n }\n }\n}", "title": "" }, { "docid": "3dae18694e614ee1647e6d402afecaa4", "score": "0.52068114", "text": "removeDuplicates(obj){\n var array = obj;\n var seenObj = {};\n array = array.filter(function(currentObject) {\n if (currentObject.name in seenObj) {\n return false;\n } else {\n seenObj[currentObject.name] = true;\n return true;\n }\n });\n return array;\n }", "title": "" }, { "docid": "3dae18694e614ee1647e6d402afecaa4", "score": "0.52068114", "text": "removeDuplicates(obj){\n var array = obj;\n var seenObj = {};\n array = array.filter(function(currentObject) {\n if (currentObject.name in seenObj) {\n return false;\n } else {\n seenObj[currentObject.name] = true;\n return true;\n }\n });\n return array;\n }", "title": "" }, { "docid": "30fca1dbe2f5454bb77f43da09c4631a", "score": "0.51943034", "text": "function getSet(obj,prop,get,set){\n Object.defineProperty(obj,prop,{\n enumerable: true,\n configurable: true,\n get: get, set: set\n });\n }", "title": "" }, { "docid": "6c1ed381c7f6190501bc4e1891d5ebe4", "score": "0.51743525", "text": "function Set(arr) {\n for (var i = 0; i < arr.length; i++) {\n this[arr[i]] = null;\n };\n}", "title": "" }, { "docid": "e6a6754d22e32a7bca421d8a21a974b1", "score": "0.5171135", "text": "function SetPolyfill(){\nthis._cache=[];}", "title": "" }, { "docid": "7770b8d98967470425970a339cb02b48", "score": "0.5168243", "text": "set (name, value) {\n let index = this.indexOf(name)\n if (index >= 0) this.entries[index][1] = value\n else this.add(name, value)\n }", "title": "" }, { "docid": "d642595cf7d328714af00a11a3c3ea0b", "score": "0.5164694", "text": "function addToSet(set, array) {\n\t var l = array.length;\n\t while (l--) {\n\t if (typeof array[l] === 'string') {\n\t array[l] = array[l].toLowerCase();\n\t }\n\t set[array[l]] = true;\n\t }\n\t return set;\n\t}", "title": "" }, { "docid": "e6cc3c07d979df7a927b70d7dd362708", "score": "0.5163716", "text": "reformObj(arr) {\n let resultArr = [];\n for (let category in arr) {\n resultArr.push({ [category]: arr[category].val });\n }\n return resultArr;\n }", "title": "" }, { "docid": "1ebbf5a4af6cf054504b2460b7dd110e", "score": "0.5152082", "text": "[createFunctionName('set', collection, true)](data) {\n return setObjectsToArray(data, self[collection], findField)\n }", "title": "" }, { "docid": "1e45ec79e59c05d92b3b5bf539ff53d6", "score": "0.5147454", "text": "function handlePrefix(el, name, set, value) {\n\t\tvar prefixes = ['', 'webkit', 'moz', 'Moz', 'ms', 'o'],\n\t\t\tsuffix = name[0].toUpperCase() + name.substring(1);\n\t\tfor (var i = 0; i < 6; i++) {\n\t\t\tvar prefix = prefixes[i],\n\t\t\t\tkey = prefix ? prefix + suffix : name;\n\t\t\tif (key in el) {\n\t\t\t\tif (set) {\n\t\t\t\t\tel[key] = value;\n\t\t\t\t} else {\n\t\t\t\t\treturn el[key];\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "55868fb23402a40606d0271c558704ad", "score": "0.512081", "text": "function mergeDedupe(arr) {\n return [...new Set([].concat(...arr))];\n }", "title": "" }, { "docid": "5c915e31ba7f6e2138d528d082bc05a7", "score": "0.5117773", "text": "set(propObj, value) {\n propObj[this.id] = value;\n return propObj;\n }", "title": "" }, { "docid": "b7518fff7b198a867a31fcecf5a5626f", "score": "0.5114338", "text": "function Set(elems){\nif(typeof elems == \"string\")\nthis.map = stringToMap(elems);\nelse\nthis.map = {};\n}", "title": "" }, { "docid": "83d4de1e0357b06b00e6fe8c5ef10d42", "score": "0.51108897", "text": "function uniqNoSet(arr) {\n var ret = [];\n\n for (var i = 0; i < arr.length; i++) {\n if (ret.indexOf(arr[i]) === -1) {\n ret.push(arr[i]);\n }\n }\n\n return ret;\n } // 2 - a simple Set type is defined", "title": "" }, { "docid": "9f32194ccdf4dfe3a83f92dec69c9aef", "score": "0.51080894", "text": "function ivar_set(obj, id, val) {\n obj[id] = val;\n return val;\n}", "title": "" }, { "docid": "72243b2e9c423964ce00e6714c43dbe6", "score": "0.51062673", "text": "function select(arr, obj) {\n // your code here\n var result = {};\n for (var prop in obj) {\n if (arr.includes(prop)) {\n result[prop] = obj[prop];\n }\n }\n return result;\n}", "title": "" }, { "docid": "4bea33e0bcf58012bcb49b5105187ad4", "score": "0.5103911", "text": "function defineAttribute(arr, prop) {\n\t if (!(prop in arr)) { // e.g. we cannot redefine .length\n\t Object.defineProperty(arr, prop, {\n\t get: function() {\n\t return filterSet(util.pluck(arr, prop));\n\t },\n\t set: function(v) {\n\t if (util.isArray(v)) {\n\t if (this.length != v.length) throw error({message: 'Must be same length'});\n\t for (var i = 0; i < v.length; i++) {\n\t this[i][prop] = v[i];\n\t }\n\t }\n\t else {\n\t for (i = 0; i < this.length; i++) {\n\t this[i][prop] = v;\n\t }\n\t }\n\t }\n\t });\n\t }\n\t}", "title": "" }, { "docid": "64610fee28745c3000b8c5f6449dc35a", "score": "0.51017547", "text": "function arrayToSet(array) {\n\t\tvar set = {};\n\t\tangular.forEach(array, function(value, key) {\n\t\t\tset[value] = true;\n\t\t});\n\t\treturn set;\n\t}", "title": "" }, { "docid": "47f72b71f6cc0a111468498ea9a58607", "score": "0.5093588", "text": "function indexBy(arr, name) {\n return arr.reduce(\n function(result, next) {\n result[next[name]] = next\n return result\n },\n {}\n )\n}", "title": "" }, { "docid": "1b76eb2c2bdf25bca13313271c98dae8", "score": "0.5085009", "text": "function setPub(obj, name, val) {\n \n if (typeof name === 'number' &&\n name >= 0 &&\n // See issue 875\n obj instanceof Array &&\n obj.FROZEN___ !== obj) {\n return obj[name] = val;\n }\n name = String(name);\n if (obj === null || obj === void 0) {\n throw new TypeError(\"Can't set \" + name + ' on ' + obj);\n }\n if (obj[name + '_canSet___'] === obj) {\n return obj[name] = val;\n } else if (canSetPub(obj, name)) {\n fastpathSet(obj, name);\n return obj[name] = val;\n } else {\n return obj.handleSet___(name, val);\n }\n }", "title": "" }, { "docid": "2572322b333faeb5547cbfb7684e3b65", "score": "0.50746065", "text": "fitter(arr, filename) {\n arr = Array.from(new Set(arr));\n let res = [];\n arr.forEach((v) => {\n res.push({ val: v, from: filename });\n });\n return res;\n }", "title": "" }, { "docid": "b4d4f6c2bd1dfdc9b097f6ccb4da54b5", "score": "0.5073044", "text": "function setIn(obj, path, value) {\n var res = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = Object(lodash_es_toPath__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}", "title": "" }, { "docid": "b4d4f6c2bd1dfdc9b097f6ccb4da54b5", "score": "0.5073044", "text": "function setIn(obj, path, value) {\n var res = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = Object(lodash_es_toPath__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}", "title": "" }, { "docid": "b4d4f6c2bd1dfdc9b097f6ccb4da54b5", "score": "0.5073044", "text": "function setIn(obj, path, value) {\n var res = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = Object(lodash_es_toPath__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = Object(lodash_es_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}", "title": "" }, { "docid": "04054cfd656d07b306ee11ad544f6d81", "score": "0.5069298", "text": "function firstDuplicate(xs) {\n let s = new Map;\n for (let i = 0; i < xs.length; ++i) {\n let { descType, name } = xs[i];\n let val = [];\n if (s.has(name)) {\n val = s.get(name);\n switch (descType) {\n case 'get':\n case 'set':\n if (val.includes(descType)) return name;\n break;\n default:\n return name;\n }\n }\n val.push(descType);\n s.set(name, val);\n }\n }", "title": "" }, { "docid": "525d5f5995dc794c94fbfb19871fc05d", "score": "0.506408", "text": "function removeDuplicates(arr, prop) {\n\tvar new_arr = [];\n\tvar lookup = {};\n\n\tfor (var i in arr) {\n\t\tlookup[arr[i][prop]] = arr[i];\n\t}\n\n\tfor (i in lookup) {\n\t\tnew_arr.push(lookup[i]);\n\t}\n\treturn new_arr;\n}", "title": "" }, { "docid": "57a07c50e9fb160657b80cae0e30ba1a", "score": "0.5060356", "text": "function indexBy(array, propName) {\n\t var result = {};\n\t forEach(array, function (item) {\n\t result[item[propName]] = item;\n\t });\n\t return result;\n\t }", "title": "" }, { "docid": "d9a8af1d50da9bb725d44677bfb89fe7", "score": "0.5059205", "text": "function unique(arr) {\n var hash = {};\n var result = [];\n for (var i = 0, l = arr.length; i < l; ++i) {\n var objString = JSON.stringify(arr[i]);\n if (!hash.hasOwnProperty(objString)) {\n hash[objString] = true;\n result.push(arr[i]);\n }\n }\n return result;\n }", "title": "" }, { "docid": "c4d3d804183bfcfe900177990cbbba4d", "score": "0.5050575", "text": "function uniq(arr) {\n var theSet = new pouchdbCollections.Set(arr);\n var result = new Array(theSet.size);\n var index = -1;\n theSet.forEach(function (value) {\n result[++index] = value;\n });\n return result;\n}", "title": "" }, { "docid": "c4d3d804183bfcfe900177990cbbba4d", "score": "0.5050575", "text": "function uniq(arr) {\n var theSet = new pouchdbCollections.Set(arr);\n var result = new Array(theSet.size);\n var index = -1;\n theSet.forEach(function (value) {\n result[++index] = value;\n });\n return result;\n}", "title": "" }, { "docid": "a14f7174ef95fb9a698fa77981f908b7", "score": "0.5038735", "text": "static groupBy(f, arr) {\n let result = {};\n arr.forEach(e => {\n if (f(e) in result) {\n result[f(e)].push(e);\n } else {\n result[f(e)] = [e];\n }\n });\n return result;\n }", "title": "" }, { "docid": "53ab41863cf3e4149391059aa1afab91", "score": "0.50302297", "text": "function uniq(arr) {\n var theSet = new ExportedSet(arr);\n var result = new Array(theSet.size);\n var index = -1;\n theSet.forEach(function (value) {\n result[++index] = value;\n });\n return result;\n}", "title": "" }, { "docid": "53ab41863cf3e4149391059aa1afab91", "score": "0.50302297", "text": "function uniq(arr) {\n var theSet = new ExportedSet(arr);\n var result = new Array(theSet.size);\n var index = -1;\n theSet.forEach(function (value) {\n result[++index] = value;\n });\n return result;\n}", "title": "" }, { "docid": "53ab41863cf3e4149391059aa1afab91", "score": "0.50302297", "text": "function uniq(arr) {\n var theSet = new ExportedSet(arr);\n var result = new Array(theSet.size);\n var index = -1;\n theSet.forEach(function (value) {\n result[++index] = value;\n });\n return result;\n}", "title": "" }, { "docid": "ba914aceda2ab05cacac2d55441af5d0", "score": "0.5028038", "text": "function pluck(array, key) {\n return array.map(function (o) {\n return o[key];\n });\n } //get the unique keys", "title": "" }, { "docid": "c042a3c92034ec36e80091b25aea377f", "score": "0.5026496", "text": "function uniqSetWithForEach(arr) {\n\t\tvar ret = [];\n\t\n\t\t(new Set(arr)).forEach(function (el) {\n\t\t\tret.push(el);\n\t\t});\n\t\n\t\treturn ret;\n\t}", "title": "" }, { "docid": "a4434bd5790d0ee99428a8e73c96383d", "score": "0.50108844", "text": "function slice(obj, set) {\n\t\tvar r = {};\n\t\tfor (var key in obj) {\n\t\t\tif (key in set) {\n\t\t\t\tr[key] = obj[key];\n\t\t\t\tdelete obj[key];\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}", "title": "" }, { "docid": "bd50841e7f3a5ce64cb511b8661e798b", "score": "0.50078255", "text": "function uniquify(arr)\n{\n // console.log(arr)\n var index = 0;\n var n = []; \n // n.push({name: \"none\", group: \"none\", weight: 1});\n for(var i = 0; i < arr.length; i++) \n {\n index = 0;\n for (var x = 0; x<n.length; x++)\n {\n if (arr[i].name == n[x].name && arr[i].group == n[x].group) \n index = -1;\n }\n if (index != -1) n.push(arr[i]);\n // if (n.indexOf(arr[i].name) == -1 && n.indexOf(arr[i].group) == -1) n.push(arr[i]);\n }\n // console.log(n);\n return n;\n}", "title": "" }, { "docid": "d708344a54aaefbc8861a672aa17d40c", "score": "0.49909434", "text": "function getFromSet(set, tpm, tpw, intd, intw, intm) {\n for (const v of set) {\n //loop through the entire set\n if (\n v.timesPerMonth === tpm &&\n v.timesPerWeek === tpw &&\n v.intervalDays === intd &&\n v.intervalWeeks === intw &&\n v.intervalMonths === intm\n ) {\n return v; //object found in set\n }\n }\n return null; //object not found in set\n }", "title": "" }, { "docid": "f76481648e8713fac39d63718f5b7082", "score": "0.4988011", "text": "arrToObj(arr) {\n let obj = {}\n arr.map(item => {\n return (obj[item.id] = item)\n })\n return obj\n }", "title": "" }, { "docid": "6c69df8a975c967a65d79610935b6d1f", "score": "0.49877268", "text": "function setIn(obj, path, value) {\n var res = Object(__WEBPACK_IMPORTED_MODULE_4_lodash_es_clone__[\"a\" /* default */])(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = Object(__WEBPACK_IMPORTED_MODULE_5_lodash_es_toPath__[\"a\" /* default */])(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = Object(__WEBPACK_IMPORTED_MODULE_4_lodash_es_clone__[\"a\" /* default */])(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}", "title": "" }, { "docid": "514af805aaaf8724c3629c9638ed72a6", "score": "0.498567", "text": "function array_getfield(arr, name) {\n\tvar ret = [];\n\tfor (var i=0; i<arr.length; ++i) {\n\t\tret.push(arr[i][name]);\n\t}\n\treturn ret;\n}", "title": "" }, { "docid": "b58cdd75fbda8e69cfedd3087fb1c614", "score": "0.49840686", "text": "function addToSet(set, array) {\n var l = array.length;\n while (l--) {\n if (typeof array[l] === 'string') {\n array[l] = array[l].toLowerCase();\n }\n set[array[l]] = true;\n }\n return set;\n}", "title": "" }, { "docid": "b58cdd75fbda8e69cfedd3087fb1c614", "score": "0.49840686", "text": "function addToSet(set, array) {\n var l = array.length;\n while (l--) {\n if (typeof array[l] === 'string') {\n array[l] = array[l].toLowerCase();\n }\n set[array[l]] = true;\n }\n return set;\n}", "title": "" }, { "docid": "ddb7affc84e67217ebb9310e8d01e625", "score": "0.4964822", "text": "set(name, value) {\n let data = this.getData();\n if (data == null) {\n data = window[this.key] = {};\n }\n let v = data[name];\n if (v !== undefined) {\n throw new Error(\"Object already exists. Cannot overwrite\");\n }\n data[name] = value;\n }", "title": "" }, { "docid": "d453db4580826b641b4561468051ad2d", "score": "0.495939", "text": "setId() {\n\t\tthrow new Error(\"id was renamed to ids and type changed to string[]\");\n\t}", "title": "" }, { "docid": "d453db4580826b641b4561468051ad2d", "score": "0.495939", "text": "setId() {\n\t\tthrow new Error(\"id was renamed to ids and type changed to string[]\");\n\t}", "title": "" }, { "docid": "c7c66c13aec7d26ebb14f1a462312b15", "score": "0.49508145", "text": "function keyBy(prop, array) {\n return array.reduce(function(result, item) {\n result[item[prop]] = item;\n return result;\n }, {});\n }", "title": "" }, { "docid": "2ae28d5520ef06012d5ab0fdae2bdabc", "score": "0.4931544", "text": "function uniqueBy(arr, fn) {\n var unique = {};\n var distinct = [];\n arr.forEach(function (x) {\n var key = fn(x);\n if (!unique[key]) {\n distinct.push(key);\n unique[key] = true;\n }\n });\n return distinct;\n}", "title": "" }, { "docid": "f2ec4b6c4f9e5dd2f80adf1155b75754", "score": "0.49259502", "text": "pathSet(base, names) {\n for (let i = 0; i < names.length; i++) {\n base = base[names[i]] = base[names[i]] || {};\n }\n return base;\n }", "title": "" }, { "docid": "b51c8a78d028a598ffa22a873694eb04", "score": "0.49242336", "text": "function sfSetObj(ast, env){\n let ret = smNode(ast);\n for(let i=1;i<ast.length; ++i){\n if(i>1)ret.add(\",\");\n ret.add(txExpr(ast[i], env));\n }\n return wrap(ret, [kbStdRef(`${rdr.jsid(\"hash-set\")}`),\"(\"],\")\");\n }", "title": "" }, { "docid": "52119e02aed7b1614a865d099e72410a", "score": "0.49194768", "text": "function fillSelect(obj, name, val) {\n let arr = []\n arr = findUniqueValue(obj, name, val);\n\n sortName(arr, name).forEach((x) => addToSelTest(x, name, name + val, name));\n}", "title": "" }, { "docid": "6a300ff385b1f23aee7e628216660954", "score": "0.49002767", "text": "function makeUniqArray(arrArgument) {\n var resultArray = [];\n var duplicateBase = {};\n for (var i = 0; i < arrArgument.length; i++) {\n\n if(duplicateBase[arrArgument[i]]===undefined) {\n duplicateBase[arrArgument[i]] = 1;\n \n console.log(duplicateBase[arrArgument[i]]); \n resultArray.push(arrArgument[i]);\n } else {\n duplicateBase[arrArgument[i]] = duplicateBase[arrArgument[i]] + 1;\n console.log(duplicateBase[arrArgument[i]]);\n }\n }\n return resultArray;\n }", "title": "" }, { "docid": "5255aa91ee3a21c49c633c48dddfbe78", "score": "0.4896379", "text": "function buildSetters (varNames, set) {\n const setters = {}\n varNames.forEach(varName => {\n setters[setterFuncName(varName)] = (value) => set(varName, value)\n })\n return setters\n}", "title": "" }, { "docid": "b8085b604da4667629805665c92fcc99", "score": "0.48963404", "text": "function uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}", "title": "" }, { "docid": "b8085b604da4667629805665c92fcc99", "score": "0.48963404", "text": "function uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}", "title": "" }, { "docid": "b8085b604da4667629805665c92fcc99", "score": "0.48963404", "text": "function uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}", "title": "" }, { "docid": "b8085b604da4667629805665c92fcc99", "score": "0.48963404", "text": "function uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}", "title": "" } ]
31396a96fcf8bd0690ac04aaba436628
deletion, so don't let them throw. Hostoriginating errors should interrupt deletion, so it's okay
[ { "docid": "eeee9bbcd62a49b0bd27d655ea5d4161", "score": "0.0", "text": "function commitUnmount(finishedRoot, current, renderPriorityLevel) {\n onCommitUnmount(current);\n\n switch (current.tag) {\n case FunctionComponent:\n case ForwardRef:\n case MemoComponent:\n case SimpleMemoComponent:\n case Block:\n {\n var updateQueue = current.updateQueue;\n\n if (updateQueue !== null) {\n var lastEffect = updateQueue.lastEffect;\n\n if (lastEffect !== null) {\n var firstEffect = lastEffect.next;\n var effect = firstEffect;\n\n do {\n var _effect2 = effect,\n destroy = _effect2.destroy,\n tag = _effect2.tag;\n\n if (destroy !== undefined) {\n if ((tag & Passive$1) !== NoFlags$1) {\n enqueuePendingPassiveHookEffectUnmount(current, effect);\n } else {\n {\n safelyCallDestroy(current, destroy);\n }\n }\n }\n\n effect = effect.next;\n } while (effect !== firstEffect);\n }\n }\n\n return;\n }\n\n case ClassComponent:\n {\n safelyDetachRef(current);\n var instance = current.stateNode;\n\n if (typeof instance.componentWillUnmount === 'function') {\n safelyCallComponentWillUnmount(current, instance);\n }\n\n return;\n }\n\n case HostComponent:\n {\n safelyDetachRef(current);\n return;\n }\n\n case HostPortal:\n {\n // TODO: this is recursive.\n // We are also not using this parent because\n // the portal will get pushed immediately.\n {\n unmountHostComponents(finishedRoot, current);\n }\n return;\n }\n\n case FundamentalComponent:\n {\n return;\n }\n\n case DehydratedFragment:\n {\n return;\n }\n\n case ScopeComponent:\n {\n return;\n }\n }\n }", "title": "" } ]
[ { "docid": "8bf6a3f04550dfcae86d77a756a44160", "score": "0.647436", "text": "async preDelete () {\n\t}", "title": "" }, { "docid": "b188e824182f6ce285e3256455357cf7", "score": "0.6450559", "text": "function hoistedDelete() {}", "title": "" }, { "docid": "b94afa9e6b47607ac67d9c312f4fb704", "score": "0.63733006", "text": "delete() {\n \n }", "title": "" }, { "docid": "f4b2ca029a3ab2d2c44f8e1eb63e1530", "score": "0.6280785", "text": "delete() {}", "title": "" }, { "docid": "f4b2ca029a3ab2d2c44f8e1eb63e1530", "score": "0.6280785", "text": "delete() {}", "title": "" }, { "docid": "d59040ea38d520816636fd1643dfbec4", "score": "0.6242876", "text": "function rejectAndDelete(exceptions) {\n\t\t\t media.delete();\n\t\t\t reject(exceptions);\n\t\t\t }", "title": "" }, { "docid": "f1e0e30b2488240661817657ea1de3a1", "score": "0.6156361", "text": "delete() {\n\n\t}", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "99e0a35c1681fc1b4dbc47cb81473622", "score": "0.61540544", "text": "detach() {\n throw new Error('Not Implemented');\n }", "title": "" }, { "docid": "f335b0c6d6d097c63e6f85de2fc7394e", "score": "0.6091117", "text": "cleanup() {}", "title": "" }, { "docid": "f335b0c6d6d097c63e6f85de2fc7394e", "score": "0.6091117", "text": "cleanup() {}", "title": "" }, { "docid": "a26f579aaf72649dfabd5e8ed0b5bc26", "score": "0.60719866", "text": "function cleanup() {\n const idx = []\n for(let i=0; i < WORKERS.length; i++) {\n if (!WORKERS[i].is('dead', 'error')) continue;\n idx.push(i)\n }\n idx.forEach(i => WORKERS.splice(i, 1))\n}", "title": "" }, { "docid": "728ea6309cc49e5b27e2feaf8f4aeaf7", "score": "0.6047838", "text": "delete() {\n\t\tthis.notAllowed();\n\t}", "title": "" }, { "docid": "d025c6c41feb3320fe84827f322812b2", "score": "0.60099345", "text": "exitOC_Delete(ctx) {}", "title": "" }, { "docid": "e4544bca8ff5c8bcbb16ef6019db1544", "score": "0.59670293", "text": "function _fnRemoved () {\n throw {code: 410, text: 'Object is removed'};\n}", "title": "" }, { "docid": "efbe9731bafeca2ca14f847ead3a0e13", "score": "0.59136623", "text": "beforeDelete () {}", "title": "" }, { "docid": "13fe87c93e65aa5819264f2a4d90c26e", "score": "0.58315235", "text": "remove() { }", "title": "" }, { "docid": "4e9eb5abb4d43b8ec64725dbbedb0562", "score": "0.5799465", "text": "cleanOnDemandBuffer()\n {\n if (this._pendingOnDemandDeletes.length > 0)\n {\n var pending = this._pendingOnDemandDeletes.shift();\n this.deletePendingOnDemand(pending.delete_range);\n }\n }", "title": "" }, { "docid": "0eeb694231152609bc00eecd6f67b0b5", "score": "0.5783152", "text": "_terminate() {\n return function(t) {\n const n = te.get(t);\n n && (m(\"ComponentProvider\", \"Removing Datastore\"), te.delete(t), n.terminate());\n }(this), Promise.resolve();\n }", "title": "" }, { "docid": "93ff555b904992ec34f79a27b2bf12fb", "score": "0.57776266", "text": "onDeleted() {\n\t \n this.log('device deleted');\n\t\tcmdclient[device_data.host].destroy();\n\t\t\n }", "title": "" }, { "docid": "831d6952a1e904dc7c3453151404a3dd", "score": "0.5771356", "text": "detach() {\n throw new Error('incompatible reuse strategy');\n }", "title": "" }, { "docid": "7e7917dcc4cc4df6611aaade6cce3bb6", "score": "0.57097995", "text": "onCleanUp() { }", "title": "" }, { "docid": "45efd5e90545fbfd8df5632a45964c87", "score": "0.5692756", "text": "delete() {\n\n }", "title": "" }, { "docid": "b12cd533bbd1fe739be114fdc2e8cb74", "score": "0.56922054", "text": "onDelete() {\n delete this.files;\n delete this.filesNameString;\n this.clearErrors();\n this.dropped.emit(undefined);\n }", "title": "" }, { "docid": "9baf79f101c1a6dd314411435cace946", "score": "0.5691224", "text": "_tryGCOne(now) {\n if (this._cleanupNextPosition >= this._cleanupKeys.length) {\n this._cleanupKeys = Object.keys(this._storage);\n this._cleanupNextPosition = 0;\n }\n if (this._cleanupKeys.length <= 0) {\n //nothing to try cleaning up\n return;\n }\n let key = this._cleanupKeys[this._cleanupNextPosition];\n this._cleanupNextPosition++;\n let tryCleanup = this._storage[key];\n if (tryCleanup == null) {\n // tslint:disable-next-line: no-dynamic-delete\n delete this._storage[key];\n return;\n }\n if (tryCleanup.gcAfter > now) {\n //not expired;\n return;\n }\n //no early exit clauses triggered, so cleanup\n // tslint:disable-next-line: no-dynamic-delete\n delete this._storage[key];\n return;\n }", "title": "" }, { "docid": "d1c014152fc686ce354f1bc601373717", "score": "0.56770384", "text": "recoverByDelete(next, nextEnd) {\n let isNode = next <= this.p.parser.maxNode;\n if (isNode) this.storeNode(next, this.pos, nextEnd);\n this.storeNode(0\n /* Err */\n , this.pos, nextEnd, isNode ? 8 : 4);\n this.pos = this.reducePos = nextEnd;\n this.score -= 200\n /* Token */\n ;\n }", "title": "" }, { "docid": "89f9664d746170fce231e33ad5e28be2", "score": "0.56697303", "text": "function destroyed() {\n throw new Error('Call made to destroyed method');\n}", "title": "" }, { "docid": "bc35786ce7a1571cadca57a66421bde8", "score": "0.5668556", "text": "async delete() {\n await this._impl_delete();\n }", "title": "" }, { "docid": "1e105b31f94f450a39fee37704d01990", "score": "0.56643784", "text": "function finish(err) {\n\t\tif(err)\n\t\t{\n\t\t\tremoveFunc(function(err) {\n\t\t\t\tif(err)\n\t\t\t\t\tconsole.warn(\"Error while removing errorneous object: \", err);\n\t\t\t});\n\t\t\tcallback(err);\n\t\t}\n\t\telse\n\t\t\tcallback(null);\n\t}", "title": "" }, { "docid": "afdf2199588f5fb3b1d32a51bc9fe5bd", "score": "0.56634754", "text": "function cleanup() {\n }", "title": "" }, { "docid": "8e1cf2fd266a2e18eee29d3ef6ee964c", "score": "0.5654208", "text": "function handleDeleteResponseAndThrow(resultOfDelete){\n var response = handleDeleteResponse(resultOfDelete);\n if(response!==null){\n throw response;\n }\n}", "title": "" }, { "docid": "376a0adf8a3d1ae5c2a655ee5b6af29c", "score": "0.56459075", "text": "function errCleanUp(err) {\n //Clean up temp area. Even though this is async,\n //it is not important to track the completion.\n file.asyncPlatformRm(tempDirName);\n\n deferred.reject(err);\n }", "title": "" }, { "docid": "ca4cdc7c3bd4b40af1fd0e9131c4c9e3", "score": "0.56431437", "text": "function cleanupException() {\n var stream = dbExceptions\n .createReadStream({\n keys: true,\n values: true\n })\n .on(\"data\", item => {\n const value = JSON.parse(item.value);\n if (value.reason === \"greylist\") {\n if (value.created < Date.now() - greylistduration) {\n dbExceptions.del(item.key, err => {\n console.log(\"removed \", item.key, \"from greylist\");\n });\n }\n }\n });\n}", "title": "" }, { "docid": "c9af41be2d3b9cb37f331a33611de75c", "score": "0.56168723", "text": "destroy (err) {\n this._destroy(err, () => {})\n }", "title": "" }, { "docid": "c9af41be2d3b9cb37f331a33611de75c", "score": "0.56168723", "text": "destroy (err) {\n this._destroy(err, () => {})\n }", "title": "" }, { "docid": "c9af41be2d3b9cb37f331a33611de75c", "score": "0.56168723", "text": "destroy (err) {\n this._destroy(err, () => {})\n }", "title": "" }, { "docid": "c1202705c0692790b59f75688c5a0cf4", "score": "0.5614218", "text": "disconnect() {\n\t\t\t/* istanbul ignore next */\n\t\t\tthrow new Error(\"Not implemented!\");\n\t\t}", "title": "" }, { "docid": "02979b533dc78a1629d5fdd0e9a61a61", "score": "0.5584163", "text": "remove(){ throw 'Remove not overridden'}", "title": "" }, { "docid": "a7c06bcb10e8ccaffec930f225055f72", "score": "0.5582894", "text": "wsFail() {\n this.destroy();\n }", "title": "" }, { "docid": "0eb9d8761e071b743236eb360e182928", "score": "0.55781895", "text": "function errCleanUp(err) {\r\n //Clean up temp area. Even though this is async,\r\n //it is not important to track the completion.\r\n if (tempDirName) {\r\n file.asyncPlatformRm(tempDirName);\r\n }\r\n\r\n deferred.reject(err);\r\n }", "title": "" }, { "docid": "048ad481d5249b197295fe0124f49f25", "score": "0.5578025", "text": "G_() {\n if (this.ks.z_) throw new k$1(x$1.FAILED_PRECONDITION, \"The client has already been terminated.\");\n }", "title": "" }, { "docid": "5cdd102732d1dcebea139679433c3ad1", "score": "0.5575195", "text": "function socketError () {\n this.destroy();\n}", "title": "" }, { "docid": "5cdd102732d1dcebea139679433c3ad1", "score": "0.5575195", "text": "function socketError () {\n this.destroy();\n}", "title": "" }, { "docid": "5cdd102732d1dcebea139679433c3ad1", "score": "0.5575195", "text": "function socketError () {\n this.destroy();\n}", "title": "" }, { "docid": "6f76fdf4e98720e359f24e1d34341a20", "score": "0.5561665", "text": "function removeDeletedEntities() {\n\t\t// copy list so we can modify it\n\t\tvar delList = that.deleteQueue.slice(0);\n\t\t\n\t\tfor (var ie = 0; ie < delList.length; ie++) {\n\t\t\tvar e = delList[ie];\n\t\t\tif (e.deathCallback != null) {\n\t\t\t\t//Log.i(\"Asciiquarium\", \"Animation: invoke death callback for \" + e.name);\n\t\t\t\te.deathCallback.run(e);\n\t\t\t}\n\t\t\t\n\t\t\tif (e.physical)\n\t\t\t\tthat.physicalCount--;\n\n\t\t\t// that.list.remove(e)\n\t\t\tfor (var id = 0; id < that.list.length; id++) {\n\t\t\t\tif (that.list[id] == e) {\n\t\t\t\t\tthat.list.splice(id, 1);\n\t\t\t\t\tdelete e;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tthat.deleteQueue = [];\n\t}", "title": "" }, { "docid": "8611190ef28310fe8e2fd541b878a125", "score": "0.5553094", "text": "delDrops() {\n this.head = null\n }", "title": "" }, { "docid": "f608a345f7f9b983d817b545f1980cc7", "score": "0.55456144", "text": "deleteAll() {\n try {\n fs.unlinkSync(this.filename)\n return null\n } catch(error) {\n if (error?.code === 'ENOENT') {\n console.log('file not found');\n return null\n }\n return error\n }\n\n}", "title": "" }, { "docid": "86fc7c21c117579e90b7f46197c99387", "score": "0.5537583", "text": "cleanup() {\n this.disposeDeleteUnlinkedNodes();\n this.disposeGraphStateEmpty();\n }", "title": "" }, { "docid": "357bd59c8948a241230a1dc5738f28e9", "score": "0.5531501", "text": "function postMortem(){throw new Error('This method cannot be called because this Handsontable instance has been destroyed');}", "title": "" }, { "docid": "97d23c2184e6568b4ccead28322d0092", "score": "0.5517569", "text": "function clean (cb) {\n return del([DEST]).then(cb.bind(null, null))\n}", "title": "" }, { "docid": "1efd9b13ced7e741316ef96248c8e9d2", "score": "0.5515699", "text": "function del(){\r\n\thandleSchemaNode('deleteNode');\r\n}", "title": "" }, { "docid": "ba705f12d1967a26aea1abed38644c24", "score": "0.55104387", "text": "Remove() {}", "title": "" }, { "docid": "b2920e95fb87b05051857da87f504159", "score": "0.5504821", "text": "indicateRemove() {}", "title": "" }, { "docid": "09ac391cc292a9cd893de90859f9aea8", "score": "0.5496084", "text": "destroy() {}", "title": "" }, { "docid": "09ac391cc292a9cd893de90859f9aea8", "score": "0.5496084", "text": "destroy() {}", "title": "" }, { "docid": "e0ba1e3693aa829431b7597d221b0f1f", "score": "0.54878384", "text": "function socketOnError() {\n this.destroy()\n}", "title": "" }, { "docid": "623a081576d675acb7d3bafafcec3a31", "score": "0.5484814", "text": "function deletef() {\n\n }", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "340f3604b43096aa62515040287d8010", "score": "0.5475925", "text": "function socketOnError() {\n this.destroy();\n}", "title": "" }, { "docid": "33468bc6495e5471ba41d3d5d3ab2771", "score": "0.5467322", "text": "delete() {\n if (!this.removed) {\n for (let [_, edge] of this.neighbors) edge.delete();\n\n for (let g of this.glissInputs) g.remove();\n\n for (let g of this.glissOutputs) g.remove();\n\n let removed = this.glissInputs.concat(this.glissOutputs).concat([...this.neighbors].map(e => e[1]));\n editor$1.removeReferences(removed);\n this.remove();\n }\n }", "title": "" }, { "docid": "ac925ec7e29b364695a769e7d74d96ee", "score": "0.54647607", "text": "postDestroy() { }", "title": "" }, { "docid": "0ff0514c1153445ccd4546ff9770a2b6", "score": "0.5460329", "text": "delete() {\n let _this = this;\n\n\n _this._releaseListeners();\n\n //TODO: send delete message ?\n\n // nothing to be done\n // return new Promise((resolve) => {\n // log.log('[DataObjectChild.delete]');\n // resolve();\n // });\n }", "title": "" }, { "docid": "0e75ecd1163be1cb79211ab8ea976c0b", "score": "0.54438174", "text": "function deleteGhosts() {\n let ghosts = document.querySelectorAll(GHOST_SEL);\n [...ghosts].forEach(g => g.parentElement.removeChild(g));\n ghost = null;\n }", "title": "" }, { "docid": "0d6ef1679480db1d5cfee15822825343", "score": "0.5442813", "text": "function deleteProcesses() {\n\tconsole.log(\"@deleteProcesses: not implemented\");\n}", "title": "" }, { "docid": "62f45728c67ea60cf00e5299a1129c85", "score": "0.5437965", "text": "onRemoved() {}", "title": "" }, { "docid": "bf57d4302a91408c70d85669cafdf177", "score": "0.5434755", "text": "async postDelete () {\n\t}", "title": "" }, { "docid": "eb1052bd1a80443e2ec05b951f9e1ef9", "score": "0.5420964", "text": "function deleteFailure() {\n alert('You are not the owner of this item and do not have authorization to delete!');\n}", "title": "" }, { "docid": "01870724891feeb11d45e533ba2bcd37", "score": "0.54144716", "text": "_cleanup() {\n _.each(this.tokenBuckets, (value, key) => {\n const tokenBucket = this.tokenBuckets[key];\n if (tokenBucket.tokens == tokenBucket.limit) {\n tokenBucket.destroy();\n delete this.tokenBuckets[key];\n }\n });\n }", "title": "" }, { "docid": "5d76dba6bc81fc278b9a8a6e8485dffc", "score": "0.54056156", "text": "function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n>>>>>>> master\n }", "title": "" }, { "docid": "8ea299ba5a861087d3a7ca97be691a40", "score": "0.5403551", "text": "_handleDelete() {\n const pathDeleteIndices = this._handleSingleVertexDelete();\n // Remove enqueued paths\n if (this.allowPathRemoval) {\n // Remove paths starting with the last (!) index.\n for (var i = pathDeleteIndices.length - 1; i >= 0; i--) {\n this.removePathAt(pathDeleteIndices[i]);\n }\n }\n this.pb.redraw();\n }", "title": "" }, { "docid": "a23a51c65d1c4b9ba5ad30ade474e5c1", "score": "0.5401192", "text": "delete(){\n\n }", "title": "" }, { "docid": "cb21908a78ad9d06deb15a99344ea0b4", "score": "0.53945136", "text": "async __deleteIndex() {\n await this.pool.end();\n let client = new Client(Object.assign({}, config, { database: 'postgres' }));\n try {\n await client.connect();\n await client.query(`drop database if exists ${config.database}`);\n } finally {\n client.end();\n }\n }", "title": "" }, { "docid": "39a1a7bbb8ce702e2af2e886e358ba74", "score": "0.53940105", "text": "destructor() {\n\t\tObject.keys(this.clients).forEach((hash) => {\n\t\t\tthis.removeClient(hash);\n\t\t});\n\t}", "title": "" }, { "docid": "e676f0ebae40ae5aa3c8c92abd3ed798", "score": "0.53872085", "text": "function postMortem() {\n throw new Error('This method cannot be called because this Handsontable instance has been destroyed');\n }", "title": "" }, { "docid": "2518eeca194c445505a993ed42313377", "score": "0.5385519", "text": "delete () {\n this.emit('deleting', this);\n this.beforeDelete();\n this.constructor._service.delete(this);\n this.emit('deleted', this);\n }", "title": "" }, { "docid": "815f8f4cc6c0c6cfb7e7254adb9b6a1f", "score": "0.53756875", "text": "tryDeleteLastWatcher() {\n if (this.lastWatcher) {\n this.getWatcherGroup().delete(this.lastWatcher);\n this.lastWatcher = null;\n }\n }", "title": "" }, { "docid": "815f8f4cc6c0c6cfb7e7254adb9b6a1f", "score": "0.53756875", "text": "tryDeleteLastWatcher() {\n if (this.lastWatcher) {\n this.getWatcherGroup().delete(this.lastWatcher);\n this.lastWatcher = null;\n }\n }", "title": "" }, { "docid": "6124204e03fe97303d979d1cd0a948f6", "score": "0.53562963", "text": "exitDeleteStatement(ctx) {\n\t}", "title": "" }, { "docid": "2104bf85cc79f1ccb8ee8851c21540e0", "score": "0.5353155", "text": "disconnectedCallback() {\n console.log(\"removido\")\n }", "title": "" }, { "docid": "3b49f783ea4b6593c268afeb2dcbafa4", "score": "0.5353154", "text": "async deleteAction(epcList) {\n throw new Error('deleteAction not implemented');\n }", "title": "" }, { "docid": "b060d3158847584512ef99c6f6d3baec", "score": "0.53526694", "text": "del(dbId) {}", "title": "" }, { "docid": "91ae5a455bbbb467af7fb1e9e03e1e20", "score": "0.5343543", "text": "async destroy() {\r\n return null;\r\n }", "title": "" }, { "docid": "f4e40dcf633ac00ebbd1d25bc8013a63", "score": "0.5336141", "text": "async abort() {\n return;\n }", "title": "" }, { "docid": "e0b204cc80b658b9807c5f6c4ffe10eb", "score": "0.53359836", "text": "onDestroy() {}", "title": "" } ]
03491d6e01414d9189e94ae6b77412d8
Given an image, return the proper image URI
[ { "docid": "b6a0201caa04aebe7de6b40350377275", "score": "0.67375106", "text": "function imageURIForItem( item ) {\n\tif ( !item.hasOwnProperty('img') )\n\t\treturn false;\n\n\treturn \"http://cdn.dota2.com/apps/dota2/images/items/\" + item.img;\n}", "title": "" } ]
[ { "docid": "06f59c5e85cbde6a216f2285a3c494a7", "score": "0.7374813", "text": "imageUrl(){\n this._log(`Generate image-url for file ${this.uri}`);\n return `image-url(\"${this.uri}\")`;\n }", "title": "" }, { "docid": "83a95f152c47d7000cfab5bd5bdc5f9f", "score": "0.68277556", "text": "function get_big_image_uri(original_href)\r\n{\r\n /imgurl=([^&]*)/.test(original_href);\r\n return decodeURIComponent(RegExp.lastParen);\r\n}", "title": "" }, { "docid": "77df8d12d249fd01454835c968526819", "score": "0.67126113", "text": "function parseImageURL() {\n\t\t\tvar href = imageArray[0].href;\n\t\t\tvar pos0 = href.lastIndexOf('/') + 1;\n\t\t\tvar pre = href.substring(0, pos0);\n\t\t\tvar post = href.substring(pos0, href.length);\n\t\t\thref = pre + 'm' + post;\n\t\t\treturn href;\n\t\t}", "title": "" }, { "docid": "2c21fcab6448a9fb19355e25c370f6b6", "score": "0.66200006", "text": "function getFlikrImgURL(img) {\n\tlet imgURL = \"\"\n\tif(img) {\n\t\timgURL = `https://farm${img.farm}.staticflickr.com/${img.server}/${img.id}_${img.secret}.jpg`\n\t}\n\treturn imgURL\n}", "title": "" }, { "docid": "fb09f93afc845dfec7e73647e27e8507", "score": "0.65439487", "text": "function getImageURL(path) {\n if (path === null) {\n return noImage\n }\n let url = props.baseImageUrl + 'w342' + path\n return url\n }", "title": "" }, { "docid": "110d51f862b4293c71bf29cbee10d73f", "score": "0.6515594", "text": "function imageURLFromValue(value) {\n if (value === '') {\n return null\n }\n\n var regex = /(https?:\\/\\/.*\\.(?:png|jpg|jpeg))/i\n var matches = regex.exec(value)\n return (matches && matches.length > 1) ? matches[1] : null\n}", "title": "" }, { "docid": "3c6667066ff4ef24f817eabe24fb18bb", "score": "0.6433028", "text": "function getRefImageUrl() {\n return 'http://dantri4.vcmedia.vn/a3HWDOlTcvMNT73KRccc/Image/2013/11/42a-83e38.jpg';\n}", "title": "" }, { "docid": "c177801cb24d21baa71a61f66a8366b5", "score": "0.6402398", "text": "function imageUrl(filename) {\n return \"url(\" + imagesPath() + filename + \")\";\n }", "title": "" }, { "docid": "6cd45080c32145116ae28f758d6cc58f", "score": "0.6396751", "text": "function constructImageURL(photoObj) {\n return \"https://farm\" + photoObj.farm +\n \".staticflickr.com/\" + photoObj.server +\n \"/\" + photoObj.id + \"_\" + photoObj.secret + \".jpg\";\n}", "title": "" }, { "docid": "3432de2fcba6c79f9561d5ad45fc07fc", "score": "0.63945013", "text": "function getImage(url) {\n if (url) {\n var reg = /https:\\/\\//g;\n return url.replace(reg, 'https://images.weserv.nl/?url=')\n }\n}", "title": "" }, { "docid": "d4a472bb3dedbfed620e83c45948f56d", "score": "0.6363082", "text": "function getImageURL(){\t\r\n\ttry{\r\n\t\t//If available get it\r\n\t\treturn xpath(config[location.host].image,document).src;\r\n\t}catch (err){\r\n\t\tconsole.log(\"getImageURL: Not available for [\"+location.href+\"]\");\r\n\t}\r\n\t//Otherwise return \"\"\r\n\treturn \"\";\r\n}", "title": "" }, { "docid": "61def2c59ab83a057b9fa685d0b89bc4", "score": "0.6362559", "text": "function $resolveImageURL(fileURL) {\n const url = this.$parseUrl(fileURL);\n // If we are within the resource system, look up a \"real\" path that can be\n // used by the DOM. If not found, return the path itself without the\n // \"qrc:/\" scheme.\n if (url && (url.scheme === \"qrc:\")) {\n return QmlWeb.qrc[url.fullpath] || url.fullpath;\n }\n\n // Something we can't parse, just pass it through\n return fileURL;\n}", "title": "" }, { "docid": "d4fd75683cb82b237ad8e45cf626318a", "score": "0.6343463", "text": "static image(imageResourcePath) {\r\n ArgumentsValidator_1.ArgumentsValidator.warnIfNullOrUndefined('imageResourceName', imageResourcePath);\r\n return 'res://images/' + imageResourcePath;\r\n }", "title": "" }, { "docid": "6608bee32c26adf55079017eec82b3f7", "score": "0.63336676", "text": "function getImageUrl(images,url){\n\n var final_url=get_thumbnail(images);\n\n if(final_url!=\"\"){\n var parse_image_url=new URL(final_url,true);\n var parse_link_url=new URL(url,true);\n var protocol=parse_link_url.protocol;\n var hostname=parse_link_url.hostname;\n if(validURI(final_url)){\n return final_url;\n }\n if(parse_image_url.protocol){\n return final_url;\n }else{\n final_url=protocol+parse_image_url;\n if(validURI(final_url)){\n return final_url;\n }else{\n final_url=protocol+hostname+parse_image_url;\n return final_url;\n }\n }\n }\n return \"\";\n\n}", "title": "" }, { "docid": "45c63549853c67ce35a9475494e7ed0a", "score": "0.62382233", "text": "function extractImageURL(/**CSSStyleDeclaration*/ computedStyle, /**String*/ property)\n{\n\tlet value = computedStyle.getPropertyCSSValue(property);\n\tif (value instanceof Ci.nsIDOMCSSValueList && value.length >= 1)\n\t\tvalue = value[0];\n\tif (value instanceof Ci.nsIDOMCSSPrimitiveValue && value.primitiveType == Ci.nsIDOMCSSPrimitiveValue.CSS_URI)\n\t\treturn Utils.unwrapURL(value.getStringValue()).spec;\n\n\treturn null;\n}", "title": "" }, { "docid": "bdeb537cb8b46da8ba6d0ed5bfdb94de", "score": "0.6231146", "text": "constructMediaUrl(image, imgSize = \"200x200\"){\n var url = \"\";\n if(image.type == \"image\") {\n url = \"/\"+image.fileDirectory + \"/\"+imgSize+\"/\" + image.filename;\n }else if(image.type == \"document\") {\n url = this.documentIconUrl;\n }else if(image.type == \"video\") {\n url = this.videoIconUrl;\n }else if(image.type == \"audio\") {\n url = this.audioIconUrl;\n }\n return this.baseURL+url;\n }", "title": "" }, { "docid": "d850c4d20456e98f6e479528e720bf6d", "score": "0.6213007", "text": "function image(relativePath) {\n return \"images/\" + relativePath;\n}", "title": "" }, { "docid": "0f753fae24ca9fdd921558b992a357e5", "score": "0.6144345", "text": "createImageLink(image) {\n const imageURL = image.path;\n const imageType = image.extension;\n const imageSize = 'portrait_uncanny';\n const fullURL = `${imageURL}/${imageSize}.${imageType}`;\n\n this.setState({\n imageLink: fullURL\n })\n }", "title": "" }, { "docid": "95387aee448ca7a4da626774f143d276", "score": "0.612386", "text": "function get_image_url(val) {\n if (all_options.image_info_map) {\n var img = all_options.image_info_map[val];\n if (img && img.url)\n return absolutize(img.url);\n }\n\n var chunk = blorbchunks['Pict:'+val];\n if (chunk) {\n if (chunk.dataurl)\n return chunk.dataurl;\n\n var info = get_image_info(val);\n if (info && chunk.content) {\n var mimetype = 'application/octet-stream';\n if (chunk.type == 'JPEG')\n mimetype = 'image/jpeg';\n else if (chunk.type == 'PNG ')\n mimetype = 'image/png';\n var b64dat = encode_base64(chunk.content);\n chunk.dataurl = 'data:'+mimetype+';base64,'+b64dat;\n return chunk.dataurl;\n }\n }\n\n return undefined;\n}", "title": "" }, { "docid": "69a974ea84409e3f3118dd035c0542b5", "score": "0.6079408", "text": "function imageUrl(path) {\n var dataUrl = require('text!cockpit/ui/' + path);\n if (dataUrl) {\n return dataUrl;\n }\n\n var filename = module.id.split('/').pop() + '.js';\n var imagePath;\n\n if (module.uri.substr(-filename.length) !== filename) {\n console.error('Can\\'t work out path from module.uri/module.id');\n return path;\n }\n\n if (module.uri) {\n var end = module.uri.length - filename.length - 1;\n return module.uri.substr(0, end) + path;\n }\n\n return filename + path;\n}", "title": "" }, { "docid": "b9d3a7ea277582f6c385535ba8fc4430", "score": "0.60745454", "text": "generateImageURL() {\n const camera = this._getState(this.cc.id,'unknown');\n this.cs.image = camera.attributes.entity_picture + \"&t=\" + new Date().getTime()\n this.cs.imageBase = camera.attributes.entity_picture\n }", "title": "" }, { "docid": "36300482f817e4d8c23268666f442bd0", "score": "0.60721445", "text": "function getURL(image_data) {\n // TODO: might be better ones than jsQR, this is just most recent (it's bigger)\n let qrCodeRead = jsQR(image_data.data, image_data.width, image_data.height);\n if (qrCodeRead) {\n url = qrCodeRead.data;\n if (isLegalURL(url)){\n return url;\n }\n return 1;\n }\n else {\n return 2;\n }\n}", "title": "" }, { "docid": "52df5875b56c9f21e744f6f21b1c5cf7", "score": "0.6046768", "text": "function mkImgUrl(fs) {\n var fsUrl = '';\n if(fs) {\n fsUrl = fs.replace('/mnt/xfsdata/simg', '');\n }\n return fsUrl;\n }", "title": "" }, { "docid": "36d6afe6b7fc483a9bc48b2b4845382d", "score": "0.60343456", "text": "function image(relativePath) {\n\n\treturn \"../images/\" + relativePath;\n\n}", "title": "" }, { "docid": "bce9fd2c21c53ee35185577af2f71606", "score": "0.60154974", "text": "function urlFor(source) {\n return builder.image(source)\n}", "title": "" }, { "docid": "1ac177853ab1b990f35916d727c4050f", "score": "0.5991263", "text": "function generateFlickrImageUrl(photo) {\n return 'https://farm' + photo.farm + '.staticflickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_q.jpg';\n}", "title": "" }, { "docid": "19947aac244a4b7b2f3dfb6a46661d4b", "score": "0.59562266", "text": "function getPhotoURL(fileref) {\n return fileref ? host + \"/rf/image_wsbtv_large\" + fileref : \"\";\n }", "title": "" }, { "docid": "fdb2d754f801bfe2bd144242450a59ec", "score": "0.5950668", "text": "static imageUrlForRestaurant(restaurant) {\n const representationsURLs = DBHelper.imageRepresentationsPaths(restaurant.photograph);\n return representationsURLs;\n }", "title": "" }, { "docid": "0f05b492e7edb045f242a8c02f1d9238", "score": "0.5942243", "text": "function localImageSrc(originalSrc, tiddler) {\n var type = tiddler.fields.type,\n text = tiddler.fields.text,\n canonical_uri = tiddler.fields._canonical_uri;\n\n if (text) {\n switch (type) {\n case \"image/svg+xml\":\n return \"data:image/svg+xml,\" + encodeURIComponent(text);\n default:\n return \"data:\" + type + \";base64,\" + text;\n }\n } else if (canonical_uri) {\n return canonical_uri;\n }\n return originalSrc;\n }", "title": "" }, { "docid": "091629db78b62094e24a1cfb2e0b0914", "score": "0.5919868", "text": "function ImageURLHelper() {\n\t\tsuperClass.call(this, VOD_IMAGE_PREFIX, COVER_IMAGE_SUFFIX);\n\t}", "title": "" }, { "docid": "cbe95f5eec85293e74f8e92e4f3fe728", "score": "0.5904411", "text": "function buildThumbnailURL(photo) {\n // Thumbnail format: https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg\n return `https://farm${photo.farm}.staticflickr.com/${photo.server}/${photo.id}_${photo.secret}.jpg`;\n }", "title": "" }, { "docid": "2f600e023b77277b2d3516dc0cf099bb", "score": "0.58686465", "text": "function makeImageLink(user_id, image_id, subimage_id) {\n \n // it is bad to use \"image\" here as is\n var res = \"/image/\" + user_id + \"/\"\n \n if (image_id) {\n res += image_id + \"/\"\n \n if (subimage_id) {\n res += subimage_id + \"/\"\n }\n }\n \n return res\n}", "title": "" }, { "docid": "9d7d5f496baab39c36756faf4589e176", "score": "0.58593106", "text": "function checkForImage(pub) {\n if (pub.imageUrl === '') {\n return 'https://images.unsplash.com/photo-1586993451228-09818021e309?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80'\n }\n return pub.imageUrl\n }", "title": "" }, { "docid": "a48d6ca850db7e7b388de16c5ff69f4c", "score": "0.58550835", "text": "function getImageSrc(image) {\n // Set default image path from href\n var result = image.href;\n // If dataset is supported find the most suitable image\n if (image.dataset) {\n var srcs = [];\n // Get all possible image versions depending on the resolution\n for (var item in image.dataset) {\n if (item.substring(0, 3) === 'at-' && !isNaN(item.substring(3))) {\n srcs[item.replace('at-', '')] = image.dataset[item];\n }\n }\n // Sort resolutions ascending\n var keys = Object.keys(srcs).sort(function(a, b) {\n return parseInt(a, 10) < parseInt(b, 10) ? -1 : 1;\n });\n // Get real screen resolution\n var width = window.innerWidth * window.devicePixelRatio;\n // Find the first image bigger than or equal to the current width\n var i = 0;\n while (i < keys.length - 1 && keys[i] < width) {\n i++;\n }\n result = srcs[keys[i]] || result;\n }\n return result;\n }", "title": "" }, { "docid": "9f9448ddad16b988b3096dfe3d567de7", "score": "0.5830623", "text": "function getImageUrl(urlString, shouldEncode) {\n if (CONSTANTS.isRunMode) {\n return shouldEncode ? encodeUrl(urlString) : urlString;\n }\n /*In studio mode before setting picturesource, check if the studioController is loaded and new picturesource is in 'styles/images/' path or not.\n * When page is refreshed, loader.gif will be loaded first and it will be in 'style/images/'.\n * Prepend 'services/projects/' + $rootScope.project.id + '/web/resources/images/imagelists/' if the image url is just image name in the project root,\n * and if the url pointing to resources/images/ then 'services/projects/' + $rootScope.project.id + '/web/'*/\n if (isValidWebURL(urlString)) {\n return urlString;\n }\n if (!isImageFile(urlString)) {\n urlString = 'resources/images/imagelists/default-image.png';\n }\n\n // if the resource to be loaded is inside a prefab\n if (stringStartsWith(urlString, 'services/prefabs')) {\n return urlString;\n }\n\n urlString = getProjectResourcePath($rootScope.project.id) + urlString;\n return urlString;\n }", "title": "" }, { "docid": "b99aae8329e124225e440e73a7e02e9c", "score": "0.5818009", "text": "function GetImagePath(originalImgSrc, imgSetting) {\n var parts = originalImgSrc.split('/');\n parts.splice(parts.length - 1, 0, imgSetting);\n return parts.join('/');\n }", "title": "" }, { "docid": "8b478da9d95ee15b6237b45edab21029", "score": "0.5800881", "text": "function replaceImageUri(responseStr) {\n\t//logger.debug(\"Input: \" + responseStr);\n\t// HACK need to evaluate the external name\n\tvar serverName = \"ec2-54-187-179-165.us-west-2.compute.amazonaws.com\";\n\tvar imgPrefix = \"http://\" + serverName + \":\" + mockServerConfig.serverPort + \"/img/\";\n\tresponseStr = responseStr.replace(/>([a-zA-Z0-9_\\-]*\\.jpg)</g, \">\" + imgPrefix + \"$1<\");\n\t//logger.debug(\"Output: \" + responseStr);\n\treturn responseStr;\n}", "title": "" }, { "docid": "e3adaec17254f722a10ef2ae0e681401", "score": "0.5791725", "text": "url() {\n return urlForImage(this.options)\n }", "title": "" }, { "docid": "6045461975e28d381be0583c15b9fb1e", "score": "0.57892466", "text": "getImage(image){\n if(image != null && image != undefined && image != ''){\n return image.smallImageLocation;\n }\n return imageComing;\n }", "title": "" }, { "docid": "4018f63b223ef669d5b6998faff1c44c", "score": "0.5769676", "text": "imageLink(imgName, ...args) {\n let link = this.imagePath;\n link += imgName;\n if (args.length > 0) {\n for (arg of args) {\n link += arg;\n }\n }\n return link;\n }", "title": "" }, { "docid": "c0fefc31bbf43bf1af0cbead26768979", "score": "0.57381606", "text": "function setImageURL(result, img) {\n img.src = result;\n}", "title": "" }, { "docid": "6f8d29cada4d8baecc893765639d3476", "score": "0.5731877", "text": "function createImageURL(url, mode) {\n var p;\n switch (mode) {\n case TT.imgmodes.base:\n p = \"\";\n break;\n case TT.imgmodes.thumb:\n p = \":thumb\";\n break;\n case TT.imgmodes.small:\n p = \":small\"; // or \"\" cause I think this is default\n break;\n case TT.imgmodes.large:\n p = \":large\";\n break;\n case TT.imgmodes.orig:\n default:\n p = \":orig\";\n }\n\n return url.replace(/:[^\\/]*$|$/, p);\n}", "title": "" }, { "docid": "e85cf281b1b6238338b4c11211b52878", "score": "0.5705596", "text": "getBookImage(book) {\n if (book.imageLinks && book.imageLinks.thumbnail) {\n return `url(${book.imageLinks.thumbnail})`;\n }\n else {\n return \"No Image Available\";\n }\n }", "title": "" }, { "docid": "6ecc633f3a958a06f9106e605c686871", "score": "0.5704189", "text": "createCurrentImageSource() {\n return IMAGE_BASE_URL + this.currentImageUrlNumber + \".jpg\"\n }", "title": "" }, { "docid": "c76a4fcadc47f2a2bd081f1cf0364eca", "score": "0.5692382", "text": "get image() {\n if (this._imageRef) {\n return this._imageRef;\n }\n const {\n width,\n height,\n uri\n } = this;\n this._imageRef = {\n width,\n height,\n uri,\n name: 'test.jpg'\n };\n return this._imageRef;\n }", "title": "" }, { "docid": "2ef972a91ace5fa38e52c9170cbfe8a5", "score": "0.5692293", "text": "function restaurantImageURL() {\n const restaurantImageURLFromAPI = item.restaurant.featured_image;\n if(restaurantImageURLFromAPI) {\n return restaurantImageURLFromAPI;\n } else {\n return './images/donut.jpg' //Put here path to the image placeholder for restaurant without a feature_image value\n }\n }", "title": "" }, { "docid": "2f0e18a6c09d7c286fbb4d15985c1057", "score": "0.56845456", "text": "function encodeImageFileAsURL(element) {\n var file = element.files[0];\n var reader = new FileReader();\n reader.onloadend = function () {\n baseImage = reader.result\n console.log('RESULT', reader.result)\n }\n reader.readAsDataURL(file);\n }", "title": "" }, { "docid": "e2b6a5edb34e6d98af8950d5225bbe06", "score": "0.5679207", "text": "function getImageUrl() {\n return currentPictureUrl;\n}", "title": "" }, { "docid": "b73e81f46aef25a66b2476c04ca67f45", "score": "0.5679045", "text": "function isImage(test) {\n return /(https?:\\/\\/.*\\.(?:png|jpg))/i.test(test);\n }", "title": "" }, { "docid": "ae76df3cc6cc6088b812bf2f4ff3fa49", "score": "0.5676449", "text": "function getImgURL(file){\n\n var reader = new FileReader();\n reader.addEventListener(\"load\", function() {\n var image = new Image();\n image.src = this.result\n preview.setAttribute(\"src\", this.result);\n\n image.onload = function() {\n checkImageSize(image, defText, preview)\n };\n\n uploadedImage = image;\n\n });\n \n reader.readAsDataURL(file);\n return \n}", "title": "" }, { "docid": "2afb7c4405ec174c051d76bb262687ff", "score": "0.5662775", "text": "function getFlikrWebPageURL(img) {\n\tlet pageURL = \"\"\n\tif(img) {\n\t\tpageURL = `https://www.flickr.com/photos/${img.owner}/${img.id}`\n\t}\n\treturn pageURL\n}", "title": "" }, { "docid": "2ea244e3032b1350466bbc65a9321fd6", "score": "0.5660917", "text": "function findURL(url){\n\tvar img = document.createElement('img');\n\timg.src = url; // Set string url\n\turl = img.src; // Get qualified url\n\timg.src = null; // No server request\n\treturn url;\n}", "title": "" }, { "docid": "45b9a8832ac8e57d9c087b691703d6ba", "score": "0.56567943", "text": "function pictureDataUri(rawPicture) {\n const binary = rawPicture.data.reduce((str, code) => str + String.fromCharCode(code), \"\");\n return \"data:\" + rawPicture.format + \";base64,\" + window.btoa(binary);\n}", "title": "" }, { "docid": "af2514c68bbd390a8affaa34eb90080d", "score": "0.5649933", "text": "function getImageURL(str) {\n var strObj = {\n image: false\n };\n if (str !== UNDEF) {\n // Remove the white space at the beginning and end of the string.\n str = str.replace(/^\\s+/, BLANK).replace(/\\s+$/, BLANK);\n // Check whether the string start with \"i-\"\n if (/^i\\s*[\\-]\\s*/i.test(str)) {\n // Remove \"i-\" at the beginning of the string and make image as true\n strObj.image = true;\n strObj.string = str.replace(/^i\\s*[\\-]\\s*/i, BLANK);\n } else {\n // Remove single \"\\\" at the beginning\n strObj.string = str.replace(/^\\\\/, BLANK);\n }\n }\n return strObj;\n}", "title": "" }, { "docid": "ae3c5a05c59878c61df1222f05b8b8ef", "score": "0.5647283", "text": "function getImageUrl(relativeUrl, proxied) {\n var gadgetURL = _args()[\"url\"];\n var baseURL = gadgetURL.replace(/[a-zA-Z0-9_]+\\.xml(\\?.*)?/, \"\");\n return proxied ? gadgets.io.getProxyUrl(baseURL + relativeUrl) : baseURL + relativeUrl;\n }", "title": "" }, { "docid": "06ef7663b421e64e03e757a94822ae99", "score": "0.5635682", "text": "function imgToDataUrl(img) {\n var $img = artoo.$(img);\n\n // Do we know the mime type of the image?\n var mime = imageMimes[getExtension($img.attr('src')) || 'png'];\n\n // Creating dummy canvas\n var canvas = document.createElement('canvas');\n canvas.width = $img[0].naturalWidth;\n canvas.height = $img[0].naturalHeight;\n\n // Copy the desired image to a canvas\n var ctx = canvas.getContext('2d');\n ctx.drawImage($img[0], 0, 0);\n var dataUrl = canvas.toDataURL(mime);\n\n // Clean up\n canvas = null;\n\n // Returning the url\n return dataUrl;\n }", "title": "" }, { "docid": "f44a2f8763fae856cefd9aabce7f5c31", "score": "0.5624998", "text": "function image(node) {\n var self = this\n var content = uri(self.encode(node.url || '', node))\n var exit = self.enterLink()\n var alt = self.encode(self.escape(node.alt || '', node))\n\n exit()\n\n if (node.title) {\n content += space + title(self.encode(node.title, node))\n }\n\n return (\n exclamationMark +\n leftSquareBracket +\n alt +\n rightSquareBracket +\n leftParenthesis +\n content +\n rightParenthesis\n )\n}", "title": "" }, { "docid": "088585c32e8ea5320f111e09667a24a1", "score": "0.56020164", "text": "function getPhotoFilename(image) {\n return path.join(photosDir, image);\n}", "title": "" }, { "docid": "a8bf84616dfda6bc7b7450db476a0e4c", "score": "0.5591522", "text": "getBase64Image(img) {\r\n // This function converts image to data URI\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n var ctx = canvas.getContext(\"2d\");\r\n ctx.drawImage(img, 0, 0);\r\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL\r\n var dataURL = canvas.toDataURL(\"image/png\");\r\n return dataURL;\r\n }", "title": "" }, { "docid": "8e225ea4b91ad9d999ed02fcc63fee39", "score": "0.55787444", "text": "function convertImageUrl(url, width) {\n const prefixS3 = /^https:\\/\\/s3/;\n const prefixBuiltIn = /^\\/image/;\n let rUrl;\n if (prefixS3.test(url)) {\n const cleanUrl = url.split('?')[0].replace('s3.us-west', 's3-us-west');\n rUrl = `https://notion.so/image/${encodeURIComponent(cleanUrl)}`;\n }\n else if (prefixBuiltIn.test(url)) {\n rUrl = `https://notion.so${url}`;\n }\n else {\n rUrl = url;\n }\n if (width) {\n return `${rUrl}?width=${width}`;\n }\n else {\n return rUrl;\n }\n}", "title": "" }, { "docid": "40a3d78b73b50eef08e5b2b787a46190", "score": "0.55712885", "text": "function img(ref, ld) {\r\n\t\tvar imgPath = '';\r\n\t\tif (TB3O.T35 == true) imgPath = (!ld ? localGP + \"img/\" + ref : localGP + \"img/lang/\" + TB3O.lng + '/' + ref); else imgPath = (!ld ? localGP + \"img/un/\" + ref : localGP + \"img/\" + TB3O.lng + '/' + ref);\r\n\t\treturn imgPath;\r\n\t}", "title": "" }, { "docid": "cf62585b152555509ebcaeac027fb628", "score": "0.5566563", "text": "static imgUrlSetForRestaurant(restaurant) {\r\n // workaround for images that have no photograph property.\r\n const fileName = restaurant.photograph || restaurant.id;\r\n const fileExtension = 'jpg';\r\n return `/img/responsive/${fileName}-800-large.${fileExtension} 2x, /img/responsive/${fileName}-400-small.${fileExtension} 1x`;\r\n }", "title": "" }, { "docid": "6955892d2ede0d31d62468f6fd6a79e9", "score": "0.5566214", "text": "function onSuccess(imageURI){\n\t\t$(\"#your-image\").attr(\"src\", imageURI);\n\t\t\n\t}", "title": "" }, { "docid": "63b57bd2bda47c74f247821b27a769bd", "score": "0.5559209", "text": "function getImage(imageUrl) {\n return fetch(imageUrl)\n .then(response => {\n if (response.status === 404) throw new Error('Image not found');\n else if (!response.ok) throw new Error('Other network error');\n return response.blob();\n }).then(myBlob => {\n return convertBlobToBase64(myBlob);\n });\n}", "title": "" }, { "docid": "3d9b1e90fdbd7cdcbb3419c15595f39a", "score": "0.55547714", "text": "function getImgId() {\n const result = window.location.pathname.split('/')[2]\n if ( result != null ){\n return decodeURI(result);\n }\n else{\n return null;\n }\n}", "title": "" }, { "docid": "3f3cd4d657c3874823227d8502191f1b", "score": "0.55530906", "text": "getPathFoto() {\n if (this.state.fields.pathFoto === \"\" || this.state.fields.pathFoto === null)\n return \"assets/images/users/no-image.jpg\";\n return 'https://localhost:44327/' + this.state.fields.pathFoto;\n }", "title": "" }, { "docid": "58550fc51b84e1f18e0dd75e5d52cfda", "score": "0.55520654", "text": "function image(node) {\r\n var self = this\r\n var content = uri(self.encode(node.url || '', node))\r\n var exit = self.enterLink()\r\n var alt = self.encode(self.escape(node.alt || '', node))\r\n\r\n exit()\r\n\r\n if (node.title) {\r\n content += space + title(self.encode(node.title, node))\r\n }\r\n\r\n return (\r\n exclamationMark +\r\n leftSquareBracket +\r\n alt +\r\n rightSquareBracket +\r\n leftParenthesis +\r\n content +\r\n rightParenthesis\r\n )\r\n}", "title": "" }, { "docid": "939f5ccadb3f670d7b78d4fd03bc6483", "score": "0.5528849", "text": "function getImageUrl (d) {\n if (d.acct_type === 'competitive') {\n return d.image_url\n } else if (d.image_url && d.acct_type !== 'competitive') {\n return BASE_IMAGE_URL + d.image_url.substring(d.image_url.lastIndexOf('/'))\n } else {\n return null\n }\n}", "title": "" }, { "docid": "dab155c1c04161cbb841b294c23c5b2f", "score": "0.5522545", "text": "function encodeImageFileAsURL(cb) {\n return function () {\n var file = this.files[0];\n var reader = new FileReader();\n reader.onloadend = function () {\n cb(reader.result);\n }\n reader.readAsDataURL(file);\n }\n}", "title": "" }, { "docid": "cd4c55403350872b57802007acec625e", "score": "0.54937786", "text": "function renderImage(image) {\n return `<img src=\"${image.source}\" alt=\"${image.alternativeText}\" />`;\n}", "title": "" }, { "docid": "d063473d66c12d85c031dd3c93ae824c", "score": "0.5479473", "text": "_getImageUri(piece, color) {\n const isWhite = color === COLORS.WHITE;\n const getFullPath = (path) => this._options.pieceImages.basePath + path;\n switch (piece) {\n case PIECES.PAWN:\n return getFullPath(isWhite ? this._options.pieceImages.whitePawn : this._options.pieceImages.blackPawn);\n case PIECES.KNIGHT:\n return getFullPath(isWhite ? this._options.pieceImages.whiteKnight : this._options.pieceImages.blackKnight);\n case PIECES.BISHOP:\n return getFullPath(isWhite ? this._options.pieceImages.whiteBishop : this._options.pieceImages.blackBishop);\n case PIECES.ROOK:\n return getFullPath(isWhite ? this._options.pieceImages.whiteRook : this._options.pieceImages.blackRook);\n case PIECES.QUEEN:\n return getFullPath(isWhite ? this._options.pieceImages.whiteQueen : this._options.pieceImages.blackQueen);\n case PIECES.KING:\n return getFullPath(isWhite ? this._options.pieceImages.whiteKing : this._options.pieceImages.blackKing);\n }\n return \"\";\n }", "title": "" }, { "docid": "3b57ae068207c01a5464133050ccfdde", "score": "0.54770213", "text": "static imageUrlForRestaurant(restaurant) {\r\n if(!restaurant.photograph) restaurant.photograph = \"10\";\r\n return (`/img/${restaurant.photograph}.jpg`);\r\n }", "title": "" }, { "docid": "e37c4a21a57ed344198964bcca71340c", "score": "0.5475357", "text": "function ptr_to_url(ptr) {\n return `data/imgs/${ptr}.${config[\"imgs-fmt\"]}`;\n}", "title": "" }, { "docid": "d2c20ba878f6d0bfa9818b9ba0864cd5", "score": "0.54601383", "text": "function readURL(input, img) {\n if (input.files && input.files[0]) {\n var reader = new FileReader();\n\n reader.onload = function (e) {\n img.attr('src', e.target.result);\n }\n reader.readAsDataURL(input.files[0]);\n }\n }", "title": "" }, { "docid": "82e7482d8641e81957018a3145b3ec05", "score": "0.5453389", "text": "function getDataUri(url, callback) {\r\n var wchImage = new Image();\r\n wchImage.crossOrigin=\"anonymous\";\r\n wchImage.onload = function () {\r\n var canvas = document.createElement('canvas');\r\n canvas.width = this.width; \r\n canvas.height = this.height;\r\n\r\n canvas.getContext('2d').drawImage(this, 0, 0);\r\n\r\n // Get raw image data\r\n callback(canvas.toDataURL('image/png').replace(/^data:image\\/(png|jpg);base64,/, ''));\r\n\r\n };\r\n\r\n wchImage.src = url;\r\n}", "title": "" }, { "docid": "9c3f41ba64104652be28fb2aa50ec725", "score": "0.5451137", "text": "function setUserImageURL() {}", "title": "" }, { "docid": "06e665919f7b5cc2134c6ed4da74e1c5", "score": "0.54466295", "text": "function getImage(callback) {\n return images.find(req, {\n '_id': piece.aposFavicon.items[0].pieceIds[0]\n }).toObject(function (err, image) {\n if (err) {\n return callback(err);\n }\n // Use the existing resized image closest to 512 pixels\n // wide and tall, without being smaller, as the source image.\n // This addresses a major performance problem encountered\n // otherwise with the favicon module as it resizes the original\n // naively over and over for every conversion it performs\n const sizes = (self.apos.attachments.uploadfs.options.imageSizes || []);\n let size;\n sizes.forEach((s) => {\n if ((s.width > 512) && (s.height > 512)) {\n if ((!size) || (size.width * size.height > s.width * s.height)) {\n size = s;\n }\n }\n });\n const sizeExtension = size ? (size.name + '.') : '';\n let originalPath = '/attachments/' + image.attachment._id + '-' + image.attachment.name + '.' + sizeExtension + image.attachment.extension;\n let tempPath = attachments.uploadfs.getTempPath() + '/' + self.apos.utils.generateId() + '.' + image.attachment.extension;\n\n return attachments.uploadfs.copyOut(originalPath, tempPath, function(err) {\n if (err) {\n return callback(err);\n }\n return callback(null, tempPath);\n });\n\n });\n }", "title": "" }, { "docid": "a73acd4a8567c1f3a0a8753858a37223", "score": "0.54331404", "text": "addImageResourceFromUrl (itemId, owner, filename, url) {\n return fetchImageAsBlob(url)\n .then((blob) => {\n // upload as a resources\n return this.uploadResource(itemId, owner, blob, filename);\n });\n }", "title": "" }, { "docid": "b270d48c6d9fa28d16132ed6723c5d1a", "score": "0.54331195", "text": "readURL() {\n const input = $('#resource-picture').prop('files');\n if (input && input[0]) {\n const reader = new FileReader();\n reader.onload = function(e) {\n $('#image-preview').attr('src', e.target.result);\n };\n reader.readAsDataURL(input[0]); // convert to base64 string\n }\n }", "title": "" }, { "docid": "977e82af7a0095e09531999bf02e370c", "score": "0.54326224", "text": "function imageSrc (size, photo_id, server_id, farm_id, secret){\n /* size is a one-letter code that defines the size of the photo:\n s\tsmall square 75x75\n q\tlarge square 150x150\n t\tthumbnail, 100 on longest side\n m\tsmall, 240 on longest side\n n\tsmall, 320 on longest side\n -\tmedium, 500 on longest side\n z\tmedium 640, 640 on longest side\n c\tmedium 800, 800 on longest side†\n b\tlarge, 1024 on longest side*\n h\tlarge 1600, 1600 on longest side†\n k\tlarge 2048, 2048 on longest side†\n o\toriginal image, either a jpg, gif or png, depending on source format */\n return \"https://farm\" + farm_id + \".staticflickr.com/\" + server_id + \"/\" + photo_id + \"_\" + secret + \"_\" + size + \".jpg\";\n }", "title": "" }, { "docid": "8c96deeeb15bc97dee2398e4df1ed846", "score": "0.5430524", "text": "function getImageDataURL(img) {\n // Create an empty canvas element \n var canvas = document.createElement(\"canvas\");\n\n // Copy the image contents to the canvas \n canvas.width = img.width;\n canvas.height = img.height;\n var ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0);\n var data = canvas.toDataURL(\"image/png\");\n canvas.remove();\n return data;\n }", "title": "" }, { "docid": "ef2a2f6754b3a6cd2afd2fbbad93c83d", "score": "0.5428842", "text": "async function getImageUrl() {\n return new Promise((resolve, reject) => {\n const imageStorageRef = firebaseStorage.ref(\n `images/${Date.now() + selectedImage?.name}`\n );\n // Put image to the storage\n imageStorageRef.put(selectedImage).on(\n \"state_changed\",\n (snap) => {\n let percentage = (snap.bytesTransferred / snap.totalBytes) * 100;\n setImageProgress(percentage);\n },\n (error) => {\n console.log(error.message);\n },\n () => {\n // Get the image download url\n imageStorageRef.getDownloadURL().then((url) => {\n resolve(url);\n });\n }\n );\n });\n }", "title": "" }, { "docid": "5b75af2865dd83f2070ab7848daa7905", "score": "0.5426484", "text": "function setImage(img) {\n if (img === null) {\n return \"media/mainMenu/imageNotFound.jpg\";\n }\n return img;\n}", "title": "" }, { "docid": "52dcbcb31e482b1723303509d3f787cc", "score": "0.5421306", "text": "static imageUrlForRestaurantx1(restaurant) {\r\n if(!restaurant.photograph) restaurant.photograph = \"10\";\r\n return (`/img/${restaurant.photograph}x1.jpg`);\r\n }", "title": "" }, { "docid": "f11b1f0c90453baa27d94c31f1a855fe", "score": "0.54153943", "text": "function getThePicURL(passURI) {\n //console.log(passURI);\n let makeURL = \"https://pokeapi.co/\" + passURI;\n //console.log(makeURL);\n return makeURL;\n}", "title": "" }, { "docid": "561a530d451ad238b9e207bf1564054d", "score": "0.5409265", "text": "function routeImage(folder) {\n\treturn location.origin+'/assets/images/' + folder + '/'\n}", "title": "" }, { "docid": "09d01aa2456b8e6f5a5322a46298d44b", "score": "0.54076385", "text": "function get_container_page_uri(original_href)\r\n{\r\n /imgrefurl=([^&]*)/.test(original_href);\r\n return decodeURIComponent(RegExp.lastParen);\r\n}", "title": "" }, { "docid": "f42b54fbeb9aba7978188b220a2dd4ee", "score": "0.5406717", "text": "function fetchImage (dataImage) {\n return \"data:image/png;base64,\" + dataImage;\n }", "title": "" }, { "docid": "d6eb2aa1042b6d4cd3136bedc54b66d5", "score": "0.5389618", "text": "_urlToImage(url, callback) {\n // if arg is a string, then it's a data url\n var imageObj = new Global_1.glob.Image();\n imageObj.onload = function () {\n callback(imageObj);\n };\n imageObj.src = url;\n }", "title": "" }, { "docid": "497ee214747927a344134648b7b069f1", "score": "0.53895617", "text": "function getImagePath() {\n return currentPicturePath;\n}", "title": "" }, { "docid": "dc0f8d56e7f96658a0d5663533c1823d", "score": "0.5373423", "text": "function getImgUrl(id){\n if (id !== undefined)\n return domain + \"/Drawings/\" + id;\n else return \"\";\n}", "title": "" }, { "docid": "24f2ecc361754e6cc3ea4eb0e1b1a695", "score": "0.535689", "text": "function setImage(product) {\n if (!product.image) {\n if (!product.model_image) {\n return \"https://via.placeholder.com/100\";\n } else {\n return product.model_image;\n }\n } else {\n return product.image;\n }\n}", "title": "" }, { "docid": "93fc33eebec08398faf0bc5beb0ed324", "score": "0.5352419", "text": "function img (uri) {\n var dfr = Q.defer(), img_ = d.createElement('img');\n img_.addEventListener('error', function error (ev) {\n ev.target.removeEventListener(ev.type, error);\n dfr.reject(new Error(uri));\n });\n img_.addEventListener('load', function load (ev) {\n ev.target.removeEventListener(ev.type, load);\n dfr.resolve(ev.target);\n });\n img_.setAttribute('src', uri);\n return dfr.promise;\n}", "title": "" }, { "docid": "f45edebd8579f1c6941e16ac3ea6f5ea", "score": "0.5342403", "text": "function getDataUri(url) {\n return new Promise(resolve => {\n const image = new Image();\n\n image.onload = () => {\n const canvas = document.createElement('canvas');\n canvas.width = image.naturalWidth;\n canvas.height = image.naturalHeight;\n canvas.getContext('2d').drawImage(image, 0, 0);\n resolve(canvas.toDataURL('image/png'));\n };\n\n image.onerror = () => {\n resolve(\n null,\n 'The image failed to load. Reload the page to try again.'\n );\n };\n\n image.crossOrigin = 'Anonymous';\n\n image.src = url;\n });\n }", "title": "" }, { "docid": "8d61640d13011bc7a9be217eb064a21e", "score": "0.5338116", "text": "function viewFullImg(uri){\n\tconst html = `<img src=\"${uri}\">`\n\tdocument.getElementById(\"results\").innerHTML = html;\n}", "title": "" }, { "docid": "81e7326d8ddccbc2541074efd84d318c", "score": "0.5320615", "text": "function image$3(node) {\n var self = this;\n var content = encloseUri(self.encode(node.url || '', node));\n var exit = self.enterLink();\n var alt = self.encode(self.escape(node.alt || '', node));\n\n exit();\n\n if (node.title) {\n content += space$t + encloseTitle(self.encode(node.title, node));\n }\n\n return (\n exclamationMark$6 +\n leftSquareBracket$c +\n alt +\n rightSquareBracket$c +\n leftParenthesis$6 +\n content +\n rightParenthesis$7\n )\n}", "title": "" }, { "docid": "5c57ebaac9a4183325f497305b6f62aa", "score": "0.53158855", "text": "getPhotoURL(url) {\n if (!url) {\n return 'https://media.deseretdigital.com/file/88aa4c1731?resize=width_800&type=png&c=14&a=af527bd9';\n } else {\n const id = url.replace('https://drive.google.com/open?id=', '');\n return 'https://drive.google.com/a/deseretnews.com/uc?export=view&id=' + id;\n }\n }", "title": "" }, { "docid": "f8484e44eb1822328128555f46d83c02", "score": "0.5309837", "text": "function sendImage(URI) {\n\t$.ajax({\n\t\turl : \"../../webapi/summary/image\",\n\t\ttype : \"POST\",\n\t\tdataType : \"text\",\n\t\tcontentType : \"text/plain\",\n\t\tcache : false,\n\t\tdata : \"obsimg,\"+URI,\n\t\tsuccess : function(data) {\n\n\t\t},\n\t\terror : function(xhr, status, error) {\n\t\t\tshowError(msg.obs_errorCouldntSendData + \": \" + error);\n\t\t\tthis_.waiting = false;\n\t\t}\n\t});\n}", "title": "" }, { "docid": "490a5d106c8a635d533a7a629b91cf4c", "score": "0.53068036", "text": "function getSmallImage(item) { return \"http://i.imgur.com/CsJQeOQ.jpg\"; }", "title": "" }, { "docid": "d222ca5b784b8a0f8f7b534d384317a2", "score": "0.53064597", "text": "_getArtistImage(artistUrl) {\n return axios\n .get(artistUrl)\n .then(response => {\n const html = response.data;\n const ogImage = html.match(\n /<meta property=\\\"og:image\\\" content=\\\"(.*png)\\\"/,\n )[1];\n return ogImage.replace(/[\\d]+x[\\d]+/, '{w}x{h}');\n })\n .catch(error => {\n debug('Get Artist Image Failed: %O', error);\n });\n }", "title": "" } ]
a7d3388aa7765b0fcd7c312b813d8b34
reset controlled post or reply form
[ { "docid": "a74426fb06f5cfe053da051cab1ea43e", "score": "0.0", "text": "function formReset(formName = 'newPost', afterPost = null) {\n return {\n type: `RESET_FORM`,\n formName,\n afterPost\n };\n}", "title": "" } ]
[ { "docid": "0fc5ae3a830fade82198f553e3f6df08", "score": "0.7803936", "text": "function resetForm() {\n vm.selectedPostType = vm.postTypes[0];\n vm.postContent = '';\n vm.locationSection = false;\n vm.files = [];\n vm.imageCount = 0;\n vm.formPost.$setPristine();\n clearLink();\n }", "title": "" }, { "docid": "e5be23ee50e5464c1e779375bcd3c99a", "score": "0.7212986", "text": "function resetForm() {\n adForm.reset();\n resetPhoto();\n }", "title": "" }, { "docid": "98588b0bd2ac6127b560e2d9a10d01c0", "score": "0.7206507", "text": "resetPostForm() {\n this.$store.state.postValidateMsg = null\n this.$refs.observer.reset();\n }", "title": "" }, { "docid": "9e7d0e7d1ee4390f88258c6d2b325f0f", "score": "0.71718955", "text": "function resetForm() {\n vm.newQuestion = '';\n }", "title": "" }, { "docid": "f8fc7fbcc8e1fdc7edc6660b23e05e4a", "score": "0.71516365", "text": "function reastform() {\n form.reset()\n}", "title": "" }, { "docid": "b9faf3b7cf69487d4fd93a97bf34e488", "score": "0.71430045", "text": "function reset() {\n form.reset();\n}", "title": "" }, { "docid": "e633e01bc3b6d11dd44b604c09344696", "score": "0.71338934", "text": "resetPostForm() {\n this.setState({\n postModalOpen: false,\n postAuthor: '',\n postTitle: '',\n postCategory: '',\n postBody: '',\n postId: '',\n updatePost: false\n })\n }", "title": "" }, { "docid": "a1ac56619f7a443edfebe334d3e869b6", "score": "0.70797116", "text": "function resetForm() {\n\n}", "title": "" }, { "docid": "6cae74ad8ff3892d926fb86bc0552826", "score": "0.70044905", "text": "function formReset(){\n $(\"#topics-form\").trigger(\"reset\");\n }", "title": "" }, { "docid": "42f8d2bbaf2989dedbada75cda8bef99", "score": "0.6988303", "text": "function resetForm() {\n\t$('#title').val('');\n\t$('#caption').val('');\n\t$('#file').val('');\n\ttoggleDisabled(true);\n\ttoggleZeroState();\n}", "title": "" }, { "docid": "a717a329f570362eec2f8ef480d75d40", "score": "0.6987619", "text": "function resetForm() {\n const formTitle = document.querySelector(\"#title-input\");\n formTitle.value = \"\";\n const formAuthor = document.querySelector(\"#author-input\");\n formAuthor.value = \"\";\n const formPages = document.querySelector(\"#pages-input\");\n formPages.value = \"\";\n const formRead = document.querySelector(\"#read-input\");\n formRead.checked = false;\n const formUnread = document.querySelector(\"#unread-input\");\n formUnread.checked = false;\n}", "title": "" }, { "docid": "e9f84b5c842cabe73e1b0b1f7f21fd36", "score": "0.6952502", "text": "function resetForm () {\n\t\tvar formData = cloneObject(Defaults.form);\n\t\tif ( form.data.id ) {\n\t\t\tformData.id = form.data.id;\n\t\t}\n\t\treplaceForm(formData);\n\t}", "title": "" }, { "docid": "5bf4de65deb8c78888487ee032146aec", "score": "0.68547267", "text": "function resetPresidentForm(){\n anioField.setValue('');\n numeroField.setValue('');\n }", "title": "" }, { "docid": "6966fc6f175638648bb88e2d00973eba", "score": "0.68302536", "text": "function resetForm() {\r\n\t\t$('#txtIdPubId').val(\"\");\r\n\t\t$('#txtIdName').val(\"\");\r\n\t\t$('#txtIdAdd1').val(\"\");\r\n\t\t$('#txtIdAdd2').val(\"\");\r\n\t\t$('#txtIdAdd3').val(\"\");\r\n\t\t$('#txtIdTel').val(\"\");\r\n\t\t$('#txtIdMobile').val(\"\");\r\n\t\t$('#txtIdEmail').val(\"\");\r\n\t\t$('#txtIdNic').val(\"\");\r\n\t\t$('#dp1').val(\"\");\r\n\t\t$('#idGender').val(\"\");\r\n\t\t$('#genderName').val(\"\");\r\n\t\t$('#txtIdNote').val(\"\");\r\n\t\t// $('#txtIdUid').val(dtPublic.fnGetData(aPos, 12));\r\n\t\t$('#txtIdUid').val(stfId);\r\n\t\t$('#notificationId').val(\"\");\r\n\t\t$('#notificationName').val(\"\");\r\n\t\t$('#idNotification').val(\"\");\r\n\t}", "title": "" }, { "docid": "d2b06b9847105e4f7ab0ff5b976bb5f2", "score": "0.6822819", "text": "function resetForm(){\r\n ECostField.reset();\r\n EDateField.reset();\r\n EReasonField.reset();\r\n \r\n }", "title": "" }, { "docid": "3f7765a1c98e217e7cba3bfbc488bc91", "score": "0.680907", "text": "function reset_form(e) {\n $(e.data.selector)[0].reset();\n}", "title": "" }, { "docid": "6fc877a34726a6769935f181ce77f244", "score": "0.68046623", "text": "function reset() {\n $(element).find(\".feedback-panel\").hide();\n resetChoices();\n resetFeedback(scope.choices);\n scope.response = undefined;\n scope.showCorrectAnswerButton = false;\n scope.bridge.viewMode = 'normal';\n scope.bridge.answerVisible = false;\n resetShuffledOrder();\n updateUi();\n }", "title": "" }, { "docid": "32cd41f85ed815c1efc42b6e1bfae1e0", "score": "0.6803994", "text": "function textBoxReset () {\n document.forms[\"articleForm\"].reset()}", "title": "" }, { "docid": "a58029e626da758833fe3fc9acf1ead5", "score": "0.6803772", "text": "function resetForm() {\n $form.find('input[type=\"text\"], input[type=\"number\"]').val('');\n }", "title": "" }, { "docid": "2618345c233f11c80bde9a3f41483c8e", "score": "0.67675346", "text": "function resetForm() {\n\t\tdocument.getElementById(\"photognum\").value = 1;\n\t\tdocument.getElementById(\"photoghrs\").value = 2;\n\t\tdocument.getElementById(\"membook\").checked = false;\n\t\tdocument.getElementById(\"reprodrights\").checked = false;\n\t\tdocument.getElementById(\"distance\").value = 0;\n\t}", "title": "" }, { "docid": "265ce18d4266496c8cd5642b2a09fd8e", "score": "0.67535293", "text": "function resetForm() {\n\t\tvar self = this;\n\n\t\t$('[type=reset]', this.$form).click(function() {\n\t\t\t$('[type=submit]', self.$form).removeClass('btn-success btn-danger');\n\t\t\t$('.control-group', self.$form).removeClass('success error');\n\t\t\t$('input, textearea, select', self.$form).each(function() {\n\t\t\t\t__hideTooltip($(this));\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "cccb5012400fa504572086349a8afccd", "score": "0.67291474", "text": "reset(){\n this.selectedAnswer(null);\n this.answered = false;\n }", "title": "" }, { "docid": "e2986ef5edb906028cd98ba7a4a28ab1", "score": "0.67006415", "text": "resetForm() {\n // this.loadEditForm(this.itemInfo);\n this.itemEditForm.reset();\n }", "title": "" }, { "docid": "f9c64a84695ec229df270877dce95162", "score": "0.66947633", "text": "function resetPage() {\n //remove any text from myMsg\n myMsg.innerHTML = \"\";\n \n //change the class name\n myMsg.className = \"hide\";\n \n //reset the user fields\n userVerb1.value = \"\";\n userAdj1.value = \"\";\n userNoun.value = \"\";\n userVerb2.value = \"\";\n userAdj2.value = \"\";\n userAdj3.value = \"\";\n\n return false;\n }", "title": "" }, { "docid": "2a2d2bc434083b936ab40671ed609f3c", "score": "0.66926736", "text": "clearForm(){\r\n\t\taddModal.title.value = \"\";\r\n\t\taddModal.author.value = \"\";\r\n\t\taddModal.pages.value = \"\";\r\n\t\taddModal.checkbox.checked = false;\r\n\t}", "title": "" }, { "docid": "9d3cfdce527f73ef9891563d55e1bb9f", "score": "0.668533", "text": "function resetModal() {\n\t$(\"#post-title-input-id\").val(\"\").removeClass(\"is-invalid\");\n\t$(\"#post-info-input-id\").val(\"\").removeClass(\"is-invalid\");\n}", "title": "" }, { "docid": "286d1abbdb9fe313e3290feb692407c9", "score": "0.66852874", "text": "__onFormReset() {\n this.value = '';\n }", "title": "" }, { "docid": "d613dcc68188b1f953c6f645793e0bbc", "score": "0.66785604", "text": "function resetForm() {\n try{\n $scope.formData.name = \"\";\n $scope.formData.description = \"\";\n } catch (e) {\n }\n }", "title": "" }, { "docid": "c18dd738d3cc9fa858ab5383a9f2101b", "score": "0.6667907", "text": "function reset() {\n\t\tdoSubmit = true;\n\t\tauthContingency = false;\n\t\turls = {};\n\t\texperiences = {};\n\t\tlisteners = [];\n\t\t\n\t\tresetExperience();\n\t}", "title": "" }, { "docid": "0ceaabaecf999eb49df2e10eef588bae", "score": "0.666669", "text": "function resetForm(e,entryId,response){\n\n if(entryId==\"\" && response.error==false){\n\n jQuery('form').find(\"input[type=text], textarea ,select\").val(\"\");\n jQuery('select').val('')\n jQuery('select').trigger('change')\n jQuery('input:checkbox').removeAttr('checked')\n }\n\n msgClass= (response.error==false)? \"text-success\" :\"text-error\";\n \n jQuery('form').prepend('<div class=\"'+msgClass+'\">'+response.msg+'</div>')\n \n jQuery(\".loading-animator\").remove();\n\n jQuery(e.target).show() ; \n\n jQuery('body,html').animate({\n scrollTop: 0\n }, 800);\n return false;\n\n}", "title": "" }, { "docid": "3b3852fbe681e482441a779e4f3c50ba", "score": "0.6664403", "text": "function resetForm() {\n phoneField.blur();\n nameField.blur();\n phoneField.value = '';\n nameField.value = '';\n currentPerson = null;\n }", "title": "" }, { "docid": "5aab3f3ae11f452058dd57260e94df83", "score": "0.6661688", "text": "handleReset() {\n this.formRef.current.resetFields();\n }", "title": "" }, { "docid": "34852028eac929d67ae636033d104856", "score": "0.6638779", "text": "function resetSharePublicationForm() {\n\t\t\t\t\tctrl.currentIndex = 0;\n\n\t\t\t\t\tctrl.groupsChecked = [];\n\t\t\t\t\tctrl.placesChecked = [];\n\t\t\t\t\tctrl.groupsChatArray = [];\n\t\t\t\t\tctrl.subscribersArray = [];\n\t\t\t\t\tctrl.subscriptionsArray = [];\n\n\t\t\t\t\tctrl.changeMenu('members', 0);\n\t\t\t\t}", "title": "" }, { "docid": "e5f137c8e12c9a15b6dd880acc524590", "score": "0.6631266", "text": "_resetForm(){\n\t\t\tthis.production.id = null;\n\t\t\tthis.set('production.objective',null);\n\t\t\tthis.set('production.minimumTickets',null);\n\t\t\tthis.set('production.limitTickets',null);\n//\t\t\tthis.set('production.productionTime',null);\n\t\t\tthis.set('production.participatInProduction',false);\n\t\t\tvar d = new Date();\n\t\t\tthis.set('production.startOfProduction',d.getTime());\n\t\t\tthis.set('production.userProductionConfigurations',[]);\n\t\t\tthis.set('production.rubricProductionConfigurations',[]);\n\t\t}", "title": "" }, { "docid": "bb8301bd4b4be70fcae22e6682b4a73b", "score": "0.6620874", "text": "_clearForm() {\n\t\t\tthis.data = {};\n\t\t\tthis.render();\n\t\t}", "title": "" }, { "docid": "71f4ba094051539116433d0d1037d0fa", "score": "0.6609431", "text": "function resetPresidentForm(){\n criticidadEventoRadios.setValue('');\n }", "title": "" }, { "docid": "d783e761fd8f48b13c41571e1aa28c49", "score": "0.6597263", "text": "function resetPresidentForm(){\n nombrePlantillaField.setValue('');\n descripcionField.setValue('');\n archivoField.setValue('');\n habilitadoField.setValue('');\n }", "title": "" }, { "docid": "074d72bf4aad7d83f6dd4b5a33c0935d", "score": "0.65971047", "text": "clearFields() {\n //rest the whole form\n document.getElementById('book-form').reset();\n }", "title": "" }, { "docid": "8c9343d5989f89debcd224f5bff06f67", "score": "0.65947604", "text": "function resetForm() {\n\t// Change the form destination (sign-in account)\n\t$('#signInForm').attr('action', 'db/signin.php');\n\t$('#signInForm button[name=\"mainBtn\"]').html('Sign in');\n\n\t// remove headers for the different sections\n//\t$('#requiredHeader').remove();\n//\t$('#optionalHeader').remove();\n\n\t// Hide additional fields (optional and required fields)\n\thideAdditionalFields();\n//\thideRequiredMessage();\n\n\t// Show the registration button\n\t$('#registerNowSection').show()\n\n\t// Hide any notifications\n\t$('#notification').hide();\n\n\t// Empty all the filled in form fields\n\t$('#signInForm')[0].reset();\n $(\".chzn-select\").trigger(\"liszt:updated\");\n\t$('#signInForm input#inputUsername').attr('value', '');\n\n\t// Focus the form on the username field\n\t$('#inputUsername').focus();\n}", "title": "" }, { "docid": "39f315d0f45bf2087524de48fc82c91c", "score": "0.658488", "text": "function resetForm(){\n formulario.reset();\n iniciarApp(); \n}", "title": "" }, { "docid": "e9c4d9be4ccff6018aab6d20ab008e04", "score": "0.65670925", "text": "function clearReplyTextArea() {\n \n $(\"#replyPost\").val('');\n \n \n}", "title": "" }, { "docid": "80c332949c62774e079c696105748a4d", "score": "0.6566152", "text": "function resetForm() {\n document.getElementById('name_subject').value = '';\n document.getElementById('time_subject').value = '';\n}", "title": "" }, { "docid": "3fd9b07c21ed3cf0b9b09a24cbc8e271", "score": "0.6559304", "text": "function resetForm() {\r\n document.getElementById('title').value = '';\r\n document.getElementById('descr').value = '';\r\n}", "title": "" }, { "docid": "d628d6af2ff9b5d5b85ac9b792a60e65", "score": "0.6555065", "text": "function reset() {\n firstNameOk = false;\n lastNameOk = false;\n emailOk = false;\n birthdayOk = false;\n tournamentOk = false;\n cityBtnChecked = false;\n}", "title": "" }, { "docid": "71627a0e97d76f6f1f4e1024e0c93554", "score": "0.6551191", "text": "function resetUpdateForm() {\n\n $('#updateError').remove();\n $('#updateSuccess').remove();\n $('#updateFnameError').text('');\n $('#updateLnameError').text('');\n $('#updateEmailError').text('');\n}", "title": "" }, { "docid": "70df7c5e657c45f3f4a0340e570700ce", "score": "0.6545181", "text": "function reset() {\n $(\"#id\").val(null);\n $(\"#nombre\").val(null);\n $(\"#apellido\").val(null);\n $(\"#edad\").val(null);\n $(\".boton\").hide($(\".boton2\").show());\n \n}", "title": "" }, { "docid": "ac582275657ac0f21048e24eca89c2bc", "score": "0.6540849", "text": "function resetForm()\n{\n changeTownship();\n return true;\n}", "title": "" }, { "docid": "626e6af7457050ee500b351a52f9c008", "score": "0.6538284", "text": "function resetNewLeadForm() {\n var $form = $(\"#newLeadForm\");\n\n $form.find('input[name=\"name\"]').val('');\n $form.find('input[name=\"email\"]').val('');\n $form.find('input[name=\"phone\"]').val('');\n $form.find('input[name=\"address\"]').val('');\n $form.find('input[name=\"postal_code\"]').val('');\n $form.find('input[name=\"city\"]').val('');\n $form.find('input[name=\"newsletter\"]').attr('checked', 'checked');\n $form.find('input[name=\"newsletter_format\"]')[0].checked = true;\n $form.find('input[name=\"newsletter_format\"]')[1].checked = false;\n }", "title": "" }, { "docid": "f1a84e4cdaf27570972e97738a3638f4", "score": "0.65335554", "text": "function resetForm() {\n document.getElementById(\"title\").value = \"\"\n document.getElementById(\"author\").value = \"\"\n document.getElementById(\"pages\").value = \"\"\n document.getElementById(\"read\").checked = false;\n}", "title": "" }, { "docid": "25fa20180eeb48d6540dd5b624425ff7", "score": "0.6532321", "text": "function resetForm(){\n $scope.formData = {\n phrase: '',\n keywords: [],\n location: [],\n domains: ['any'],\n language: 'any',\n proficiency_level: 'any',\n phaseLevels: {\n '1': '0',\n '2': '0',\n '3': '0',\n '4': '0',\n '5': '0'\n },\n other: [],\n age_range: {\n from: 1,\n to: 99\n },\n learning_time: {\n from: 0,\n to: 99\n }\n };\n }", "title": "" }, { "docid": "65d0422b6caae58600cfcee1eb983dda", "score": "0.6514103", "text": "function resetContent() {\n $top.empty();\n $answers.empty();\n $response.empty();\n }", "title": "" }, { "docid": "c97e25d35ed02630866647da8125325e", "score": "0.65122074", "text": "function resetForm(e){\r\n e.preventDefault();\r\n form.reset();\r\n}", "title": "" }, { "docid": "386e7daf9e1fe9d5bb2da89a80c290b0", "score": "0.6502847", "text": "onReset(evt) {\n evt.preventDefault();\n // Reset our form values\n this.usuario.tipoId = \"\";\n this.usuario.id = \"\";\n this.usuario.nombres = \"\";\n this.usuario.apellidos = \"\";\n this.usuario.correo = \"\";\n this.usuario.peso = \"\";\n this.usuario.estatura = \"\";\n\n }", "title": "" }, { "docid": "3c07306c3558644ae7a879b8f692fa29", "score": "0.65009993", "text": "function clearTemplateFieldRequestForm( id ) {\n $( '#templateField_' + id + '_form input[name=rname]' ).val( \"\" );\n $( '#templateField_' + id + '_form textarea' ).val( \"\" );\n $( '#templateField_' + id + '_form select' ).attr( 'selectedIndex', 0 );\n}", "title": "" }, { "docid": "9556547d7adda1383083700996a6ed8f", "score": "0.6493429", "text": "function resetContactForm () {\n $(\"#contactName\").val('');\n $(\"#contactEmail\").val('');\n $(\"#contactSubject\").val('');\n $(\"#contactMessage\").val('');\t\t \n}", "title": "" }, { "docid": "76b708c0f2757fabc571f82a9a044286", "score": "0.6487201", "text": "function resetForms(){\n // Resent the form\n $('#concepts_group textarea').val('');\n $('#concepts_group input').val('');\n $('#add_concepts input').val('');\n\n // restet the concepts added to varable\n concepts = [];\n\n // Remove all added content\n $('.checkbox').remove();\n $('.alert-warning').remove();\n $('.alert-success').remove();\n\n // Ide the form part 2\n $(\"#add_concepts\").hide();\n\n // Show the video\n $('#lesson_video').show();\n // Show the concepts area\n $('#write_concepts_area').show();\n $(\"#write_concepts\").show();\n }", "title": "" }, { "docid": "e1ec42018bb27642a182de17081d470c", "score": "0.64853287", "text": "function resetForm() {\n document.getElementById(\"contact-form\").reset();\n}", "title": "" }, { "docid": "1c64092e76aa6e15a76a932185db6824", "score": "0.6483382", "text": "function formReset(){\r\n\tdocument.getElementById(\"form\").reset();\t//To reset everything\r\n}", "title": "" }, { "docid": "e7476b3bcdd1a910f2acaedeb3b8185b", "score": "0.64813334", "text": "function resetCourseForm(){\r\n CostField.reset();\r\n DateField.reset();\r\n ReasonField.reset();\r\n \r\n }", "title": "" }, { "docid": "f8089c1f28de2c226f5733dfea6afb10", "score": "0.6480939", "text": "function clearAllFields(){\n\tanswerdetailfrm.answerForm.answer.value = \"\";\n\tanswerdetailfrm.answerForm.description.value = \"\";\n}", "title": "" }, { "docid": "d2d2bc0584e7c390c701d86290c0b07c", "score": "0.64767444", "text": "function toDoFormReset() {\n $('#TDFtName').val('');\n $('#TDFdName').val('');\n /* $('input[name=\"radio-priority\"]').prop('checked', false); */\n $('#low[name=\"radio-priority\"]').prop('checked', true);\n toDoForm.hide();\n }", "title": "" }, { "docid": "dd1bb7379ac951188aeb1a37e78f4dad", "score": "0.6471942", "text": "function reset(){\n setCurrentQuestion(0)\n }", "title": "" }, { "docid": "6965a95fa2c1fb11b8821d1debc3635c", "score": "0.64713347", "text": "function resetForm() {\n location.reload();\n}", "title": "" }, { "docid": "42f2f5e6c5c795108f1ee4edddda8a38", "score": "0.6468988", "text": "function resetForm( form ) {\n\tform[0].reset();\n\n\t// delete the skills in the skill table\n\twhile (SKILL_ROW_NO>0) {\n\t\trow_id = \"skill_row\" + SKILL_ROW_NO;\n\t\tdelete_skill_row( row_id );\n\t}\n\n\n\t// reset the resume and video file input\n\tresume_input_initial();\n\tvideo_input_initial();\n}", "title": "" }, { "docid": "aaf09478463e02a3091fe54e0bfaf7c2", "score": "0.6467827", "text": "clearDialogForm() {\n const nameElement = document.getElementById('review-form-name');\n const ratingElement = document.getElementById('review-form-rating');\n const commentElement = document.getElementById('review-form-comment');\n\n nameElement.value = '';\n ratingElement.selectedIndex = 4;\n commentElement.value = '';\n }", "title": "" }, { "docid": "97ba8aad96066e0fe612966b5ef2c9e0", "score": "0.64661723", "text": "function formReset() {\r\n form.reset();\r\n\tform.removeChild(field);\r\n}", "title": "" }, { "docid": "12c0d10839c3666cdd663ad520a9c4c7", "score": "0.64617854", "text": "function ResetContactForm(ev) {\r\n document.getElementById(ev).reset();\r\n}", "title": "" }, { "docid": "e601134fbb9eb89ca42fd730a2d44e20", "score": "0.6457032", "text": "function reset()\n{\n $('#adder').val('default');\n $('#adder-name').val('');\n}", "title": "" }, { "docid": "0b55fb751b728327a3f282f4f23b4738", "score": "0.64554274", "text": "clearForm() {\n\n $(\"#amount_text\").val(\"\");\n shared.addClass(\"amount_required\", \"hide\");\n\n $(\"#type_select\").val(0);\n shared.addClass(\"select_required\", \"hide\");\n\n $(\"#description_textarea\").val(\"\");\n shared.addClass(\"description_required\", \"hide\");\n \n $(\"#receipt_file\").val(\"\");\n }", "title": "" }, { "docid": "a9e85e63e37bd0bfca61b1465598b2ff", "score": "0.64549506", "text": "function reset(){\n formEl.style.display = 'none';\n ChooseUserEl.style.display = 'none';\n ChooseOpEl.style.display = 'none';\n ScoreBoardEl.style.display = 'none';\n startBtnEl.style.display = 'none';\n nextInningBtnEl.style.display = 'none';\n reloadPageBtnEl.style.display = 'none';\n}", "title": "" }, { "docid": "6c50ddb0d7975d55d8ca48c3131bab12", "score": "0.6445937", "text": "function reset() {\n $scope.contact = {\n name: \"\",\n location: \"\",\n email: \"\",\n primary: \"\",\n }\n }", "title": "" }, { "docid": "d53ca31aabf4bf4d2148c76780ef5af6", "score": "0.6436395", "text": "resetForm(){\n this.file=null;\n this.show=false;\n }", "title": "" }, { "docid": "898d960cd47052b749226c78dc3fe1ed", "score": "0.6431579", "text": "handleReset(e) {\n e.preventDefault();\n this.refs.form.resetFields();\n this.setState({\n form: {\n Name: \"\",\n Mark: \"\",\n StartDateTime: \"\",\n EndDateTime: \"\",\n IsPublic: false,\n OrganizationId: \"\"\n }\n });\n }", "title": "" }, { "docid": "a4ec752fd78043c63b551f56a7f30354", "score": "0.642556", "text": "function reset_form($form) {\n $form.find('input:text, input:password, input:file, select, textarea').val('');\n $form.find('input:radio, input:checkbox')\n .removeAttr('checked').removeAttr('selected');\n \n\tg_modify_id = false;\n\t$('#pictures').hide();\n\t$('#file_upload input[type=file]').val('');\n}", "title": "" }, { "docid": "edf6f854c897837f56407009d274f035", "score": "0.64124215", "text": "reset() {\n this.data = Object.assign({}, this.initialData);\n\n this.errors = [];\n this.error = '';\n\n this.isSubmitting = false;\n }", "title": "" }, { "docid": "203361bd741776fbe5e953d6bdeac88c", "score": "0.640567", "text": "resetForm() {\n this.itemAddForm.reset();\n }", "title": "" }, { "docid": "9304e38c84f2eb1442efa920a9210910", "score": "0.64034235", "text": "function reset() {\r\n document.getElementById('myForm').reset();\r\n}", "title": "" }, { "docid": "9a50ec6d21d517e26c1261c4c95b947a", "score": "0.63942397", "text": "function attachPressReviewFormClearingAndRestore() {\n _attachInputClearingAndRestore(\"pressReviewFormEmailDefaultLabel\", \"#press-reviews-subscription-form #email\");\n}", "title": "" }, { "docid": "98e0fbdbf54b0fa142f17ad1f958b4e7", "score": "0.639351", "text": "reset() {\n const field = $(this.element);\n field.wrap('<form>').closest('form').get(0).reset();\n field.unwrap();\n }", "title": "" }, { "docid": "b72e07abfecab31fc8012bd8ee81adc9", "score": "0.63925767", "text": "function formReset(form) {\n $(form)[0].reset();\n}", "title": "" }, { "docid": "b827628016636b6afcff7fd4b336e25c", "score": "0.638759", "text": "function clearTemplateRequestForm( id ) {\n $( '#template_' + id + '_form input#rname' ).val( \"\" );\n $( '#template_' + id + '_form textarea' ).val( \"\" );\n}", "title": "" }, { "docid": "78e782871ef364aa2d7f110947ca5d70", "score": "0.63839895", "text": "function resetCourseForm(){\r\n CatNameField.reset();\r\n TypeField.reset();\r\n CategoriesField.reset();\r\n }", "title": "" }, { "docid": "a61a3e98938cb774b67d911b315c5df1", "score": "0.6378776", "text": "function resetForm($form) {\n\t\t$form.find('input:text, input:password, input:file, select, textarea').val('');\n\t\t$form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');\n\t}", "title": "" }, { "docid": "99b0cd9045b039a4eaa507f65e404320", "score": "0.63729316", "text": "clearForm() {\n let { cancelCommentEdit } = this.props;\n\n this.setState({\n body: '',\n author: ''\n });\n\n cancelCommentEdit();\n }", "title": "" }, { "docid": "dc4e8f23677c31654707a81fc997aaaf", "score": "0.63709533", "text": "function resetForm($form) {\n $form.find('input:text, input:password, input:file, select, textarea').val('');\n $form.find('input:radio, input:checkbox')\n .removeAttr('checked').removeAttr('selected');\n }", "title": "" }, { "docid": "cb6afcaecc001e752956a9b31f9034d9", "score": "0.63690615", "text": "function clearform() {\n $(\"#stu_form\").trigger(\"reset\");\n $(\"#Msg-1\").html(\"\");\n $(\"#Msg-2\").html(\"\");\n $(\"#Msg-3\").html(\"\");\n}", "title": "" }, { "docid": "c9632f6bed7c932da7ddf2c2181430df", "score": "0.63652074", "text": "clearRecipeForm() {\n document.getElementById('recipe-form').reset();\n }", "title": "" }, { "docid": "bdfb2d7c8fffc08ca2b8e96916488f25", "score": "0.6361582", "text": "function resetForm(form) {\n \"use strict\";\n var frm_elements = form.elements,\n field_type;\n for (i = 0; i < frm_elements.length; i += 1) {\n field_type = frm_elements[i].type.toLowerCase();\n switch (field_type) {\n case \"text\":\n case \"password\":\n case \"textarea\":\n case \"hidden\":\n frm_elements[i].value = \"\";\n break;\n case \"radio\":\n case \"checkbox\":\n if (frm_elements[i].checked) {\n frm_elements[i].checked = false;\n }\n break;\n case \"select-one\":\n case \"select-multi\":\n frm_elements[i].selectedIndex = -1;\n break;\n case \"number\":\n frm_elements[i].value = 1;\n break;\n default:\n break;\n }\n \n }\n hideElement(document.getElementById(\"diceSpinLabel\"));\n hideElement(document.getElementById(\"diceLabel\"));\n hideElement(document.getElementById(\"diceSpin\"));\n}", "title": "" }, { "docid": "1454d780b35063efe5fd124c8887164f", "score": "0.6361368", "text": "function reset(){}", "title": "" }, { "docid": "5f43345f0aaf45bcb4bc0e348125c87b", "score": "0.6358055", "text": "function clearform() {\n $(\"#stuform\").trigger(\"reset\");\n $(\"#Msg1\").html(\"\");\n $(\"#Msg2\").html(\"\");\n $(\"#Msg3\").html(\"\");\n}", "title": "" }, { "docid": "d60e25367a415569c4c11d1a51dffaaf", "score": "0.6357802", "text": "function reset(){\n v_formTitle.innerText = 'Agregar Dueño';\n v_btnSubmit.innerText = 'Guardar';\n v_index.value = '';\n v_identificacion.value = '';\n v_nombre.value = '';\n v_apellido.value = '';\n v_pais.value = '';\n}", "title": "" }, { "docid": "a6103f5e9a38df31085fc8fa44e35064", "score": "0.63488406", "text": "function resetForm() {\n p.innerText = '';\n}", "title": "" }, { "docid": "82ce5c7b8181b550520ac446f8c43f3d", "score": "0.63454837", "text": "function reset(){\r\n self.rarity = {\r\n \tid : null,\r\n \tname : ''\r\n };\r\n //$scope.myFormRarity.$setPristine(); //reset Form\r\n }", "title": "" }, { "docid": "c94842340c2ffa9ad644cb7be3d3961b", "score": "0.6335875", "text": "function x() {\r\n document.getElementById(\"newForm\").reset();\r\n return;\r\n }", "title": "" }, { "docid": "6aa5cc1112cf51bfe08a79db8f25f4c2", "score": "0.633577", "text": "function ResetNewQuestionForm() {\r\n\r\n $(\"#dropdown\").empty();\r\n\r\n $(\"#txtQuestion\").val(\"\");\r\n $(\"#txtPointValue\").val(\"\");\r\n $(\"#selectQuestionType\").val(\"null\");\r\n }", "title": "" }, { "docid": "5c509fe0e2c77df706800a2e5584b4dd", "score": "0.6325018", "text": "function resetForm() {\n $('#name').val('');\n }", "title": "" }, { "docid": "b8025ce506c654a89c9337f8b499239c", "score": "0.63229305", "text": "function resetForm() {\n\tgenericResetForm()\n\tenableMap();\n\tenableSectionHeaders();\n\tdisableFormStepLinksSection508()\n\n\t// Make the section skin, exam section invisible.\n\t$(\"#skin-section\").addClass(\"no_display\")\n\t$(\"#skin\").addClass(\"no_display\")\n\t$(\"#physical-section\").addClass(\"no_display\")\n\t$(\"#physical\").addClass(\"no_display\")\n\n\t// Set the form steps so section is the active one.\n makeFormStepsSectionActive(1)\n\n}", "title": "" }, { "docid": "801040011164c9c94e0baf8b49e16611", "score": "0.63228285", "text": "function reset() {\n nombre.value = \"\";\n codigo.value = \"\";\n resetTextArea();\n }", "title": "" }, { "docid": "1280f4b90924de09f58726216c0e8c99", "score": "0.6318996", "text": "function clearform(){\n setTotalOpenAmount();\n setNotes('');\n }", "title": "" }, { "docid": "7dcf19cec944ab23c933aa42816ae7f8", "score": "0.6318885", "text": "function resetHandler() {\n\n\t//deletes all the questions until there is one left on the page\n\twhile (document.getElementsByTagName('select').length != 1) {\n\t\tdocument.getElementById('mainForm').removeChild(document.getElementsByTagName('select')[document.getElementsByTagName('select').length - 1].parentNode.parentNode.lastChild.previousSibling);\n\t}\n\n\t//clears the localStorage\n\tlocalStorage.removeItem(\"choice\");\n\n\t//sets the image to the first array in the Json onject\n\timgEle.setAttribute('src', (dataObj[Object.keys(dataObj)[0]])[0]);\n\n\tvar count = document.getElementsByTagName('h3')[0].childNodes.length;\n\n\t//Reset the textbox\n\tfor(i = 0; i < count; i++) {\n\n\t\tdocument.getElementsByTagName('h3')[0].removeChild(document.getElementsByTagName('h3')[0].firstChild);\n\t}\n\n\n}", "title": "" }, { "docid": "d2725f4d9e07d162ccedba8d009a3490", "score": "0.6318571", "text": "function _reset() {\n $(\"#editor-box input[type=text]\", top.document)\n .val(\"\")\n .attr(\"disabled\", true);\n $(\"#editor-box input[type=checkbox]\", top.document)\n .attr(\"checked\", false)\n .attr(\"disabled\", true);\n $(\"#editor-box input[type=button], #editor-box select\", top.document)\n .attr(\"disabled\", true);\n}", "title": "" } ]
4a255e21d3c0be270905d1d0e11a7648
The actual plugin constructor
[ { "docid": "c6e9d3b89e38135dd7aacda2af5e215a", "score": "0.0", "text": "function Plugin(element, options) {\n this.element = element;\n\n var data = $(element).data();\n\n this.settings = $.extend({}, defaults, data, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "title": "" } ]
[ { "docid": "177a77f7e75111718746a0d9aa6fac07", "score": "0.7915289", "text": "function Plugin() {\n this.init();\n }", "title": "" }, { "docid": "40b07bb5aab78430ef5aa9f5f337754c", "score": "0.75985163", "text": "constructor() {\n\n\n\t\t// initialize after construction\n\t\tthis.init();\n\t}", "title": "" }, { "docid": "ad5ea96df065b5af9c24beb31361c279", "score": "0.7410778", "text": "constructor() {\n super()\n this.init()\n }", "title": "" }, { "docid": "3664ba3504ef155297b04945cba468f1", "score": "0.7402669", "text": "constructor() {\n // declare our class properties\n // call init\n this.init();\n }", "title": "" }, { "docid": "f66ee57414255f4244ad5d088c1767f9", "score": "0.7349132", "text": "constructor() {\n\t\t// ...\n\t}", "title": "" }, { "docid": "b562358b32a42f96ee3ea7e8821a4973", "score": "0.7307621", "text": "constructor() {\n super();\n this.plugins = [];\n }", "title": "" }, { "docid": "9088a0ce43272138d3418cd03c9f8d7a", "score": "0.73003334", "text": "constructor() {\r\n super()\r\n this.init()\r\n }", "title": "" }, { "docid": "4e51ad5707f31184969049a420a95160", "score": "0.72423345", "text": "function Constructor() {\n this.init && this.init.apply(this, arguments);\n }", "title": "" }, { "docid": "f22cb981733d75c2bc34bdb791b93657", "score": "0.72343564", "text": "Constructor(){}", "title": "" }, { "docid": "0186459e4ce622a72f71947a8077227c", "score": "0.7234346", "text": "init() {\n\n\t}", "title": "" }, { "docid": "51cea732847f2da4213977db3b49fecf", "score": "0.7204909", "text": "init() {\n // override me do\n }", "title": "" }, { "docid": "ce596583ba0a20482b08d4c190eb47ef", "score": "0.71798736", "text": "init() { }", "title": "" }, { "docid": "ce596583ba0a20482b08d4c190eb47ef", "score": "0.71798736", "text": "init() { }", "title": "" }, { "docid": "ce596583ba0a20482b08d4c190eb47ef", "score": "0.71798736", "text": "init() { }", "title": "" }, { "docid": "ce596583ba0a20482b08d4c190eb47ef", "score": "0.71798736", "text": "init() { }", "title": "" }, { "docid": "8cac41cff01e0a74ce4c333fcf9b86c2", "score": "0.71496284", "text": "init () {}", "title": "" }, { "docid": "1f8951dc8e007d65f8c777090e63e67b", "score": "0.7141335", "text": "constructor( ) {\n }", "title": "" }, { "docid": "1d1cd2f4d3dd53f90bac1ca0fe1ea6b6", "score": "0.7083413", "text": "constructor() {\n this._initialize();\n }", "title": "" }, { "docid": "aa673006264e5bacc04f2ce45049f24e", "score": "0.7074323", "text": "function IPlugin() {}", "title": "" }, { "docid": "34756a39f585fb7f0636bc1a8eabf528", "score": "0.7073638", "text": "constructor() {\n this._setup(); // DO NOT REMOVE\n }", "title": "" }, { "docid": "750bcf2367b26b42e540c220ceca9e1f", "score": "0.7058465", "text": "constructor () {\n\n\t}", "title": "" }, { "docid": "5f79e3e6029038b568219de138ebda84", "score": "0.70562667", "text": "init(){\n \n\t}", "title": "" }, { "docid": "e35dcaad55ad8e12fd5a61bcd85d99a4", "score": "0.70310766", "text": "init(){}", "title": "" }, { "docid": "b762ba73dbe0c6e8acc47c8b94fa5559", "score": "0.7030667", "text": "function _ctor() {\n\t}", "title": "" }, { "docid": "d137af80c61e1e90ad9432eae8f932d5", "score": "0.7028249", "text": "constructor() {\n }", "title": "" }, { "docid": "e936f5d43518d07c719777223b21571e", "score": "0.70086783", "text": "init()\n {\n\n }", "title": "" }, { "docid": "c8b5ab86038bdb6473d08707aa85ab20", "score": "0.6959452", "text": "constructor() {\n\t}", "title": "" }, { "docid": "c8b5ab86038bdb6473d08707aa85ab20", "score": "0.6959452", "text": "constructor() {\n\t}", "title": "" }, { "docid": "c8b5ab86038bdb6473d08707aa85ab20", "score": "0.6959452", "text": "constructor() {\n\t}", "title": "" }, { "docid": "571fea20efadbf48175fc5efee96a62e", "score": "0.6949666", "text": "constructor() {\n this.init();\n }", "title": "" }, { "docid": "571fea20efadbf48175fc5efee96a62e", "score": "0.6949666", "text": "constructor() {\n this.init();\n }", "title": "" }, { "docid": "571fea20efadbf48175fc5efee96a62e", "score": "0.6949666", "text": "constructor() {\n this.init();\n }", "title": "" }, { "docid": "8e0d47c54af8e39572800bc9124ead10", "score": "0.69295955", "text": "initialize() { }", "title": "" }, { "docid": "6e9a4358c0f350492fc15e4137366ae2", "score": "0.69245833", "text": "function plugin() {}", "title": "" }, { "docid": "1b94b3a325846b0095fe019a0888ba3c", "score": "0.6899119", "text": "initializeInstance() {}", "title": "" }, { "docid": "2850be5a69749990815d13e7df07c510", "score": "0.6874179", "text": "init () {\n\n }", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "2948170530e7f7889e3083545cb3392f", "score": "0.6868699", "text": "init() {}", "title": "" }, { "docid": "a0d8cf5607aaa174293d485d3aa922f1", "score": "0.68628275", "text": "constructor() {\n\n console.debug('constructor')\n\n \n \n\n\n }", "title": "" }, { "docid": "6c653c3c87fcf1c48fc424623bdf5e60", "score": "0.68590206", "text": "constructor() {\n super();\n // TODO\n }", "title": "" }, { "docid": "802fa7c9d67c941c61bead032e96debe", "score": "0.684776", "text": "constructor(opts) {\n return this.init(opts)\n }", "title": "" }, { "docid": "eeebc37542aec21ec0633d6ed1e586b2", "score": "0.6846138", "text": "function Plugin( element, options ) {\n this.element = element;\n this.$element = $(element);\n\n this.options = $.extend( {}, defaults, options) ;\n\n this._defaults = defaults;\n this._name = whackAMole;\n\n this.init();\n }", "title": "" }, { "docid": "3b579384241ef828b3f31db25f3f30b0", "score": "0.68428326", "text": "function Plugin ( element, options ) {\n\t\tthis.element = $(element);\n\t\tthis.settings = $.extend( {}, defaults, options );\n\t\tthis.state = {};\n\t\tthis.init();\n\t}", "title": "" }, { "docid": "0ad684c3f48eed05aa2c050b5a2a9b28", "score": "0.68423617", "text": "init (options) {\n\n }", "title": "" }, { "docid": "1f12e71a458ab949e3cda3a1a6a91cdc", "score": "0.6838742", "text": "function contruct() {\n if (!$[pluginName]) {\n $.isLoading = function (opts) {\n $(\"body\").isLoading(opts);\n };\n }\n }", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.6831462", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.6831462", "text": "initialize() {}", "title": "" }, { "docid": "dfbdc7a3daa3b9223c53834a26dedc70", "score": "0.6831462", "text": "initialize() {}", "title": "" }, { "docid": "c1987c9aad2e560b2c78d1762f366192", "score": "0.6829787", "text": "function init() {\n var _this = this;\n\n this._get('options').plugins.forEach(function (plugin) {\n // check if plugin definition is string or object\n var Plugin = undefined;\n var pluginName = undefined;\n var pluginOptions = {};\n if (typeof plugin === 'string') {\n pluginName = plugin;\n } else if ((typeof plugin === 'undefined' ? 'undefined' : babelHelpers.typeof(plugin)) === 'object') {\n pluginName = plugin.name;\n pluginOptions = plugin.options || {};\n }\n\n Plugin = find(pluginName);\n _this._get('plugins')[plugin] = new Plugin(_this, pluginOptions);\n\n addClass(_this._get('$container'), pluginClass(pluginName));\n });\n }", "title": "" }, { "docid": "62c1b7c30be5bc0d7870a47d540353e5", "score": "0.68177533", "text": "constructor(){\r\n this.initialize();\r\n }", "title": "" }, { "docid": "de58938241555d2fc66b4ec8e0928f02", "score": "0.6817545", "text": "init() {\n }", "title": "" }, { "docid": "de58938241555d2fc66b4ec8e0928f02", "score": "0.6817545", "text": "init() {\n }", "title": "" }, { "docid": "de58938241555d2fc66b4ec8e0928f02", "score": "0.6817545", "text": "init() {\n }", "title": "" }, { "docid": "70404ade03f449221fe1b6a2233c6f49", "score": "0.680774", "text": "init() {\n this._super(...arguments);\n this.setup();\n }", "title": "" }, { "docid": "fb174e1f406f8910b5cb1d3c33103b18", "score": "0.6806985", "text": "function Plugin() {\n\tthis._list = [];\n\tthis._element = null;\n}", "title": "" }, { "docid": "b9359b45bd02826eddbd1b1a6733dcf2", "score": "0.68021107", "text": "constructor(config){ super(config) }", "title": "" }, { "docid": "b9359b45bd02826eddbd1b1a6733dcf2", "score": "0.68021107", "text": "constructor(config){ super(config) }", "title": "" }, { "docid": "b9359b45bd02826eddbd1b1a6733dcf2", "score": "0.68021107", "text": "constructor(config){ super(config) }", "title": "" }, { "docid": "b9359b45bd02826eddbd1b1a6733dcf2", "score": "0.68021107", "text": "constructor(config){ super(config) }", "title": "" }, { "docid": "80fb3b1dbb0217efb1b1f5eef9198b07", "score": "0.67916125", "text": "constructor (cherryInstance) {\n this.options = {}\n this.plugin = null\n this.cherry = cherryInstance\n }", "title": "" }, { "docid": "3fb55c66251bb2823be2ac8a86954f8c", "score": "0.6789295", "text": "constructor() { super(); }", "title": "" }, { "docid": "cd8692cad204a0bb38432ae8273dbd47", "score": "0.67779994", "text": "constructor() {\n //\n }", "title": "" }, { "docid": "cd8692cad204a0bb38432ae8273dbd47", "score": "0.67779994", "text": "constructor() {\n //\n }", "title": "" }, { "docid": "cd8692cad204a0bb38432ae8273dbd47", "score": "0.67779994", "text": "constructor() {\n //\n }", "title": "" }, { "docid": "cd8692cad204a0bb38432ae8273dbd47", "score": "0.67779994", "text": "constructor() {\n //\n }", "title": "" }, { "docid": "fa1554020e1f9c918264cc9b69ff7f10", "score": "0.6775207", "text": "init() {\n\n }", "title": "" }, { "docid": "914ab2bb48d1680891194ac8e984d5d3", "score": "0.67728275", "text": "function Plugin( element, options ) {\n this.element = element; \n this.options = $.extend( {}, defaults, options); \n this._defaults = defaults;\n this._name = pluginName; \n this.init();\n }", "title": "" }, { "docid": "ce8e87c1645953487041076a8f910744", "score": "0.6767588", "text": "function Plugin( element, options ) {\n this.element = element;\n this.options = $.extend( {}, defaults, options) ;\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "title": "" }, { "docid": "0a4bd72d45e5bb622f43f85324b0974f", "score": "0.67647606", "text": "function Plugin( element, options ) {\n this.element = element;\n\t\tthis.$el = $(element);\n\t\tthis.options = $.extend( {}, defaults, options) ;\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "title": "" }, { "docid": "ebbef63f462f426cef58e11671aee1f1", "score": "0.6763879", "text": "function Plugin( element, options ) {\n this.element = element\n this.options = $.extend( {}, defaults, options)\n this._defaults = defaults\n this._name = pluginName\n this.init()\n }", "title": "" }, { "docid": "16af8b75f143e5b423c2770ede961ef1", "score": "0.6762545", "text": "initialize () {\n\n }", "title": "" }, { "docid": "b541d818021bd88cf39418a5b48d9edf", "score": "0.6754769", "text": "constructor() {\r\n\r\n }", "title": "" }, { "docid": "bafc7c8a2b7a19577cf8321ca252b6f4", "score": "0.6728111", "text": "init() {\n this._super(...arguments);\n }", "title": "" }, { "docid": "bafc7c8a2b7a19577cf8321ca252b6f4", "score": "0.6728111", "text": "init() {\n this._super(...arguments);\n }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "9f4cdaeffeae89627614b3b10a716f3d", "score": "0.6727763", "text": "constructor() { }", "title": "" }, { "docid": "53f7dd0c44a90ff6829800ec34c5ed3b", "score": "0.6723855", "text": "function Plugin( element ) { \t\n\t\t\n\t\t//set the name of the plugin\n\t\tthis._name = pluginName;\n\n\t\t//element is accessible here\n\t\tthis.element = element;\n\n\t\t//map the public methods to the plugin\n\t\tthis.publicMethods = publicMethods;\n\n\t\t//set the defaults\n\t\tthis._defaults = $.fn[this._name].options;\n\n\t\t//set options to default\n\t\tthis.options = this._defaults;\n\n\t\t//run init with stock options\n\t\tthis.init( this.options );\n\t}", "title": "" } ]
e6ec36e7c88afd85172ff121eb1088d7
Uploads everything to the db. If an entry is already up in the database, it is skipped.
[ { "docid": "c12f0627a315d54407e1b99d6cc635cb", "score": "0.55934006", "text": "async function insertAll() {\n await insertPublishers(publishers);\n await insertGenres(genres);\n await insertPlatforms(platforms);\n await insertRatings(ratings);\n await insertGames(games);\n}", "title": "" } ]
[ { "docid": "c9066374ed407c3c15d26684457f9614", "score": "0.58375347", "text": "function uploadTransaction() {\n // open\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n // access the store\n const store = transaction.objectStore(\"pending\");\n store.add(record);\n}", "title": "" }, { "docid": "3f458c32c7f1cb6d54b76b4e624a1ca2", "score": "0.5804302", "text": "function insertPostFacebook( data ){\n data.forEach(function(item) {\n fb_post_model.update(\n { id : item.id },\n { $set : item },\n { upsert : true },\n function(err){\n if(err) console.log(err);\n }\n );\n });\n console.log('Save Post Complete : '+data.length);\n}", "title": "" }, { "docid": "df2bffd2aba028a975ceb98f80f6f329", "score": "0.5714455", "text": "function syncEntries(){\n\n // take all entries in webstorage and POST them to the mongo\n\n //then get all the entries back from mongo\n console.log(\"sync ing\");\n $.each(localStorage,function(indexInArray, valueOfElement){\n // console.log(\"syncEntries index:\"+indexInArray+\" voe \"+valueOfElement);\n //localstorage is always a string\n var entry;\n if(valueOfElement)\n entry = JSON.parse(valueOfElement);\n else{\n console.log(\"skipping \"+indexInArray);\n return false;\n }\n //if it doenst have an '_id' that means it has never been into mongo, so add it\n if(!entry._id){\n console.log(\"Found a local\"+JSON.stringify(entry));\n // Use AJAX to post the object to our adduser service\n $.ajax({\n type: 'POST',\n data: entry,\n url: 'http://icefishing.dyndns.org:8080/addentry',\n dataType: 'JSON',\n success: function(msg){\n console.log(\"Post succeeded msg:\"+JSON.stringify(msg));\n },\n error: function(XMLHttpRequest,textStatus,errorThrown){\n /*alert(\"POST error xml:\"+JSON.stringify(XMLHttpRequest)+\" text status:'\"+textStatus+\"' errorThrown:'\"+errorThrown+\"'\");*/\n\t\t\t\t\t\t document.getElementById(\"statusSpan\").innerHTML = \"Push failed! Couldn't connect to server. Running locally\";\n\t\t\t\t\t\t \n }\n }).done(function( response ) {\n //get here if the POST succeeds, 'response' is from backend db\n\n // Check for successful (blank) response\n if (response.msg === '') {\n\n // Clear the form inputs\n // $('#addUser input').val('');\n\n /** old way\n //since we successfully pushed everything, we can now clear the local storage\n //clear the local storage and download a new one\n localStorage.clear();\n $.getJSON( '/entrylist', function(data){\n $.each(data,function(indexInArray,valueOfElement){\n localStorage[indexInArray] = JSON.stringify(valueOfElement);\n // console.log(\"got json, looping\"+indexInArray);\n\n });\n //getJSON is Asynchronous, so it immediatly prints to console and waits to updateTable\n // Update the table (happens after it saves to localStorage)\n //but it must be inside the getJSON callback function\n updateTable(localStorage);\n });\n *** end old way */\n\n //since we pushed succesfully, remove the newly added element from local storage so it doesnt\n //get added twice\n localStorage.removeItem(indexInArray);\n\n //new way is just to call populate table, which takes care of the ajax call\n populateTable();\n document.getElementById(\"statusSpan\").innerHTML = \"Push complete.\";\n\n console.log(\"ajax and mongo success!\");\n }\n else {\n // If something goes wrong, alert the error message that our service returned\n alert('Backend DB Error: ' + response.msg);\n }\n });//end ajax\n }\n });\n\n}", "title": "" }, { "docid": "c155579b08587ffa4e5d47c4e00e93fe", "score": "0.5666094", "text": "function save() {\n\n $meteor.subscribe('recent');\n if (currentUploaded && currentUploaded.length > 0) {\n angular.forEach(currentUploaded, function (value, key) {\n\n\n delete value.$$hashKey;\n $scope.recentUpload.save(value);\n });\n }\n\n }", "title": "" }, { "docid": "1fadd5d53c9acba1884af3997fd82c55", "score": "0.5566558", "text": "function uploadPizza() {\n // open transaction on our db\n const transaction = db.transaction(['new_pizza'], 'readwrite');\n\n // access your objet store\n const pizzaObjectStore = transaction.objectStore('new_pizza');\n\n // get all records from store and set to a variable -> this is an async function that takes time to retrieve all of the data in the store\n const getAll = pizzaObjectStore.getAll();\n\n getAll.onsuccess = function() {\n // if there was data in IndexedDB's store, send it to the api server\n if (getAll.result.length > 0) {\n fetch('/api/pizzas', {\n method: 'POST',\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(serverResponse => {\n if (serverResponse.message) {\n throw new Error(serverResponse)\n }\n // open one more transaction\n const transaction = db.transaction(['new_pizza'], 'readwrite');\n // access the new_pizza object store\n const pizzaObjectStore = transaction.objectStore('new_pizza');\n // clear all items in your store\n pizzaObjectStore.clear();\n \n alert ('All saved pizza has been submitted!');\n })\n .catch(err => {\n console.log(err);\n });\n }\n }\n\n\n}", "title": "" }, { "docid": "1ac7233fa3486058abaf040e04179371", "score": "0.5523583", "text": "async _upload() {\n return;\n console.log('Attempting upload...');\n if (!this.isSignedIn()) {\n console.log('Upload aborted. No user is signed in.');\n return;\n }\n const doc = this._buildDocument();\n if (!doc) {\n console.log('Upload aborted. There is no data to upload.');\n return;\n }\n const success = await this._uploadNewDocument(doc);\n console.log(success ? 'Upload successful.' : 'Upload failed.');\n }", "title": "" }, { "docid": "42e9d86b37cfd90f6e4550c3c3fa664a", "score": "0.55223525", "text": "function checkDatabase() {\n const transaction = db.transaction(\"pending\", \"readonly\");\n const store = transaction.objectStore(\"pending\");\n const getAll = store.getAll();\n // If successful POST the data \n getAll.onsuccess = () => {\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\"\n }\n })\n .then((response) => response.json())\n .then(() => {\n const transaction = db.transaction(\"pending\", \"readwrite\");\n const store = transaction.objectStore(\"pending\");\n // Clear the pending items\n store.clear();\n });\n }\n };\n }", "title": "" }, { "docid": "db422e18ce0dd84fe07637236b10d571", "score": "0.54827857", "text": "async function startUpload() {\n sinceLastAdd = Date.now() - lastUploadAdded;\n if (sinceLastAdd > 250) {\n // Begin uploading the files.\n const belowMax = Object.keys(activeUploads).length < maxUploads;\n const haveUploads = uploadBuffer.length > 0;\n if (belowMax && haveUploads) {\n // Grab uploads from buffer.\n const upload = uploadBuffer.shift();\n if (!(upload.uid in activeUploads)) {\n // Start the upload.\n activeUploads[upload.uid] = new Upload(upload);\n activeUploads[upload.uid].computeMd5();\n }\n }\n }\n}", "title": "" }, { "docid": "5660904be4d3ee5ca92ab97c51e57a6f", "score": "0.54700416", "text": "function uploadTransaction() {\n //open transaction on your db\n const transaction = db.transaction(['new_transaction'], 'readwrite');\n\n //access object store\n const transactionObjectStore = transaction.objectStore('new_transaction');\n\n //get all records from the store and set to a variable\n const getAll = transactionObjectStore.getAll();\n\n //upon a successful .getAll() execution run this fx\n getAll.onsuccess = function () {\n //if there is data in the indexedDb's store then send it to the api server\n if (getAll.result.length > 0) {\n fetch('/api/transaction', {\n method: 'POST',\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(serverResponse => {\n if (serverResponse.message) {\n throw new Error(serverResponse);\n }\n //open one more transaction\n const transaction = db.transaction(['new_transaction'], 'readwrite');\n\n //access new_pizza object store\n const transactionObjectStore = transaction.objectStore('new_transaction');\n\n //clear all items in store\n transactionObjectStore.clear();\n\n alert('All saved transactions have been submitted!');\n })\n .catch(err => {\n console.log(err);\n });\n }\n };\n}", "title": "" }, { "docid": "f69ee69a61613ad3e85573538739dca2", "score": "0.5383421", "text": "function uploadTransaction() {\n // open transaction on db\n const transaction = db.transaction([\"new_transaction\"], \"readwrite\");\n\n // access obj store for `new_transaction`\n const transactionObjectStore = transaction.objectStore(\"new_transaction\");\n\n // get all records from store and set to a var\n const getAll = transactionObjectStore.getAll();\n\n // upon successful .getAll()\n getAll.onsuccess = function () {\n // if there was data in indexedDb's store, send to api server\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n // getAll.result is an array of all data we retrieved from new_transaction obj store\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\",\n }\n })\n .then((response) => response.json())\n .then(() => {\n // open one more transaction\n const transaction = db.transaction([\"new_transaction\"], \"readwrite\");\n // access new_transaction obj store\n const transactionObjectStore = transaction.objectStore(\"new_transaction\");\n // clear all items in store\n transactionObjectStore.clear();\n\n alert(\"All saved transactions have been submitted!\");\n })\n .catch((err) => {\n console.log(err);\n });\n }\n };\n}", "title": "" }, { "docid": "f8db84300409a3c127859632b1da891a", "score": "0.5371131", "text": "async upsert() {\n await this.save(true);\n }", "title": "" }, { "docid": "4423f1f5b44636c84d851f8b37f3c1e0", "score": "0.5322939", "text": "function addTrainToDB () {\n // Checks that all inputs contain valid data\n var newTrain = getValidTrain();\n\n if (newTrain) {\n // Uploads train data to the database\n database.ref().push(newTrain);\n\n // Clears all of the text-boxes\n $(\"#train-name-input\").val(\"\");\n $(\"#destination-input\").val(\"\");\n $(\"#first-time-input\").val(\"\");\n $(\"#frequency-input\").val(\"\");\n } // if (newTrain)\n} // function addTrainToDB", "title": "" }, { "docid": "b35be0d4550d55cd80a68d7eb783f2f7", "score": "0.5317471", "text": "onAfterAddingAll(fileItems) {\n if (fileItems.length > 1) {\n this.artifactoryNotifications.create({error: \"You can only deploy one file\"});\n this.deploySingleUploader.clearQueue();\n return;\n }\n\n let uploadAll = true;\n\n fileItems.forEach((item)=> {\n if (!item.okToUploadFile) {\n uploadAll = false;\n return;\n }\n });\n if (uploadAll) {\n this.deploySingleUploader.uploadAll();\n }\n else {\n return;\n }\n }", "title": "" }, { "docid": "011f04ee09027e0fc70a51216d4f3d4f", "score": "0.5301588", "text": "function upload(db){\n db.executeSql('SELECT * FROM DosageData', [], function (db, results) {\n var len = results.rows.length, i;\n for (i = 0; i < len; i++) {\n var data = results.rows.item(i);\n // Code to submit data to remote server (Turned off for time being because online submission currenlty isn't working)\n /*$.ajax({\n type:\"POST\",\n url:\"dosage.php\",\n dataType:\"json\",\n data: data.serialize(),\n success:completion()\n });*/\n }\n db.executeSql('DROP TABLE IF EXISTS DosageData');\n //alert(\"Database will be dropped\");\n db.executeSql('CREATE TABLE IF NOT EXISTS DosageData (date, urName, cltName, serv, othr, who, how, hrs, min)');\n //alert(\"New database created\")\n htmlstring = '';\n });\n}", "title": "" }, { "docid": "c8b922bd1b65a243a0a3dd2d608c4a6a", "score": "0.528715", "text": "function submit() {\n var imageCount = $$(\"input.uploadBtn\")[0].files.length;\n if ((imageCount != null) && (imageCount > 0)) {\n console.log(\"saveImagesAndPost\");\n saveImagesAndPost(data);\n } else {\n // now user must post things with a photo!\n // console.log(\"saveOnlyPost\");\n // savePost(data);\n myApp.hideIndicator();\n myApp.alert('You need to pick a photo for this post. :(', 'Error');\n }\n }", "title": "" }, { "docid": "7115ca0f14722ad41efc4e03b715163f", "score": "0.528168", "text": "function prepareSavedJobsSubmit()\r\n{\t\r\n localDatabaseInstance = openDatabase(\"PMP Database\", \"1.0\", \"PMP Database\", 200000);\r\n localDatabaseInstance.transaction(function querySavedJobs(tx) {\r\n tx.executeSql('SELECT * FROM JOBSUBMIT', [], submitSavedJobs, function(err){\r\n console.log(\"No Outstanding jobs found in database\");\r\n //clearInterval(submitJobsCron);\r\n // table does not exists for jobs\r\n prepareSavedDeliveryChecksSubmit();\r\n });\r\n });\r\n}", "title": "" }, { "docid": "ff01eb12a051e87a34d13c2e77929381", "score": "0.5275023", "text": "function finishUp(){\n\tpostsRef.on('value', function(snapshot){\n\t\tvar fireBaseCount = snapshot.numChildren();\n\t\tconsole.log('TWEETS IN FIREBASE' + fireBaseCount);\n\t\tclearAllArrays();\n \t});\n }", "title": "" }, { "docid": "a46aad6248171511073b36f573e08f48", "score": "0.52732384", "text": "submit(data) {\n const imageUrl = this.state.image;\n const image = imageUrl;\n const { title, price, location, category, description } = data;\n const owner = Meteor.user().username;\n const date = this.date.toLocaleDateString('en-US');\n Items.insert({ title, price, location, image, category, description, owner, date }, this.insertCallback);\n }", "title": "" }, { "docid": "fb480d55c544b2e29d11c781e5a93251", "score": "0.52718925", "text": "async function insertAvails(){\n const avails = await getAvail();\n await asyncForEach(avails, async(availability) =>{\n await db('availability').insert({availability})\n })\n}", "title": "" }, { "docid": "f37bbc5e6f71d6182f77f5f23eee107d", "score": "0.5257408", "text": "async uploadToStorage(hooks = {}) {\n const {onStartUploading} = hooks\n\n try {\n // for as long as we are uploading, keep pinging our server every 25 minutes so it stays awake\n // (sleeps after 30 minutes)\n // (hopefully we upload faster than 25 minutes, but assuming large files and slow internet)\n formActions.pingHobbyServer() \n this.wakeupInterval = setInterval(formActions.pingHobbyServer(), 25*60*1000)\n\n // set to status uploading, and persist for the first time\n this.logEvent(TRANSCRIPTION_STATUSES[0], {skipPersist: true}) // uploading\n await this.updateRecord()\n onStartUploading && onStartUploading(this)\n\n await this._upload()\n const fileMetadata = this.getRequestPayload()\n return fileMetadata\n \n } catch (err) {\n console.error(`Failed uploading file ${this.filename} to cloud storage`, err)\n throw err\n\n } finally {\n // stop pinging server\n clearInterval(this.wakeInterval)\n }\n }", "title": "" }, { "docid": "a2161d24670ae9cba9c930cdd771f00f", "score": "0.52546585", "text": "function uploadAll() {\n\t// 1. let's get a list of all the files that the user has.\n\tvar allFiles = getFiles(siteFolder, gottenAllFiles)\n\t\n\tvar gottenFiles = 0\n\tfunction gottenAllFiles(allFiles) {\n\t\tgottenFiles += 1\n\t\tif(gottenFiles > 1) {\n\t\t\tconsole.error('gotten all files was called multiple times, RIP')\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// strip the site folder\n\t\tfor(var i=0; i<allFiles.length; i++) {\n\t\t\tvar file = allFiles[i]\n\t\t\tfile.stripped = stripBegin(file, siteFolder)\n\t\t}\n\t\t\n\t\tuploadFiles(allFiles)\n\t}\n\t\n\tfunction uploadFiles(allFiles) {\n\t\tvar api = new neocities(config.username, config.password)\n\t\t\n\t\tvar uploadApiArr = []\n\t\tfor(var i=0; i<allFiles.length; i++) {\n\t\t\tvar file = allFiles[i]\n\t\t\tif(file.isDir){continue} // skip folders\n\t\t\tuploadApiArr.push({name: file.stripped, path: file.fullPath})\n\t\t}\n\t\t\n\t\t// Upload the files.\n\t\tapi.upload(uploadApiArr, function(resp) {\n\t\t\tconsole.log(resp)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "051375e441007bfc3ef6389a4b2f5909", "score": "0.52487576", "text": "uploadAll(endpoint, options) {\n const items = this.queue.filter(item => (item.isReady));\n if (!items.length) {\n return;\n }\n for (const item of items) {\n item.upload(endpoint, options);\n }\n }", "title": "" }, { "docid": "33ce7d74c1ac0678806b89d15f8cf5ac", "score": "0.52444124", "text": "function loopRunUpload() {\n if (Object.values(users).every(x => x.updating == false)) running = false;\n else {\n running = true;\n handleAppDataUpdating(Date.now(), loopRunUpload);\n }\n}", "title": "" }, { "docid": "19ab5e59cb04ed5c42d08d10d1745dfe", "score": "0.524434", "text": "async function insertAnimals() {\n const animals = await getTestAnimals();\n await asyncForEach(animals, async (animal) => {\n delete animal.disposition\n delete animal.breeds;\n delete animal.type;\n delete animal.availability;\n await db('animals').insert(animal)\n })\n\n}", "title": "" }, { "docid": "c25d8e1e69d7120e502c21d15f396391", "score": "0.5234623", "text": "writePostData(post, isNewPost) {\n let event,\n storageRef = this.storage.ref().child(post.id),\n data = {\n title: post.title,\n start: post.start,\n end: post.end,\n category: post.category,\n faculty: post.faculty,\n userId: post.userId,\n favourites: post.favourites,\n };\n if (isNewPost) {\n //storing new post -> currentPostNum increases\n currentPostNum++;\n event = new Event(Config.FIREBASE_DB.EVENT.NEW_POST_STORED_IN_DB, post);\n } else {\n //updating a post\n event = new Event(Config.FIREBASE_DB.EVENT.POST_UPDATED_IN_DB, post);\n }\n storageRef.put(post.file).then(() => {\n this.database.collection(\"posts\").doc(post.id).set(data).then(\n () => {\n this.notifyAll(event);\n });\n }).catch(() => {\n if (event.type === Config.FIREBASE_DB.EVENT.NEW_POST_STORED_IN_DB) {\n //storing new post failed -> currentPostNum decreases\n currentPostNum--;\n }\n sendError(this, Config.DB_ADD_ERROR);\n });\n }", "title": "" }, { "docid": "a2153dae9f0d7666b2dff0d980efd1fc", "score": "0.5198967", "text": "function uploadTrackToDB(\n article,\n hash,\n playlistID,\n articleOrder,\n playlistTitle\n) {\n //console.log(\"upload track id is: \" + playlistID);\n\n var readableTrackStream = fs.createReadStream(__dirname + \"/uploads/\" + hash);\n\n let bucket = new mongodb.GridFSBucket(db, {\n bucketName: \"tracks\"\n });\n\n let uploadStream = bucket.openUploadStream(hash);\n\n let id = uploadStream.id;\n\n readableTrackStream.pipe(uploadStream);\n\n uploadStream.on(\"error\", () => {\n return res.status(500).json({ message: \"Error uploading file\" });\n });\n\n uploadStream.on(\"finish\", () => {\n var articleObject = {\n uid: hash,\n order: articleOrder,\n headline: article.title,\n // abstract: article.description,\n abstract:\n article.description != null ? article.description : article.title,\n publisher: article.source.name != null ? article.source.name : \"CNN\",\n // media: article.urlToImage,\n media:\n article.urlToImage != null\n ? article.urlToImage\n : playlistImagesSources.getArticleSplashMedia(playlistTitle),\n publishedOn:\n article.publishedAt != null\n ? new Date(article.publishedAt)\n : Date.now(),\n audioTrackID: id,\n url: article.url\n };\n\n //save to mongodb\n var articleToSave = new Article(articleObject);\n\n console.log(\n \"Generating track for playlist with title\",\n playlistTitle,\n \"for article #\",\n articleObject.uid\n );\n // console.log(prettyPrintJSON(articleObject));\n\n articleToSave.save(function(error) {\n if (error) {\n console.error(error);\n }\n\n //save articleIDs to playlistdb docs\n Playlist.findOne({ id: playlistID }, function(err, doc) {\n if (doc != null) {\n doc.articles.push(articleObject);\n doc.save(function(err) {\n if (err) {\n console.error(\"ERROR! Playlist ID is \" + id + \" \" + err);\n }\n });\n }\n });\n });\n });\n}", "title": "" }, { "docid": "4c529ee9a78cdca9340ac4edfc7bbf25", "score": "0.51956916", "text": "function uploadTransaction(){\n console.log('uploading transaction')\n // open a transaction on your db\n const transaction = db.transaction(['new_budgetTransaction'], 'readwrite');\n\n // access your object store\n const transactionObjectStore = transaction.objectStore('new_budgetTransaction');\n\n // get all records from store and set to a variable\n const getAll = transactionObjectStore.getAll();\n\n // upon a successfull getAll(), run this function\n getAll.onsuccess = function (){\n // if there was a data in indexedDb's store, send to api server\n if (getAll.result.length > 0){\n fetch('/api/transaction', {\n method: 'POST',\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(serverResponse => {\n if (serverResponse.message) {\n throw new Error(serverResponse);\n }\n // open one more transaction\n const transaction = db.transaction(['new_budgetTransaction'], 'readwrite');\n // access the new_transaction object store\n const transactionObjectStore = transaction.objectStore('new_budgetTransaction');\n // clear all items in your store\n transactionObjectStore.clear();\n\n alert('All saved transactions has been submitted');\n })\n .catch(err => {\n console.log(err)\n })\n }\n }\n}", "title": "" }, { "docid": "d89688c4b4966e8e72fed46c1d9900e2", "score": "0.5192428", "text": "async function seed() {\n try{\n await db.sync({ force: true }); // clears db and matches models to tables\n console.log('db synced!');\n\n // Creating Users\n await Promise.all(\n Users.map((user) => {\n return User.create(user);\n })\n );\n\n await Promise.all(\n Projects.map((project) => {\n return Project.create(project);\n })\n );\n\n console.log(`seeded ${Users.length} users`);\n console.log(`seeded successfully`);\n console.log(`seeded ${Projects.length} projects`);\n console.log(`seeded successfully`);\n } catch (e) {\n console.log(e);\n }\n}", "title": "" }, { "docid": "e1263faa50726c73b85f05b64fba2265", "score": "0.5188422", "text": "async writeDB(data) {\n //if (!this.dbHasSynced) return false;\n\n // Input validation code here.\n\n return await this.db.add(data);\n }", "title": "" }, { "docid": "6bb58d17de3de44e0b5a5aff0fe7fad6", "score": "0.5185865", "text": "function doSave() {\n pendingSave = null\n if (dirty && !pendingPost) doPostContent()\n }", "title": "" }, { "docid": "fe9a58d9eeb84de3a4771661281900fa", "score": "0.5180397", "text": "function insertDbEntry() {\n dbReactions.insert( { messageID: messageContent.id, roleID: roleArray, reactionID: reactionArray }, error => {\n if (error) return logger.error(intLang('utilities.neDB._errors.insertUnsuccessful', 'messageReaction', 60));\n return message.reply(intLang('commands.messageReaction.responses.insertDbEntrySuccessful'));\n });\n\n // Remove all user and setup messages after 5 seconds\n removeMessages(null, 5000);\n }", "title": "" }, { "docid": "07bc1f46a328a3785bd9e90c54244018", "score": "0.5165193", "text": "function checkDatabase() {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const pendingStore = transaction.objectStore(\"pending\");\n const getAllPending = pendingStore.getAll();\n\n\n //if anything in indexedDB, send to cloud DB\n getAllPending.onsuccess = function () {\n if (getAllPending.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAllPending.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\"\n }\n })\n .then(response => response.json())\n //clear indexedDB now that data is in cloud\n .then(() => {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const pendingStore = transaction.objectStore(\"pending\");\n pendingStore.clear();\n })\n .catch((err) => {\n console.log(err);\n });\n }\n };\n}", "title": "" }, { "docid": "e3955e2cc1c8ba5eddf9597f5ce4d89d", "score": "0.51641065", "text": "function checkDatabase() {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const store = transaction.objectStore(\"pending\");\n const getAll = store.getAll();\n\n getAll.onsuccess = function() {\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\"\n }\n })\n .then(response => response.json())\n .then(() => {\n \n const transaction = db.transaction([\"pending\"], \"readwrite\");\n \n const store = transaction.objectStore(\"pending\");\n\n store.clear();\n });\n }\n };\n}", "title": "" }, { "docid": "094e8833a04680cbb3941f0de10d616a", "score": "0.5161093", "text": "async function seedDB() {\n try {\n await Brother.deleteMany(\n { email: { $ne: '[email protected]' } },\n );\n console.log('Removed all members from DB excluding Webmaster Admin');\n await Merit.deleteMany();\n console.log('Removed all merits from last semester from DB');\n\n await populateDBWith(actives, BrothersTypeEnum.ACTIVES);\n await populateDBWith(alumni, BrothersTypeEnum.ALUMNI);\n await populateDBWith(pledges, BrothersTypeEnum.PLEDGES);\n await turnPrevPledgesActive(PREVIOUS_PLEDGE_CLASS);\n await updatePositions(officers);\n } catch (error) {\n return console.error('Error:', error);\n }\n console.log('\\nDB SEED DONE!');\n}", "title": "" }, { "docid": "487f85bf3ed9d50bf5bd91e7aa6d294e", "score": "0.5146022", "text": "async function insertAnimalAvail() {\n await db('animal_availability').insert({ animal_id: 1, availability_id: 2 });\n await db('animal_availability').insert({ animal_id: 2, availability_id: 3 });\n await db('animal_availability').insert({ animal_id: 3, availability_id: 1 });\n await db('animal_availability').insert({ animal_id: 4, availability_id: 3 });\n}", "title": "" }, { "docid": "d50d048f49b9ef52e264a925f5920ce4", "score": "0.51371646", "text": "function go() {\n if(part.locked) {\n return;\n }\n part.submit();\n Numbas.store.save();\n }", "title": "" }, { "docid": "a5f587dd84805bce813bb355016ac84d", "score": "0.51134276", "text": "function postEntries(username) {\n console.log('Seeding notes/journal-entry db records');\n\n const dbQueries = [];\n for (let i = 0; i < 10; i++) {\n dbQueries.push(\n Entry.create(generateEntry(username))\n .then(entry => UserAccount\n .findOne({ username })\n .exec()\n .then(user => {\n user.posts.push(entry._id);\n return user.save();\n })));\n }\n return Promise.all(dbQueries);\n}", "title": "" }, { "docid": "9d584f6f49b59a9425e30fc18437581b", "score": "0.51068556", "text": "async function upload(req) {\n try {\n let result = await streamUpload(req);\n const thisArtist = await db.artist.findOne({\n where: {userId: req.user.id}\n })\n const newWork = await thisArtist.createWork({\n imageFile: result.url,\n title: req.body.title,\n yearCreated: req.body.yearCreated,\n description: req.body.description,\n discipline: req.body.discipline,\n })\n\n const thisUser = await db.user.findOne({\n where: {id: req.user.id}\n })\n\n const addedWork = await thisUser.addWork(newWork)\n\n res.redirect(`/artists/${thisArtist.id}`)\n } catch (err){\n console.log(err)\n }\n }", "title": "" }, { "docid": "1d2536193d0045013efcfd304a937041", "score": "0.51064235", "text": "async save() {\n\t\tconst title = this.title;\n\t\tif (!this.title) {\n\t\t\twinston.error(`Error ingesting Collection ${this.repoLocal}`);\n\t\t\treturn false;\n\t\t}\n\n\t\tconst collection = await Collection.create({\n\t\t\ttitle: title.slice(0, 250),\n\t\t\trepository: this.repoRemote,\n\t\t\turn: this.urn,\n\t\t});\n\n\t\t// ingest all textGroups\n\t\tfor (let i = 0; i < this.textGroups.length; i += 1) {\n\t\t\tawait this.textGroups[i].save(collection); // eslint-disable-line\n\t\t}\n\n\t\t// ingest all works and textnodes\n\t\tfor (let i = 0; i < this.works.length; i += 1) {\n\t\t\tawait this.works[i].generateInventory(collection); // eslint-disable-line\n\t\t}\n\t}", "title": "" }, { "docid": "2d08cfb7aa6ed7b178bb991f22e255ef", "score": "0.5094858", "text": "function onceClear(err) {\n if(err) console.log(err);\n\n // loop over the projects, construct and save an object from each one\n // Note that we don't care what order these saves are happening in...\n var to_save_count = achievements.length;\n for(var i=0; i<achievements.length; i++) {\n var json = achievements[i];\n var proj = new models.Achievement({\n \"_id\" : i,\n \"name\" : json['name'],\n \"description\" : json['description']\n });\n\n proj.save(function(err, proj) {\n if(err) console.log(err);\n\n to_save_count--;\n console.log(to_save_count + ' left to save');\n if(to_save_count <= 0) {\n console.log('DONE');\n\n //Set all Users to have only first achievement\n models.User.find().update({\"achievements\" : [0]}).exec(function(err, result) {\n // The script won't terminate until the \n // connection to the database is closed\n mongoose.connection.close()\n });\n }\n });\n }\n}", "title": "" }, { "docid": "96124030992f66d6197304f218892798", "score": "0.50918925", "text": "async save(url) {\n if (this.currentRecord == null) return;\n\n // need to delete the reactive observer for db insertion/update\n let model = cloneDeep(this.model);\n delete model.__ob__;\n\n // for items with their own table that are linked with a dossier\n // need to append the dossier id for table joins\n if (this.isSubmission && (url === 'file' || url === 'document' || url === 'dossier' )) {\n model._dossier = this.dossierid;\n }\n\n // updating an existing item\n if ('_id' in model) {\n if (this.isSubmission) {\n try {\n let result = await BackendService.updateAppData(url, model);\n this.updateCurrentRecord(result);\n if (url === 'file' || url === 'document') {\n console.log('here');\n // set records that match this dossier\n await this.getSubmissionDataAll({url, dossierid: this.dossierid});\n }\n this.mapStateToModel();\n this.showMessage(this.$t('UPDATE_SUCCESS'));\n }\n catch(err) {\n this.showMessage(this.$t('UPDATE_FAILURE'));\n }\n }\n\n // global app data update\n else {\n try {\n let result = await this.updateAppData({url, model});\n this.updateCurrentRecord(result);\n if (this.hasRecords(url)) {\n this.getAppDataAll({url});\n }\n this.mapStateToModel();\n this.showMessage(this.$t('UPDATE_SUCCESS'));\n }\n catch(err) {\n this.showMessage(this.$t('UPDATE_FAILURE'));\n }\n }\n }\n\n // else we need to create a new record\n else {\n // NOTE: if the model has a _dossierid field, it will be used to save\n // to correct table\n // if (this.isSubmission) {\n\n // }\n // else {\n\n // }\n this.createAppData({url, model})\n .then(record => {\n this.updateCurrentRecord(record);\n this.mapStateToModel();\n this.showMessage(this.$t('SAVE_SUCCESS'));\n })\n .then(async () => {\n if (this.isSubmission) {\n await this.getSubmissionDataAll({url, dossierid: this.dossierid});\n }\n else if (this.hasRecords(url)) {\n await this.getAppDataAll({url});\n }\n })\n .catch(err => {\n this.showMessage(this.$t('SAVE_FAILURE'));\n console.error(err);\n });\n }\n }", "title": "" }, { "docid": "0e6af4f868021643bb3a2a6f1323433f", "score": "0.50785697", "text": "function updateDB() {\n for (const table of Object.keys(data.pendingChanges)) {\n for (const row of Object.keys(data.pendingChanges[table])) {\n // POST pending changes with ID = null as INSERT requests; update ID to 'pending'\n if (data.pendingChanges[table][row].idaction == null) {\n postAction(table, row);\n data[table][row].idaction = 'pending';\n } else { // handle updates\n if (data.pendingChanges[table][row].idaction === 'pending') {\n // update id in change list with id from table\n data.pendingChanges[table][row].idaction = data[table][row].idaction;\n }\n // Handle UPDATE queries\n if (data.pendingChanges[table][row].idaction !== 'pending') {\n postAction(table, row);\n }\n }\n }\n }\n}", "title": "" }, { "docid": "518b5044e12f63f3750c43157cbfdd7a", "score": "0.5077501", "text": "uploadNewPic(pic, thumb, fileName, text) {\n console.log(\"uploadNewPic\");\n // Get a reference to where the post will be created.\n const newPostKey = this.database.ref('/posts').push().key;\n\n console.log(\"New-post-key: \", newPostKey)\n console.log(\"upload-path: \", `${this.auth.currentUser.uid}/full/${newPostKey}/${fileName}`);\n // Start the pic file upload to Cloud Storage.\n console.log(1);\n const picRef = this.storage.ref(`${this.auth.currentUser.uid}/full/${newPostKey}/${fileName}`);\n console.log(2);\n const metadata = {\n contentType: pic.type,\n };\n console.log(3);\n const picUploadTask = picRef.put(pic, metadata).then((snapshot) => {\n console.log('New pic uploaded. Size:', snapshot.totalBytes, 'bytes.');\n return snapshot.ref.getDownloadURL().then((url) => {\n console.log('File available at', url);\n return url;\n });\n }).catch((error) => {\n console.error('Error while uploading new pic', error);\n });\n console.log(4);\n // Start the thumb file upload to Cloud Storage.\n const thumbRef = this.storage.ref(`${this.auth.currentUser.uid}/thumb/${newPostKey}/${fileName}`);\n const tumbUploadTask = thumbRef.put(thumb, metadata).then((snapshot) => {\n console.log('New thumb uploaded. Size:', snapshot.totalBytes, 'bytes.');\n return snapshot.ref.getDownloadURL().then((url) => {\n console.log('File available at', url);\n return url;\n });\n }).catch((error) => {\n console.error('Error while uploading new thumb', error);\n });\n\n return Promise.all([picUploadTask, tumbUploadTask]).then((urls) => {\n // Once both pics and thumbnails has been uploaded add a new post in the Firebase Database and\n // to its fanned out posts lists (user's posts and home post).\n const update = {};\n update[`/posts/${newPostKey}`] = {\n full_url: urls[0],\n thumb_url: urls[1],\n text: text,\n client: 'mobile',\n timestamp: firebase.database.ServerValue.TIMESTAMP,\n full_storage_uri: picRef.toString(),\n thumb_storage_uri: thumbRef.toString(),\n author: {\n uid: this.auth.currentUser.uid,\n full_name: this.auth.currentUser.displayName || 'Anonymous',\n profile_picture: this.auth.currentUser.photoURL || null,\n },\n };\n update[`/people/${this.auth.currentUser.uid}/posts/${newPostKey}`] = true;\n update[`/feed/${this.auth.currentUser.uid}/${newPostKey}`] = true;\n return this.database.ref().update(update).then(() => newPostKey);\n }); \n }", "title": "" }, { "docid": "9edcd89bbb7d42f5baa33f985831ca11", "score": "0.5075217", "text": "function autoSave() {\r\n cleanEntries();\r\n sys.writeToFile(submitDir+\"index.json\", JSON.stringify(userqueue));\r\n sys.writeToFile(dataDir+\"bfteams_user.json\", JSON.stringify(usersets));\r\n}", "title": "" }, { "docid": "71aac39bf9b3cda8cd8b31933407a969", "score": "0.50617105", "text": "function saveArticleToDb(title, article, author){\n var numItems = db.count({type: \"blogPost\"});\n Logger.log(numItems);\n \n var current = {type: \"blogPost\",\n title: title,\n article: article,\n author: author,\n docId: \"\",\n id: numItems+1};//this is our auto increment - not necessary for this app but good to know \n db.save(current);\n var newDocId = updateWebfolder(current);//post the article to web and this var holds the newDocId\n return newDocId;//used to show user the URL for the new file.\n}", "title": "" }, { "docid": "90ef1422903167043937c7c6dc8ffb2b", "score": "0.50602144", "text": "async function insert() {\r\n var qlink = await uploadFile(question);\r\n //console.log(qlink);\r\n var alink = await uploadFile(answer);\r\n //console.log(alink);\r\n\r\n Mytest.findOne({ tsname: req.body.test_series, teacher: req.user.username }, function(err, found) {\r\n //console.log(found.test[0].tname);\r\n var x = found.test.length;\r\n for (var i = 0; i < x; i++) {\r\n if (found.test[i].tname == req.body.tname) {\r\n\r\n found.test[i].questions.push({\r\n question: qlink,\r\n a: req.body.a,\r\n b: req.body.b,\r\n c: req.body.c,\r\n d: req.body.d,\r\n ans: req.body.A,\r\n solution: alink\r\n });\r\n found.test[i].markModified(\"question\");\r\n found.save();\r\n\r\n }\r\n\r\n }\r\n });\r\n }", "title": "" }, { "docid": "b35b93bfea4b74bef8887e5d0d524b27", "score": "0.5057664", "text": "function addFoodsToDatabase(data) {\n\t if( window.localStorage.getItem(\"serverdata\") != \"loaded\") {\n\t\t var count = data.length;\n\t\t db.transaction( function(tx){ \n\t\t\t tx.executeSql('DELETE FROM TABLEFOODS' );\n\t\t }, errorCallbackSQLite );\n\t\t for (var i=0; i< count; i++) {\n\t\t\t addFoodInLoop(data, i);\n\t\t }\n\t\t setAllFoodList();\n\t\t window.localStorage.setItem(\"serverdata\", \"loaded\");\n\t }\t\n }", "title": "" }, { "docid": "119000c0d1bccfc64eb8e1699c17c444", "score": "0.50573224", "text": "function updateUserWasteListToDatabase(data) {\n\t var count = data.length;\n\t db.transaction( function(tx){ \n\t\t tx.executeSql('DELETE FROM TABLEWASTE' );\n\t }, errorCallbackSQLite );\n\t for (var i=0; i< count; i++) {\n\t\t addUserWasteInLoop(data, i);\n\t }\n }", "title": "" }, { "docid": "a20cd58ae4c8675dc3f65df8a8f88ffa", "score": "0.50517046", "text": "async function writeToDb(data, Videos) {\n //How do we know if this call was successful?\n try {\n await Videos.create(data)\n } catch (err) {\n console.log(\"something went wrong with writing to the db:\", err);\n }\n return;\n}", "title": "" }, { "docid": "d3993f8e0eecd74d7f3ecae66b232fc8", "score": "0.5044802", "text": "async function insertAnimals(){\n const animals = await getTestAnimals();\n await asyncForEach(animals, async (animal) =>{\n await db('animals').insert(animal)\n })\n}", "title": "" }, { "docid": "0dbbc954ca611f6229d0c33f5858ed95", "score": "0.50377", "text": "function addToDb(data) {\n\tclient.query(\n\t\t'INSERT INTO '+ config.SONG_TABLE +' '\n\t\t+ 'SET artist = ?,song = ?, djname = ?, djid = ?, up = ?, down = ?, listeners = ?, started = ?',\n\t\t[currentsong.artist, \n\t\tcurrentsong.song, \n\t\tcurrentsong.djname, \n\t\tcurrentsong.djid, \n\t\tcurrentsong.up, \n\t\tcurrentsong.down, \n\t\tcurrentsong.listeners, \n\t\tnew Date()]);\n}", "title": "" }, { "docid": "9273347929794b21986c73b80fafbf5f", "score": "0.5035283", "text": "async function uploadPoke() {\n // function to just get one pokemon to test it in the console\n try {\n const data = await readFile(\n path.join(__dirname, '..', 'data', 'pokedex.json')\n ); // uses the path module to move around into our other file for us ('..' for each level it travels up the tree, and then the folder name to go down into the folder; so this is up one level back to db, and then down into data)\n const pokemon = JSON.parse(data); // turns the info read from the JSON into a javascript object\n\n //console.log(pokemon[0]); //initial check to make sure working\n\n for (let i = 0; i < pokemon.length; i++) {\n //loops it: destructures each pokemon and runs the query on it, then moves onto the next one until it runs out of pokemon\n const {\n pkdx_id,\n name,\n description,\n img_url,\n types,\n evolutions\n } = pokemon[i]; //this is destructuring the values from the data object (read by readFile) into an array pokemon[0]; this is what SQL will then use to get each bit of the $1, $2, etc.\n const res = await query(\n `INSERT INTO pokemon (\n pkdx_id,\n name,\n description,\n img_url,\n types,\n evolutions\n ) \n VALUES ($1, $2, $3, $4, $5, $6)`, // sql query as text argument in query function\n //SQL SYNTAX: INSERT INTO tablename (columnnames) VALUES (values)\n [pkdx_id, name, description, img_url, types, evolutions] // values from the destructured object above as the params argument of the query function\n );\n console.log(name); //console-logs only the name of each pokemon as each is recorded into the table\n }\n } catch (err) {\n //will stop the loop and error out if anything in the loop throws an error\n throw new Error('Failed to insert data into table. Loop stopped!');\n console.log(err);\n }\n}", "title": "" }, { "docid": "43d9e164967cdf0108bbe4466a60a187", "score": "0.50306123", "text": "async function seedDatabase() {\n return db.connectDB().then(data => {\n console.log(\"Seed Database\");\n return Item.find({ name: \"My Super Phone\" });\n }).then(data => {\n if (data.length == 0) {\n const item = new Item({\n name: \"My Super Phone\",\n inStockCount: 20,\n photoUrl: \"https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Alt_Telefon.jpg/698px-Alt_Telefon.jpg\"\n });\n return item.save();\n }\n else return 'Not adding, document already exists';\n })\n .then(data => {\n console.log(\"Saved item -----------------------\");\n console.log(data);\n }).catch(err => {\n console.error(\"Seed DB Failed\");\n console.error(err);\n throw new Error(\"Create DB Connection wrapper failed\");\n });\n}", "title": "" }, { "docid": "a9778f5495b52ab5961d2aafbb6af605", "score": "0.502777", "text": "saveFileData(upload) {\n this.afs.collection('uploads').add(upload);\n }", "title": "" }, { "docid": "16935a60206631490e52edda53e14ee1", "score": "0.5010884", "text": "function upload(callback) {\n if (!callback)\n callback = function () { }\n if (isUploading || isRestoreing) {\n callback(-3);\n return;\n }\n isUploading = 1;\n function _uploadData(callback0) {\n var templst = null;\n if (!uploadUUID()) {\n uploadUUID(uuid());\n theDB.dbRead('mainSync.Temp', null, 0, transferLimit, function (templst) {\n theDB.set(\"tempUploadData\", templst);\n _d(templst);\n });\n } else {\n templst = theDB.get(\"tempUploadData\", 1);\n _d(templst);\n }\n function _d(templst) {\n var uuids = [];\n for (var i = 0; i < templst.length; i++) {\n uuids.push(templst[i].objuuid);\n }\n theDB.dbReadObjs(uuids, function (reslst) {\n for (var i = 0; i < templst.length; i++) {\n templst[i].data = reslst[i];\n }\n callback0(templst);\n });\n }\n }\n function _upload() {\n _uploadData(function (templst) {\n httpUpload(templst, 0, uploadUUID(), currentIndex(), function (updata) {\n uploadUUID(null);\n var localids = theDB.get(\"localids\", 1) || {};\n for (var i = 0; i < updata.length; i++) {\n localids['s' + updata[i].id] = 1;\n }\n theDB.set(\"localids\", localids);\n var templst = theDB.get(\"tempUploadData\", 1);\n var dellst = [];\n var delobjs = [];\n for (var i = 0; i < updata.length; i++) {\n for (var j = 0; j < templst.length; j++) {\n if (templst[j].objuuid == updata[i].objuuid) {\n dellst.push(1);\n delobjs.push(templst[j]);\n break;\n }\n }\n }\n theDB.dbOpObjs(dellst, delobjs, function () {\n theDB.dbRead('mainSync.Temp', function (tl) {\n if (tl.length) {\n _upload();\n } else {\n isUploading = 0;\n hasNewData = false;\n callback(1);\n }\n });\n });\n }, function (errorstatus, lastId) {\n isUploading = 0\n if (errorstatus == -2) {\n restoreSeek(lastId);\n restore(function (r) {\n if (r == 1) {\n upload(callback)\n } else {\n callback(r);\n }\n });\n } else {\n callback(errorstatus);\n }\n });\n });\n }\n _upload();\n }", "title": "" }, { "docid": "14d89224fb189ae2811bca0d13c284e4", "score": "0.5010607", "text": "function saveToDb() {\n itemProvider.findOne({collection: 'products', query: {ProdID: data[i].ProdID}}, function(err, item) {\n if(err){\n console.log(err);\n return i<data.length-1?(i++,void saveToDb()):void process.exit();\n }\n if(item === null) {\n itemProvider.save({collection: 'products'}, data[i], function(err) {\n if(err) console.log(err, data[i]);\n console.log('saved: ' + data[i].ProdID, i + '/' + l);\n return i<data.length-1?(i++,void saveToDb()):void process.exit();\n });\n } else {\n // document exists, lets update it.\n var merged = merge.recursive(true, item, data[i]);\n delete merged._id;\n itemProvider.updateItem(\n {\n collection: 'products',\n query: {\n ProdID: data[i].ProdID\n },\n action: {\n '$set' : merged\n }\n }, function(err) {\n if(err) console.log(err, data[i]);\n console.log('updated: ' + data[i].ProdID, i + '/' + l);\n return i<data.length-1?(i++,void saveToDb()):void process.exit();\n });\n }\n });\n}", "title": "" }, { "docid": "32515816f408d236db23f7f1f3324ff4", "score": "0.5010376", "text": "function checkDatabase() {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const pending = transaction.objectStore(\"pending\");\n const getAll = pending.getAll();\n\n getAll.onsuccess = function () {\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\",\n },\n })\n .then((res) => res.json())\n // if success, open transactions, access pending, and clear items from store\n .then(() => {\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const pending = transaction.objectStore(\"pending\");\n pending.clear();\n });\n }\n };\n}", "title": "" }, { "docid": "290e239680edc7a7589adadee35be95b", "score": "0.50031644", "text": "async ensureUploadingSameObject() {\n // A queue for the upstream data\n const upstreamQueue = this.upstreamIterator(16, true // we just want one chunk for this validation\n );\n const upstreamChunk = await upstreamQueue.next();\n const chunk = upstreamChunk.value\n ? upstreamChunk.value.chunk\n : Buffer.alloc(0);\n // Put the original chunk back into the buffer as we just wanted to 'peek'\n // at the stream for validation.\n this.unshiftChunkBuffer(chunk);\n let cachedFirstChunk = this.get('firstChunk');\n const firstChunk = chunk.valueOf();\n if (!cachedFirstChunk) {\n // This is a new upload. Cache the first chunk.\n this.set({ uri: this.uri, firstChunk });\n }\n else {\n // this continues an upload in progress. check if the bytes are the same\n cachedFirstChunk = Buffer.from(cachedFirstChunk);\n const nextChunk = Buffer.from(firstChunk);\n if (Buffer.compare(cachedFirstChunk, nextChunk) !== 0) {\n // this data is not the same. start a new upload\n this.restart();\n return false;\n }\n }\n return true;\n }", "title": "" }, { "docid": "ea38ccf799b8186d92c6e59b7df93e74", "score": "0.50000596", "text": "function uploadMovies(moviedata){\n\n console.log(\"Importing movies into DynamoDB\");\n console.log(moviedata.length)\n let index = 1;\n //loop through all the loaded data\n moviedata.forEach(function(movie) {\n var params = {\n TableName: \"Movies\",\n Item: {\n \"year\": movie.year,\n \"title\": movie.title,\n \"info\": movie.info\n }\n };\n //recursive promise for storing the data\n let prom2 = new Promise((res, rej) => {\n docClient.put(params, function(err, data) {\n if (err) {\n console.error(\"Unable to add Movie - \", index, ' - ', movie.title, JSON.stringify(err, null, 2));\n rej();\n } else {\n console.log(\"Added Movie - \", index, ' - ', movie.title);\n res();\n }\n });\n });\n //resolving when table is full\n prom2.then(function(){\n if(index == moviedata.length){\n console.log(\"Successfully populated database\");\n resolve();\n }\n index = index + 1;\n })\n .catch(err => {\n if(index == moviedata.length){\n console.log(\"Populated database\");\n resolve();\n }\n index = index + 1;\n });\n });\n }", "title": "" }, { "docid": "4eb5d12bd5c9a1ce2e3872158574f512", "score": "0.49967915", "text": "async _syncFromRemote() {\n const lastSync = (await AsyncStorage.getItem('GD_lastRealmSync')) || 0\n const newItems = await this.encryptedFeed.find({\n user_id: this.user.id,\n date: { $gt: new Date(lastSync) },\n })\n\n const filtered = newItems.filter(_ => !_._id.toString().includes('settings') && _.txHash)\n\n log.debug('_syncFromRemote', { newItems, filtered, lastSync })\n\n if (filtered.length) {\n let decrypted = (await Promise.all(filtered.map(i => this._decrypt(i)))).filter(_ => _)\n log.debug('_syncFromRemote', { decrypted })\n\n await this.db.Feed.save(...decrypted)\n }\n AsyncStorage.setItem('GD_lastRealmSync', Date.now())\n\n //sync items that we failed to save\n const failedSync = await this.db.Feed.find({ sync: false }).toArray()\n\n if (failedSync.length) {\n log.debug('_syncFromRemote: saving failed items', failedSync.length)\n\n failedSync.forEach(async item => {\n await this._encrypt(item)\n\n this.db.Feed.table.update({ _id: item.id }, { $set: { sync: true } })\n })\n }\n\n log.info('_syncfromremote done')\n }", "title": "" }, { "docid": "4aa76bda3ca604a9327c558176fce092", "score": "0.49874565", "text": "add(updata, success, fail) {\n if (!helper.validator.validateData(updata)) {\n throw new Error('Bad reuest Upload Data');\n }\n this.dao.dbaccess(() => {\n new Promise((resolve, reject) => {\n this.dao.begin();\n this.dao.add(updata, resolve, reject);\n })\n .then((dat) => {\n this.dao.commit();\n success(dat);\n })\n .catch((err) => {\n this.dao.rollback();\n fail(err);\n });\n });\n }", "title": "" }, { "docid": "d7c7fe7bfad51b960c72f6ca62fb6fd7", "score": "0.49758542", "text": "function checkDatabase() {\n const transaction = db.transaction([\"expenses\"], \"readwrite\");\n const store = transaction.objectStore(\"expenses\");\n const getAll = store.getAll();\n\n getAll.onsuccess = function() {\n if (getAll.result.length > 0) {\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\"\n }\n })\n .then(response => response.json())\n .then(() => {\n const transaction = db.transaction([\"expenses\"], \"readwrite\");\n const store = transaction.objectStore(\"expenses\");\n store.clear();\n });\n }\n };\n}", "title": "" }, { "docid": "b2924b3c35a5734cc6fc9dafdc1aa7b2", "score": "0.49666008", "text": "function onceClear(err) {\r\n if(err) console.log(err);\r\n\r\n // loop over the projects, construct and save an object from each one\r\n // Note that we don't care what order these saves are happening in...\r\n var to_save_count = example.length;\r\n console.log(example.length);\r\n for(var i=0; i<example.length; i++) {\r\n\r\n var json = example[i];\r\n\r\n console.log(\"first\");\r\n //console.log(json);\r\n\r\n var u = new models.Profile(json);\r\n u.TypesDone = true;\r\n u.PropertyDone = true;\r\n u.RentDone = true;\r\n u.OtherDone = true;\r\n u.AddressDone = true;\r\n u.DatesDone = true;\r\n console.log(u);\r\n\r\n u.save(function(err, u) {\r\n if(err) console.log(err);\r\n to_save_count--;\r\n console.log(to_save_count + ' left to save');\r\n if(to_save_count <= 0) {\r\n console.log('DONE Profile');\r\n // The script won't terminate until the \r\n // connection to the database is closed\r\n \r\n\r\n //mongoose.connection.close();\r\n }\r\n });\r\n }\r\n}", "title": "" }, { "docid": "3288acc961646d22565bac7259e9cede", "score": "0.496104", "text": "function uploadToDb(resource) {\n let result = JSON.parse(JSON.stringify(resource));\n // update to just use sample content from news api\n //let articles = getArticleContent(result.articles);\n let articles = result.articles;\n\n for (var i = 0; i < articles.length; i++) {\n let queryStr = articleInsertQuery(articles[i]);\n queryDb(queryStr);\n //console.log(queryStr);\n //queryDb(queryStr);\n //let queryResult = queryDb(\"SELECT * FROM articles;\");\n //console.log(typeof queryResult);\n //queryDb(\"DELETE FROM articles;\");\n // let content = queryDb(\n // \"SELECT content FROM articles WHERE url = \" + \"'test url'\" + \";\"\n // );\n // console.log(content);\n // let queryResult;\n // var checkTranslation = function () {\n // queryResult = queryDb(\"SELECT * FROM articles;\");\n // };\n // const promise = new Promise(checkTranslation).then(\n // console.log(queryResult)\n // );\n }\n}", "title": "" }, { "docid": "5814dd9e2061503c29baf7e8591d7d88", "score": "0.49596187", "text": "async function submit(){\n let title = $('#title').val();\n let des = $('#description').val();\n let imgSrc =$('#img').attr('src');\n const img = localStorage.getItem('imgStored');\n if(title==\"\" || des==\"\" || title==null || des==null ){\n \n let display = title==null||title==''?'block':'none';\n $('#title').next().css( \"display\",display );\n display = des==null||des==''?'block':'none';\n $('#description').next().css( \"display\",display);\n\n }\n else{\n $('#uploadInfo').prop('disabled',true);\n $('#uploadInfo').html('<i class=\"fa fa-spinner fa-spin\"></i>');\n $('#takePics').prop('disabled',true);\n $('#takePics').html('<i class=\"fa fa-spinner fa-spin\"></i>'); \n console.log('here');\n let imgURL='img/jk-placeholder-image.jpg'; \n if(img!=null&& $('#img').attr('src')!='img/jk-placeholder-image.jpg'){\n imgURL = await uploadImage(imgSrc); \n }\n\n localStorage.removeItem('imgStored');\n const id = uuidv4();\n var newPostKey = database.ref(\"posts\").push().key;\n\n database.ref('posts/'+newPostKey).set({\n description:des,\n image: imgURL,\n title: title,\n id:newPostKey,\n time:new Date().getTime()\n }).then(snap=>{\n \n setTimeout(function(){\n alert('successfully uploaded.')\n $('#uploadInfo').prop('disabled',false);\n $('#uploadInfo').html('Upload');\n $('#takePics').prop('disabled',false);\n $('#takePics').html('<i class=\"fa fa-camera\"></i>');\n },3000)\n\n }).catch(err=>{\n alert('Err on server.')\n\n });\n }\n\n}", "title": "" }, { "docid": "6e643279fb0bf306ddc2baa930784cc2", "score": "0.49511987", "text": "async function seed() {\n await db.sync({ force: true });\n console.log('db synced!');\n // Whoa! Because we `await` the promise that db.sync returns, the next line will not be\n // executed until that promise resolves!\n const users = await Promise.all([\n User.create({\n email: '[email protected]',\n name: 'Nick Maslov',\n photoUrl:\n 'https://media.licdn.com/dms/image/C4D03AQH_Hnc3P-RzlA/profile-displayphoto-shrink_800_800/0?e=1535587200&v=beta&t=XgfVC9w8CaWp6Pi3MbhrwC2pzjPahpMpblYoAgRxLPs',\n password: '123'\n }),\n User.create({\n email: '[email protected]',\n name: 'Bushra Taimoor',\n photoUrl:\n 'https://media.licdn.com/dms/image/C4D03AQGrrwZbgATTGA/profile-displayphoto-shrink_800_800/0?e=1535587200&v=beta&t=riLnsKEP_3Jz4f6rwdmMZVcfpDL9lizD-MybHN_qkdM',\n password: '123'\n })\n ]);\n\n const templates = await Promise.all([\n Template.create({\n title: 'Spiderman',\n description:\n 'Bitten by a radioactive spider, high school student Peter Parker gained the speed, strength and powers of a spider. Adopting the name Spider-Man, Peter hoped to start a career using his new abilities. Taught that with great power comes great responsibility, Spidey has vowed to use his powers to help people.',\n coverImgUrl:\n 'https://firebasestorage.googleapis.com/v0/b/exquisite-comics.appspot.com/o/templates%2FSpiderman%2Fspidy.jpg?alt=media&token=60985e32-453a-4273-93b8-0623118cc2d6',\n chapters: [\n 'Peter Parker the nerd',\n 'Experiment Gone Wrong',\n 'Do I have powers ...'\n ]\n }),\n Template.create({\n title: 'Ironman',\n description:\n 'Wounded, captured and forced to build a weapon by his enemies, billionaire industrialist Tony Stark instead created an advanced suit of armor to save his life and escape captivity. Now with a new outlook on life, Tony uses his money and intelligence to make the world a safer, better place as Iron Man.',\n coverImgUrl:\n 'https://firebasestorage.googleapis.com/v0/b/exquisite-comics.appspot.com/o/templates%2FIronman%2Firon.jpg?alt=media&token=928b1e70-36c2-409a-8662-6be519548d07',\n chapters: [\n 'Ironman the begining',\n 'Technology has the power',\n 'Eternal Life ...'\n ]\n }),\n Template.create({\n title: 'Captain America',\n description:\n 'Vowing to serve his country any way he could, young Steve Rogers took the super soldier serum to become Americas one-man army. Fighting for the red, white and blue for over 60 years, Captain America is the living, breathing symbol of freedom and liberty',\n coverImgUrl:\n 'https://firebasestorage.googleapis.com/v0/b/exquisite-comics.appspot.com/o/templates%2FCaptain%20America%2Fmarvel-captain-america-premium-format-figure-sideshow-feature-300524-1.jpg?alt=media&token=b1d560b7-279a-4685-9011-2c58d0a8aac7',\n chapters: [\n 'From soldier to superhero',\n 'Fight for freedom & liberty',\n 'Leading the country to safety ...'\n ]\n }),\n Template.create({\n title: 'Avengers',\n description:\n 'Earths Mightiest Heroes joined forces to take on threats that were too big for any one hero to tackle. With a roster that has included Captain America, Iron Man, Ant-Man, Hulk, Thor, Wasp and dozens more over the years, the Avengers have come to be regarded as Earths No. 1 team.',\n coverImgUrl:\n 'https://firebasestorage.googleapis.com/v0/b/exquisite-comics.appspot.com/o/templates%2FAvengers%2Favengers.jpg?alt=media&token=77763957-172b-4bbe-989f-0f02f82d81af',\n chapters: [\n 'Threats to Earth asks super heroes to unite',\n 'Team of supers unite to save the world',\n 'Fight the villains ...',\n 'Insipiring next generation to join in ...'\n ]\n }),\n Template.create({\n title: 'Batman',\n description:\n 'Detective. Whatever you know him as, wherever you know him from - Batman is proof you don’t need superpowers to be a superhero… and the poster boy for what a bad childhood can do to you.',\n coverImgUrl:\n 'https://firebasestorage.googleapis.com/v0/b/exquisite-comics.appspot.com/o/templates%2FBatman%2Fbatman-4.jpg?alt=media&token=1da9664c-a4ec-4bbd-b015-2319ea69640d',\n chapters: [\n 'City needs a saviour',\n 'From a businessman to batman ',\n 'Fighting Villains',\n 'Anyone can make a difference'\n ]\n })\n ]);\n // Wowzers! We can even `await` on the right-hand side of the assignment operator\n // and store the result that the promise resolves to in a variable! This is nice!\n console.log(`seeded ${users.length} users`);\n console.log(`seeded ${templates.length} templates`);\n console.log(`seeded successfully`);\n}", "title": "" }, { "docid": "b6144575bc73f46af44a03aa628fdd02", "score": "0.49464753", "text": "addItems(itemObject){\n db.push(itemObject)\n .then((res) => {\n console.log(\"Created new item successfully!\");\n })\n .catch((e) => {\n console.log(e);\n });\n }", "title": "" }, { "docid": "d26d37e62e3e0592f76bc2f99c064524", "score": "0.49431545", "text": "function checkDatabase() {\n // open a transaction on your pending db\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n // access your pending object store\n const store = transaction.objectStore(\"pending\");\n // get all records from the index db\n const getAll = store.getAll();\n\n // once all transactions are retrieved\n getAll.onsuccess = function () {\n // if there are any transactions to add to the database...\n if (getAll.result.length > 0) {\n // send a post request to the bulk create api route with all of the retrieved data\n fetch(\"/api/transaction/bulk\", {\n method: \"POST\",\n body: JSON.stringify(getAll.result),\n headers: {\n Accept: \"application/json, text/plain, */*\",\n \"Content-Type\": \"application/json\",\n },\n })\n .then((response) => response.json())\n .then(() => {\n // if successful, open a transaction and empty the index db\n const transaction = db.transaction([\"pending\"], \"readwrite\");\n const store = transaction.objectStore(\"pending\");\n store.clear();\n });\n }\n };\n}", "title": "" }, { "docid": "f87448d6614e5708bad3985258aea17a", "score": "0.49360514", "text": "function promiseToSaveItems(uuid) {\n if (allUpdatesAreSaved) return Promise.resolve(true);\n\n if (!database) initDatabase();\n\n return Promise.all(\n Object.getOwnPropertyNames(counter).map(function (category) {\n var quantity = counter[category];\n if (quantity == 0) return;\n\n var item = {\n model: 'item',\n beachclean_uuid: uuid,\n category: category\n };\n\n return database\n .find({ selector: item })\n .then(function (result) {\n if (result && result.docs.length > 0) {\n item = result.docs[0];\n item['quantity'] = quantity;\n return database.put(item);\n } else {\n item['quantity'] = quantity;\n return database.post(item);\n }\n });\n })\n ).then(function () {\n allUpdatesAreSaved = true;\n $('#js-save-beachclean').prop('disabled', true);\n $('#js-save-beachclean').text('Saved');\n })\n .catch(console.log);\n}", "title": "" }, { "docid": "06d848c966ec40e47f0634537722f5d3", "score": "0.49344587", "text": "async _upload (){\n try {\n const { file, fileLastModified, fileType } = this\n const metadata = {\n contentType: fileType,\n customMetadata: {fileLastModified}\n };\n\n // could do it firestore way:\n //but this way is consistent with our api\n await this._sendAndTrackFile(file, metadata)\n await this.logEvent(TRANSCRIPTION_STATUSES[1]) // uploaded\n\n } catch (err) {\n console.error('error uploading to storage: ', err)\n // throw it up the chain\n throw err\n }\n }", "title": "" }, { "docid": "1d2439edfad1aec942b097ee77aa70cc", "score": "0.49331337", "text": "save() {\n // TODO: { success: true/false?? } (ver docs./src de indexedDB)\n lokiDB.saveDatabase();\n }", "title": "" }, { "docid": "4b67532b02e75351435fa391e5e95d23", "score": "0.49255103", "text": "function updateUserFoodListToDatabase(data) {\n\t var count = data.length;\n\t db.transaction( function(tx){ \n\t\t tx.executeSql('DELETE FROM TABLEUSERFOOD' );\n\t }, errorCallbackSQLite );\n\t for (var i=0; i< count; i++) {\n\t\t addUserFoodInLoop(data, i);\n\t }\n }", "title": "" }, { "docid": "c50c6d1592bf7e3dc5e5eb25e094abba", "score": "0.49215898", "text": "async function seed() {\n await db.sync({force: true})\n console.log('db synced!')\n // Whoa! Because we `await` the promise that db.sync returns, the next line will not be\n // executed until that promise resolves!\n const users = await Promise.all([\n User.create({email: '[email protected]', password: '123'}),\n User.create({email: '[email protected]', password: '123'}),\n User.create({email: '[email protected]', password: '123', admin: true}),\n User.create({email: '[email protected]', password: '123', admin: true}),\n User.create({email: '[email protected]', password: '123', admin: true}),\n User.create({email: '[email protected]', password: '123', admin: true}),\n User.create({email: 'fruitful.com', password: '123', admin: true}),\n User.create({email: '[email protected]', password: '123', admin: true})\n ])\n // Wowzers! We can even `await` on the right-hand side of the assignment operator\n // and store the result that the promise resolves to in a variable! This is nice!\n console.log(`seeded ${users.length} users`)\n console.log(`seeded successfully`)\n\n // Products\n const bananas = await Product.create({\n title: 'Bananas',\n description: 'I am a delightfully bright, sweet and love mixing it up with other fruit in a salad or smoothie!',\n price: 249,\n inventory: 20,\n photo: \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSbcDw4FobLR9UUmXNAwWmpyziACHNQwXb6ZPgsYsASLiE-li1dgQ\"\n })\n\n const strawberries = await Product.create({\n title: 'Strawberries',\n description: 'I am irresistably tasty and versatile! In a smoothie? Frozen yogurt? Dipped in chocolate? I am perfect for anything!',\n price: 399,\n inventory: 20,\n photo: \"https://media.istockphoto.com/photos/strawberry-picture-id513590708?k=6&m=513590708&s=612x612&w=0&h=bt6vD_Ujv3bqRqqBtJQsNJQANxsjWzvDph6h6Kx4xtM=\"\n })\n\n const blueberries = await Product.create({\n title: 'Blueberries',\n description: 'I am so tasty and mushy! No teeth? No problem!',\n price: 499,\n inventory: 20,\n photo: \"https://images-na.ssl-images-amazon.com/images/I/41LnV22OsiL._SX355_.jpg\"\n })\n\n const peaches = await Product.create({\n title: 'Peaches',\n description: 'I am a fuzzy, round, and plump!',\n price: 129,\n inventory: 20,\n photo: \"https://d1ubpsppdzqxsq.cloudfront.net/image/300s/93/f1/6b/93f16b908b800c99260d29b6c20794d57d5e062e.jpg\"\n })\n\n const lemons = await Product.create({\n title: 'Lemons',\n description: 'I am zesty, I am strong, I am bright and daring, there is nothing I cannot do!',\n price: 159,\n inventory: 20,\n photo: \"https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/766/images/lemon-uses-0-1494115921.jpg\"\n })\n\n const redSeedlessGrapes = await Product.create({\n title: 'Red Seedless Grapes',\n description: \"I'm there for snack time, nap time, and all the times in between!\",\n price: 599,\n inventory: 20,\n photo: \"https://d2lnr5mha7bycj.cloudfront.net/product-image/file/large_bf472e46-861d-4fe4-9fbc-8f34c9bb3a98.png\"\n })\n\n const nectarines = await Product.create({\n title: 'Nectarines',\n description: \"I'm the oft-overlooked cousin of the peach - don't underestimate me!\",\n price: 129,\n inventory: 20,\n photo: \"http://www.paradisefruit802.com/wp-content/uploads/2016/07/Nectarine.gif\"\n })\n\n const raspberries = await Product.create({\n title: 'Raspberries',\n description: \"I'm a collection of crimson droplets held together by pure joy!\",\n price: 499,\n inventory: 20,\n photo: \"https://marulangeneralstore.com/wp-content/uploads/2017/02/Raspberries-Punnet-300x300.jpg\"\n })\n\n const oranges = await Product.create({\n title: 'Oranges',\n description: \"I'm a sunny standard for all your juicing needs!\",\n price: 150,\n inventory: 10,\n photo: \"https://i0.wp.com/www.healthfitnessrevolution.com/wp-content/uploads/2016/02/ThinkstockPhotos-494037394.jpg?fit=630%2C558\"\n })\n\n const avocado = await Product.create({\n title: 'Avocado',\n description: \"I'm the poster child for millenial consumption!\",\n price: 599,\n inventory: 10,\n photo: \"https://images-na.ssl-images-amazon.com/images/I/51ukRMsmDIL._SY300_QL70_.jpg\"\n })\n\n const mangoes = await Product.create({\n title: 'Mangoes',\n description: \"I'm as close to a perfect fruit as there's ever been...and humble!\",\n price: 419,\n inventory: 20,\n photo: \"https://www.fruteriadevalencia.com/wp-content/uploads/2015/02/MANGO-buena.jpg\"\n })\n\n const redGrapefruit = await Product.create({\n title: 'Red Grapefruit',\n description: \"I'm the perfect combo of tart and sweet!\",\n price: 799,\n inventory: 20,\n photo: \"https://www.edenbotanicals.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/g/r/grapefruit_canstockphoto11983829.jpg\"\n })\n\n const pineapple = await Product.create({\n title: 'Pineapple',\n description: \"I'm a symbol of hospitality - and also just super cool!\",\n price: 419,\n inventory: 10,\n photo: \"https://cdn8.bigcommerce.com/s-q51ae6vv/images/stencil/500x659/products/940/3226/FA_Pineapple__96451.1402897272.jpg?c=2&imbypass=on\"\n })\n\n const galaApples = await Product.create({\n title: 'Gala Apples',\n description: \"I'm so picture perfect I should be in a gala-ry! Get it?\",\n price: 149,\n inventory: 10,\n photo: \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSntiNZHaOwF7RdDk0UuMujTSLcHuSFm8sl1SQ92bwExOaeximD_A\"\n })\n\n const apricots = await Product.create({\n title: 'Apricots',\n description: \"I'm a tiny golden orb you can bring with you anywhere!\",\n price: 190,\n inventory: 10,\n photo: \"http://polgarkerteszet.hu/wp-content/uploads/2012/09/canstockphoto686473411.jpg\"\n })\n\n const cherries = await Product.create({\n title: 'Cherries',\n description: \"I'm a great on-the-go pick-me-up!\",\n price: 598,\n inventory: 10,\n photo: \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRmx3_v7X7IJoDYGYNJbrNSCwWJcI39fKJiTAjDbBEvV2848aW5gg\"\n })\n\n const blackberries = await Product.create({\n title: 'Blackberries',\n description: \"I'm full of vine-ripened, sunshine-swelled flavor\",\n price: 399,\n inventory: 10,\n photo: \"https://images.eatthismuch.com/site_media/img/1339_scotjohns_53d85531-4339-4ad7-bb36-46d72850e4e2.png\"\n })\n\n const greenSeedlessGrapes = await Product.create({\n title: 'Green Seedless Grapes',\n description: \"I'm easy to eat - have a grape day!\",\n price: 599,\n inventory: 10,\n photo: \"http://www.jackieleonards.ie/wp-content/uploads/2015/03/green-grapes.png\"\n })\n\n const watermelon = await Product.create({\n title: 'Watermelon',\n description: \"I'm the epitome of summer!\",\n price: 509,\n inventory: 10,\n photo: \"https://images.fitpregnancy.mdpcdn.com/sites/fitpregnancy.com/files/styles/width_360/public/field/image/watermelon-wonder-at_0.jpg\"\n })\n\n const grannySmithApples = await Product.create({\n title: 'Granny Smith Apples',\n description: \"I'm apple-pie-perfect\",\n price: 199,\n inventory: 10,\n photo: \"https://www.markon.com/sites/default/files/styles/large/public/pi_photos/Apples_Granny_Smith_Hero.jpg\"\n })\n\n const cantaloupe = await Product.create({\n title: 'Cantaloupe',\n description: \"I'm perfectly pleasant paired with prosciutto\",\n price: 349,\n inventory: 10,\n photo: \"https://foodsafetyblog.statefoodsafety.com/wp-content/uploads/2014/05/20160122_Dollarphotoclub_55601311_cantaloupe-1024x782.jpg\"\n })\n\n const kiwi = await Product.create({\n title: 'Kiwi',\n description: \"I'm rough on the outside but a big softy once you get to know me!\",\n price: 99,\n inventory: 10,\n photo: \"http://xwifekitchen.com/wp-content/uploads/2018/02/kiwi.jpeg\"\n })\n\n const goldenKiwi = await Product.create({\n title: 'Golden Kiwi',\n description: \"I'm not your everyday kiwi next door!\",\n price: 149,\n inventory: 10,\n photo: \"https://cdn.shopify.com/s/files/1/0206/9470/products/kiwi_gold_1024x1024.jpg?v=1482250186\"\n })\n\n const limes = await Product.create({\n title: 'Limes',\n description:\"I'm the key ingredient in guac, mojitos, and key lime pie!\",\n price: 99,\n inventory: 10,\n photo: \"https://paradisenursery.com/wp-content/uploads/2014/04/Persian-lime.jpg\"\n })\n\n const fujiApples = await Product.create({\n title: 'Fuji Apples',\n description: \"I'm an apple for apple connoisseurs\",\n price: 169,\n inventory: 10,\n photo: \"https://image.made-in-china.com/43f34j00UFQtLPidqDzp/Exported-Chinese-Shandong-Fresh-FUJI-Apple.jpg\"\n })\n\n const plums = await Product.create({\n title: 'Plums',\n description: \"I'm perfectly purple and plump!\",\n price: 129,\n inventory: 10,\n photo: \"http://www.dljproduce.com/wp-content/uploads/2017/10/Plum_iStock-822420778.jpg\"\n })\n\n const whitePeaches = await Product.create({\n title: 'White Peaches',\n description: \"I'm worth the mess you'll make eating me!\",\n price: 149,\n inventory: 10,\n photo: \"https://www.naturehills.com/media/catalog/product/cache/d73a5018306142840707bd616a4ef293/w/h/white-lady-peach-tree-6-800x800.jpg\"\n })\n\n const seedlessWatermelon = await Product.create({\n title: 'Seedless Watermelon',\n description: \"I'm the perfect summertime snack!\",\n price: 615,\n inventory: 10,\n photo: \"https://www.whataboutwatermelon.com/wp-content/uploads/2010/09/seedless2.jpg\"\n })\n\n const rainierCherries = await Product.create({\n title: 'Rainier Cherries',\n description: \"I'm a gem of a cherry variety!\",\n price: 599,\n inventory: 10,\n photo: \"https://images.eatthismuch.com/site_media/img/139485_test_user_6288648c-96da-4e3f-b871-a3249a4bf31e.png\"\n })\n\n const clementines = await Product.create({\n title: 'Clementines',\n description: \"I'm a perfect self-contained snack!\",\n price: 49,\n inventory: 10,\n photo: \"https://nutriliving-images.imgix.net/images/2014/266/1538/D15EB38C-4743-E411-B834-22000AF88B16.jpg?ch=DPR&w=488&h=488&auto=compress,format&dpr=1\"\n })\n\n const passionfruit = await Product.create({\n title: 'Passion Fruit',\n description: \"I'm zesty and full of life!\",\n price: 449,\n inventory: 10,\n photo: \"https://www.selinawamucii.com/wp-content/uploads/2014/08/Selina-Wamucii-Passion-Fruit-300x256.jpg\"\n })\n\n const dragonfruit = await Product.create({\n title: 'Dragonfruit',\n description: \"I'm a fierce once - devour me!\",\n price: 419,\n inventory: 10,\n photo: \"http://www.tang-freres.fr/wp-content/uploads/produits/fruits/fruit-du-dragon-pitaya.png\"\n })\n\n const coconut = await Product.create({\n title: 'Coconut',\n description: \"I'm a multifaceted one - eat me for breakfast, lunch, or dinner!\",\n price: 519,\n inventory: 10,\n photo: \"http://bodaciousolive.com/wp-content/uploads/2015/12/coconut-1024x842.jpg\"\n })\n\n const mangosteen = await Product.create({\n title: 'Mangosteen',\n description: \"I may sound like a mango but I'm a whole nother beast\",\n price: 649,\n inventory: 10,\n photo: \"https://cdn.shopify.com/s/files/1/0940/6866/products/shanzhuc-500x500_1024x1024.jpg?v=1467949283\"\n })\n\n const guava = await Product.create({\n title: 'Guava',\n description: \"I'm delicious whole or in a juice!\",\n price: 448,\n inventory: 10,\n photo: \"https://d1ubpsppdzqxsq.cloudfront.net/image/300s/ff/80/73/ff80734c6088f31177411d9548bce1daff770716.jpg\"\n })\n\n\n const papaya = await Product.create({\n title: 'Papaya',\n description: \"I'm creamy and sweet - what a treat!\",\n price: 529,\n inventory: 10,\n photo: \"https://www.fruttaweb.com/8371-large_default/fresh-papaya-ready-to-eat.jpg\"\n })\n\n const durian = await Product.create({\n title: 'Durian',\n description: \"I'm...an acquired taste. Banned on the Singapore subway system!\",\n price: 499,\n inventory: 10,\n photo: \"https://cdn.shopify.com/s/files/1/0940/6866/products/jack-fruit_1024x1024.jpg?v=1464302411\"\n })\n\n const rambutan = await Product.create({\n title: 'Rambutan',\n description: \"I'm a unique flavor - try me!\",\n price: 519,\n inventory: 10,\n photo: \"https://cdn3.volusion.com/oukqz.sbeju/v/vspfiles/photos/Hawaiian-Rambutan-fruit2-2.gif?1531528582\"\n })\n\n const koreanPear = await Product.create({\n title: 'Korean Pear',\n description: \"I'm crisp like an apple, juicy like a pear!\",\n price: 329,\n inventory: 10,\n photo: \"https://d1ubpsppdzqxsq.cloudfront.net/image/300s/2c/9d/44/2c9d4474b193dd4b0f7ef635a929afc3c08f8419.jpg\"\n })\n\n const starfruit = await Product.create({\n title: 'Starfruit',\n description: \"I add to the STAR quality of any fruit salad!\",\n price: 319,\n inventory: 10,\n photo: \"https://storage.googleapis.com/drhealthbenefits/2017/05/health-benefits-of-starfruit.jpg\"\n })\n\n const lychee = await Product.create({\n title: 'Lychee',\n description: \"I'm a pearl of sweetness and light\",\n price: 399,\n inventory: 10,\n photo: \"http://befreshcorp.net/wp-content/uploads/2017/07/product-packshot-Lychee.jpg\"\n })\n\n const kumquat = await Product.create({\n title: 'Kumquat',\n description: \"I'm a tiny burst of sunshine!\",\n price: 309,\n inventory: 10,\n photo: \"https://exoticfruitbox.com/wp-content/uploads/2015/10/kumquat.jpg\"\n })\n\n const figs = await Product.create({\n title: 'Figs',\n description: \"I'm delicious with honey and goat cheese!\",\n price: 509,\n inventory: 10,\n photo: \"https://4awcmd1th3m1scfs83pxlvbh-wpengine.netdna-ssl.com/wp-content/uploads/2016/08/figs.jpg\"\n })\n\n\n // Categories\n const stonefruit = await Category.create({\n title: 'Stone fruit',\n description: 'I have a pit!'\n })\n\n const citrus = await Category.create({\n title: 'Citrus',\n description: `I'm tarty!`\n })\n\n const tropical = await Category.create({\n title: 'Tropical',\n description: `I love warm weather!`\n })\n\n const classic = await Category.create({\n title: 'Classic',\n description: `I'm a childhood favorite!`\n })\n\n const berries = await Category.create({\n title: 'Berries',\n description: `I have lots of seeds!`\n })\n\n const seedless = await Category.create({\n title: 'Seedless',\n description: `I have no seeds!`\n })\n\n const popular = await Category.create({\n title: 'Popular',\n description: `I'm popular!`\n })\n\n const specials = await Category.create({\n title: 'Specials',\n description: `I'm special!`\n })\n\n await Promise.all([\n stonefruit.addProducts([mangoes, peaches, plums, nectarines, whitePeaches, cherries, rainierCherries, apricots, avocado, lychee, rambutan]),\n citrus.addProducts([lemons, oranges, redGrapefruit, limes, clementines]),\n tropical.addProducts([mangoes, pineapple, papaya, coconut, passionfruit, dragonfruit, bananas, avocado, lemons, mangosteen, lychee, kumquat, starfruit, durian, guava, kiwi]),\n classic.addProducts([fujiApples, grannySmithApples, galaApples]),\n berries.addProducts([strawberries, blueberries, blackberries, raspberries]),\n seedless.addProducts([redSeedlessGrapes, greenSeedlessGrapes, seedlessWatermelon]),\n popular.addProducts([bananas, strawberries, blueberries, fujiApples, peaches, lemons, watermelon, lychee]),\n specials.addProducts([mangosteen, dragonfruit, papaya, durian, rambutan, koreanPear, cantaloupe, figs, goldenKiwi])\n ])\n\n// Orders\n const order1 = await Order.create({\n userId: 1,\n isComplete: true,\n totalPrice: 100,\n isShipped: true\n })\n\n const order2 = await Order.create({\n userId: 1,\n isComplete: true,\n totalPrice: 200\n })\n\n const order3 = await Order.create({\n userId: 2,\n isComplete: true,\n totalPrice: 300,\n isShipped: true\n })\n\n const order4 = await Order.create({\n userId: 2,\n isComplete: true,\n totalPrice: 400,\n isShipped: true\n })\n\n const order5 = await Order.create({\n userId: 2,\n isComplete: true,\n totalPrice: 500\n })\n\n const bulkOrders = await Order.bulkCreate([\n {\n userId: 2,\n isComplete: true,\n totalPrice: 10,\n isShipped: true,\n createdAt: '2018-06-30 12:16:19.232-04'\n },\n {\n userId: 2,\n isComplete: true,\n totalPrice: 1000,\n createdAt: '2018-06-31 12:16:19.232-04'\n\n },\n {\n userId: 1,\n isComplete: false,\n totalPrice: 700,\n isShipped: true,\n createdAt: '2018-04-01 12:16:19.232-04'\n\n },\n {\n userId: 2,\n isComplete: false,\n totalPrice: 100,\n isShipped: true,\n createdAt: '2018-04-30 12:16:19.232-04'\n },\n {\n userId: 2,\n isComplete: true,\n totalPrice: 10,\n createdAt: '2018-03-30 12:16:19.232-04'\n },\n {\n userId: 2,\n isComplete: true,\n totalPrice: 150,\n createdAt: '2018-02-31 12:16:19.232-04'\n\n },\n {\n userId: 1,\n isComplete: true,\n totalPrice: 700,\n isShipped: true,\n createdAt: '2018-05-01 12:16:19.232-04'\n\n },\n {\n userId: 2,\n isComplete: true,\n totalPrice: 100,\n createdAt: '2018-05-30 12:16:19.232-04'\n },\n ])\n\n // OrderProducts entries\n const bulkOrderProducts = await OrderProducts.bulkCreate([\n {\n quantity: 1,\n unitPrice: 100,\n orderId: 1,\n productId: 3\n },\n {\n quantity: 2,\n unitPrice: 100,\n orderId: 2,\n productId: 5\n },\n {\n quantity: 3,\n unitPrice: 100,\n orderId: 3,\n productId: 4\n },\n {\n quantity: 1,\n unitPrice: 100,\n orderId: 4,\n productId: 3\n },\n {\n quantity: 2,\n unitPrice: 150,\n orderId: 4,\n productId: 2\n },\n {\n quantity: 3,\n unitPrice: 100,\n orderId: 5,\n productId: 2\n },\n {\n quantity: 1,\n unitPrice: 200,\n orderId: 5,\n productId: 3\n },\n {\n quantity: 3,\n unitPrice: 100,\n orderId: 5,\n productId: 1\n },\n {\n quantity: 1,\n unitPrice: 10,\n orderId: 6,\n productId: 4\n },\n {\n quantity: 3,\n unitPrice: 100,\n orderId: 7,\n productId: 1\n },\n {\n quantity: 1,\n unitPrice: 500,\n orderId: 7,\n productId: 3\n },\n {\n quantity: 1,\n unitPrice: 200,\n orderId: 7,\n productId: 4\n },\n {\n quantity: 1,\n unitPrice: 700,\n orderId: 8,\n productId: 3\n },\n {\n quantity: 1,\n unitPrice: 100,\n orderId: 9,\n productId: 4\n },\n {\n quantity: 1,\n unitPrice: 10,\n orderId: 10,\n productId: 5\n },\n {\n quantity: 1,\n unitPrice: 150,\n orderId: 11,\n productId: 4\n },\n {\n quantity: 1,\n unitPrice: 700,\n orderId: 12,\n productId: 3\n },\n {\n quantity: 1,\n unitPrice: 100,\n orderId: 13,\n productId: 3\n }\n ])\n\n console.log('Success! Product database is seeded!')\n}", "title": "" }, { "docid": "9aab966572763e38873495d88ebda674", "score": "0.4919848", "text": "function handleSubmit() { uploadSet(name, images, setSuccess); }", "title": "" }, { "docid": "03ae0b3dabfc9299dbd42185517236fd", "score": "0.49155787", "text": "all(success, fail) {\n this.dao.dbaccess(() => {\n new Promise((resolve, reject) => {\n this.dao.begin();\n this.dao.all(resolve, reject);\n })\n .then((ups) => {\n const upfiles = [];\n if (ups) {\n ups.forEach((up) => {\n upfiles.push({\n id: up.id,\n name: up.name,\n path: up.path,\n mime: up.mime,\n size: up.size,\n time: up.time,\n });\n });\n }\n this.dao.commit();\n success(upfiles);\n })\n .catch((err) => {\n this.dao.rollback();\n fail(err);\n });\n });\n }", "title": "" }, { "docid": "08cede163f41c184cd8def491b7520b7", "score": "0.4914102", "text": "function uploadDataToDatabase() {\n var data = JSON.parse(raw_data);\n console.log(\"Upload data\");\n console.log(data);\n for (var i = 0; i < data.length; i++) {\n addSample(data[i]);\n }\n // eslint-disable-next-line no-alert\n alert(\"Sample data in the file has been uploaded successfully\");\n}", "title": "" }, { "docid": "8658c6c8b0f22f9d9d689897cccddbae", "score": "0.49127874", "text": "function startUpload(){\r\n\t\tconsole.log(\"Start Upload\");\r\n\t\t//Ask the user if he or she wants to leave (and abort the upload process)\r\n\t\tleaveMessage(true);\r\n\t\t\r\n\t\t//Change the handlers\r\n\t\tenableCancel();\r\n\t\tdisableSubmit();\r\n\t\t\r\n\t\t//Upload the first file\r\n\t\tfor(index in files.local) {\r\n\t\t\t// Alternative analyse method: uploading to EchoNest\r\n\t\t\tvar file = files.local[index],\r\n\t\t\t\tcb_alt = function(){ upload(file, index); };\r\n\t\t\t\tcb_suc = function(echo_data){\r\n\t\t\t\t\t// Convert song to track data\r\n\t\t\t\t\techo_data = {\r\n\t\t\t\t\t\tid: echo_data.id,\r\n\t\t\t\t\t\tartist_id: echo_data.artist_id,\r\n\t\t\t\t\t\tartist: echo_data.artist_name,\r\n\t\t\t\t\t\ttitle: echo_data.title,\r\n\t\t\t\t\t\taudio_summary: echo_data.audio_summary\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// Wrap\r\n\t\t\t\t\tfile.response = {track: echo_data};\r\n\t\t\t\t\tsyncResult(file, index);\r\n\t\t\t\t};\r\n\t\t\t// ID3 analyse method\r\n\t\t\tID3.loadTags(files.local[index], function(){\r\n\t\t\t\t// Try to get loaded tags\r\n\t\t\t\tvar tags = ID3.getAllTags(file.name);\r\n\t\t\t\t// Search on Echonest with these tags\r\n\t\t\t\ttagsToEchonest(tags, function(code, data){\r\n\t\t\t\t\tif(code == 0)\r\n\t\t\t\t\t\tcb_suc(data);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tcb_alt();\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tif(Object.keys(files.local).length == 0) leaveMessage(false);\r\n\t}", "title": "" }, { "docid": "8251b9aed04e5667d2421b8e50a0630e", "score": "0.49029633", "text": "'items.insert'(text, qty) {\n //Validate the incomming data\n check(text, String);\n check(qty, String);\n\n //Check that the user IS logged in\n if(!this.userId) {\n throw new Meteor.Error('not-authorzed');\n }\n //add the record to the DB. This helps ensure there is a standard format in our data\n Items.insert({\n text,\n qty,\n createdAt: new Date(),\n owner: this.userId,\n username: Meteor.users.findOne(this.userId).username,\n });\n }", "title": "" }, { "docid": "df5e7bca7130cda5ff6fc770f86b25cb", "score": "0.48974752", "text": "handleSubmit(e) {\n let itemName = e.target.ItemName.value;\n let itemDescription = e.target.ItemDescription.value;\n let itemQuantity = e.target.ItemQuantity.value;\n let itemPrice = e.target.ItemPrice.value;\n let itemUnitMeasure = e.target.ItemUnitMeasure.value;\n e.preventDefault();\n if (itemName) {\n e.target.ItemName.value = '';\n e.target.ItemDescription.value = '';\n e.target.ItemQuantity.value = '';\n e.target.ItemPrice.value = '';\n Meteor.call('items.insert',itemName,itemDescription,itemQuantity,itemPrice,itemUnitMeasure)\n\n }\n }", "title": "" }, { "docid": "3d11a794a7b3b1889ee8c11dc735f7a6", "score": "0.4889162", "text": "prepareItems() {\n for (this.limiter.beginFrame(); this.queue.length && this.limiter.allowedToUpload(); ) {\n const item = this.queue[0];\n let uploaded = !1;\n if (item && !item._destroyed) {\n for (let i2 = 0, len = this.uploadHooks.length; i2 < len; i2++)\n if (this.uploadHooks[i2](this.uploadHookHelper, item)) {\n this.queue.shift(), uploaded = !0;\n break;\n }\n }\n uploaded || this.queue.shift();\n }\n if (this.queue.length)\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n else {\n this.ticking = !1;\n const completes = this.completes.slice(0);\n this.completes.length = 0;\n for (let i2 = 0, len = completes.length; i2 < len; i2++)\n completes[i2]();\n }\n }", "title": "" }, { "docid": "648ab7e75e5678e4de7fc15fb9cc4a83", "score": "0.4888141", "text": "async function saveTweets(tweets) {\n try {\n tweets.forEach((t) => {\n db.run('INSERT INTO tweets VALUES (?,?,?,?,?);',\n [t.tweet_id, t.tweet, t.created_at, t.user.user_name, t.user.user_id],\n (err) => {\n if (err) {\n console.log(err.message)\n }\n })\n })\n } catch (e) {\n console.log(e)\n }\n}", "title": "" }, { "docid": "f1c8e169e508c0a191d38e31afa65dd0", "score": "0.48865345", "text": "function seedDB(){\n \n Campground.remove({}, function(err){ //1\n if(err){\n console.log(err);\n }\n console.log(\"removed campgrounds!\");\n Comment.remove({}, function(err) {\n if(err){\n console.log(err);\n }\n console.log(\"removed comments!\"); //2\n \n data.forEach(function(seed){ //3\n Campground.create(seed, function(err, campground){\n if(err){\n console.log(err)\n } else {\n console.log(\"added a campground\");\n \n Comment.create( //4\n {\n text: \"This place is great, but I wish there was internet\",\n author: \"Homer\"\n }, function(err, comment){\n if(err){\n console.log(err);\n } else {\n campground.comments.push(comment); //5\n campground.save(); //6\n console.log(\"Created new comment\");\n }\n });\n }\n });\n });\n });\n }); \n //add a few comments\n}", "title": "" }, { "docid": "b78f2c6e2a987730d64a383117a1dfe1", "score": "0.48852208", "text": "function upsert(req, res, uid) {\n client\n .database('shop')\n .container('items')\n .items.upsert(req.body).then(results => {\n console.log(\"UPSERT GOOD TO GO\");\n }).catch(error=> console.log(error));\n}", "title": "" }, { "docid": "e69532395cf4ac5a0be8aa4c7921c427", "score": "0.48850906", "text": "uploadImageFirebase(context,fileForInsert){\n return new Promise((resolve) => {\n for (let index = 0; index < fileForInsert.length; index++) {\n const element = fileForInsert[index];\n const uuid = element.uuid ;\n // console.log('element', element)\n // console.log('uuid', uuid)\n // console.log(state.files[index])\n \n firebase.auth().signInWithEmailAndPassword(state.userFirebase,state.passFirebase)\n .then(() => {\n var storageRef = firebase.storage().ref();\n var metadata = {\n contentType: element.file[0].type\n }\n const filename = element.file[0].name\n const ext = filename.slice(filename.lastIndexOf('.'))\n var uploadTask = storageRef.child('products/' + uuid + ext).put(element.file[0], metadata);\n\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, \n function(snapshot) {\n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED: \n // console.log('Upload is paused');\n break;\n case firebase.storage.TaskState.RUNNING: \n // console.log('Upload is running');\n break;\n }\n }, function(error) {\n switch (error.code) {\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n break;\n\n case 'storage/canceled':\n // User canceled the upload\n break;\n\n case 'storage/unknown':\n // Unknown error occurred, inspect error.serverResponse\n break;\n }\n }, function complete () {\n // Upload completed successfully, now we can get the download URL\n uploadTask.snapshot.ref.getDownloadURL().then(function(downloadURL) {\n let objectFile={\n index: index,\n name: uuid + ext,\n urlFirebase:downloadURL\n }\n // // // console.log('tama;o Imagen', state.maxUploadImage-1)\n \n context.commit('addingImageFirebase',objectFile)\n // console.log('File available at', downloadURL);\n if(fileForInsert.length == index+1){\n // console.log('entro para que siga el procedimiento')\n resolve(true)\n }\n });\n })\n })\n }\n })\n }", "title": "" }, { "docid": "ec5624de3a0438c9a2172f3e814f340b", "score": "0.48839504", "text": "function Upload(response)\n{\n\tconsole.log(\"Request handler 'upload' was called.\");\n\t\n\t// get our table names list (the things to import)\n\tvar list = dataKnowledge.GetTableNames();\n\tvar last = '';\n\tfor (var i in list) {\n\t\tlast = list[i];\n\t}\n\t\t\n\tout.UploadOutput('init', response);\t\n\tfor (var i in list) {\n\t\tvar isLast = false; \n\t\tif (list[i] == last) {\n\t\t\tisLast = true;\n\t\t}\t\t\t\t\t\n\t\tUploadData(list[i], response, isLast)\n\t}\t\t\n}", "title": "" }, { "docid": "cd636ec9e44ffc2a0b5b9aaff5280992", "score": "0.48774755", "text": "function cachePostToIdb() {\n\t\tconsole.log('start saving to indexeddb');\n\n\t\t// ==========indexedDB================\n\t\tconst dbName = 'newReviewsDB'\n\t\tconst dbVersion = 12\n\n\t\t// Create/open database\n\t\tvar request = indexedDB.open(dbName, dbVersion);\n\n\t\trequest.onerror = function (event) {\n\t\t\tconsole.log('indexedDB error for newReviewsDB: ' + this.error);\n\t\t};\n\n\t\t// ============= ON SUCCESS ================\n\t\trequest.onsuccess = function (event) {\n\t\t\tconsole.log('Database newReviews initialised succesfully');\n\n\t\t\t// store the result of opening the database in the db variable.\n\t\t\tvar db = event.target.result;\n\n\t\t\tdb.onerror = function (event) {\n\t\t\t\t// Generic error handler for all errors targeted \n\t\t\t\t// at this database's requests!\n\t\t\t\tconsole.log('Database newReview error: ' + event.target.errorCode);\n\t\t\t};\n\n\t\t\t// open a read/write db transaction, ready for adding the data\n\t\t\tvar transaction = db.transaction(['NewReview'], 'readwrite');\n\n\t\t\t// call an object store that's already been added to the database\n\t\t\tvar objectStore = transaction.objectStore('NewReview');\n\n\t\t\tobjectStore.put(objNewReview);\n\n\t\t\t// report on the success of the transaction completing, when everything is done\n\t\t\ttransaction.oncomplete = function () {\n\t\t\t\tconsole.log('Transaction completed: database modification finished');\n\t\t\t};\n\n\t\t\ttransaction.onerror = function () {\n\t\t\t\tconsole.log('Transaction not opened due to error: ' + transaction.error);\n\t\t\t};\n\n\n\t\t\tconsole.log('REPORT ///////////////////////////////');\n\t\t\tconsole.log('objectStore indexNames: ' + objectStore.indexNames);\n\t\t\tconsole.log('objectStore keyPath: ' + objectStore.keyPath);\n\t\t\tconsole.log('objectStore name: ' + objectStore.name);\n\t\t\tconsole.log('objectStore transaction: ' + objectStore.transaction);\n\t\t\tconsole.log('objectStore autoIncrement: ' + objectStore.autoIncrement);\n\t\t\tconsole.log('///////////////////////////////');\n\t\t};\n\n\n\t\t// ============= ON UPGRADE (DB SCHEMA) ================\n\t\trequest.onupgradeneeded = function (event) {\n\t\t\tconsole.log('onupgradeneeded request triggered: ' + event);\n\n\t\t\tvar db = event.target.result;\n\n\t\t\tdb.onerror = function (event) {\n\t\t\t\tconsole.log('Error loading database');\n\t\t\t};\n\n\t\t\tdb.onversionchange = function (event) {\n\t\t\t\tconsole.log('version changed, user should be informed');\n\n\t\t\t};\n\n\t\t\t// Create an objectStore for this database\n\t\t\tvar objectStore = db.createObjectStore('NewReview', {\n\t\t\t\tkeyPath: 'name'\n\t\t\t\t// autoIncrement: true\n\t\t\t});\n\n\t\t\tconsole.log('onupgradeneeded event triggered, object store restaurants created');\n\n\t\t};\n\n\n\t\t// ==========indexedDB END================\t\t\n\t}", "title": "" }, { "docid": "f728fef4fa0aef9e7d522beaa2df772e", "score": "0.48771814", "text": "function insertSeedData() {\n console.log(\"Inside Seed Data\");\n Task.insertMany(seedTasks, function(err) {\n if (err) {\n console.log(err);\n } else {\n console.log(\"Seed Data Successful\");\n }\n });\n}", "title": "" }, { "docid": "848d0162d576f3c711d9099b56d3f465", "score": "0.48769403", "text": "async function seed() {\n await db.sync({force: true})\n console.log('db synced!')\n // Whoa! Because we `await` the promise that db.sync returns, the next line will not be\n // executed until that promise resolves!\n const users = await Promise.all([\n User.create({email: '[email protected]', password: '123'}),\n User.create({email: '[email protected]', password: '123'})\n ])\n const products = await Promise.all([\n Product.create({\n name: 'air ones',\n price: 100,\n picture: '/pictures/airJordan.jpg'\n }),\n Product.create({\n name: 'Kyrie',\n price: 200,\n picture: '/pictures/footLocker.jpg'\n }),\n Product.create({\n name: 'Clown Shoes',\n price: 150,\n picture: '/pictures/clown-shoes-red-and-yellow.jpg'\n }),\n Product.create({\n name: 'DRose',\n price: 250,\n picture: '/pictures/drose.jpg'\n }),\n Product.create({\n name: 'Crocs',\n price: 40,\n picture: '/pictures/crocs.jpg'\n }),\n Product.create({\n name: 'Flip Flops',\n price: 250,\n picture: '/pictures/flipflops.jpg'\n }),\n Product.create({\n name: 'Yeezys',\n price: 10000,\n picture: '/pictures/yeezy.jpg'\n })\n ])\n const sizes = await Promise.all([\n Size.create({\n size: 7\n }),\n Size.create({\n size: 8\n }),\n Size.create({\n size: 9\n }),\n Size.create({\n size: 10\n }),\n Size.create({\n size: 11\n }),\n Size.create({\n size: 12\n })\n ])\n const inventoryWithSize = await Promise.all([\n ProductSize.create({\n inventory: 0,\n size: 7,\n productId: 1\n }),\n ProductSize.create({\n inventory: 4,\n size: 8,\n productId: 1\n }),\n ProductSize.create({\n inventory: 5,\n size: 9,\n productId: 1\n }),\n ProductSize.create({\n inventory: 2,\n size: 10,\n productId: 1\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 1\n }),\n ProductSize.create({\n inventory: 1,\n size: 12,\n productId: 1\n }),\n ProductSize.create({\n inventory: 3,\n size: 7,\n productId: 2\n }),\n ProductSize.create({\n inventory: 5,\n size: 8,\n productId: 2\n }),\n ProductSize.create({\n inventory: 2,\n size: 9,\n productId: 2\n }),\n ProductSize.create({\n inventory: 1,\n size: 10,\n productId: 2\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 2\n }),\n ProductSize.create({\n inventory: 4,\n size: 12,\n productId: 2\n }),\n ProductSize.create({\n inventory: 1,\n size: 7,\n productId: 3\n }),\n ProductSize.create({\n inventory: 2,\n size: 8,\n productId: 3\n }),\n ProductSize.create({\n inventory: 6,\n size: 9,\n productId: 3\n }),\n ProductSize.create({\n inventory: 6,\n size: 10,\n productId: 3\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 3\n }),\n ProductSize.create({\n inventory: 0,\n size: 12,\n productId: 3\n }),\n ProductSize.create({\n inventory: 1,\n size: 7,\n productId: 4\n }),\n ProductSize.create({\n inventory: 2,\n size: 8,\n productId: 4\n }),\n ProductSize.create({\n inventory: 6,\n size: 9,\n productId: 4\n }),\n ProductSize.create({\n inventory: 6,\n size: 10,\n productId: 4\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 4\n }),\n ProductSize.create({\n inventory: 0,\n size: 12,\n productId: 4\n }),\n ProductSize.create({\n inventory: 1,\n size: 7,\n productId: 5\n }),\n ProductSize.create({\n inventory: 2,\n size: 8,\n productId: 5\n }),\n ProductSize.create({\n inventory: 6,\n size: 9,\n productId: 5\n }),\n ProductSize.create({\n inventory: 6,\n size: 10,\n productId: 5\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 5\n }),\n ProductSize.create({\n inventory: 0,\n size: 12,\n productId: 5\n }),\n ProductSize.create({\n inventory: 1,\n size: 7,\n productId: 6\n }),\n ProductSize.create({\n inventory: 2,\n size: 8,\n productId: 6\n }),\n ProductSize.create({\n inventory: 6,\n size: 9,\n productId: 6\n }),\n ProductSize.create({\n inventory: 6,\n size: 10,\n productId: 6\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 6\n }),\n ProductSize.create({\n inventory: 0,\n size: 12,\n productId: 6\n }),\n ProductSize.create({\n inventory: 1,\n size: 7,\n productId: 7\n }),\n ProductSize.create({\n inventory: 2,\n size: 8,\n productId: 7\n }),\n ProductSize.create({\n inventory: 6,\n size: 9,\n productId: 7\n }),\n ProductSize.create({\n inventory: 6,\n size: 10,\n productId: 7\n }),\n ProductSize.create({\n inventory: 3,\n size: 11,\n productId: 7\n }),\n ProductSize.create({\n inventory: 0,\n size: 12,\n productId: 7\n }),\n ])\n\n // Wowzers! We can even `await` on the right-hand side of the assignment operator\n // and store the result that the promise resolves to in a variable! This is nice!\n console.log(`seeded ${users.length} users`)\n console.log(`seeded ${products.length} products`)\n console.log(`seeded ${sizes.length} sizes`)\n console.log(`seeded successfully`)\n}", "title": "" }, { "docid": "1d4a90f4060b71f2351ac60266cb74a1", "score": "0.48743024", "text": "async save(){\n if (this.id === undefined){\n await InsertManager.insert(this);\n }\n else{\n /*\n await databaseManager.updateObject(this);\n */\n }\n }", "title": "" }, { "docid": "6df8ae7f6138c653f22e178437806706", "score": "0.4873014", "text": "SaveAndReimport() {}", "title": "" }, { "docid": "57e59e640d0909293fefef3f27e5380f", "score": "0.48729265", "text": "afterUpload() {}", "title": "" }, { "docid": "e48c699c3d71ecfc15704e6d95378cab", "score": "0.48686165", "text": "handleSave() {\n // for all the keys updated set the store with those updates\n for (let key in this.state.tempData) {\n this.store.setProfileSubStore(key, this.state.tempData[`${key}`]);\n }\n\n // Update firebase\n this.store.writePlaces(this.globalStore.placeId);\n this.setState({ show: false });\n }", "title": "" }, { "docid": "8c1b4f204b59f5216c3603c53c175de6", "score": "0.48684195", "text": "saveInDB () {\n\n const actives = db.events.get('actives'),\n index = actives.findIndex(event => event.id === this.#id).value()\n \n if (index < 0) actives.push(this.getObject()).write()\n else actives.set(`[${index}]`, this.getObject()).write()\n\n }", "title": "" }, { "docid": "1cc063bcfa4d0568be0409d2e01521b0", "score": "0.48664835", "text": "function onceClear(err) {\n if(err) console.log(err);\n\n // Saving Users\n var to_save_count = projects_json[\"users\"].length;\n for(var i=0; i<projects_json[\"users\"].length; i++) {\n var json = projects_json[\"users\"][i];\n var usr = new models.Users(json);\n\n usr.save(function(err, usr) {\n if(err) console.log(err);\n console.log(usr);\n to_save_count--;\n console.log(to_save_count + ' left to save');\n if(to_save_count <= 0) {\n console.log('DONE');\n // The script won't terminate until the \n // connection to the database is closed\n //mongoose.connection.close()\n }\n });\n }\n}", "title": "" }, { "docid": "0ae0c643ec96d6e364561754e718c1f3", "score": "0.4863753", "text": "function upload(user, imageList, outfitName) {\n // Strip email\n removeDomain = user.substring(0, user.lastIndexOf(\"@\"));\n removeSpecialChar = removeDomain.replace(/@[^@]+$/, '')\n user = removeSpecialChar\n\n console.log(imageList)\n\n // Format parameters\n for (i=0; i<imageList.length; i++) {\n\n removeExtra = imageList[i].substring(imageList[i].length - 10, imageList[i].length)\n\n let postKey = firebase.database().ref(user + \"/outfits/\" + outfitName + \"/\" + removeExtra).key;\n let updates = {};\n let postData = {\n url: imageList[i],\n name: i\n };\n // console.log(imageList[i], i)\n\n var ref = firebase.database().ref()\n ref.child(user).once(\"value\", gotUserData);\n function gotUserData() {\n updates[\"/\" + user + \"/outfits/\" + outfitName + \"/\" + postKey] = postData;\n firebase.database().ref().update(updates)\n }\n }\n}", "title": "" }, { "docid": "e94d99f19f53006bcabbdd02d85c8730", "score": "0.48556095", "text": "function updateDB(event) {\n event.preventDefault();\n const username = usernameElement.value;\n const message = messageElement.value;\n\n usernameElement.value = \"\";\n messageElement.value = \"\";\n\n console.log(username + \" : \" + message);\n\n //Update database here\n let value = {\n NAME: username,\n Message: message\n };\n\n db.push(value);\n\n}", "title": "" }, { "docid": "c5e22dc3d0cfe60157c5acdd40290373", "score": "0.4851134", "text": "function saveToDb() {\n data[i].sid = uuid.v4();\n data[i].gpa = getRandomFloatInclusive(2.5, 4.0).toFixed(1);\n data[i].major = majors[getRandomIntInclusive(0, majors.length - 1)];\n data[i].modified = date;\n data[i].modifiedby = admins[getRandomIntInclusive(0, admins.length - 1)];\n delete data[i].name.title;\n\tdata[i].name.first = capitalizeAll(data[i].name.first);\n\tdata[i].name.last = capitalizeAll(data[i].name.last);\n\tdata[i].location.street = capitalizeAll(data[i].location.street);\n\tdata[i].location.city = capitalizeAll(data[i].location.city);\n\tdata[i].location.state = capitalizeAll(data[i].location.state);\n delete data[i].picture.thumbnail;\n delete data[i].picture.medium;\n\n itemProvider.saveItem({ collection: 'students', student: data[i] })\n .then(res => {\n console.log('saved: ' + data[i].sid, i + '/' + l);\n return i < data.length - 1 ? (i++ , void saveToDb()) : void process.exit();\n });\n}", "title": "" }, { "docid": "6f86ddc75cb6106da1152d271aa284a9", "score": "0.48462877", "text": "function addArticles(articles) {\n console.log(`Adding ${articles.length} articles`);\n \n articles.forEach(item => {\n // const article = new db.Article(item);\n \n // \"unique\" constraint doesn't seem to work sometimes(?)\n // somehow allowing to insert duplicates\n // article\n // .save()\n // .then(dbArticle => console.log(dbArticle))\n // .catch(err => console.log(err));\n \n // console.log(`Adding ${item}`);\n db.Article.findOneAndUpdate({\n link: item.link\n }, \n item, {\n upsert: true,\n returnNewDocument: true\n })\n .then(doc => {\n // console.log(`Added ${doc}`);\n ;\n })\n .catch(err => console.log(err));\n });\n}", "title": "" }, { "docid": "7c97d51064b93ed01e49f89078da6686", "score": "0.4844833", "text": "async function saveThisHasAllLogsForUser(exerciseModel, done) {\n try {\n await exerciseModel.save(done);\n } catch (err) {\n console.log(\"Line 209\" + err);\n done(err);\n }\n}", "title": "" }, { "docid": "53c3adaa2c580bd5471cdcd925ed2d2f", "score": "0.4829563", "text": "insertDataIntoCollection (data, collectionName) {\n if (data && collectionName && CollectionMap[ collectionName ]) {\n // if you have a partial duplicate, you should still be able to import the rest of the file.\n try {\n let key = importKeys[ collectionName ] || '_id',\n query = {},\n importCount = 0;\n data.forEach((record) => {\n query[ key ] = record[ key ];\n importCount += 1;\n //console.info('ImportExportTool.insertDataIntoCollection inserting', collectionName, key, record[ key ]);\n \n // Updating the _id field will fail, so remove it\n if (key !== '_id') {\n delete record._id\n }\n \n // Upsert triggers insert handler default values, so do an update or insert\n let check = CollectionMap[ collectionName ].findOne(query);\n if (check) {\n CollectionMap[ collectionName ].remove(query);\n }\n CollectionMap[ collectionName ].insert(record, { bypassCollection2: true });\n });\n console.info('ImportExportTool inserted', importCount, 'records into', collectionName);\n } catch (e) {\n console.error('ImportExportTool.insertDataIntoCollection failed:', e);\n }\n } else {\n console.error('ImportExportTool.insertDataIntoCollection failed: collection [', collectionName, '] not found');\n }\n }", "title": "" } ]
177cc011e0e0858cf26c994ba0a93079
HRB: End of function sortGlossryTerms() / HRB: Function Name : getPrintListTableRow() Description : creates and returns a row into print preview list table Return Value :
[ { "docid": "09fb4adc9494dbbc47a6face5545fabd", "score": "0.5998864", "text": "function addPrintListTableRow(chapNum,chaptTitle,printPagePath,curTable) {\n\t\n\tvar curRow = curTable.insertRow(curTable.rows.length);\n\t\n\tif(checkBrowser() == 'IE') { // if Internet Explorer\n\t\tcurRow.setAttribute(\"valign\",\"top\");\t\t\n\t\tcurRow.onmouseover = function(){ this.style.color='#75b3d5'; };\n\t\tcurRow.onmouseout = function(){ this.style.color='#025A86'; };\n\t\tcurRow.onmousedown = function(){ OpenNew(printPagePath); };\n\t}\n\telse {\n\t\tcurRow.setAttribute(\"valign\",\"top\");\n\t\tcurRow.setAttribute(\"onmouseover\",\"this.style.color='#75b3d5'\");\n\t\tcurRow.setAttribute(\"onmouseout\",\"this.style.color='#025A86'\");\n\t\tcurRow.setAttribute(\"onmousedown\",\"OpenNew('\"+printPagePath+\"')\"); // FF\t\t\n\t}\n\t\t\n\tvar curCol = curRow.insertCell(curRow.cells.length);\n\tvar curSpan = document.createElement('span');\n\tcurSpan.style.cursor=\"pointer\";\n\tif(checkBrowser() == 'IE') { // if Internet Explorer\n\t\tcurSpan.onmouseover = function(){ this.style.color='#75b3d5'; };\n\t\tcurSpan.onmouseout = function(){ this.style.color='#025A86'; };\n\t}\n\telse {\n\t\tcurSpan.setAttribute(\"onmouseover\",\"this.style.color='#75b3d5'\");\n\t\tcurSpan.setAttribute(\"onmouseout\",\"this.style.color='#025A86'\");\n\t}\n\tcurSpan.innerHTML = chapNum;\n\tcurCol.appendChild(curSpan);\n\t\n\tcurCol = curRow.insertCell(curRow.cells.length);\n\tcurSpan = document.createElement('a');\n\tcurSpan.style.cursor=\"pointer\";\n\tif(checkBrowser() == 'IE') { // if Internet Explorer\n\t\tcurSpan.onmouseover = function(){ this.style.color='#75b3d5'; };\n\t\tcurSpan.onmouseout = function(){ this.style.color='#025A86'; };\n\t}\n\telse {\n\t\tcurSpan.setAttribute(\"onmouseover\",\"this.style.color='#75b3d5'\");\n\t\tcurSpan.setAttribute(\"onmouseout\",\"this.style.color='#025A86'\");\n\t}\n\tcurCol.setAttribute(\"title\",\"Go to this chapter\");\n\tif(is508Compliance) {\n\t\tif(checkBrowser() == 'IE') {\n\t\t\tcurSpan.tabIndex=\"41\";\n\t\t\tcurSpan.style.border=\"4px solid transparent\";\n\t\t\tcurSpan.onfocus=function(){onfocuselement(this);};\n\t\t\tcurSpan.onblur=function(){onblurelement(this);};\n\t\t\tcurSpan.onkeyup=function(){if(chkEnterKey(event)){OpenNew(printPagePath);}};\n\t\t\tcurSpan.onclick=function(){if(chkEnterKey(event)){OpenNew(printPagePath);}};\n\t\t}\n\t\telse {\n\t\t\tcurSpan.setAttribute(\"tabindex\",\"41\");\n\t\t\tcurSpan.setAttribute(\"style\",\"border:4px solid transparent\");\n\t\t\tcurSpan.setAttribute(\"onfocus\",\"onfocuselement(this);\");\n\t\t\tcurSpan.setAttribute(\"onblur\",\"onblurelement(this);\");\n\t\t\tcurSpan.setAttribute(\"onkeyup\",\"if(chkEnterKey(event)){OpenNew('\"+printPagePath+\"')}\");\n\t\t\tcurSpan.setAttribute(\"onclick\",\"if(chkEnterKey(event)){OpenNew('\"+printPagePath+\"')}\");\n\t\t}\n\t}\n\tcurSpan.innerHTML = chaptTitle;\n\tcurCol.appendChild(curSpan);\n}", "title": "" } ]
[ { "docid": "6f1fe026702599ef65cd010f66ab2d94", "score": "0.60202765", "text": "function sortGlossryTerms() {\n\tvar strRef=\"\";\n\tvar glossaryTermsListDiv = document.getElementById(\"glossTermsListDiv\");\n\tvar arrPageGlossTerms = glossaryTermsListDiv.getElementsByTagName('a');\n\tvar strIndexSperator = \"<!>\";\t// for seperating glossary term from index number\n\tfor(var ind = 0;ind<arrPageGlossTerms.length;ind++) {\n\t\tvar curTermLink = arrPageGlossTerms[ind];\n\t\tif(curTermLink != null && typeof curTermLink != \"undefined\" && (curTermLink.tagName == \"a\" || curTermLink.tagName == \"A\")) {\n\t\t\tif(typeof globalGlossRefArr[curTermLink.innerHTML] == \"undefined\") {\n\t\t\t\tglobalGlossKeyArr.push(curTermLink.innerHTML);\n\t\t\t\tstrRef = curTermLink.href.substring(\"javascript:O('\".length,curTermLink.href.indexOf(\"')\"))\n\t\t\t\tglobalGlossRefArr[curTermLink.innerHTML] = strRef;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// Sort the key Array\n\tglobalGlossKeyArr.sort();\n\t\n\tvar glossTermsDiv = document.getElementById(\"glossTermsDiv\");\t\n\t\n\tfor(iIndex = 0 ; iIndex < globalGlossKeyArr.length ; iIndex++) {\t\t\n\t\tvar glossWord = globalGlossKeyArr[iIndex];\n\t\tvar strRefFile = globalGlossRefArr[globalGlossKeyArr[iIndex]];\n\t\t\n\t\t// HRB: Srart of code to Create link and add into glossTermsDiv\n\t\t\n\t\tvar anchorLink = document.createElement('a');\n\t\tanchorLink.setAttribute(\"class\",\"clsGlossaryLinks\");\n\t\tanchorLink.setAttribute(\"href\",\"javascript:O(\\'\"+strRefFile+\"\\')\");\n\t\tanchorLink.setAttribute(\"title\",\"View this term\");\n\t\t\n\t\tif(is508Compliance) {\n\t\t\tanchorLink.tabIndex=\"24\";\n\t\t\tanchorLink.style.border=\"4px solid transparent\";\n\t\t\tanchorLink.setAttribute(\"onfocus\",\"onfocuselement(this)\");\n\t\t\tif(iIndex==0) {\n\t\t\t anchorLink.setAttribute(\"onkeydown\",\"chkKeyPress(event)\");\n\t\t\t anchorLink.setAttribute(\"onblur\",\"onblurelement(this);if(chkShiftTabPress(event,\\'shifttab\\')){document.getElementById(\\'glossLx\\').focus();}\");\n\t\t\t}\n\t\t\telse {\n\t\t\t anchorLink.setAttribute(\"onblur\",\"onblurelement(this)\");\n\t\t\t}\n\t\t\tanchorLink.setAttribute(\"onclick\",\"if(chkEnterKey(event)){O(\\'\"+strRefFile+\"\\');document.getElementById(\\'popupLx\\').srcEle=this;setTimeout(function(){document.getElementById(\\'popupL1\\').focus();},\\'10\\')}\");\n\t\t\tanchorLink.setAttribute(\"onkeyup\",\"if(chkEnterKey(event)){O(\\'\"+strRefFile+\"\\');document.getElementById(\\'popupLx\\').srcEle=this;setTimeout(function(){document.getElementById(\\'popupL1\\').focus();},\\'10\\')}\");\n\t\t}\n\t\t\n\t\tanchorLink.innerHTML = glossWord;\n\t\tglossTermsDiv.appendChild(anchorLink);\n\t\t\n\t\tvar subTag = document.createElement('sub');\n\t\tglossTermsDiv.appendChild(subTag);\n\t\t\n\t\tvar brTag = document.createElement('br');\n\t\tglossTermsDiv.appendChild(brTag);\t\t\n\t}\n\t\n\t// Remove glossaryTermsListDiv\n\tvar parentGlossaryTermsListDiv = glossaryTermsListDiv.parentNode;\n\tparentGlossaryTermsListDiv.removeChild(glossaryTermsListDiv);\n}", "title": "" }, { "docid": "cf05426476e2542c4f43183860558a8a", "score": "0.5700521", "text": "function setPrintList() {\n\tvar divPrintL1 = document.getElementById('printL1');\n\t\t\n\tvar tblChapterListTemp = divPrintL1.getElementsByTagName('table')[0];\n\t//HRB: Start of code to remove Document of progess row in case of final exam\n\t//if(tblChapterListTemp.rows.length>tblChapterListTemp.rows.length + 1)\n\tif(FinalExam == \"bychapter\") {\n\t\t//var documentRow = tblChapterListTemp.rows[tblChapterListTemp.rows.length-1].cloneNode(true);\n\t\tvar glossaryRow = tblChapterListTemp.rows[tblChapterListTemp.rows.length-1].cloneNode(true);\n\t\t\n\t\t// add glossary and progrees document rows in tblChapterList\n\t\ttblChapterList.tBodies[0].appendChild(glossaryRow);\n//\t\ttblChapterList.tBodies[0].appendChild(documentRow);\n\t}\n\telse {\n\t\tvar glossaryRow = tblChapterListTemp.rows[tblChapterListTemp.rows.length-1].cloneNode(true);\n\t\t// add glossary and progrees document rows in tblChapterList\n\t\ttblChapterList.tBodies[0].appendChild(glossaryRow);\n\t}\n\t//HRB: Start of code to remove Document of progess row in case of final exam\n\t// Delete all tblChapterListTemp rows\n\twhile(tblChapterListTemp.rows.length > 0) {\n\t\ttblChapterListTemp.deleteRow(0);\n\t}\n\t\n\t// Add rows of tblChapterList into table tblChapterListTemp\n\twhile(tblChapterList.rows.length > 0) {\n\t\ttblChapterListTemp.tBodies[0].appendChild(tblChapterList.rows[0]);\n\t}\n}", "title": "" }, { "docid": "c727363b5bb04bc8e98f2179936cb6ed", "score": "0.5647705", "text": "function displayTerms( title = '') {\n\n //console.log('displayTerms() called');\n\n let d = document.getElementById('debug'); \n \n let table = '<h5>' + title + '</h5><table>';\n \n // Build the table header\n \n table += '<thead><tr><th>idx</th><th>Order</th><th>Name</th>' +\n '<th>Type</th><th>Codes</th><th>levels</th><th>combins</th>' +\n '<th>df</th><th>level codes</th><th>n</th><th>averages</th>' +\n '<th>sumx</th><th>sumx2</th><th>ss</th><th>SS</th>' +\n '<th>MS</th><th>F</th><th>Against</th></tr></thead><tbody>';\n \n let a = [];\n let tp = '';\n\n for(let i = 0, len = terms.length; i < len; i++ ) {\n table += '<tr><td>' + terms[i].idx.toString() + '</td>';\n table += '<td>'+terms[i].order.toString()+'</td>';\n table += '<td>'+terms[i].name+'</td>';\n //table += '<td></td>';\n\n (terms[i].type===RANDOM)?tp='RANDOM':tp='FIXED';\n table += '<td>' + tp + '</td>';\n table += '<td>' + terms[i].codes.toString(); + '</td>';\n table += '<td>' + terms[i].nlevels.toString() + '</td>';\n table += '<td>' + terms[i].combins.toString() + '</td>';\n table += '<td>' + terms[i].df.toString() + '</td>';\n a = terms[i].levels.slice();\n table += '<td>' + a.join(' : ') + '</td>';\n a = terms[i].n.slice();\n table += '<td>' + a.join(' : ') + '</td>';\n a = terms[i].average.slice();\n for(let j = 0, l = a.length; j < l; j++ ) a[j] = a[j].toFixed(3);\n table += '<td>' + a.join(' : ') + '</td>';\n a = terms[i].sumx.slice();\n for(let j = 0, l = a.length; j < l; j++ ) a[j] = a[j].toFixed(3);\n table += '<td>' + a.join(' : ') + '</td>';\n a = terms[i].sumx2.slice();\n for(let j = 0, l = a.length; j < l; j++ ) a[j] = a[j].toFixed(3);\n table += '<td>' + a.join(' : ') + '</td>';\n table += '<td>' + terms[i].ss.toFixed(3) + '</td>';\n table += '<td>' + terms[i].SS.toFixed(3) + '</td>';\n table += '<td>' + terms[i].MS.toFixed(3) + '</td>';\n table += '<td>' + terms[i].F.toFixed(3) + '</td>';\n table += '<td>' + terms[i].against + '</td>';\n }\n table +='</tbody></table>';\n d.innerHTML += table;\n }", "title": "" }, { "docid": "c4d179e1bd35419b0a16f7e91a8464de", "score": "0.5477416", "text": "function getTable() {\n\n if (this.object) {\n var tbody = $('#gcodelist tbody');\n\n // clear table\n $(\"#gcodelist > tbody\").html(\"\");\n\n for (let i = 0; i < this.object.userData.lines.length; i++) {\n var line = this.object.userData.lines[i];\n\n if (line.args.origtext != '') {\n tbody.append('<tr><th scope=\"row\">' + (i + 1) + '</th><td>' + line.args.origtext + '</td></tr>');\n }\n }\n\n // set tableRows to the newly generated table rows\n tableRows = $('#gcodelist tbody tr');\n }\n}", "title": "" }, { "docid": "688e111afac7e57c27b59df5ac342512", "score": "0.53784347", "text": "function makeTableData(nameOfProduct, searchID) {\n\n //Tables are displayed in html by doing <table> .... </table>\n //The function completes the ... part between the table\n\n // Create the data elemet <td></td>\n var item = document.createElement('td');\n\n // Create the row element <tr></tr>\n var row = document.createElement('tr');\n\n row.id = \"tr-\" + searchID; //ID for wish list rows\n\n //add a class name if necessary\n row.className = \"wishListItems\";\n\n //Append name to item\n //This method will APPEND the nameOfProduct BETWEEN the <td> (RIGHT HERE) </td>\n item.appendChild(document.createTextNode(nameOfProduct));\n\n //Append item to row\n //This time, it will append here <tr> (RIGHT HERE) </tr>\n row.appendChild(item)\n\n // Finally, return the constructed list:\n return row; //<tr><td>nameOfProduct</td></tr> is the result in the end\n}", "title": "" }, { "docid": "a61af8e2b9b90f1a3cf4ffe3f0c92c58", "score": "0.52396595", "text": "function sortGlossary() {\n\n var curPageGlossTerms = document.getElementsByTagName(\"hr\");\n\n for (var ind = 0; ind < curPageGlossTerms.length; ind++) {\n var curTermHR = curPageGlossTerms[ind];\n if (curTermHR != null && typeof curTermHR != \"undefined\" && typeof curTermHR.id != \"undefined\") {\n var x = curTermHR.nextSibling;\n while (x != null && typeof x != \"undefined\") {\n\n\t\t\t\tif((x.tagName == \"h3\" || x.tagName == \"H3\") || (x.tagName == \"div\" || x.tagName == \"DIV\")){\n if (typeof gblGlossRefArr[x.innerHTML] == \"undefined\") {\n gblGlossKeyArr.push(x.innerHTML);\n gblGlossRefArr[x.innerHTML] = curTermHR.id;\n }\n break;\n } else {\n x = x.nextSibling;\n }\n }\n }\n }\n\n // Sort the gblGlossKeyArr array\n gblGlossKeyArr.sort();\n\n var glossaryContentDiv = document.getElementById(\"GlossaryContentDiv\");\n\n for (iIndex = 0; iIndex < gblGlossKeyArr.length; iIndex++) {\n\n var hrId = gblGlossRefArr[gblGlossKeyArr[iIndex]];\n var termHR = document.getElementById(hrId);\n\n if (typeof termHR != \"undefined\" && termHR != null) {\n var tagHR = document.createElement(\"hr\");\n tagHR.id = termHR.id;\n glossaryContentDiv.appendChild(tagHR);\n var x = termHR.nextSibling;\n while (x != null && (x.nodeName != 'hr' && x.nodeName != \"HR\")) {\n glossaryContentDiv.appendChild(x);\n x = termHR.nextSibling;\n }\n }\n\n }\n // Remove chapterContentDiv\n chapterContentDiv = document.getElementById(\"chapterContentDiv\");\n var parentChapterContentDiv = chapterContentDiv.parentNode;\n parentChapterContentDiv.removeChild(chapterContentDiv);\n}", "title": "" }, { "docid": "95cd83686ca8e79fe06dde68362437b0", "score": "0.5220646", "text": "function build_rows_occ(occ_list){\n rows = []\n header = \"<thead class='thead-dark'><tr><th>S.No.</th><th>Occurance From</th><th>Occurace To</th><th>Direction From PS</th><th>Distance From PS</th><th>Address</th><th>Edit</th><th>Delete</th></thead>\"\n i = 1;\n occ_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<td><a class='delete' title='Edit' data-toggle='tooltip' onclick='edit_occ_row(\\\"occurance_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></td>\";\n delete_button = \"<td><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_occ_row(\\\"occurance_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></td>\";\n no = '<td>'+i+'</td>'\n html = '<tr id=\"'+index+'\">'+no+row.occ_datefrom+row.occ_dateto+row.occ_directionfromps+row.occ_distancefromps+row.address+edit_button+delete_button+'</tr>';\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "fedeeb5018fd9c0a9227f0771776b59a", "score": "0.5218662", "text": "function DISABLEDwriteTableHeaderRow(row_conf) {\n // console.debug(\"## writeTableHeaderRow\");\n \n\n var tr = null;\n\n try {\n\n // t_head.setAttribute(\"style\", \"position: absolute; color: #000\");\n\n tr = document.createElement(\"tr\");\n // tr.setAttribute(\"style\", \"display: block; position: relative; color:\n // #000\");\n tr.setAttribute(\"class\", \"normalRow\");\n\n for (var i = 0; i < row_conf.length; i++) {\n var obj = row_conf[i];\n // create a column for each\n\n // console.debug(JSON.stringify(obj));\n // console.debug(\"create column header \");\n\n var i_col = document.createElement(\"th\");\n\n i_col.setAttribute(\"col_num\", i);\n // i_col.setAttribute(\"style\", \"background: #C96; text-align: left;\n // border-top: 1px; padding: 4px\" );\n\n // create clickable link\n var a_ref = document.createElement(\"a\");\n // set data type here\n // T for text\n // D for dates\n // N for numbers\n // a_ref.setAttribute(\"href\", \"javascript:SortTable(\"+i+\",'T',\" +\n // table_id +\");\");\n // i_col.innerHTML = obj.text;\n i_col.appendChild(document.createTextNode(obj.text));\n\n\n // create event listener to trigger sorting on the column\n i_col.addEventListener('click', function (event) {\n // SortTable(i, 'T', table_id);\n sortColumn(event);\n })\n i_col.appendChild(a_ref);\n tr.appendChild(i_col);\n\n }\n } catch (e) {\n console.debug(e)\n }\n\n return tr;\n\n}", "title": "" }, { "docid": "8999793a19033bc086259533006d1167", "score": "0.5175879", "text": "function printfyHead(){\n\n // create elements <table> and a <tbody>\n var table = document.getElementById(\"put\");\n var row = document.createElement(\"tr\");\n\n // put <table> in the <body>\n var cell = document.createElement(\"th\");\n var cellText = document.createTextNode(\"Website Name\");\n cell.appendChild(cellText);\n row.appendChild(cell);\n\n var cell2 = document.createElement(\"th\");\n var cellText2 = document.createTextNode(\"Result\");\n cell2.appendChild(cellText2);\n row.appendChild(cell2);\n\n //row2.appendChild(cell2);\n table.appendChild(row);\n}", "title": "" }, { "docid": "b1e628018afd216a431a231d8a73b079", "score": "0.51345444", "text": "function createSortSummaryTable(){\n // Extract the value property of from the restriction object\n var table_name = tabsFrame.restriction.clauses[0].value;\n var view = tabsFrame.newView;\n var index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n resetTable('sortOrderSummary');\n var table = $('sortOrderSummary');\n var tBody = table.tBodies[0];\n var pattern = tabsFrame.patternRestriction;\n \n var fieldProperties = [\"field_name\", \"ml_heading\", \"primary_key\", \"data_type\", \"afm_type\", \"table_name\", \"ml_heading_english\"];\n //var fieldProperties = [\"field_name\", \"ml_heading\", \"primary_key\", \"data_type\", \"afm_type\", \"table_name\"];\n //var dateOptions = ['', getMessage('year'), getMessage('yearQuarter'), getMessage('yearMonth'), getMessage('yearMonthDay'), getMessage('yearWeek')];\n // var dateValues = ['', 'year', 'quarter', 'month', 'day', 'week'];\n var curTgrp = view.tableGroups[index];\n var fields = curTgrp.fields;\n var sortFields = curTgrp.sortFields;\n \n // var groupByDate = '';\n // var groupByTable = '';\n // var groupByField = '';\n \n if (hasGroupByDate(curTgrp)) { \t \n if (pattern.match(/summary|paginated/)) {\n $('groupDates').style.display = \"\";\n }\n }\n \n // For each field within the tablegroup, create a row \n if (fields == undefined) {\n alert(getMessage(\"noFields\"));\n tabsFrame.selectTab('page4');\n }\n else {\n for (var k = 0; k < fields.length; k++) {\n var new_tr = document.createElement('tr');\n new_tr.id = \"row\" + k;\n var fieldObj = fields[k];\n var hasDate = false;\n \n // Loop through the field object, and extract its relevant properties (ie. Field Name, Heading, Primary Key) to fill in table cell\t\t\t\n for (p in fieldProperties) {\n \n //if ((fieldObj[fieldProperties[p]] != undefined) && (!fieldProperties[p].toString().match(/function/gi)) && (fieldObj[fieldProperties[p]] != \"stats\")) {\n if ((fieldObj[fieldProperties[p]] != undefined) && (!fieldProperties[p].toString().match(/function/gi)) && (fieldObj[fieldProperties[p]] != \"stats\") && (fieldProperties[p] != \"ml_heading_english\")) {\n var new_td = document.createElement('td');\n new_td.innerHTML = fieldObj[fieldProperties[p]];\n new_td.is_virtual = fieldObj['is_virtual'];\n new_td.sql = fieldObj['sql'];\n new_tr.appendChild(new_td); \n }\n \n if (fieldObj['data_type'] == 'Date') {\n //\t $('groupDates').style.display = \"\";\n hasDate = true;\n }\n \n }\n \n new_tr.ml_heading_english = fieldObj['ml_heading_english'];\n\n\t\t\t// create cell for ascending/descending\n var new_td = document.createElement('td');\n var id = 'sort_' + fieldObj['table_name'] + '.' + fieldObj['field_name'];\n new_td.innerHTML = '<input type=\"checkbox\" id=\"' + id + '\" onclick=\"setAscending(this, ' + k + ')\" value=\"false\"/>';\n new_tr.appendChild(new_td);\n\t\t\t \n // Create a cell for the \"Sort Order\" column \n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n \n // Create a cell for the column with a \"Set\" button \t\t\t \t\t\t\n var new_td = document.createElement('td');\n // if (stat == ''){\n createButton(\"set\", \"setSort\", getMessage(\"set\"), \"row\" + k, new_td);\n // }\t\t\t\n new_tr.appendChild(new_td);\n \n // If date field, insert \"Group Dates By\" column\n var new_td = document.createElement('td');\n if ((hasDate == true) && (pattern.match(/summary|paginated/))) {\n \tnew_td = fillGroupByDateCell(new_td, curTgrp, fields[k]);\n\n \n /* \n if ((groupByTable == fields[k].table_name) && (groupByField == fields[k].field_name) && ((groupByDate == 'year') || (groupByDate == 'month') || (groupByDate == 'quarter') || (groupByDate == 'day') || (groupByDate == 'week'))) {\n // var oOption = document.createElement(\"OPTION\");\n // oOption.appendChild( document.createTextNode( dateOptions[dateValues.indexOf(stat)] ));\n // oOption.value = stat;\n \n // newSelect.appendChild(oOption);\n new_td.innerHTML = dateOptions[dateValues.indexOf(groupByDate)];\n }\n else {\n var newSelect = document.createElement('select');\n newSelect.name = \"groupBy\";\n newSelect.disabled = false;\n for (var x = 0; x < dateOptions.length; x++) {\n var oOption = document.createElement(\"OPTION\");\n oOption.appendChild(document.createTextNode(dateOptions[x]));\n oOption.value = dateValues[x];\n \n newSelect.appendChild(oOption);\n \n }\n \n var parameters = [];\n parameters[\"select_box\"] = newSelect;\n parameters[\"field\"] = fieldObj;\n YAHOO.util.Event.addListener(newSelect, \"change\", onChangeGroupDate, parameters);\n new_td.appendChild(newSelect);\n }\n*/ \n }\n new_tr.appendChild(new_td);\n tBody.appendChild(new_tr);\n \n // Create empty cell in last column \n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n tBody.appendChild(new_tr);\n // \t \talert(tBody.innerHTML);\n }\n }\n\t\n\t// check checkbox if descending order was set\n\tif (sortFields != undefined){\n\t\tfor (var m = 0; m < sortFields.length; m++) {\n\t\t\tif (sortFields[m].isAscending == false) {\n\t\t\t\tvar id = 'sort_' + sortFields[m].table_name + '.' + sortFields[m].field_name;\n\t\t\t\t$(id).checked = true;\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d6f90f3692ff361738483996a81a440", "score": "0.5132212", "text": "function renderScores() {\n if (storedScores !== null) {\n scoreList.sort(function (a, b) {\n return a.newScore - b.newScore;\n });\n scoreList.reverse(function (a, b) {\n return a.newScore - b.newScore\n })\n\n //For loop for scorelist \n for (i = 0; i < scoreList.length; i++) {\n var scoreListItem = scoreList[i];\n var tr = document.createElement(\"tr\");\n var nameCell = document.createElement(\"td\");\n var nameCellText = document.createTextNode(scoreListItem.name);\n var scoreCell = document.createElement(\"td\");\n var scoreCellNum = document.createTextNode(scoreListItem.newScore);\n\n tr.setAttribute(\"tr-index\", i);\n document.getElementById(\"highScores\").appendChild(tr);\n tr.appendChild(nameCell);\n nameCell.appendChild(nameCellText);\n tr.appendChild(scoreCell);\n scoreCell.appendChild(scoreCellNum);\n\n }\n }\n}", "title": "" }, { "docid": "e802f1f9a5713c5f9d32b9d4ce92daf7", "score": "0.5111151", "text": "function build_rows_property(property_list){\n rows = []\n header = \"<thead class='thead-dark'><th>S.No.</th><th>Stolen Property</th> <th>Value</th><th>Qty</th><th>Edit</th> <th>Delete</th></thead>\"\n i = 1;\n property_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<th><a class='delete' title='Edit' onclick='edit_property_row(\\\"property_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></th>\";\n delete_button = \"<th><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_property_row(\\\"property_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></th>\";\n no = '<th>'+i+'</th>';\n html = '<tr id=\"'+index+'\">'+no+row.category+row.value+row.qty+edit_button+delete_button+'</tr>';\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "a72e81b5127b735139f64fc9992327be", "score": "0.51055354", "text": "function buildTopRightTable( ownPlaceholder )\n {\n var JSONrecords = nheap.content_data\n [ \"Page 4\" ]\n [ \"DebtKeyRatio.txt\" ]\n [ \"DebtKeyRatio\" ];\n\n var timeLength = JSONrecords[0].data.length;\n var rows = JSONrecords.map( rec => ({ KEY_RATIO:rec.KEY_RATIO, dvalue:rec.data[ rec.data.length-1 ][1] }) );\n\n var columnsMeta =\n [\n { KEY_RATIO: { caption: \"Noms\" } },\n { dvalue: { caption: JSONrecords[0].data[ timeLength-1 ][0] } }\n ]; \n\n methods.tableTpl_2_content({\n contentPlaceholderToAttach : ownPlaceholder,\n table : rows,\n caption : \"Key Ratios\",\n cellPaddingTop : 1,\n cellPaddingBottom : 1,\n cellFontSize:7,\n widthPercent: 85,\n margin : [0, 0, 0, 0], //above caption\n firstCellIncrease : 23, //%\n captionFontSize : 12,\n captionBold : true,\n columns : columnsMeta\n });\n }", "title": "" }, { "docid": "42acb421b0ffc988669c43792d9ee376", "score": "0.509963", "text": "function displayData(p, rows) {\n console.log(\"page no.:\"+ p);\n console.log(\"row count:\"+ rows);\n $tbody.innerHTML = '';\n\n if (parseInt(Number(p)) == p)\n {\n data = filteredData.slice((p-1)*rows, (p*rows));\n console.log(data);\n }\n else\n {\n\t alert('Please click on Previous or Next to navigate the pages.');\n console.log('Sorry!! This is not hanlded :( Need some more time.');\n return;\n }\n\n for (var i = 0; i < data.length; i++) {\n var UFOData = data[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "title": "" }, { "docid": "48dcba8c5d4d936e60c22b02497bef3d", "score": "0.50952023", "text": "render(table) {\n console.log('Applying 3rd partys better sort.');\n }", "title": "" }, { "docid": "261d5061f6d3e3380d0bcbb124a41739", "score": "0.5092305", "text": "function displayRocketTable(dataTable) {\n \n console.log('WHAT');\n\n let tabRow = document.createElement('tr');\n let tabName = document.createElement('th');\n let tabCost = document.createElement('th');\n tabCost.innerText = 'Cost';\n tabName.innerText = 'Name';\n spaceTable.appendChild(tabRow);\n tabRow.appendChild(tabName);\n tabRow.appendChild(tabCost);\n \n\n let rocketsa = dataTable.forEach( r => {\n let tabRowe = document.createElement('tr');\n let rocketa = document.createElement('td');\n let costa = document.createElement('td');\n rocketa.innerText = r.name;\n costa.innerText = r.cost_per_launch;\n spaceTable.appendChild(tabRowe);\n tabRowe.appendChild(rocketa);\n tabRowe.appendChild(costa);\n \n\n })\n\n\n}", "title": "" }, { "docid": "c0c021383749220db8b3e29d6b55cf5d", "score": "0.50861317", "text": "function GearSort(sortfunc)\n{\n // Create a shortcut to the rows of the skills table.\n var rows = document.getElementById(\"gear\").rows;\n\n // Now copy all the data in each row (the first two are headers and\n // the last is a footer).\n debug.trace(\"Copying gear data...\");\n var rows_c = new Array();\n for (var i = 2; i < rows.length - 1; i++)\n {\n r = new Object();\n r.item = rows[i].cells[0].firstChild.value;\n r.weight = rows[i].cells[1].firstChild.value;\n r.loc = rows[i].cells[2].firstChild.value;\n rows_c.push(r);\n }\n\n // Sort the data.\n debug.trace(\"Sorting gear data...\");\n rows_c.sort(sortfunc);\n\n // Now, restore the sorted data.\n debug.trace(\"Copying sorted gear data...\");\n for (var i = 2; i < rows.length - 1; i++)\n {\n var r = rows_c.shift();\n rows[i].cells[0].firstChild.value = r.item;\n rows[i].cells[1].firstChild.value = r.weight;\n rows[i].cells[2].firstChild.value = r.loc;\n }\n\n debug.trace(\"Sorting complete.\");\n}", "title": "" }, { "docid": "5d543dc217f3479dc470900851aa0d96", "score": "0.5072976", "text": "function generateRGRows(){\n\n // Building columns\n let number_of_alphabet = document.getElementById('input_left_side').value;\n\n let table = document.getElementById('rg_table');\n let thead = table.createTHead();\n let row = thead.insertRow();\n\n let first_th = document.createElement(\"th\");\n first_th.className+=\"col-md-auto\";\n let first_text = document.createTextNode(\"LeftSide\");\n first_th.appendChild(first_text);\n row.appendChild(first_th);\n\n let th = document.createElement(\"th\");\n th.className+=\"col-md-auto\";\n let text = document.createTextNode(\"RightSide\");\n th.appendChild(text);\n row.appendChild(th); \n\n // Building rows\n for (let index = 0; index < number_of_alphabet; index++) {\n let row = table.insertRow(); \n for (let j = 0; j < 2; j++) {\n let cell = row.insertCell();\n if(j == 0){\n text = document.createTextNode(index);\n } else {\n text = document.createTextNode(\"\");\n cell.contentEditable = true;\n }\n cell.appendChild(text);\n }\n }\n}", "title": "" }, { "docid": "610c5d71b14fb8d6fbb1a70fa1782386", "score": "0.5067036", "text": "function createTableFromList() {\n sortViewList();\n\n var newTable = document.createElement(\"table\");\n newTable.setAttribute(\"class\", \"display-items\");\n\n //create header\n var headerRow = createTableHeader();\n newTable.appendChild(headerRow);\n\n //create HTML of each Item, which takes one row\n itemViewList.forEach(function (item, index) {\n newTable.appendChild(createTableRowHTML(item));\n });\n return newTable;\n}", "title": "" }, { "docid": "47a62a34d5664a786fc14280b9bc66d5", "score": "0.5062477", "text": "function generateTableRow(viewObject, tableDescription, tableName) {\n\t\t\tvar rows = /(ROWS:\\s*)(.*)(COLUMNS)/.exec(tableDescription)[2].split(/;\\s*/),\n\t\t\t\t\tcols = /(COLUMNS:\\s*)(.*)/.exec(tableDescription)[2].split(/;\\s*/);\n\t\t\n\t\tvar tmpTable = [cols];\n\n\t\t// Mark first table row as a header\n\t\ttmpTable[0].header = true;\n\n\t\t// Go through each table row and fill in cells\n\t\tfor (var iRow = 0; iRow < rows.length; iRow++) {\n\t\t\tvar tmpRow = [viewObject[tableName][iRow].name];\n\t\t\t// Mark regular rows as a not headers\n\t\t\ttmpRow.header = false;\n\n\t\t\t// Get values for columns after name column from view object\n\t\t\tfor (var iCell = 1; iCell < cols.length; iCell++) {\n\n\t\t\t\t// Take value from table on view object, if it exists\n\t\t\t\tvar value = (viewObject[tableName][iRow] && viewObject[tableName][iRow][cols[iCell]]) || 0;\n\t\t\t\ttmpRow.push('$' + value.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, \"$1,\"));\n\t\t\t} // next cells\n\n\t\t\ttmpTable.push(tmpRow);\n\t\t} // next table row\n\n\t\treturn tmpTable;\n\t}", "title": "" }, { "docid": "c13b2447bd6d89bde9ffaa8fef6ad072", "score": "0.5049376", "text": "function printToTable() {\n var tr = document.createElement(\"TR\");\n\n for (var k in newHighScore) {\n var td = document.createElement(\"TD\");\n var txt = document.createTextNode(newHighScore[k]);\n td.appendChild(txt);\n tr.appendChild(td);\n }\n\n document.getElementById(\"scoresTable\").appendChild(tr);\n}", "title": "" }, { "docid": "a27f34e1e111594c2fe6695220e52d37", "score": "0.5035429", "text": "function build_rows_witness(witness_list){\n rows = []\n header = \"<thead class='thead-dark'><th>S.No.</th><th>Witness Name</th><th>Relative Name</th> <th>PS</th><th>Edit</th> <th>Delete</th></thead>\"\n i = 1;\n witness_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<td><a class='delete' title='Edit' onclick='edit_witness_row(\\\"witness_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></td>\";\n delete_button = \"<td><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_witness_row(\\\"witness_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></td>\";\n no = '<td>'+i+'</td>'\n html = '<tr id=\"'+index+'\">'+no+row.witness_name+row.witness_relativename+row.witness_ps+edit_button+delete_button+'</tr>';\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "250bdc21852302d6b6490eac5bfcf415", "score": "0.50110364", "text": "function build_loyaltyGlanceTable(tableId, headersArray, data) { //arguments are table ID, the array for the headers, and the data provided\n var table = document.getElementById(tableId) // id for table is ataglance\n if (table) {\n var tb = document.createElement(\"tbody\")\n table.appendChild(tb) //variable tb is tablebody, and the tablebody is appended into the table\n var th = document.createElement(\"th\"); // the table header had element th\n for (var i = 0; i < headersArray.length; i++)\n // variable i loops through the headersArray for anything bigger than i\n {\n var th = document.createElement(\"th\"); // no idea why the variable is repeated here\n th.append(headersArray[i]); // headersarray loop is appended into the table headers\n tb.appendChild(th); // table headers are appended into the table body\n }\n for (let k = 0; k < 4; k++) // in the variable tr, only have 5 options\n {\n var tr = document.createElement(\"tr\");\n // insert a table row cell into the inner html with variable name\n tr.insertCell().innerHTML = data[k].Party;\n tr.insertCell().innerHTML = Math.round(data[k].Number);\n tr.insertCell().innerHTML = Math.round(statistics[k].Average) + \"%\"\n\n tb.appendChild(tr); // tr appended into the tb\n }\n }\n}", "title": "" }, { "docid": "3b53e2375c62bb1ed51c1cbff3a2ce16", "score": "0.50052094", "text": "function displayTable(sightingList) {\n let tableBody = d3.select(\"tbody\"); \n sightingList.forEach((sighting) => {\n var tblrow = tableBody.append(\"tr\");\n Object.entries(sighting).forEach(([key, value]) => {\n var cell = tblrow.append(\"td\"); \n cell.text(value); \n });\n });\n }", "title": "" }, { "docid": "8750d06aff4a4a84839b9e65f0f6cd24", "score": "0.5002673", "text": "function getTermList($table, $num) {\n\tvar list = [];\n\tfor (let i = 0; i < $num; i++) list.push($table[i].text);\n\treturn list;\n}", "title": "" }, { "docid": "f0a1276aa7aaab08f234c7f97300ae8c", "score": "0.5001063", "text": "function generateTable(){\n if(!table_data.length)\n return;\n //generate first header row with column names\n var tmpl1='<TR><TD></TD>';\n for(var i=0;i<table_data[0].length;i++){\n tmpl1+='<TH onclick=\"sortData('+i+'\\,this)\"';\n if(sort_track==i)\n tmpl1+='sort=\\''+sort_type+'\\' class=\"active\"';\n tmpl1+='>C'+(i+1)+'<i class=\"ion-minus-circled\" onclick=\"removeRC(0,'+i+'\\)\\\" title=\"Delete Column\"></i></TH>';\n }\n tmpl1+='<TH class=\"addRC\" onclick=\"addRC(0)\"><i class=\"ion-plus-circled\"></i> Add</TH>';\n tmpl1+='</TR>';\n\n //generate rest of the rows\n var tmpl2;\n for(i=0;i<table_data.length;i++){\n tmpl2='<TR>';\n for(var j=0;j<table_data[0].length;j++) {\n if(j==0)\n tmpl2 += '<TH>R' + (i+1) + '<i class=\"ion-minus-circled\" onclick=\"removeRC(1,'+i+'\\)\\\" title=\"Delete Row\"></i></TH>';\n tmpl2 += '<TD><div contenteditable=\"true\" onkeyup=\"updateData('+i+','+j+'\\,this\\)\\\" onkeypress=\"avoidEnter(event)\">'+table_data[i][j]+'</div></TD>';\n }\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(0)\"></TD>';\n tmpl2+='</TR>';\n tmpl1=tmpl1.concat(tmpl2);\n }\n\n //generate last row with add function\n tmpl2='<TR>';\n for(var j=0;j<table_data[0].length;j++) {\n if(j==0)\n tmpl2 += '<TH class=\"addRC\" onclick=\"addRC(1)\"><i class=\"ion-plus-circled\"></i> Add</TH>';\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(1)\"></TD>';\n }\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(1)\"></TD>';\n tmpl2+='</TR>';\n tmpl1=tmpl1.concat(tmpl2);\n\n document.getElementById('excel').innerHTML=tmpl1;\n}", "title": "" }, { "docid": "ca012f814b17855ded2db00fd6f24b5b", "score": "0.49825358", "text": "printSObjectFields(sObjectDescription, sortBy){\n const table = new easyTable();\n\n var field;\n var fieldName;\n var fieldType;\n for (var i = 0; i < sObjectDescription.fields.length; i++){\n field = sObjectDescription.fields[i];\n \n table.cell('name', this.printFieldName(field));\n table.cell('type', this.printFieldType(field));\n table.cell('label', field.label);\n table.newRow();\n }\n\n if (!sortBy){\n sortBy = 'name|asc';\n }\n table.sort([sortBy]);\n\n console.log(table.toString());\n }", "title": "" }, { "docid": "29ab902db14233647fd3b42967df7766", "score": "0.49791232", "text": "function build_rows_prop(property_list){\n rows = []\n header = \"<thead class='thead-dark'><th>S.No.<th>Property Category</th> <th>Property Type</th> <th>Property Nature</th> <th>Description</th> <th>Estimated Value</th><th>Edit</th> <th>Delete</th></thead>\"\n i = 1;\n property_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<td><a class='delete' title='Edit' data-toggle='tooltip' onclick='edit_prop_row(\\\"prpoerty_datatable\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></td>\";\n delete_button = \"<td><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_prop_row(\\\"prpoerty_datatable\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></td>\";\n no = '<td>'+i+'</td>'\n html = '<tr id=\"'+index+'\">'+no+row.category+row.type+row.nature+row.desc+row.value+edit_button+delete_button+'</tr>';\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "cc6c931af8fff71bb5c031e9c9c19c3a", "score": "0.49709216", "text": "function getTableHeader() {\n // 2nd tr\n var trTag = $j('<tr></tr>');\n var tdTag = $j('<td class=\"infoline\" style=\"width:60px;\"></td>').html(\n '&nbsp;');\n trTag.html(tdTag);\n var tdTag = $j('<td class=\"infoline\" style=\"width:100px;\"></td>').html(\n '<b>Parent Code</b>');\n tdTag.appendTo(trTag);\n var tdTag = $j('<td class=\"infoline\" style=\"width:100px;\"></td>').html(\n '<b>Research Code</b>');\n tdTag.appendTo(trTag);\n var tdTag = $j('<td class=\"infoline\"></td>').html('<b>Research Area</b>');\n tdTag.appendTo(trTag);\n var tdTag = $j('<td class=\"infoline\"></td>').html('<b>Active</b>');\n tdTag.appendTo(trTag);\n var tdTag = $j('<td class=\"infoline\" style=\"width:65px;\"></td>').html(\n '<b>Action</b>');\n tdTag.appendTo(trTag);\n return trTag;\n}", "title": "" }, { "docid": "fafa73fde0fa67fce987f11a7fcdad6a", "score": "0.49644426", "text": "function createTable(UFOdata){\n // clear table of all previous searches\n tbody.html(\"\")\n // Loop through each data entry to create a table row for each entry\n UFOdata.forEach((sighting) => {\n console.log(sighting);\n var row=tbody.append('tr');\n // Add table columns for each key value pair in each entry\n Object.values(sighting).forEach((value) =>{\n console.log(value);\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "title": "" }, { "docid": "c0dc62f396c4219c650aab559b2fd7f7", "score": "0.49594972", "text": "function printRow(header, doc, unicodeOpts, numRecurses) {\n doc = Object.merge(doc); // Makes a copy.\n // We recurse if there's any wrapping or arrays.\n if (typeof numRecurses === \"undefined\") {\n numRecurses = 0;\n }\n\n var row = \"\";\n var recurseAgain = false;\n\n Object.keys(header).forEach(function(field, i) {\n var val = getField(doc, field, true);\n\n if (val === undefined) {\n row += padPrint(\"\", header[field], unicodeOpts.useUnicode, i === 0);\n return;\n }\n\n if (val instanceof Array) {\n // Arrays will print on multiple lines.\n if (val.length === 0) {\n val = \"[ ]\";\n } else {\n var prefix = \" \";\n var lines = extractArrayLines(val);\n if (numRecurses < lines.length) {\n val = lines[numRecurses];\n if (numRecurses < lines.length - 1) {\n // Still more elements, need to print another line.\n recurseAgain = true;\n if (numRecurses === 0) {\n val = \"[\" + val;\n } else {\n val = \" \" + val;\n }\n } else {\n val = \" \" + val + \"]\";\n }\n } else {\n val = \"\";\n }\n }\n } else {\n var stringVal = String(val);\n\n // Two things to watch for in the non-array case: If there is a\n // newline in a string,\n // we should split that (so that it doesn't screw up the whole\n // table), and if the\n // string representation of the value is too long, we should\n // split that into\n // multiple lines.\n var newlineIdx = stringVal.indexOf(\"\\n\");\n if (newlineIdx !== -1) {\n val = stringVal.slice(0, newlineIdx);\n setFieldIfPresent(\n doc, field, stringVal.slice(newlineIdx + 1, stringVal.length));\n recurseAgain = true;\n } else {\n val = stringVal.slice(0, header[field]);\n setFieldIfPresent(doc, field, stringVal.slice(header[field], stringVal.length));\n recurseAgain = recurseAgain || getField(doc, field) !== \"\";\n }\n }\n\n row += padPrint(val, header[field], unicodeOpts.useUnicode, i === 0); // Fills in |'s\n });\n\n row += unicodeOpts.useUnicode ? \"║\" : \"|\"; // Final border\n\n print(row);\n\n if (recurseAgain) {\n printRow(header, doc, unicodeOpts, numRecurses + 1);\n } else { // Done, print the divider between rows\n printRowSep(header, false, unicodeOpts);\n }\n }", "title": "" }, { "docid": "51481444134cb5d12c0c340c32bcee4f", "score": "0.4949508", "text": "function createTable(library){\n\n\t//creates the table html DOM element\n mytable = $(\"<table id= \\\"genLibTable\\\" border='4'></table>\");\n mytablebody = $(\"<tbody></tbody>\");\n\n curr_row = $(\"<tr bgcolor=\\\"#0bed0b\\\"></tr>\");\n\n\t//add all the shelves to the table\n for(col = 0; col < library.shelves.length; col++){\n \tcurr_cell = $(\"<td></td>\");\n \tcurr_text = library.shelves[col].shelfName;\n \tcurr_cell.append(curr_text);\n \tcurr_row.append(curr_cell);\n }\n\n\t//appends arg to mytablebody\n\tmytablebody.append(curr_row);\n\n\t//add the books to the shelf columns\n\t//get the longest shelf's length\n\tvar longestShelfLen = 0;\n\n\tfor(i=0;i<library.shelves.length;i++){\n\t\tif(library.shelves[i].books.length > longestShelfLen){\n\t\t\tlongestShelfLen = library.shelves[i].books.length;\n\t\t}\n\t}\n\n\t//for every book in the shelves\n\tfor(row=0;row<longestShelfLen;row++){\n\t\t//make a new row\n\t\tcurr_row = $(\"<tr bgcolor=\\\"#d2e940\\\"></tr>\");\n\n\t\t//for each shelf\n\t\tfor(col=0;col<library.shelves.length;col++){\n\t\t\t//if the shelf has a book at that spot\n\t\t\tif((row<library.shelves[col].books.length) && (library.shelves[col].books[row].available==1)){\n\t\t\t\t//make a new data col\n\t\t\t\tcurr_cell = $(\"<td id=\\\"\"+library.shelves[col].books[row].bookName+\"\\\"></td>\");\n\t\t\t\tcurr_text = library.shelves[col].books[row].bookName;\n\n\t\t\t}\n\t\t\telse{\n\t\t\t\t//make a new data col\n\t\t\t\tcurr_cell = $(\"<td></td>\");\n\t\t\t\tcurr_text = \" \";\n\t\t\t}\n\t\t\tcurr_cell.append(curr_text);\n\t\t\tcurr_row.append(curr_cell);\n\t\t\tmytablebody.append(curr_row);\n\t\t}\n\t}\n\n\t//append the body to the whole table\n\tmytable.append(mytablebody);\n\n\t//return generated table\n\treturn mytable;\n}", "title": "" }, { "docid": "ce8594404c60dcda7727e56f858ac628", "score": "0.49486846", "text": "getTaxRow(displayName) {\n let rowEls = [\n <RowHeader useMobileUI={this.props.useMobileUI}>\n <span className='leftPad'>{`${displayName}:`}</span>\n <Swappable className='rightPad' >\n <PriceInput\n priceObj={this.state.tax}\n onChangeCB={this.callbacks.taxUpdater}\n />\n <div className='Underlineable'>\n <span tabIndex='0'>\n {Utils.priceAsString(this.state.tax.num, false)}\n </span>\n </div>\n </Swappable>\n </RowHeader>\n ];\n\n rowEls = rowEls.concat(this.getSplitTaxOrTipArray(this.state.tax.num)\n .map(price => (<span>{Utils.priceAsString(price)}</span>)));\n\n return <TR>{rowEls.map((el, i) => <TD key={i}>{el}</TD>)}</TR>;\n }", "title": "" }, { "docid": "f0658671de244976ac82dd99c30785eb", "score": "0.49411443", "text": "function displayInventoryTable(res) {\r\n\r\n const table = new Table({\r\n head: ['Product #', 'Department', 'Product', 'Price', 'Qty In Stock'],\r\n colWidths: [15, 20, 30, 15, 15]\r\n });\r\n\r\n for (let i = 0;\r\n (i < res.length); i++) {\r\n var row = [];\r\n row.push(res[i].item_id);\r\n row.push(res[i].department_name);\r\n row.push(res[i].product_name);\r\n row.push(res[i].price);\r\n row.push(res[i].stock_quantity);\r\n table.push(row);\r\n }\r\n\r\n console.log(table.toString());\r\n}", "title": "" }, { "docid": "fd397d1b5ce06252ed50ef6eae9ad273", "score": "0.49269527", "text": "function sortTable(n) {\n console.log(n);\n let res = [];\n let heading = document.querySelectorAll(\"th\");\n let title = [];\n for (let i = 0; i < heading.length; i++) {\n title.push(heading[i].innerText);\n }\n console.log(title);\n let rows = document.querySelectorAll(\"tr\");\n console.log(rows);\n for (let i = 0; i < rows.length; i++) {\n let column = [];\n let cells = rows[i].querySelectorAll(\"td\");\n for (let j = 0; j < cells.length; j++) {\n column.push(cells[j].innerText);\n }\n res.push(column);\n }\n\n res = sortByColumn(res, n);\n let table = document.getElementById(\"table\");\n let tableData = \"\";\n tableData += \"<tr>\";\n for (let i = 0; i < title.length; i++) {\n tableData += `<th onclick=\"sortTable(${i})\">${title[i]}</th>`;\n }\n tableData += `</tr>`;\n for (let i = 1; i < res.length; i++) {\n tableData += '<tr class=\"items\">';\n for (let j = 0; j < res[i].length; j++) {\n tableData += `<td>${res[i][j]}</td>`;\n }\n tableData += `</tr>`;\n }\n table.innerHTML = tableData;\n}", "title": "" }, { "docid": "1497decbd4ba7c286c7518a6c1e28331", "score": "0.49265817", "text": "function headerGraphic() {\n clear();\n\n var table = new Table;({\n chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'\n , 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝'\n , 'left': '║' , 'left-mid': '║' , 'mid': ' ' , 'mid-mid': ''\n , 'right': '║' , 'right-mid': '║' , 'middle': '' }\n });\n\n let firstWord = colors.brightMagenta.bold(\n figlet.textSync('Employee', { horizontalLayout: 'fitted' , font: 'Standard' })\n );\n\n let secondWord = colors.brightMagenta.bold(\n figlet.textSync('Tracker', { horizontalLayout: 'fitted' , font: 'Standard' })\n );\n\n table.push(\n [firstWord]\n , [secondWord]\n );\n \n let finalTable = table.toString();\n \n console.log(finalTable);\n \n}", "title": "" }, { "docid": "73d3701859d75b1ab2b936fa8c8a78a2", "score": "0.492615", "text": "function buildTable(data) {\n var headers = Object.keys(data[0]);\n var table = document.createElement(\"TABLE\");\n var row = document.createElement(\"TR\");\n headers.forEach(function(column){\n var cellH = document.createElement(\"TH\");\n var textItem = document.createTextNode(column);\n cellH.appendChild(textItem);\n row.appendChild(cellH);\n });\n table.appendChild(row); \n \n data.forEach(function(item){\n var row = document.createElement(\"TR\");\n headers.forEach(function(header){\n var cell = document.createElement(\"TD\");\n var textItem = document.createTextNode(item[header]);\n cell.appendChild(textItem); //to right align numeric values\n if(!isNaN(item[header]))\n cell.style.textAlign = \"right\";\n row.appendChild(cell);\n });\n table.appendChild(row);\n }); \n return table;\n }", "title": "" }, { "docid": "fea0064f4322d277b4db5da55e32b6cd", "score": "0.49205908", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get the current object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "title": "" }, { "docid": "ba8fecc9016d4cec072b0ff81beff203", "score": "0.49115804", "text": "function setupMySpecialTable(specialsList) {\n\n // Get a reference to the table body so we can add our rows in\n var specialsTable = document.getElementById(\"specialsList\");\n\n // Loop through all the student/name objects \n for (i = 0; i < specials.length; i++) {\n\n // Create row \n var row = document.createElement('tr');\n\n // Add the columns in the row (td / data cells)\n var categorycol = document.createElement('td');\n categorycol.innerHTML = specials[i].Category;\n row.appendChild(categorynamecol);\n\n var dishnamecol = document.createElement('td');\n dishnamecol.innerHTML = specials[i].Dishname;\n row.appendChild(dishnamecol);\n\n var pricecol = document.createElement('td');\n pricecol.innerHTML = specials[i].Price;\n row.appendChild(pricecol);\n\n // Append the row to the end of the table\n specialsTable.appendChild(row);\n\n\n }\n\n}", "title": "" }, { "docid": "cc8389429c6c4bffe6d1e9888c578299", "score": "0.49071306", "text": "function create_step_row() {\n console.debug(\"create_step_row\");\n var newRow = document.createElement('tr');\n newRow.setAttribute(\"class\", \"step_row\");\n\n // first cell if which rank this step has in the overall policy object\n\n var newcell_l = document.createElement('td');\n newcell_l.setAttribute(\"class\", \"rank\");\n // compute rank\n newcell_l.appendChild(document.createTextNode((getStepCount() + 1)));\n console.debug(newcell_l);\n newRow.appendChild(newcell_l);\n\n // table cell for the procedure\n var newcell_2 = document.createElement('td');\n newcell_2.setAttribute(\"class\", \"procedure\");\n newcell_2.setAttribute(\"j_name\", \"procedure\");\n\n // create drop-down list in this cell later\n\n// newcell_2.appendChild(create_processing_type_dropdown_list);\n\n //newcell_2.appendChild(document.createTextNode(\"dropdown\"));\n //newcell_2.setAttribute(\"contenteditable\", \"true\");\n\n newRow.appendChild(newcell_2);\n\n // table cell for parameters\n\n var newcell_3 = document.createElement('td');\n newcell_3.setAttribute(\"class\", \"parameters\");\n\n // within the parameters cell, setup a table for the parameters\n // where each row has two cells\n var newtable_2 = document.createElement('table');\n newtable_2.setAttribute(\"class\", \"parameters_table\");\n newtable_2.setAttribute(\"j_name\", \"parameters\");\n\n // parameter table row\n var newrow_2 = document.createElement('tr');\n newrow_2.setAttribute(\"class\", \"parameter\");\n\n // parameter table cell for the parameter value\n\n var newcell_31 = document.createElement('td');\n newcell_31.setAttribute(\"class\", \"updatable_user_typed_value\");\n newcell_31.setAttribute(\"j_name\", \"value\");\n newcell_31.setAttribute(\"contenteditable\", \"true\");\n\n newcell_31.appendChild(document.createTextNode(\"default\"));\n\n newrow_2.appendChild(newcell_31);\n\n // parameter table cell for the parameter notes/remarks\n\n var newcell_32 = document.createElement('td');\n newcell_32.setAttribute(\"class\", \"updatable_user_typed_value\");\n newcell_32.setAttribute(\"j_name\", \"notes\");\n newcell_32.setAttribute(\"contenteditable\", \"true\");\n\n newcell_32.appendChild(document.createTextNode(\"default\"));\n\n // edit_cell2.setAttribute(\"contenteditable\", \"true\");\n // edit_cell2.setAttribute(\"class\", \"value_editable\");\n\n newrow_2.appendChild(newcell_32);\n\n newtable_2.appendChild(newrow_2);\n newcell_3.appendChild(newtable_2);\n newRow.appendChild(newcell_3);\n\n // notes\n var newcell_4 = document.createElement('td');\n newcell_4.setAttribute(\"class\", \"updatable_user_typed_value\");\n newcell_4.setAttribute(\"j_name\", \"notes\");\n newcell_4.setAttribute(\"contenteditable\", \"true\");\n // create drop-down list in this cell\n newcell_4.appendChild(document.createTextNode(\"text\"));\n newRow.appendChild(newcell_4);\n\n // cell for buttons\n var newcell_5 = document.createElement('td');\n newcell_5.setAttribute(\"class\", \"buttons\");\n // create new edit button\n var newbutton_1 = document.createElement('button');\n newbutton_1.setAttribute(\"class\", \"editstep_button\");\n // newbutton_1.setAttribute(\"id\", \"button_generate_default\");\n newbutton_1.appendChild(document.createTextNode(\"edit\"));\n newcell_5.appendChild(newbutton_1);\n\n // create new up button\n var newbutton_2 = document.createElement('button');\n newbutton_2.setAttribute(\"class\", \"deletestep_button\");\n // newbutton_2.setAttribute(\"id\", \"button_generate_default\");\n newbutton_2.appendChild(document.createTextNode(\"up\"));\n\n newcell_5.appendChild(newbutton_2);\n\n // create new delete button\n var newbutton_3 = document.createElement('button');\n newbutton_3.setAttribute(\"class\", \"deletestep_button\");\n // newbutton_3.setAttribute(\"id\", \"button_generate_default\");\n newbutton_3.appendChild(document.createTextNode(\"delete\"));\n\n newcell_5.appendChild(newbutton_3);\n\n // create new delete button\n var newbutton_4 = document.createElement('button');\n newbutton_4.setAttribute(\"class\", \"downstep_button\");\n // newbutton_4.setAttribute(\"id\", \"button_generate_default\");\n newbutton_4.appendChild(document.createTextNode(\"down\"));\n\n newcell_5.appendChild(newbutton_4);\n newRow.appendChild(newcell_5);\n\n // attach event listeners to buttons in this row\n attachButtonEventlisteners(newRow);\n return newRow;\n}", "title": "" }, { "docid": "a6153489a424d07ebdd626f4130e8e20", "score": "0.49060073", "text": "function populateRows() {\n for (var key in primary) {\n if (primary.hasOwnProperty(key)) {\n var newRow = document.createElement('TR');\n var sideHeader = document.createElement('TH');\n sideHeader.setAttribute('class', 'leftSideHeader');\n sideHeader.innerHTML = key;\n newRow.appendChild(sideHeader);\n \n for (var innerKey in primary[key]) {\n if (primary[key].hasOwnProperty(innerKey)) {\n var newCell = document.createElement('TD');\n var text = primary[key][innerKey];\n // TODO: format text and stuff\n if (innerKey === 'Percent') {\n text = text.toPercent();\n newCell.setAttribute('class', 'numberFormat');\n }\n else if (innerKey === 'Amount') {\n text = text.toMyCurrencyString();\n if (text.replace(/[,]+/g, \"\") >= 0) {\n newCell.setAttribute('class', 'numberFormat positive');\n }\n else {\n newCell.setAttribute('class', 'numberFormat negative');\n }\n }\n newCell.innerHTML = text;\n newRow.appendChild(newCell);\n \n }\n }\n this.dom.appendChild(newRow);\n \n }\n }\n }", "title": "" }, { "docid": "39f47ed733520669a3ce54a684bb776f", "score": "0.49008814", "text": "function build_rows_acc(accused_list){\n rows = []\n header = \"<thead class='thead-dark'><th>S.No.</th><th>Accused Name</th> <th>Relative Name</th> <th>Address</th><th>Edit</th> <th>Delete</th></thead>\"\n i = 1;\n accused_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<td><a class='delete' title='Edit' data-toggle='tooltip' onclick='edit_acc_row(\\\"accused_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></td>\";\n delete_button = \"<td><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_acc_row(\\\"accused_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></td>\";\n no = '<td>'+i+'</td>'\n html = '<tr id=\"'+index+'\">'+no+row.accusedname+row.acc_relname+row.accaddress+edit_button+delete_button+'</tr>';\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "de1530304251f3c85638f4e666abc592", "score": "0.4897584", "text": "function addRowQuohdrList(value1, value2, value3, value4, value5, value6) {\n\n //if (rowCounter == 3) {\n //}\n\n var t = createTable(\"sb-result\");\n var tr = createTableRow(t);\n //var rowCell = createTableCell(tr,\"sb-row\");\n var cell1 = createTableCell(tr,\"sb-cell1\");\n var cell2 = createTableCell(tr,\"sb-cell2\");\n\t\tvar cell3 = createTableCell(tr,\"sb-cell3\");\n var cell4 = createTableCell(tr,\"sb-cell4\");\t\t\t\t\n var cell5 = createTableCell(tr,\"sb-cell5\");\t\n\t\t\n //var str = rowCounter++;\n //rowCell.innerHTML = str;\n\n //str = \"<a href='\"+value6+\"'>\" + value1 + \"</a>\";\n\t\t//quohdrid\n\t\tvar str = value1;\n cell1.innerHTML = str;\n\t\t//quoteno\n\t\tstr = value2;\n\t\t//str = \"<a href='/beacon/EditQuohdr.do?id=\"+value1+\"&amp;action=Edit'>\"+value2+\"</a>\";\n\t\t//charges link\n\t\t//str = str+\"&nbsp;&nbsp;<a href='/beacon/ListQuocharge.do?id=\"+value1+\"&amp;breadX=/beacon/BeaconMenu.do|Home|1'><img src='images/icon_mini_charges.gif' border='0' alt='Charges'/></a>\";\n\t\t//movements link\t\t\n\t\t//str = str+\"&nbsp;<a href='/beacon/ListQuomov.do?id=\"+value1+\"'><img src='images/icon_mini_movements.gif' border='0' alt='Movements'/></a>\";\n\t\t//costs link\n\t\t//str = str+\"&nbsp;<a href='/beacon/ListQuocost.do?id=\"+value1+\"'><img src='images/icon_mini_costs.gif' border='0' alt='Costs'/></a>\";\t\t\n\t\t//notes link\n\t\t//str = str+\"&nbsp;<a href='/beacon/ListQuonote.do?id=\"+value1+\"'><img src='images/icon_mini_notes.gif' border='0' alt='Notes'/></a>\";\n\t\t//analysis link\n\t\t//str = str+\"&nbsp;<a href='/beacon/ListQuosummary.do?id=\"+value1+\"'><img src='images/icon_mini_analysis.gif' border='0' alt='Analysis'/></a>\";\n\t\t//reports link\n\t\tstr = str+\"&nbsp;&nbsp;<a href='/beacon/PrintQuotation.do?id=\"+value1+\"'><img src='images/icon_mini_reports.gif' border='0' alt='Report'/></a>\";\t\t\n cell2.innerHTML = str;\n\t\t//customeraddrkey\n str = value3;\t\n cell3.innerHTML = str;\n\t\t\n\t\tstr = value4;\n cell4.innerHTML = str;\n\t\t\n\t\tstr = value5;\n cell5.innerHTML = str;\n\t\t\n // attach it\n var savedResults = document.getElementById(\"saved_results\");\n savedResults.appendChild(t);\n\n //leads.push(result);\n\n\n }", "title": "" }, { "docid": "becc7496a9d44727719a9b2acc9d2dad", "score": "0.48954433", "text": "function makeTableItem(i,e){\r\n //var item = '<tr class=\"tr_item\" bgcolor=\"' + (i % 2 == 0 ? '#ECECEC' : '#FFFFFF') + '\">' + \r\n var item = '<tr class=\"tr_item\">'+\r\n '<td style=\"width: 15%;\">' + e.g1Symbol + '</td>' + \r\n '<td style=\"width: 15%;\">' + e.g2Symbol + '</td>' ;\r\n if(!isNaN(parseInt(e.pubmedid))){\r\n item+= '<td style=\"width: 20%;\">' + '<a style=\"text-decoration:none;\" target=\"_blank\" href=\"http://www.ncbi.nlm.nih.gov/pubmed?term='+e.pubmedid+'\">'+e.network+'</a>' + '</td>'; \r\n }else{\r\n item+= '<td style=\"width: 20%;\">' + '<a style=\"text-decoration:none;\" target=\"_blank\" href=\"'+e.pubmedid+'\">'+e.network+'</a>' + '</td>'; \r\n }\r\n item+='<td style=\"text-align: left;width: 13%;\">'+e.type + '</td>'+'<td style=\"text-align: left;width: 13%;\">'+e.weight + '</td></tr>';\r\n return item; \r\n}", "title": "" }, { "docid": "9744afdbc9ac2e7054c7771603d15b3c", "score": "0.4894382", "text": "createTable(rows, columns) {\n let startPara = this.selection.start.paragraph;\n let table = new TableWidget();\n table.tableFormat = new WTableFormat(table);\n table.tableFormat.preferredWidthType = 'Auto';\n table.tableFormat.initializeTableBorders();\n let index = 0;\n while (index < rows) {\n let tableRow = this.createRowAndColumn(columns, index);\n tableRow.rowFormat.heightType = 'Auto';\n tableRow.containerWidget = table;\n table.childWidgets.push(tableRow);\n index++;\n }\n return table;\n }", "title": "" }, { "docid": "8364116d6861593f4d6fcb39bd4f159c", "score": "0.4866025", "text": "function AdSelectedNumToTable()\n {\n selectedNumbersTable = document.getElementById(\"selectedNumbers\");\n var row = selectedNumbersTable.insertRow(displayRowIndex);\n displayRowIndex++;\n var cell = row.insertCell(0);\n cell.innerHTML = \"<h2>\" + resultDisplay + \"<h2>\";\n var cell = row.insertCell(1);\n cell.innerHTML = \"<h2>\\u05DE\\u05E1\\u05E4\\u05E8:\" + displayRowIndex + \" <h2>\";\n }", "title": "" }, { "docid": "ee1e0f70467aaee24ce4e1e988ce0635", "score": "0.48631018", "text": "function resultTable(data){\n \n let tableRow = document.createElement(\"div\") ;\n tableRow.classList.add(\"tr\");\n tableRow.setAttribute(\"id\", \"trKing\");\n let dataWord = document.createElement(\"div\") ;\n dataWord.classList.add(\"td\")\n let dataNum = document.createElement(\"div\") ;\n dataNum.classList.add(\"td\")\n let dataPer = document.createElement(\"div\") ;\n dataPer.classList.add(\"td\")\n dataWord.innerText = data[0] ;\n dataNum.innerText = data[1] ;\n dataPer.innerText = ((data[1] * 100)/numberOfWords).toFixed(2) +\"%\" ;\n\n\t\t\t\t\ttableRow.appendChild(dataWord);\n\t\t\t\t\ttableRow.appendChild(dataNum);\n\t\t\t\t\ttableRow.appendChild(dataPer);\n\n\t\t\t\t\twordList.appendChild(tableRow);\n \n }", "title": "" }, { "docid": "ef3d6e434dd5aee08403e84c67ce8950", "score": "0.4860769", "text": "function renderTable(search_data) { \n $tbody.innerHTML = \"\";\n for (var i = 0; i < search_data.length; i++) {\n \n var sighting = search_data[i];\n var fields = Object.keys(sighting);\n \n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "title": "" }, { "docid": "8d3b6ed28bc75feb6f0f6b8feb623238", "score": "0.48507395", "text": "function format(d) {\n // `d` is the original data object for the row\n\n //TODO: build output and formatting instructions from the context\n var blacklist = ['toolkitDefinition', 'toolkitLabel', 'label', 'description', 'inScheme', '@id', '@type', 'name', 'isDefinedBy', 'status', 'lexicalAlias'];\n if (typeof d != \"undefined\") {\n var ownKeys = Object.getOwnPropertyNames(d).sort();\n var property = '';\n\n var rows = '<table class=\"pindex_detail w-100\">\t<col style=\"width:10%\"><col style=\"width:90%\">';\n for (i = 0, len = ownKeys.length; i < len; i++) {\n property = ownKeys[i];\n if (typeof property != \"undefined\" && blacklist.indexOf(property) == -1) {\n rows += '<tr class=\"bg-light text-dark\">' + '<td id=\"detail_key_' + property + '\">' + property + ':</td>' + '<td class=\"description\" id=\"detail_def_' + property + '\">';\n switch (property) {\n case '@id':\n case 'api':\n rows += makeLinkArray(d[property]);\n break;\n case 'broadMatch':\n case 'closeMatch':\n case 'disjointWith':\n case 'equivalentClass':\n case 'equivalentProperty':\n case 'hasSubClass':\n case 'hasSubclass':\n case 'hasSubProperty':\n case 'hasSubproperty':\n case 'hasUnconstrained':\n case 'inverseOf':\n case 'narrowMatch':\n case 'propertyDisjointWith':\n case 'related':\n case 'sameAs':\n case 'subClassOf':\n case 'subPropertyOf':\n rows += makeLabelArray(d[property]);\n break;\n case 'altLabel':\n case 'hiddenLabel':\n case 'label':\n case 'ToolkitLabel':\n rows += makeLiteral(d[property]);\n break;\n case 'changeNote':\n case 'comment':\n case 'description':\n case 'editorialNote':\n case 'example':\n case 'historyNote':\n case 'notation':\n case 'note':\n case 'scopeNote':\n case 'ToolkitDefinition':\n rows += makeLiteral(d[property]);\n break;\n case 'domain':\n case 'range':\n rows += makeLabelArray(d[property]);\n break;\n case 'isDefinedBy':\n case 'status':\n rows += formatLabel(d[property]);\n break;\n case 'url':\n rows += makeUrl(d[property]);\n break;\n default:\n rows += '\"' + d[property] + '\"';\n }\n }\n rows += \"</td></tr>\\n\";\n }\n return rows + \"</table>\";\n }\n}", "title": "" }, { "docid": "52785723bd85ce7a9a2990d46c38891e", "score": "0.48494563", "text": "function renderList(items, header, parent, childIndex)\n{\n var tBody = document.createElement(\"tbody\");\n var tRow = document.createElement(\"tr\");\n var newCell;\n var i = 0;\n\n // Create the header row and append it to the table\n for (var headerProp in header)\n {\n newCell = document.createElement(\"th\");\n newCell.innerHTML = header[headerProp];\n tRow.appendChild(newCell);\n }\n tBody.appendChild(tRow);\n\n // Create a new row for each entry in the array\n for (i = 0; i < items.length; i++)\n {\n tRow = document.createElement(\"tr\");\n //tableRow.setAttribute('data-href', 'javascript:openCaseForm(' + items[i].name + ');');\n\n // Iterate through each object in the header and add the correct data from the case\n for (var propertyValue in header)\n {\n newCell = document.createElement(\"td\");\n newCell.innerHTML = items[i][propertyValue];\n tRow.appendChild(newCell);\n }\n tBody.appendChild(tRow);\n }\n parent.replaceChild(tBody, parent.childNodes[childIndex])\n}", "title": "" }, { "docid": "23f1b4fdcb47dc337aa57f3311633cc4", "score": "0.48457888", "text": "function sortTableview(type,index){\r\n var rows=$('#result_2 #'+type).find('tr').has('td').get();\r\n //alert(rows);\r\n rows.sort(function(a,b){\r\n var key_a=$(a).children('td').eq(index-1).text();\r\n key_a=$.trim(key_a);\r\n var key_b=$(b).children('td').eq(index-1).text();\r\n key_b=$.trim(key_b);\r\n if(key_a > key_b) return 1;\r\n if(key_a < key_b) return -1;\r\n return 0\r\n });\r\n $.each(rows,function(i,e){\r\n $('#result_2 #'+type).append(e);\r\n // if(i%2==1){\r\n // $(e).css('background','#ECECEC');\r\n // }else{\r\n // $(e).css('background','#FFFFFF'); \r\n // }\r\n });\r\n //setStyle(type); \r\n var page=$('#'+type).attr('index');\r\n $('#'+type+' tr').show();\r\n $('#'+type+' tr:lt('+parseInt((page-1)*50+1)+')').hide();\r\n $('#'+type+' tr:gt('+parseInt(page*50)+')').hide();\r\n $('#'+type+' tr:eq(0)').show();\r\n}", "title": "" }, { "docid": "1f16261a83d741bc81d32031e84eeae5", "score": "0.4834092", "text": "function renderTable() {\n $tbody.innerHTML = '';\n for (var i = 0; i < filteredData.length; i++) {\n // Get get the current UFOData object and its fields\n var UFOData = filteredData[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "title": "" }, { "docid": "a08585bf34569566f1bfe9b55f0ec559", "score": "0.48319417", "text": "function addCells(row,tidx,tend,textLines,change){if(tidx < tend){row.appendChild(telt(\"th\",(tidx + 1).toString()));row.appendChild(ctelt(\"td\",change,textLines[tidx].replace(/\\t/g,'    ')));return tidx + 1;}else {row.appendChild(document.createElement(\"th\"));row.appendChild(celt(\"td\",\"empty\"));return tidx;}}", "title": "" }, { "docid": "a161d9b35bf68353496bbc95c27b7684", "score": "0.4826505", "text": "function displayTable(results) {\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Department', 'Price', 'Stock']\n , colWidths: [10, 30, 15, 10, 10]\n });\n for (i = 0; i < results.length; i++) {\n table.push(\n [results[i].item_id, results[i].product_name, results[i].department_name, results[i].price, results[i].stock_quantity]\n );\n }\n console.log(table.toString());\n}", "title": "" }, { "docid": "e0c46bf065d19605767a126c92442bb6", "score": "0.48239967", "text": "function build_rows_vic(victim_list){\n rows = []\n header = \"<thead class='thead-dark'><th>S.No.</th><th>Victim Name</th><th>Relative Name</th> <th>Address</th><th>Edit</th> <th>Delete</th></thead>\"\n i = 1;\n victim_list.forEach(function(row, index){\n if(row['soft_delete'] == \"Yes\"){\n return true;\n }\n index += 1;\n edit_button = \"<td><a class='delete' title='Edit' data-toggle='tooltip' onclick='edit_vic_row(\\\"victim_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-edit'></i></a></td>\";\n delete_button = \"<td><a class='delete' title='Delete' data-toggle='tooltip' onclick='delete_vic_row(\\\"victim_table\\\",\\\"\"+index+\"\\\");'><i class='step-icon feather icon-trash-2'></i></a></td>\";\n no = '<td>'+i+'</td>'\n html = '<tr id=\"'+index+'\">'+no+row.victimname+row.vic_relativename+row.victimaddress+edit_button+delete_button+'</tr>';\n\n rows.push(html);\n i += 1;\n });\n return header+\"<tbody>\"+rows+\"</tbody>\";\n}", "title": "" }, { "docid": "70f3ff8bedebf9138156c279ceaac600", "score": "0.4822552", "text": "function getTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n // printing current results object and fields\n var results = tableData[i];\n console.log(results)\n var fields = Object.keys(results);\n // Creating a new row in tbody\n var $newrow = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For each field in results object, creating a new cell and setting data to be the current results field\n var field = fields[j];\n var $cell = $newrow.insertCell(j);\n $cell.innerText = results[field];\n }\n }\n}", "title": "" }, { "docid": "da1edd592896e917abd79c7058232cff", "score": "0.4821", "text": "function CreateTblHeader(field_setting) {\n //console.log(\"=== CreateTblHeader ===== \");\n //console.log(\"field_setting\", field_setting);\n const column_count = field_setting.field_names.length;\n\n //console.log(\"filter_dict\", filter_dict);\n\n// +++ insert header and filter row ++++++++++++++++++++++++++++++++\n let tblRow_header = tblHead_datatable.insertRow (-1);\n let tblRow_filter = tblHead_datatable.insertRow (-1);\n\n // --- loop through columns\n for (let j = 0; j < column_count; j++) {\n const field_name = field_setting.field_names[j];\n // - skip column if field_name in columns_hidden;\n const hide_column = columns_hidden.includes(field_name);\n if (!hide_column){\n\n // --- get field_caption from field_setting\n const field_caption = loc[field_setting.field_caption[j]];\n const field_tag = field_setting.field_tags[j];\n const filter_tag = field_setting.filter_tags[j];\n const class_width = \"tw_\" + field_setting.field_width[j] ;\n const class_align = \"ta_\" + field_setting.field_align[j];\n\n// ++++++++++ insert columns in header row +++++++++++++++\n // --- add th to tblRow.\n let th_header = document.createElement(\"th\");\n // --- add div to th, margin not working with th\n const el_header = document.createElement(\"div\");\n // --- add innerText to el_header\n el_header.innerText = (field_caption) ? field_caption : null;\n // --- add width, text_align\n // not necessary: th_header.classList.add(class_width, class_align);\n th_header.classList.add(class_width, class_align);\n el_header.classList.add(class_width, class_align);\n\n th_header.appendChild(el_header)\n tblRow_header.appendChild(th_header);\n\n// ++++++++++ create filter row +++++++++++++++\n // --- add th to tblRow_filter.\n const th_filter = document.createElement(\"th\");\n\n // --- create element with tag based on filter_tag\n const filter_field_tag = ([\"text\", \"number\"].includes(filter_tag)) ? \"input\" : \"div\";\n const el_filter = document.createElement(filter_field_tag);\n\n // --- add data-field Attribute.\n el_filter.setAttribute(\"data-field\", field_name);\n el_filter.setAttribute(\"data-filtertag\", filter_tag);\n // PR2021-05-30 debug: use cellIndex instead of attribute data-colindex,\n //el_filter.setAttribute(\"data-colindex\", j);\n\n // --- add EventListener to el_filter / th_filter\n if (filter_tag === \"select\") {\n th_filter.addEventListener(\"click\", function(event){HandleFilterSelect(el_filter)});\n add_hover(th_filter);\n } else if ([\"text\", \"number\"].includes(filter_tag)) {\n el_filter.addEventListener(\"keyup\", function(event){HandleFilterKeyup(el_filter, event)});\n add_hover(th_filter);\n\n } else if ([\"toggle\", \"activated\"].includes(filter_tag)) {\n // add EventListener for icon to th_filter, not el_filter\n th_filter.addEventListener(\"click\", function(event){HandleFilterToggle(el_filter)});\n th_filter.classList.add(\"pointer_show\");\n\n // default empty icon necessary to set pointer_show\n el_filter.classList.add(\"tickmark_0_0\");\n add_hover(th_filter);\n\n } else if (filter_tag === \"inactive\") {\n // add EventListener for icon to th_filter, not el_filter\n th_filter.addEventListener(\"click\", function(event){HandleFilterInactive(el_filter)});\n th_filter.classList.add(\"pointer_show\");\n // set inactive icon\n const filter_showinactive = (filter_dict && filter_dict.showinactive != null) ? filter_dict.showinactive : 1;\n const icon_class = (filter_showinactive === 2) ? \"inactive_1_3\" : (filter_showinactive === 1) ? \"inactive_0_2\" : \"inactive_0_0\";\n\n el_filter.classList.add(icon_class);\n add_hover(th_filter);\n }\n // --- add other attributes\n if (filter_tag === \"text\") {\n el_filter.setAttribute(\"type\", \"text\")\n el_filter.classList.add(\"input_text\");\n\n el_filter.setAttribute(\"autocomplete\", \"off\");\n el_filter.setAttribute(\"ondragstart\", \"return false;\");\n el_filter.setAttribute(\"ondrop\", \"return false;\");\n }\n\n // --- add width, text_align\n // PR2021-05-30 debug. Google chrome not setting width without th_filter class_width\n th_filter.classList.add(class_width, class_align);\n\n el_filter.classList.add(class_width, class_align, \"tsa_color_darkgrey\", \"tsa_transparent\");\n th_filter.appendChild(el_filter);\n tblRow_filter.appendChild(th_filter);\n }; // if (!columns_hidden.includes(field_name))\n }; // for (let j = 0; j < column_count; j++)\n }", "title": "" }, { "docid": "0221554bd52c08f380e7f1980720b428", "score": "0.48135725", "text": "function display_invoice_table_rows() {\n subtotal = 0;\n str = '';\n for (i = 0; i < products.length; i++) {\n p = 0;\n if (typeof POST[`${products[i].name}`] != 'undefined') {\n p = POST[`${products[i].name}`]; //Defines any POST requests which have been defined in display.html\n }\n if (p > 0) {\n\n extended_price = p * products[i].price\n subtotal += extended_price;\n str += (`\n <tr>\n <td width=\"43%\">${products[i].name}</td>\n <td align=\"center\" width=\"11%\">${p}</td>\n <td width=\"13%\">\\$${products[i].price.toFixed(2)}</td>\n <td width=\"54%\">\\$${extended_price.toFixed(2)}</td>\n </tr>\n `);\n }\n }\n\n /* Based on order_page.html of Lab 12*/\n\n // Compute tax\n tax_rate = 0.1;\n tax = tax_rate * subtotal;\n\n // Compute grand total\n grandtotal = subtotal + tax;\n\n return str;\n }", "title": "" }, { "docid": "15ca6b05e91e3587f70e3fd3b149311f", "score": "0.481016", "text": "function loadTableGBU()\n{\n var arr = new Array(\"Beginning of Policy Year\",\"7\",\"8\",\"9\",\"10\",\"11 and onwards\",\"% of Fund Value (applicable to Basic Unit Account and Rider Unit Account)\",\"0.04\",\"0.08\",\"0.12\",\"0.16\",\"0.20\");\n \n var table = document.createElement('table');\n table.setAttribute('class','normalTable');\n \n for (i = 1; i<= arr.length/2;i++)\n {\n \n var tr = document.createElement('tr');\n var td = document.createElement('td');\n var td2 = document.createElement('td');\n td.setAttribute('class','textAlignCenter');\n td2.setAttribute('class','textAlignCenter');\n td.innerHTML = arr[i-1];\n td2.innerHTML = arr[(arr.length/2)-1+i];\n tr.appendChild(td);\n tr.appendChild(td2);\n table.appendChild(tr);\n }\n \n return table;\n \n}//table TPD in No 2", "title": "" }, { "docid": "5fc355d087927ef6cde8762075d0461b", "score": "0.4808932", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredrows.length; i++) {\n // Get get the current address object and its fields\n var rows = filteredrows[i];\n var fields = Object.keys(rows);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the rows object, create a new cell at set its inner text to be the current value at the current row's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = rows[field];\n }\n }\n}", "title": "" }, { "docid": "6db46f249e621d87099821e119e56d2e", "score": "0.4807444", "text": "function loadTableAR_CIWP()//Critical Illness Rider\n{\n var arrTitle = new Array(\"Rider(s)\",\"Sum Assured/Benefit\",\"Coverage Period\",\"Insured Lives\",\"Description of Benefit\");\n var arrContent = new Array (\"Critical Illness WP Rider\",CWIP_sumAssured+\" </br>(Annual)\",CWIP_coverage,\"Life Assured\",loadTableAR_CIWP_desc());\n \n //set the portion of the display table\n var arrStyle = new Array(\"5%\",\"5%\",\"5%\",\"10%\",\"75%\");\n var table = document.createElement('table');\n table.setAttribute('class','normalTable');\n table.border = \"1\";\n \n for (i = 0; i< 2;i++)\n {\n var tr = document.createElement('tr');\n for (j = 0; j < arrTitle.length;j++)\n {\n \n var td = document.createElement('td');\n td.style.width = arrStyle[j];\n \n if (i == 0)\n {\n td.innerHTML = arrTitle[j];\n }\n else if (j == 4)\n {\n td.appendChild(arrContent[j]);\n td.setAttribute('class','tdVerticalAlign textAlignCenter');\n\n }\n else{\n \n td.innerHTML = arrContent[j];\n td.setAttribute('class','tdVerticalAlign textAlignCenter');\n\n \n }\n tr.appendChild(td);\n }\n \n table.appendChild(tr);\n }\n \n return table;\n \n}", "title": "" }, { "docid": "686dd9a9c37948aa5bbfd5b06cf832d5", "score": "0.4805537", "text": "function UltraGrid_InitialseHeaderSortsRows(theObject)\n{\n\t//create an empty map\n\tvar map = {};\n\t//retrieve the property\n\tvar stringProperty = theObject.Properties[__NEMESIS_PROPERTY_SORTEABLE_COLUMNS];\n\t//valid?\n\tif (!String_IsNullOrWhiteSpace(stringProperty))\n\t{\n\t\tvar data = false;\n\t\t//parse it into json\n\t\ttry { data = JSON.parse(stringProperty); } catch (error) { Common_Error(error.message); }\n\t\t//valid templates?\n\t\tif (data)\n\t\t{\n\t\t\t//get the initial sort\n\t\t\tvar initialSort = data.InitialSort;\n\t\t\t//get sorteables from this\n\t\t\tdata = data.Sorteables;\n\t\t\t//valid?\n\t\t\tif (data)\n\t\t\t{\n\t\t\t\t//loop through them\n\t\t\t\tfor (var iSelects = 0, cSelects = data.length; iSelects < cSelects; iSelects++)\n\t\t\t\t{\n\t\t\t\t\t//get the sort data\n\t\t\t\t\tvar sortData =\n\t\t\t\t\t{\n\t\t\t\t\t\tSortType: data[iSelects].SortType,\n\t\t\t\t\t\tTriggerOnIcon: data[iSelects].TriggerType,\n\t\t\t\t\t\tSortedIcon: null,\n\t\t\t\t\t\tUnsortedIcon: null,\n\t\t\t\t\t\tAscendingIcon: null,\n\t\t\t\t\t\tDescendingIcon: null\n\t\t\t\t\t};\n\t\t\t\t\t//validate sort type\n\t\t\t\t\tswitch (sortData.SortType)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"StrCmp\":\n\t\t\t\t\t\t\t//use string compare type\n\t\t\t\t\t\t\tsortData.SortType = __ULTRAGRID_SORT_TYPE_STRING_SENSITIVE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"StrICmp\":\n\t\t\t\t\t\t\t//use string insensitive\n\t\t\t\t\t\t\tsortData.SortType = __ULTRAGRID_SORT_TYPE_STRING_INSENSITIVE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"Number\":\n\t\t\t\t\t\t\t//use number\n\t\t\t\t\t\t\tsortData.SortType = __ULTRAGRID_SORT_TYPE_NUMBER;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"DateTime\":\n\t\t\t\t\t\t\t//use date\n\t\t\t\t\t\t\tsortData.SortType = __ULTRAGRID_SORT_TYPE_DATE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t//fail this (will just show the icon, if any, for decorative purposes)\n\t\t\t\t\t\t\tsortData.SortType = __ULTRAGRID_SORT_TYPE_NONE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t//validate trigger type\n\t\t\t\t\tswitch (sortData.TriggerOnIcon)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"Icon\":\n\t\t\t\t\t\t\t//set only on icon\n\t\t\t\t\t\t\tsortData.TriggerOnIcon = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t//set all header\n\t\t\t\t\t\t\tsortData.TriggerOnIcon = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t//get icons\n\t\t\t\t\tvar icons = data[iSelects].Icons;\n\t\t\t\t\t//has icons?\n\t\t\t\t\tif (icons)\n\t\t\t\t\t{\n\t\t\t\t\t\t//get sorted icon\n\t\t\t\t\t\tvar icon = icons.SortedIcon;\n\t\t\t\t\t\t//validate icon\n\t\t\t\t\t\tif (icon && !/^none$/i.test(icon.Icon))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//set the icon\n\t\t\t\t\t\t\tsortData.SortedIcon = { Icon: icon.Icon, Position: null };\n\t\t\t\t\t\t\t//we have an icon, check its position\n\t\t\t\t\t\t\tif (/^-?\\d+,-?\\d+,\\d+,\\d+$/.test(icon.Position))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//break this into numbers\n\t\t\t\t\t\t\t\tvar numbers = icon.Position.split(\",\");\n\t\t\t\t\t\t\t\t//convert them\n\t\t\t\t\t\t\t\tsortData.SortedIcon.Position = new Position_Rect(Get_Number(numbers[0]), Get_Number(numbers[1]), Get_Number(numbers[2]), Get_Number(numbers[3]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//get unsorted icon\n\t\t\t\t\t\ticon = icons.UnsortedIcon;\n\t\t\t\t\t\t//validate icon\n\t\t\t\t\t\tif (icon && !/^none$/i.test(icon.Icon))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//set the icon\n\t\t\t\t\t\t\tsortData.UnsortedIcon = { Icon: icon.Icon, Position: null };\n\t\t\t\t\t\t\t//we have an icon, check its position\n\t\t\t\t\t\t\tif (/^-?\\d+,-?\\d+,\\d+,\\d+$/.test(icon.Position))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//break this into numbers\n\t\t\t\t\t\t\t\tnumbers = icon.Position.split(\",\");\n\t\t\t\t\t\t\t\t//convert them\n\t\t\t\t\t\t\t\tsortData.UnsortedIcon.Position = new Position_Rect(Get_Number(numbers[0]), Get_Number(numbers[1]), Get_Number(numbers[2]), Get_Number(numbers[3]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//get ascending icon\n\t\t\t\t\t\ticon = icons.AscendingIcon;\n\t\t\t\t\t\t//validate icon\n\t\t\t\t\t\tif (icon && !/^none$/i.test(icon.Icon))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//set the icon\n\t\t\t\t\t\t\tsortData.AscendingIcon = { Icon: icon.Icon, Position: null, ShowAlways: icon.ShowAlways };\n\t\t\t\t\t\t\t//we have an icon, check its position\n\t\t\t\t\t\t\tif (/^-?\\d+,-?\\d+,\\d+,\\d+$/.test(icon.Position))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//break this into numbers\n\t\t\t\t\t\t\t\tnumbers = icon.Position.split(\",\");\n\t\t\t\t\t\t\t\t//convert them\n\t\t\t\t\t\t\t\tsortData.AscendingIcon.Position = new Position_Rect(Get_Number(numbers[0]), Get_Number(numbers[1]), Get_Number(numbers[2]), Get_Number(numbers[3]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//get descending icon\n\t\t\t\t\t\ticon = icons.DescendingIcon;\n\t\t\t\t\t\t//validate icon\n\t\t\t\t\t\tif (icon && !/^none$/i.test(icon.Icon))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//set the icon\n\t\t\t\t\t\t\tsortData.DescendingIcon = { Icon: icon.Icon, Position: null, ShowAlways: icon.ShowAlways };\n\t\t\t\t\t\t\t//we have an icon, check its position\n\t\t\t\t\t\t\tif (/^-?\\d+,-?\\d+,\\d+,\\d+$/.test(icon.Position))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//break this into numbers\n\t\t\t\t\t\t\t\tnumbers = icon.Position.split(\",\");\n\t\t\t\t\t\t\t\t//convert them\n\t\t\t\t\t\t\t\tsortData.DescendingIcon.Position = new Position_Rect(Get_Number(numbers[0]), Get_Number(numbers[1]), Get_Number(numbers[2]), Get_Number(numbers[3]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//get header id\n\t\t\t\t\tvar headerId = data[iSelects].HeaderId;\n\t\t\t\t\t//we need to get the headers for this\n\t\t\t\t\tvar headers = headerId == \"-1\" ? theObject.Data.Headers.Cells : UltraGrid_GetCellsFromSetIds(theObject, headerId);\n\t\t\t\t\t//loop through the headers\n\t\t\t\t\tfor (var iHeader = 0, cHeader = headers.length; iHeader < cHeader; iHeader++)\n\t\t\t\t\t{\n\t\t\t\t\t\t//retrieve the real header\n\t\t\t\t\t\tvar header = headers[iHeader];\n\t\t\t\t\t\t//create a specific data for this one (we need to also store its state)\n\t\t\t\t\t\tvar headerData =\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSortType: sortData.SortType,\n\t\t\t\t\t\t\tTriggerOnIcon: sortData.TriggerType,\n\t\t\t\t\t\t\tSortedIcon: sortData.SortedIcon,\n\t\t\t\t\t\t\tUnsortedIcon: sortData.UnsortedIcon,\n\t\t\t\t\t\t\tAscendingIcon: sortData.AscendingIcon,\n\t\t\t\t\t\t\tDescendingIcon: sortData.DescendingIcon,\n\t\t\t\t\t\t\tSorted: false,\n\t\t\t\t\t\t\tAscending: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\t//put it in the map\n\t\t\t\t\t\tmap[header.UltraGridId] = headerData;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//has initial sort?\n\t\t\tif (initialSort && initialSort.HeaderId)\n\t\t\t{\n\t\t\t\t//we need to get the headers for this\n\t\t\t\theaders = initialSort.HeaderId == \"-1\" ? theObject.Data.Headers.Cells : UltraGrid_GetCellsFromSetIds(theObject, initialSort.HeaderId);\n\t\t\t\t//we only care about one\n\t\t\t\tif (headers && headers.length > 0)\n\t\t\t\t{\n\t\t\t\t\t//get the header\n\t\t\t\t\theader = headers[0];\n\t\t\t\t\t//mark it as selected\n\t\t\t\t\tmap[header.UltraGridId].Sorted = true;\n\t\t\t\t\t//set ascending\n\t\t\t\t\tmap[header.UltraGridId].Ascending = Get_Bool(initialSort.Ascending, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//return the result\n\treturn map;\n}", "title": "" }, { "docid": "f58b03bfdd76b8bb81b6b3ee59831277", "score": "0.48036483", "text": "function convert_device_uplink_headers_database_to_table(device_uplink,view){cov_oh5eqgm35.f[4]++;let headers_database=(cov_oh5eqgm35.s[158]++,Object.keys(device_uplink));let headers_table=(cov_oh5eqgm35.s[159]++,[]);let place_holder=(cov_oh5eqgm35.s[160]++,{});//object which will store the text and value data\nlet x;//this is just a place holder for the value returned by device_uplink_headers_database_to_table_LUT\ncov_oh5eqgm35.s[161]++;for(let i=0;i<headers_database.length;i++){cov_oh5eqgm35.s[162]++;x=device_uplink_headers_database_to_table_LUT(headers_database[i],view);cov_oh5eqgm35.s[163]++;if(x!=null){cov_oh5eqgm35.b[37][0]++;cov_oh5eqgm35.s[164]++;place_holder[\"text\"]=x;cov_oh5eqgm35.s[165]++;place_holder[\"value\"]=headers_database[i];cov_oh5eqgm35.s[166]++;headers_table.push(place_holder);cov_oh5eqgm35.s[167]++;place_holder={};}else{cov_oh5eqgm35.b[37][1]++;}}cov_oh5eqgm35.s[168]++;return headers_table;}//Takes as the input an array of lenght 1 of the device uplink data and returns the headers in the form {text: \"Table form\", value: \"database form\"};", "title": "" }, { "docid": "56761655cece593c850d927dde4779a4", "score": "0.47969055", "text": "function tablePrint (res) {\n console.log(Table.print(res, {\n item_id: {name: 'Product ID'},\n product_name: {name: 'Product Name'},\n department_name: {name: 'Dept. Name'},\n price: {name: 'Price', printer: Table.number(2)},\n stock_quantity: {name: 'Stock Quantity'}\n }));\n}", "title": "" }, { "docid": "b8380657a2f71243cc349090a387d1ab", "score": "0.47892192", "text": "function addRow () {\r\n var td; var tr = thisTable.document.createElement('tr');\r\n var t = thisTable.document.getElementById('tabulated_data');\r\n // create the td nodes for the new row\r\n // for each td node add the object variable like ?v0\r\n for (var i=0; i<numCols; i++) {\r\n if (symbolRC (1, i)) {\r\n td = createSymbolTD();\r\n td.v = qps[i].object;\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else if (literalRC(1, i)) {\r\n td = createLiteralTD(); \r\n td.v = qps[i].object\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else if (bnodeRC(1, i)) {\r\n td = createBNodeTD();\r\n td.v = qps[i].object\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else {tabulator.log.warn('addRow problem')} \r\n tr.appendChild(td);\r\n }\r\n t.appendChild(tr);\r\n // highlight the td in the first column of the new row\r\n numRows = t.childNodes.length;\r\n clearSelected(selTD);\r\n newRow = numRows-1;\r\n newCol = 0;\r\n selTD = getTDNode(newRow, newCol); // first td of the row\r\n setSelected(selTD);\r\n // clone the qps array and attach a pointer to the clone on the first td of the row\r\n tabulator.log.msg('CREATING A CLONE OF QPS: ' + qps);\r\n var qpsClone = [];\r\n for (var i = 0; i<qps.length; i++) {\r\n var stat = qps[i];\r\n var newStat = new tabulator.rdf.Statement(stat.subject, stat.predicate, stat.object, stat.why);\r\n qpsClone[i] = newStat;\r\n }\r\n selTD.qpsClone = qpsClone; // remember that right now selTD is the first td of the row, qpsClone is not a 100% clone\r\n } //addRow", "title": "" }, { "docid": "8b429bd062a87fc57f1e9b3e3a33056b", "score": "0.47889784", "text": "function ts_makeSortable(table){\n\tvar firstRow;\n\tif(table.rows&&table.rows.length>0){\n\t\tif(table.tHead&&table.tHead.rows.length>0){\n\t\t\tfirstRow=table.tHead.rows[table.tHead.rows.length-1];\n\t\t}else{\n\t\t\tfirstRow=table.rows[0];\n\t\t}\n\t}\n\tif(!firstRow)\n\t\treturn;\n\tfor(var i=0;i<firstRow.cells.length;i++){\n\t\tvar cell=firstRow.cells[i];\n\t\tif((\" \"+cell.className+\" \").indexOf(\" unsortable \")==-1){\n\t\t\tcell.innerHTML+=' '\n\t\t\t\t\t+'<a href=\"#\" class=\"sortheader\" '\n\t\t\t\t\t+'onclick=\"ts_resortTable(this);return false;\">'\n\t\t\t\t\t+'<span class=\"sortarrow\">'\n\t\t\t\t\t+'<img src=\"'\n\t\t\t\t\t+ts_image_path\n\t\t\t\t\t+ts_image_none\n\t\t\t\t\t+'\" alt=\"&darr;\"/></span></a>';\n\t\t}\n\t}\n\tif(ts_alternate_row_colors){\n\t\tts_alternate(table);\n\t}\n}", "title": "" }, { "docid": "1ad74d7640cdf50e585917aa69846f15", "score": "0.47870985", "text": "function drawTable(budget, taxes_paid=10489) {\n // Appending our general table elements\n var table =d3.select('#tax_table').append('table'),\n thead = table.append('thead'),\n tbody = table.append('tbody'),\n cols = ['Component/Program', 'Percent', 'Funds', 'Bill', 'Law'];\n\n // Building header row\n thead.append('tr').selectAll('th')\n .data(cols).enter()\n .append('th').text(function(col) {\n return col;\n });\n // Now we transform our data\n table_data = tableData(budget,taxes_paid);\n // Now let's make rows for each item in our array of table data.\n var rows = tbody.selectAll('tr')\n .data(table_data)\n .enter()\n .append('tr')\n .attr('id', function(d){\n return d.name;\n });\n // Create a cell in each for for each item\n var cols = Object.keys(table_data[0]);\n var cells = rows.selectAll('td')\n .data(function(row) {\n return cols.map(function(col){\n return {col: col, val: row[col]};\n });\n }).enter()\n .append('td')\n .text(function (d){\n if (d.col == \"percent\") {\n return percentFormat(d.val*100) + \"%\"\n } else if (d.col == 'funds') {\n return \"$\" + cashFormat(d.val)\n } else {\n return d.val\n }\n });\n return table;\n}", "title": "" }, { "docid": "c3e7bda65d6f2c512f8105ed4b95d953", "score": "0.478601", "text": "function display_combatants(){\n\n let c_display = document.getElementById(\"c_table\");\n\n c_display.innerHTML = \"\";\n\n let newRow = document.createElement('tr');\n\n let newCell = document.createElement('td');\n newCell.innerHTML = \"Name\";\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = \"Initiative\";\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = \"HP\";\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = \"Temp. HP\";\n newRow.appendChild(newCell);\n\n\n c_display.appendChild(newRow); \n\n for(const element of c_list) {\n console.log(element.name, element.hp, element.initiative);\n\n newRow = document.createElement('tr');\n newCell = document.createElement('td');\n newCell.innerHTML = element.name;\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = element.initiative;\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = element.hp;\n newRow.appendChild(newCell);\n\n newCell = document.createElement('td');\n newCell.innerHTML = element.temp_hp;\n newRow.appendChild(newCell);\n\n\n c_display.appendChild(newRow); \n }\n}", "title": "" }, { "docid": "f93297ff8aa046ecabdf1cbc7e3c4cc3", "score": "0.4776421", "text": "function printTableLeastEngaged() {\n let OrderedMembers = members.sort((a, b) => (a.missed_votes_pct > b.missed_votes_pct) ? 1 : ((b.missed_votes_pct > a.missed_votes_pct) ? -1 : 0));\n for (let i = 0; i < OrderedMembers.length * 0.1; i++) {\n let fila2 = document.createElement(\"tr\");\n let celda2 = document.createElement(\"td\");\n let celda3 = document.createElement(\"td\");\n let celda4 = document.createElement(\"td\");\n celda2.innerHTML = OrderedMembers[i].first_name;\n celda3.innerHTML = OrderedMembers[i].missed_votes;\n celda4.innerHTML = OrderedMembers[i].missed_votes_pct;\n fila2.append(celda2, celda3, celda4);\n presis.append(fila2);\n\n }\n}", "title": "" }, { "docid": "09ed9e7c9e0099c9b3328b5bfb60f30e", "score": "0.47761026", "text": "function printTable() {\r\n let budgetList = HandleLocalStorage.getBudgetItems();\r\n let totalAllocation = 0;\r\n\r\n console.log(budgetList);\r\n\r\n var previousTransaction = '<table>'+\r\n '<tr>'+\r\n '<th>Category</th>'+\r\n '<th>Allocation</th>'+\r\n '</tr>';\r\n \r\n //amount = accounting.formatMoney(parseInt(amount), {symbol:\"Php\",precision: 0, thousand: \",\", format: \"%s%v\"});\r\n budgetList.forEach(budgetItem => {\r\n previousTransaction += '<tr>'+\r\n '<td>'+budgetItem.categoryName+'</tD>'+\r\n '<td>'+ accounting.formatMoney(parseInt(budgetItem.budgetAmount), {symbol: \"₱\" ,precision: 0, thousand: \",\", format: \"%s%v\"})+'</th>'+\r\n '</th>'+\r\n '</tr>' \r\n //show total amount allocation\r\n totalAllocation += parseInt(budgetItem.budgetAmount);\r\n \r\n });\r\n\r\n //format into currency: P x,xxx\r\n totalAllocation = accounting.formatMoney(totalAllocation, {symbol: \"₱\" ,precision: 0, thousand: \",\", format: \"%s%v\"});\r\n budgetLeftAmt.innerText = totalAllocation;\r\n\r\n previousTransaction += '</table>';\r\n console.log(previousTransaction);\r\n budgetTable.innerHTML = previousTransaction;\r\n budgetTableContainer.style.display = \"block\"; \r\n}", "title": "" }, { "docid": "d7fddc1162838601c02b99e0b365df97", "score": "0.4769072", "text": "function _debug_printJournal(param, report, stylesheet) {\n if (!param)\n return param;\n\n //Column count\n var sortedColumns = [];\n for (var i in param.journal.columns) {\n if (param.journal.columns[i].index>=0)\n sortedColumns.push(param.journal.columns[i].index);\n }\n sortedColumns.sort(_debug_sortNumber); \n\n //Title\n var table = report.addTable(\"tableJournal\");\n var headerRow = table.getHeader().addRow();\n headerRow.addCell(\"Registrazioni IVA Italia\", \"title\", sortedColumns.length);\n \n //Period\n var periodo = \"Periodo dal \" + Banana.Converter.toLocaleDateFormat(param.startDate);\n periodo +=\" al \" + Banana.Converter.toLocaleDateFormat(param.endDate);\n headerRow = table.getHeader().addRow();\n headerRow.addCell(periodo, \"period\", sortedColumns.length);\n \n //Header\n var headerRow = table.getHeader().addRow();\n for (var i in sortedColumns) {\n var index = sortedColumns[i];\n for (var j in param.journal.columns) {\n if (param.journal.columns[j].index == index) {\n var columnTitle = param.journal.columns[j].title;\n /*if (columnTitle.length>8)\n columnTitle = columnTitle.substring(0, 7) + \".\";*/\n headerRow.addCell(columnTitle);\n break;\n }\n }\n }\n\n // Print data\n var row = table.addRow();\n for (var i=0; i < param.journal.rows.length;i++) {\n var jsonObj = param.journal.rows[i];\n var row = table.addRow();\n for (var j in sortedColumns) {\n var index = sortedColumns[j];\n for (var k in param.journal.columns) {\n if (param.journal.columns[k].index == index) {\n var content = jsonObj[param.journal.columns[k].name];\n row.addCell(content, param.journal.columns[k].type);\n break;\n }\n }\n }\n }\n \n _debug_printJournal_addStyle(stylesheet);\n\n}", "title": "" }, { "docid": "8fb9eb3798ba5ff9d27c6a64ae974e04", "score": "0.47680226", "text": "function getTableRow(gbElement) {\n // Title of the CWL element\n var elementTitle = $(gbElement).find(\"title\").html();\n\n // Find corresponding table row and return\n return $(\"tr\").filter(function() {\n return elementTitle.endsWith($(this).find(\"td:first\").html());\n });\n }", "title": "" }, { "docid": "1416e16373a5d580acfef1ef39ea6678", "score": "0.47665274", "text": "function createGlanceTable(arrayStatisticsMembers) {\n\n var tblbody = document.getElementById(\"tblBodySenateGlance\"); //get tbody from HTML\n\n for (var i = 0; i < arrayStatisticsMembers.length; i++) {\n var tblRows = document.createElement(\"tr\"); //create tr\n\n var tblColumns = [arrayStatisticsMembers[i].party,\n arrayStatisticsMembers[i].no_representatives,\n arrayStatisticsMembers[i].avg_votes];\n\n for (var j = 0; j < tblColumns.length; j++) {\n var tblCells = document.createElement(\"td\");\n tblCells.append(tblColumns[j]);\n tblRows.appendChild(tblCells);\n }\n tblbody.appendChild(tblRows);\n }\n}", "title": "" }, { "docid": "30c52d75e802f353f71e0e82349b9643", "score": "0.47640434", "text": "function populateTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n // Get current sighting object and fields\n var sighting = tableData[i];\n console.log(sighting)\n var fields = Object.keys(sighting);\n // Create new row in tbody, set index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For each field in sighting object, create new cell and set inner text to be current value at current sighting field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "title": "" }, { "docid": "618cba78c4a81101c9de3630d68b306c", "score": "0.47637147", "text": "function showProducts(rows) {\n\n var table = new Table({\n head: ['ID', 'Product Name', 'Price', 'Quantity'],\n colWidths: [7, 25, 10, 10]\n });\n rows.forEach(function(value, index) {\n table.push([value.itemID, value.productName, value.price, value.stockQuantity]);\n\n // console.log(row.itemID, row.productName, row.price);\n });\n console.log(table.toString());\n // console.log(\"ID ARRAY: \" + prodIdArray);\n \n}", "title": "" }, { "docid": "5530f563d9d98b48126e6bb54599a2cf", "score": "0.47622934", "text": "function tableFormat(res){\n for(i=0; i<res.length; i++){\n table.push(\n [res[i].item_id, res[i].product_name, res[i].department_name, res[i].price, res[i].stock_quantity]\n )\n }\n console.log(table.toString());\n console.log(\"\\n \");\n}", "title": "" }, { "docid": "1b9ccba6337a48f50a1c1de0418fe4fd", "score": "0.47604886", "text": "function printListCommits(repo_name, branch_name, attributes) {\n var commits = listCommitsComplete(repo_name, branch_name, attributes);\n \n //ERROR HANDLING\n if (commits != null) {\n if (commits.length < 0) {\n showError(\"No commits found\");\n }\n }\n else {\n showError(\"No commits found\");\n }\n \n var textList = [];\n for (var i = 0; i < commits.length; i++) {\n var sha = commits[i].sha;\n var contributor = commits[i].commit.committer.name;\n var message = commits[i].commit.message;\n var date = commits[i].commit.committer.date;\n var body = DocumentApp.getActiveDocument().getBody();\n \n var text = \"COMMIT REF ID: \" + sha + \"\\n\";\n text += \"CONTRIBUTOR: \" + contributor + \"\\n\";\n text += \"COMMIT MESSAGE: \" + message + \"\\n\";\n text += \"DATE: \" + date + \"\\n\";\n textList.push(text);\n }\n \n var curPrintFormat = PropertiesService.getScriptProperties().getProperty('curPrintFormat');\n if (curPrintFormat == null) setCurrentPrintFormat(\"TABLE\");\n Logger.log(\"TESTING HERE\");\n Logger.log(curPrintFormat);\n \n switch (curPrintFormat){\n case \"TABLE\":\n var table = [[\"COMMIT REF ID\", \"CONTRIBUTOR\", \"COMMIT MESSAGE\", \"DATE\"]];\n for (var i = commits.length - 1; i >= 0; i--) {\n var sha = commits[i].sha;\n var contributor = commits[i].commit.committer.name;\n var message = commits[i].commit.message;\n var date = commits[i].commit.committer.date;\n var body = DocumentApp.getActiveDocument().getBody();\n table.push([sha, contributor, message, date]);\n }\n body.appendTable(table);\n break;\n case \"LIST\":\n for (var i = textList.length - 1; i >= 0 ; i--) {\n body.appendListItem(textList[i]);\n }\n break;\n case \"BULLETS\":\n for (var i = textList.length - 1; i >= 0 ; i--) {\n body.appendParagraph(\"*\\n\" + textList[i]);\n }\n break;\n default:\n body.appendParagraph(\"*\\n ERROR\" );\n }\n \n \n}", "title": "" }, { "docid": "95dbfa368a1145ae34c33bdfeda49d0e", "score": "0.47589076", "text": "function printTable(data){\r\nfor(i=0; i<data.rows.length; i++){\r\n let rowData = \"\";\r\n for(j=0; j<data.rows.item(i).cells.length; j++){\r\n rowData += data.rows.item(i).cells.item(j).innerHTML + \" \";\r\n }\r\n rowData = rowData.slice(0,-1);\r\n console.log(rowData);\r\n}\r\n}", "title": "" }, { "docid": "fd75fe6c4ccf9731e22af255a17bc2d5", "score": "0.47549367", "text": "function createtable(listofveg){\n\t// listofveg is the div for the table container\n\tvar tablecontainer = document.getElementById(listofveg );\n\t\n\t// ARRAY FOR HEADER.\n \n arrHead = ['Veg name', 'number of sqft', 'spacing per sqft', 'number of seeds per sqft', 'total seedlings']; \n\t\n\t\n\tvar body = document.body,\n tbl = document.createElement('table');\n\ttbl.setAttribute(\"id\" , \"listtable\");\n //tbl.style.width = '350px';\n //tbl.style.border = '1px solid white';\n\t\n\tvar tr = tbl.insertRow(-1);\n\n for (var h = 0; h < arrHead.length; h++) {\n var th = document.createElement('th'); // TABLE HEADER.\n th.innerHTML = arrHead[h];\n tr.appendChild(th);\n }\n \n for(var i = 0; i < 0; i++){\n tr = tbl.insertRow();\n\t\ttr.setAttribute(\"id\",\"row\" + i);\n for(var j = 0; j < 5; j++){\n //if(i == 2 && j == 1){\n // break;\n //} else {\n var td = tr.insertCell();\n\t\t\t\ttd.setAttribute(\"id\" , \"r\" + i + \"c\" + j);\n td.appendChild(document.createTextNode(''));\n td.style.border = '1px solid white';\n //if(i == 1 && j == 1){\n // td.setAttribute('rowSpan', '3');\n //}\n //}\n }\n }\n tablecontainer.appendChild(tbl);\n}", "title": "" }, { "docid": "b8700e61355784da406a51e1f8ca6c19", "score": "0.4754556", "text": "function buildRecipeList(json) {\n var html = \"\";\n var count = 0;\n\n html += \"<thead>\";\n html += tableGen.headerRow([\"Title\", \"Description\", \"Author\", \"Tags\"]);\n html += \"</thead><tbody>\";\n for (var key in json) {\n value = json[key];\n\n var output = [];\n output.push(tableGen.dataCell(\"<a href='#view/ID=\" + value['ID'] + \"'>\" + value['Title'] + \"</a>\"));\n output.push(tableGen.dataCell(value['Description']));\n output.push(tableGen.dataCell(value['Author'] != undefined ? value['Author']['Name'] : ''));\n var tagList = [];\n var tags = value['Tags']\n for (var tagKey in tags) {\n tagList.push(tags[tagKey]['Tag']);\n }\n output.push(tableGen.dataCell(tagList));\n var attrs = \"data-cmd='view' data-id='\" + value['ID'] + \"'\";\n var sClass = (count++ % 2 == 1 ? ' alt' : '');\n html += tableGen.dataRow(attrs, sClass, output);\n }\n html += \"</tbody>\";\n\n return html;\n}", "title": "" }, { "docid": "855252bdc7f2bc471c4b73579e135775", "score": "0.47535", "text": "function SkillSort(sortfunc)\n{\n // Create a shortcut to the rows of the skills table.\n var rows = document.getElementById(\"skills\").rows;\n\n // Now copy all the data in each row (the first two are headers and\n // the last is a footer).\n debug.trace(\"Copying skill data...\");\n var rows_c = new Array();\n for (var i = 2; i < rows.length - 1; i++)\n {\n r = new Object();\n r.skill = rows[i].cells[0].firstChild.value;\n r.ab = rows[i].cells[1].firstChild.value;\n r.cc = rows[i].cells[2].firstChild.checked;\n r.mod = rows[i].cells[3].firstChild.value;\n r.abmod = rows[i].cells[5].firstChild.value;\n r.rank = rows[i].cells[7].firstChild.value;\n r.misc = rows[i].cells[9].firstChild.value;\n rows_c.push(r);\n }\n\n // Sort the data.\n debug.trace(\"Sorting skill data...\");\n rows_c.sort(sortfunc);\n\n // Now, restore the sorted data.\n debug.trace(\"Copying sorted skill data...\");\n for (var i = 2; i < rows.length - 1; i++)\n {\n var r = rows_c.shift();\n rows[i].cells[0].firstChild.value = r.skill;\n rows[i].cells[1].firstChild.value = r.ab;\n rows[i].cells[2].firstChild.checked = r.cc;\n rows[i].cells[3].firstChild.value = r.mod;\n rows[i].cells[5].firstChild.value = r.abmod;\n rows[i].cells[7].firstChild.value = r.rank;\n rows[i].cells[9].firstChild.value = r.misc;\n }\n\n debug.trace(\"Sorting complete.\");\n}", "title": "" }, { "docid": "363158aae6064e0560f780f2a3020934", "score": "0.47469896", "text": "function MakeTable(list, id, sortProp) {\n\n var newTable = document.createElement(\"table\");\n\n // Create a header for table and put a row in the header\n var tableHead = document.createElement(\"thead\");\n newTable.appendChild(tableHead);\n var tableHeadRow = document.createElement(\"tr\");\n tableHead.appendChild(tableHeadRow);\n \n var currentSort = localStorage.getItem('currentSort'+id);\n\n if(currentSort !== null) {\n sort(list, currentSort);\n } \n else {\n sort(list, sortProp);\n }\n\n // Iterate over properties.\n var obj = cardList[0];\n for (var prop in obj) {\n var newHeader = addToRow(\"th\", tableHeadRow, prop, \"left\");\n newHeader.onclick = function () {\n var newOrder = this.innerHTML;\n sort(list, prop);\n pic = false;\n MakeTable(list, id, newOrder);\n localStorage.setItem('currentSort'+id, this.innerHTML); \n };\n }\n\n // Add one row (to HTML table) per element in the array.\n // Each array element has a list of properties that will become \n // td elements (Table Data, a cell) in the HTML table. \n var tableBody = document.createElement(\"tbody\");\n newTable.appendChild(tableBody);\n for (var i in list) {\n var tableRow = document.createElement(\"tr\");\n tableBody.appendChild(tableRow);\n var obj = list[i];\n\n for (var prop in obj) {\n if (!isNaN(obj[prop])) {\n obj[prop] = formatCurrency(obj[prop]);\n addToRow(\"td\", tableRow, obj[prop], \"right\");\n } else if ((obj[prop].includes(\"png\")||obj[prop].includes(\"jpg\")) && pic) {\n obj[prop] = \"<img src='\" + obj[prop] + \"'>\";\n addToRow(\"td\", tableRow, obj[prop], \"left\");\n } else {\n addToRow(\"td\", tableRow, obj[prop], \"left\");\n }\n }\n var obj = list[i];\n }\n\n\n // Add th or td (based on eleType) to row of HTML table.\n function addToRow(eleType, row, data, alignment) {\n var ele = document.createElement(eleType);\n ele.innerHTML = data;\n ele.style.textAlign = alignment;\n row.appendChild(ele);\n return ele; \n }\n\n function formatCurrency(num) {\n num = Number(num);\n return num.toLocaleString(\"en-US\", \n {style: \"currency\", currency: \"USD\", minimumFractionDigits: 2});\n }\n function sort(list, byProperty) {\n var size = list.length;\n console.log(\"size is \" + size);\n for (var i = 0; i < size - 1; i++) {\n var small = i;\n console.log('i is ' + i);\n for (var j = i; j < size; j++) {\n console.log(\"j is \" + j);\n var listJ = list[j];\n var listSmall = list[small];\n\n if (convert(listJ[byProperty]) < convert(listSmall[byProperty])) {\n small = j;\n console.log(\"small is \" + small);\n }\n }\n var temp = list[i];\n list[i] = list[small];\n list[small] = temp;\n console.log(\"swapped i \" + i + \" with small \" + small);\n }\n\n function convert(s) {\n if (isNaN(s)) {\n return s;\n } else {\n return Number(s);\n }\n }\n }\n\n document.getElementById(id).innerHTML = \"\";\n document.getElementById(id).appendChild(newTable);\n }", "title": "" }, { "docid": "28b304cfbd06cccf1ac548b8c233b891", "score": "0.47455516", "text": "function generateTable(tablename) {\r\n let table = document.getElementById(tablename);\r\n for (let i = 0; i < items.length; i++) {\r\n let row = table.insertRow();\r\n let element = items[i];\r\n for (key in element) {\r\n let cell = row.insertCell();\r\n let text = document.createTextNode(element[key]);\r\n cell.appendChild(text);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "28b304cfbd06cccf1ac548b8c233b891", "score": "0.47455516", "text": "function generateTable(tablename) {\r\n let table = document.getElementById(tablename);\r\n for (let i = 0; i < items.length; i++) {\r\n let row = table.insertRow();\r\n let element = items[i];\r\n for (key in element) {\r\n let cell = row.insertCell();\r\n let text = document.createTextNode(element[key]);\r\n cell.appendChild(text);\r\n }\r\n }\r\n}", "title": "" }, { "docid": "716b03fb29df0cfade66d1138229335f", "score": "0.474353", "text": "function formatTable(i) {\n\t\t\n\t\t\n\t\t// FORMAT 1ST ROW RB1\n\t\t\n\n\t\tvar rbIncomeFormatted = \"$\" + parseFloat(rbIncome.innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\trbIncome.innerText = rbIncomeFormatted;\n\t\tvar rbInterestFormatted = \"$\" + parseFloat(rbInterest.innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\trbInterest.innerText = rbInterestFormatted;\n\t\tvar rbBalanceFormatted = \"$\" + parseFloat(rbBalance.innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\trbBalance.innerText = rbBalanceFormatted;\n\t\t\n\t\t\n\t\t// FORMAT DYNAMIC RESULTS RB2+\n\t\tfor(i=0; i < parseInt(lengthOfRetirement) ; i++){\n\t\t\t\n\t\t\tallIncome[i].innerText = \"$\" + parseFloat(allIncome[i].innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\t\tallInterest[i].innerText = \"$\" + parseFloat(allInterest[i].innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\t\tallBalance[i].innerText = \"$\" + parseFloat(allBalance[i].innerText).toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\t\t\t\n\t\t}\n\t\t\n\t}", "title": "" }, { "docid": "f794ca4b9035b29372b4fe81c43d098a", "score": "0.47402146", "text": "function createRowWithTicket(pOneTicketData, pOrder) {\n\n var tableBody = $(\"#table-body\");\n var mainRow = $(\"#table-body-main-row\");\n var newRow = $(\"<tr>\");\n newRow.attr('data-ticket-DBID', pOneTicketData.ticketID);\n newRow.attr('data-ticket-custDBID', pOneTicketData.custID);\n newRow.addClass('ticket');\n\t\tvar tdTicketCompleted = $(\"<td>\");\n if (pOneTicketData.deliverCompleted ) {\n tdTicketCompleted.text('Yes');\n } else {\n tdTicketCompleted.text('No');\n }\n\n\t\t\tif(pOneTicketData.deliverCompleted != true)\n\t\t\t{\n\t\t\tnumTickets = numTickets + 1;\n\t\t\tdocument.getElementById(\"search-text\").textContent = numTickets + \" Open Tickets in All Stores\";\n\t\t\tvar tdTicketNum = $(\"<td>\");\n\t\t\ttdTicketNum.text(pOneTicketData.fullTicketNum);\n\t\t\tnewRow.append(tdTicketNum);\n\t\t\t\n\t\t\t var tdTicketLoc = $(\"<td>\");\n\t\t\ttdTicketLoc.text(pOneTicketData.location);\n\t\t\tnewRow.append(tdTicketLoc);\n\n\t\t\tvar tdTicketDate= $(\"<td>\");\n\t\t\tvar sliceDate = pOneTicketData.date;\n\t\t\ttdTicketDate.text(sliceDate.slice(0, sliceDate.lastIndexOf(\"\")));\n\t\t\tnewRow.append(tdTicketDate);\n\n\t\t\tvar fulloneCustomerName = pOneTicketData.custName + ' ' + (pOneTicketData.custLastName);\n\t\t\tvar tdCustName = $(\"<td>\");\n\t\t\ttdCustName.text(fulloneCustomerName);\n\t\t\tnewRow.append(tdCustName);\n\n\t\t\tvar tdEqType = $(\"<td>\");\n\t\t\ttdEqType.text(pOneTicketData.eqType);\n\t\t\tnewRow.append(tdEqType);\n\n\t\t\tvar tdEqBrand = $(\"<td>\");\n\t\t\ttdEqBrand.text(pOneTicketData.eqBrand);\n\t\t\tnewRow.append(tdEqBrand);\n\n\t\t\tvar tdEqModel = $(\"<td>\");\n\t\t\ttdEqModel.text(pOneTicketData.eqModel);\n\t\t\tnewRow.append(tdEqModel);\n\n\t\t\t//newRow.append(tdTicketCompleted);\n\n\t\t\tvar tdIssues = $(\"<td>\");\n\t\t\ttdIssues.text(pOneTicketData.characteristics);\n\t\t\tnewRow.append(tdIssues);\n\t\t\t}\n\t\t\n // Finally, append or prepend the whole row to the tablebody\n if (pOrder == 'prepend') {\n tableBody.prepend(newRow);\n } else if (pOrder == 'append') {\n tableBody.append(newRow);\n }\n \n }", "title": "" }, { "docid": "77d0554d294124316ed148d00e6ce756", "score": "0.4739005", "text": "function loadTableTPD()\n{\n var arr = new Array(\"Attained Age upon TPD\",\"Less Than 7\",\"7 to less than 15\",\"15 to less than 65\",\"TPD Benefit Limit per Life\",\"RM 100,000\",\"RM 500,000\",\"RM 3,500,000\");\n \n var table = document.createElement('table');\n table.setAttribute('class','normalTable');\n //table.style.width = \"95%\";\n\n for (i = 1; i<= arr.length/2;i++)\n {\n \n var tr = document.createElement('tr');\n var td = document.createElement('td');\n var td2 = document.createElement('td');\n td.setAttribute('class','textAlignCenter');\n td2.setAttribute('class','textAlignCenter');\n td.innerHTML = arr[i-1];\n td2.innerHTML = arr[(arr.length/2)-1+i];\n tr.appendChild(td);\n tr.appendChild(td2);\n table.appendChild(tr);\n }\n \n return table;\n \n}//table TPD in No 2", "title": "" }, { "docid": "895734a109ba5daf82a7f8a2a9c859b1", "score": "0.4738129", "text": "function createPDF() {\n $('table tr td:last-child').remove();\n $('table tr td:last-child').remove();\n $('table tr td:last-child').remove();\n $('table th:last-child').remove();\n $('table th:last-child').remove();\n $('table th:last-child').remove();\n var sTable = document.getElementById('comptesTable').innerHTML;\n\n var style = \"<style>\";\n style = style + \"table {width: 100%;font: 17px Calibri;}\";\n style = style + \"table, th, td {border: solid 1px #DDD; border-collapse: collapse;\";\n style = style + \"padding: 2px 3px;text-align: center;}\";\n style = style + \"</style>\";\n\n // CREATE A WINDOW OBJECT.\n var win = window.open('', '', 'height=700,width=700');\n\n win.document.write('<html><head>');\n win.document.write('<title>Lists Accounts</title>');\n win.document.write(style);\n win.document.write('</head>');\n win.document.write('<body>');\n win.document.write('<h1>Lists Accounts :</h1>');\n win.document.write(sTable);\n win.document.write('</body></html>');\n\n win.document.close();\n\n win.print();\n\n location.reload(); // Reload Page\n\n}", "title": "" }, { "docid": "c1a2eb8f1403adff8bba61bac5b3e582", "score": "0.47351617", "text": "function printTables(membersArray, tbodyId, criteria1, criteria2) {\n let tbody = document.getElementById(tbodyId);\n for (let i = 0; i < membersArray.length; i++) {\n let row = tbody.insertRow(-1);\n let cell1 = row.insertCell(0);\n let element1 = document.createElement(\"td\");\n let firstName = membersArray[i].first_name;\n let middleName = membersArray[i].middle_name;\n let lastName = membersArray[i].last_name;\n let urlMember = membersArray[i].url;\n if (middleName == null) {\n var fullName = `<a href=\"${urlMember}\" target=\"_blank\">${firstName} ${lastName}</a>`;\n } else {\n var fullName = `<a href=\"${urlMember}\" target=\"_blank\">${firstName} ${lastName} ${middleName}</a>`;\n }\n element1.innerHTML = fullName;\n cell1.append(element1);\n\n let cell2 = row.insertCell(1);\n let element2 = document.createElement(\"td\");\n element2.innerHTML = membersArray[i][criteria1];\n cell2.append(element2);\n\n let cell3 = row.insertCell(2);\n let element3 = document.createElement(\"td\");\n element3.innerHTML = membersArray[i][criteria2];\n cell3.append(element3);\n\n }\n}", "title": "" }, { "docid": "9c81ee28daf09e8b2f2602deff469bdb", "score": "0.47307608", "text": "function sortTable(f,n){\r\n\tvar rows = $('#SPapprvergrid tbody tr').get();\r\n\r\n\trows.sort(function(a, b) {\r\n\r\n\t\tvar A = getVal(a);\r\n\t\tvar B = getVal(b);\r\n\r\n\t\tif(A < B) {\r\n\t\t\treturn -1*f;\r\n\t\t}\r\n\t\tif(A > B) {\r\n\t\t\treturn 1*f;\r\n\t\t}\r\n\t\treturn 0;\r\n\t});\r\n\r\n\tfunction getVal(elm){\r\n\t\tvar v = $(elm).children('td').eq(n).text().toUpperCase();\r\n\t\tif($.isNumeric(v)){\r\n\t\t\tv = parseInt(v,10);\r\n\t\t}\r\n\t\treturn v;\r\n\t}\r\n\r\n\t$.each(rows, function(index, row) {\r\n\t\t$('#SPapprvergrid').children('tbody').append(row);\r\n\t});\r\n}", "title": "" }, { "docid": "08cec5a631f2e8fdf953c7c9f0f3f323", "score": "0.4724635", "text": "function getAllIngr() {\n let tabAllIngr = []; /*to create an empty tab that will contain all the Ingr*/\n recipes.forEach(recette => { /*to go through all the recipes 1 by 1 with the variable \"recette\" that is the current recipe, beginning by the recipe index 0 then index 0 etc...till the end of tab*/\n recette.ingredients.forEach(currentIngredient => { /*current ingredient is each box containing ingredient+qty+unit in the main tab of the ingr of a given recipe*/\n let ingr = currentIngredient.ingredient; /*variable pour éviter les répétitions de currentingredient.ingredient dans cette même boucle*/\n if (!tabAllIngr.find(i => Utils.normString(i) === Utils.normString(ingr))) { /*if one Ingr of one of the recipes is not yet (negative shown by \"!\") listed in the Ingr table, then it is displayed*/\n /* whatever the way word is written in recipe, we get it all in lowercase; then we use CSS text transform capitalize pour display words starting by uppercase*/\n tabAllIngr.push(Utils.normString(ingr)); /*push: at each loop, we add the Ingr if it is what we are searching for*/\n }\n });\n });\n tabAllIngr.sort(Intl.Collator().compare);\n return tabAllIngr;\n}", "title": "" }, { "docid": "ad602a9e84fe8c95f54e400cdacdf109", "score": "0.47240525", "text": "function onClickLastNameTableHeader(event)\n{\n document.isAscendingOrder = !document.isAscendingOrder;\n sortTableElementsBy(\"last_name\");\n}", "title": "" }, { "docid": "67e0c29be8b4efeca2337de83ea29644", "score": "0.47237122", "text": "function formatIndexPage() {\r\n\r\n // grab the th header titles\r\n var dev = document.evaluate(\r\n \"//table[3]//th\", \r\n document, \r\n null, \r\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n \r\n // create 3 new holding cells for the titles\r\n var x = document.createElement('td');\r\n x.className = 'thTop';\r\n x.width = '50';\r\n x.height = '28';\r\n x.align = 'center';\r\n//\tx.noWrap = dev.snapshotItem(1).getAttribute('nowrap');\r\n // copy 'Topic' text\r\n // could have just created some text nodes - but the the text \"may\" change in the future??\r\n x.appendChild(dev.snapshotItem(1).firstChild.cloneNode(false));\r\n var y = x.cloneNode(true);\r\n // copy 'Post' text\r\n y.replaceChild(dev.snapshotItem(2).firstChild.cloneNode(false), y.firstChild);\r\n var z = x.cloneNode(true);\r\n // copy 'Last Post' text\r\n z.replaceChild(dev.snapshotItem(3).firstChild.cloneNode(false), z.firstChild);\r\n z.removeAttribute('width');\r\n \r\n // got what we need, remove the last 3 th cells from the header\r\n for (i = 1; i < dev.snapshotLength; i++)\r\n dev.snapshotItem(i).parentNode.removeChild(dev.snapshotItem(i));\r\n // and replace with a full width \"colspan=3\" cell\r\n dev = dev.snapshotItem(0).parentNode.appendChild(document.createElement('th'));\r\n dev.className = 'thTop';\r\n dev.height = '28';\r\n dev.colSpan = '3';\r\n\r\n // now find all the forum category headers\r\n dev = document.evaluate(\r\n \"//table[3]//td[@class='catLeft']/parent::tr\", \r\n document, \r\n null, \r\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n // and insert the created holding cells in place of the original single cells\r\n for (i = 0; i < dev.snapshotLength; i++) {\r\n var c = dev.snapshotItem(i);\r\n c.replaceChild(x.cloneNode(true), c.getElementsByTagName('td')[1]);\r\n c.appendChild(y.cloneNode(true));\r\n c.appendChild(z.cloneNode(true));\r\n }\r\n\r\n // finally create a largish blank row before each category header row - not the first one!\r\n for (i = 1; i < dev.snapshotLength; i++) {\r\n var c = dev.snapshotItem(i).parentNode.insertBefore(document.createElement('tr'),dev.snapshotItem(i));\r\n c = c.appendChild(document.createElement('td'));\r\n c.className = 'spacerow';\r\n c.height = '50';\r\n c.colSpan = '5';\r\n }\r\n}", "title": "" }, { "docid": "dcaf23f29d1040635d5143778b0c5e36", "score": "0.47211075", "text": "function buildList() {\n\n //Retrieve all the sessions journal in the form of an array;\n let journal = retreiveAllData();\n // -------------------------------------------------------------JavaScript - Arrays Ex. 2||\n let sortedByTime = journal.sort(sortByTime);\n let sortedJournal = sortedByTime.sort(sortByDate);\n let date = \"\";\n let time = \"\";\n\n // -------------------------------------------------------------DOM Manipulation - Create & Append Ex. 2||\n let printHeading = document.createElement(\"H1\");\n let text = document.createTextNode(\"Journal\");\n printHeading.appendChild(text);\n document.getElementById(\"list\").appendChild(printHeading);\n\n\n // -------------------------------------------------------------JavaScript - Loop Ex. 3||\n for (let i = 0; i < sortedJournal.length; i++) {\n\n let rowDAO = sortedJournal[i]; \n if (date == rowDAO.date) {\n //Do nothing\n } else {\n // -------------------------------------------------------------DOM Manipulation - Create & Append Ex. 3||\n printDate = document.createElement(\"H2\");\n text = document.createTextNode(rowDAO.date);\n printDate.appendChild(text);\n document.getElementById(\"list\").appendChild(printDate);\n date = rowDAO.date;\n }\n\n if (time == rowDAO.time) {\n //Do nothing\n } else {\n \n // -------------------------------------------------------------DOM Manipulation - Create & Append Ex. 3||\n printTime = document.createElement(\"H3\");\n text = document.createTextNode(rowDAO.time);\n printTime.appendChild(text);\n document.getElementById(\"list\").appendChild(printTime);\n time = rowDAO.time;\n }\n\n let row = \"\";\n \n if (rowDAO.type == 'weather') {\n row += rowDAO.weather + \"\";\n } else if (rowDAO.type == 'mood') {\n row += rowDAO.mood + \"\";\n } else if (rowDAO.type == 'exercise') {\n row += rowDAO.duration + \" of \" + rowDAO.workout;\n } else {\n console.log('Unrecognized Object Type');\n }\n\n row += \" -- \" + rowDAO.note;\n\n printRow = document.createElement(\"P\");\n text = document.createTextNode(row);\n printRow.appendChild(text);\n document.getElementById(\"list\").appendChild(printRow);\n }\n}", "title": "" }, { "docid": "7c451e18a0ade95b4bfcc4366508ae3b", "score": "0.47209585", "text": "function returnTitleRow(arr)\n{\n var tr = document.createElement('tr');\n \n \n for (i = 0 ; i< arr.length ; i++)\n {\n var td = document.createElement('td');\n // td.setAttribute('class','tableHeaderTD');\n td.innerHTML = arr[i];\n tr.appendChild(td);\n }\n \n return tr;\n}", "title": "" }, { "docid": "94f121afc3d2d3f4cdbd1bbb303fe350", "score": "0.4720303", "text": "function printRow(header, doc, unicodeOpts, numRecurses) {\n // We recurse if there's any wrapping or arrays, this variable is used to know what\n // to print on this call, default it to 0.\n if (typeof(numRecurses) === 'undefined') {\n numRecurses = 0;\n }\n var row = '';\n var recurseAgain = false;\n Object.keys(header).forEach(function(field) {\n // the value of the doc, unless doc is null, then this is the header row.\n var val;\n if (doc === null) { // We're printing the header.\n val = field;\n } else {\n //avoid the null, convert to empty string\n val = getField(doc, field, true) === null? '' : getField(doc, field);\n // Arrays will print on multiple lines\n if (val instanceof Array) {\n var lastValidIndex = val.length - 1;\n if (numRecurses <= lastValidIndex) {\n val = tojson(val[numRecurses], '' /* indent */, true /* no newlines */);\n if (numRecurses < lastValidIndex) {\n // Still more elements, need to print another line.\n recurseAgain = true;\n val += ',';\n }\n } else {\n val = '';\n }\n } else {\n // Wrap long values to multiple lines, here only print the appropriate slice.\n var sliceStart = header[field]*numRecurses;\n var sliceEnd = sliceStart + header[field];\n // Recurse again if it still isn't fully printed.\n if (val.toString().length > sliceEnd) {\n recurseAgain = true;\n }\n val = val.toString().slice(sliceStart, sliceEnd);\n }\n }\n row += padPrint(val, header[field], unicodeOpts.useUnicode); // Fills in |'s\n });\n row += unicodeOpts.useUnicode? '\\u2502' : '|'; // Final border\n print(row);\n if (recurseAgain) {\n printRow(header, doc, unicodeOpts, numRecurses + 1);\n } else { // Done, just print the divider between rows\n printRowSep(header, false, unicodeOpts);\n }\n }", "title": "" }, { "docid": "959d248756e86113009154dbec812f16", "score": "0.47167763", "text": "function printHTML(htmlTemplate, order) {\n var divPrint = $('#divPrint');\n if (!divPrint.length) {\n var divPrint = $('<div/>', {\n id: \"divPrint\",\n }).appendTo(\"#workplace\");\n }\n var s = \"\";\n s = htmlTemplate;\n s = s.replace(\"$caption\", \"ILKato\");\n\n s = s.replace(\"$order_number\", order.No);\n s = s.replace(\"$order_date\", order.DDate);\n s = s.replace(\"$order_time\", order.CTime);\n s = s.replace(\"$delivery_time\", order.DTime);\n//\n s = s.replace(\"$comment\", order.Comment);\n//\n var pcount = 1;\n s = s.replace(\"$count_person\", pcount);\n//\n// //table id, _class, headerItems, tableItems, footerItems\n var prd = order.Products.map(function (item, i, arr) {\n var newObj = {};\n newObj.No = i + 1;\n newObj.Count = 1;\n newObj.Name = item.Name;\n newObj.Weight = item.Weight;\n return newObj;\n });\n//\n//// function CreateTable(id, _class, headerItems, tableItems, footerItems) {\n var t = CreateTable('tPProducts', undefined, [\"№\", \"Кол-во\", \"Наименование\", \"Вес\"], prd, undefined);\n //t.css('align:\"right\"; width:\"53%\";border:\"1px\";cellspacing=0;');\n t.removeAttr(\"class\");\n t.children().removeAttr(\"class\");\n\n//console.log(t[0].outerHTML);\n s = s.replace(\"$table\", t[0].outerHTML);\n s = s.replace(\"<thead>\", \"\");\n s = s.replace(\"</thead>\", \"\");\n\n//\n//\n//\n//\n//\n// //another one\n// s = s.replace(\"$order_time\", order.CTime);\n\n divPrint.html(s);\n window.print();\n divPrint.remove();\n// return divPrint;\n}", "title": "" }, { "docid": "e416026dbc01d7302c2d1bd0b640c28b", "score": "0.47138643", "text": "function printItems(respObjList){\n\t//console.log(respObjList);\n\tlet htmlStr=\"\";\n\tfor(let item of respObjList){//yksi kokoelmalooppeista\t\t\n \thtmlStr+=\"<tr id='rivi_\"+item.id+\"'>\";\n \thtmlStr+=\"<td>\"+item.rekno+\"</td>\";\n \thtmlStr+=\"<td>\"+item.merkki+\"</td>\";\n \thtmlStr+=\"<td>\"+item.malli+\"</td>\";\n \thtmlStr+=\"<td>\"+item.vuosi+\"</td>\"; \t\n \thtmlStr+=\"</tr>\"; \t\n\t}\t\n\tdocument.getElementById(\"tbody\").innerHTML = htmlStr;\t\n}", "title": "" }, { "docid": "70fc2d1e576f6aceefa192e40bc4b9b9", "score": "0.47127935", "text": "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < ufoSightings.length; i++) {\n // Get get the current sightings object and its fields\n var sightings = ufoSightings[i];\n var fields = Object.keys(sightings);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the sightings object, create a new cell at set its inner text to be the current value at the current sightings field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sightings[field];\n }\n }\n}", "title": "" }, { "docid": "24d8c6d901094c245c7b9d93dfc56c07", "score": "0.47118482", "text": "function getInspectionDetailsTable() {\n var result;\n result = {\n table: {\n widths: [100, '*', 25, '*', 40, '*'],\n body: [\n [{\n text: 'INSPECTION DETAILS',\n style: 'tableHeader',\n colSpan: 6,\n border: [false, false, false, true]\n }, {}, {}, {}, {}, {}],\n [{\n text: 'Address of Property',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('2'),\n style: 'tableText',\n colSpan: 5,\n border: [true, true, false, true]\n }, {}, {}, {}, {}],\n [{\n text: 'Suburb',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('3'),\n style: 'tableText'\n }, {\n text: 'State',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('state'),\n style: 'tableText'\n }, {\n text: 'Postcode',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('11'),\n style: 'tableText',\n border: [true, true, false, true]\n }],\n [{\n text: 'Date of Inspection',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('4'),\n style: 'tableText',\n colSpan: 2\n }, {}, {\n text: 'Time of Inspection',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('10'),\n style: 'tableText',\n colSpan: 2,\n border: [true, true, false, true]\n }, {}],\n [{\n text: 'Existing use of Building',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('5'),\n style: 'tableText',\n colSpan: 5,\n border: [true, true, false, true]\n }, {}, {}, {}, {}],\n [{\n text: 'Weather conditions',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('6'),\n style: 'tableText',\n colSpan: 5,\n border: [true, true, false, true]\n }, {}, {}, {}, {}],\n [{\n text: 'Verbal summary to',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('7'),\n style: 'tableText',\n colSpan: 2\n }, {}, {\n text: 'Date',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('12'),\n style: 'tableText',\n colSpan: 2,\n border: [true, true, false, true]\n }, {}]\n ]\n }\n };\n return result;\n}", "title": "" } ]
65da6123780c831094b1a809fb5a061e
Group series by axis.
[ { "docid": "8db76d2036672d6ec3c6fcf06ee6d383", "score": "0.67862827", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = zrUtil.indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {\n axis: baseAxis,\n seriesModels: []\n };\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n return result;\n}", "title": "" } ]
[ { "docid": "525a9d6e7fd24da961cb469feba5ab22", "score": "0.74399084", "text": "function groupSeriesByAxis(ecModel){var result=[],axisList=[];return ecModel.eachSeriesByType(\"boxplot\",function(seriesModel){var baseAxis=seriesModel.getBaseAxis(),idx=zrUtil.indexOf(axisList,baseAxis);0>idx&&(idx=axisList.length,axisList[idx]=baseAxis,result[idx]={axis:baseAxis,seriesModels:[]}),result[idx].seriesModels.push(seriesModel)}),result}", "title": "" }, { "docid": "054900ce5f6d55b51949952471454aa5", "score": "0.7416812", "text": "function groupSeriesByAxis(ecModel){\nvar result=[];\nvar axisList=[];\n\necModel.eachSeriesByType('boxplot',function(seriesModel){\nvar baseAxis=seriesModel.getBaseAxis();\nvar idx=indexOf(axisList,baseAxis);\n\nif(idx<0){\nidx=axisList.length;\naxisList[idx]=baseAxis;\nresult[idx]={axis:baseAxis,seriesModels:[]};\n}\n\nresult[idx].seriesModels.push(seriesModel);\n});\n\nreturn result;\n}", "title": "" }, { "docid": "3383eab358afd9839281e0e387f88a2a", "score": "0.7165447", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = { axis: baseAxis, seriesModels: [] };\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n }", "title": "" }, { "docid": "2075713f0b06587d8f61d92ade368b11", "score": "0.71649575", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n}", "title": "" }, { "docid": "2075713f0b06587d8f61d92ade368b11", "score": "0.71649575", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n}", "title": "" }, { "docid": "2075713f0b06587d8f61d92ade368b11", "score": "0.71649575", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n}", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "19c8946a3ee33d663561f7732c531c0a", "score": "0.70752895", "text": "function groupSeriesByAxis(ecModel) {\n\t var result = [];\n\t var axisList = [];\n\n\t ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n\t var baseAxis = seriesModel.getBaseAxis();\n\t var idx = zrUtil.indexOf(axisList, baseAxis);\n\n\t if (idx < 0) {\n\t idx = axisList.length;\n\t axisList[idx] = baseAxis;\n\t result[idx] = {axis: baseAxis, seriesModels: []};\n\t }\n\n\t result[idx].seriesModels.push(seriesModel);\n\t });\n\n\t return result;\n\t }", "title": "" }, { "docid": "de96f465d5d0b56d32302fce981ee0fd", "score": "0.7013638", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = util.indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {\n axis: baseAxis,\n seriesModels: []\n };\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n return result;\n}", "title": "" }, { "docid": "be5cac4cfbb8c9ef9126e16361fa9d14", "score": "0.6961094", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', (function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = zrUtil.indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n }));\n\n return result;\n }", "title": "" }, { "docid": "d3acc0946f0c6ec43f4ab15edc1b2293", "score": "0.69341224", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = zrUtil.indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n }", "title": "" }, { "docid": "d3acc0946f0c6ec43f4ab15edc1b2293", "score": "0.69341224", "text": "function groupSeriesByAxis(ecModel) {\n var result = [];\n var axisList = [];\n\n ecModel.eachSeriesByType('boxplot', function (seriesModel) {\n var baseAxis = seriesModel.getBaseAxis();\n var idx = zrUtil.indexOf(axisList, baseAxis);\n\n if (idx < 0) {\n idx = axisList.length;\n axisList[idx] = baseAxis;\n result[idx] = {axis: baseAxis, seriesModels: []};\n }\n\n result[idx].seriesModels.push(seriesModel);\n });\n\n return result;\n }", "title": "" }, { "docid": "d1a746bf72d643bb1d5cfb66f3d4fb8b", "score": "0.6227388", "text": "createSeries () {\n const {\n series: data,\n seriesOptions: options = {}\n } = this._options || {};\n\n const groupingOptions = options.grouping;\n if (groupingOptions) {\n if (groupingOptions.pixels) {\n this._groupingPixels = ensureNumber( groupingOptions.pixels );\n }\n }\n\n const {\n columns,\n types,\n colors,\n names\n } = data;\n\n const xAxisIndex = columns.findIndex(column => {\n return types[ column[ 0 ] ] === SeriesTypes.x;\n });\n const xAxis = this._xAxis = columns[ xAxisIndex ].slice( 1 );\n\n let yAxes = columns.slice(); // copy an array to change later\n yAxes.splice( xAxisIndex, 1 ); // remove x axis from the array\n\n for (let i = 0; i < yAxes.length; ++i) {\n const yAxis = yAxes[ i ].slice();\n const label = yAxis.shift();\n const type = types[ label ];\n const color = colors[ label ];\n const name = names[ label ];\n\n // prepare series settings\n const settings = {\n xAxis, yAxis, label, type,\n color, name, options: this.extendSeriesOptions( options )\n };\n\n // create instance\n const series = new Series( this._renderer, this._seriesGroup, settings );\n // provide context for each series\n series.setChart( this );\n series.initialize();\n\n this._series.push( series );\n }\n }", "title": "" }, { "docid": "97e25b6d9eaed8b97da7b01b27983f79", "score": "0.6213052", "text": "createSeriesGroup () {\n }", "title": "" }, { "docid": "327e0f2e4c3bc2ec4f91fa875b63c68f", "score": "0.58995587", "text": "function createGroupedBars() {\n //set all values by series\n chart.data.forEach(function (d) {\n d.values = axis.serieNames.map(function (name) {\n return {\n name: name,\n xValue: d[chart.xField],\n yValue: +d[name]\n };\n })\n });\n\n //get new y domain\n var newYDomain = [0, d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1;\n });\n })];\n\n //check whether the chart is reversed\n if (isReversed) {\n //set new domain\n newYDomain = [d3.max(chart.data, function (d) {\n return d3.max(d.values, function (v) {\n return v.yValue * 1;\n });\n }), 0];\n\n //update x axis\n axis.x.domain(newYDomain);\n } else {\n //update y axis\n axis.y.domain(newYDomain);\n }\n\n //get range band\n var rangeBand = groupAxis.rangeBand();\n\n //create bar groups on canvas\n groupedBars = chart.svg.selectAll('.eve-series')\n .data(chart.data)\n .enter().append('g')\n .attr('class', 'eve-series')\n .attr('transform', function (d) {\n if (isReversed)\n return 'translate(' + (axis.offset.left) + ',' + (axis.y(d[chart.xField])) + ')';\n else\n return 'translate(' + (axis.x(d[chart.xField]) + axis.offset.left) + ',0)';\n });\n\n //create bar group rectangles\n groupedBarsRects = groupedBars.selectAll('rect')\n .data(function (d) { return d.values; })\n .enter().append('rect')\n .attr('class', function (d, i) { return 'eve-bar-serie eve-bar-serie-' + i; })\n .attr('width', function (d) { return isReversed ? (axis.offset.width - axis.x(d.yValue)) : rangeBand; })\n .attr('x', function (d) { return isReversed ? 0 : groupAxis(d.name); })\n .attr('y', function (d) { return isReversed ? groupAxis(d.name) : axis.y(d.yValue); })\n .attr('height', function (d) { return isReversed ? rangeBand : (axis.offset.height - axis.y(d.yValue)); })\n .style('fill', function (d, i) {\n //check whether the serie has color\n if (chart.series[i].color === '')\n return i <= e.colors.length ? e.colors[i] : e.randColor();\n else\n return chart.series[i].color;\n })\n .style('stroke', '#ffffff')\n .style('stroke-width', function (d, i) { return chart.series[i].strokeSize + 'px'; })\n .style('stroke-opacity', function (d, i) { return chart.series[i].alpha; })\n .style('fill-opacity', function (d, i) { return chart.series[i].alpha; })\n .on('mousemove', function(d, i) {\n var balloonContent = chart.getXYFormat(d, chart.series[d.index]);\n\n //show balloon\n chart.showBalloon(balloonContent);\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize + 1; });\n })\n .on('mouseout', function(d, i) {\n //hide balloon\n chart.hideBalloon();\n\n //increase bullet stroke size\n d3.select(this)\n .style('stroke-width', function (d) { return chart.series[i].strokeSize; });\n });\n\n //set serie labels\n groupedBarsTexts = groupedBars.selectAll('text')\n .data(function(d) { return d.values; })\n .enter().append('text')\n .attr('class', function(d, i) { return 'eve-bar-label eve-bar-label-' + i; })\n .style('cursor', 'pointer')\n .style('fill', function(d, i) { return chart.series[i].labelFontColor; })\n .style('font-weight', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'bold' : 'normal'; })\n .style('font-style', function(d, i) { return chart.series[i].labelFontStyle == 'bold' ? 'normal' : chart.series[i].labelFontStyle; })\n .style(\"font-family\", function(d, i) { return chart.series[i].labelFontFamily; })\n .style(\"font-size\", function(d, i) { return chart.series[i].labelFontSize + 'px'; })\n .text(function(d, i) {\n //check whether the label format is enabled\n if(chart.series[i].labelFormat != '')\n return chart.getXYFormat(d, chart.series[i], 'label');\n })\n .attr('x', function(d, i) {\n //return calculated x pos\n return isReversed ? (axis.offset.width - axis.x(d.yValue)) : (i * rangeBand);\n })\n .attr('y', function(d, i) {\n //return calculated y pos\n return isReversed ? groupAxis(d.name) + rangeBand : axis.y(d.yValue) - 2;\n });\n }", "title": "" }, { "docid": "e4d17fd2935950fd0d58d4fb5d45e581", "score": "0.5852447", "text": "function groupTicks(d, step) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return [{\n name: d.name,\n value: d.value,\n angle: d.value * k + d.startAngle\n }];\n }", "title": "" }, { "docid": "dcc7325c3b1508bebbd938a37002a520", "score": "0.5661641", "text": "function groupTicks(d, step) {\n // console.log(d)\n const k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value + 1, step).map(value => {\n return { value: value, angle: value * k + d.startAngle };\n });\n}", "title": "" }, { "docid": "09d13172f31774986e25323acfd3a618", "score": "0.56351215", "text": "function CreateXYSeries(group, key1, key2) {\n var xDate = false;\n var xSeries = [];\n var ySeries = [];\n\n if (group.all()[0]['key'] instanceof Date) {\n xDate = true;\n var minDate = group.all()[0]['key'];\n var maxDate = group.all()[group.all().length - 1]['key'];\n var timeDiff = Math.abs(maxDate.getTime() - minDate.getTime());\n var totalDays = Math.ceil(timeDiff / (1000 * 3600 * 24));\n }\n if (xDate) {\n group.all().forEach(function (d) {\n var timeDiff = Math.abs(DeepValue(d, key1).getTime() - minDate.getTime());\n var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));\n xSeries.push(diffDays);\n ySeries.push(DeepValue(d, key2));\n })\n }\n else {\n group.all().forEach(function (d) {\n xSeries.push(DeepValue(d, key1));\n ySeries.push(DeepValue(d, key2));\n })\n }\n return [xSeries, ySeries, xDate, totalDays];\n}", "title": "" }, { "docid": "9262591a93a4a4ddbc25c37293bf4491", "score": "0.5611682", "text": "function getDataSeries(data)\n{\n \n var series_list = Array();\n \n for(var group in data)\n {\n series = new Object();\n \n series.label = group;\n \n series.data = getFilteredArray(data[group], 5).filtered_with_tolerance;//findLineByLeastSquares(data[group]);\n \n \n series_list.push(series);\n }\n \n return series_list;\n}", "title": "" }, { "docid": "298b3a16166f5a458246906bde674ae4", "score": "0.5571495", "text": "function combineAllGroups() {\n var allGroups = [];\n\n allGroups.push(chart.group());\n\n for (var i = 0; i < chart.stack().length; ++i)\n allGroups.push(chart.stack()[i]);\n\n return allGroups;\n }", "title": "" }, { "docid": "298b3a16166f5a458246906bde674ae4", "score": "0.5571495", "text": "function combineAllGroups() {\n var allGroups = [];\n\n allGroups.push(chart.group());\n\n for (var i = 0; i < chart.stack().length; ++i)\n allGroups.push(chart.stack()[i]);\n\n return allGroups;\n }", "title": "" }, { "docid": "8139c75e097f65115cc7d0766f5b2fdd", "score": "0.5477058", "text": "function groupTicks(d) {\n // console.log(\"Var k:\");\n var k = (d.endAngle - d.startAngle) / d.value;\n // console.log(k);\n // console.log(\"Für d.endAngle = \" + d.endAngle + \" - d.startAngle = \" + d.startAngle + \" / d.value = \" + d.value);\n // console.log(\"Objekt D:\");\n // console.log(d);\n return d3.range(0, d.value, 1000).map(function(v, i) {\n // console.log(\"V ist : \");\n // console.log(v);\n // console.log(\"i ist : \");\n // console.log(i);\n // console.log(poiComponentMatrix[d.index][0]);\n return {\n angle: v * k + d.startAngle,\n // TODO: Label noch besser ausrichten\n label: (d.index < pois.length) ? poiComponentMatrix[d.index][0] : componentsList[d.index - pois.length]\n // label: (d.index < pois.length) ? poiComponentMatrix[d.index][0] : poiComponentMatrix[d.index][1][d.index - pois.length][2]\n // label: i % 5 ? null : v / 1000 + \"k\"\n };\n });\n}", "title": "" }, { "docid": "76e037537ac6837d82f1a51919411a52", "score": "0.5474671", "text": "function groupTicks(d) {\nvar k = (d.endAngle - d.startAngle) / d.value;\nreturn d3.range(0, d.value, 500).map(function(v, i) {\nreturn {\n angle: v * k + d.startAngle,\n label: i % 1 ? null : v \n};\n});\n} //groupTicks", "title": "" }, { "docid": "76e037537ac6837d82f1a51919411a52", "score": "0.5474671", "text": "function groupTicks(d) {\nvar k = (d.endAngle - d.startAngle) / d.value;\nreturn d3.range(0, d.value, 500).map(function(v, i) {\nreturn {\n angle: v * k + d.startAngle,\n label: i % 1 ? null : v \n};\n});\n} //groupTicks", "title": "" }, { "docid": "0fcbed9cee4935267c9016cbb86fa9a2", "score": "0.5442846", "text": "async getRoundsGroupedBySeries(ctx) {\n let data = await Model.round\n .aggregate([\n {\n $lookup: {\n from: \"series\",\n localField: \"series\",\n foreignField: \"_id\",\n as: \"series\"\n }\n }, \n {\n $group: {\n _id: \"$series\",\n rounds: {\n $push: {\n _id: \"$_id\",\n number: \"$number\",\n round: \"$round\",\n track: \"$track\",\n configuration: \"$configuration\",\n type: \"$type\"\n }\n }\n }\n }\n ])\n .exec();\n ctx.body = data; \n }", "title": "" }, { "docid": "7c46e978743bd5ae785d1e383079ffae", "score": "0.5436851", "text": "function axesDomain(series) {\n function min (series) {\n var seriesNum = series.map(d => parseFloat(d))\n var seriesMin = d3.min(seriesNum, d => d)\n return seriesMin\n }\n function max (series) {\n var seriesNum = series.map(d => parseFloat(d))\n var seriesMax = d3.max(seriesNum, d => d)\n return seriesMax\n }\n var seriesMin = min(series);\n var seriesMax = max(series);\n \n return [seriesMin, seriesMax]\n}", "title": "" }, { "docid": "7924f3667dc0249e18f2941f9eb7dcca", "score": "0.5430185", "text": "function groupTicks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 10).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 1 ? null : v + \"%\"\n };\n });\n }", "title": "" }, { "docid": "937ab4a9e95bebfb1e57c51df0fb040a", "score": "0.5426098", "text": "function groupTicks(d) {\n\t\tvar k = (d.endAngle - d.startAngle) / d.value;\n\t\treturn d3.range(0, d.value, 1000).map(function(v, i) {\n\t\t\treturn {\n\t\t\t\tangle: v * k + d.startAngle,\n\t\t\t\tlabel: i % 100 ? null : v / 1000 + \"k\"\n\t\t\t};\n\t\t});\n\t}", "title": "" }, { "docid": "16fe228af393ee33c7ece0a5e2102bbc", "score": "0.5424425", "text": "get timeseries() {\n return this.response.series.map((s) => ({\n x: _.range(\n extractYear(s.time_range.gte),\n extractYear(s.time_range.lte) + 1\n ),\n y: s.values,\n name: s.options.name,\n }));\n }", "title": "" }, { "docid": "6b3800ef59a77850900f0fd369972ec5", "score": "0.5424271", "text": "function groupTicks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 1000).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 5 ? null : v / 1000 + \"k\"\n };\n });\n}", "title": "" }, { "docid": "583e9b2eb4da1f2b1b0b53a6b0b1859f", "score": "0.54231715", "text": "function groupTicks(d) {\n\t\tvar k = (d.endAngle - d.startAngle) / d.value;\n\t\treturn d3.range(0, d.value, 1000).map(function(v, i) {\n\t\t\treturn {\n\t\t\t\tangle : v * k + d.startAngle,\n\t\t\t\tlabel : i % 5 ? null : v / 1000 + \"k\"\n\t\t\t};\n\t\t});\n\t}", "title": "" }, { "docid": "509d1de85fba3d73156c0f4f5e0dd9f9", "score": "0.5412284", "text": "function transitionGrouped() {\n const xr = tx().rescaleX(x);\n const yr = ty().rescaleY(y);\n // adjust y-axis\n // y.domain([0, d3.max(_.flatMapDeep(series, d => _.map(d, d=> d[1] - d[0])))*1.1]);\n // change class of bars\n svg.selectAll('.bars').classed('grouped', true);\n svg.selectAll('.bars').classed('stacked', false);\n let n = series.length;\n // change position of the rects through transition\n rect.transition()\n .duration(500)\n .delay((d, i) => i * 20)\n .attr(\"x\", (d, i) => xr(d.data.date) + xBand.bandwidth() / n * d.index)\n // .attr(\"x\", (d, i) => x(d.data.date) - xBand.bandwidth()/2 + xBand.bandwidth() / n * d.index)\n .attr(\"width\", xBand.bandwidth() / n)\n .transition()\n .attr(\"y\", d => yr(d[1] - d[0]))\n .attr(\"height\", d => yr(0) - yr(d[1] - d[0]));\n // update y-axis and grid\n svg.selectAll(\".y-axis\").call(yAxis, yr);\n svg.selectAll('.grid').selectAll('g').remove();\n svg.selectAll(\".grid\").call(grid, yr);\n }", "title": "" }, { "docid": "938995cc6c1f8483144dcfc2b9301b09", "score": "0.54078907", "text": "function groupData(i, day) {\n\n if (i.day == day) {\n graphData.push({\n \"day\": i.day,\n \"values\": [\n {\"value\": i.questions_answered, \"label\": \"question answered\"},\n {\"value\": i.questions_correct, \"label\": \"question correct\"}\n ]\n })\n } else {\n graphData.push({\n \"day\": day,\n \"values\": [\n {\"value\": 0, \"label\": \"question answered\"},\n {\"value\": 0, \"label\": \"question correct\"}\n ]\n })\n }\n}", "title": "" }, { "docid": "7e837974d9a1715aa0fe147006c33257", "score": "0.5364787", "text": "createGroups() {\n this.xAxisG = this.g.diagram.append('g')\n .attr('class', 'top-axis axis')\n .attr('clip-path', 'url(#clip-path)');\n this.yLeftAxisG = this.g.diagram.append('g')\n .attr('class', 'left-axis axis');\n this.yRightAxisG = this.g.diagram.append('g')\n .attr('class', 'right-axis axis')\n .attr('transform', `translate(${this.dims.marey.innerWidth},0)`);\n this.yScrollAxisG = this.g.scroll.append('g')\n .attr('class', 'scroll-axis axis');\n this.yStopSelAxisG = this.g.stopSelection.append('g')\n .attr('class', 'stop-selection-axis axis');\n this.tripsG = this.g.diagram.append('g')\n .attr('class', 'trips')\n .attr('clip-path', 'url(#clip-path-trips)');\n this.timelineG = this.g.diagram.append('g')\n .attr('class', 'timeline');\n }", "title": "" }, { "docid": "40ec746fb841e8dff46544102d48752e", "score": "0.53597426", "text": "function groupTicks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 1).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 5 ? null : v + \"%\"\n };\n });\n}", "title": "" }, { "docid": "40ec746fb841e8dff46544102d48752e", "score": "0.53597426", "text": "function groupTicks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 1).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 5 ? null : v + \"%\"\n };\n });\n}", "title": "" }, { "docid": "e3880c56a86fa2c42f07fa12d4b2da6d", "score": "0.5332473", "text": "function parseGroupedInterval() {\n var options = Array.prototype.slice.call(arguments);\n return function (res) {\n var dataset = new Dataset().type('grouped-interval');\n (0, _each.each)(res.result, function (record, i) {\n var index = options[0] && options[0] === 'timeframe.end' ? record.timeframe.end : record.timeframe.start;\n if (record.value.length) {\n (0, _each.each)(record.value, function (group, j) {\n var label;\n (0, _each.each)(group, function (value, key) {\n if (key !== 'result') {\n label = key;\n }\n });\n dataset.set([String(group[label]), index], group.result);\n });\n } else {\n dataset.appendRow(index);\n }\n });\n return dataset;\n };\n}", "title": "" }, { "docid": "d33b61c3371c27a27122aab953a97218", "score": "0.5321069", "text": "function eachAxis(handler) {\n return [handler(\"x\"), handler(\"y\")];\n}", "title": "" }, { "docid": "95ee8a0949121e002ad2b7d4a222446a", "score": "0.5318523", "text": "function groupTicks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 1000).map(function (v, i) {\n return {\n angle: v * k + d.startAngle,\n //label: i % 5 ? null : v / 1000 + \"k\"\n label: chordData.header[d.index]\n };\n });\n }", "title": "" }, { "docid": "5c90f10554ed53bda1b2938b50649fa9", "score": "0.53123635", "text": "series(name, body) {\n const testSeries = this.group(name, body);\n testSeries.isSeries = true;\n return testSeries;\n }", "title": "" }, { "docid": "358fc283435713e93bba413189fc6e02", "score": "0.52680737", "text": "function axisAsTimeSeries(axis) {\n var result = [];\n var rowNumber = 0;\n\n _.each(axis, function (tryTimeString) {\n var time = convertTimeString(tryTimeString);\n if (time) {\n time.row = rowNumber;\n rowNumber = rowNumber + 1;\n\n result.push(time);\n } else {\n return null;\n }\n });\n return result;\n }", "title": "" }, { "docid": "ebdec82aa48f0e7678d7aadf8e96f5ee", "score": "0.52357984", "text": "groupArray(result, entry, iter = 0) {\n let nextResult;\n if (iter === this.groupBy.length + 1) {\n result.push(entry);\n return;\n }\n\n\n let groupingProperty = result[entry[this.groupBy[iter]]];\n let chartEntry = result[entry[this.idAlias]];\n\n //If we can't find a property within result for the groupBy parameter at this level we create a new one.\n if (!result[entry[this.groupBy[iter]]] && iter < this.groupBy.length) {\n result[entry[this.groupBy[iter]]] = {groupName: entry[this.groupByAlias[iter]]};\n nextResult = result[entry[this.groupBy[iter]]];\n }\n else if (!result[entry[this.idAlias]] && iter === this.groupBy.length) {\n result[entry[this.idAlias]] = [];\n nextResult = result[entry[this.idAlias]];\n }\n else if (result[entry[this.groupBy[iter]]]) {\n nextResult = result[entry[this.groupBy[iter]]];\n }\n else if (result[entry[this.idAlias]]) {\n nextResult = result[entry[this.idAlias]];\n }\n iter++;\n this.groupArray(nextResult, entry, iter);\n }", "title": "" }, { "docid": "e64cddc3dd981678c988509a5eba6c14", "score": "0.5232819", "text": "function eachAxis(handler) {\n\t return [handler(\"x\"), handler(\"y\")];\n\t}", "title": "" }, { "docid": "e43899774d70b31d3dfb7318c745a822", "score": "0.52061313", "text": "initAxisX(){\n this.xAxisGroup = this.chartGroup.append(\"g\")\n .attr(\"transform\", `translate(0, ${this.chartHeight})`);\n }", "title": "" }, { "docid": "a2da25dbc47c257942372da6a1f3a7b4", "score": "0.518392", "text": "function transitionGrouped() {\n currentChartType = 'grouped';\n y.domain([0, yGroupMax]);\n\n rect.transition()\n .duration(500)\n .delay(function(d, i) {\n return i * 10;\n })\n .attr(\"x\", function(d, i, j) {\n return x(d.x) + x.rangeBand() / n * j;\n })\n .attr(\"width\", x.rangeBand() / n)\n .transition()\n .attr(\"y\", function(d) {\n return y(d.y);\n })\n .attr(\"height\", function(d) {\n return height - y(d.y);\n });\n\n //update y axis\n yAxisGroupSelector\n .transition()\n .duration(500)\n .call(yAxis);\n }", "title": "" }, { "docid": "b6818b4b22b212e826a0e4436ae3bf56", "score": "0.5112924", "text": "function groupByTissues() {\n var checkbox = $('#isoform-barplot-groupByTissues-on');\n var cx = $('#isoform-barplot-canvas').data('canvasxpress');\n if (checkbox.is(':checked')) {\n cx.groupSamples([\"Tissue_Group\"]);\n } else {\n cx.groupSamples([]);\n }\n}", "title": "" }, { "docid": "7babf8b1f4e2a8322ae3998a7d3e9fe4", "score": "0.5104776", "text": "function makeLabelsByCustomizedCategoryInterval(axis,categoryInterval,onlyTick){\nvar ordinalScale=axis.scale;\nvar labelFormatter=makeLabelFormatter(axis);\nvar result=[];\n\neach$1(ordinalScale.getTicks(),function(tickValue){\nvar rawLabel=ordinalScale.getLabel(tickValue);\nif(categoryInterval(tickValue,rawLabel)){\nresult.push(onlyTick?\ntickValue:\n{\nformattedLabel:labelFormatter(tickValue),\nrawLabel:rawLabel,\ntickValue:tickValue});\n\n\n}\n});\n\nreturn result;\n}", "title": "" }, { "docid": "63240d5d6dd4e94762af15bfb8e6e0b7", "score": "0.50877047", "text": "function generateChartAxis(rawData) {\n\treturn Object.keys(rawData).map(function(key, index) {\n return {x: moment(key)._d, y: rawData[key]}\n }); \n}", "title": "" }, { "docid": "eb7c2c8547f394a6b3bdd3afd7a71d11", "score": "0.507609", "text": "function drawAxis( axisIndex, key, duration ) {\n var scaleMin = axisRange[0];\n var scaleMax = axisRange[1];\n\n var scale = d3.scale.linear()\n .domain( [0,domainMax] ) // demo data range\n .range( axisRange )\n \n scales[axisIndex] = scale;\n\n var numTicks = 10;\n var tickSize = 0.1;\n var tickFontSize = 0.5;\n\n \n\n // base grid lines\n if(axisIndex == 0){\n for(var ind = 0; ind < (groupValues.length+1); ind++){\n var transform = scene.append(\"transform\")\n .attr(\"rotation\", [1,0.3,0,Math.PI/3*4])\n .attr(\"translation\", scaleMax+\" \"+0+\" \"+scaleMax/15*ind)\n .attr(\"scale\", [0.02,0.02,0.02]);\n var yTickLine = transform.append(\"shape\")\n yTickLine\n .append(\"appearance\")\n .append(\"material\")\n .attr(\"emissiveColor\", \"gray\")\n yTickLine\n .append(\"polyline2d\")\n // Line drawn along y axis does not render in Firefox, so draw one\n // along the x axis instead and rotate it (above).\n .attr(\"lineSegments\", \"0 0,\" + scaleMax + \" 0\");\n\n if(ind < groupValues.length){\n var transform = scene.append(\"transform\")\n .attr(\"rotation\", [1,0.3,0,Math.PI/3*4])\n .attr(\"translation\", scaleMax/20*21+\" \"+0+\" \"+(scaleMax/15*ind+scaleMax/30))\n .attr(\"scale\", [0.02,0.02,0.02]);\n var yTickText = transform.append(\"billboard\")\n .attr(\"axisOfRotation\", \"0 0 0\")\n .append(\"shape\")\n .call(makeSolid);\n yTickText.append(\"text\")\n .attr(\"string\", groupValues[ind])\n .attr(\"solid\", \"true\")\n .append(\"fontstyle\")\n .attr(\"quality\", 1)\n .attr(\"size\", 10)\n .attr(\"justify\", \"MIDDLE\");\n }\n }\n }else if (axisIndex==1) {\n for(var ind = 0; ind < numTicks+1; ind++){\n var transform = scene.append(\"transform\")\n .attr(\"rotation\", [0,1,0,Math.PI/9*10])\n .attr(\"translation\", 0+\" \"+scaleMax*xzRate*2/numTicks*ind+\" \"+scaleMax*xzRate)\n .attr(\"scale\", [0.02,0.02,0.02]);\n var yTickLine = transform.append(\"shape\")\n yTickLine\n .append(\"appearance\")\n .append(\"material\")\n .attr(\"emissiveColor\", \"gray\")\n yTickLine\n .append(\"polyline2d\")\n // Line drawn along y axis does not render in Firefox, so draw one\n // along the x axis instead and rotate it (above).\n .attr(\"lineSegments\", \"0 0,\" + scaleMax + \" 0\");\n\n var transform = scene.append(\"transform\")\n .attr(\"rotation\", [0,1,0,Math.PI/9*10])\n .attr(\"translation\", -scaleMax/30+\" \"+(scaleMax*xzRate*2/numTicks*ind-scaleMax/60)+\" \"+scaleMax*xzRate)\n .attr(\"scale\", [0.02,0.02,0.02]);\n var yTickText = transform.append(\"billboard\")\n .attr(\"axisOfRotation\", \"0 0 0\")\n .append(\"shape\")\n .call(makeSolid)\n yTickText.append(\"text\")\n .attr(\"string\", parseInt(ind/domainMax*100*numTicks)+\"%\")\n .append(\"fontstyle\")\n .attr(\"size\", 10)\n .attr('quality',2)\n // .attr('style','bold')\n .attr(\"justify\", \"END\")\n }\n\n var ticks12 = scale.ticks( numTicks );\n for(var i=0; i < ticks12.length; i++){\n ticks12[i] = ticks12[i]*2*xzRate;\n }\n\n var gridLines = scene.selectAll( \".\"+axisName(\"GridLine1\", axisIndex))\n .data(ticks12);\n gridLines.exit().remove();\n \n var newGridLines = gridLines.enter()\n .append(\"transform\")\n .attr(\"class\", axisName(\"GridLine1\", axisIndex))\n .attr(\"rotation\", [1,0,0, -Math.PI/2])\n .append(\"shape\")\n\n newGridLines.append(\"appearance\")\n .append(\"material\")\n .attr(\"emissiveColor\", \"gray\")\n newGridLines.append(\"polyline2d\");\n\n gridLines.selectAll(\"shape polyline2d\").transition().duration(duration)\n .attr(\"lineSegments\", \"0 0, \" + axisRange[1] + \" 0\")\n\n gridLines.transition().duration(duration)\n .attr(\"translation\", function(d) {\n return \"0 \"+scale(d) + \" 0\"; \n })\n\n var gridLines = scene.selectAll( \".\"+axisName(\"GridLine2\", axisIndex))\n .data(ticks12);\n gridLines.exit().remove();\n var newGridLines = gridLines.enter()\n .append(\"transform\")\n .attr(\"class\", axisName(\"GridLine2\", axisIndex))\n .attr(\"rotation\", [0,1,0, -Math.PI/2])\n .attr(\"scale\",[0.2,0.2,0.2])\n .append(\"shape\")\n\n newGridLines.append(\"appearance\")\n .append(\"material\")\n .attr(\"emissiveColor\", \"gray\")\n newGridLines.append(\"polyline2d\");\n\n gridLines.selectAll(\"shape polyline2d\").transition().duration(duration)\n .attr(\"lineSegments\", \"0 0, \" + axisRange[1] + \" 0\")\n\n gridLines.transition().duration(duration)\n .attr(\"translation\", function(d) {\n return \"0 \"+scale(d) + \" 0\"; \n })\n } \n }", "title": "" }, { "docid": "e850a3435ac07585bae20244dc913769", "score": "0.50751257", "text": "function calculateSeries(data) {\n var series = [];\n\n data.series.map( function(item, key) {\n\n series.push({\n name: item.name,\n data: item.data,\n color: item.color\n });\n });\n\n return series;\n }", "title": "" }, { "docid": "70c4f27f0f26c5f53d86abf5cd82a73a", "score": "0.5075107", "text": "function groupSegsByDay(segs) {\n var segsByDay = []; // sparse array\n var i;\n var seg;\n for (i = 0; i < segs.length; i += 1) {\n seg = segs[i];\n (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))\n .push(seg);\n }\n return segsByDay;\n}", "title": "" }, { "docid": "70c4f27f0f26c5f53d86abf5cd82a73a", "score": "0.5075107", "text": "function groupSegsByDay(segs) {\n var segsByDay = []; // sparse array\n var i;\n var seg;\n for (i = 0; i < segs.length; i += 1) {\n seg = segs[i];\n (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))\n .push(seg);\n }\n return segsByDay;\n}", "title": "" }, { "docid": "b001f4e5c277238fee89228fb3e37653", "score": "0.50735", "text": "function getAxisTicks(data, config, type) {\n var ticks = [];\n if (data[0]) {\n angular.forEach(data[0].datapoints, function (datapoint) {\n ticks.push(datapoint.x);\n //ticks.push('test');\n });\n }\n return {\n type: 'category',\n //boundaryGap: type === 'bar',\n boundaryGap: type === 'bar' || _.includes(_.map(data, 'type'),'bar'),\n\n //splitNumber: 10,\n data: ticks\n };\n }", "title": "" }, { "docid": "68bea308f4ab055c7f0ad004b7739a41", "score": "0.5051823", "text": "function calculateSeries(data) {\n var series = [];\n\n data.series.map( function(item, key) {\n series.push({\n name: item.name,\n data: item.data,\n color: item.color\n });\n });\n\n return series;\n }", "title": "" }, { "docid": "20456b1fb6db316c21cb5c2053cb94c4", "score": "0.50492877", "text": "function renderSubgroupAxis(gFeatureAxis, tweetsForFeature) {\n const featureScale = feature.type == 'continuous' \n ? feature.scale\n : d3.scaleLinear()\n .domain([_.min(feature.scale.domain()), _.max(feature.scale.domain())]) // Treat cateogorical features as continuous\n .range([160, 0]);\n\n const xGroupScale = d3.scaleOrdinal()\n .domain(d3.range(9))\n .range(cumGroupSizeRatio);\n\n const groupRatioScale = d3.scaleLinear()\n .domain([0, 0.2, 0.4, 0.6, 0.8, 1])\n .range(['#CB4335', '#E74C3C', '#FADBD8', '#D7DBFF', '#7584FF', '#001BFF']);\n\n yAxisSetting = d3\n .axisLeft(featureScale)\n //.tickValues(feature.type == 'categorical' ? feature.values.map(e => e.num) : feature.values)\n // .tickFormat(\n // (feature.type == 'categorical') \n // ? (d, i) => feature.values[d].category\n // : (d, i) => d\n // )\n .tickSize(0);\n d3.select(this).call(yAxisSetting);\n\n // d3.select(this)\n // .selectAll('.subgroup_rect')\n // .data(d3.range(9)).enter()\n\n clusters.forEach(function(cl, clId) {\n const instancesForCl = tweetsForFeature.filter(d => d.clusterId == cl.clusterId);\n\n const featureValues = instancesForCl.map(d => d.feature);\n const featureMean = _.mean(featureValues),\n featureSD = Math.sqrt(_.sum(_.map(featureValues, (i) => Math.pow((i - featureMean), 2))) / featureValues.length);\n const third_quantile = featureMean + featureSD*0.6745,\n first_quantile = featureMean - featureSD*0.6745 < 0 \n ? (featureMean - featureSD*0.6745)/5 \n : featureMean - featureSD*0.6745;\n\n gFeatureAxis\n .append('rect')\n .attr('class', 'subgroup_rect subgroup_rect_' + cl.clusterId)\n .attr('x', clId == 0 ? 0 : xGroupScale(clId-1))\n .attr('y', featureScale(third_quantile)+5)\n .attr('width', clId == 0 ? xGroupScale(clId) : xGroupScale(clId)-xGroupScale(clId-1))\n .attr('height', featureScale(first_quantile)-featureScale(third_quantile) == 0 ? 4 : featureScale(first_quantile)-featureScale(third_quantile))\n .style('stroke', 'black')\n .style('stroke', 0.25)\n .style('fill', groupRatioScale(cl.groupRatio.lib))\n .on('mouseover', function(d, i) {\n d3.select(this)\n .style('stroke', 'orange')\n .style('stroke-width', 2);\n console.log('featureMean and SD: ', cl.clusterId, featureMean, featureSD)\n // const subgroupHtml =\n // '<div style=\"font-weight: 600\">' +\n // 'Subgroup Id: ' +\n // (i+1) +\n // '</br>' +\n // 'Mean: ' +\n // featureMean +\n // 'sd: ' +\n // featureSD +\n // '</div>';\n\n // tooltip.html(subgroupHtml);\n // tooltip.show();\n })\n .on('mouseout', function(d) {\n d3.select(this)\n .style('stroke', 'black')\n .style('stroke-width', 0.5);\n // tooltip.hide();\n })\n \n var triangleSize = 20;\n var verticalTransform = 180 + Math.sqrt(triangleSize);\n \n const triangle = d3.symbol()\n .type(d3.symbolTriangle)\n .size(triangleSize);\n \n gFeatureAxis.append('path')\n .attr('class', 'point_to_subgroup_for_selected_instance ' + 'subgroup_' + clId)\n .attr(\"d\", triangle)\n .attr(\"stroke\", 'black')\n .attr(\"fill\", 'black')\n .attr(\"transform\", function(d) { \n const x = clId == 0 ? 0 : xGroupScale(clId-1);\n return \"translate(\" + x + \",\" + (-10) + \")rotate(180)\"; \n });\n });\n }", "title": "" }, { "docid": "db77a5a50301bc60ab0ab1575c2cd005", "score": "0.5036008", "text": "function calculateBase(groupItem){\nvar extent;\nvar baseAxis=groupItem.axis;\nvar seriesModels=groupItem.seriesModels;\nvar seriesCount=seriesModels.length;\n\nvar boxWidthList=groupItem.boxWidthList=[];\nvar boxOffsetList=groupItem.boxOffsetList=[];\nvar boundList=[];\n\nvar bandWidth;\nif(baseAxis.type==='category'){\nbandWidth=baseAxis.getBandWidth();\n}else\n{\nvar maxDataCount=0;\neach$13(seriesModels,function(seriesModel){\nmaxDataCount=Math.max(maxDataCount,seriesModel.getData().count());\n});\nextent=baseAxis.getExtent(),\nMath.abs(extent[1]-extent[0])/maxDataCount;\n}\n\neach$13(seriesModels,function(seriesModel){\nvar boxWidthBound=seriesModel.get('boxWidth');\nif(!isArray(boxWidthBound)){\nboxWidthBound=[boxWidthBound,boxWidthBound];\n}\nboundList.push([\nparsePercent$1(boxWidthBound[0],bandWidth)||0,\nparsePercent$1(boxWidthBound[1],bandWidth)||0]);\n\n});\n\nvar availableWidth=bandWidth*0.8-2;\nvar boxGap=availableWidth/seriesCount*0.3;\nvar boxWidth=(availableWidth-boxGap*(seriesCount-1))/seriesCount;\nvar base=boxWidth/2-availableWidth/2;\n\neach$13(seriesModels,function(seriesModel,idx){\nboxOffsetList.push(base);\nbase+=boxGap+boxWidth;\n\nboxWidthList.push(\nMath.min(Math.max(boxWidth,boundList[idx][0]),boundList[idx][1]));\n\n});\n}", "title": "" }, { "docid": "3d3e44a06fa045408e95bf7fcef3c46c", "score": "0.50313294", "text": "function ColumnMultiSeriesgroup() {\n _classCallCheck(this, ColumnMultiSeriesgroup);\n\n var _this = _possibleConstructorReturn(this, _ComponentInterface.call(this));\n\n _this.setState('visible', true);\n return _this;\n }", "title": "" }, { "docid": "093e8a0315e7c6042bac60f4fa5901da", "score": "0.50118583", "text": "function assemble_assembleAxisSignals(model) {\n const { axes } = model.component;\n for (const channel of channel_POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/weight so x-axis can draw the grid with the right height. Same for y-axis and width.\n const sizeType = channel === 'x' ? 'height' : 'width';\n return [\n {\n name: sizeType,\n update: model.getSizeSignalRef(sizeType).signal\n }\n ];\n }\n }\n }\n }\n return [];\n}", "title": "" }, { "docid": "dfcb87023177ce9bd4fa38943f374aba", "score": "0.49864927", "text": "function groupBackTogether() {\n // Get singles\n var singles = [];\n nodes.forEach(function(d) {\n if (d instanceof SingleEvent) {\n singles.push(d);\n }\n });\n\n // Remove them\n singles.forEach(function(d) {\n d.removeSelf();\n });\n\n // Create company events\n var newCompanyEvents = parseSingleToCompanyEvents(singles);\n \n // Get other company events\n var companies = [];\n nodes.forEach(function(d) {\n if (d instanceof CompanyEvent) {\n companies.push(d);\n }\n });\n \n // Remove them\n companies.forEach(function(d) {\n d.removeSelf();\n });\n \n // Combine two companies arrays\n companies = companies.concat(newCompanyEvents);\n \n // Create date events\n var newDateEvents = parseCompanyToDateEvents(companies);\n \n // Set start points to grav points so they start in the right place\n newDateEvents.forEach(function(d) {\n var newY;\n for (var i=0; i<d.companyEvents.length; i++) {\n var curCompany = d.companyEvents[i];\n \n if (curCompany.y) {\n newY = curCompany.y;\n break;\n }\n }\n \n if (!newY) {\n console.log(\"No company with Y value. Setting to middle.\")\n newY = height/2;\n }\n \n \n var gravPoint = d.getGravPoint();\n d.x = gravPoint.x;\n d.y = newY;\n d.px = d.x;\n d.py = d.y;\n });\n \n // Add date events\n nodes = nodes.concat(newDateEvents);\n\n // Update the graph\n graph.update();\n}", "title": "" }, { "docid": "73ac865dfe8afc6ecd10d7b58c91212b", "score": "0.49616146", "text": "function _group_ticks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 50).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 5 ? null : v / 1\n }\n })\n }", "title": "" }, { "docid": "d1b2e038c685b57c6e572e20d49bc241", "score": "0.4946457", "text": "function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */],\n reset = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */],\n resetNeeded = true,\n groupAll = key === __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */],\n n0old;\n\n if (arguments.length < 1) key = __WEBPACK_IMPORTED_MODULE_2__identity__[\"a\" /* default */];\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n\n if(iterable) {\n n0old = n0\n n0 = values.length - newValues.length\n n1 = newValues.length;\n }\n\n var oldGroups = groups,\n reIndex = iterable ? [] : cr_index(k, groupCapacity),\n add = reduceAdd,\n remove = reduceRemove,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n if (resetNeeded) remove = initial = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n if(iterable){\n groupIndex = k0 ? groupIndex : [];\n }\n else{\n groupIndex = k0 > 1 ? __WEBPACK_IMPORTED_MODULE_0__array__[\"a\" /* default */].arrayLengthen(groupIndex, n) : cr_index(n, groupCapacity);\n }\n\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n g0 = oldGroups[++i0];\n if (g0) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n\n while (x1 <= x) {\n j = newIndex[i1] + (iterable ? n0old : n0)\n\n\n if(iterable){\n if(groupIndex[j]){\n groupIndex[j].push(k)\n }\n else{\n groupIndex[j] = [k]\n }\n }\n else{\n groupIndex[j] = k;\n }\n\n // Always add new values to groups. Only remove when not in filter.\n // This gives groups full information on data life-cycle.\n g.value = add(g.value, data[j], true);\n if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater th1an all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n\n // Fill in gaps with empty arrays where there may have been rows with empty iterables\n if(iterable){\n for (var index1 = 0; index1 < n; index1++) {\n if(!groupIndex[index1]){\n groupIndex[index1] = [];\n }\n }\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if(k > i0){\n if(iterable){\n for (i0 = 0; i0 < n0old; ++i0) {\n for (index1 = 0; index1 < groupIndex[i0].length; index1++) {\n groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];\n }\n }\n }\n else{\n for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n }\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1 || iterable) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n reset = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if(iterable){\n k++\n return\n }\n if (++k === groupCapacity) {\n reIndex = __WEBPACK_IMPORTED_MODULE_0__array__[\"a\" /* default */].arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = __WEBPACK_IMPORTED_MODULE_0__array__[\"a\" /* default */].arrayWiden(groupIndex, groupWidth);\n groupCapacity = capacity(groupWidth);\n }\n }\n }\n\n function removeData(reIndex) {\n if (k > 1 || iterable) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = cr_index(oldK, oldK),\n i,\n i0,\n j;\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n if (!iterable) {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n } else {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n groupIndex[j] = groupIndex[i];\n for (i0 = 0; i0 < groupIndex[j].length; i0++) {\n seenGroups[groupIndex[j][i0]] = 1;\n }\n ++j;\n }\n }\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1 || iterable) {\n // Reindex the group index using seenGroups to find the new index.\n if (!iterable) {\n for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n for (i = 0; i < j; ++i) {\n for (i0 = 0; i0 < groupIndex[i].length; ++i0) {\n groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];\n }\n }\n }\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n } else if (k === 1) {\n if (groupAll) return;\n for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = __WEBPACK_IMPORTED_MODULE_3__null__[\"a\" /* default */];\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateMany(filterOne, filterOffset, added, removed, notFilter) {\n\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n j,\n k,\n n,\n g;\n\n if(iterable){\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceAdd(g.value, data[k], false, j);\n }\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceRemove(g.value, data[k], notFilter, j);\n }\n }\n }\n return;\n }\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateOne(filterOne, filterOffset, added, removed, notFilter) {\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n j,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n if(iterable){\n for (i = 0; i < n; ++i) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceAdd(g.value, data[i], true, j);\n }\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceRemove(g.value, data[i], false, j);\n }\n }\n }\n return;\n }\n\n for (i = 0; i < n; ++i) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i], true);\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n for (i = 0; i < n; ++i) {\n g.value = reduceAdd(g.value, data[i], true);\n }\n\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(__WEBPACK_IMPORTED_MODULE_9__reduce__[\"a\" /* default */].reduceIncrement, __WEBPACK_IMPORTED_MODULE_9__reduce__[\"a\" /* default */].reduceDecrement, __WEBPACK_IMPORTED_MODULE_4__zero__[\"a\" /* default */]);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(__WEBPACK_IMPORTED_MODULE_9__reduce__[\"a\" /* default */].reduceAdd(value), __WEBPACK_IMPORTED_MODULE_9__reduce__[\"a\" /* default */].reduceSubtract(value), __WEBPACK_IMPORTED_MODULE_4__zero__[\"a\" /* default */]);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = __WEBPACK_IMPORTED_MODULE_5__heapselect__[\"a\" /* default */].by(valueOf);\n heap = __WEBPACK_IMPORTED_MODULE_6__heap__[\"a\" /* default */].by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(__WEBPACK_IMPORTED_MODULE_2__identity__[\"a\" /* default */]);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n i = dimensionGroups.indexOf(group);\n if (i >= 0) dimensionGroups.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }", "title": "" }, { "docid": "8777177fdbfeb3a22c648f0064e557fe", "score": "0.49289596", "text": "function getAxis(coll) {\n var otherColl = coll === 'xAxis' ? 'yAxis' : 'xAxis',\n opt = axis.options[otherColl];\n\n // Other axis indexed by number\n if (isNumber(opt)) {\n return [chart[otherColl][opt]];\n }\n\n // Other axis indexed by id (like navigator)\n if (isString(opt)) {\n return [chart.get(opt)];\n }\n\n // Auto detect based on existing series\n return map(series, function(s) {\n return s[otherColl];\n });\n }", "title": "" }, { "docid": "9d713d43dfce8fd25a6a1611cb7c55a9", "score": "0.49214476", "text": "function groupValues(values) {\n var groups = [], currentGroup;\n for (var i = 0, len = values.length; i < len; i++) {\n var value = values[i];\n if (!currentGroup || currentGroup.identity !== value.identity) {\n currentGroup = {\n values: []\n };\n if (value.identity) {\n currentGroup.identity = value.identity;\n var source = value.source;\n // allow null, which will be formatted as (Blank).\n if (source.groupName !== undefined) {\n currentGroup.name = source.groupName;\n }\n else if (source.displayName) {\n currentGroup.name = source.displayName;\n }\n }\n groups.push(currentGroup);\n }\n currentGroup.values.push(value);\n }\n return groups;\n }", "title": "" }, { "docid": "9d713d43dfce8fd25a6a1611cb7c55a9", "score": "0.49214476", "text": "function groupValues(values) {\n var groups = [], currentGroup;\n for (var i = 0, len = values.length; i < len; i++) {\n var value = values[i];\n if (!currentGroup || currentGroup.identity !== value.identity) {\n currentGroup = {\n values: []\n };\n if (value.identity) {\n currentGroup.identity = value.identity;\n var source = value.source;\n // allow null, which will be formatted as (Blank).\n if (source.groupName !== undefined) {\n currentGroup.name = source.groupName;\n }\n else if (source.displayName) {\n currentGroup.name = source.displayName;\n }\n }\n groups.push(currentGroup);\n }\n currentGroup.values.push(value);\n }\n return groups;\n }", "title": "" }, { "docid": "9d713d43dfce8fd25a6a1611cb7c55a9", "score": "0.49214476", "text": "function groupValues(values) {\n var groups = [], currentGroup;\n for (var i = 0, len = values.length; i < len; i++) {\n var value = values[i];\n if (!currentGroup || currentGroup.identity !== value.identity) {\n currentGroup = {\n values: []\n };\n if (value.identity) {\n currentGroup.identity = value.identity;\n var source = value.source;\n // allow null, which will be formatted as (Blank).\n if (source.groupName !== undefined) {\n currentGroup.name = source.groupName;\n }\n else if (source.displayName) {\n currentGroup.name = source.displayName;\n }\n }\n groups.push(currentGroup);\n }\n currentGroup.values.push(value);\n }\n return groups;\n }", "title": "" }, { "docid": "205326a60d2ac60812c186b0f1b3f2b3", "score": "0.49125025", "text": "function layoutSingleSeries(seriesModel, offset, boxWidth) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n var halfWidth = boxWidth / 2;\n var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;\n var vDimIdx = 1 - cDimIdx;\n var coordDims = ['x', 'y'];\n var cDim = data.mapDimension(coordDims[cDimIdx]);\n var vDims = data.mapDimension(coordDims[vDimIdx], true);\n\n if (cDim == null || vDims.length < 5) {\n return;\n }\n\n for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {\n var axisDimVal = data.get(cDim, dataIndex);\n\n var median = getPoint(axisDimVal, vDims[2], dataIndex);\n var end1 = getPoint(axisDimVal, vDims[0], dataIndex);\n var end2 = getPoint(axisDimVal, vDims[1], dataIndex);\n var end4 = getPoint(axisDimVal, vDims[3], dataIndex);\n var end5 = getPoint(axisDimVal, vDims[4], dataIndex);\n\n var ends = [];\n addBodyEnd(ends, end2, 0);\n addBodyEnd(ends, end4, 1);\n\n ends.push(end1, end2, end5, end4);\n layEndLine(ends, end1);\n layEndLine(ends, end5);\n layEndLine(ends, median);\n\n data.setItemLayout(dataIndex, {\n initBaseline: median[vDimIdx],\n ends: ends\n });\n }\n\n function getPoint(axisDimVal, dimIdx, dataIndex) {\n var val = data.get(dimIdx, dataIndex);\n var p = [];\n p[cDimIdx] = axisDimVal;\n p[vDimIdx] = val;\n var point;\n if (isNaN(axisDimVal) || isNaN(val)) {\n point = [NaN, NaN];\n }\n else {\n point = coordSys.dataToPoint(p);\n point[cDimIdx] += offset;\n }\n return point;\n }\n\n function addBodyEnd(ends, point, start) {\n var point1 = point.slice();\n var point2 = point.slice();\n point1[cDimIdx] += halfWidth;\n point2[cDimIdx] -= halfWidth;\n start\n ? ends.push(point1, point2)\n : ends.push(point2, point1);\n }\n\n function layEndLine(ends, endCenter) {\n var from = endCenter.slice();\n var to = endCenter.slice();\n from[cDimIdx] -= halfWidth;\n to[cDimIdx] += halfWidth;\n ends.push(from, to);\n }\n}", "title": "" }, { "docid": "205326a60d2ac60812c186b0f1b3f2b3", "score": "0.49125025", "text": "function layoutSingleSeries(seriesModel, offset, boxWidth) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n var halfWidth = boxWidth / 2;\n var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;\n var vDimIdx = 1 - cDimIdx;\n var coordDims = ['x', 'y'];\n var cDim = data.mapDimension(coordDims[cDimIdx]);\n var vDims = data.mapDimension(coordDims[vDimIdx], true);\n\n if (cDim == null || vDims.length < 5) {\n return;\n }\n\n for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {\n var axisDimVal = data.get(cDim, dataIndex);\n\n var median = getPoint(axisDimVal, vDims[2], dataIndex);\n var end1 = getPoint(axisDimVal, vDims[0], dataIndex);\n var end2 = getPoint(axisDimVal, vDims[1], dataIndex);\n var end4 = getPoint(axisDimVal, vDims[3], dataIndex);\n var end5 = getPoint(axisDimVal, vDims[4], dataIndex);\n\n var ends = [];\n addBodyEnd(ends, end2, 0);\n addBodyEnd(ends, end4, 1);\n\n ends.push(end1, end2, end5, end4);\n layEndLine(ends, end1);\n layEndLine(ends, end5);\n layEndLine(ends, median);\n\n data.setItemLayout(dataIndex, {\n initBaseline: median[vDimIdx],\n ends: ends\n });\n }\n\n function getPoint(axisDimVal, dimIdx, dataIndex) {\n var val = data.get(dimIdx, dataIndex);\n var p = [];\n p[cDimIdx] = axisDimVal;\n p[vDimIdx] = val;\n var point;\n if (isNaN(axisDimVal) || isNaN(val)) {\n point = [NaN, NaN];\n }\n else {\n point = coordSys.dataToPoint(p);\n point[cDimIdx] += offset;\n }\n return point;\n }\n\n function addBodyEnd(ends, point, start) {\n var point1 = point.slice();\n var point2 = point.slice();\n point1[cDimIdx] += halfWidth;\n point2[cDimIdx] -= halfWidth;\n start\n ? ends.push(point1, point2)\n : ends.push(point2, point1);\n }\n\n function layEndLine(ends, endCenter) {\n var from = endCenter.slice();\n var to = endCenter.slice();\n from[cDimIdx] -= halfWidth;\n to[cDimIdx] += halfWidth;\n ends.push(from, to);\n }\n}", "title": "" }, { "docid": "205326a60d2ac60812c186b0f1b3f2b3", "score": "0.49125025", "text": "function layoutSingleSeries(seriesModel, offset, boxWidth) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n var halfWidth = boxWidth / 2;\n var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;\n var vDimIdx = 1 - cDimIdx;\n var coordDims = ['x', 'y'];\n var cDim = data.mapDimension(coordDims[cDimIdx]);\n var vDims = data.mapDimension(coordDims[vDimIdx], true);\n\n if (cDim == null || vDims.length < 5) {\n return;\n }\n\n for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {\n var axisDimVal = data.get(cDim, dataIndex);\n\n var median = getPoint(axisDimVal, vDims[2], dataIndex);\n var end1 = getPoint(axisDimVal, vDims[0], dataIndex);\n var end2 = getPoint(axisDimVal, vDims[1], dataIndex);\n var end4 = getPoint(axisDimVal, vDims[3], dataIndex);\n var end5 = getPoint(axisDimVal, vDims[4], dataIndex);\n\n var ends = [];\n addBodyEnd(ends, end2, 0);\n addBodyEnd(ends, end4, 1);\n\n ends.push(end1, end2, end5, end4);\n layEndLine(ends, end1);\n layEndLine(ends, end5);\n layEndLine(ends, median);\n\n data.setItemLayout(dataIndex, {\n initBaseline: median[vDimIdx],\n ends: ends\n });\n }\n\n function getPoint(axisDimVal, dimIdx, dataIndex) {\n var val = data.get(dimIdx, dataIndex);\n var p = [];\n p[cDimIdx] = axisDimVal;\n p[vDimIdx] = val;\n var point;\n if (isNaN(axisDimVal) || isNaN(val)) {\n point = [NaN, NaN];\n }\n else {\n point = coordSys.dataToPoint(p);\n point[cDimIdx] += offset;\n }\n return point;\n }\n\n function addBodyEnd(ends, point, start) {\n var point1 = point.slice();\n var point2 = point.slice();\n point1[cDimIdx] += halfWidth;\n point2[cDimIdx] -= halfWidth;\n start\n ? ends.push(point1, point2)\n : ends.push(point2, point1);\n }\n\n function layEndLine(ends, endCenter) {\n var from = endCenter.slice();\n var to = endCenter.slice();\n from[cDimIdx] -= halfWidth;\n to[cDimIdx] += halfWidth;\n ends.push(from, to);\n }\n}", "title": "" }, { "docid": "8952adef8fa1107480e584d913dde389", "score": "0.49119923", "text": "computeSeries() {\n\t\tvar numSeries = this.sa.length;\n\t\tvar seriesCounter = 0;\n\t\tvar totalHeight = 0;\n\t\tvar seriesOffset = this.yo;\n\t\tvar seriesID = new Array;\n\n\t\tthis.start = this.sa[0].start;\n\t\tthis.end = this.sa[0].end;\n\n\t\t// Create an array of unique series to be rendered\n\t\twhile(seriesCounter != numSeries) {\n\t\t\tvar s = this.sa[seriesCounter];\n\n\t\t\tif(!seriesID.includes(s.n)) {\n\t\t\t\t// If the series is not already in the array, add it\n\t\t\t\ttotalHeight = totalHeight + s.sh;\n\t\t\t\tseriesID.push(s.n)\n\t\t\t} else {\n\t\t\t\t// If the series is already in the array, suppress y-axis rendering\n\t\t\t\ts.noYAxis = true;\n\t\t\t}\n\n\t\t\t// Set the x-axis to include the union of all series x-axis\n\t\t\tif(this.start > s.start) this.start = s.start;\n\t\t\tif(this.end < s.end) this.end = s.end;\n\n\t\t\tseriesCounter = seriesCounter + 1;\n\t\t}\n\n\t\t// If there are more than one series to be rendered, shrink chart height\n\t\t// to handle gaps inserted between series\n\t\tif(seriesID.length > 1)\n\t\t{\n\t\t\tthis.h = this.h - ((seriesID.length - 1) * 4);\n\t\t}\n\n\t\t// Set max/min values for overlayed charts\n\t\tvar IDCounter = 0;\n\t\twhile(IDCounter != seriesID.length) {\n\t\t\tvar seriesCounter = 0;\n\t\t\tvar maxValue = null;\n\t\t\tvar minValue = null;\n\n\t\t\twhile(seriesCounter != numSeries) {\n\t\t\t\tvar s = this.sa[seriesCounter];\n\n\t\t\t\tif(s.n == seriesID[IDCounter]) {\n\t\t\t\t\tif(maxValue == null) maxValue = s.maxValue;\n\t\t\t\t\telse if(maxValue < s.maxValue) maxValue = s.maxValue;\n\n\t\t\t\t\tif(minValue == null) minValue = s.minValue;\n\t\t\t\t\telse if(minValue > s.minValue) minValue = s.minValue;\n\t\t\t\t}\n\n\t\t\t\tseriesCounter = seriesCounter + 1;\n\t\t\t}\n\n\t\t\tseriesCounter = 0;\n\t\t\twhile(seriesCounter != numSeries) {\n\t\t\t\tvar s = this.sa[seriesCounter];\n\n\t\t\t\tif(s.n == seriesID[IDCounter]) {\n\t\t\t\t\ts.maxValue = maxValue;\n\t\t\t\t\ts.minValue = minValue;\n\t\t\t\t}\n\n\t\t\t\tseriesCounter = seriesCounter + 1;\n\t\t\t}\n\n\t\t\tIDCounter = IDCounter + 1;\n\t\t}\n\n\t\tseriesID = new Array;\n\t\tseriesCounter = 0;\n\t\twhile(seriesCounter != numSeries) {\n\t\t\tvar s = this.sa[seriesCounter];\n\n\t\t\tif(!seriesID.includes(s.n)) {\n\t\t\t\ts.h = this.h * (s.sh / totalHeight);\n\t\t\t\ts.yo = seriesOffset;\n\t\t\t\tseriesOffset = seriesOffset + s.h + 4;\n\t\t\t\tseriesID.push(s.n)\n\t\t\t} else {\n\t\t\t\tvar seriesIntCounter = 0;\n\t\t\t\twhile(this.sa[seriesIntCounter].n != s.n) {\n\t\t\t\t\tseriesIntCounter = seriesIntCounter + 1;\n\t\t\t\t}\n\t\t\t\ts.h = this.sa[seriesIntCounter].h;\n\t\t\t\ts.yo = this.sa[seriesIntCounter].yo;\n\t\t\t\tseriesIntCounter = 0;\n\t\t\t}\n\n\t\t\ts.wGridLines = Math.floor(s.w / 88) - 2;\n\t\t\ts.hGridLines = Math.floor(s.h / 15);\n\n\t\t\tif(s.style != \"heatstrip\") {\n\t\t\t\tvar divOffset = ((s.maxValue - s.minValue) / (s.hGridLines));\n\t\t\t\tif(!s.hasOwnProperty('yMax')) if(s.maxValue != 0) {\n\t\t\t\t\tif((s.maxValue - Math.floor(s.maxValue)) !== 0) {\n\t\t\t\t\t\ts.maxValue = s.maxValue + divOffset / 4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts.maxValue = s.maxValue + Math.ceil(divOffset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!s.hasOwnProperty('yMin')) if(s.minValue != 0) {\n\t\t\t\t\tif((s.minValue - Math.floor(s.minValue)) !== 0) {\n\t\t\t\t\t\ts.minValue = s.minValue - divOffset / 4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts.minValue = s.minValue - Math.ceil(divOffset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar Prefix = \"\";\n\t\t\tvar largestValue = Math.max(Math.abs(s.maxValue), Math.abs(s.minValue));\n\t\t\ts.hs = s.h / (s.maxValue - s.minValue);\n\t\t\ts.scale = 1;\n\t\t\ts.prefix = \"\";\n\n\t\t\tif(largestValue > 1 || largestValue < -1) {\n\t\t\t\tif(largestValue < 1000) { s.prefix = \"\"; s.scale = 1;}\n\t\t\t\tif(largestValue >= 1000) { s.prefix = \"k\"; s.scale = 1000;}\n\t\t\t\tif(largestValue >= 1000000) { s.prefix = \"M\"; s.scale = 1000000;}\n\t\t\t\tif(largestValue >= 1000000000) { s.prefix = \"G\"; s.scale = 1000000000;}\n\t\t\t\tif(largestValue >= 1000000000000) { s.prefix = \"T\"; s.scale = 1000000000000;}\n\t\t\t} else {\n\t\t\t\tif(largestValue <= 0.00001) { s.prefix = \"µ\"; s.scale = 0.000001;}\n\t\t\t\tif(largestValue > 0.00001) { s.prefix = \"µ\"; s.scale = 0.000001;}\n\t\t\t\tif(largestValue > 0.001) { s.prefix = \"m\"; s.scale = 0.001;}\n\t\t\t\tif(largestValue > 0.1) { s.prefix = \"\"; s.scale = 1;}\n\t\t\t}\n\n\t\t\ts.start = this.start;\n\t\t\ts.end = this.end;\n\t\t\t\n\t\t\ts.ws = s.w / (s.end - s.start);\n\n\t\t\tseriesCounter = seriesCounter + 1;\n\t\t}\n\t}", "title": "" }, { "docid": "90df1e8f4a16ec9231b66f43a2447585", "score": "0.4899122", "text": "function wait_per_group_per_year(ndx) {\n var wpyDim = ndx.dimension(dc.pluck(\"Year\"));\n var wpyGroup = wpyDim.group().reduceSum(dc.pluck(\"FourAndUnder_sum\"));\n var wpyGroup2 = wpyDim.group().reduceSum(dc.pluck(\"FiveToTwelve_sum\"));\n var wpyGroup3 = wpyDim.group().reduceSum(dc.pluck(\"OverTwelve_sum\"));\n \n \n \n dc.barChart('#wait-stacked-chart')\n .width(600)\n .height(400)\n .x(d3.scale.ordinal())\n .xUnits(dc.units.ordinal)\n .xAxisLabel(\"Year\")\n .dimension(wpyDim)\n .group(wpyGroup, 'Four Hours and Under')\n .stack(wpyGroup2, 'Five To Twelve Hours')\n .stack(wpyGroup3, 'Over Twelve Hours')\n .brushOn(false)\n .transitionDuration(500)\n .elasticY(true)\n .margins({top: 20, left: 50, bottom: 50, right: 200})\n .legend(dc.legend().x(420).y(170).itemHeight(15).gap(5))\n .yAxisLabel(\"Total Combined Wait in Hours\");\n}", "title": "" }, { "docid": "cbc77abf1362a857daa2cef48275c1e5", "score": "0.486608", "text": "function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = crossfilter_capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = crossfilter_null,\n reset = crossfilter_null,\n resetNeeded = true,\n groupAll = key === crossfilter_null,\n n0old;\n\n if (arguments.length < 1) key = crossfilter_identity;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n\n if(iterable) {\n n0old = n0;\n n0 = values.length - newValues.length;\n n1 = newValues.length;\n }\n\n var oldGroups = groups,\n reIndex = iterable ? [] : crossfilter_index(k, groupCapacity),\n add = reduceAdd,\n remove = reduceRemove,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = crossfilter_null;\n if (resetNeeded) remove = initial = crossfilter_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n if(iterable){\n groupIndex = k0 ? groupIndex : [];\n }\n else{\n groupIndex = k0 > 1 ? xfilterArray.arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n }\n\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n g0 = oldGroups[++i0];\n if (g0) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n\n while (x1 <= x) {\n j = newIndex[i1] + (iterable ? n0old : n0);\n\n\n if(iterable){\n if(groupIndex[j]){\n groupIndex[j].push(k);\n }\n else{\n groupIndex[j] = [k];\n }\n }\n else{\n groupIndex[j] = k;\n }\n\n // Always add new values to groups. Only remove when not in filter.\n // This gives groups full information on data life-cycle.\n g.value = add(g.value, data[j], true);\n if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater th1an all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n\n // Fill in gaps with empty arrays where there may have been rows with empty iterables\n if(iterable){\n for (var index1 = 0; index1 < n; index1++) {\n if(!groupIndex[index1]){\n groupIndex[index1] = [];\n }\n }\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if(k > i0){\n if(iterable){\n for (i0 = 0; i0 < n0old; ++i0) {\n for (index1 = 0; index1 < groupIndex[i0].length; index1++) {\n groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];\n }\n }\n }\n else{\n for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n }\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1 || iterable) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = crossfilter_null;\n reset = crossfilter_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if(iterable){\n k++;\n return\n }\n if (++k === groupCapacity) {\n reIndex = xfilterArray.arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = xfilterArray.arrayWiden(groupIndex, groupWidth);\n groupCapacity = crossfilter_capacity(groupWidth);\n }\n }\n }\n\n function removeData(reIndex) {\n if (k > 1 || iterable) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = crossfilter_index(oldK, oldK),\n i,\n i0,\n j;\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n if (!iterable) {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n } else {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n groupIndex[j] = groupIndex[i];\n for (i0 = 0; i0 < groupIndex[j].length; i0++) {\n seenGroups[groupIndex[j][i0]] = 1;\n }\n ++j;\n }\n }\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1 || iterable) {\n // Reindex the group index using seenGroups to find the new index.\n if (!iterable) {\n for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n for (i = 0; i < j; ++i) {\n for (i0 = 0; i0 < groupIndex[i].length; ++i0) {\n groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];\n }\n }\n }\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = crossfilter_null;\n } else if (k === 1) {\n if (groupAll) return;\n for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = crossfilter_null;\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateMany(filterOne, filterOffset, added, removed, notFilter) {\n\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n j,\n k,\n n,\n g;\n\n if(iterable){\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceAdd(g.value, data[k], false, j);\n }\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceRemove(g.value, data[k], notFilter, j);\n }\n }\n }\n return;\n }\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateOne(filterOne, filterOffset, added, removed, notFilter) {\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n j,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n if(iterable){\n for (i = 0; i < n; ++i) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceAdd(g.value, data[i], true, j);\n }\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceRemove(g.value, data[i], false, j);\n }\n }\n }\n return;\n }\n\n for (i = 0; i < n; ++i) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i], true);\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n for (i = 0; i < n; ++i) {\n g.value = reduceAdd(g.value, data[i], true);\n }\n\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, crossfilter_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), crossfilter_zero);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = xfilterHeapselect.by(valueOf);\n heap = xfilterHeap.by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(crossfilter_identity);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n i = dimensionGroups.indexOf(group);\n if (i >= 0) dimensionGroups.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }", "title": "" }, { "docid": "79913234c21b16859cfe23f5022fc77d", "score": "0.48621818", "text": "function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = crossfilter_capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = crossfilter_null,\n reset = crossfilter_null,\n resetNeeded = true,\n groupAll = key === crossfilter_null,\n n0old;\n\n if (arguments.length < 1) key = crossfilter_identity;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n\n if(iterable) {\n n0old = n0\n n0 = values.length - newValues.length\n n1 = newValues.length;\n }\n\n var oldGroups = groups,\n reIndex = iterable ? [] : crossfilter_index(k, groupCapacity),\n add = reduceAdd,\n remove = reduceRemove,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = crossfilter_null;\n if (resetNeeded) remove = initial = crossfilter_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n if(iterable){\n groupIndex = k0 ? groupIndex : [];\n }\n else{\n groupIndex = k0 > 1 ? xfilterArray.arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n }\n\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n g0 = oldGroups[++i0];\n if (g0) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n\n while (x1 <= x) {\n j = newIndex[i1] + (iterable ? n0old : n0)\n\n\n if(iterable){\n if(groupIndex[j]){\n groupIndex[j].push(k)\n }\n else{\n groupIndex[j] = [k]\n }\n }\n else{\n groupIndex[j] = k;\n }\n\n // Always add new values to groups. Only remove when not in filter.\n // This gives groups full information on data life-cycle.\n g.value = add(g.value, data[j], true);\n if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater th1an all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n\n // Fill in gaps with empty arrays where there may have been rows with empty iterables\n if(iterable){\n for (var index1 = 0; index1 < n; index1++) {\n if(!groupIndex[index1]){\n groupIndex[index1] = [];\n }\n }\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if(k > i0){\n if(iterable){\n for (i0 = 0; i0 < n0old; ++i0) {\n for (index1 = 0; index1 < groupIndex[i0].length; index1++) {\n groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];\n }\n }\n }\n else{\n for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n }\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1 || iterable) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = crossfilter_null;\n reset = crossfilter_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if(iterable){\n k++\n return\n }\n if (++k === groupCapacity) {\n reIndex = xfilterArray.arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = xfilterArray.arrayWiden(groupIndex, groupWidth);\n groupCapacity = crossfilter_capacity(groupWidth);\n }\n }\n }\n\n function removeData(reIndex) {\n if (k > 1 || iterable) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = crossfilter_index(oldK, oldK),\n i,\n i0,\n j;\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n if (!iterable) {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n } else {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n groupIndex[j] = groupIndex[i];\n for (i0 = 0; i0 < groupIndex[j].length; i0++) {\n seenGroups[groupIndex[j][i0]] = 1;\n }\n ++j;\n }\n }\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1 || iterable) {\n // Reindex the group index using seenGroups to find the new index.\n if (!iterable) {\n for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n for (i = 0; i < j; ++i) {\n for (i0 = 0; i0 < groupIndex[i].length; ++i0) {\n groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];\n }\n }\n }\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = crossfilter_null;\n } else if (k === 1) {\n if (groupAll) return;\n for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = crossfilter_null;\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateMany(filterOne, filterOffset, added, removed, notFilter) {\n\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n j,\n k,\n n,\n g;\n\n if(iterable){\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceAdd(g.value, data[k], false, j);\n }\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceRemove(g.value, data[k], notFilter, j);\n }\n }\n }\n return;\n }\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateOne(filterOne, filterOffset, added, removed, notFilter) {\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n j,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n if(iterable){\n for (i = 0; i < n; ++i) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceAdd(g.value, data[i], true, j);\n }\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceRemove(g.value, data[i], false, j);\n }\n }\n }\n return;\n }\n\n for (i = 0; i < n; ++i) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i], true);\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n for (i = 0; i < n; ++i) {\n g.value = reduceAdd(g.value, data[i], true);\n }\n\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, crossfilter_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), crossfilter_zero);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = xfilterHeapselect.by(valueOf);\n heap = xfilterHeap.by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(crossfilter_identity);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n i = dimensionGroups.indexOf(group);\n if (i >= 0) dimensionGroups.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }", "title": "" }, { "docid": "b04dc568fb861ec21cb2ce1a752bf38d", "score": "0.48570183", "text": "initAxisY(){\n this.yAxisGroup = this.chartGroup.append(\"g\");\n }", "title": "" }, { "docid": "1c2930265f2a498312ce99e771122e3a", "score": "0.4854893", "text": "assembleGroup(signals = []) {\n const group = {};\n signals = signals.concat(this.assembleSignals());\n if (signals.length > 0) {\n group.signals = signals;\n }\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || model_isFacetModel(this.parent) ? assemble_assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n return group;\n }", "title": "" }, { "docid": "7b462cd11287cbe8a0ecdc2f4eec64ea", "score": "0.48527542", "text": "make_x_axis() {\n\t\tlet start_at, height, text_start_at, label_class = '';\n\t\tif(this.x_axis_mode === 'span') {\t\t// long spanning lines\n\t\t\tstart_at = -7;\n\t\t\theight = this.height + 15;\n\t\t\ttext_start_at = this.height + 25;\n\t\t} else if(this.x_axis_mode === 'tick'){\t// short label lines\n\t\t\tstart_at = this.height;\n\t\t\theight = 6;\n\t\t\ttext_start_at = 9;\n\t\t\tlabel_class = 'x-axis-label';\n\t\t}\n\n\t\tthis.x_axis_group.attr({\n\t\t\ttransform: `translate(0,${start_at})`\n\t\t});\n\t\tthis.x.values.map((point, i) => {\n\t\t\tthis.x_axis_group.add(this.snap.g(\n\t\t\t\tthis.snap.line(0, 0, 0, height),\n\t\t\t\tthis.snap.text(0, text_start_at, point).attr({\n\t\t\t\t\tdy: \".71em\",\n\t\t\t\t\tclass: \"x-value-text\"\n\t\t\t\t})\n\t\t\t).attr({\n\t\t\t\tclass: `tick ${label_class}`,\n\t\t\t\ttransform: `translate(${ this.x_axis_values[i] }, 0)`\n\t\t\t}));\n\t\t});\n\t}", "title": "" }, { "docid": "90373db741a36c3aae13203bb2142c10", "score": "0.48399135", "text": "function populateGroupBySegmentChartData() {\n\t\t$scope.segmentChartConfig.series = [];\n\t\t$scope.segmentChartConfig.xAxis.categories = $scope.eventsData['categories'];\n\t\tvar series = {name: $scope.selectedEventName, data:$scope.eventsData['series'], color: '#1F77B4'};\n\t\t$scope.segmentChartConfig.series.push(series);\t\n\t\t$scope.segmentChartConfig.options.chart.type = 'column';\n\t\t$scope.segmentChartConfig.options.legend.enabled = false;\n\t\t$scope.segmentChartConfig.options.tooltip = {headerFormat:'', pointFormat:'{point.y} Users'};\n\t}", "title": "" }, { "docid": "4687463c2a5e7856ab78cad061192369", "score": "0.48272428", "text": "function doShiftChartElements (series) {\n angular.forEach(series, function (trend) {\n var graph = trend.graph;\n var area;// = trend.area;\n var currentShift = (graph && graph.shift) || 0;\n\n Highcharts.each([graph, area, trend.graphNeg, trend.areaNeg], function (shape) {\n if (shape) {\n shape.shift = currentShift + 1;\n }\n });\n });\n }", "title": "" }, { "docid": "14f38ae06e827bebf7a6a4d16ca85c70", "score": "0.48263645", "text": "function runGroupingStep() {\n var groupColors = [\"#1abc9c\", \"#3498db\", \"#9b59b6\", \"#2ecc71\",\n \"#f1c40f\", \"#e67e22\", \"#e74c3c\",\n \"#16a085\", \"#27ae60\", \"#2980b9\", \"#8e44ad\",\n \"#f39c12\", \"#d35400\",\"#c0392b\"];\n\n toggleAnimating();\n var currentGroup = [];\n config.points.forEach(function(point) {\n // Erase old, ungrouped point\n graphics.setTransition(0);\n if (currentGroup.length == config.m - 1)\n graphics.setDelay(40);\n else\n graphics.setDelay(0);\n graphics.erasePoint(point);\n\n // Get the group color\n var groupID = config.groups.length;\n var pointColor = groupColors[groupID % groupColors.length];\n graphics.setColor(pointColor);\n\n // Add the new, grouped point\n graphics.setDelay(0);\n graphics.setTransition(0);\n var x = point.getX();\n var y = point.getY();\n var coloredPoint = graphics.drawPoint(x, y);\n currentGroup.push(coloredPoint);\n\n // Change groups when group is filled\n if (currentGroup.length == config.m) {\n config.groups.push(currentGroup);\n currentGroup = [];\n }\n }, currentGroup);\n if (currentGroup.length != 0)\n config.groups.push(currentGroup);\n graphics.whenDone(toggleAnimating);\n }", "title": "" }, { "docid": "7bb1de9addf4732991be46b6871ced08", "score": "0.48192382", "text": "function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = cr_null,\n reset = cr_null,\n resetNeeded = true,\n groupAll = key === cr_null,\n n0old;\n\n if (arguments.length < 1) key = cr_identity;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n\n if(iterable) {\n n0old = n0;\n n0 = values.length - newValues.length;\n n1 = newValues.length;\n }\n\n var oldGroups = groups,\n reIndex = iterable ? [] : cr_index(k, groupCapacity),\n add = reduceAdd,\n remove = reduceRemove,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = cr_null;\n if (resetNeeded) remove = initial = cr_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n if(iterable){\n groupIndex = k0 ? groupIndex : [];\n }\n else{\n groupIndex = k0 > 1 ? xfilterArray.arrayLengthen(groupIndex, n) : cr_index(n, groupCapacity);\n }\n\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n g0 = oldGroups[++i0];\n if (g0) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n\n while (x1 <= x) {\n j = newIndex[i1] + (iterable ? n0old : n0);\n\n\n if(iterable){\n if(groupIndex[j]){\n groupIndex[j].push(k);\n }\n else{\n groupIndex[j] = [k];\n }\n }\n else{\n groupIndex[j] = k;\n }\n\n // Always add new values to groups. Only remove when not in filter.\n // This gives groups full information on data life-cycle.\n g.value = add(g.value, data[j], true);\n if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater th1an all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n\n // Fill in gaps with empty arrays where there may have been rows with empty iterables\n if(iterable){\n for (var index1 = 0; index1 < n; index1++) {\n if(!groupIndex[index1]){\n groupIndex[index1] = [];\n }\n }\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if(k > i0){\n if(iterable){\n for (i0 = 0; i0 < n0old; ++i0) {\n for (index1 = 0; index1 < groupIndex[i0].length; index1++) {\n groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];\n }\n }\n }\n else{\n for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n }\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1 || iterable) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = cr_null;\n reset = cr_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if(iterable){\n k++;\n return\n }\n if (++k === groupCapacity) {\n reIndex = xfilterArray.arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = xfilterArray.arrayWiden(groupIndex, groupWidth);\n groupCapacity = capacity(groupWidth);\n }\n }\n }\n\n function removeData(reIndex) {\n if (k > 1 || iterable) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = cr_index(oldK, oldK),\n i,\n i0,\n j;\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n if (!iterable) {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n } else {\n for (i = 0, j = 0; i < n; ++i) {\n if (reIndex[i] !== REMOVED_INDEX) {\n groupIndex[j] = groupIndex[i];\n for (i0 = 0; i0 < groupIndex[j].length; i0++) {\n seenGroups[groupIndex[j][i0]] = 1;\n }\n ++j;\n }\n }\n groupIndex = groupIndex.slice(0, j);\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1 || iterable) {\n // Reindex the group index using seenGroups to find the new index.\n if (!iterable) {\n for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n for (i = 0; i < j; ++i) {\n for (i0 = 0; i0 < groupIndex[i].length; ++i0) {\n groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];\n }\n }\n }\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = cr_null;\n } else if (k === 1) {\n if (groupAll) return;\n for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = cr_null;\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateMany(filterOne, filterOffset, added, removed, notFilter) {\n\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n j,\n k,\n n,\n g;\n\n if(iterable){\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceAdd(g.value, data[k], false, j);\n }\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n for (j = 0; j < groupIndex[k].length; j++) {\n g = groups[groupIndex[k][j]];\n g.value = reduceRemove(g.value, data[k], notFilter, j);\n }\n }\n }\n return;\n }\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n // notFilter indicates a crossfilter.add/remove operation.\n function updateOne(filterOne, filterOffset, added, removed, notFilter) {\n if ((filterOne === one && filterOffset === offset) || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (filters.zeroExcept(k = added[i], offset, zero)) {\n g.value = reduceAdd(g.value, data[k], false);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {\n g.value = reduceRemove(g.value, data[k], notFilter);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n j,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n if(iterable){\n for (i = 0; i < n; ++i) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceAdd(g.value, data[i], true, j);\n }\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n for (j = 0; j < groupIndex[i].length; j++) {\n g = groups[groupIndex[i][j]];\n g.value = reduceRemove(g.value, data[i], false, j);\n }\n }\n }\n return;\n }\n\n for (i = 0; i < n; ++i) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i], true);\n }\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // We add all records and then remove filtered records so that reducers\n // can build an 'unfiltered' view even if there are already filters in\n // place on other dimensions.\n for (i = 0; i < n; ++i) {\n g.value = reduceAdd(g.value, data[i], true);\n }\n\n for (i = 0; i < n; ++i) {\n if (!filters.zeroExcept(i, offset, zero)) {\n g.value = reduceRemove(g.value, data[i], false);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, cr_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), cr_zero);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = h$1.by(valueOf);\n heap = h.by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(cr_identity);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n i = dimensionGroups.indexOf(group);\n if (i >= 0) dimensionGroups.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }", "title": "" }, { "docid": "ecdc129eed841c3cec1efb8959e0c433", "score": "0.4817595", "text": "function split_chart(dataSet, space) {\r\n // map data for the first series, take x from the zero column and value from the first column of data set\r\n var seriesData_1 = dataSet.mapAs({ 'x': 0, 'value': 1 });\r\n\r\n // map data for the second series, take x from the zero column and value from the second column of data set\r\n var seriesData_2 = dataSet.mapAs({ 'x': 0, 'value': 2 });\r\n\r\n // map data for the third series, take x from the zero column and value from the third column of data set\r\n var seriesData_3 = dataSet.mapAs({ 'x': 0, 'value': 3 });\r\n\r\n // create bar chart\r\n var chart = anychart.column();\r\n\r\n // turn on chart animation\r\n chart.animation(true);\r\n\r\n // set container id for the chart\r\n chart.container(space);\r\n chart.padding([10, 40, 5, 20]);\r\n\r\n // set scale minimum\r\n chart.yScale().minimum(0);\r\n\r\n // force chart to stack values by Y scale.\r\n chart.yScale().stackMode('value');\r\n\r\n chart.yAxis().labels().format(function () {\r\n return this.value.toLocaleString();\r\n });\r\n\r\n // helper function to setup label settings for all series\r\n var setupSeriesLabels = function (series, name) {\r\n series.name(name);\r\n series.stroke('3 #fff 1');\r\n series.hovered().stroke('3 #fff 1');\r\n };\r\n\r\n // temp variable to store series instance\r\n var series;\r\n\r\n // create first series with mapped data\r\n series = chart.column(seriesData_1);\r\n setupSeriesLabels(series, 'Positive');\r\n series.normal().fill(positive_color, 0.8);\r\n\r\n // create second series with mapped data\r\n series = chart.column(seriesData_2);\r\n setupSeriesLabels(series, 'Neutral');\r\n series.normal().fill(neutral_color, 0.8);\r\n\r\n // create third series with mapped data\r\n series = chart.column(seriesData_3);\r\n setupSeriesLabels(series, 'Negative');\r\n series.normal().fill(negative_color, 0.8);\r\n\r\n\r\n // turn on legend\r\n chart.legend().enabled(true).fontSize(13).padding([0, 0, 20, 0]);\r\n chart.interactivity().hoverMode('by-x');\r\n chart.tooltip().displayMode('union');\r\n // initiate chart drawing\r\n chart.draw();\r\n}", "title": "" }, { "docid": "dc33bf1347f1d5b7e2b2dbb22a2516f6", "score": "0.48175213", "text": "function axis () {\n\n var axis = axis$1(),\n baseline = d3.functor(0),\n decorate = noop,\n xScale = d3.time.scale(),\n yScale = d3.scale.linear();\n\n var dataJoin$$ = dataJoin().selector('g.axis-adapter').element('g').attr({ 'class': 'axis axis-adapter' });\n\n var axisAdapter = function axisAdapter(selection) {\n\n selection.each(function (data, index) {\n\n var g = dataJoin$$(this, [data]);\n\n var translation;\n switch (axisAdapter.orient()) {\n case 'top':\n case 'bottom':\n translation = 'translate(0,' + yScale(baseline(data)) + ')';\n axis.scale(xScale);\n break;\n\n case 'left':\n case 'right':\n translation = 'translate(' + xScale(baseline(data)) + ',0)';\n axis.scale(yScale);\n break;\n\n default:\n throw new Error('Invalid orientation');\n }\n\n g.enter().attr('transform', translation);\n g.attr('transform', translation);\n\n g.call(axis);\n\n decorate(g, data, index);\n });\n };\n\n axisAdapter.baseline = function (x) {\n if (!arguments.length) {\n return baseline;\n }\n baseline = d3.functor(x);\n return axisAdapter;\n };\n axisAdapter.decorate = function (x) {\n if (!arguments.length) {\n return decorate;\n }\n decorate = x;\n return axisAdapter;\n };\n axisAdapter.xScale = function (x) {\n if (!arguments.length) {\n return xScale;\n }\n xScale = x;\n return axisAdapter;\n };\n axisAdapter.yScale = function (x) {\n if (!arguments.length) {\n return yScale;\n }\n yScale = x;\n return axisAdapter;\n };\n\n return d3.rebind(axisAdapter, axis, 'orient', 'ticks', 'tickValues', 'tickSize', 'innerTickSize', 'outerTickSize', 'tickPadding', 'tickFormat');\n }", "title": "" }, { "docid": "47221bc5d7edeecda413ff64fa808c84", "score": "0.48144126", "text": "canUseAsXAxis(axis) {\r\n let iv = this.i.nk(axis);\r\n return (iv);\r\n }", "title": "" }, { "docid": "cd2c6cf4457c5a54fa205aa4517553e0", "score": "0.48112413", "text": "function getSingleAxisValues(Axis,newData){\n var X =[];\n for(i=0;i<newData.length;i++)\n {\n if(Axis==\"xAxis\")\n {\n X.push(newData[i].x);\n }\n else{\n X.push(newData[i].y);\n }\n }\n return X;\n}", "title": "" }, { "docid": "5cc88aa91f9a031aa1bcbc87a8c9c5fa", "score": "0.48035926", "text": "function formatAsSeriesAndCategories(workingSeries, workingCategories, seriesName, xValue, yValue) {\n\n if (!workingCategories.hasOwnProperty(xValue)) {\n workingCategories[xValue] = xValue;\n }\n\n workingSeries[seriesName].data.push(yValue);\n }", "title": "" }, { "docid": "b7d47f0d960501a8224226b7a7bdffb4", "score": "0.480119", "text": "function layoutSingleSeries(seriesModel, offset, boxWidth) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n var halfWidth = boxWidth / 2;\n var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;\n var vDimIdx = 1 - cDimIdx;\n var coordDims = ['x', 'y'];\n var cDim = data.mapDimension(coordDims[cDimIdx]);\n var vDims = data.mapDimension(coordDims[vDimIdx], true);\n\n if (cDim == null || vDims.length < 5) {\n return;\n }\n\n for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {\n var axisDimVal = data.get(cDim, dataIndex);\n\n var median = getPoint(axisDimVal, vDims[2], dataIndex);\n var end1 = getPoint(axisDimVal, vDims[0], dataIndex);\n var end2 = getPoint(axisDimVal, vDims[1], dataIndex);\n var end4 = getPoint(axisDimVal, vDims[3], dataIndex);\n var end5 = getPoint(axisDimVal, vDims[4], dataIndex);\n\n var ends = [];\n addBodyEnd(ends, end2, 0);\n addBodyEnd(ends, end4, 1);\n\n ends.push(end1, end2, end5, end4);\n layEndLine(ends, end1);\n layEndLine(ends, end5);\n layEndLine(ends, median);\n\n data.setItemLayout(dataIndex, {\n initBaseline: median[vDimIdx],\n ends: ends\n });\n }\n\n function getPoint(axisDimVal, dimIdx, dataIndex) {\n var val = data.get(dimIdx, dataIndex);\n var p = [];\n p[cDimIdx] = axisDimVal;\n p[vDimIdx] = val;\n var point;\n if (isNaN(axisDimVal) || isNaN(val)) {\n point = [NaN, NaN];\n }\n else {\n point = coordSys.dataToPoint(p);\n point[cDimIdx] += offset;\n }\n return point;\n }\n\n function addBodyEnd(ends, point, start) {\n var point1 = point.slice();\n var point2 = point.slice();\n point1[cDimIdx] += halfWidth;\n point2[cDimIdx] -= halfWidth;\n start\n ? ends.push(point1, point2)\n : ends.push(point2, point1);\n }\n\n function layEndLine(ends, endCenter) {\n var from = endCenter.slice();\n var to = endCenter.slice();\n from[cDimIdx] -= halfWidth;\n to[cDimIdx] += halfWidth;\n ends.push(from, to);\n }\n }", "title": "" }, { "docid": "33afeab2adf9c6c96791f58d3b76e23e", "score": "0.4789534", "text": "function groupBubbles() {\n hideGroups();\n\n force.on('tick', function (e) {\n bubbles.each(moveToCenter(e.alpha))\n .attr('cx', function (d) { return d.x; })\n .attr('cy', function (d) { return d.y; });\n });\n\n force.start();\n }", "title": "" }, { "docid": "fce12d46529488b598a3847cf79d477a", "score": "0.47853053", "text": "function groupByTrack (rows, layerName) {\n var nested = d3.nest()\n .key(function (d) { return d.chr; })\n .entries(rows);\n return nested.map(function (d) {\n return { key: d.key, values: [{ layer: layerName, values: d.values }]};\n });\n }", "title": "" }, { "docid": "05b1d81c58c2a91eff4f67d533370c00", "score": "0.47768968", "text": "function hidexAxis() {\n g.select('.x.axis')\n .transition().duration(500)\n .style('opacity', 0);\n }", "title": "" }, { "docid": "47aa561a3b69b0e424ce9d5a46ea44e4", "score": "0.47754544", "text": "function x(d) { return d['x-axis']; }", "title": "" }, { "docid": "880305a22a5a13d680fe5c4a1194073e", "score": "0.47726536", "text": "function AxisGroupLayout() {\r\n go.Layout.call(this);\r\n // go.GridLayout.call(this);\r\n // this.cellSize = new go.Size(1, 1);\r\n // this.wrappingColumn = Infinity;\r\n // this.wrappingWidth = Infinity;\r\n // this.spacing = new go.Size(0, 0);\r\n // this.alignment = go.GridLayout.Position;\r\n }", "title": "" }, { "docid": "f6bd1e68f73594c2819bdb762cebb6fc", "score": "0.4769515", "text": "function group(entries, sortmode) {\n var days = groupByDay(entries); // Group by day\n\n // Within each day, group by sortmode\n for (var i = 0; i < days.length; i++) {\n days[i].groups = _.sortBy(days[i].groups, 'title'); // Sort inner groups by title\n days[i].groups = groupBySortmode(days[i].groups, sortmode);\n }\n\n return days;\n }", "title": "" }, { "docid": "01661a5e54da4a6cd5eec606698a92b3", "score": "0.47678995", "text": "groupBy(xs, key) {\n return xs.reduce(function(rv, x) {\n (rv[x[key]] = rv[x[key]] || []).push(x);\n return rv;\n }, {});\n }", "title": "" }, { "docid": "5a910fcd1c4538ad800af193240d096a", "score": "0.47665808", "text": "function groupByDay(entries) {\n return sortAndGroup(entries, 'startDate', function(startDate) {\n return startDate.toDateString();\n }, 'groups');\n }", "title": "" }, { "docid": "c83d118a4153b88ec4a7e2b7fe578292", "score": "0.47543502", "text": "clearAxis() {\n d3.select(`#${this.chartData.selector}`)\n .selectAll('.axis')\n .remove();\n }", "title": "" } ]
8c3d58190880a905532673bc72336775
The purpose of the componentWillMount method is to perform all programming tasks that need to take place before the component is rendered on the screen. In this case it is load all a users routes
[ { "docid": "8edaf1decdc4e3c322c2397883829315", "score": "0.74079496", "text": "componentWillMount() {\n this.props.store.getRoutes(this.props.token);\n }", "title": "" } ]
[ { "docid": "70f46fd0ae932130183da879a1b9c1fa", "score": "0.74844474", "text": "componentWillMount () {\n // load all of the user's data\n this.getUserEntries();\n }", "title": "" }, { "docid": "88254719db020c3176811d46b90908c8", "score": "0.7377115", "text": "async componentWillMount() {\n await this.loadUser();\n }", "title": "" }, { "docid": "06ce96b2f116e65abecf7f4f00428a9f", "score": "0.73459995", "text": "componentDidMount() {\n this.loadUsers()\n }", "title": "" }, { "docid": "5fb230aeb03937c53d8b2a311dbfe76f", "score": "0.730032", "text": "componentDidMount() {\n\t\t// populates user base of app\n\t\tthis.props.getUsers();\n\t}", "title": "" }, { "docid": "510d351fc85bd66d26795717ed9926f8", "score": "0.72801894", "text": "componentWillMount() {\n this.loadJoinedUsers();\n }", "title": "" }, { "docid": "df73eaabd3e1f259bee35cd0d3929554", "score": "0.72495544", "text": "componentDidMount() {\n //calls getUsers method when component is first mounted\n this.getUsers();\n }", "title": "" }, { "docid": "eadd75b2a8bc2f483ef3a40607de1c80", "score": "0.7134923", "text": "componentDidMount() {\n\t\tthis.getUsers();\n\t}", "title": "" }, { "docid": "21636255cc9127bbe6bfd5868f26ebcb", "score": "0.71268487", "text": "componentDidMount() {\n this.loadFarmers();\n this.loadUser();\n }", "title": "" }, { "docid": "f68b0bda1bf1aee636f46c94c5e80876", "score": "0.7014405", "text": "async componentDidMount(){ //una vez q el componente es montado procede a renderizar\n this.getUsers();\n }", "title": "" }, { "docid": "e69b46012361360704c6d833cb02569a", "score": "0.6985441", "text": "componentDidMount() {\n // this.routeStore1.getProfile(this.props.token, this.props.userId);\n\n this.routeStore1.getRoute(this.props.token, this.props.uRouteId);\n this.routeStore2.getRoute(this.props.token, this.props.routeId);\n\n }", "title": "" }, { "docid": "d065a6f398440b9398409028f1b1dd18", "score": "0.69782484", "text": "componentWillMount() {\n\t\tthis.usersDataGetRequest();\n\t}", "title": "" }, { "docid": "1e180bca481dadbd5b6fedc48e15581b", "score": "0.6934014", "text": "componentWillMount() {\n this.fetchBookmarks()\n this.fetchUsers()\n }", "title": "" }, { "docid": "17df326ecbd55b33e2c745d4813da8bd", "score": "0.69328016", "text": "componentDidMount() {\n this.getUsers();\n }", "title": "" }, { "docid": "fc2a24c8d2485fcb9d2d3a0377f4ba45", "score": "0.6910041", "text": "componentDidMount(){\r\n this.getUsers();\r\n console.log(\"Mount\", this.state);\r\n }", "title": "" }, { "docid": "25341e6902146619a5cf4b23218b0ff5", "score": "0.689602", "text": "componentDidMount(){\n this.getAllUsers()\n }", "title": "" }, { "docid": "00d04035c334db587ad3b68a53a89473", "score": "0.68913966", "text": "componentDidMount() {\n this.getUsers();\n }", "title": "" }, { "docid": "6549b27767acd161ce58db70607b2c0a", "score": "0.6853893", "text": "componentDidMount(){\n if(this.props.auth.isAuthenticated) {\n this.props.getUsers();\n this.setState({user: this.props.auth.user});\n } else {\n this.props.history.push(\"/\");\n }\n }", "title": "" }, { "docid": "139cef8cc1e5b744ef21517ac2544dff", "score": "0.68538404", "text": "componentWillMount() {\n this.props.fetchUsers()\n this.props.fetchProjects()\n this.props.fetchRoles()\n }", "title": "" }, { "docid": "5605203058933d6c068426cb32a84dab", "score": "0.6840377", "text": "async componentDidMount() {\n // let scenes actively listen to new received notif\n this.listener = Notifications.addListener(this.listen);\n // load all the required user data if user is logged-in\n if (this.props.auth.isAuthenticated) {\n // retrieve and setup data\n this.setupUserAppData();\n }\n }", "title": "" }, { "docid": "b61007db99d54cbbe1df604cb967e2ae", "score": "0.68264633", "text": "componentWillMount(){\n \tthis.renderDefaultUser();\n }", "title": "" }, { "docid": "864601562ca7b30c5479668f4ac1d23c", "score": "0.6815572", "text": "componentDidMount() {\n this.props.getAllFolders(this.props.auth.user.id);\n }", "title": "" }, { "docid": "44eb3dd40be96740437fc4ed3d4ce700", "score": "0.68030983", "text": "componentDidMount() {\n this.props.getUsers();\n }", "title": "" }, { "docid": "755023ead2f8d50abc60fed7206d661c", "score": "0.67913294", "text": "componentDidMount() {\n\t\tthis.fetchUser();\n\t}", "title": "" }, { "docid": "ba84b5e1ffb080e369b94c3e5c30e0ca", "score": "0.67814875", "text": "componentDidMount(){\n this.loadLocations();\n }", "title": "" }, { "docid": "466d277997020f2348ec4c938cd8bca0", "score": "0.67608863", "text": "componentDidMount() {\n this.props.fetchUsers();\n }", "title": "" }, { "docid": "4b81dab22e8a6d64aa937c599554d235", "score": "0.67548627", "text": "componentWillMount() {\n this.props.dispatch(UserActions.fetchUsers())\n }", "title": "" }, { "docid": "d920f8243c6e6416e316f87cdbfbb046", "score": "0.6744272", "text": "componentWillMount() {\n this.addEvents();\n this.startConn();\n this.loadMap();\n }", "title": "" }, { "docid": "ca320f771402f7fe3b4c8fe308587dbe", "score": "0.6743616", "text": "componentDidMount() {\n this.bindRouteLinks();\n }", "title": "" }, { "docid": "82be61c4cfb7e9392f932466e97807c0", "score": "0.6741527", "text": "componentDidMount() {\n usersActions.getUsers();\n }", "title": "" }, { "docid": "3a14a6e68a9aa4fc77efc777413b9b63", "score": "0.67352134", "text": "componentWillMount(){\n this.props.clearErrorMessage(this.state.randomFloat);\n this.props.startTaskProjectsLoading();\n this.props.startStatusesLoading();\n this.props.startCompaniesLoading();\n this.props.startTaskAttributesLoading();\n this.props.startTagsLoading();\n this.props.startUnitsLoading();\n this.props.startUsersLoading();\n this.props.deleteTaskSolvers();\n this.props.getTaskStatuses(this.props.statusesUpdateDate,this.props.token);\n this.props.getTaskProjects(this.props.token);\n this.props.getTaskCompanies(this.props.companiesUpdateDate,this.props.token);\n this.props.getTaskAttributes(this.props.token);\n this.props.getTags(this.props.token);\n this.props.getUnits(this.props.token);\n this.props.getUsers(\"\",this.props.token);\n\n this.props.setFilterPage(this.props.match.params?this.props.match.params.page:1);\n }", "title": "" }, { "docid": "cefcbe2d08523cb6b25e5c0c8a4aac86", "score": "0.67216456", "text": "async componentWillMount() {\n await this.GetAll();\n }", "title": "" }, { "docid": "d5c42aef555c7062ecace5e882d38378", "score": "0.6711714", "text": "componentDidMount() {\n //this.props.fetchUsers();\n }", "title": "" }, { "docid": "051ecd20f5aa5ac4cae831578f0a3543", "score": "0.67080677", "text": "componentDidMount() {\n this.setupSocketListeners();\n this.fetchUsers();\n }", "title": "" }, { "docid": "1c6d1ace524b22d6c9a1ad6417145677", "score": "0.6696493", "text": "componentWillMount() {\n const falcorPathSets = this.constructor.getFalcorPathSets(this.props.params);\n if (!isAppReady() || pathSetsInCache(this.props.model.getCache(), falcorPathSets)) {\n this.loadFalcorCache(falcorPathSets)\n } else {\n this.falcorFetch(falcorPathSets)\n }\n }", "title": "" }, { "docid": "a2171d5ce26c8ba8508c0f7781be6d9c", "score": "0.66869444", "text": "componentDidMount() {\n\t\tthis.getLocations();\n\t}", "title": "" }, { "docid": "6114c0707903a1574aa0d16e1630645a", "score": "0.66766644", "text": "componentDidMount() {\n fetch_users(this.props.dispatch.bind(this), this.props.auth.token);\n\t}", "title": "" }, { "docid": "b22caaacb65eac0126e4bdd203f17469", "score": "0.6669385", "text": "componentDidMount(){\n\t\tconst basicString = this.props.userCredentials.email + ':' + this.props.userCredentials.password;\n\t\tthis.getAllProfilesFromDB(basicString);\n\t\tthis.getAllInterviewersFromDB(basicString);\n\t}", "title": "" }, { "docid": "df02edd00399e5f895f0cbe155fd3868", "score": "0.6659502", "text": "componentWillMount() {\n this.loadData(`${this.props.baseUrl}/1`);\n this.loadData(`${this.props.baseUrl}/2`);\n this.loadData(`${this.props.baseUrl}/4`);\n this.loadData(`${this.props.baseUrl}/7`);\n this.loadData(`${this.props.baseUrl}/8`);\n this.loadData(`${this.props.baseUrl}/4/6`);\n this.loadData(`${this.props.baseUrl}/4/7`);\n this.loadData(`${this.props.baseUrl}/4/8`);\n this.loadData(`${this.props.baseUrl}/4/9`);\n this.loadData(`${this.props.baseUrl}/7/6`);\n this.loadData(`${this.props.baseUrl}/7/7`);\n this.loadData(`${this.props.baseUrl}/4/8`);\n this.loadData(`${this.props.baseUrl}/8/7`);\n this.loadData(`${this.props.baseUrl}/8/8`);\n this.loadData(`${this.props.baseUrl}/89/1`);\n this.loadData(`${this.props.baseUrl}/11/8`);\n this.loadData(`${this.props.baseUrl}/11/9`);\n this.loadData(`${this.props.baseUrl}/13/7`);\n this.loadData(`${this.props.baseUrl}/13/8`);\n }", "title": "" }, { "docid": "7a3f76d1b1418f9a311a179f1ba49496", "score": "0.66592276", "text": "componentDidMount() {\n this.getUsers(10);\n }", "title": "" }, { "docid": "433adb0966068acd388f270e4b612b3b", "score": "0.6638766", "text": "componentDidMount() {\n this.props.getWalkStops(this.props.walk.id);\n this.props.getRoute(this.props.walk.id);\n }", "title": "" }, { "docid": "d27aab0c07da1cb78fd95e6cbc55595c", "score": "0.66323507", "text": "componentWillMount(){\n this.props.fetchTags();\n this.props.fetchUsers();\n }", "title": "" }, { "docid": "9c0555807ec94f9c3a0061352acc7902", "score": "0.66223633", "text": "componentDidMount() {\n this.setState({userData: UserDataStore.getUserData()});\n this.loadLocationData();\n }", "title": "" }, { "docid": "b62ec326ada8ffe15f75254b808f6834", "score": "0.66155285", "text": "componentWillMount() {\n\t\tthis.checkExistence();\n\t\tthis.props.bringAuthors();\n\t\tthis.props.bringCourses();\n\t}", "title": "" }, { "docid": "607219dea81341859fdc5578a76d3e99", "score": "0.66133606", "text": "componentDidMount() {\n this.loadNews();\n this.loadJobs();\n this.loadEvents();\n }", "title": "" }, { "docid": "ea77942460b2e2ef550b1e43bf1c8844", "score": "0.6608379", "text": "componentWillMount(){\n this.load();\n }", "title": "" }, { "docid": "41fff119cb54421a24dd188fe0f6b076", "score": "0.6608343", "text": "componentWillMount() {\n this._doLoad();\n }", "title": "" }, { "docid": "860793871321dfa4e4d6925db1ce736c", "score": "0.66072536", "text": "componentWillMount() {\n this.fetchMembers();\n }", "title": "" }, { "docid": "e0fbbc096495065e1c9588f33acc4444", "score": "0.6606328", "text": "componentDidMount() {\n this.fetchPosts();\n this.fetchComments();\n this.fetchUsers();\n }", "title": "" }, { "docid": "c296c02b6a50881e6bad38afdc21c8b1", "score": "0.6580285", "text": "componentDidMount() {\n if (this.props.userId) {\n this.getUsers();\n }\n }", "title": "" }, { "docid": "1041c7a116cb38a6b02e149b5b19d5e2", "score": "0.6566965", "text": "componentDidMount () {\n\t\t//监听UserStore\n\t\tthis.unUserStoreChange = UserStore.listen(this.onUserStoreChange);\n\n\t\tInteractionManager.runAfterInteractions(() => {\n\t\t\tthis.setState({doRenderScene: true}, () => {\n\t\t\t\tthis.fetchData();\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "f0a2509ea74e85b73b6a1d423db50ec3", "score": "0.6563351", "text": "componentWillMount() {\n let pathname = this.props.location.pathname.split('/');\n let roomNum = (pathname[pathname.length-2]);\n let name = (pathname[pathname.length-1]);\n let syns = data.synonyms.map((synonym) => {\n return {word: synonym.syn, active: true};\n });\n this.setState({room: roomNum, user: name, isMounted: true, synonyms: syns});\n }", "title": "" }, { "docid": "91b3d4250e85f92f44b38efedacfc6fe", "score": "0.65633047", "text": "componentDidMount() {\n this.props.dispatch({ type: USER_ACTIONS.FETCH_USER });\n if (!this.props.user && this.props.user === '') {\n this.props.history.push('home');\n }\n this.props.dispatch(fetchStats());\n }", "title": "" }, { "docid": "cc9329ff47a4d2f3e433fd846430d0c0", "score": "0.6562695", "text": "componentWillMount(){\n\n console.log('this is componentWillMount ');\n this.getProjects();\n this.getTodos();\n }", "title": "" }, { "docid": "192cea62cec65ba8ec98356ae91d5613", "score": "0.65622133", "text": "componentWillMount(){\n this.props.clearErrorMessage(this.state.randomFloat);\n this.props.clearTask();\n this.props.startTaskProjectsLoading();\n this.props.startStatusesLoading();\n this.props.startCompaniesLoading();\n this.props.startTaskAttributesLoading();\n this.props.startTagsLoading();\n this.props.startUnitsLoading();\n this.props.startUsersLoading();\n this.props.deleteTaskSolvers();\n\n this.props.setActiveRequests(7);\n this.props.getTaskStatuses(this.props.statusesUpdateDate,this.props.token);\n this.props.getTaskProjects(this.props.token);\n this.props.getTaskCompanies(this.props.companiesUpdateDate,this.props.token);\n this.props.getTaskAttributes(this.props.token);\n this.props.getTags(this.props.token);\n this.props.getTaskUnits(this.props.token);\n this.props.getUsers(\"\",this.props.token);\n }", "title": "" }, { "docid": "9cfb288a15861c5bd592113196b0619e", "score": "0.6557448", "text": "componentWillMount() {\n // check if data and load if there is none\n // really just an extra check\n if (this.props.cryptoPuzzles == []) {\n this.props.loadCryptographyPuzzles();\n }\n if (this.props.cyberPuzzles == []) {\n this.props.loadCyberSecurityPuzzles();\n }\n if (this.props.loadLogicPuzzles == []) {\n this.props.loadLogicPuzzles();\n }\n // only check and load if the user is an admin (data is already loaded when loggedIn)\n if (this.props.newPuzzles == [] && this.props.user.admin) {\n this.props.loadNewPuzzles();\n }\n // handle android back button press\n // should exit the app\n BackHandler.addEventListener('hardwareBackPress', () => {\n return false;\n });\n }", "title": "" }, { "docid": "6f5619a9739054ec4581ba9ee378630c", "score": "0.6555575", "text": "componentWillMount() {\r\n this.fetchAlbumlists();\r\n }", "title": "" }, { "docid": "6953eff6b292401132991613d363592f", "score": "0.65439296", "text": "componentDidMount() {\n this.fetchUser();\n }", "title": "" }, { "docid": "b53a6b11a7319bf40a128e1cbb04fe07", "score": "0.65434873", "text": "componentDidMount() {\n document.title = \"Users\";\n this.getUsers();\n }", "title": "" }, { "docid": "95125de55cddb5f06cbeb677624b151f", "score": "0.65432703", "text": "componentDidMount(){\n this.getUsers();\n this.getStatus();\n this.getToDos();\n }", "title": "" }, { "docid": "82bc78e33a9aff672137ad6c5c4d0221", "score": "0.6535287", "text": "componentDidMount() {\n this.loadMyGroups();\n }", "title": "" }, { "docid": "adbeab339ddaefbcc26eb4c902206352", "score": "0.6533938", "text": "componentWillMount() {\n this.loadDatas();\n }", "title": "" }, { "docid": "341edec33750540db9c4a3114f2bee18", "score": "0.6524215", "text": "async componentDidMount () {\n try {\n const configs = await session.getConfigs();\n if (await this.isUserLoggedIn()) {\n const [groups, neighborhoods] = await Promise.all([\n airtable.listCommunityGroups(),\n airtable.listNeighborhoods()\n ]);\n this.setState({ loading: false, loggedIn: true, groups, neighborhoods, configs });\n } else {\n this.setState({ loading: false, loggedIn: false, configs });\n }\n } catch (err) {\n this.setState({ error: err, loading: false });\n }\n }", "title": "" }, { "docid": "74b84b45f7f299fc6e35c73dc2fd94c7", "score": "0.65109277", "text": "componentDidMount() {\n\t\tthis.getUserData(); // get current data for user\n\t\tthis.reloadPosts(this.state.posturl); // load posts\n\t}", "title": "" }, { "docid": "ef56806ea0bc307c6e38df905804bf1e", "score": "0.65015906", "text": "componentWillMount(){}", "title": "" }, { "docid": "6edee13aeeda3b4121a0bc144982ed22", "score": "0.6490333", "text": "componentDidMount() {\n\n this.loadCurrentUser();\n }", "title": "" }, { "docid": "bf0b2d130664be44dc6766fcc19b6d95", "score": "0.64836615", "text": "componentDidMount () {\n var logState = localStorage.getItem('logState') || false;\n if(!logState) {\n Router.push('/index');\n }\n var logUser = JSON.parse(localStorage.getItem('user')) || {}\n if(!logUser || logUser.name != \"Mateo Silguero\") {\n Router.push('/index');\n }\n this.getUsers();\n list = JSON.parse(localStorage.getItem('uList'));\n this.setState({list: list});\n }", "title": "" }, { "docid": "633dc6d9d42af1fe3a9cce44985bd1cc", "score": "0.6472576", "text": "componentWillMount(){\n console.log('Component Will Mount')\n //fetch call\n //axios call\n //database call\n }", "title": "" }, { "docid": "a01279dcf163fadf387b941b71ec4242", "score": "0.64715946", "text": "componentDidMount() {\n const users = this.getUsers()\n this.setState({ results: users })\n }", "title": "" }, { "docid": "09e593e0fcb16c8d0ef421a310e0b767", "score": "0.64672714", "text": "componentDidMount() {\n this.props.getAllLocations();\n }", "title": "" }, { "docid": "d1f4e617dba1e90e5cb847c941e61020", "score": "0.6466266", "text": "componentDidMount(){\n this.props.fetchUser();\n }", "title": "" }, { "docid": "5bb665b3eb2432f1c1fd1ca2937ae091", "score": "0.6466028", "text": "componentDidMount() {\n let locations = this.props.markers;\n let distNotify = this.props.distNotify;\n this.requestRoute = requestRoute.bind(this);\n this.requestRoute(locations, distNotify);\n }", "title": "" }, { "docid": "fb291cd77d982533c989ec8ac6c39044", "score": "0.6465746", "text": "async componentWillMount() {\n this.setState({ username: this.props.user.username });\n this.setState({ roomNumber: this.props.user.roomNumber });\n }", "title": "" }, { "docid": "ff39df80044844c0d05c9b2b49fb3572", "score": "0.6463778", "text": "componentWillMount() {\n this.load();\n }", "title": "" }, { "docid": "03cda2b2947e866884cd11e1355b9462", "score": "0.64604616", "text": "componentDidMount() {\n this.getAllItems();\n this.checkSession();\n this.getLocation();\n }", "title": "" }, { "docid": "794d246f2da9f01536528792bd393c7a", "score": "0.64594305", "text": "componentDidMount() {\n this.props.fetchUser();\n }", "title": "" }, { "docid": "794d246f2da9f01536528792bd393c7a", "score": "0.64594305", "text": "componentDidMount() {\n this.props.fetchUser();\n }", "title": "" }, { "docid": "9f27b47da576a167cd2d593401f7d90a", "score": "0.6457631", "text": "componentDidMount() {\n\t\t// get the members when this component is first rendered \n\t\tthis.getMembers()\n\t}", "title": "" }, { "docid": "970d033e480c4ec5f7e5950d017b1d6e", "score": "0.64540356", "text": "componentDidMount() {\n this.initializeTermsDictionary(urlBase)\n this.initializeDiscardedInfluencersList(urlBase)\n this.initializeBlacklistsObject(urlBase)\n }", "title": "" }, { "docid": "6930d31f6c84f7dcb1e3def19d63ea6a", "score": "0.64532936", "text": "async componentDidMount() {\n const users = await getActiveUser();\n this.getUserSites();\n const allUserSites = await getUserSites();\n this.setState({\n currentUser: users,\n });\n console.log(allUserSites);\n }", "title": "" }, { "docid": "fd69d902aa60ed59e6472a94f71cb5ac", "score": "0.64507234", "text": "componentDidMount(){\n this.props.fetchUser();\n }", "title": "" }, { "docid": "ec96a2df6aa1ba0a6e232aea8c6fd459", "score": "0.6437664", "text": "UNSAFE_componentWillMount() {\n this.getUserLocation();\n }", "title": "" }, { "docid": "6c809bd674c41acac54175836add1220", "score": "0.64315146", "text": "componentDidMount() {\n this.setState({isLoadingGroups: true});\n this.setState({isLoadingUsers: true});\n let url = config.api + \"/users\";\n fetch(url,config.api_request)\n .then(handleJSONResponse)\n .then(json => {\n this.setState({isLoadingUsers: false,users: json});\n })\n .catch(e => {\n this.setState({error: new Error('Cannot load user list')});\n });\n\n url = config.api + \"/right_groups\";\n fetch(url, config.api_request)\n .then(handleJSONResponse)\n .then(json => {\n this.setState({isLoadingGroups: false, groups: json});\n })\n .catch(e => {\n this.setState({error: new Error('Cannot load groups list')});\n });\n }", "title": "" }, { "docid": "dfd71fdeee78d5a8db7991eb67f669da", "score": "0.6430588", "text": "componentDidMount() {\n this.getLocations();\n }", "title": "" }, { "docid": "cebda3fa2e921759cbc5dbca60b11648", "score": "0.64232", "text": "componentWillMount() {\n\t\tif(!this.checkForLogin())\n\t\t\tthis.showLogin();\n\t\telse\n\t\t\tthis.showHome();\n\t}", "title": "" }, { "docid": "4e1dc3f327be9c9f000711ca0a1215e2", "score": "0.6421834", "text": "componentDidMount() {\n this.props.fetchUser();\n }", "title": "" }, { "docid": "4e1dc3f327be9c9f000711ca0a1215e2", "score": "0.6421834", "text": "componentDidMount() {\n this.props.fetchUser();\n }", "title": "" }, { "docid": "81d24aac38d9a71566494e0c4d70b1c6", "score": "0.64188915", "text": "componentDidMount() {\n if (this.props.notLoaded) {\n this.props.dispatch(fetchProtectedUser());\n }\n }", "title": "" }, { "docid": "81d24aac38d9a71566494e0c4d70b1c6", "score": "0.64188915", "text": "componentDidMount() {\n if (this.props.notLoaded) {\n this.props.dispatch(fetchProtectedUser());\n }\n }", "title": "" }, { "docid": "d6bdec6090507ec29ba262ee88be28c2", "score": "0.6415181", "text": "componentDidMount() {\n this.fetchLocations();\n }", "title": "" }, { "docid": "4b330f5f19e1ed5b50d1d2a5b450fe09", "score": "0.6412475", "text": "componentDidMount() {\n this.loadFriends()\n }", "title": "" }, { "docid": "c3449baf09b943a43c730d59b7ecaa42", "score": "0.6406595", "text": "componentWillMount() {\n const user = this.state.user || JSON.parse(localStorage.getItem(\"user\"));\n this.setState({\n user,\n });\n if (user) {\n this.setState({\n isLoadingClassrooms: true,\n });\n Axios.get(`${BASE_URL}/users/${user.user_id}/classrooms`, {\n headers: {\n \"x-access-token\": JSON.parse(localStorage.getItem(\"user\")).token,\n },\n })\n .then((response) => {\n let classrooms = response.data.data;\n this.setState({\n classrooms,\n isLoadingClassrooms: false,\n });\n })\n .catch((err) => {\n console.log(err);\n this.setState({\n classrooms: [],\n isLoadingClassrooms: false,\n });\n });\n }\n }", "title": "" }, { "docid": "d777d2b6285a856f387f3d364216b28b", "score": "0.6404677", "text": "componentDidMount() {\n this.loadFriends()\n }", "title": "" }, { "docid": "99a766771419c9e6bffab2bf19e084f9", "score": "0.64018434", "text": "componentDidMount(){\n\t\t// Fetch va y busca los usuarios en esa URL con el then obtenemos una respuesta y luego se hace \n\t\t//\"magia\" con el response.json Fetch es un objeto del window de los objetos y nos permite\n\t\t// hacer requests a servidores web y este https://jsonplaceholder.typicode.com/users es un servidor \n\t\t// que nos retorna un listado de usuarios que podemos usar en nuestra aplicacion\n\t\tfetch('https://jsonplaceholder.typicode.com/users').then(response => {\n\t\t\t return response.json();\n\t\t})\n\t\t// luego hacemos un update con el setState para obtener los usuarios y tenerlos en \n\t\t// la propiedad robot que tenemos en el estado\n\t\t.then(users=>{\n\t\t\tthis.setState({robots : users})\n\t\t})\n\t\t\n\t}", "title": "" }, { "docid": "5697c07a4de50241fc8cbf26d45c591c", "score": "0.6397133", "text": "componentDidMount(){\r\n\t\t\r\n \t\t\r\n \tthis.getMembers();\r\n \r\n\t}", "title": "" }, { "docid": "46a42aa34ecba33235bb2f01527c4b67", "score": "0.63831586", "text": "componentDidMount() {\n this.loadUsuarios();\n }", "title": "" }, { "docid": "c864a078f49e32437fda4369a2500c18", "score": "0.6382725", "text": "componentDidMount() {\n initializeHistory();\n this.listenStaticRouterUpdates();\n }", "title": "" }, { "docid": "d3cdfc24c0560d14254358d9f3a5b834", "score": "0.6379906", "text": "componentWillMount(){\n\t\taxios.get(\"http://demo9197058.mockable.io/users\")\n\t\t .then(res => {\n\t\t\tconst users= res.data;\n\t\t\tthis.setState({ users });\n\t\t })\n}", "title": "" }, { "docid": "4ffa2b4f7a7384eb898ab9682f96dc21", "score": "0.6375629", "text": "componentDidMount() {\n var self = this;\n usersService.getAllUsers(this.props.token).then(function (result) {\n self.setState({\n users: result.data\n })\n });\n }", "title": "" }, { "docid": "49a39c8e2539f2c67da4b1efa5e9b469", "score": "0.6364271", "text": "componentDidMount(){\n this.retrieveRooms();\n }", "title": "" }, { "docid": "1e03be66b6661328746dc1f8ebf2ee74", "score": "0.6355252", "text": "componentDidMount() {\n this.props.onFetchUsers()\n }", "title": "" } ]
5d6de3f47ebd81842aa6085eb4b284fc
Decimal methods / clone config/set / Create and return a Decimal constructor with the same configuration properties as this Decimal constructor.
[ { "docid": "a19dfc235a9c17e2945e76b8b0eea102", "score": "0.6940124", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * value {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(value) {\r\n var x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(value);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (value instanceof Decimal) {\r\n x.s = value.s;\r\n x.e = value.e;\r\n x.d = (value = value.d) ? value.slice() : value;\r\n return;\r\n }\r\n\r\n if (typeof value === 'number') {\r\n\r\n // Reject Infinity/NaN.\r\n if (value * 0 !== 0) {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n if (value > 0) {\r\n x.s = 1;\r\n } else if (value < 0) {\r\n value = -value;\r\n x.s = -1;\r\n } else {\r\n x.s = 0;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (value === ~~value && value < 1e7) {\r\n x.e = 0;\r\n x.d = [value];\r\n return;\r\n }\r\n\r\n return parseDecimal(x, value.toString());\r\n } else if (typeof value !== 'string') {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n // Minus sign?\r\n if (value.charCodeAt(0) === 45) {\r\n value = value.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n if (isDecimal.test(value)) parseDecimal(x, value);\r\n else throw Error(invalidArgument + value);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n\r\n Decimal.clone = clone;\r\n Decimal.config = Decimal.set = config;\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" } ]
[ { "docid": "2b813b82b6db2bcdcd19cc41edcf275d", "score": "0.7003102", "text": "function clone(obj) {\n var i, p, ps;\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * value {number|string|Decimal} A numeric value.\r\n *\r\n */\n\n function Decimal(value) {\n var x = this; // Decimal called without new.\n\n if (!(x instanceof Decimal)) return new Decimal(value); // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n\n x.constructor = Decimal; // Duplicate.\n\n if (value instanceof Decimal) {\n x.s = value.s;\n x.e = value.e;\n x.d = (value = value.d) ? value.slice() : value;\n return;\n }\n\n if (typeof value === 'number') {\n // Reject Infinity/NaN.\n if (value * 0 !== 0) {\n throw Error(invalidArgument + value);\n }\n\n if (value > 0) {\n x.s = 1;\n } else if (value < 0) {\n value = -value;\n x.s = -1;\n } else {\n x.s = 0;\n x.e = 0;\n x.d = [0];\n return;\n } // Fast path for small integers.\n\n\n if (value === ~~value && value < 1e7) {\n x.e = 0;\n x.d = [value];\n return;\n }\n\n return parseDecimal(x, value.toString());\n } else if (typeof value !== 'string') {\n throw Error(invalidArgument + value);\n } // Minus sign?\n\n\n if (value.charCodeAt(0) === 45) {\n value = value.slice(1);\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n if (isDecimal.test(value)) parseDecimal(x, value);else throw Error(invalidArgument + value);\n }\n\n Decimal.prototype = P;\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.clone = clone;\n Decimal.config = Decimal.set = config;\n if (obj === void 0) obj = {};\n\n if (obj) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\n\n for (i = 0; i < ps.length;) {\n if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n return Decimal;\n }", "title": "" }, { "docid": "f0c35796629b722b7c05bc2cdc172b6b", "score": "0.6880761", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * value {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(value) {\n var x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(value);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (value instanceof Decimal) {\n x.s = value.s;\n x.e = value.e;\n x.d = (value = value.d) ? value.slice() : value;\n return;\n }\n\n if (typeof value === 'number') {\n\n // Reject Infinity/NaN.\n if (value * 0 !== 0) {\n throw Error(invalidArgument + value);\n }\n\n if (value > 0) {\n x.s = 1;\n } else if (value < 0) {\n value = -value;\n x.s = -1;\n } else {\n x.s = 0;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n // Fast path for small integers.\n if (value === ~~value && value < 1e7) {\n x.e = 0;\n x.d = [value];\n return;\n }\n\n return parseDecimal(x, value.toString());\n } else if (typeof value !== 'string') {\n throw Error(invalidArgument + value);\n }\n\n // Minus sign?\n if (value.charCodeAt(0) === 45) {\n value = value.slice(1);\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n if (isDecimal.test(value)) parseDecimal(x, value);\n else throw Error(invalidArgument + value);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n\n Decimal.clone = clone;\n Decimal.config = Decimal.set = config;\n\n if (obj === void 0) obj = {};\n if (obj) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "f0c35796629b722b7c05bc2cdc172b6b", "score": "0.6880761", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * value {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(value) {\n var x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(value);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (value instanceof Decimal) {\n x.s = value.s;\n x.e = value.e;\n x.d = (value = value.d) ? value.slice() : value;\n return;\n }\n\n if (typeof value === 'number') {\n\n // Reject Infinity/NaN.\n if (value * 0 !== 0) {\n throw Error(invalidArgument + value);\n }\n\n if (value > 0) {\n x.s = 1;\n } else if (value < 0) {\n value = -value;\n x.s = -1;\n } else {\n x.s = 0;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n // Fast path for small integers.\n if (value === ~~value && value < 1e7) {\n x.e = 0;\n x.d = [value];\n return;\n }\n\n return parseDecimal(x, value.toString());\n } else if (typeof value !== 'string') {\n throw Error(invalidArgument + value);\n }\n\n // Minus sign?\n if (value.charCodeAt(0) === 45) {\n value = value.slice(1);\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n if (isDecimal.test(value)) parseDecimal(x, value);\n else throw Error(invalidArgument + value);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n\n Decimal.clone = clone;\n Decimal.config = Decimal.set = config;\n\n if (obj === void 0) obj = {};\n if (obj) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "11ab09688c5e6d819a15a2f791b3dcdb", "score": "0.6822342", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * value {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(value) {\r\n var x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(value);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (value instanceof Decimal) {\r\n x.s = value.s;\r\n x.e = value.e;\r\n x.d = (value = value.d) ? value.slice() : value;\r\n return;\r\n }\r\n\r\n if (typeof value === 'number') {\r\n\r\n // Reject Infinity/NaN.\r\n if (value * 0 !== 0) {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n if (value > 0) {\r\n x.s = 1;\r\n } else if (value < 0) {\r\n value = -value;\r\n x.s = -1;\r\n } else {\r\n x.s = 0;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (value === ~~value && value < 1e7) {\r\n x.e = 0;\r\n x.d = [value];\r\n return;\r\n }\r\n\r\n return parseDecimal(x, value.toString());\r\n } else if (typeof value !== 'string') {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n // Minus sign?\r\n if (value.charCodeAt(0) === 45) {\r\n value = value.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n if (isDecimal.test(value)) parseDecimal(x, value);\r\n else throw Error(invalidArgument + value);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n\r\n Decimal.clone = clone;\r\n Decimal.config = Decimal.set = config;\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n}", "title": "" }, { "docid": "418937e8c1b452b517016daf0254d4bb", "score": "0.67630553", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n x.e = v.e;\r\n x.d = (v = v.d) ? v.slice() : v;\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n x.e = e;\r\n x.d = [v];\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if (v.charCodeAt(0) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "418937e8c1b452b517016daf0254d4bb", "score": "0.67630553", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n x.e = v.e;\r\n x.d = (v = v.d) ? v.slice() : v;\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n x.e = e;\r\n x.d = [v];\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if (v.charCodeAt(0) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "ecf9b63d4249002e2e17a052ff32ecbe", "score": "0.67630553", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n x.e = v.e;\r\n x.d = (v = v.d) ? v.slice() : v;\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n x.e = e;\r\n x.d = [v];\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if (v.charCodeAt(0) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = config;\r\n Decimal.clone = clone;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.fromJSON = fromJSON;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "0a61de5b09066f5d33d98d916ed83f21", "score": "0.67290705", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (v instanceof Decimal) {\n x.s = v.s;\n x.e = v.e;\n x.d = (v = v.d) ? v.slice() : v;\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n x.e = e;\n x.d = [v];\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if (v.charCodeAt(0) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = config;\n Decimal.clone = clone;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.fromJSON = fromJSON;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "88114885016c1c1e5e494603fd1899a2", "score": "0.6699447", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (isDecimalInstance(v)) {\n x.s = v.s;\n\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n\n // Zero.\n x.e = 0;\n x.d = [0];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [0];\n } else {\n x.e = e;\n x.d = [v];\n }\n } else {\n x.e = e;\n x.d = [v];\n }\n\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone;\n Decimal.isDecimal = isDecimalInstance;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.clamp = clamp;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.sum = sum;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "88114885016c1c1e5e494603fd1899a2", "score": "0.6699447", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (isDecimalInstance(v)) {\n x.s = v.s;\n\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n\n // Zero.\n x.e = 0;\n x.d = [0];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [0];\n } else {\n x.e = e;\n x.d = [v];\n }\n } else {\n x.e = e;\n x.d = [v];\n }\n\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone;\n Decimal.isDecimal = isDecimalInstance;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.clamp = clamp;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.sum = sum;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "823f6203cba83882ff5acfde75e3458d", "score": "0.6640447", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n\r\n if (external) {\r\n if (!v.d || v.e > Decimal.maxE) {\r\n\r\n // Infinity.\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (v.e < Decimal.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d.slice();\r\n }\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d ? v.d.slice() : v.d;\r\n }\r\n\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\r\n if (external) {\r\n if (e > Decimal.maxE) {\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (e < Decimal.minE) {\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if ((i = v.charCodeAt(0)) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n // Plus sign?\r\n if (i === 43) v = v.slice(1);\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "823f6203cba83882ff5acfde75e3458d", "score": "0.6640447", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n\r\n if (external) {\r\n if (!v.d || v.e > Decimal.maxE) {\r\n\r\n // Infinity.\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (v.e < Decimal.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d.slice();\r\n }\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d ? v.d.slice() : v.d;\r\n }\r\n\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\r\n if (external) {\r\n if (e > Decimal.maxE) {\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (e < Decimal.minE) {\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if ((i = v.charCodeAt(0)) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n // Plus sign?\r\n if (i === 43) v = v.slice(1);\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "823f6203cba83882ff5acfde75e3458d", "score": "0.6640447", "text": "function clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (v instanceof Decimal) {\r\n x.s = v.s;\r\n\r\n if (external) {\r\n if (!v.d || v.e > Decimal.maxE) {\r\n\r\n // Infinity.\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (v.e < Decimal.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d.slice();\r\n }\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d ? v.d.slice() : v.d;\r\n }\r\n\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\r\n if (external) {\r\n if (e > Decimal.maxE) {\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (e < Decimal.minE) {\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n\r\n return;\r\n\r\n // Infinity, NaN.\r\n } else if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n\r\n } else if (t !== 'string') {\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n // Minus sign?\r\n if ((i = v.charCodeAt(0)) === 45) {\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n // Plus sign?\r\n if (i === 43) v = v.slice(1);\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n }", "title": "" }, { "docid": "6849b05bea2c7d220766e3267cc90103", "score": "0.66232526", "text": "function clone(obj) {\r\n\t var i, p, ps;\r\n\r\n\t /*\r\n\t * The Decimal constructor and exported function.\r\n\t * Return a new Decimal instance.\r\n\t *\r\n\t * v {number|string|Decimal} A numeric value.\r\n\t *\r\n\t */\r\n\t function Decimal(v) {\r\n\t var e, i, t,\r\n\t x = this;\r\n\r\n\t // Decimal called without new.\r\n\t if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n\t // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n\t // which points to Object.\r\n\t x.constructor = Decimal;\r\n\r\n\t // Duplicate.\r\n\t if (v instanceof Decimal) {\r\n\t x.s = v.s;\r\n\t x.e = v.e;\r\n\t x.d = (v = v.d) ? v.slice() : v;\r\n\t return;\r\n\t }\r\n\r\n\t t = typeof v;\r\n\r\n\t if (t === 'number') {\r\n\t if (v === 0) {\r\n\t x.s = 1 / v < 0 ? -1 : 1;\r\n\t x.e = 0;\r\n\t x.d = [0];\r\n\t return;\r\n\t }\r\n\r\n\t if (v < 0) {\r\n\t v = -v;\r\n\t x.s = -1;\r\n\t } else {\r\n\t x.s = 1;\r\n\t }\r\n\r\n\t // Fast path for small integers.\r\n\t if (v === ~~v && v < 1e7) {\r\n\t for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\t x.e = e;\r\n\t x.d = [v];\r\n\t return;\r\n\r\n\t // Infinity, NaN.\r\n\t } else if (v * 0 !== 0) {\r\n\t if (!v) x.s = NaN;\r\n\t x.e = NaN;\r\n\t x.d = null;\r\n\t return;\r\n\t }\r\n\r\n\t return parseDecimal(x, v.toString());\r\n\r\n\t } else if (t !== 'string') {\r\n\t throw Error(invalidArgument + v);\r\n\t }\r\n\r\n\t // Minus sign?\r\n\t if (v.charCodeAt(0) === 45) {\r\n\t v = v.slice(1);\r\n\t x.s = -1;\r\n\t } else {\r\n\t x.s = 1;\r\n\t }\r\n\r\n\t return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n\t }\r\n\r\n\t Decimal.prototype = P;\r\n\r\n\t Decimal.ROUND_UP = 0;\r\n\t Decimal.ROUND_DOWN = 1;\r\n\t Decimal.ROUND_CEIL = 2;\r\n\t Decimal.ROUND_FLOOR = 3;\r\n\t Decimal.ROUND_HALF_UP = 4;\r\n\t Decimal.ROUND_HALF_DOWN = 5;\r\n\t Decimal.ROUND_HALF_EVEN = 6;\r\n\t Decimal.ROUND_HALF_CEIL = 7;\r\n\t Decimal.ROUND_HALF_FLOOR = 8;\r\n\t Decimal.EUCLID = 9;\r\n\r\n\t Decimal.config = config;\r\n\t Decimal.clone = clone;\r\n\r\n\t Decimal.abs = abs;\r\n\t Decimal.acos = acos;\r\n\t Decimal.acosh = acosh; // ES6\r\n\t Decimal.add = add;\r\n\t Decimal.asin = asin;\r\n\t Decimal.asinh = asinh; // ES6\r\n\t Decimal.atan = atan;\r\n\t Decimal.atanh = atanh; // ES6\r\n\t Decimal.atan2 = atan2;\r\n\t Decimal.cbrt = cbrt; // ES6\r\n\t Decimal.ceil = ceil;\r\n\t Decimal.cos = cos;\r\n\t Decimal.cosh = cosh; // ES6\r\n\t Decimal.div = div;\r\n\t Decimal.exp = exp;\r\n\t Decimal.floor = floor;\r\n\t Decimal.fromJSON = fromJSON;\r\n\t Decimal.hypot = hypot; // ES6\r\n\t Decimal.ln = ln;\r\n\t Decimal.log = log;\r\n\t Decimal.log10 = log10; // ES6\r\n\t Decimal.log2 = log2; // ES6\r\n\t Decimal.max = max;\r\n\t Decimal.min = min;\r\n\t Decimal.mod = mod;\r\n\t Decimal.mul = mul;\r\n\t Decimal.pow = pow;\r\n\t Decimal.random = random;\r\n\t Decimal.round = round;\r\n\t Decimal.sign = sign; // ES6\r\n\t Decimal.sin = sin;\r\n\t Decimal.sinh = sinh; // ES6\r\n\t Decimal.sqrt = sqrt;\r\n\t Decimal.sub = sub;\r\n\t Decimal.tan = tan;\r\n\t Decimal.tanh = tanh; // ES6\r\n\t Decimal.trunc = trunc; // ES6\r\n\r\n\t if (obj === void 0) obj = {};\r\n\t if (obj) {\r\n\t ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n\t for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n\t }\r\n\r\n\t Decimal.config(obj);\r\n\r\n\t return Decimal;\r\n\t }", "title": "" }, { "docid": "eb2b5725470ee307ce505485deb89a1f", "score": "0.66194236", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (v instanceof Decimal) {\n x.s = v.s;\n\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n\n // Zero.\n x.e = 0;\n x.d = [0];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [0];\n } else {\n x.e = e;\n x.d = [v];\n }\n } else {\n x.e = e;\n x.d = [v];\n }\n\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone;\n Decimal.isDecimal = isDecimalInstance;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "eb2b5725470ee307ce505485deb89a1f", "score": "0.66194236", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (v instanceof Decimal) {\n x.s = v.s;\n\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n\n // Zero.\n x.e = 0;\n x.d = [0];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [0];\n } else {\n x.e = e;\n x.d = [v];\n }\n } else {\n x.e = e;\n x.d = [v];\n }\n\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone;\n Decimal.isDecimal = isDecimalInstance;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "eb2b5725470ee307ce505485deb89a1f", "score": "0.66194236", "text": "function clone(obj) {\n var i, p, ps;\n\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\n function Decimal(v) {\n var e, i, t,\n x = this;\n\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n\n // Duplicate.\n if (v instanceof Decimal) {\n x.s = v.s;\n\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n\n // Zero.\n x.e = 0;\n x.d = [0];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n\n return;\n }\n\n t = typeof v;\n\n if (t === 'number') {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [0];\n return;\n }\n\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [0];\n } else {\n x.e = e;\n x.d = [v];\n }\n } else {\n x.e = e;\n x.d = [v];\n }\n\n return;\n\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n\n return parseDecimal(x, v.toString());\n\n } else if (t !== 'string') {\n throw Error(invalidArgument + v);\n }\n\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n\n Decimal.prototype = P;\n\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone;\n Decimal.isDecimal = isDecimalInstance;\n\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh; // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh; // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh; // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt; // ES6\n Decimal.ceil = ceil;\n Decimal.cos = cos;\n Decimal.cosh = cosh; // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot; // ES6\n Decimal.ln = ln;\n Decimal.log = log;\n Decimal.log10 = log10; // ES6\n Decimal.log2 = log2; // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign; // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh; // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.tan = tan;\n Decimal.tanh = tanh; // ES6\n Decimal.trunc = trunc; // ES6\n\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n\n Decimal.config(obj);\n\n return Decimal;\n }", "title": "" }, { "docid": "f84f46eee56b1beb8d153930aadb3e06", "score": "0.6495556", "text": "function clone$1(obj) {\n var i, p, ps;\n /*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */ function Decimal(v) {\n var e, i, t, x = this;\n // Decimal called without new.\n if (!(x instanceof Decimal)) return new Decimal(v);\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n // which points to Object.\n x.constructor = Decimal;\n // Duplicate.\n if (v instanceof Decimal) {\n x.s = v.s;\n if (external) {\n if (!v.d || v.e > Decimal.maxE) {\n // Infinity.\n x.e = NaN;\n x.d = null;\n } else if (v.e < Decimal.minE) {\n // Zero.\n x.e = 0;\n x.d = [ 0 ];\n } else {\n x.e = v.e;\n x.d = v.d.slice();\n }\n } else {\n x.e = v.e;\n x.d = v.d ? v.d.slice() : v.d;\n }\n return;\n }\n t = typeof v;\n if (t === \"number\") {\n if (v === 0) {\n x.s = 1 / v < 0 ? -1 : 1;\n x.e = 0;\n x.d = [ 0 ];\n return;\n }\n if (v < 0) {\n v = -v;\n x.s = -1;\n } else {\n x.s = 1;\n }\n // Fast path for small integers.\n if (v === ~~v && v < 1e7) {\n for (e = 0, i = v; i >= 10; i /= 10) e++;\n if (external) {\n if (e > Decimal.maxE) {\n x.e = NaN;\n x.d = null;\n } else if (e < Decimal.minE) {\n x.e = 0;\n x.d = [ 0 ];\n } else {\n x.e = e;\n x.d = [ v ];\n }\n } else {\n x.e = e;\n x.d = [ v ];\n }\n return;\n // Infinity, NaN.\n } else if (v * 0 !== 0) {\n if (!v) x.s = NaN;\n x.e = NaN;\n x.d = null;\n return;\n }\n return parseDecimal(x, v.toString());\n } else if (t !== \"string\") {\n throw Error(invalidArgument + v);\n }\n // Minus sign?\n if ((i = v.charCodeAt(0)) === 45) {\n v = v.slice(1);\n x.s = -1;\n } else {\n // Plus sign?\n if (i === 43) v = v.slice(1);\n x.s = 1;\n }\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\n }\n Decimal.prototype = P;\n Decimal.ROUND_UP = 0;\n Decimal.ROUND_DOWN = 1;\n Decimal.ROUND_CEIL = 2;\n Decimal.ROUND_FLOOR = 3;\n Decimal.ROUND_HALF_UP = 4;\n Decimal.ROUND_HALF_DOWN = 5;\n Decimal.ROUND_HALF_EVEN = 6;\n Decimal.ROUND_HALF_CEIL = 7;\n Decimal.ROUND_HALF_FLOOR = 8;\n Decimal.EUCLID = 9;\n Decimal.config = Decimal.set = config;\n Decimal.clone = clone$1;\n Decimal.isDecimal = isDecimalInstance;\n Decimal.abs = abs;\n Decimal.acos = acos;\n Decimal.acosh = acosh;\n // ES6\n Decimal.add = add;\n Decimal.asin = asin;\n Decimal.asinh = asinh;\n // ES6\n Decimal.atan = atan;\n Decimal.atanh = atanh;\n // ES6\n Decimal.atan2 = atan2;\n Decimal.cbrt = cbrt;\n // ES6\n Decimal.ceil = ceil;\n Decimal.cos = cos;\n Decimal.cosh = cosh;\n // ES6\n Decimal.div = div;\n Decimal.exp = exp;\n Decimal.floor = floor;\n Decimal.hypot = hypot;\n // ES6\n Decimal.ln = ln;\n Decimal.log = log$1;\n Decimal.log10 = log10;\n // ES6\n Decimal.log2 = log2;\n // ES6\n Decimal.max = max;\n Decimal.min = min;\n Decimal.mod = mod;\n Decimal.mul = mul;\n Decimal.pow = pow;\n Decimal.random = random;\n Decimal.round = round;\n Decimal.sign = sign$4;\n // ES6\n Decimal.sin = sin;\n Decimal.sinh = sinh;\n // ES6\n Decimal.sqrt = sqrt;\n Decimal.sub = sub;\n Decimal.tan = tan;\n Decimal.tanh = tanh;\n // ES6\n Decimal.trunc = trunc;\n // ES6\n if (obj === void 0) obj = {};\n if (obj) {\n if (obj.defaults !== true) {\n ps = [ \"precision\", \"rounding\", \"toExpNeg\", \"toExpPos\", \"maxE\", \"minE\", \"modulo\", \"crypto\" ];\n for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\n }\n }\n Decimal.config(obj);\n return Decimal;\n }", "title": "" }, { "docid": "c7e1aecf22dc7681968be9b72deec5ec", "score": "0.63568485", "text": "function q(t){/*\n * The Decimal constructor and exported function.\n * Return a new Decimal instance.\n *\n * v {number|string|Decimal} A numeric value.\n *\n */\nfunction e(t){var n,r,i,o=this;\n// Decimal called without new.\nif(!(o instanceof e))return new e(t);\n// Duplicate.\nif(\n// Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\n// which points to Object.\no.constructor=e,t instanceof e)return o.s=t.s,o.e=t.e,void(o.d=(t=t.d)?t.slice():t);if(\"number\"===(i=typeof t)){if(0===t)return o.s=1/t<0?-1:1,o.e=0,void(o.d=[0]);\n// Fast path for small integers.\nif(t<0?(t=-t,o.s=-1):o.s=1,t===~~t&&t<1e7){for(n=0,r=t;r>=10;r/=10)n++;return o.e=n,void(o.d=[t])}return 0*t!=0?(t||(o.s=NaN),o.e=NaN,void(o.d=null)):E(o,t.toString())}if(\"string\"!==i)throw Error(Ct+t);\n// Minus sign?\nreturn 45===t.charCodeAt(0)?(t=t.slice(1),o.s=-1):o.s=1,At.test(t)?E(o,t):C(o,t)}var n,r,i;if(e.prototype=Lt,e.ROUND_UP=0,e.ROUND_DOWN=1,e.ROUND_CEIL=2,e.ROUND_FLOOR=3,e.ROUND_HALF_UP=4,e.ROUND_HALF_DOWN=5,e.ROUND_HALF_EVEN=6,e.ROUND_HALF_CEIL=7,e.ROUND_HALF_FLOOR=8,e.EUCLID=9,e.config=e.set=z,e.clone=q,e.abs=I,e.acos=k,e.acosh=A,// ES6\ne.add=P,e.asin=R,e.asinh=D,// ES6\ne.atan=j,e.atanh=L,// ES6\ne.atan2=F,e.cbrt=V,// ES6\ne.ceil=B,e.cos=H,e.cosh=U,// ES6\ne.div=$,e.exp=W,e.floor=G,e.hypot=Y,// ES6\ne.ln=K,e.log=X,e.log10=Z,// ES6\ne.log2=Q,// ES6\ne.max=J,e.min=tt,e.mod=et,e.mul=nt,e.pow=rt,e.random=it,e.round=ot,e.sign=st,// ES6\ne.sin=at,e.sinh=ut,// ES6\ne.sqrt=ct,e.sub=lt,e.tan=pt,e.tanh=ht,// ES6\ne.trunc=ft,// ES6\nvoid 0===t&&(t={}),t)for(i=[\"precision\",\"rounding\",\"toExpNeg\",\"toExpPos\",\"maxE\",\"minE\",\"modulo\",\"crypto\"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return e.config(t),e}", "title": "" }, { "docid": "72d3989a05435b3c3dd276c1351dbfab", "score": "0.6115988", "text": "get valueDecimal () {\n\t\treturn this._valueDecimal;\n\t}", "title": "" }, { "docid": "a76d92e51024d24b60e826cbe2ae4be2", "score": "0.6106323", "text": "get valueDecimal() {\n\t\treturn this.__valueDecimal;\n\t}", "title": "" }, { "docid": "375b952d76f0b70518e0fb9221e82a12", "score": "0.5816416", "text": "function create_decimal_field()\n{\n\n function DecimalField(config) {\n jsGrid.fields.number.call(this, config);\n }\n\n DecimalField.prototype = new jsGrid.fields.number({\n\n filterValue: function() {\n return this.filterControl.val()\n ? parseFloat(this.filterControl.val() || 0, 10)\n : undefined;\n },\n\n insertValue: function() {\n return this.insertControl.val()\n ? parseFloat(this.insertControl.val() || 0, 10)\n : undefined;\n },\n\n editValue: function() {\n return this.editControl.val()\n ? parseFloat(this.editControl.val() || 0, 10)\n : undefined;\n }\n });\n\n jsGrid.fields.decimal = jsGrid.DecimalField = DecimalField;\n\n}", "title": "" }, { "docid": "ffe026b7e1836a34a514307b5cd4cd97", "score": "0.5743003", "text": "function decimal(value) {\n // Allow numbers to be specified in hex, octal, and binary\n if (value[0] === \"#\") {\n value = value.replace(\"#\", \"0\");\n }\n return new Decimal(value);\n}", "title": "" }, { "docid": "9cf9152f9e9fc81a5f5519dffffa768d", "score": "0.5682388", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var alphabet, c, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error( bignumberError + ' Constructor call without new: ' + n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n if ( b == null ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if ( isNum && n * 0 == 0 ) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Faster path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, isNum );\r\n x.s = str.charCodeAt(0) == 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck( b, 2, ALPHABET.length, 'Base' );\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if ( n * 0 != 0 ) return parseNumeric( x, str, isNum, b );\r\n\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if ( str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n throw Error\r\n ( tooManyDigits + n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if ( b > 10 && b < 37 ) str = str.toLowerCase();\r\n }\r\n\r\n alphabet = ALPHABET.slice( 0, b );\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for ( len = str.length; i < len; i++ ) {\r\n if ( alphabet.indexOf( c = str.charAt(i) ) < 0 ) {\r\n if ( c == '.' ) {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if ( i > e ) {\r\n e = len;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric( x, n + '', isNum, b );\r\n }\r\n }\r\n\r\n str = convertBase( str, b, 10, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if ( isNum && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n throw Error\r\n ( tooManyDigits + ( x.s * n ) );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters, and not\r\n * containing '.'. The empty string, null or undefined\r\n * resets the alphabet to its default value.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if ( obj != null ) {\r\n\r\n if ( typeof obj == 'object' ) {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if ( obj.hasOwnProperty( p = 'DECIMAL_PLACES' ) ) {\r\n v = obj[p];\r\n intCheck( v, 0, MAX, p );\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if ( obj.hasOwnProperty( p = 'ROUNDING_MODE' ) ) {\r\n v = obj[p];\r\n intCheck( v, 0, 8, p );\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if ( obj.hasOwnProperty( p = 'EXPONENTIAL_AT' ) ) {\r\n v = obj[p];\r\n if ( isArray(v) ) {\r\n intCheck( v[0], -MAX, 0, p );\r\n intCheck( v[1], 0, MAX, p );\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck( v, -MAX, MAX, p );\r\n TO_EXP_NEG = -( TO_EXP_POS = v < 0 ? -v : v );\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if ( obj.hasOwnProperty( p = 'RANGE' ) ) {\r\n v = obj[p];\r\n if ( isArray(v) ) {\r\n intCheck( v[0], -MAX, -1, p );\r\n intCheck( v[1], 1, MAX, p );\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck( v, -MAX, MAX, p );\r\n if (v) {\r\n MIN_EXP = -( MAX_EXP = v < 0 ? -v : v );\r\n } else {\r\n throw Error\r\n ( bignumberError + p + ' cannot be zero: ' + v );\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if ( obj.hasOwnProperty( p = 'CRYPTO' ) ) {\r\n v = obj[p];\r\n if ( v === !!v ) {\r\n if (v) {\r\n if ( typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes) ) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n ( bignumberError + 'crypto unavailable' );\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n ( bignumberError + p + ' not true or false: ' + v );\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if ( obj.hasOwnProperty( p = 'MODULO_MODE' ) ) {\r\n v = obj[p];\r\n intCheck( v, 0, 9, p );\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if ( obj.hasOwnProperty( p = 'POW_PRECISION' ) ) {\r\n v = obj[p];\r\n intCheck( v, 0, MAX, p );\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if ( obj.hasOwnProperty( p = 'FORMAT' ) ) {\r\n v = obj[p];\r\n if ( typeof v == 'object' ) FORMAT = v;\r\n else throw Error\r\n ( bignumberError + p + ' not an object: ' + v );\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if ( obj.hasOwnProperty( p = 'ALPHABET' ) ) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if ( typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v) ) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n ( bignumberError + p + ' invalid: ' + v );\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n ( bignumberError + 'Object expected: ' + obj );\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [ TO_EXP_NEG, TO_EXP_POS ],\r\n RANGE: [ MIN_EXP, MAX_EXP ],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin( arguments, P.lt );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin( arguments, P.gt );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if ( dp == null ) dp = DECIMAL_PLACES;\r\n else intCheck( dp, 0, MAX );\r\n\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n ( bignumberError + 'crypto unavailable' );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = ( function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut( str, baseIn, baseOut, alphabet ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n\r\n arr[0] += alphabet.indexOf( str.charAt( i++ ) );\r\n\r\n for ( j = 0; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function ( str, baseIn, baseOut, sign, callerIsToString ) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e, '0' ),\r\n 10, baseOut, decimal );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut( str, baseIn, baseOut, callerIsToString\r\n ? ( alphabet = ALPHABET, decimal )\r\n : ( alphabet = decimal, ALPHABET ) );\r\n\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n\r\n // Zero?\r\n if ( !xc[0] ) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint( alphabet.charAt(1), -dp, alphabet.charAt(0) )\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += alphabet.charAt( xc[i++] ) );\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint( str, e, alphabet.charAt(0) );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format( n, i, rm, id ) {\r\n var c0, e, ne, len, str;\r\n\r\n if ( rm == null ) rm = ROUNDING_MODE;\r\n else intCheck( rm, 0, 8 );\r\n\r\n if ( !n.c ) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne, '0' );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( id == 1 || id == 2 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e, '0' );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, isNum, b ) {\r\n var base,\r\n s = isNum ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if ( !isNum ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n throw Error\r\n ( bignumberError + 'Not a' + ( b ? ' base ' + b : '' ) + ' number: ' + str );\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function ( y, b ) {\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function ( dp, rm ) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if ( dp != null ) {\r\n intCheck( dp, 0, MAX );\r\n if ( rm == null ) rm = ROUNDING_MODE;\r\n else intCheck( rm, 0, 8 );\r\n\r\n return round( new BigNumber(x), dp + x.e + 1, rm );\r\n }\r\n\r\n if ( !( c = x.c ) ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function ( y, b ) {\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function ( y, b ) {\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if ( rm == null ) rm = ROUNDING_MODE;\r\n else intCheck( rm, 0, 8 );\r\n return round( n, n.e + 1, rm );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function ( y, b ) {\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function ( y, b ) {\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function ( y, b ) {\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function ( sd, rm ) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if ( sd != null && sd !== !!sd ) {\r\n intCheck( sd, 1, MAX );\r\n if ( rm == null ) rm = ROUNDING_MODE;\r\n else intCheck( rm, 0, 8 );\r\n\r\n return round( new BigNumber(x), sd, rm );\r\n }\r\n\r\n if ( !( c = x.c ) ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( sd && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER );\r\n return this.times( '1e' + k );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n if ( dp != null ) {\r\n intCheck( dp, 0, MAX );\r\n dp++;\r\n }\r\n return format( this, dp, rm, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n if ( dp != null ) {\r\n intCheck( dp, 0, MAX );\r\n dp = dp + this.e + 1;\r\n }\r\n return format( this, dp, rm );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = this.toFixed( dp, rm );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if ( md != null ) {\r\n n = new BigNumber(md);\r\n\r\n if ( !n.isInteger() || n.lt(ONE) ) {\r\n throw Error\r\n ( bignumberError + 'Argument ' +\r\n ( n.isInteger() ? 'out of range: ' : 'not an integer: ' ) + md );\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.comparedTo(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.comparedTo(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().comparedTo(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.exponentiatedBy = P.pow = function ( n, m ) {\r\n var i, k, y, z,\r\n x = this;\r\n\r\n intCheck( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER );\r\n if ( m != null ) m = new BigNumber(m);\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInteger() && m.gt(ONE) && m.isInteger() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n //k = mathceil( POW_PRECISION / LOG_BASE + 1.5 ); // gives [9, 21] guard digits.\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( i = mathfloor( n < 0 ? -n : n ); ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n if ( sd != null ) intCheck( sd, 1, MAX );\r\n return format( this, sd, rm, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e, '0' );\r\n } else {\r\n intCheck( b, 2, ALPHABET.length, 'Base' );\r\n str = convertBase( toFixedPoint( str, e, '0' ), 10, b, s, true );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e, '0' );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if ( configObject != null ) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "9da3c54b98bd7e037aac5cba847de12c", "score": "0.56579757", "text": "function clone(configObject) {\n var div, convertBase, parseNumeric,\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\n ONE = new BigNumber(1),\n\n\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\n\n\n // The default values below must be integers within the inclusive ranges stated.\n // The values can also be changed at run-time using BigNumber.set.\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n // The rounding mode used when rounding to the above decimal places, and when using\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\n // UP 0 Away from zero.\n // DOWN 1 Towards zero.\n // CEIL 2 Towards +Infinity.\n // FLOOR 3 Towards -Infinity.\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n // The modulo mode used when calculating the modulus: a mod n.\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n // The remainder (r) is calculated as: r = a - n * q.\n //\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\n // DOWN 1 The remainder has the same sign as the dividend.\n // This modulo mode is commonly known as 'truncated division' and is\n // equivalent to (a % n) in JavaScript.\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n // The remainder is always positive.\n //\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\n // modes are commonly used for the modulus operation.\n // Although the other rounding modes can also be used, they may not give useful results.\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n },\n\n // The alphabet used for base conversion.\n // It must be at least 2 characters long, with no '.' or repeated character.\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\n\n\n //------------------------------------------------------------------------------------------\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\n */\n function BigNumber(n, b) {\n var alphabet, c, caseChanged, e, i, isNum, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof BigNumber)) {\n\n // Don't throw on constructor call without new (#81).\n // '[BigNumber Error] Constructor call without new: {n}'\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\n return new BigNumber(n, b);\n }\n\n if (b == null) {\n\n // Duplicate.\n if (n instanceof BigNumber) {\n x.s = n.s;\n x.e = n.e;\n x.c = (n = n.c) ? n.slice() : n;\n return;\n }\n\n isNum = typeof n == 'number';\n\n if (isNum && n * 0 == 0) {\n\n // Use `1 / n` to handle minus zero also.\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\n\n // Faster path for integers.\n if (n === ~~n) {\n for (e = 0, i = n; i >= 10; i /= 10, e++);\n x.e = e;\n x.c = [n];\n return;\n }\n\n str = n + '';\n } else {\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\n }\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n\n // Exponential form?\n if ((i = str.search(/e/i)) > 0) {\n\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n\n // Integer.\n e = str.length;\n }\n\n } else {\n\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = n + '';\n\n // Allow exponential notation to be used with base 10 argument, while\n // also rounding to DECIMAL_PLACES as with other bases.\n if (b == 10) {\n x = new BigNumber(n instanceof BigNumber ? n : str);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n isNum = typeof n == 'number';\n\n if (isNum) {\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\n\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\n throw Error\n (tooManyDigits + n);\n }\n\n // Prevent later check for length on converted number.\n isNum = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n alphabet = ALPHABET.slice(0, b);\n e = i = 0;\n\n // Check that str is a valid base b number.\n // Don't use RegExp so alphabet can contain special characters.\n for (len = str.length; i < len; i++) {\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\n if (c == '.') {\n\n // If '.' is not the first character and it has not be found before.\n if (i > e) {\n e = len;\n continue;\n }\n } else if (!caseChanged) {\n\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\n str == str.toLowerCase() && (str = str.toUpperCase())) {\n caseChanged = true;\n i = -1;\n e = 0;\n continue;\n }\n }\n\n return parseNumeric(x, n + '', isNum, b);\n }\n }\n\n str = convertBase(str, b, 10, x.s);\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n else e = str.length;\n }\n\n // Determine leading zeros.\n for (i = 0; str.charCodeAt(i) === 48; i++);\n\n // Determine trailing zeros.\n for (len = str.length; str.charCodeAt(--len) === 48;);\n\n str = str.slice(i, ++len);\n\n if (str) {\n len -= i;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (isNum && BigNumber.DEBUG &&\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\n throw Error\n (tooManyDigits + (x.s * n));\n }\n\n e = e - i - 1;\n\n // Overflow?\n if (e > MAX_EXP) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE;\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0');\n x.c.push(+str);\n }\n } else {\n\n // Zero.\n x.c = [x.e = 0];\n }\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.clone = clone;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object with the following optional properties (if the value of a property is\n * a number, it must be an integer within the inclusive range stated):\n *\n * DECIMAL_PLACES {number} 0 to MAX\n * ROUNDING_MODE {number} 0 to 8\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\n * CRYPTO {boolean} true or false\n * MODULO_MODE {number} 0 to 9\n * POW_PRECISION {number} 0 to MAX\n * ALPHABET {string} A string of two or more unique characters which does\n * not contain '.'.\n * FORMAT {object} An object with some of the following properties:\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\n *\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function (obj) {\n var p, v;\n\n if (obj != null) {\n\n if (typeof obj == 'object') {\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n DECIMAL_PLACES = v;\n }\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\n v = obj[p];\n intCheck(v, 0, 8, p);\n ROUNDING_MODE = v;\n }\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\n v = obj[p];\n if (isArray(v)) {\n intCheck(v[0], -MAX, 0, p);\n intCheck(v[1], 0, MAX, p);\n TO_EXP_NEG = v[0];\n TO_EXP_POS = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\n }\n }\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\n if (obj.hasOwnProperty(p = 'RANGE')) {\n v = obj[p];\n if (isArray(v)) {\n intCheck(v[0], -MAX, -1, p);\n intCheck(v[1], 1, MAX, p);\n MIN_EXP = v[0];\n MAX_EXP = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n if (v) {\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\n } else {\n throw Error\n (bignumberError + p + ' cannot be zero: ' + v);\n }\n }\n }\n\n // CRYPTO {boolean} true or false.\n // '[BigNumber Error] CRYPTO not true or false: {v}'\n // '[BigNumber Error] crypto unavailable'\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\n v = obj[p];\n if (v === !!v) {\n if (v) {\n if (typeof crypto != 'undefined' && crypto &&\n (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = v;\n } else {\n CRYPTO = !v;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n } else {\n CRYPTO = v;\n }\n } else {\n throw Error\n (bignumberError + p + ' not true or false: ' + v);\n }\n }\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\n v = obj[p];\n intCheck(v, 0, 9, p);\n MODULO_MODE = v;\n }\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n POW_PRECISION = v;\n }\n\n // FORMAT {object}\n // '[BigNumber Error] FORMAT not an object: {v}'\n if (obj.hasOwnProperty(p = 'FORMAT')) {\n v = obj[p];\n if (typeof v == 'object') FORMAT = v;\n else throw Error\n (bignumberError + p + ' not an object: ' + v);\n }\n\n // ALPHABET {string}\n // '[BigNumber Error] ALPHABET invalid: {v}'\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\n v = obj[p];\n\n // Disallow if only one character, or contains '.' or a repeated character.\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\n ALPHABET = v;\n } else {\n throw Error\n (bignumberError + p + ' invalid: ' + v);\n }\n }\n\n } else {\n\n // '[BigNumber Error] Object expected: {v}'\n throw Error\n (bignumberError + 'Object expected: ' + obj);\n }\n }\n\n return {\n DECIMAL_PLACES: DECIMAL_PLACES,\n ROUNDING_MODE: ROUNDING_MODE,\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\n RANGE: [MIN_EXP, MAX_EXP],\n CRYPTO: CRYPTO,\n MODULO_MODE: MODULO_MODE,\n POW_PRECISION: POW_PRECISION,\n FORMAT: FORMAT,\n ALPHABET: ALPHABET\n };\n };\n\n\n /*\n * Return true if v is a BigNumber instance, otherwise return false.\n *\n * v {any}\n */\n BigNumber.isBigNumber = function (v) {\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.maximum = BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.minimum = BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\n * '[BigNumber Error] crypto unavailable'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor(Math.random() * pow2_53); }\n : function () {\n return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0);\n };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n if (dp == null) dp = DECIMAL_PLACES;\n else intCheck(dp, 0, MAX);\n\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n }\n\n // Remove trailing elements which are zero.\n for (; c[i] === 0; c.pop(), i--);\n\n // Zero?\n if (i < 0) {\n c = [e = 0];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Called by BigNumber and BigNumber.prototype.toString.\n convertBase = (function () {\n var decimal = '0123456789';\n\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\n */\n function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n // If the caller is toString, we are converting from base 10 to baseOut.\n // If the caller is BigNumber, we are converting from baseIn to base 10.\n return function (str, baseIn, baseOut, sign, callerIsToString) {\n var alphabet, d, e, k, r, x, xc, y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\n 10, baseOut, decimal);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\n ? (alphabet = ALPHABET, decimal)\n : (alphabet = decimal, ALPHABET));\n\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop());\n\n // Zero?\n if (!xc[0]) return alphabet.charAt(0);\n\n // Does str represent an integer? If so, no need for the division.\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // The sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n // xc now represents str converted to baseOut.\n\n // THe index of the rounding digit.\n d = e + dp + 1;\n\n // The rounding digit: the digit to the right of the digit that may be rounded up.\n i = xc[d];\n\n // Look at the rounding digits and mode to determine whether to round up.\n\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n // If the index of the rounding digit is not greater than zero, or xc represents\n // zero, then the result of the base conversion is zero or, if rounding up, a value\n // such as 0.00001.\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\n : alphabet.charAt(0);\n } else {\n\n // Truncate xc to the required number of decimal places.\n xc.length = d;\n\n // Round up?\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];);\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\n\n // Add leading zeros, decimal point and trailing zeros as required.\n str = toFixedPoint(str, e, alphabet.charAt(0));\n }\n\n // The caller will add the sign.\n return str;\n };\n })();\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for (i = cmp = 0; i < aL; i++) {\n\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0;\n\n // Subtract b from a.\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for (; !a[0] && a.length > 1; a.splice(0, 1));\n }\n\n // x: dividend, y: divisor.\n return function (x, y, dp, rm, base) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if (!xc || !xc[0] || !yc || !yc[0]) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for (i = 0; yc[i] == (xc[i] || 0); i++);\n\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1));\n\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for (; remL < yL; rem[remL++] = 0);\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare(yc, rem, yL, remL);\n\n // If divisor < remainder.\n if (cmp < 0) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor(rem0 / yc0);\n\n // Algorithm:\n // product = divisor multiplied by trial digit (n).\n // Compare product and remainder.\n // If product is greater than remainder:\n // Subtract divisor from product, decrement trial digit.\n // Subtract product from remainder.\n // If product was less than remainder at the last compare:\n // Compare new remainder and divisor.\n // If remainder is greater than divisor:\n // Subtract divisor from remainder, increment trial digit.\n\n if (n > 1) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder then trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while (compare(prod, rem, prodL, remL) == 1) {\n n--;\n\n // Subtract divisor from product.\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract(rem, prod, remL, base);\n remL = rem.length;\n\n // If product was < remainder.\n if (cmp == -1) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++;\n\n // Subtract divisor from remainder.\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null;\n\n // Leading zero?\n if (!qc[0]) qc.splice(0, 1);\n }\n\n if (base == BASE) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\n\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n: a BigNumber.\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\n * rm: the rounding mode.\n * id: 1 (toExponential) or 2 (toPrecision).\n */\n function format(n, i, rm, id) {\n var c0, e, ne, len, str;\n\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n if (!n.c) return n.toString();\n\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\n ? toExponential(str, ne)\n : toFixedPoint(str, ne, '0');\n } else {\n n = round(new BigNumber(n), i, rm);\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString(n.c);\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\n\n // Append zeros?\n for (; len < i; str += '0', len++);\n str = toExponential(str, e);\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e, '0');\n\n // Append zeros?\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0');\n } else {\n i += e - len;\n if (i > 0) {\n if (e + 1 == len) str += '.';\n for (; i--; str += '0');\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin(args, method) {\n var m, n,\n i = 0;\n\n if (isArray(args[0])) args = args[0];\n m = new BigNumber(args[0]);\n\n for (; ++i < args.length;) {\n n = new BigNumber(args[i]);\n\n // If any number is NaN, return NaN.\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise(n, c, e) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for (; !c[--j]; c.pop());\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for (j = c[0]; j >= 10; j /= 10, i++);\n\n // Overflow?\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function (x, str, isNum, b) {\n var base,\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\n\n // No exception on ±Infinity or NaN.\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n x.c = x.e = null;\n } else {\n if (!isNum) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n }\n\n // '[BigNumber Error] Not a number: {n}'\n // '[BigNumber Error] Not a base {b} number: {n}'\n if (BigNumber.DEBUG) {\n throw Error\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\n }\n\n // NaN\n x.c = x.e = x.s = null;\n }\n }\n })();\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round(x, sd, rm, r) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n\n if (r) {\n\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0));\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for (d = 1; k >= 10; k /= 10, d++);\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n\n r = rm < 4\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for (; ;) {\n\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\n j = xc[0] += k;\n for (k = 1; j >= 10; j /= 10, k++);\n\n // if i != k the length has increased.\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for (i = xc.length; xc[--i] === 0; xc.pop());\n }\n\n // Overflow? Infinity.\n if (x.e > MAX_EXP) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = function (y, b) {\n return compare(this, new BigNumber(y, b));\n };\n\n\n /*\n * If dp is undefined or null or true or false, return the number of decimal places of the\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n *\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.decimalPlaces = P.dp = function (dp, rm) {\n var c, n, v,\n x = this;\n\n if (dp != null) {\n intCheck(dp, 0, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), dp + x.e + 1, rm);\n }\n\n if (!(c = x.c)) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\n if (n < 0) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function (y, b) {\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.idiv = function (y, b) {\n return div(this, new BigNumber(y, b), 0, 1);\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\n *\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\n *\n * n {number|string|BigNumber} The exponent. An integer.\n * [m] {number|string|BigNumber} The modulus.\n *\n * '[BigNumber Error] Exponent not an integer: {n}'\n */\n P.exponentiatedBy = P.pow = function (n, m) {\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\n x = this;\n\n n = new BigNumber(n);\n\n // Allow NaN and ±Infinity, but not other non-integers.\n if (n.c && !n.isInteger()) {\n throw Error\n (bignumberError + 'Exponent not an integer: ' + n);\n }\n\n if (m != null) m = new BigNumber(m);\n\n // Exponent of MAX_SAFE_INTEGER is 15.\n nIsBig = n.e > 14;\n\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\n\n // The sign of the result of pow when x is negative depends on the evenness of n.\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\n return m ? y.mod(m) : y;\n }\n\n nIsNeg = n.s < 0;\n\n if (m) {\n\n // x % m returns NaN if abs(m) is zero, or m is NaN.\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\n\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\n\n if (isModExp) x = x.mod(m);\n\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\n // [1, 240000000]\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\n // [80000000000000] [99999750000000]\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\n\n // If x is negative and n is odd, k = -0, else k = 0.\n k = x.s < 0 && isOdd(n) ? -0 : 0;\n\n // If x >= 1, k = ±Infinity.\n if (x.e > -1) k = 1 / k;\n\n // If n is negative return ±0, else return ±Infinity.\n return new BigNumber(nIsNeg ? 1 / k : k);\n\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\n }\n\n if (nIsBig) {\n half = new BigNumber(0.5);\n nIsOdd = isOdd(n);\n } else {\n nIsOdd = n % 2;\n }\n\n if (nIsNeg) n.s = 1;\n\n y = new BigNumber(ONE);\n\n // Performs 54 loop iterations for n of 9007199254740991.\n for (; ;) {\n\n if (nIsOdd) {\n y = y.times(x);\n if (!y.c) break;\n\n if (k) {\n if (y.c.length > k) y.c.length = k;\n } else if (isModExp) {\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (nIsBig) {\n n = n.times(half);\n round(n, n.e + 1, 1);\n if (!n.c[0]) break;\n nIsBig = n.e > 14;\n nIsOdd = isOdd(n);\n } else {\n n = mathfloor(n / 2);\n if (!n) break;\n nIsOdd = n % 2;\n }\n\n x = x.times(x);\n\n if (k) {\n if (x.c && x.c.length > k) x.c.length = k;\n } else if (isModExp) {\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (isModExp) return y;\n if (nIsNeg) y = ONE.div(y);\n\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\n */\n P.integerValue = function (rm) {\n var n = new BigNumber(this);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n return round(n, n.e + 1, rm);\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isEqualTo = P.eq = function (y, b) {\n return compare(this, new BigNumber(y, b)) === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isGreaterThan = P.gt = function (y, b) {\n return compare(this, new BigNumber(y, b)) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isLessThan = P.lt = function (y, b) {\n return compare(this, new BigNumber(y, b)) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise return false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise return false.\n */\n P.isNegative = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is positive, otherwise return false.\n */\n P.isPositive = function () {\n return this.s > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = function (y, b) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\n\n // Either zero?\n if (!xc[0] || !yc[0]) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if (a = xe - ye) {\n\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for (b = a; b--; t.push(0));\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = (j = yc.length) - (i = xc.length);\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if (b > 0) for (; b--; xc[i++] = 0);\n b = BASE - 1;\n\n // Subtract yc from xc.\n for (; j > a;) {\n\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b);\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\n\n // Zero?\n if (!xc[0]) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise(y, xc, ye);\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function (y, b) {\n var q, s,\n x = this;\n\n y = new BigNumber(y, b);\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n y = x.minus(q.times(y));\n\n // To match JavaScript %, ensure sign of zero is sign of dividend.\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\n\n return y;\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\n * of BigNumber(y, b).\n */\n P.multipliedBy = P.times = function (y, b) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = (y = new BigNumber(y, b)).c;\n\n // Either NaN, ±Infinity or ±0?\n if (!xc || !yc || !xc[0] || !yc[0]) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if (!xc || !yc) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise(y, zc, e);\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = function (y, b) {\n var t,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0);\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for (; a--; t.push(0));\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise(y, xc, ye);\n };\n\n\n /*\n * If sd is undefined or null or true or false, return the number of significant digits of\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n * If sd is true include integer-part trailing zeros in the count.\n *\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\n * boolean: whether to count integer-part trailing zeros: true or false.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.precision = P.sd = function (sd, rm) {\n var c, n, v,\n x = this;\n\n if (sd != null && sd !== !!sd) {\n intCheck(sd, 1, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), sd, rm);\n }\n\n if (!(c = x.c)) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--);\n\n // Add the number of digits of the first element.\n for (v = c[0]; v >= 10; v /= 10, n++);\n }\n\n if (sd && x.e + 1 > n) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\n */\n P.shiftedBy = function (k) {\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n return this.times('1e' + k);\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt(N) = N\n * sqrt(-I) = N\n * sqrt(I) = I\n * sqrt(0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n }\n\n // Initial estimate.\n s = Math.sqrt(+x);\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0;\n\n // Newton-Raphson iteration.\n for (; ;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n =\n coeffToString(r.c)).slice(0, s)) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e)--s;\n n = n.slice(s - 3, s + 1);\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if (n == '9999' || !rep && n == '4999') {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toExponential = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp++;\n }\n return format(this, dp, rm, 1);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toFixed = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp = dp + this.e + 1;\n }\n return format(this, dp, rm);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.set).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toFormat = function (dp, rm) {\n var str = this.toFixed(dp, rm);\n\n if (this.c) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n\n for (; i < len; i += g1) {\n intPart += groupSeparator + intDigits.substr(i, g1);\n }\n\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\n '$&' + FORMAT.fractionGroupSeparator)\n : fractionPart)\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\n *\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\n */\n P.toFraction = function (md) {\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\n x = this,\n xc = x.c;\n\n if (md != null) {\n n = new BigNumber(md);\n\n // Throw if md is less than one or is not an integer, unless it is Infinity.\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\n throw Error\n (bignumberError + 'Argument ' +\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\n }\n }\n\n if (!xc) return x.toString();\n\n d = new BigNumber(ONE);\n n1 = d0 = new BigNumber(ONE);\n d1 = n0 = new BigNumber(ONE);\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for (; ;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.comparedTo(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\n ? [n1.toString(), d1.toString()]\n : [n0.toString(), d0.toString()];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.toPrecision = function (sd, rm) {\n if (sd != null) intCheck(sd, 1, MAX);\n return format(this, sd, rm, 2);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\n *\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if (e === null) {\n\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString(n.c);\n\n if (b == null) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(str, e)\n : toFixedPoint(str, e, '0');\n } else {\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if (e === null) return n.toString();\n\n str = coeffToString(n.c);\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(str, e)\n : toFixedPoint(str, e, '0');\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P._isBigNumber = true;\n\n if (configObject != null) BigNumber.set(configObject);\n\n return BigNumber;\n }", "title": "" }, { "docid": "39e5c9ac794b5340840edacd970b169c", "score": "0.5635967", "text": "static fromSubunitsToDecimal(amount) {\n const inSubunits = new NonExpDecimal(amount.toString(10));\n return new Decimal(inSubunits.dividedBy(this.SUBUNITS));\n }", "title": "" }, { "docid": "039dafc815bc678f4aaa80651c66b2bf", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "57ddc22bc022835f61658d1715a61748", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (hasSymbol) {\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n }\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "ea6b98f03284ffbd462679e286aa95e2", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(n, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof BigNumber)) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\r\n return new BigNumber(n, b);\r\n }\r\n\r\n if (b == null) {\r\n\r\n // Duplicate.\r\n if (n instanceof BigNumber) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = (n = n.c) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum && n * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\r\n\r\n // Faster path for integers.\r\n if (n === ~~n) {\r\n for (e = 0, i = n; i >= 10; i /= 10, e++);\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(n instanceof BigNumber ? n : str);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + n);\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, n + '', isNum, b);\r\n }\r\n }\r\n\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n str = str.slice(i, ++len);\r\n\r\n if (str) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\r\n throw Error\r\n (tooManyDigits + (x.s * n));\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if (e > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var m, n,\r\n i = 0;\r\n\r\n if (isArray(args[0])) args = args[0];\r\n m = new BigNumber(args[0]);\r\n\r\n for (; ++i < args.length;) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.c = x.e = x.s = null;\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + n);\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n nIsOdd = isOdd(n);\r\n } else {\r\n nIsOdd = n % 2;\r\n }\r\n\r\n if (nIsNeg) n.s = 1;\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (nIsBig) {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n if (!n.c[0]) break;\r\n nIsBig = n.e > 14;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n n = mathfloor(n / 2);\r\n if (!n) break;\r\n nIsOdd = n % 2;\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c ).slice(0, s) === (n =\r\n coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function (dp, rm) {\r\n var str = this.toFixed(dp, rm);\r\n\r\n if (this.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n\r\n for (; i < len; i += g1) {\r\n intPart += groupSeparator + intDigits.substr(i, g1);\r\n }\r\n\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + FORMAT.fractionGroupSeparator)\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\r\n }\r\n }\r\n\r\n if (!xc) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\r\n ? [n1.toString(), d1.toString()]\r\n : [n0.toString(), d0.toString()];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString(n.c);\r\n\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "6dd7d14bcaa31e83ba42083798def46a", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz',\r\n alphabetHasNormalDecimalDigits = true;\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10 && alphabetHasNormalDecimalDigits) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if less than two characters,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\r\n alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10 && alphabetHasNormalDecimalDigits) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "039dafc815bc678f4aaa80651c66b2bf", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "ea6b98f03284ffbd462679e286aa95e2", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(n, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof BigNumber)) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\r\n return new BigNumber(n, b);\r\n }\r\n\r\n if (b == null) {\r\n\r\n // Duplicate.\r\n if (n instanceof BigNumber) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = (n = n.c) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum && n * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\r\n\r\n // Faster path for integers.\r\n if (n === ~~n) {\r\n for (e = 0, i = n; i >= 10; i /= 10, e++);\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(n instanceof BigNumber ? n : str);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + n);\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, n + '', isNum, b);\r\n }\r\n }\r\n\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n str = str.slice(i, ++len);\r\n\r\n if (str) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\r\n throw Error\r\n (tooManyDigits + (x.s * n));\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if (e > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var m, n,\r\n i = 0;\r\n\r\n if (isArray(args[0])) args = args[0];\r\n m = new BigNumber(args[0]);\r\n\r\n for (; ++i < args.length;) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.c = x.e = x.s = null;\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + n);\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n nIsOdd = isOdd(n);\r\n } else {\r\n nIsOdd = n % 2;\r\n }\r\n\r\n if (nIsNeg) n.s = 1;\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (nIsBig) {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n if (!n.c[0]) break;\r\n nIsBig = n.e > 14;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n n = mathfloor(n / 2);\r\n if (!n) break;\r\n nIsOdd = n % 2;\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c ).slice(0, s) === (n =\r\n coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function (dp, rm) {\r\n var str = this.toFixed(dp, rm);\r\n\r\n if (this.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n\r\n for (; i < len; i += g1) {\r\n intPart += groupSeparator + intDigits.substr(i, g1);\r\n }\r\n\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + FORMAT.fractionGroupSeparator)\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\r\n }\r\n }\r\n\r\n if (!xc) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\r\n ? [n1.toString(), d1.toString()]\r\n : [n0.toString(), d0.toString()];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString(n.c);\r\n\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "039dafc815bc678f4aaa80651c66b2bf", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "5511d8688cd85cb1b10336929c713511", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz',\r\n alphabetHasNormalDecimalDigits = true;\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10 && alphabetHasNormalDecimalDigits) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if less than two characters,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\r\n alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) {\r\n t = xc;\r\n xc = yc;\r\n yc = t;\r\n y.s = -y.s;\r\n }\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) {\r\n zc = xc;\r\n xc = yc;\r\n yc = zc;\r\n i = xcL;\r\n xcL = ycL;\r\n ycL = i;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) {\r\n t = yc;\r\n yc = xc;\r\n xc = t;\r\n b = a;\r\n }\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) {\r\n i = g1;\r\n g1 = g2;\r\n g2 = i;\r\n len -= i;\r\n }\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10 && alphabetHasNormalDecimalDigits) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "57ddc22bc022835f61658d1715a61748", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (hasSymbol) {\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n }\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "ea6b98f03284ffbd462679e286aa95e2", "score": "0.5600372", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(n, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof BigNumber)) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\r\n return new BigNumber(n, b);\r\n }\r\n\r\n if (b == null) {\r\n\r\n // Duplicate.\r\n if (n instanceof BigNumber) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = (n = n.c) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum && n * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\r\n\r\n // Faster path for integers.\r\n if (n === ~~n) {\r\n for (e = 0, i = n; i >= 10; i /= 10, e++);\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(n instanceof BigNumber ? n : str);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + n);\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, n + '', isNum, b);\r\n }\r\n }\r\n\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n str = str.slice(i, ++len);\r\n\r\n if (str) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\r\n throw Error\r\n (tooManyDigits + (x.s * n));\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if (e > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var m, n,\r\n i = 0;\r\n\r\n if (isArray(args[0])) args = args[0];\r\n m = new BigNumber(args[0]);\r\n\r\n for (; ++i < args.length;) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.c = x.e = x.s = null;\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + n);\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n nIsOdd = isOdd(n);\r\n } else {\r\n nIsOdd = n % 2;\r\n }\r\n\r\n if (nIsNeg) n.s = 1;\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (nIsBig) {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n if (!n.c[0]) break;\r\n nIsBig = n.e > 14;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n n = mathfloor(n / 2);\r\n if (!n) break;\r\n nIsOdd = n % 2;\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c ).slice(0, s) === (n =\r\n coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function (dp, rm) {\r\n var str = this.toFixed(dp, rm);\r\n\r\n if (this.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n\r\n for (; i < len; i += g1) {\r\n intPart += groupSeparator + intDigits.substr(i, g1);\r\n }\r\n\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + FORMAT.fractionGroupSeparator)\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\r\n }\r\n }\r\n\r\n if (!xc) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\r\n ? [n1.toString(), d1.toString()]\r\n : [n0.toString(), d0.toString()];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString(n.c);\r\n\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "babb009e3b2eb1458a8294a946575ecd", "score": "0.552392", "text": "function DecimalType(attrs, opts) {\n avro.types.LogicalType.call(this, attrs, opts);\n\n var precision = attrs.precision;\n if (precision !== (precision | 0) || precision <= 0) {\n throw new Error('invalid precision');\n }\n var scale = attrs.scale;\n if (scale !== (scale | 0) || scale < 0 || scale > precision) {\n throw new Error('invalid scale');\n }\n var type = this.underlyingType;\n if (avro.Type.isType(type, 'fixed')) {\n var size = type.size;\n var maxPrecision = Math.log(Math.pow(2, 8 * size - 1) - 1) / Math.log(10);\n if (precision > (maxPrecision | 0)) {\n throw new Error('fixed size too small to hold required precision');\n }\n }\n this.Decimal = Decimal;\n\n function Decimal(unscaled) { this.unscaled = unscaled; }\n Decimal.prototype.precision = precision;\n Decimal.prototype.scale = scale;\n Decimal.prototype.toNumber = function () {\n return this.unscaled * Math.pow(10, -scale);\n };\n}", "title": "" }, { "docid": "261a460035f880e793b8da0ec30e7dac", "score": "0.5519635", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(n, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof BigNumber)) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\r\n return new BigNumber(n, b);\r\n }\r\n\r\n if (b == null) {\r\n\r\n // Duplicate.\r\n if (n instanceof BigNumber) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = (n = n.c) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum && n * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\r\n\r\n // Faster path for integers.\r\n if (n === ~~n) {\r\n for (e = 0, i = n; i >= 10; i /= 10, e++);\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(n instanceof BigNumber ? n : str);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + n);\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, n + '', isNum, b);\r\n }\r\n }\r\n\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n str = str.slice(i, ++len);\r\n\r\n if (str) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\r\n throw Error\r\n (tooManyDigits + (x.s * n));\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if (e > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var m, n,\r\n i = 0;\r\n\r\n if (isArray(args[0])) args = args[0];\r\n m = new BigNumber(args[0]);\r\n\r\n for (; ++i < args.length;) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.c = x.e = x.s = null;\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + n);\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n nIsOdd = isOdd(n);\r\n } else {\r\n nIsOdd = n % 2;\r\n }\r\n\r\n if (nIsNeg) n.s = 1;\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (nIsBig) {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n if (!n.c[0]) break;\r\n nIsBig = n.e > 14;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n n = mathfloor(n / 2);\r\n if (!n) break;\r\n nIsOdd = n % 2;\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c ).slice(0, s) === (n =\r\n coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function (dp, rm) {\r\n var str = this.toFixed(dp, rm);\r\n\r\n if (this.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n\r\n for (; i < len; i += g1) {\r\n intPart += groupSeparator + intDigits.substr(i, g1);\r\n }\r\n\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + FORMAT.fractionGroupSeparator)\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\r\n }\r\n }\r\n\r\n if (!xc) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\r\n ? [n1.toString(), d1.toString()]\r\n : [n0.toString(), d0.toString()];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString(n.c);\r\n\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n}", "title": "" }, { "docid": "3f1e64bf428f15305662d23a924a8de8", "score": "0.5519635", "text": "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz',\r\n alphabetHasNormalDecimalDigits = true;\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10 && alphabetHasNormalDecimalDigits) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if less than two characters,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\r\n alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10 && alphabetHasNormalDecimalDigits) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n}", "title": "" }, { "docid": "bdb735cb8af8117d485fc676e5008d26", "score": "0.5388905", "text": "static create(model) {\n return internal.instancehelpers.createElement(model, DecimalAttributeType);\n }", "title": "" }, { "docid": "e5b0435725e4d054e3346123f59f0cb6", "score": "0.53811914", "text": "function factory$2 (type, config, load, typed, math) {\n var BigNumber = decimal.clone({precision: config.precision});\n\n /**\n * Attach type information\n */\n BigNumber.prototype.type = 'BigNumber';\n BigNumber.prototype.isBigNumber = true;\n\n /**\n * Get a JSON representation of a BigNumber containing\n * type information\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n */\n BigNumber.prototype.toJSON = function () {\n return {\n mathjs: 'BigNumber',\n value: this.toString()\n };\n };\n\n /**\n * Instantiate a BigNumber from a JSON object\n * @param {Object} json a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n * @return {BigNumber}\n */\n BigNumber.fromJSON = function (json) {\n return new BigNumber(json.value);\n };\n\n // listen for changed in the configuration, automatically apply changed precision\n math.on('config', function (curr, prev) {\n if (curr.precision !== prev.precision) {\n BigNumber.config({ precision: curr.precision });\n }\n });\n\n return BigNumber;\n}", "title": "" }, { "docid": "caff486fdb0ca0fdeed2af3cebd9a002", "score": "0.5290213", "text": "visitDecimalLiteral(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "a3e05e40c84e999e8c88ed3040a32725", "score": "0.5175899", "text": "clone() {\n const clone = new this.constructor(this.model);\n clone.config = Object.assign(clone.config, this.config);\n clone.options = Object.assign(clone.options, this.options);\n return clone;\n }", "title": "" }, { "docid": "4724ffcda04ba270408c41cd33eaad8f", "score": "0.51476735", "text": "function constructorFactory(config) {\n var div, parseNumeric,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.splice(0, 1);\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P.isBigNumber = true;\n\n if ( config != null ) BigNumber.config(config);\n\n return BigNumber;\n }", "title": "" }, { "docid": "4724ffcda04ba270408c41cd33eaad8f", "score": "0.51476735", "text": "function constructorFactory(config) {\n var div, parseNumeric,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.splice(0, 1);\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P.isBigNumber = true;\n\n if ( config != null ) BigNumber.config(config);\n\n return BigNumber;\n }", "title": "" }, { "docid": "4724ffcda04ba270408c41cd33eaad8f", "score": "0.51476735", "text": "function constructorFactory(config) {\n var div, parseNumeric,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.splice(0, 1);\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P.isBigNumber = true;\n\n if ( config != null ) BigNumber.config(config);\n\n return BigNumber;\n }", "title": "" }, { "docid": "4724ffcda04ba270408c41cd33eaad8f", "score": "0.51476735", "text": "function constructorFactory(config) {\n var div, parseNumeric,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.splice(0, 1);\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P.isBigNumber = true;\n\n if ( config != null ) BigNumber.config(config);\n\n return BigNumber;\n }", "title": "" }, { "docid": "4724ffcda04ba270408c41cd33eaad8f", "score": "0.51476735", "text": "function constructorFactory(config) {\n var div, parseNumeric,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.splice(0, 1);\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n P.isBigNumber = true;\n\n if ( config != null ) BigNumber.config(config);\n\n return BigNumber;\n }", "title": "" }, { "docid": "0aae6dba84104db33a8dcd420c0d1e00", "score": "0.513702", "text": "visitMasterDecimalOption(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "214e391ea28aacfba33adef498d3f49e", "score": "0.5090209", "text": "function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n // See GitHub issue: #81.\r\n //if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "275774c16e3895afa863ac2c29126447", "score": "0.5090209", "text": "function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "275774c16e3895afa863ac2c29126447", "score": "0.5090209", "text": "function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "275774c16e3895afa863ac2c29126447", "score": "0.5090209", "text": "function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "214e391ea28aacfba33adef498d3f49e", "score": "0.5090209", "text": "function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n // See GitHub issue: #81.\r\n //if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "12a3499965feefeecf85c2c32c489563", "score": "0.50787634", "text": "function constructorFactory(config) {\r\n\t var div, parseNumeric,\r\n\r\n\t // id tracks the caller function, so its name can be included in error messages.\r\n\t id = 0,\r\n\t P = BigNumber.prototype,\r\n\t ONE = new BigNumber(1),\r\n\r\n\r\n\t /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n\t /*\r\n\t * The default values below must be integers within the inclusive ranges stated.\r\n\t * The values can also be changed at run-time using BigNumber.config.\r\n\t */\r\n\r\n\t // The maximum number of decimal places for operations involving division.\r\n\t DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n\t /*\r\n\t * The rounding mode used when rounding to the above decimal places, and when using\r\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n\t * UP 0 Away from zero.\r\n\t * DOWN 1 Towards zero.\r\n\t * CEIL 2 Towards +Infinity.\r\n\t * FLOOR 3 Towards -Infinity.\r\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n\t */\r\n\t ROUNDING_MODE = 4, // 0 to 8\r\n\r\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n\t // The exponent value at and beneath which toString returns exponential notation.\r\n\t // Number type: -7\r\n\t TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n\t // The exponent value at and above which toString returns exponential notation.\r\n\t // Number type: 21\r\n\t TO_EXP_POS = 21, // 0 to MAX\r\n\r\n\t // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n\t // The minimum exponent value, beneath which underflow to zero occurs.\r\n\t // Number type: -324 (5e-324)\r\n\t MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n\t // The maximum exponent value, above which overflow to Infinity occurs.\r\n\t // Number type: 308 (1.7976931348623157e+308)\r\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n\t MAX_EXP = 1e7, // 1 to MAX\r\n\r\n\t // Whether BigNumber Errors are ever thrown.\r\n\t ERRORS = true, // true or false\r\n\r\n\t // Change to intValidatorNoErrors if ERRORS is false.\r\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n\t // Whether to use cryptographically-secure random number generation, if available.\r\n\t CRYPTO = false, // true or false\r\n\r\n\t /*\r\n\t * The modulo mode used when calculating the modulus: a mod n.\r\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n\t * The remainder (r) is calculated as: r = a - n * q.\r\n\t *\r\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n\t * DOWN 1 The remainder has the same sign as the dividend.\r\n\t * This modulo mode is commonly known as 'truncated division' and is\r\n\t * equivalent to (a % n) in JavaScript.\r\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n\t * The remainder is always positive.\r\n\t *\r\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n\t * modes are commonly used for the modulus operation.\r\n\t * Although the other rounding modes can also be used, they may not give useful results.\r\n\t */\r\n\t MODULO_MODE = 1, // 0 to 9\r\n\r\n\t // The maximum number of significant digits of the result of the toPower operation.\r\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n\t POW_PRECISION = 0, // 0 to MAX\r\n\r\n\t // The format specification used by the BigNumber.prototype.toFormat method.\r\n\t FORMAT = {\r\n\t decimalSeparator: '.',\r\n\t groupSeparator: ',',\r\n\t groupSize: 3,\r\n\t secondaryGroupSize: 0,\r\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\r\n\t fractionGroupSize: 0\r\n\t };\r\n\r\n\r\n\t /******************************************************************************************/\r\n\r\n\r\n\t // CONSTRUCTOR\r\n\r\n\r\n\t /*\r\n\t * The BigNumber constructor and exported function.\r\n\t * Create and return a new instance of a BigNumber object.\r\n\t *\r\n\t * n {number|string|BigNumber} A numeric value.\r\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n\t */\r\n\t function BigNumber( n, b ) {\r\n\t var c, e, i, num, len, str,\r\n\t x = this;\r\n\r\n\t // Enable constructor usage without new.\r\n\t if ( !( x instanceof BigNumber ) ) {\r\n\r\n\t // 'BigNumber() constructor call without new: {n}'\r\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\r\n\t return new BigNumber( n, b );\r\n\t }\r\n\r\n\t // 'new BigNumber() base not an integer: {b}'\r\n\t // 'new BigNumber() base out of range: {b}'\r\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n\t // Duplicate.\r\n\t if ( n instanceof BigNumber ) {\r\n\t x.s = n.s;\r\n\t x.e = n.e;\r\n\t x.c = ( n = n.c ) ? n.slice() : n;\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n\t // Fast path for integers.\r\n\t if ( n === ~~n ) {\r\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n\t x.e = e;\r\n\t x.c = [n];\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t str = n + '';\r\n\t } else {\r\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\t } else {\r\n\t b = b | 0;\r\n\t str = n + '';\r\n\r\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n\t // Allow exponential notation to be used with base 10 argument.\r\n\t if ( b == 10 ) {\r\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\r\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n\t }\r\n\r\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n\t // Any number in exponential form will fail due to the [Ee][+-].\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n\t return parseNumeric( x, str, num, b );\r\n\t }\r\n\r\n\t if (num) {\r\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t raise( id, tooManyDigits, n );\r\n\t }\r\n\r\n\t // Prevent later check for length on converted number.\r\n\t num = false;\r\n\t } else {\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\r\n\t str = convertBase( str, 10, b, x.s );\r\n\t }\r\n\r\n\t // Decimal point?\r\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n\t // Exponential form?\r\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n\t // Determine exponent.\r\n\t if ( e < 0 ) e = i;\r\n\t e += +str.slice( i + 1 );\r\n\t str = str.substring( 0, i );\r\n\t } else if ( e < 0 ) {\r\n\r\n\t // Integer.\r\n\t e = str.length;\r\n\t }\r\n\r\n\t // Determine leading zeros.\r\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n\t str = str.slice( i, len + 1 );\r\n\r\n\t if (str) {\r\n\t len = str.length;\r\n\r\n\t // Disallow numbers with over 15 significant digits if number type.\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n\t raise( id, tooManyDigits, x.s * n );\r\n\t }\r\n\r\n\t e = e - i - 1;\r\n\r\n\t // Overflow?\r\n\t if ( e > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t } else {\r\n\t x.e = e;\r\n\t x.c = [];\r\n\r\n\t // Transform base\r\n\r\n\t // e is the base 10 exponent.\r\n\t // i is where to slice str to get the first element of the coefficient array.\r\n\t i = ( e + 1 ) % LOG_BASE;\r\n\t if ( e < 0 ) i += LOG_BASE;\r\n\r\n\t if ( i < len ) {\r\n\t if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n\t for ( len -= LOG_BASE; i < len; ) {\r\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n\t }\r\n\r\n\t str = str.slice(i);\r\n\t i = LOG_BASE - str.length;\r\n\t } else {\r\n\t i -= len;\r\n\t }\r\n\r\n\t for ( ; i--; str += '0' );\r\n\t x.c.push( +str );\r\n\t }\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\r\n\t id = 0;\r\n\t }\r\n\r\n\r\n\t // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n\t BigNumber.another = constructorFactory;\r\n\r\n\t BigNumber.ROUND_UP = 0;\r\n\t BigNumber.ROUND_DOWN = 1;\r\n\t BigNumber.ROUND_CEIL = 2;\r\n\t BigNumber.ROUND_FLOOR = 3;\r\n\t BigNumber.ROUND_HALF_UP = 4;\r\n\t BigNumber.ROUND_HALF_DOWN = 5;\r\n\t BigNumber.ROUND_HALF_EVEN = 6;\r\n\t BigNumber.ROUND_HALF_CEIL = 7;\r\n\t BigNumber.ROUND_HALF_FLOOR = 8;\r\n\t BigNumber.EUCLID = 9;\r\n\r\n\r\n\t /*\r\n\t * Configure infrequently-changing library-wide settings.\r\n\t *\r\n\t * Accept an object or an argument list, with one or many of the following properties or\r\n\t * parameters respectively:\r\n\t *\r\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n\t * ERRORS {boolean|number} true, false, 1 or 0\r\n\t * CRYPTO {boolean|number} true, false, 1 or 0\r\n\t * MODULO_MODE {number} 0 to 9 inclusive\r\n\t * POW_PRECISION {number} 0 to MAX inclusive\r\n\t * FORMAT {object} See BigNumber.prototype.toFormat\r\n\t * decimalSeparator {string}\r\n\t * groupSeparator {string}\r\n\t * groupSize {number}\r\n\t * secondaryGroupSize {number}\r\n\t * fractionGroupSeparator {string}\r\n\t * fractionGroupSize {number}\r\n\t *\r\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n\t *\r\n\t * E.g.\r\n\t * BigNumber.config(20, 4) is equivalent to\r\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n\t *\r\n\t * Ignore properties/parameters set to null or undefined.\r\n\t * Return an object with the properties current values.\r\n\t */\r\n\t BigNumber.config = BigNumber.set = function () {\r\n\t var v, p,\r\n\t i = 0,\r\n\t r = {},\r\n\t a = arguments,\r\n\t o = a[0],\r\n\t has = o && typeof o == 'object'\r\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\r\n\t // 'config() DECIMAL_PLACES out of range: {v}'\r\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t DECIMAL_PLACES = v | 0;\r\n\t }\r\n\t r[p] = DECIMAL_PLACES;\r\n\r\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n\t // 'config() ROUNDING_MODE not an integer: {v}'\r\n\t // 'config() ROUNDING_MODE out of range: {v}'\r\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n\t ROUNDING_MODE = v | 0;\r\n\t }\r\n\t r[p] = ROUNDING_MODE;\r\n\r\n\t // EXPONENTIAL_AT {number|number[]}\r\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\r\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = v[0] | 0;\r\n\t TO_EXP_POS = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n\t }\r\n\t }\r\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n\t // 'config() RANGE not an integer: {v}'\r\n\t // 'config() RANGE cannot be zero: {v}'\r\n\t // 'config() RANGE out of range: {v}'\r\n\t if ( has( p = 'RANGE' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n\t MIN_EXP = v[0] | 0;\r\n\t MAX_EXP = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n\t }\r\n\t }\r\n\t r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n\t // ERRORS {boolean|number} true, false, 1 or 0.\r\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\r\n\t if ( has( p = 'ERRORS' ) ) {\r\n\r\n\t if ( v === !!v || v === 1 || v === 0 ) {\r\n\t id = 0;\r\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = ERRORS;\r\n\r\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\r\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n\t // 'config() crypto unavailable: {crypto}'\r\n\t if ( has( p = 'CRYPTO' ) ) {\r\n\r\n\t if ( v === true || v === false || v === 1 || v === 0 ) {\r\n\t if (v) {\r\n\t v = typeof crypto == 'undefined';\r\n\t if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n\t CRYPTO = true;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n\t } else {\r\n\t CRYPTO = false;\r\n\t }\r\n\t } else {\r\n\t CRYPTO = false;\r\n\t }\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = CRYPTO;\r\n\r\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n\t // 'config() MODULO_MODE not an integer: {v}'\r\n\t // 'config() MODULO_MODE out of range: {v}'\r\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n\t MODULO_MODE = v | 0;\r\n\t }\r\n\t r[p] = MODULO_MODE;\r\n\r\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() POW_PRECISION not an integer: {v}'\r\n\t // 'config() POW_PRECISION out of range: {v}'\r\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t POW_PRECISION = v | 0;\r\n\t }\r\n\t r[p] = POW_PRECISION;\r\n\r\n\t // FORMAT {object}\r\n\t // 'config() FORMAT not an object: {v}'\r\n\t if ( has( p = 'FORMAT' ) ) {\r\n\r\n\t if ( typeof v == 'object' ) {\r\n\t FORMAT = v;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + ' not an object', v );\r\n\t }\r\n\t }\r\n\t r[p] = FORMAT;\r\n\r\n\t return r;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the maximum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the minimum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n\t * zeros are produced).\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t *\r\n\t * 'random() decimal places not an integer: {dp}'\r\n\t * 'random() decimal places out of range: {dp}'\r\n\t * 'random() crypto unavailable: {crypto}'\r\n\t */\r\n\t BigNumber.random = (function () {\r\n\t var pow2_53 = 0x20000000000000;\r\n\r\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n\t // Check if Math.random() produces more than 32 bits of randomness.\r\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n\t (Math.random() * 0x800000 | 0); };\r\n\r\n\t return function (dp) {\r\n\t var a, b, e, k, v,\r\n\t i = 0,\r\n\t c = [],\r\n\t rand = new BigNumber(ONE);\r\n\r\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n\t k = mathceil( dp / LOG_BASE );\r\n\r\n\t if (CRYPTO) {\r\n\r\n\t // Browsers supporting crypto.getRandomValues.\r\n\t if (crypto.getRandomValues) {\r\n\r\n\t a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 53 bits:\r\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n\t // 11111 11111111 11111111\r\n\t // 0x20000 is 2^21.\r\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n\t // Rejection sampling:\r\n\t // 0 <= v < 9007199254740992\r\n\t // Probability that v >= 9e15, is\r\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n\t if ( v >= 9e15 ) {\r\n\t b = crypto.getRandomValues( new Uint32Array(2) );\r\n\t a[i] = b[0];\r\n\t a[i + 1] = b[1];\r\n\t } else {\r\n\r\n\t // 0 <= v <= 8999999999999999\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 2;\r\n\t }\r\n\t }\r\n\t i = k / 2;\r\n\r\n\t // Node.js supporting crypto.randomBytes.\r\n\t } else if (crypto.randomBytes) {\r\n\r\n\t // buffer\r\n\t a = crypto.randomBytes( k *= 7 );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n\t // 0 <= v < 9007199254740992\r\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n\t if ( v >= 9e15 ) {\r\n\t crypto.randomBytes(7).copy( a, i );\r\n\t } else {\r\n\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 7;\r\n\t }\r\n\t }\r\n\t i = k / 7;\r\n\t } else {\r\n\t CRYPTO = false;\r\n\t if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n\t }\r\n\t }\r\n\r\n\t // Use Math.random.\r\n\t if (!CRYPTO) {\r\n\r\n\t for ( ; i < k; ) {\r\n\t v = random53bitInt();\r\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\r\n\t }\r\n\t }\r\n\r\n\t k = c[--i];\r\n\t dp %= LOG_BASE;\r\n\r\n\t // Convert trailing digits to zeros according to dp.\r\n\t if ( k && dp ) {\r\n\t v = POWS_TEN[LOG_BASE - dp];\r\n\t c[i] = mathfloor( k / v ) * v;\r\n\t }\r\n\r\n\t // Remove trailing elements which are zero.\r\n\t for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n\t // Zero?\r\n\t if ( i < 0 ) {\r\n\t c = [ e = 0 ];\r\n\t } else {\r\n\r\n\t // Remove leading elements which are zero and adjust exponent accordingly.\r\n\t for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n\t // Count the digits of the first element of c to determine leading zeros, and...\r\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n\t // adjust the exponent accordingly.\r\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n\t }\r\n\r\n\t rand.e = e;\r\n\t rand.c = c;\r\n\t return rand;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t // PRIVATE FUNCTIONS\r\n\r\n\r\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n\t function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc = [1].concat(xc);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }\r\n\r\n\r\n\t // Perform division in the specified base. Called by div and convertBase.\r\n\t div = (function () {\r\n\r\n\t // Assume non-zero x and k.\r\n\t function multiply( x, k, base ) {\r\n\t var m, temp, xlo, xhi,\r\n\t carry = 0,\r\n\t i = x.length,\r\n\t klo = k % SQRT_BASE,\r\n\t khi = k / SQRT_BASE | 0;\r\n\r\n\t for ( x = x.slice(); i--; ) {\r\n\t xlo = x[i] % SQRT_BASE;\r\n\t xhi = x[i] / SQRT_BASE | 0;\r\n\t m = khi * xlo + xhi * klo;\r\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n\t x[i] = temp % base;\r\n\t }\r\n\r\n\t if (carry) x = [carry].concat(x);\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t function compare( a, b, aL, bL ) {\r\n\t var i, cmp;\r\n\r\n\t if ( aL != bL ) {\r\n\t cmp = aL > bL ? 1 : -1;\r\n\t } else {\r\n\r\n\t for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n\t if ( a[i] != b[i] ) {\r\n\t cmp = a[i] > b[i] ? 1 : -1;\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t return cmp;\r\n\t }\r\n\r\n\t function subtract( a, b, aL, base ) {\r\n\t var i = 0;\r\n\r\n\t // Subtract b from a.\r\n\t for ( ; aL--; ) {\r\n\t a[aL] -= i;\r\n\t i = a[aL] < b[aL] ? 1 : 0;\r\n\t a[aL] = i * base + a[aL] - b[aL];\r\n\t }\r\n\r\n\t // Remove leading zeros.\r\n\t for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n\t }\r\n\r\n\t // x: dividend, y: divisor.\r\n\t return function ( x, y, dp, rm, base ) {\r\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n\t yL, yz,\r\n\t s = x.s == y.s ? 1 : -1,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t // Either NaN, Infinity or 0?\r\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n\t return new BigNumber(\r\n\r\n\t // Return NaN if either NaN, or both Infinity or 0.\r\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n\t );\r\n\t }\r\n\r\n\t q = new BigNumber(s);\r\n\t qc = q.c = [];\r\n\t e = x.e - y.e;\r\n\t s = dp + e + 1;\r\n\r\n\t if ( !base ) {\r\n\t base = BASE;\r\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n\t s = s / LOG_BASE | 0;\r\n\t }\r\n\r\n\t // Result exponent may be one less then the current value of e.\r\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n\t if ( s < 0 ) {\r\n\t qc.push(1);\r\n\t more = true;\r\n\t } else {\r\n\t xL = xc.length;\r\n\t yL = yc.length;\r\n\t i = 0;\r\n\t s += 2;\r\n\r\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n\t n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n\t if ( n > 1 ) {\r\n\t yc = multiply( yc, n, base );\r\n\t xc = multiply( xc, n, base );\r\n\t yL = yc.length;\r\n\t xL = xc.length;\r\n\t }\r\n\r\n\t xi = yL;\r\n\t rem = xc.slice( 0, yL );\r\n\t remL = rem.length;\r\n\r\n\t // Add zeros to make remainder as long as divisor.\r\n\t for ( ; remL < yL; rem[remL++] = 0 );\r\n\t yz = yc.slice();\r\n\t yz = [0].concat(yz);\r\n\t yc0 = yc[0];\r\n\t if ( yc[1] >= base / 2 ) yc0++;\r\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n\t do {\r\n\t n = 0;\r\n\r\n\t // Compare divisor and remainder.\r\n\t cmp = compare( yc, rem, yL, remL );\r\n\r\n\t // If divisor < remainder.\r\n\t if ( cmp < 0 ) {\r\n\r\n\t // Calculate trial digit, n.\r\n\r\n\t rem0 = rem[0];\r\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n\t // n is how many times the divisor goes into the current remainder.\r\n\t n = mathfloor( rem0 / yc0 );\r\n\r\n\t // Algorithm:\r\n\t // 1. product = divisor * trial digit (n)\r\n\t // 2. if product > remainder: product -= divisor, n--\r\n\t // 3. remainder -= product\r\n\t // 4. if product was < remainder at 2:\r\n\t // 5. compare new remainder and divisor\r\n\t // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n\t if ( n > 1 ) {\r\n\r\n\t // n may be > base only when base is 3.\r\n\t if (n >= base) n = base - 1;\r\n\r\n\t // product = divisor * trial digit.\r\n\t prod = multiply( yc, n, base );\r\n\t prodL = prod.length;\r\n\t remL = rem.length;\r\n\r\n\t // Compare product and remainder.\r\n\t // If product > remainder.\r\n\t // Trial digit n too high.\r\n\t // n is 1 too high about 5% of the time, and is not known to have\r\n\t // ever been more than 1 too high.\r\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n\t n--;\r\n\r\n\t // Subtract divisor from product.\r\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n\t prodL = prod.length;\r\n\t cmp = 1;\r\n\t }\r\n\t } else {\r\n\r\n\t // n is 0 or 1, cmp is -1.\r\n\t // If n is 0, there is no need to compare yc and rem again below,\r\n\t // so change cmp to 1 to avoid it.\r\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n\t if ( n == 0 ) {\r\n\r\n\t // divisor < remainder, so n must be at least 1.\r\n\t cmp = n = 1;\r\n\t }\r\n\r\n\t // product = divisor\r\n\t prod = yc.slice();\r\n\t prodL = prod.length;\r\n\t }\r\n\r\n\t if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n\t // Subtract product from remainder.\r\n\t subtract( rem, prod, remL, base );\r\n\t remL = rem.length;\r\n\r\n\t // If product was < remainder.\r\n\t if ( cmp == -1 ) {\r\n\r\n\t // Compare divisor and new remainder.\r\n\t // If divisor < new remainder, subtract divisor from remainder.\r\n\t // Trial digit n too low.\r\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n\t n++;\r\n\r\n\t // Subtract divisor from remainder.\r\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\r\n\t remL = rem.length;\r\n\t }\r\n\t }\r\n\t } else if ( cmp === 0 ) {\r\n\t n++;\r\n\t rem = [0];\r\n\t } // else cmp === 1 and n will be 0\r\n\r\n\t // Add the next digit, n, to the result array.\r\n\t qc[i++] = n;\r\n\r\n\t // Update the remainder.\r\n\t if ( rem[0] ) {\r\n\t rem[remL++] = xc[xi] || 0;\r\n\t } else {\r\n\t rem = [ xc[xi] ];\r\n\t remL = 1;\r\n\t }\r\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n\t more = rem[0] != null;\r\n\r\n\t // Leading zero?\r\n\t if ( !qc[0] ) qc.splice(0, 1);\r\n\t }\r\n\r\n\t if ( base == BASE ) {\r\n\r\n\t // To calculate q.e, first get the number of digits of qc[0].\r\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n\t // Caller is convertBase.\r\n\t } else {\r\n\t q.e = e;\r\n\t q.r = +more;\r\n\t }\r\n\r\n\t return q;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n\t * notation rounded to the specified decimal places or significant digits.\r\n\t *\r\n\t * n is a BigNumber.\r\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n\t * rm is the rounding mode.\r\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n\t */\r\n\t function format( n, i, rm, caller ) {\r\n\t var c0, e, ne, len, str;\r\n\r\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n\t ? rm | 0 : ROUNDING_MODE;\r\n\r\n\t if ( !n.c ) return n.toString();\r\n\t c0 = n.c[0];\r\n\t ne = n.e;\r\n\r\n\t if ( i == null ) {\r\n\t str = coeffToString( n.c );\r\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n\t ? toExponential( str, ne )\r\n\t : toFixedPoint( str, ne );\r\n\t } else {\r\n\t n = round( new BigNumber(n), i, rm );\r\n\r\n\t // n.e may have changed if the value was rounded up.\r\n\t e = n.e;\r\n\r\n\t str = coeffToString( n.c );\r\n\t len = str.length;\r\n\r\n\t // toPrecision returns exponential notation if the number of significant digits\r\n\t // specified is less than the number of digits necessary to represent the integer\r\n\t // part of the value in fixed-point notation.\r\n\r\n\t // Exponential notation.\r\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n\t // Append zeros?\r\n\t for ( ; len < i; str += '0', len++ );\r\n\t str = toExponential( str, e );\r\n\r\n\t // Fixed-point notation.\r\n\t } else {\r\n\t i -= ne;\r\n\t str = toFixedPoint( str, e );\r\n\r\n\t // Append zeros?\r\n\t if ( e + 1 > len ) {\r\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n\t } else {\r\n\t i += e - len;\r\n\t if ( i > 0 ) {\r\n\t if ( e + 1 == len ) str += '.';\r\n\t for ( ; i--; str += '0' );\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return n.s < 0 && c0 ? '-' + str : str;\r\n\t }\r\n\r\n\r\n\t // Handle BigNumber.max and BigNumber.min.\r\n\t function maxOrMin( args, method ) {\r\n\t var m, n,\r\n\t i = 0;\r\n\r\n\t if ( isArray( args[0] ) ) args = args[0];\r\n\t m = new BigNumber( args[0] );\r\n\r\n\t for ( ; ++i < args.length; ) {\r\n\t n = new BigNumber( args[i] );\r\n\r\n\t // If any number is NaN, return NaN.\r\n\t if ( !n.s ) {\r\n\t m = n;\r\n\t break;\r\n\t } else if ( method.call( m, n ) ) {\r\n\t m = n;\r\n\t }\r\n\t }\r\n\r\n\t return m;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Return true if n is an integer in range, otherwise throw.\r\n\t * Use for argument validation when ERRORS is true.\r\n\t */\r\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\r\n\t if ( n < min || n > max || n != truncate(n) ) {\r\n\t raise( caller, ( name || 'decimal places' ) +\r\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n\t }\r\n\r\n\t return true;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n\t * Called by minus, plus and times.\r\n\t */\r\n\t function normalise( n, c, e ) {\r\n\t var i = 1,\r\n\t j = c.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; !c[--j]; c.pop() );\r\n\r\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n\t // Overflow?\r\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t n.c = n.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t n.c = [ n.e = 0 ];\r\n\t } else {\r\n\t n.e = e;\r\n\t n.c = c;\r\n\t }\r\n\r\n\t return n;\r\n\t }\r\n\r\n\r\n\t // Handle values that fail the validity test in BigNumber.\r\n\t parseNumeric = (function () {\r\n\t var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n\t dotAfter = /^([^.]+)\\.$/,\r\n\t dotBefore = /^\\.([^.]+)$/,\r\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n\t whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n\t return function ( x, str, num, b ) {\r\n\t var base,\r\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n\t // No exception on ±Infinity or NaN.\r\n\t if ( isInfinityOrNaN.test(s) ) {\r\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n\t } else {\r\n\t if ( !num ) {\r\n\r\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n\t return !b || b == base ? p1 : m;\r\n\t });\r\n\r\n\t if (b) {\r\n\t base = b;\r\n\r\n\t // E.g. '1.' to '1', '.1' to '0.1'\r\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n\t }\r\n\r\n\t if ( str != s ) return new BigNumber( s, base );\r\n\t }\r\n\r\n\t // 'new BigNumber() not a number: {n}'\r\n\t // 'new BigNumber() not a base {b} number: {n}'\r\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n\t x.s = null;\r\n\t }\r\n\r\n\t x.c = x.e = null;\r\n\t id = 0;\r\n\t }\r\n\t })();\r\n\r\n\r\n\t // Throw a BigNumber Error.\r\n\t function raise( caller, msg, val ) {\r\n\t var error = new Error( [\r\n\t 'new BigNumber', // 0\r\n\t 'cmp', // 1\r\n\t 'config', // 2\r\n\t 'div', // 3\r\n\t 'divToInt', // 4\r\n\t 'eq', // 5\r\n\t 'gt', // 6\r\n\t 'gte', // 7\r\n\t 'lt', // 8\r\n\t 'lte', // 9\r\n\t 'minus', // 10\r\n\t 'mod', // 11\r\n\t 'plus', // 12\r\n\t 'precision', // 13\r\n\t 'random', // 14\r\n\t 'round', // 15\r\n\t 'shift', // 16\r\n\t 'times', // 17\r\n\t 'toDigits', // 18\r\n\t 'toExponential', // 19\r\n\t 'toFixed', // 20\r\n\t 'toFormat', // 21\r\n\t 'toFraction', // 22\r\n\t 'pow', // 23\r\n\t 'toPrecision', // 24\r\n\t 'toString', // 25\r\n\t 'BigNumber' // 26\r\n\t ][caller] + '() ' + msg + ': ' + val );\r\n\r\n\t error.name = 'BigNumber Error';\r\n\t id = 0;\r\n\t throw error;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\r\n\t */\r\n\t function round( x, sd, rm, r ) {\r\n\t var d, i, j, k, n, ni, rd,\r\n\t xc = x.c,\r\n\t pows10 = POWS_TEN;\r\n\r\n\t // if x is not Infinity or NaN...\r\n\t if (xc) {\r\n\r\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n\t // ni is the index of n within x.c.\r\n\t // d is the number of digits of n.\r\n\t // i is the index of rd within n including leading zeros.\r\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n\t out: {\r\n\r\n\t // Get the number of digits of the first element of xc.\r\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n\t i = sd - d;\r\n\r\n\t // If the rounding digit is in the first element of xc...\r\n\t if ( i < 0 ) {\r\n\t i += LOG_BASE;\r\n\t j = sd;\r\n\t n = xc[ ni = 0 ];\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t } else {\r\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n\t if ( ni >= xc.length ) {\r\n\r\n\t if (r) {\r\n\r\n\t // Needed by sqrt.\r\n\t for ( ; xc.length <= ni; xc.push(0) );\r\n\t n = rd = 0;\r\n\t d = 1;\r\n\t i %= LOG_BASE;\r\n\t j = i - LOG_BASE + 1;\r\n\t } else {\r\n\t break out;\r\n\t }\r\n\t } else {\r\n\t n = k = xc[ni];\r\n\r\n\t // Get the number of digits of n.\r\n\t for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n\t // Get the index of rd within n.\r\n\t i %= LOG_BASE;\r\n\r\n\t // Get the index of rd within n, adjusted for leading zeros.\r\n\t // The number of leading zeros of n is given by LOG_BASE - d.\r\n\t j = i - LOG_BASE + d;\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t }\r\n\t }\r\n\r\n\t r = r || sd < 0 ||\r\n\r\n\t // Are there any non-zero digits after the rounding digit?\r\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n\t r = rm < 4\r\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n\t // Check whether the digit to the left of the rounding digit is odd.\r\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( sd < 1 || !xc[0] ) {\r\n\t xc.length = 0;\r\n\r\n\t if (r) {\r\n\r\n\t // Convert sd to decimal places.\r\n\t sd -= x.e + 1;\r\n\r\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n\t xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n\t x.e = -sd || 0;\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t xc[0] = x.e = 0;\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t // Remove excess digits.\r\n\t if ( i == 0 ) {\r\n\t xc.length = ni;\r\n\t k = 1;\r\n\t ni--;\r\n\t } else {\r\n\t xc.length = ni + 1;\r\n\t k = pows10[ LOG_BASE - i ];\r\n\r\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n\t // j > 0 means i > number of leading zeros of n.\r\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n\t }\r\n\r\n\t // Round up?\r\n\t if (r) {\r\n\r\n\t for ( ; ; ) {\r\n\r\n\t // If the digit to be rounded up is in the first element of xc...\r\n\t if ( ni == 0 ) {\r\n\r\n\t // i will be the length of xc[0] before k is added.\r\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n\t j = xc[0] += k;\r\n\t for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n\t // if i != k the length has increased.\r\n\t if ( i != k ) {\r\n\t x.e++;\r\n\t if ( xc[0] == BASE ) xc[0] = 1;\r\n\t }\r\n\r\n\t break;\r\n\t } else {\r\n\t xc[ni] += k;\r\n\t if ( xc[ni] != BASE ) break;\r\n\t xc[ni--] = 0;\r\n\t k = 1;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n\t }\r\n\r\n\t // Overflow? Infinity.\r\n\t if ( x.e > MAX_EXP ) {\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow? Zero.\r\n\t } else if ( x.e < MIN_EXP ) {\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\r\n\t // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n\t */\r\n\t P.absoluteValue = P.abs = function () {\r\n\t var x = new BigNumber(this);\r\n\t if ( x.s < 0 ) x.s = 1;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of Infinity.\r\n\t */\r\n\t P.ceil = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 2 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return\r\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * 0 if they have the same value,\r\n\t * or null if the value of either is NaN.\r\n\t */\r\n\t P.comparedTo = P.cmp = function ( y, b ) {\r\n\t id = 1;\r\n\t return compare( this, new BigNumber( y, b ) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n\t * of this BigNumber is ±Infinity or NaN.\r\n\t */\r\n\t P.decimalPlaces = P.dp = function () {\r\n\t var n, v,\r\n\t c = this.c;\r\n\r\n\t if ( !c ) return null;\r\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n\t // Subtract the number of trailing zeros of the last number.\r\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n\t if ( n < 0 ) n = 0;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n / 0 = I\r\n\t * n / N = N\r\n\t * n / I = 0\r\n\t * 0 / n = 0\r\n\t * 0 / 0 = N\r\n\t * 0 / N = N\r\n\t * 0 / I = 0\r\n\t * N / n = N\r\n\t * N / 0 = N\r\n\t * N / N = N\r\n\t * N / I = N\r\n\t * I / n = I\r\n\t * I / 0 = I\r\n\t * I / N = N\r\n\t * I / I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.dividedBy = P.div = function ( y, b ) {\r\n\t id = 3;\r\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n\t * BigNumber by the value of BigNumber(y, b).\r\n\t */\r\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n\t id = 4;\r\n\t return div( this, new BigNumber( y, b ), 0, 1 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.equals = P.eq = function ( y, b ) {\r\n\t id = 5;\r\n\t return compare( this, new BigNumber( y, b ) ) === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of -Infinity.\r\n\t */\r\n\t P.floor = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 3 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.greaterThan = P.gt = function ( y, b ) {\r\n\t id = 6;\r\n\t return compare( this, new BigNumber( y, b ) ) > 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n\t id = 7;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n\t */\r\n\t P.isFinite = function () {\r\n\t return !!this.c;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n\t */\r\n\t P.isInteger = P.isInt = function () {\r\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n\t */\r\n\t P.isNaN = function () {\r\n\t return !this.s;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n\t */\r\n\t P.isNegative = P.isNeg = function () {\r\n\t return this.s < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n\t */\r\n\t P.isZero = function () {\r\n\t return !!this.c && this.c[0] == 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.lessThan = P.lt = function ( y, b ) {\r\n\t id = 8;\r\n\t return compare( this, new BigNumber( y, b ) ) < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n\t id = 9;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n - 0 = n\r\n\t * n - N = N\r\n\t * n - I = -I\r\n\t * 0 - n = -n\r\n\t * 0 - 0 = 0\r\n\t * 0 - N = N\r\n\t * 0 - I = -I\r\n\t * N - n = N\r\n\t * N - 0 = N\r\n\t * N - N = N\r\n\t * N - I = N\r\n\t * I - n = I\r\n\t * I - 0 = I\r\n\t * I - N = N\r\n\t * I - I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.minus = P.sub = function ( y, b ) {\r\n\t var i, j, t, xLTy,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 10;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.plus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Either Infinity?\r\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n\t // Either zero?\r\n\t if ( !xc[0] || !yc[0] ) {\r\n\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n\t ROUNDING_MODE == 3 ? -0 : 0 );\r\n\t }\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Determine which is the bigger number.\r\n\t if ( a = xe - ye ) {\r\n\r\n\t if ( xLTy = a < 0 ) {\r\n\t a = -a;\r\n\t t = xc;\r\n\t } else {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\r\n\t // Prepend zeros to equalise exponents.\r\n\t for ( b = a; b--; t.push(0) );\r\n\t t.reverse();\r\n\t } else {\r\n\r\n\t // Exponents equal. Check digit by digit.\r\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n\t for ( a = b = 0; b < j; b++ ) {\r\n\r\n\t if ( xc[b] != yc[b] ) {\r\n\t xLTy = xc[b] < yc[b];\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // x < y? Point xc to the array of the bigger number.\r\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n\t b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n\t // Append zeros to xc if shorter.\r\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n\t b = BASE - 1;\r\n\r\n\t // Subtract yc from xc.\r\n\t for ( ; j > a; ) {\r\n\r\n\t if ( xc[--j] < yc[j] ) {\r\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\r\n\t --xc[i];\r\n\t xc[j] += BASE;\r\n\t }\r\n\r\n\t xc[j] -= yc[j];\r\n\t }\r\n\r\n\t // Remove leading zeros and adjust exponent accordingly.\r\n\t for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n\t // Zero?\r\n\t if ( !xc[0] ) {\r\n\r\n\t // Following IEEE 754 (2008) 6.3,\r\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n\t y.c = [ y.e = 0 ];\r\n\t return y;\r\n\t }\r\n\r\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n\t // for finite x and y.\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n % 0 = N\r\n\t * n % N = N\r\n\t * n % I = n\r\n\t * 0 % n = 0\r\n\t * -0 % n = -0\r\n\t * 0 % 0 = N\r\n\t * 0 % N = N\r\n\t * 0 % I = 0\r\n\t * N % n = N\r\n\t * N % 0 = N\r\n\t * N % N = N\r\n\t * N % I = N\r\n\t * I % n = N\r\n\t * I % 0 = N\r\n\t * I % N = N\r\n\t * I % I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n\t */\r\n\t P.modulo = P.mod = function ( y, b ) {\r\n\t var q, s,\r\n\t x = this;\r\n\r\n\t id = 11;\r\n\t y = new BigNumber( y, b );\r\n\r\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n\t return new BigNumber(NaN);\r\n\r\n\t // Return x if y is Infinity or x is zero.\r\n\t } else if ( !y.c || x.c && !x.c[0] ) {\r\n\t return new BigNumber(x);\r\n\t }\r\n\r\n\t if ( MODULO_MODE == 9 ) {\r\n\r\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n\t // r = x - qy where 0 <= r < abs(y)\r\n\t s = y.s;\r\n\t y.s = 1;\r\n\t q = div( x, y, 0, 3 );\r\n\t y.s = s;\r\n\t q.s *= s;\r\n\t } else {\r\n\t q = div( x, y, 0, MODULO_MODE );\r\n\t }\r\n\r\n\t return x.minus( q.times(y) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n\t * i.e. multiplied by -1.\r\n\t */\r\n\t P.negated = P.neg = function () {\r\n\t var x = new BigNumber(this);\r\n\t x.s = -x.s || null;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n + 0 = n\r\n\t * n + N = N\r\n\t * n + I = I\r\n\t * 0 + n = n\r\n\t * 0 + 0 = 0\r\n\t * 0 + N = N\r\n\t * 0 + I = I\r\n\t * N + n = N\r\n\t * N + 0 = N\r\n\t * N + N = N\r\n\t * N + I = N\r\n\t * I + n = I\r\n\t * I + 0 = I\r\n\t * I + N = N\r\n\t * I + I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.plus = P.add = function ( y, b ) {\r\n\t var t,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 12;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.minus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Return ±Infinity if either ±Infinity.\r\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n\t // Either zero?\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n\t if ( a = xe - ye ) {\r\n\t if ( a > 0 ) {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t } else {\r\n\t a = -a;\r\n\t t = xc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\t for ( ; a--; t.push(0) );\r\n\t t.reverse();\r\n\t }\r\n\r\n\t a = xc.length;\r\n\t b = yc.length;\r\n\r\n\t // Point xc to the longer array, and b to the shorter length.\r\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n\t for ( a = 0; b; ) {\r\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n\t xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n\t }\r\n\r\n\t if (a) {\r\n\t xc = [a].concat(xc);\r\n\t ++ye;\r\n\t }\r\n\r\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n\t // ye = MAX_EXP + 1 possible\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of significant digits of the value of this BigNumber.\r\n\t *\r\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n\t */\r\n\t P.precision = P.sd = function (z) {\r\n\t var n, v,\r\n\t x = this,\r\n\t c = x.c;\r\n\r\n\t // 'precision() argument not a boolean or binary digit: {z}'\r\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n\t if ( z != !!z ) z = null;\r\n\t }\r\n\r\n\t if ( !c ) return null;\r\n\t v = c.length - 1;\r\n\t n = v * LOG_BASE + 1;\r\n\r\n\t if ( v = c[v] ) {\r\n\r\n\t // Subtract the number of trailing zeros of the last element.\r\n\t for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n\t // Add the number of digits of the first element.\r\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n\t }\r\n\r\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n\t * omitted.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'round() decimal places out of range: {dp}'\r\n\t * 'round() decimal places not an integer: {dp}'\r\n\t * 'round() rounding mode not an integer: {rm}'\r\n\t * 'round() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.round = function ( dp, rm ) {\r\n\t var n = new BigNumber(this);\r\n\r\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n\t round( n, ~~dp + this.e + 1, rm == null ||\r\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n\t }\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n\t *\r\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t *\r\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n\t * otherwise.\r\n\t *\r\n\t * 'shift() argument not an integer: {k}'\r\n\t * 'shift() argument out of range: {k}'\r\n\t */\r\n\t P.shift = function (k) {\r\n\t var n = this;\r\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\r\n\t ? n.times( '1e' + truncate(k) )\r\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n\t : n );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * sqrt(-n) = N\r\n\t * sqrt( N) = N\r\n\t * sqrt(-I) = N\r\n\t * sqrt( I) = I\r\n\t * sqrt( 0) = 0\r\n\t * sqrt(-0) = -0\r\n\t *\r\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.squareRoot = P.sqrt = function () {\r\n\t var m, n, r, rep, t,\r\n\t x = this,\r\n\t c = x.c,\r\n\t s = x.s,\r\n\t e = x.e,\r\n\t dp = DECIMAL_PLACES + 4,\r\n\t half = new BigNumber('0.5');\r\n\r\n\t // Negative/NaN/Infinity/zero?\r\n\t if ( s !== 1 || !c || !c[0] ) {\r\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n\t }\r\n\r\n\t // Initial estimate.\r\n\t s = Math.sqrt( +x );\r\n\r\n\t // Math.sqrt underflow/overflow?\r\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n\t if ( s == 0 || s == 1 / 0 ) {\r\n\t n = coeffToString(c);\r\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n\t s = Math.sqrt(n);\r\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n\t if ( s == 1 / 0 ) {\r\n\t n = '1e' + e;\r\n\t } else {\r\n\t n = s.toExponential();\r\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n\t }\r\n\r\n\t r = new BigNumber(n);\r\n\t } else {\r\n\t r = new BigNumber( s + '' );\r\n\t }\r\n\r\n\t // Check for zero.\r\n\t // r could be zero if MIN_EXP is changed after the this value was created.\r\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n\t // coeffToString to throw.\r\n\t if ( r.c[0] ) {\r\n\t e = r.e;\r\n\t s = e + dp;\r\n\t if ( s < 3 ) s = 0;\r\n\r\n\t // Newton-Raphson iteration.\r\n\t for ( ; ; ) {\r\n\t t = r;\r\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n\t // The exponent of r may here be one less than the final result exponent,\r\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n\t // are indexed correctly.\r\n\t if ( r.e < e ) --s;\r\n\t n = n.slice( s - 3, s + 1 );\r\n\r\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n\t // iteration.\r\n\t if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n\t // On the first iteration only, check to see if rounding up gives the\r\n\t // exact result as the nines may infinitely repeat.\r\n\t if ( !rep ) {\r\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n\t if ( t.times(t).eq(x) ) {\r\n\t r = t;\r\n\t break;\r\n\t }\r\n\t }\r\n\r\n\t dp += 4;\r\n\t s += 4;\r\n\t rep = 1;\r\n\t } else {\r\n\r\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n\t // result. If not, then there are further digits and m will be truthy.\r\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n\t // Truncate to the first rounding digit.\r\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n\t m = !r.times(r).eq(x);\r\n\t }\r\n\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n * 0 = 0\r\n\t * n * N = N\r\n\t * n * I = I\r\n\t * 0 * n = 0\r\n\t * 0 * 0 = 0\r\n\t * 0 * N = N\r\n\t * 0 * I = N\r\n\t * N * n = N\r\n\t * N * 0 = N\r\n\t * N * N = N\r\n\t * N * I = N\r\n\t * I * n = I\r\n\t * I * 0 = N\r\n\t * I * N = N\r\n\t * I * I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.times = P.mul = function ( y, b ) {\r\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n\t base, sqrtBase,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n\t // Either NaN, ±Infinity or ±0?\r\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n\t y.c = y.e = y.s = null;\r\n\t } else {\r\n\t y.s *= x.s;\r\n\r\n\t // Return ±Infinity if either is ±Infinity.\r\n\t if ( !xc || !yc ) {\r\n\t y.c = y.e = null;\r\n\r\n\t // Return ±0 if either is ±0.\r\n\t } else {\r\n\t y.c = [0];\r\n\t y.e = 0;\r\n\t }\r\n\t }\r\n\r\n\t return y;\r\n\t }\r\n\r\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n\t y.s *= x.s;\r\n\t xcL = xc.length;\r\n\t ycL = yc.length;\r\n\r\n\t // Ensure xc points to longer array and xcL to its length.\r\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n\t // Initialise the result array with zeros.\r\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n\t base = BASE;\r\n\t sqrtBase = SQRT_BASE;\r\n\r\n\t for ( i = ycL; --i >= 0; ) {\r\n\t c = 0;\r\n\t ylo = yc[i] % sqrtBase;\r\n\t yhi = yc[i] / sqrtBase | 0;\r\n\r\n\t for ( k = xcL, j = i + k; j > i; ) {\r\n\t xlo = xc[--k] % sqrtBase;\r\n\t xhi = xc[k] / sqrtBase | 0;\r\n\t m = yhi * xlo + xhi * ylo;\r\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n\t zc[j--] = xlo % base;\r\n\t }\r\n\r\n\t zc[j] = c;\r\n\t }\r\n\r\n\t if (c) {\r\n\t ++e;\r\n\t } else {\r\n\t zc.splice(0, 1);\r\n\t }\r\n\r\n\t return normalise( y, zc, e );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toDigits() precision out of range: {sd}'\r\n\t * 'toDigits() precision not an integer: {sd}'\r\n\t * 'toDigits() rounding mode not an integer: {rm}'\r\n\t * 'toDigits() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toDigits = function ( sd, rm ) {\r\n\t var n = new BigNumber(this);\r\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n\t return sd ? round( n, sd, rm ) : n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in exponential notation and\r\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toExponential() decimal places not an integer: {dp}'\r\n\t * 'toExponential() decimal places out of range: {dp}'\r\n\t * 'toExponential() rounding mode not an integer: {rm}'\r\n\t * 'toExponential() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toExponential = function ( dp, rm ) {\r\n\t return format( this,\r\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFixed() decimal places not an integer: {dp}'\r\n\t * 'toFixed() decimal places out of range: {dp}'\r\n\t * 'toFixed() rounding mode not an integer: {rm}'\r\n\t * 'toFixed() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFixed = function ( dp, rm ) {\r\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n\t * of the FORMAT object (see BigNumber.config).\r\n\t *\r\n\t * FORMAT = {\r\n\t * decimalSeparator : '.',\r\n\t * groupSeparator : ',',\r\n\t * groupSize : 3,\r\n\t * secondaryGroupSize : 0,\r\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n\t * fractionGroupSize : 0\r\n\t * };\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFormat() decimal places not an integer: {dp}'\r\n\t * 'toFormat() decimal places out of range: {dp}'\r\n\t * 'toFormat() rounding mode not an integer: {rm}'\r\n\t * 'toFormat() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFormat = function ( dp, rm ) {\r\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n\t if ( this.c ) {\r\n\t var i,\r\n\t arr = str.split('.'),\r\n\t g1 = +FORMAT.groupSize,\r\n\t g2 = +FORMAT.secondaryGroupSize,\r\n\t groupSeparator = FORMAT.groupSeparator,\r\n\t intPart = arr[0],\r\n\t fractionPart = arr[1],\r\n\t isNeg = this.s < 0,\r\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\r\n\t len = intDigits.length;\r\n\r\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n\t if ( g1 > 0 && len > 0 ) {\r\n\t i = len % g1 || g1;\r\n\t intPart = intDigits.substr( 0, i );\r\n\r\n\t for ( ; i < len; i += g1 ) {\r\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\r\n\t }\r\n\r\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n\t if (isNeg) intPart = '-' + intPart;\r\n\t }\r\n\r\n\t str = fractionPart\r\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n\t '$&' + FORMAT.fractionGroupSeparator )\r\n\t : fractionPart )\r\n\t : intPart;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\r\n\t * an integer numerator and an integer denominator. The denominator will be a positive\r\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n\t * denominator is not specified, the denominator will be the lowest value necessary to\r\n\t * represent the number exactly.\r\n\t *\r\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n\t *\r\n\t * 'toFraction() max denominator not an integer: {md}'\r\n\t * 'toFraction() max denominator out of range: {md}'\r\n\t */\r\n\t P.toFraction = function (md) {\r\n\t var arr, d0, d2, e, exp, n, n0, q, s,\r\n\t k = ERRORS,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t d = new BigNumber(ONE),\r\n\t n1 = d0 = new BigNumber(ONE),\r\n\t d1 = n0 = new BigNumber(ONE);\r\n\r\n\t if ( md != null ) {\r\n\t ERRORS = false;\r\n\t n = new BigNumber(md);\r\n\t ERRORS = k;\r\n\r\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n\t if (ERRORS) {\r\n\t raise( 22,\r\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n\t }\r\n\r\n\t // ERRORS is false:\r\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n\t }\r\n\t }\r\n\r\n\t if ( !xc ) return x.toString();\r\n\t s = coeffToString(xc);\r\n\r\n\t // Determine initial denominator.\r\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n\t e = d.e = s.length - x.e - 1;\r\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n\t exp = MAX_EXP;\r\n\t MAX_EXP = 1 / 0;\r\n\t n = new BigNumber(s);\r\n\r\n\t // n0 = d1 = 0\r\n\t n0.c[0] = 0;\r\n\r\n\t for ( ; ; ) {\r\n\t q = div( n, d, 0, 1 );\r\n\t d2 = d0.plus( q.times(d1) );\r\n\t if ( d2.cmp(md) == 1 ) break;\r\n\t d0 = d1;\r\n\t d1 = d2;\r\n\t n1 = n0.plus( q.times( d2 = n1 ) );\r\n\t n0 = d2;\r\n\t d = n.minus( q.times( d2 = d ) );\r\n\t n = d2;\r\n\t }\r\n\r\n\t d2 = div( md.minus(d0), d1, 0, 1 );\r\n\t n0 = n0.plus( d2.times(n1) );\r\n\t d0 = d0.plus( d2.times(d1) );\r\n\t n0.s = n1.s = x.s;\r\n\t e *= 2;\r\n\r\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n\t ? [ n1.toString(), d1.toString() ]\r\n\t : [ n0.toString(), d0.toString() ];\r\n\r\n\t MAX_EXP = exp;\r\n\t return arr;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the value of this BigNumber converted to a number primitive.\r\n\t */\r\n\t P.toNumber = function () {\r\n\t return +this;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n\t * If m is present, return the result modulo m.\r\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n\t * ROUNDING_MODE.\r\n\t *\r\n\t * The modular power operation works efficiently when x, n, and m are positive integers,\r\n\t * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n\t *\r\n\t * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t * [m] {number|string|BigNumber} The modulus.\r\n\t *\r\n\t * 'pow() exponent not an integer: {n}'\r\n\t * 'pow() exponent out of range: {n}'\r\n\t *\r\n\t * Performs 54 loop iterations for n of 9007199254740991.\r\n\t */\r\n\t P.toPower = P.pow = function ( n, m ) {\r\n\t var k, y, z,\r\n\t i = mathfloor( n < 0 ? -n : +n ),\r\n\t x = this;\r\n\r\n\t if ( m != null ) {\r\n\t id = 23;\r\n\t m = new BigNumber(m);\r\n\t }\r\n\r\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\r\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n\t parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n\t k = Math.pow( +x, n );\r\n\t return new BigNumber( m ? k % m : k );\r\n\t }\r\n\r\n\t if (m) {\r\n\t if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n\t x = x.mod(m);\r\n\t } else {\r\n\t z = m;\r\n\r\n\t // Nullify m so only a single mod operation is performed at the end.\r\n\t m = null;\r\n\t }\r\n\t } else if (POW_PRECISION) {\r\n\r\n\t // Truncating each coefficient array to a length of k after each multiplication\r\n\t // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n\t // i.e. there will be a minimum of 28 guard digits retained.\r\n\t // (Using + 1.5 would give [9, 21] guard digits.)\r\n\t k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n\t }\r\n\r\n\t y = new BigNumber(ONE);\r\n\r\n\t for ( ; ; ) {\r\n\t if ( i % 2 ) {\r\n\t y = y.times(x);\r\n\t if ( !y.c ) break;\r\n\t if (k) {\r\n\t if ( y.c.length > k ) y.c.length = k;\r\n\t } else if (m) {\r\n\t y = y.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t i = mathfloor( i / 2 );\r\n\t if ( !i ) break;\r\n\t x = x.times(x);\r\n\t if (k) {\r\n\t if ( x.c && x.c.length > k ) x.c.length = k;\r\n\t } else if (m) {\r\n\t x = x.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t if (m) return y;\r\n\t if ( n < 0 ) y = ONE.div(y);\r\n\r\n\t return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\r\n\t * exponential notation.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toPrecision() precision not an integer: {sd}'\r\n\t * 'toPrecision() precision out of range: {sd}'\r\n\t * 'toPrecision() rounding mode not an integer: {rm}'\r\n\t * 'toPrecision() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toPrecision = function ( sd, rm ) {\r\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n\t ? sd | 0 : null, rm, 24 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n\t * TO_EXP_NEG, return exponential notation.\r\n\t *\r\n\t * [b] {number} Integer, 2 to 64 inclusive.\r\n\t *\r\n\t * 'toString() base not an integer: {b}'\r\n\t * 'toString() base out of range: {b}'\r\n\t */\r\n\t P.toString = function (b) {\r\n\t var str,\r\n\t n = this,\r\n\t s = n.s,\r\n\t e = n.e;\r\n\r\n\t // Infinity or NaN?\r\n\t if ( e === null ) {\r\n\r\n\t if (s) {\r\n\t str = 'Infinity';\r\n\t if ( s < 0 ) str = '-' + str;\r\n\t } else {\r\n\t str = 'NaN';\r\n\t }\r\n\t } else {\r\n\t str = coeffToString( n.c );\r\n\r\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\t } else {\r\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n\t }\r\n\r\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n\t * number.\r\n\t */\r\n\t P.truncated = P.trunc = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 1 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return as toString, but do not accept a base argument, and include the minus sign for\r\n\t * negative zero.\r\n\t */\r\n\t P.valueOf = P.toJSON = function () {\r\n\t var str,\r\n\t n = this,\r\n\t e = n.e;\r\n\r\n\t if ( e === null ) return n.toString();\r\n\r\n\t str = coeffToString( n.c );\r\n\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\r\n\t return n.s < 0 ? '-' + str : str;\r\n\t };\r\n\r\n\r\n\t P.isBigNumber = true;\r\n\r\n\t if ( config != null ) BigNumber.config(config);\r\n\r\n\t return BigNumber;\r\n\t }", "title": "" }, { "docid": "e9d4d75fc7cf93fda4a8bb8c782f88b6", "score": "0.506543", "text": "toDecimal(currency) { return priceToDecimal(this.value(currency)); }", "title": "" }, { "docid": "83ed436e821c17e0f169ea432fc95e65", "score": "0.5027139", "text": "get answerDecimal () {\n\t\treturn this._answerDecimal;\n\t}", "title": "" }, { "docid": "b0142888dc90e4f41d4536234b4420ee", "score": "0.5021667", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal$1 || obj && obj.name === \"[object Decimal]\" || false;\n }", "title": "" }, { "docid": "429f446e653b123f52f41ac47f306308", "score": "0.5018953", "text": "visitDecimalMasterOption(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "title": "" }, { "docid": "e99e1349c0de865de026091c56ef398a", "score": "0.49950567", "text": "function configFactory(config, emit) {\n /**\n * Set configuration options for math.js, and get current options.\n * Will emit a 'config' event, with arguments (curr, prev, changes).\n *\n * This function is only available on a mathjs instance created using `create`.\n *\n * Syntax:\n *\n * math.config(config: Object): Object\n *\n * Examples:\n *\n *\n * import { create, all } from 'mathjs'\n *\n * // create a mathjs instance\n * const math = create(all)\n *\n * math.config().number // outputs 'number'\n * math.evaluate('0.4') // outputs number 0.4\n * math.config({number: 'Fraction'})\n * math.evaluate('0.4') // outputs Fraction 2/5\n *\n * @param {Object} [options] Available options:\n * {number} epsilon\n * Minimum relative difference between two\n * compared values, used by all comparison functions.\n * {string} matrix\n * A string 'Matrix' (default) or 'Array'.\n * {string} number\n * A string 'number' (default), 'BigNumber', or 'Fraction'\n * {number} precision\n * The number of significant digits for BigNumbers.\n * Not applicable for Numbers.\n * {string} parenthesis\n * How to display parentheses in LaTeX and string\n * output.\n * {string} randomSeed\n * Random seed for seeded pseudo random number generator.\n * Set to null to randomly seed.\n * @return {Object} Returns the current configuration\n */\n function _config(options) {\n if (options) {\n var prev = Object(utils_object[\"i\" /* mapObject */])(config, utils_object[\"a\" /* clone */]); // validate some of the options\n\n validateOption(options, 'matrix', MATRIX_OPTIONS);\n validateOption(options, 'number', NUMBER_OPTIONS); // merge options\n\n Object(utils_object[\"b\" /* deepExtend */])(config, options);\n var curr = Object(utils_object[\"i\" /* mapObject */])(config, utils_object[\"a\" /* clone */]);\n var changes = Object(utils_object[\"i\" /* mapObject */])(options, utils_object[\"a\" /* clone */]); // emit 'config' event\n\n emit('config', curr, prev, changes);\n return curr;\n } else {\n return Object(utils_object[\"i\" /* mapObject */])(config, utils_object[\"a\" /* clone */]);\n }\n } // attach the valid options to the function so they can be extended\n\n\n _config.MATRIX_OPTIONS = MATRIX_OPTIONS;\n _config.NUMBER_OPTIONS = NUMBER_OPTIONS; // attach the config properties as readonly properties to the config function\n\n Object.keys(DEFAULT_CONFIG).forEach(function (key) {\n Object.defineProperty(_config, key, {\n get: function get() {\n return config[key];\n },\n enumerable: true,\n configurable: true\n });\n });\n return _config;\n}", "title": "" }, { "docid": "7c83235bb3fbded139607eb485d8653c", "score": "0.4965981", "text": "function configFactory(config, emit) {\n /**\n * Set configuration options for math.js, and get current options.\n * Will emit a 'config' event, with arguments (curr, prev, changes).\n *\n * This function is only available on a mathjs instance created using `create`.\n *\n * Syntax:\n *\n * math.config(config: Object): Object\n *\n * Examples:\n *\n *\n * import { create, all } from 'mathjs'\n *\n * // create a mathjs instance\n * const math = create(all)\n *\n * math.config().number // outputs 'number'\n * math.evaluate('0.4') // outputs number 0.4\n * math.config({number: 'Fraction'})\n * math.evaluate('0.4') // outputs Fraction 2/5\n *\n * @param {Object} [options] Available options:\n * {number} epsilon\n * Minimum relative difference between two\n * compared values, used by all comparison functions.\n * {string} matrix\n * A string 'Matrix' (default) or 'Array'.\n * {string} number\n * A string 'number' (default), 'BigNumber', or 'Fraction'\n * {number} precision\n * The number of significant digits for BigNumbers.\n * Not applicable for Numbers.\n * {string} parenthesis\n * How to display parentheses in LaTeX and string\n * output.\n * {string} randomSeed\n * Random seed for seeded pseudo random number generator.\n * Set to null to randomly seed.\n * @return {Object} Returns the current configuration\n */\n function _config(options) {\n if (options) {\n var prev = Object(_utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"mapObject\"])(config, _utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"clone\"]); // validate some of the options\n\n validateOption(options, 'matrix', MATRIX_OPTIONS);\n validateOption(options, 'number', NUMBER_OPTIONS); // merge options\n\n Object(_utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"deepExtend\"])(config, options);\n var curr = Object(_utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"mapObject\"])(config, _utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"clone\"]);\n var changes = Object(_utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"mapObject\"])(options, _utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"clone\"]); // emit 'config' event\n\n emit('config', curr, prev, changes);\n return curr;\n } else {\n return Object(_utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"mapObject\"])(config, _utils_object_js__WEBPACK_IMPORTED_MODULE_0__[\"clone\"]);\n }\n } // attach the valid options to the function so they can be extended\n\n\n _config.MATRIX_OPTIONS = MATRIX_OPTIONS;\n _config.NUMBER_OPTIONS = NUMBER_OPTIONS; // attach the config properties as readonly properties to the config function\n\n Object.keys(_config_js__WEBPACK_IMPORTED_MODULE_1__[\"DEFAULT_CONFIG\"]).forEach(key => {\n Object.defineProperty(_config, key, {\n get: () => config[key],\n enumerable: true,\n configurable: true\n });\n });\n return _config;\n}", "title": "" }, { "docid": "df5123a6ef625b78be552ff2323bda51", "score": "0.49637434", "text": "bc(val) {\n this._bc = val;\n return this;\n }", "title": "" }, { "docid": "2939f5196e0abb8557eb0558b5932074", "score": "0.4931067", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\n }", "title": "" }, { "docid": "2939f5196e0abb8557eb0558b5932074", "score": "0.4931067", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\n }", "title": "" }, { "docid": "2939f5196e0abb8557eb0558b5932074", "score": "0.4931067", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\n }", "title": "" }, { "docid": "418667a12b711e18e41b3431d44ab11a", "score": "0.4926564", "text": "function isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\r\n }", "title": "" }, { "docid": "418667a12b711e18e41b3431d44ab11a", "score": "0.4926564", "text": "function isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\r\n }", "title": "" }, { "docid": "418667a12b711e18e41b3431d44ab11a", "score": "0.4926564", "text": "function isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\r\n }", "title": "" }, { "docid": "418667a12b711e18e41b3431d44ab11a", "score": "0.4926564", "text": "function isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\r\n }", "title": "" }, { "docid": "418667a12b711e18e41b3431d44ab11a", "score": "0.4926564", "text": "function isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;\r\n }", "title": "" }, { "docid": "a80dd4882118ae6db0cea7a2518be257", "score": "0.48884955", "text": "get decimal() {\n return parseInt(this.normalized, 16)\n }", "title": "" }, { "docid": "984f808e1f7044764f310ee0a335f5b9", "score": "0.48470107", "text": "constructor(a, b, op) {\n //access calculation's internal properties\n this.a = a;\n this.b = b;\n this.op = op;\n }", "title": "" }, { "docid": "f44c2849a38f3a49a5690132260c21c6", "score": "0.48445007", "text": "exponent() {return new Decimal(1)}", "title": "" }, { "docid": "f44c2849a38f3a49a5690132260c21c6", "score": "0.48445007", "text": "exponent() {return new Decimal(1)}", "title": "" }, { "docid": "dfa11c3eb737dc96e9549de5861b4257", "score": "0.48265642", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal || obj && obj.toStringTag === tag || false;\n }", "title": "" }, { "docid": "dfa11c3eb737dc96e9549de5861b4257", "score": "0.48265642", "text": "function isDecimalInstance(obj) {\n return obj instanceof Decimal || obj && obj.toStringTag === tag || false;\n }", "title": "" }, { "docid": "1643b051c3a981b616e97a80e6ec9d2f", "score": "0.4795367", "text": "function another(configObj) {\n\t var div,\n\n\t // id tracks the caller function, so its name can be included in error messages.\n\t id = 0,\n\t P = BigNumber.prototype,\n\t ONE = new BigNumber(1),\n\n\t /********************************* EDITABLE DEFAULTS **********************************/\n\n\t /*\n\t * The default values below must be integers within the inclusive ranges stated.\n\t * The values can also be changed at run-time using BigNumber.config.\n\t */\n\n\t // The maximum number of decimal places for operations involving division.\n\t DECIMAL_PLACES = 20,\n\t // 0 to MAX\n\n\t /*\n\t * The rounding mode used when rounding to the above decimal places, and when using\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n\t * UP 0 Away from zero.\n\t * DOWN 1 Towards zero.\n\t * CEIL 2 Towards +Infinity.\n\t * FLOOR 3 Towards -Infinity.\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n\t */\n\t ROUNDING_MODE = 4,\n\t // 0 to 8\n\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n\t // The exponent value at and beneath which toString returns exponential notation.\n\t // Number type: -7\n\t TO_EXP_NEG = -7,\n\t // 0 to -MAX\n\n\t // The exponent value at and above which toString returns exponential notation.\n\t // Number type: 21\n\t TO_EXP_POS = 21,\n\t // 0 to MAX\n\n\t // RANGE : [MIN_EXP, MAX_EXP]\n\n\t // The minimum exponent value, beneath which underflow to zero occurs.\n\t // Number type: -324 (5e-324)\n\t MIN_EXP = -1e7,\n\t // -1 to -MAX\n\n\t // The maximum exponent value, above which overflow to Infinity occurs.\n\t // Number type: 308 (1.7976931348623157e+308)\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n\t MAX_EXP = 1e7,\n\t // 1 to MAX\n\n\t // Whether BigNumber Errors are ever thrown.\n\t ERRORS = true,\n\t // true or false\n\n\t // Change to intValidatorNoErrors if ERRORS is false.\n\t isValidInt = intValidatorWithErrors,\n\t // intValidatorWithErrors/intValidatorNoErrors\n\n\t // Whether to use cryptographically-secure random number generation, if available.\n\t CRYPTO = false,\n\t // true or false\n\n\t /*\n\t * The modulo mode used when calculating the modulus: a mod n.\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n\t * The remainder (r) is calculated as: r = a - n * q.\n\t *\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\n\t * DOWN 1 The remainder has the same sign as the dividend.\n\t * This modulo mode is commonly known as 'truncated division' and is\n\t * equivalent to (a % n) in JavaScript.\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n\t * The remainder is always positive.\n\t *\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n\t * modes are commonly used for the modulus operation.\n\t * Although the other rounding modes can also be used, they may not give useful results.\n\t */\n\t MODULO_MODE = 1,\n\t // 0 to 9\n\n\t // The maximum number of significant digits of the result of the toPower operation.\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\n\t POW_PRECISION = 100,\n\t // 0 to MAX\n\n\t // The format specification used by the BigNumber.prototype.toFormat method.\n\t FORMAT = {\n\t decimalSeparator: '.',\n\t groupSeparator: ',',\n\t groupSize: 3,\n\t secondaryGroupSize: 0,\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\n\t fractionGroupSize: 0\n\t };\n\n\t /******************************************************************************************/\n\n\t // CONSTRUCTOR\n\n\t /*\n\t * The BigNumber constructor and exported function.\n\t * Create and return a new instance of a BigNumber object.\n\t *\n\t * n {number|string|BigNumber} A numeric value.\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n\t */\n\t function BigNumber(n, b) {\n\t var c,\n\t e,\n\t i,\n\t num,\n\t len,\n\t str,\n\t x = this;\n\n\t // Enable constructor usage without new.\n\t if (!(x instanceof BigNumber)) {\n\n\t // 'BigNumber() constructor call without new: {n}'\n\t if (ERRORS) raise(26, 'constructor call without new', n);\n\t return new BigNumber(n, b);\n\t }\n\n\t // 'new BigNumber() base not an integer: {b}'\n\t // 'new BigNumber() base out of range: {b}'\n\t if (b == null || !isValidInt(b, 2, 64, id, 'base')) {\n\n\t // Duplicate.\n\t if (n instanceof BigNumber) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = (n = n.c) ? n.slice() : n;\n\t id = 0;\n\t return;\n\t }\n\n\t if ((num = typeof n == 'number') && n * 0 == 0) {\n\t x.s = 1 / n < 0 ? (n = -n, -1) : 1;\n\n\t // Fast path for integers.\n\t if (n === ~ ~n) {\n\t for (e = 0, i = n; i >= 10; i /= 10, e++);\n\t x.e = e;\n\t x.c = [n];\n\t id = 0;\n\t return;\n\t }\n\n\t str = n + '';\n\t } else {\n\t if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, num);\n\t x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n\t }\n\t } else {\n\t b = b | 0;\n\t str = n + '';\n\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n\t // Allow exponential notation to be used with base 10 argument.\n\t if (b == 10) {\n\t x = new BigNumber(n instanceof BigNumber ? n : str);\n\t return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n\t }\n\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n\t // Any number in exponential form will fail due to the [Ee][+-].\n\t if ((num = typeof n == 'number') && n * 0 != 0 || !new RegExp('^-?' + (c = '[' + ALPHABET.slice(0, b) + ']+') + '(?:\\\\.' + c + ')?$', b < 37 ? 'i' : '').test(str)) {\n\t return parseNumeric(x, str, num, b);\n\t }\n\n\t if (num) {\n\t x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\n\n\t if (ERRORS && str.replace(/^0\\.0*|\\./, '').length > 15) {\n\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t raise(id, tooManyDigits, n);\n\t }\n\n\t // Prevent later check for length on converted number.\n\t num = false;\n\t } else {\n\t x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n\t }\n\n\t str = convertBase(str, 10, b, x.s);\n\t }\n\n\t // Decimal point?\n\t if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n\n\t // Exponential form?\n\t if ((i = str.search(/e/i)) > 0) {\n\n\t // Determine exponent.\n\t if (e < 0) e = i;\n\t e += +str.slice(i + 1);\n\t str = str.substring(0, i);\n\t } else if (e < 0) {\n\n\t // Integer.\n\t e = str.length;\n\t }\n\n\t // Determine leading zeros.\n\t for (i = 0; str.charCodeAt(i) === 48; i++);\n\n\t // Determine trailing zeros.\n\t for (len = str.length; str.charCodeAt(--len) === 48;);\n\t str = str.slice(i, len + 1);\n\n\t if (str) {\n\t len = str.length;\n\n\t // Disallow numbers with over 15 significant digits if number type.\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t if (num && ERRORS && len > 15) raise(id, tooManyDigits, x.s * n);\n\n\t e = e - i - 1;\n\n\t // Overflow?\n\t if (e > MAX_EXP) {\n\n\t // Infinity.\n\t x.c = x.e = null;\n\n\t // Underflow?\n\t } else if (e < MIN_EXP) {\n\n\t // Zero.\n\t x.c = [x.e = 0];\n\t } else {\n\t x.e = e;\n\t x.c = [];\n\n\t // Transform base\n\n\t // e is the base 10 exponent.\n\t // i is where to slice str to get the first element of the coefficient array.\n\t i = (e + 1) % LOG_BASE;\n\t if (e < 0) i += LOG_BASE;\n\n\t if (i < len) {\n\t if (i) x.c.push(+str.slice(0, i));\n\n\t for (len -= LOG_BASE; i < len;) {\n\t x.c.push(+str.slice(i, i += LOG_BASE));\n\t }\n\n\t str = str.slice(i);\n\t i = LOG_BASE - str.length;\n\t } else {\n\t i -= len;\n\t }\n\n\t for (; i--; str += '0');\n\t x.c.push(+str);\n\t }\n\t } else {\n\n\t // Zero.\n\t x.c = [x.e = 0];\n\t }\n\n\t id = 0;\n\t }\n\n\t // CONSTRUCTOR PROPERTIES\n\n\t BigNumber.another = another;\n\n\t BigNumber.ROUND_UP = 0;\n\t BigNumber.ROUND_DOWN = 1;\n\t BigNumber.ROUND_CEIL = 2;\n\t BigNumber.ROUND_FLOOR = 3;\n\t BigNumber.ROUND_HALF_UP = 4;\n\t BigNumber.ROUND_HALF_DOWN = 5;\n\t BigNumber.ROUND_HALF_EVEN = 6;\n\t BigNumber.ROUND_HALF_CEIL = 7;\n\t BigNumber.ROUND_HALF_FLOOR = 8;\n\t BigNumber.EUCLID = 9;\n\n\t /*\n\t * Configure infrequently-changing library-wide settings.\n\t *\n\t * Accept an object or an argument list, with one or many of the following properties or\n\t * parameters respectively:\n\t *\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n\t * ERRORS {boolean|number} true, false, 1 or 0\n\t * CRYPTO {boolean|number} true, false, 1 or 0\n\t * MODULO_MODE {number} 0 to 9 inclusive\n\t * POW_PRECISION {number} 0 to MAX inclusive\n\t * FORMAT {object} See BigNumber.prototype.toFormat\n\t * decimalSeparator {string}\n\t * groupSeparator {string}\n\t * groupSize {number}\n\t * secondaryGroupSize {number}\n\t * fractionGroupSeparator {string}\n\t * fractionGroupSize {number}\n\t *\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\n\t *\n\t * E.g.\n\t * BigNumber.config(20, 4) is equivalent to\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n\t *\n\t * Ignore properties/parameters set to null or undefined.\n\t * Return an object with the properties current values.\n\t */\n\t BigNumber.config = function () {\n\t var v,\n\t p,\n\t i = 0,\n\t r = {},\n\t a = arguments,\n\t o = a[0],\n\t has = o && typeof o == 'object' ? function () {\n\t if (o.hasOwnProperty(p)) return (v = o[p]) != null;\n\t } : function () {\n\t if (a.length > i) return (v = a[i++]) != null;\n\t };\n\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\n\t // 'config() DECIMAL_PLACES out of range: {v}'\n\t if (has(p = 'DECIMAL_PLACES') && isValidInt(v, 0, MAX, 2, p)) {\n\t DECIMAL_PLACES = v | 0;\n\t }\n\t r[p] = DECIMAL_PLACES;\n\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n\t // 'config() ROUNDING_MODE not an integer: {v}'\n\t // 'config() ROUNDING_MODE out of range: {v}'\n\t if (has(p = 'ROUNDING_MODE') && isValidInt(v, 0, 8, 2, p)) {\n\t ROUNDING_MODE = v | 0;\n\t }\n\t r[p] = ROUNDING_MODE;\n\n\t // EXPONENTIAL_AT {number|number[]}\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\n\t if (has(p = 'EXPONENTIAL_AT')) {\n\n\t if (isArray(v)) {\n\t if (isValidInt(v[0], -MAX, 0, 2, p) && isValidInt(v[1], 0, MAX, 2, p)) {\n\t TO_EXP_NEG = v[0] | 0;\n\t TO_EXP_POS = v[1] | 0;\n\t }\n\t } else if (isValidInt(v, -MAX, MAX, 2, p)) {\n\t TO_EXP_NEG = -(TO_EXP_POS = (v < 0 ? -v : v) | 0);\n\t }\n\t }\n\t r[p] = [TO_EXP_NEG, TO_EXP_POS];\n\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n\t // 'config() RANGE not an integer: {v}'\n\t // 'config() RANGE cannot be zero: {v}'\n\t // 'config() RANGE out of range: {v}'\n\t if (has(p = 'RANGE')) {\n\n\t if (isArray(v)) {\n\t if (isValidInt(v[0], -MAX, -1, 2, p) && isValidInt(v[1], 1, MAX, 2, p)) {\n\t MIN_EXP = v[0] | 0;\n\t MAX_EXP = v[1] | 0;\n\t }\n\t } else if (isValidInt(v, -MAX, MAX, 2, p)) {\n\t if (v | 0) MIN_EXP = -(MAX_EXP = (v < 0 ? -v : v) | 0);else if (ERRORS) raise(2, p + ' cannot be zero', v);\n\t }\n\t }\n\t r[p] = [MIN_EXP, MAX_EXP];\n\n\t // ERRORS {boolean|number} true, false, 1 or 0.\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\n\t if (has(p = 'ERRORS')) {\n\n\t if (v === !!v || v === 1 || v === 0) {\n\t id = 0;\n\t isValidInt = (ERRORS = !!v) ? intValidatorWithErrors : intValidatorNoErrors;\n\t } else if (ERRORS) {\n\t raise(2, p + notBool, v);\n\t }\n\t }\n\t r[p] = ERRORS;\n\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\n\t // 'config() crypto unavailable: {crypto}'\n\t if (has(p = 'CRYPTO')) {\n\n\t if (v === !!v || v === 1 || v === 0) {\n\t CRYPTO = !!(v && crypto && typeof crypto == 'object');\n\t if (v && !CRYPTO && ERRORS) raise(2, 'crypto unavailable', crypto);\n\t } else if (ERRORS) {\n\t raise(2, p + notBool, v);\n\t }\n\t }\n\t r[p] = CRYPTO;\n\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n\t // 'config() MODULO_MODE not an integer: {v}'\n\t // 'config() MODULO_MODE out of range: {v}'\n\t if (has(p = 'MODULO_MODE') && isValidInt(v, 0, 9, 2, p)) {\n\t MODULO_MODE = v | 0;\n\t }\n\t r[p] = MODULO_MODE;\n\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n\t // 'config() POW_PRECISION not an integer: {v}'\n\t // 'config() POW_PRECISION out of range: {v}'\n\t if (has(p = 'POW_PRECISION') && isValidInt(v, 0, MAX, 2, p)) {\n\t POW_PRECISION = v | 0;\n\t }\n\t r[p] = POW_PRECISION;\n\n\t // FORMAT {object}\n\t // 'config() FORMAT not an object: {v}'\n\t if (has(p = 'FORMAT')) {\n\n\t if (typeof v == 'object') {\n\t FORMAT = v;\n\t } else if (ERRORS) {\n\t raise(2, p + ' not an object', v);\n\t }\n\t }\n\t r[p] = FORMAT;\n\n\t return r;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the maximum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.max = function () {\n\t return maxOrMin(arguments, P.lt);\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the minimum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.min = function () {\n\t return maxOrMin(arguments, P.gt);\n\t };\n\n\t /*\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n\t * zeros are produced).\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t *\n\t * 'random() decimal places not an integer: {dp}'\n\t * 'random() decimal places out of range: {dp}'\n\t * 'random() crypto unavailable: {crypto}'\n\t */\n\t BigNumber.random = function () {\n\t var pow2_53 = 0x20000000000000;\n\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n\t // Check if Math.random() produces more than 32 bits of randomness.\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\t var random53bitInt = Math.random() * pow2_53 & 0x1fffff ? function () {\n\t return mathfloor(Math.random() * pow2_53);\n\t } : function () {\n\t return (Math.random() * 0x40000000 | 0) * 0x800000 + (Math.random() * 0x800000 | 0);\n\t };\n\n\t return function (dp) {\n\t var a,\n\t b,\n\t e,\n\t k,\n\t v,\n\t i = 0,\n\t c = [],\n\t rand = new BigNumber(ONE);\n\n\t dp = dp == null || !isValidInt(dp, 0, MAX, 14) ? DECIMAL_PLACES : dp | 0;\n\t k = mathceil(dp / LOG_BASE);\n\n\t if (CRYPTO) {\n\n\t // Browsers supporting crypto.getRandomValues.\n\t if (crypto && crypto.getRandomValues) {\n\n\t a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n\t for (; i < k;) {\n\n\t // 53 bits:\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n\t // 11111 11111111 11111111\n\t // 0x20000 is 2^21.\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n\t // Rejection sampling:\n\t // 0 <= v < 9007199254740992\n\t // Probability that v >= 9e15, is\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\t if (v >= 9e15) {\n\t b = crypto.getRandomValues(new Uint32Array(2));\n\t a[i] = b[0];\n\t a[i + 1] = b[1];\n\t } else {\n\n\t // 0 <= v <= 8999999999999999\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push(v % 1e14);\n\t i += 2;\n\t }\n\t }\n\t i = k / 2;\n\n\t // Node.js supporting crypto.randomBytes.\n\t } else if (crypto && crypto.randomBytes) {\n\n\t // buffer\n\t a = crypto.randomBytes(k *= 7);\n\n\t for (; i < k;) {\n\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n\t // 0 <= v < 9007199254740992\n\t v = (a[i] & 31) * 0x1000000000000 + a[i + 1] * 0x10000000000 + a[i + 2] * 0x100000000 + a[i + 3] * 0x1000000 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n\t if (v >= 9e15) {\n\t crypto.randomBytes(7).copy(a, i);\n\t } else {\n\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push(v % 1e14);\n\t i += 7;\n\t }\n\t }\n\t i = k / 7;\n\t } else if (ERRORS) {\n\t raise(14, 'crypto unavailable', crypto);\n\t }\n\t }\n\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n\t if (!i) {\n\n\t for (; i < k;) {\n\t v = random53bitInt();\n\t if (v < 9e15) c[i++] = v % 1e14;\n\t }\n\t }\n\n\t k = c[--i];\n\t dp %= LOG_BASE;\n\n\t // Convert trailing digits to zeros according to dp.\n\t if (k && dp) {\n\t v = POWS_TEN[LOG_BASE - dp];\n\t c[i] = mathfloor(k / v) * v;\n\t }\n\n\t // Remove trailing elements which are zero.\n\t for (; c[i] === 0; c.pop(), i--);\n\n\t // Zero?\n\t if (i < 0) {\n\t c = [e = 0];\n\t } else {\n\n\t // Remove leading elements which are zero and adjust exponent accordingly.\n\t for (e = -1; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n\t // Count the digits of the first element of c to determine leading zeros, and...\n\t for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n\t // adjust the exponent accordingly.\n\t if (i < LOG_BASE) e -= LOG_BASE - i;\n\t }\n\n\t rand.e = e;\n\t rand.c = c;\n\t return rand;\n\t };\n\t }();\n\n\t // PRIVATE FUNCTIONS\n\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\n\t function convertBase(str, baseOut, baseIn, sign) {\n\t var d,\n\t e,\n\t k,\n\t r,\n\t x,\n\t xc,\n\t y,\n\t i = str.indexOf('.'),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if (baseIn < 37) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if (i >= 0) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace('.', '');\n\t y = new BigNumber(baseIn);\n\t x = y.pow(str.length - i);\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut(str, baseIn, baseOut);\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for (; xc[--k] == 0; xc.pop());\n\t if (!xc[0]) return '0';\n\n\t if (i < 0) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div(x, y, dp, rm, baseOut);\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n\t if (d < 1 || !xc[0]) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint('1', -dp) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for (--baseOut; ++xc[--d] > baseOut;) {\n\t xc[d] = 0;\n\n\t if (!d) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for (k = xc.length; !xc[--k];);\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++]));\n\t str = toFixedPoint(str, e);\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }\n\n\t // Perform division in the specified base. Called by div and convertBase.\n\t div = function () {\n\n\t // Assume non-zero x and k.\n\t function multiply(x, k, base) {\n\t var m,\n\t temp,\n\t xlo,\n\t xhi,\n\t carry = 0,\n\t i = x.length,\n\t klo = k % SQRT_BASE,\n\t khi = k / SQRT_BASE | 0;\n\n\t for (x = x.slice(); i--;) {\n\t xlo = x[i] % SQRT_BASE;\n\t xhi = x[i] / SQRT_BASE | 0;\n\t m = khi * xlo + xhi * klo;\n\t temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;\n\t carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n\t x[i] = temp % base;\n\t }\n\n\t if (carry) x.unshift(carry);\n\n\t return x;\n\t }\n\n\t function compare(a, b, aL, bL) {\n\t var i, cmp;\n\n\t if (aL != bL) {\n\t cmp = aL > bL ? 1 : -1;\n\t } else {\n\n\t for (i = cmp = 0; i < aL; i++) {\n\n\t if (a[i] != b[i]) {\n\t cmp = a[i] > b[i] ? 1 : -1;\n\t break;\n\t }\n\t }\n\t }\n\t return cmp;\n\t }\n\n\t function subtract(a, b, aL, base) {\n\t var i = 0;\n\n\t // Subtract b from a.\n\t for (; aL--;) {\n\t a[aL] -= i;\n\t i = a[aL] < b[aL] ? 1 : 0;\n\t a[aL] = i * base + a[aL] - b[aL];\n\t }\n\n\t // Remove leading zeros.\n\t for (; !a[0] && a.length > 1; a.shift());\n\t }\n\n\t // x: dividend, y: divisor.\n\t return function (x, y, dp, rm, base) {\n\t var cmp,\n\t e,\n\t i,\n\t more,\n\t n,\n\t prod,\n\t prodL,\n\t q,\n\t qc,\n\t rem,\n\t remL,\n\t rem0,\n\t xi,\n\t xL,\n\t yc0,\n\t yL,\n\t yz,\n\t s = x.s == y.s ? 1 : -1,\n\t xc = x.c,\n\t yc = y.c;\n\n\t // Either NaN, Infinity or 0?\n\t if (!xc || !xc[0] || !yc || !yc[0]) {\n\n\t return new BigNumber(\n\n\t // Return NaN if either NaN, or both Infinity or 0.\n\t !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\n\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0);\n\t }\n\n\t q = new BigNumber(s);\n\t qc = q.c = [];\n\t e = x.e - y.e;\n\t s = dp + e + 1;\n\n\t if (!base) {\n\t base = BASE;\n\t e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n\t s = s / LOG_BASE | 0;\n\t }\n\n\t // Result exponent may be one less then the current value of e.\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\t for (i = 0; yc[i] == (xc[i] || 0); i++);\n\t if (yc[i] > (xc[i] || 0)) e--;\n\n\t if (s < 0) {\n\t qc.push(1);\n\t more = true;\n\t } else {\n\t xL = xc.length;\n\t yL = yc.length;\n\t i = 0;\n\t s += 2;\n\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n\t n = mathfloor(base / (yc[0] + 1));\n\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n\t if (n > 1) {\n\t yc = multiply(yc, n, base);\n\t xc = multiply(xc, n, base);\n\t yL = yc.length;\n\t xL = xc.length;\n\t }\n\n\t xi = yL;\n\t rem = xc.slice(0, yL);\n\t remL = rem.length;\n\n\t // Add zeros to make remainder as long as divisor.\n\t for (; remL < yL; rem[remL++] = 0);\n\t yz = yc.slice();\n\t yz.unshift(0);\n\t yc0 = yc[0];\n\t if (yc[1] >= base / 2) yc0++;\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n\t do {\n\t n = 0;\n\n\t // Compare divisor and remainder.\n\t cmp = compare(yc, rem, yL, remL);\n\n\t // If divisor < remainder.\n\t if (cmp < 0) {\n\n\t // Calculate trial digit, n.\n\n\t rem0 = rem[0];\n\t if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\n\n\t // n is how many times the divisor goes into the current remainder.\n\t n = mathfloor(rem0 / yc0);\n\n\t // Algorithm:\n\t // 1. product = divisor * trial digit (n)\n\t // 2. if product > remainder: product -= divisor, n--\n\t // 3. remainder -= product\n\t // 4. if product was < remainder at 2:\n\t // 5. compare new remainder and divisor\n\t // 6. If remainder > divisor: remainder -= divisor, n++\n\n\t if (n > 1) {\n\n\t // n may be > base only when base is 3.\n\t if (n >= base) n = base - 1;\n\n\t // product = divisor * trial digit.\n\t prod = multiply(yc, n, base);\n\t prodL = prod.length;\n\t remL = rem.length;\n\n\t // Compare product and remainder.\n\t // If product > remainder.\n\t // Trial digit n too high.\n\t // n is 1 too high about 5% of the time, and is not known to have\n\t // ever been more than 1 too high.\n\t while (compare(prod, rem, prodL, remL) == 1) {\n\t n--;\n\n\t // Subtract divisor from product.\n\t subtract(prod, yL < prodL ? yz : yc, prodL, base);\n\t prodL = prod.length;\n\t cmp = 1;\n\t }\n\t } else {\n\n\t // n is 0 or 1, cmp is -1.\n\t // If n is 0, there is no need to compare yc and rem again below,\n\t // so change cmp to 1 to avoid it.\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\n\t if (n == 0) {\n\n\t // divisor < remainder, so n must be at least 1.\n\t cmp = n = 1;\n\t }\n\n\t // product = divisor\n\t prod = yc.slice();\n\t prodL = prod.length;\n\t }\n\n\t if (prodL < remL) prod.unshift(0);\n\n\t // Subtract product from remainder.\n\t subtract(rem, prod, remL, base);\n\t remL = rem.length;\n\n\t // If product was < remainder.\n\t if (cmp == -1) {\n\n\t // Compare divisor and new remainder.\n\t // If divisor < new remainder, subtract divisor from remainder.\n\t // Trial digit n too low.\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\n\t while (compare(yc, rem, yL, remL) < 1) {\n\t n++;\n\n\t // Subtract divisor from remainder.\n\t subtract(rem, yL < remL ? yz : yc, remL, base);\n\t remL = rem.length;\n\t }\n\t }\n\t } else if (cmp === 0) {\n\t n++;\n\t rem = [0];\n\t } // else cmp === 1 and n will be 0\n\n\t // Add the next digit, n, to the result array.\n\t qc[i++] = n;\n\n\t // Update the remainder.\n\t if (rem[0]) {\n\t rem[remL++] = xc[xi] || 0;\n\t } else {\n\t rem = [xc[xi]];\n\t remL = 1;\n\t }\n\t } while ((xi++ < xL || rem[0] != null) && s--);\n\n\t more = rem[0] != null;\n\n\t // Leading zero?\n\t if (!qc[0]) qc.shift();\n\t }\n\n\t if (base == BASE) {\n\n\t // To calculate q.e, first get the number of digits of qc[0].\n\t for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\n\t round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\n\n\t // Caller is convertBase.\n\t } else {\n\t q.e = e;\n\t q.r = +more;\n\t }\n\n\t return q;\n\t };\n\t }();\n\n\t /*\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\n\t * notation rounded to the specified decimal places or significant digits.\n\t *\n\t * n is a BigNumber.\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\n\t * rm is the rounding mode.\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n\t */\n\t function format(n, i, rm, caller) {\n\t var c0, e, ne, len, str;\n\n\t rm = rm != null && isValidInt(rm, 0, 8, caller, roundingMode) ? rm | 0 : ROUNDING_MODE;\n\n\t if (!n.c) return n.toString();\n\t c0 = n.c[0];\n\t ne = n.e;\n\n\t if (i == null) {\n\t str = coeffToString(n.c);\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG ? toExponential(str, ne) : toFixedPoint(str, ne);\n\t } else {\n\t n = round(new BigNumber(n), i, rm);\n\n\t // n.e may have changed if the value was rounded up.\n\t e = n.e;\n\n\t str = coeffToString(n.c);\n\t len = str.length;\n\n\t // toPrecision returns exponential notation if the number of significant digits\n\t // specified is less than the number of digits necessary to represent the integer\n\t // part of the value in fixed-point notation.\n\n\t // Exponential notation.\n\t if (caller == 19 || caller == 24 && (i <= e || e <= TO_EXP_NEG)) {\n\n\t // Append zeros?\n\t for (; len < i; str += '0', len++);\n\t str = toExponential(str, e);\n\n\t // Fixed-point notation.\n\t } else {\n\t i -= ne;\n\t str = toFixedPoint(str, e);\n\n\t // Append zeros?\n\t if (e + 1 > len) {\n\t if (--i > 0) for (str += '.'; i--; str += '0');\n\t } else {\n\t i += e - len;\n\t if (i > 0) {\n\t if (e + 1 == len) str += '.';\n\t for (; i--; str += '0');\n\t }\n\t }\n\t }\n\t }\n\n\t return n.s < 0 && c0 ? '-' + str : str;\n\t }\n\n\t // Handle BigNumber.max and BigNumber.min.\n\t function maxOrMin(args, method) {\n\t var m,\n\t n,\n\t i = 0;\n\n\t if (isArray(args[0])) args = args[0];\n\t m = new BigNumber(args[0]);\n\n\t for (; ++i < args.length;) {\n\t n = new BigNumber(args[i]);\n\n\t // If any number is NaN, return NaN.\n\t if (!n.s) {\n\t m = n;\n\t break;\n\t } else if (method.call(m, n)) {\n\t m = n;\n\t }\n\t }\n\n\t return m;\n\t }\n\n\t /*\n\t * Return true if n is an integer in range, otherwise throw.\n\t * Use for argument validation when ERRORS is true.\n\t */\n\t function intValidatorWithErrors(n, min, max, caller, name) {\n\t if (n < min || n > max || n != truncate(n)) {\n\t raise(caller, (name || 'decimal places') + (n < min || n > max ? ' out of range' : ' not an integer'), n);\n\t }\n\n\t return true;\n\t }\n\n\t /*\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n\t * Called by minus, plus and times.\n\t */\n\t function normalise(n, c, e) {\n\t var i = 1,\n\t j = c.length;\n\n\t // Remove trailing zeros.\n\t for (; !c[--j]; c.pop());\n\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\n\t for (j = c[0]; j >= 10; j /= 10, i++);\n\n\t // Overflow?\n\t if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n\n\t // Infinity.\n\t n.c = n.e = null;\n\n\t // Underflow?\n\t } else if (e < MIN_EXP) {\n\n\t // Zero.\n\t n.c = [n.e = 0];\n\t } else {\n\t n.e = e;\n\t n.c = c;\n\t }\n\n\t return n;\n\t }\n\n\t // Handle values that fail the validity test in BigNumber.\n\t parseNumeric = function () {\n\t var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n\t dotAfter = /^([^.]+)\\.$/,\n\t dotBefore = /^\\.([^.]+)$/,\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n\t whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n\t return function (x, str, num, b) {\n\t var base,\n\t s = num ? str : str.replace(whitespaceOrPlus, '');\n\n\t // No exception on ±Infinity or NaN.\n\t if (isInfinityOrNaN.test(s)) {\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n\t } else {\n\t if (!num) {\n\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n\t s = s.replace(basePrefix, function (m, p1, p2) {\n\t base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n\t return !b || b == base ? p1 : m;\n\t });\n\n\t if (b) {\n\t base = b;\n\n\t // E.g. '1.' to '1', '.1' to '0.1'\n\t s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n\t }\n\n\t if (str != s) return new BigNumber(s, base);\n\t }\n\n\t // 'new BigNumber() not a number: {n}'\n\t // 'new BigNumber() not a base {b} number: {n}'\n\t if (ERRORS) raise(id, 'not a' + (b ? ' base ' + b : '') + ' number', str);\n\t x.s = null;\n\t }\n\n\t x.c = x.e = null;\n\t id = 0;\n\t };\n\t }();\n\n\t // Throw a BigNumber Error.\n\t function raise(caller, msg, val) {\n\t var error = new Error(['new BigNumber', // 0\n\t 'cmp', // 1\n\t 'config', // 2\n\t 'div', // 3\n\t 'divToInt', // 4\n\t 'eq', // 5\n\t 'gt', // 6\n\t 'gte', // 7\n\t 'lt', // 8\n\t 'lte', // 9\n\t 'minus', // 10\n\t 'mod', // 11\n\t 'plus', // 12\n\t 'precision', // 13\n\t 'random', // 14\n\t 'round', // 15\n\t 'shift', // 16\n\t 'times', // 17\n\t 'toDigits', // 18\n\t 'toExponential', // 19\n\t 'toFixed', // 20\n\t 'toFormat', // 21\n\t 'toFraction', // 22\n\t 'pow', // 23\n\t 'toPrecision', // 24\n\t 'toString', // 25\n\t 'BigNumber' // 26\n\t ][caller] + '() ' + msg + ': ' + val);\n\n\t error.name = 'BigNumber Error';\n\t id = 0;\n\t throw error;\n\t }\n\n\t /*\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\n\t */\n\t function round(x, sd, rm, r) {\n\t var d,\n\t i,\n\t j,\n\t k,\n\t n,\n\t ni,\n\t rd,\n\t xc = x.c,\n\t pows10 = POWS_TEN;\n\n\t // if x is not Infinity or NaN...\n\t if (xc) {\n\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\n\t // ni is the index of n within x.c.\n\t // d is the number of digits of n.\n\t // i is the index of rd within n including leading zeros.\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\n\t out: {\n\n\t // Get the number of digits of the first element of xc.\n\t for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\n\t i = sd - d;\n\n\t // If the rounding digit is in the first element of xc...\n\t if (i < 0) {\n\t i += LOG_BASE;\n\t j = sd;\n\t n = xc[ni = 0];\n\n\t // Get the rounding digit at index j of n.\n\t rd = n / pows10[d - j - 1] % 10 | 0;\n\t } else {\n\t ni = mathceil((i + 1) / LOG_BASE);\n\n\t if (ni >= xc.length) {\n\n\t if (r) {\n\n\t // Needed by sqrt.\n\t for (; xc.length <= ni; xc.push(0));\n\t n = rd = 0;\n\t d = 1;\n\t i %= LOG_BASE;\n\t j = i - LOG_BASE + 1;\n\t } else {\n\t break out;\n\t }\n\t } else {\n\t n = k = xc[ni];\n\n\t // Get the number of digits of n.\n\t for (d = 1; k >= 10; k /= 10, d++);\n\n\t // Get the index of rd within n.\n\t i %= LOG_BASE;\n\n\t // Get the index of rd within n, adjusted for leading zeros.\n\t // The number of leading zeros of n is given by LOG_BASE - d.\n\t j = i - LOG_BASE + d;\n\n\t // Get the rounding digit at index j of n.\n\t rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n\t }\n\t }\n\n\t r = r || sd < 0 ||\n\n\t // Are there any non-zero digits after the rounding digit?\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n\t xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n\n\t r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\n\n\t // Check whether the digit to the left of the rounding digit is odd.\n\t (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));\n\n\t if (sd < 1 || !xc[0]) {\n\t xc.length = 0;\n\n\t if (r) {\n\n\t // Convert sd to decimal places.\n\t sd -= x.e + 1;\n\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\t xc[0] = pows10[sd % LOG_BASE];\n\t x.e = -sd || 0;\n\t } else {\n\n\t // Zero.\n\t xc[0] = x.e = 0;\n\t }\n\n\t return x;\n\t }\n\n\t // Remove excess digits.\n\t if (i == 0) {\n\t xc.length = ni;\n\t k = 1;\n\t ni--;\n\t } else {\n\t xc.length = ni + 1;\n\t k = pows10[LOG_BASE - i];\n\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n\t // j > 0 means i > number of leading zeros of n.\n\t xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n\t }\n\n\t // Round up?\n\t if (r) {\n\n\t for (;;) {\n\n\t // If the digit to be rounded up is in the first element of xc...\n\t if (ni == 0) {\n\n\t // i will be the length of xc[0] before k is added.\n\t for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\n\t j = xc[0] += k;\n\t for (k = 1; j >= 10; j /= 10, k++);\n\n\t // if i != k the length has increased.\n\t if (i != k) {\n\t x.e++;\n\t if (xc[0] == BASE) xc[0] = 1;\n\t }\n\n\t break;\n\t } else {\n\t xc[ni] += k;\n\t if (xc[ni] != BASE) break;\n\t xc[ni--] = 0;\n\t k = 1;\n\t }\n\t }\n\t }\n\n\t // Remove trailing zeros.\n\t for (i = xc.length; xc[--i] === 0; xc.pop());\n\t }\n\n\t // Overflow? Infinity.\n\t if (x.e > MAX_EXP) {\n\t x.c = x.e = null;\n\n\t // Underflow? Zero.\n\t } else if (x.e < MIN_EXP) {\n\t x.c = [x.e = 0];\n\t }\n\t }\n\n\t return x;\n\t }\n\n\t // PROTOTYPE/INSTANCE METHODS\n\n\t /*\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\n\t */\n\t P.absoluteValue = P.abs = function () {\n\t var x = new BigNumber(this);\n\t if (x.s < 0) x.s = 1;\n\t return x;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of Infinity.\n\t */\n\t P.ceil = function () {\n\t return round(new BigNumber(this), this.e + 1, 2);\n\t };\n\n\t /*\n\t * Return\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * 0 if they have the same value,\n\t * or null if the value of either is NaN.\n\t */\n\t P.comparedTo = P.cmp = function (y, b) {\n\t id = 1;\n\t return compare(this, new BigNumber(y, b));\n\t };\n\n\t /*\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\n\t * of this BigNumber is ±Infinity or NaN.\n\t */\n\t P.decimalPlaces = P.dp = function () {\n\t var n,\n\t v,\n\t c = this.c;\n\n\t if (!c) return null;\n\t n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\n\n\t // Subtract the number of trailing zeros of the last number.\n\t if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\n\t if (n < 0) n = 0;\n\n\t return n;\n\t };\n\n\t /*\n\t * n / 0 = I\n\t * n / N = N\n\t * n / I = 0\n\t * 0 / n = 0\n\t * 0 / 0 = N\n\t * 0 / N = N\n\t * 0 / I = 0\n\t * N / n = N\n\t * N / 0 = N\n\t * N / N = N\n\t * N / I = N\n\t * I / n = I\n\t * I / 0 = I\n\t * I / N = N\n\t * I / I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.dividedBy = P.div = function (y, b) {\n\t id = 3;\n\t return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\n\t * BigNumber by the value of BigNumber(y, b).\n\t */\n\t P.dividedToIntegerBy = P.divToInt = function (y, b) {\n\t id = 4;\n\t return div(this, new BigNumber(y, b), 0, 1);\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.equals = P.eq = function (y, b) {\n\t id = 5;\n\t return compare(this, new BigNumber(y, b)) === 0;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of -Infinity.\n\t */\n\t P.floor = function () {\n\t return round(new BigNumber(this), this.e + 1, 3);\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.greaterThan = P.gt = function (y, b) {\n\t id = 6;\n\t return compare(this, new BigNumber(y, b)) > 0;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.greaterThanOrEqualTo = P.gte = function (y, b) {\n\t id = 7;\n\t return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n\t */\n\t P.isFinite = function () {\n\t return !!this.c;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\n\t */\n\t P.isInteger = P.isInt = function () {\n\t return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\n\t */\n\t P.isNaN = function () {\n\t return !this.s;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\n\t */\n\t P.isNegative = P.isNeg = function () {\n\t return this.s < 0;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n\t */\n\t P.isZero = function () {\n\t return !!this.c && this.c[0] == 0;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.lessThan = P.lt = function (y, b) {\n\t id = 8;\n\t return compare(this, new BigNumber(y, b)) < 0;\n\t };\n\n\t /*\n\t * Return true if the value of this BigNumber is less than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.lessThanOrEqualTo = P.lte = function (y, b) {\n\t id = 9;\n\t return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n\t };\n\n\t /*\n\t * n - 0 = n\n\t * n - N = N\n\t * n - I = -I\n\t * 0 - n = -n\n\t * 0 - 0 = 0\n\t * 0 - N = N\n\t * 0 - I = -I\n\t * N - n = N\n\t * N - 0 = N\n\t * N - N = N\n\t * N - I = N\n\t * I - n = I\n\t * I - 0 = I\n\t * I - N = N\n\t * I - I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.minus = P.sub = function (y, b) {\n\t var i,\n\t j,\n\t t,\n\t xLTy,\n\t x = this,\n\t a = x.s;\n\n\t id = 10;\n\t y = new BigNumber(y, b);\n\t b = y.s;\n\n\t // Either NaN?\n\t if (!a || !b) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if (a != b) {\n\t y.s = -b;\n\t return x.plus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if (!xe || !ye) {\n\n\t // Either Infinity?\n\t if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\n\n\t // Either zero?\n\t if (!xc[0] || !yc[0]) {\n\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\n\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n\t ROUNDING_MODE == 3 ? -0 : 0);\n\t }\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Determine which is the bigger number.\n\t if (a = xe - ye) {\n\n\t if (xLTy = a < 0) {\n\t a = -a;\n\t t = xc;\n\t } else {\n\t ye = xe;\n\t t = yc;\n\t }\n\n\t t.reverse();\n\n\t // Prepend zeros to equalise exponents.\n\t for (b = a; b--; t.push(0));\n\t t.reverse();\n\t } else {\n\n\t // Exponents equal. Check digit by digit.\n\t j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n\t for (a = b = 0; b < j; b++) {\n\n\t if (xc[b] != yc[b]) {\n\t xLTy = xc[b] < yc[b];\n\t break;\n\t }\n\t }\n\t }\n\n\t // x < y? Point xc to the array of the bigger number.\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n\t b = (j = yc.length) - (i = xc.length);\n\n\t // Append zeros to xc if shorter.\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\t if (b > 0) for (; b--; xc[i++] = 0);\n\t b = BASE - 1;\n\n\t // Subtract yc from xc.\n\t for (; j > a;) {\n\n\t if (xc[--j] < yc[j]) {\n\t for (i = j; i && !xc[--i]; xc[i] = b);\n\t --xc[i];\n\t xc[j] += BASE;\n\t }\n\n\t xc[j] -= yc[j];\n\t }\n\n\t // Remove leading zeros and adjust exponent accordingly.\n\t for (; xc[0] == 0; xc.shift(), --ye);\n\n\t // Zero?\n\t if (!xc[0]) {\n\n\t // Following IEEE 754 (2008) 6.3,\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\n\t y.c = [y.e = 0];\n\t return y;\n\t }\n\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n\t // for finite x and y.\n\t return normalise(y, xc, ye);\n\t };\n\n\t /*\n\t * n % 0 = N\n\t * n % N = N\n\t * n % I = n\n\t * 0 % n = 0\n\t * -0 % n = -0\n\t * 0 % 0 = N\n\t * 0 % N = N\n\t * 0 % I = 0\n\t * N % n = N\n\t * N % 0 = N\n\t * N % N = N\n\t * N % I = N\n\t * I % n = N\n\t * I % 0 = N\n\t * I % N = N\n\t * I % I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n\t */\n\t P.modulo = P.mod = function (y, b) {\n\t var q,\n\t s,\n\t x = this;\n\n\t id = 11;\n\t y = new BigNumber(y, b);\n\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\t if (!x.c || !y.s || y.c && !y.c[0]) {\n\t return new BigNumber(NaN);\n\n\t // Return x if y is Infinity or x is zero.\n\t } else if (!y.c || x.c && !x.c[0]) {\n\t return new BigNumber(x);\n\t }\n\n\t if (MODULO_MODE == 9) {\n\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\n\t // r = x - qy where 0 <= r < abs(y)\n\t s = y.s;\n\t y.s = 1;\n\t q = div(x, y, 0, 3);\n\t y.s = s;\n\t q.s *= s;\n\t } else {\n\t q = div(x, y, 0, MODULO_MODE);\n\t }\n\n\t return x.minus(q.times(y));\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\n\t * i.e. multiplied by -1.\n\t */\n\t P.negated = P.neg = function () {\n\t var x = new BigNumber(this);\n\t x.s = -x.s || null;\n\t return x;\n\t };\n\n\t /*\n\t * n + 0 = n\n\t * n + N = N\n\t * n + I = I\n\t * 0 + n = n\n\t * 0 + 0 = 0\n\t * 0 + N = N\n\t * 0 + I = I\n\t * N + n = N\n\t * N + 0 = N\n\t * N + N = N\n\t * N + I = N\n\t * I + n = I\n\t * I + 0 = I\n\t * I + N = N\n\t * I + I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.plus = P.add = function (y, b) {\n\t var t,\n\t x = this,\n\t a = x.s;\n\n\t id = 12;\n\t y = new BigNumber(y, b);\n\t b = y.s;\n\n\t // Either NaN?\n\t if (!a || !b) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if (a != b) {\n\t y.s = -b;\n\t return x.minus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if (!xe || !ye) {\n\n\t // Return ±Infinity if either ±Infinity.\n\t if (!xc || !yc) return new BigNumber(a / 0);\n\n\t // Either zero?\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\t if (a = xe - ye) {\n\t if (a > 0) {\n\t ye = xe;\n\t t = yc;\n\t } else {\n\t a = -a;\n\t t = xc;\n\t }\n\n\t t.reverse();\n\t for (; a--; t.push(0));\n\t t.reverse();\n\t }\n\n\t a = xc.length;\n\t b = yc.length;\n\n\t // Point xc to the longer array, and b to the shorter length.\n\t if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\n\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\t for (a = 0; b;) {\n\t a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n\t xc[b] %= BASE;\n\t }\n\n\t if (a) {\n\t xc.unshift(a);\n\t ++ye;\n\t }\n\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\t // ye = MAX_EXP + 1 possible\n\t return normalise(y, xc, ye);\n\t };\n\n\t /*\n\t * Return the number of significant digits of the value of this BigNumber.\n\t *\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n\t */\n\t P.precision = P.sd = function (z) {\n\t var n,\n\t v,\n\t x = this,\n\t c = x.c;\n\n\t // 'precision() argument not a boolean or binary digit: {z}'\n\t if (z != null && z !== !!z && z !== 1 && z !== 0) {\n\t if (ERRORS) raise(13, 'argument' + notBool, z);\n\t if (z != !!z) z = null;\n\t }\n\n\t if (!c) return null;\n\t v = c.length - 1;\n\t n = v * LOG_BASE + 1;\n\n\t if (v = c[v]) {\n\n\t // Subtract the number of trailing zeros of the last element.\n\t for (; v % 10 == 0; v /= 10, n--);\n\n\t // Add the number of digits of the first element.\n\t for (v = c[0]; v >= 10; v /= 10, n++);\n\t }\n\n\t if (z && x.e + 1 > n) n = x.e + 1;\n\n\t return n;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n\t * omitted.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'round() decimal places out of range: {dp}'\n\t * 'round() decimal places not an integer: {dp}'\n\t * 'round() rounding mode not an integer: {rm}'\n\t * 'round() rounding mode out of range: {rm}'\n\t */\n\t P.round = function (dp, rm) {\n\t var n = new BigNumber(this);\n\n\t if (dp == null || isValidInt(dp, 0, MAX, 15)) {\n\t round(n, ~ ~dp + this.e + 1, rm == null || !isValidInt(rm, 0, 8, 15, roundingMode) ? ROUNDING_MODE : rm | 0);\n\t }\n\n\t return n;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n\t *\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t *\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n\t * otherwise.\n\t *\n\t * 'shift() argument not an integer: {k}'\n\t * 'shift() argument out of range: {k}'\n\t */\n\t P.shift = function (k) {\n\t var n = this;\n\t return isValidInt(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument')\n\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\n\t ? n.times('1e' + truncate(k)) : new BigNumber(n.c && n.c[0] && (k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER) ? n.s * (k < 0 ? 0 : 1 / 0) : n);\n\t };\n\n\t /*\n\t * sqrt(-n) = N\n\t * sqrt( N) = N\n\t * sqrt(-I) = N\n\t * sqrt( I) = I\n\t * sqrt( 0) = 0\n\t * sqrt(-0) = -0\n\t *\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.squareRoot = P.sqrt = function () {\n\t var m,\n\t n,\n\t r,\n\t rep,\n\t t,\n\t x = this,\n\t c = x.c,\n\t s = x.s,\n\t e = x.e,\n\t dp = DECIMAL_PLACES + 4,\n\t half = new BigNumber('0.5');\n\n\t // Negative/NaN/Infinity/zero?\n\t if (s !== 1 || !c || !c[0]) {\n\t return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n\t }\n\n\t // Initial estimate.\n\t s = Math.sqrt(+x);\n\n\t // Math.sqrt underflow/overflow?\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\t if (s == 0 || s == 1 / 0) {\n\t n = coeffToString(c);\n\t if ((n.length + e) % 2 == 0) n += '0';\n\t s = Math.sqrt(n);\n\t e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n\t if (s == 1 / 0) {\n\t n = '1e' + e;\n\t } else {\n\t n = s.toExponential();\n\t n = n.slice(0, n.indexOf('e') + 1) + e;\n\t }\n\n\t r = new BigNumber(n);\n\t } else {\n\t r = new BigNumber(s + '');\n\t }\n\n\t // Check for zero.\n\t // r could be zero if MIN_EXP is changed after the this value was created.\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n\t // coeffToString to throw.\n\t if (r.c[0]) {\n\t e = r.e;\n\t s = e + dp;\n\t if (s < 3) s = 0;\n\n\t // Newton-Raphson iteration.\n\t for (;;) {\n\t t = r;\n\t r = half.times(t.plus(div(x, t, dp, 1)));\n\n\t if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n\n\t // The exponent of r may here be one less than the final result exponent,\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n\t // are indexed correctly.\n\t if (r.e < e) --s;\n\t n = n.slice(s - 3, s + 1);\n\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n\t // iteration.\n\t if (n == '9999' || !rep && n == '4999') {\n\n\t // On the first iteration only, check to see if rounding up gives the\n\t // exact result as the nines may infinitely repeat.\n\t if (!rep) {\n\t round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n\t if (t.times(t).eq(x)) {\n\t r = t;\n\t break;\n\t }\n\t }\n\n\t dp += 4;\n\t s += 4;\n\t rep = 1;\n\t } else {\n\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n\t // result. If not, then there are further digits and m will be truthy.\n\t if (! +n || ! +n.slice(1) && n.charAt(0) == '5') {\n\n\t // Truncate to the first rounding digit.\n\t round(r, r.e + DECIMAL_PLACES + 2, 1);\n\t m = !r.times(r).eq(x);\n\t }\n\n\t break;\n\t }\n\t }\n\t }\n\t }\n\n\t return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n\t };\n\n\t /*\n\t * n * 0 = 0\n\t * n * N = N\n\t * n * I = I\n\t * 0 * n = 0\n\t * 0 * 0 = 0\n\t * 0 * N = N\n\t * 0 * I = N\n\t * N * n = N\n\t * N * 0 = N\n\t * N * N = N\n\t * N * I = N\n\t * I * n = I\n\t * I * 0 = N\n\t * I * N = N\n\t * I * I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\n\t * BigNumber(y, b).\n\t */\n\t P.times = P.mul = function (y, b) {\n\t var c,\n\t e,\n\t i,\n\t j,\n\t k,\n\t m,\n\t xcL,\n\t xlo,\n\t xhi,\n\t ycL,\n\t ylo,\n\t yhi,\n\t zc,\n\t base,\n\t sqrtBase,\n\t x = this,\n\t xc = x.c,\n\t yc = (id = 17, y = new BigNumber(y, b)).c;\n\n\t // Either NaN, ±Infinity or ±0?\n\t if (!xc || !yc || !xc[0] || !yc[0]) {\n\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n\t if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n\t y.c = y.e = y.s = null;\n\t } else {\n\t y.s *= x.s;\n\n\t // Return ±Infinity if either is ±Infinity.\n\t if (!xc || !yc) {\n\t y.c = y.e = null;\n\n\t // Return ±0 if either is ±0.\n\t } else {\n\t y.c = [0];\n\t y.e = 0;\n\t }\n\t }\n\n\t return y;\n\t }\n\n\t e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n\t y.s *= x.s;\n\t xcL = xc.length;\n\t ycL = yc.length;\n\n\t // Ensure xc points to longer array and xcL to its length.\n\t if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n\t // Initialise the result array with zeros.\n\t for (i = xcL + ycL, zc = []; i--; zc.push(0));\n\n\t base = BASE;\n\t sqrtBase = SQRT_BASE;\n\n\t for (i = ycL; --i >= 0;) {\n\t c = 0;\n\t ylo = yc[i] % sqrtBase;\n\t yhi = yc[i] / sqrtBase | 0;\n\n\t for (k = xcL, j = i + k; j > i;) {\n\t xlo = xc[--k] % sqrtBase;\n\t xhi = xc[k] / sqrtBase | 0;\n\t m = yhi * xlo + xhi * ylo;\n\t xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;\n\t c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n\t zc[j--] = xlo % base;\n\t }\n\n\t zc[j] = c;\n\t }\n\n\t if (c) {\n\t ++e;\n\t } else {\n\t zc.shift();\n\t }\n\n\t return normalise(y, zc, e);\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toDigits() precision out of range: {sd}'\n\t * 'toDigits() precision not an integer: {sd}'\n\t * 'toDigits() rounding mode not an integer: {rm}'\n\t * 'toDigits() rounding mode out of range: {rm}'\n\t */\n\t P.toDigits = function (sd, rm) {\n\t var n = new BigNumber(this);\n\t sd = sd == null || !isValidInt(sd, 1, MAX, 18, 'precision') ? null : sd | 0;\n\t rm = rm == null || !isValidInt(rm, 0, 8, 18, roundingMode) ? ROUNDING_MODE : rm | 0;\n\t return sd ? round(n, sd, rm) : n;\n\t };\n\n\t /*\n\t * Return a string representing the value of this BigNumber in exponential notation and\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toExponential() decimal places not an integer: {dp}'\n\t * 'toExponential() decimal places out of range: {dp}'\n\t * 'toExponential() rounding mode not an integer: {rm}'\n\t * 'toExponential() rounding mode out of range: {rm}'\n\t */\n\t P.toExponential = function (dp, rm) {\n\t return format(this, dp != null && isValidInt(dp, 0, MAX, 19) ? ~ ~dp + 1 : null, rm, 19);\n\t };\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFixed() decimal places not an integer: {dp}'\n\t * 'toFixed() decimal places out of range: {dp}'\n\t * 'toFixed() rounding mode not an integer: {rm}'\n\t * 'toFixed() rounding mode out of range: {rm}'\n\t */\n\t P.toFixed = function (dp, rm) {\n\t return format(this, dp != null && isValidInt(dp, 0, MAX, 20) ? ~ ~dp + this.e + 1 : null, rm, 20);\n\t };\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n\t * of the FORMAT object (see BigNumber.config).\n\t *\n\t * FORMAT = {\n\t * decimalSeparator : '.',\n\t * groupSeparator : ',',\n\t * groupSize : 3,\n\t * secondaryGroupSize : 0,\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\n\t * fractionGroupSize : 0\n\t * };\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFormat() decimal places not an integer: {dp}'\n\t * 'toFormat() decimal places out of range: {dp}'\n\t * 'toFormat() rounding mode not an integer: {rm}'\n\t * 'toFormat() rounding mode out of range: {rm}'\n\t */\n\t P.toFormat = function (dp, rm) {\n\t var str = format(this, dp != null && isValidInt(dp, 0, MAX, 21) ? ~ ~dp + this.e + 1 : null, rm, 21);\n\n\t if (this.c) {\n\t var i,\n\t arr = str.split('.'),\n\t g1 = +FORMAT.groupSize,\n\t g2 = +FORMAT.secondaryGroupSize,\n\t groupSeparator = FORMAT.groupSeparator,\n\t intPart = arr[0],\n\t fractionPart = arr[1],\n\t isNeg = this.s < 0,\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\n\t len = intDigits.length;\n\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n\t if (g1 > 0 && len > 0) {\n\t i = len % g1 || g1;\n\t intPart = intDigits.substr(0, i);\n\n\t for (; i < len; i += g1) {\n\t intPart += groupSeparator + intDigits.substr(i, g1);\n\t }\n\n\t if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n\t if (isNeg) intPart = '-' + intPart;\n\t }\n\n\t str = fractionPart ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize) ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'), '$&' + FORMAT.fractionGroupSeparator) : fractionPart) : intPart;\n\t }\n\n\t return str;\n\t };\n\n\t /*\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\n\t * an integer numerator and an integer denominator. The denominator will be a positive\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\n\t * denominator is not specified, the denominator will be the lowest value necessary to\n\t * represent the number exactly.\n\t *\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n\t *\n\t * 'toFraction() max denominator not an integer: {md}'\n\t * 'toFraction() max denominator out of range: {md}'\n\t */\n\t P.toFraction = function (md) {\n\t var arr,\n\t d0,\n\t d2,\n\t e,\n\t exp,\n\t n,\n\t n0,\n\t q,\n\t s,\n\t k = ERRORS,\n\t x = this,\n\t xc = x.c,\n\t d = new BigNumber(ONE),\n\t n1 = d0 = new BigNumber(ONE),\n\t d1 = n0 = new BigNumber(ONE);\n\n\t if (md != null) {\n\t ERRORS = false;\n\t n = new BigNumber(md);\n\t ERRORS = k;\n\n\t if (!(k = n.isInt()) || n.lt(ONE)) {\n\n\t if (ERRORS) {\n\t raise(22, 'max denominator ' + (k ? 'out of range' : 'not an integer'), md);\n\t }\n\n\t // ERRORS is false:\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\n\t md = !k && n.c && round(n, n.e + 1, 1).gte(ONE) ? n : null;\n\t }\n\t }\n\n\t if (!xc) return x.toString();\n\t s = coeffToString(xc);\n\n\t // Determine initial denominator.\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\t e = d.e = s.length - x.e - 1;\n\t d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n\t md = !md || n.cmp(d) > 0 ? e > 0 ? d : n1 : n;\n\n\t exp = MAX_EXP;\n\t MAX_EXP = 1 / 0;\n\t n = new BigNumber(s);\n\n\t // n0 = d1 = 0\n\t n0.c[0] = 0;\n\n\t for (;;) {\n\t q = div(n, d, 0, 1);\n\t d2 = d0.plus(q.times(d1));\n\t if (d2.cmp(md) == 1) break;\n\t d0 = d1;\n\t d1 = d2;\n\t n1 = n0.plus(q.times(d2 = n1));\n\t n0 = d2;\n\t d = n.minus(q.times(d2 = d));\n\t n = d2;\n\t }\n\n\t d2 = div(md.minus(d0), d1, 0, 1);\n\t n0 = n0.plus(d2.times(n1));\n\t d0 = d0.plus(d2.times(d1));\n\t n0.s = n1.s = x.s;\n\t e *= 2;\n\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\n\t arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().cmp(div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1.toString(), d1.toString()] : [n0.toString(), d0.toString()];\n\n\t MAX_EXP = exp;\n\t return arr;\n\t };\n\n\t /*\n\t * Return the value of this BigNumber converted to a number primitive.\n\t */\n\t P.toNumber = function () {\n\t var x = this;\n\n\t // Ensure zero has correct sign.\n\t return +x || (x.s ? x.s * 0 : NaN);\n\t };\n\n\t /*\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n\t * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n\t *\n\t * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n\t * (Performs 54 loop iterations for n of 9007199254740992.)\n\t *\n\t * 'pow() exponent not an integer: {n}'\n\t * 'pow() exponent out of range: {n}'\n\t */\n\t P.toPower = P.pow = function (n) {\n\t var k,\n\t y,\n\t i = mathfloor(n < 0 ? -n : +n),\n\t x = this;\n\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\n\t if (!isValidInt(n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent') && (!isFinite(n) || i > MAX_SAFE_INTEGER && (n /= 0) || parseFloat(n) != n && !(n = NaN))) {\n\t return new BigNumber(Math.pow(+x, n));\n\t }\n\n\t // Truncating each coefficient array to a length of k after each multiplication equates\n\t // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n\t // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n\t k = POW_PRECISION ? mathceil(POW_PRECISION / LOG_BASE + 2) : 0;\n\t y = new BigNumber(ONE);\n\n\t for (;;) {\n\n\t if (i % 2) {\n\t y = y.times(x);\n\t if (!y.c) break;\n\t if (k && y.c.length > k) y.c.length = k;\n\t }\n\n\t i = mathfloor(i / 2);\n\t if (!i) break;\n\n\t x = x.times(x);\n\t if (k && x.c && x.c.length > k) x.c.length = k;\n\t }\n\n\t if (n < 0) y = ONE.div(y);\n\t return k ? round(y, POW_PRECISION, ROUNDING_MODE) : y;\n\t };\n\n\t /*\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\n\t * exponential notation.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toPrecision() precision not an integer: {sd}'\n\t * 'toPrecision() precision out of range: {sd}'\n\t * 'toPrecision() rounding mode not an integer: {rm}'\n\t * 'toPrecision() rounding mode out of range: {rm}'\n\t */\n\t P.toPrecision = function (sd, rm) {\n\t return format(this, sd != null && isValidInt(sd, 1, MAX, 24, 'precision') ? sd | 0 : null, rm, 24);\n\t };\n\n\t /*\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n\t * TO_EXP_NEG, return exponential notation.\n\t *\n\t * [b] {number} Integer, 2 to 64 inclusive.\n\t *\n\t * 'toString() base not an integer: {b}'\n\t * 'toString() base out of range: {b}'\n\t */\n\t P.toString = function (b) {\n\t var str,\n\t n = this,\n\t s = n.s,\n\t e = n.e;\n\n\t // Infinity or NaN?\n\t if (e === null) {\n\n\t if (s) {\n\t str = 'Infinity';\n\t if (s < 0) str = '-' + str;\n\t } else {\n\t str = 'NaN';\n\t }\n\t } else {\n\t str = coeffToString(n.c);\n\n\t if (b == null || !isValidInt(b, 2, 64, 25, 'base')) {\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e);\n\t } else {\n\t str = convertBase(toFixedPoint(str, e), b | 0, 10, s);\n\t }\n\n\t if (s < 0 && n.c[0]) str = '-' + str;\n\t }\n\n\t return str;\n\t };\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n\t * number.\n\t */\n\t P.truncated = P.trunc = function () {\n\t return round(new BigNumber(this), this.e + 1, 1);\n\t };\n\n\t /*\n\t * Return as toString, but do not accept a base argument.\n\t */\n\t P.valueOf = P.toJSON = function () {\n\t return this.toString();\n\t };\n\n\t // Aliases for BigDecimal methods.\n\t //P.add = P.plus; // P.add included above\n\t //P.subtract = P.minus; // P.sub included above\n\t //P.multiply = P.times; // P.mul included above\n\t //P.divide = P.div;\n\t //P.remainder = P.mod;\n\t //P.compareTo = P.cmp;\n\t //P.negate = P.neg;\n\n\t if (configObj != null) BigNumber.config(configObj);\n\n\t return BigNumber;\n\t }", "title": "" }, { "docid": "45998ac5751a8cfcd5568f77d3cf7ba1", "score": "0.4768629", "text": "function constructorFactory(configObj) {\n\t var div,\n\n\t // id tracks the caller function, so its name can be included in error messages.\n\t id = 0,\n\t P = BigNumber.prototype,\n\t ONE = new BigNumber(1),\n\n\n\t /********************************* EDITABLE DEFAULTS **********************************/\n\n\n\t /*\n\t * The default values below must be integers within the inclusive ranges stated.\n\t * The values can also be changed at run-time using BigNumber.config.\n\t */\n\n\t // The maximum number of decimal places for operations involving division.\n\t DECIMAL_PLACES = 20, // 0 to MAX\n\n\t /*\n\t * The rounding mode used when rounding to the above decimal places, and when using\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n\t * UP 0 Away from zero.\n\t * DOWN 1 Towards zero.\n\t * CEIL 2 Towards +Infinity.\n\t * FLOOR 3 Towards -Infinity.\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n\t */\n\t ROUNDING_MODE = 4, // 0 to 8\n\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n\t // The exponent value at and beneath which toString returns exponential notation.\n\t // Number type: -7\n\t TO_EXP_NEG = -7, // 0 to -MAX\n\n\t // The exponent value at and above which toString returns exponential notation.\n\t // Number type: 21\n\t TO_EXP_POS = 21, // 0 to MAX\n\n\t // RANGE : [MIN_EXP, MAX_EXP]\n\n\t // The minimum exponent value, beneath which underflow to zero occurs.\n\t // Number type: -324 (5e-324)\n\t MIN_EXP = -1e7, // -1 to -MAX\n\n\t // The maximum exponent value, above which overflow to Infinity occurs.\n\t // Number type: 308 (1.7976931348623157e+308)\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n\t MAX_EXP = 1e7, // 1 to MAX\n\n\t // Whether BigNumber Errors are ever thrown.\n\t ERRORS = true, // true or false\n\n\t // Change to intValidatorNoErrors if ERRORS is false.\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n\t // Whether to use cryptographically-secure random number generation, if available.\n\t CRYPTO = false, // true or false\n\n\t /*\n\t * The modulo mode used when calculating the modulus: a mod n.\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n\t * The remainder (r) is calculated as: r = a - n * q.\n\t *\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\n\t * DOWN 1 The remainder has the same sign as the dividend.\n\t * This modulo mode is commonly known as 'truncated division' and is\n\t * equivalent to (a % n) in JavaScript.\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n\t * The remainder is always positive.\n\t *\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n\t * modes are commonly used for the modulus operation.\n\t * Although the other rounding modes can also be used, they may not give useful results.\n\t */\n\t MODULO_MODE = 1, // 0 to 9\n\n\t // The maximum number of significant digits of the result of the toPower operation.\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\n\t POW_PRECISION = 100, // 0 to MAX\n\n\t // The format specification used by the BigNumber.prototype.toFormat method.\n\t FORMAT = {\n\t decimalSeparator: '.',\n\t groupSeparator: ',',\n\t groupSize: 3,\n\t secondaryGroupSize: 0,\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\n\t fractionGroupSize: 0\n\t };\n\n\n\t /******************************************************************************************/\n\n\n\t // CONSTRUCTOR\n\n\n\t /*\n\t * The BigNumber constructor and exported function.\n\t * Create and return a new instance of a BigNumber object.\n\t *\n\t * n {number|string|BigNumber} A numeric value.\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n\t */\n\t function BigNumber( n, b ) {\n\t var c, e, i, num, len, str,\n\t x = this;\n\n\t // Enable constructor usage without new.\n\t if ( !( x instanceof BigNumber ) ) {\n\n\t // 'BigNumber() constructor call without new: {n}'\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\n\t return new BigNumber( n, b );\n\t }\n\n\t // 'new BigNumber() base not an integer: {b}'\n\t // 'new BigNumber() base out of range: {b}'\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n\t // Duplicate.\n\t if ( n instanceof BigNumber ) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = ( n = n.c ) ? n.slice() : n;\n\t id = 0;\n\t return;\n\t }\n\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n\t // Fast path for integers.\n\t if ( n === ~~n ) {\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n\t x.e = e;\n\t x.c = [n];\n\t id = 0;\n\t return;\n\t }\n\n\t str = n + '';\n\t } else {\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\t } else {\n\t b = b | 0;\n\t str = n + '';\n\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n\t // Allow exponential notation to be used with base 10 argument.\n\t if ( b == 10 ) {\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n\t }\n\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n\t // Any number in exponential form will fail due to the [Ee][+-].\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n\t return parseNumeric( x, str, num, b );\n\t }\n\n\t if (num) {\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t raise( id, tooManyDigits, n );\n\t }\n\n\t // Prevent later check for length on converted number.\n\t num = false;\n\t } else {\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\n\t str = convertBase( str, 10, b, x.s );\n\t }\n\n\t // Decimal point?\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n\t // Exponential form?\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n\t // Determine exponent.\n\t if ( e < 0 ) e = i;\n\t e += +str.slice( i + 1 );\n\t str = str.substring( 0, i );\n\t } else if ( e < 0 ) {\n\n\t // Integer.\n\t e = str.length;\n\t }\n\n\t // Determine leading zeros.\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n\t // Determine trailing zeros.\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\n\t str = str.slice( i, len + 1 );\n\n\t if (str) {\n\t len = str.length;\n\n\t // Disallow numbers with over 15 significant digits if number type.\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n\t raise( id, tooManyDigits, x.s * n );\n\t }\n\n\t e = e - i - 1;\n\n\t // Overflow?\n\t if ( e > MAX_EXP ) {\n\n\t // Infinity.\n\t x.c = x.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t } else {\n\t x.e = e;\n\t x.c = [];\n\n\t // Transform base\n\n\t // e is the base 10 exponent.\n\t // i is where to slice str to get the first element of the coefficient array.\n\t i = ( e + 1 ) % LOG_BASE;\n\t if ( e < 0 ) i += LOG_BASE;\n\n\t if ( i < len ) {\n\t if (i) x.c.push( +str.slice( 0, i ) );\n\n\t for ( len -= LOG_BASE; i < len; ) {\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\n\t }\n\n\t str = str.slice(i);\n\t i = LOG_BASE - str.length;\n\t } else {\n\t i -= len;\n\t }\n\n\t for ( ; i--; str += '0' );\n\t x.c.push( +str );\n\t }\n\t } else {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t }\n\n\t id = 0;\n\t }\n\n\n\t // CONSTRUCTOR PROPERTIES\n\n\n\t BigNumber.another = constructorFactory;\n\n\t BigNumber.ROUND_UP = 0;\n\t BigNumber.ROUND_DOWN = 1;\n\t BigNumber.ROUND_CEIL = 2;\n\t BigNumber.ROUND_FLOOR = 3;\n\t BigNumber.ROUND_HALF_UP = 4;\n\t BigNumber.ROUND_HALF_DOWN = 5;\n\t BigNumber.ROUND_HALF_EVEN = 6;\n\t BigNumber.ROUND_HALF_CEIL = 7;\n\t BigNumber.ROUND_HALF_FLOOR = 8;\n\t BigNumber.EUCLID = 9;\n\n\n\t /*\n\t * Configure infrequently-changing library-wide settings.\n\t *\n\t * Accept an object or an argument list, with one or many of the following properties or\n\t * parameters respectively:\n\t *\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n\t * ERRORS {boolean|number} true, false, 1 or 0\n\t * CRYPTO {boolean|number} true, false, 1 or 0\n\t * MODULO_MODE {number} 0 to 9 inclusive\n\t * POW_PRECISION {number} 0 to MAX inclusive\n\t * FORMAT {object} See BigNumber.prototype.toFormat\n\t * decimalSeparator {string}\n\t * groupSeparator {string}\n\t * groupSize {number}\n\t * secondaryGroupSize {number}\n\t * fractionGroupSeparator {string}\n\t * fractionGroupSize {number}\n\t *\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\n\t *\n\t * E.g.\n\t * BigNumber.config(20, 4) is equivalent to\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n\t *\n\t * Ignore properties/parameters set to null or undefined.\n\t * Return an object with the properties current values.\n\t */\n\t BigNumber.config = function () {\n\t var v, p,\n\t i = 0,\n\t r = {},\n\t a = arguments,\n\t o = a[0],\n\t has = o && typeof o == 'object'\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\n\t // 'config() DECIMAL_PLACES out of range: {v}'\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t DECIMAL_PLACES = v | 0;\n\t }\n\t r[p] = DECIMAL_PLACES;\n\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n\t // 'config() ROUNDING_MODE not an integer: {v}'\n\t // 'config() ROUNDING_MODE out of range: {v}'\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n\t ROUNDING_MODE = v | 0;\n\t }\n\t r[p] = ROUNDING_MODE;\n\n\t // EXPONENTIAL_AT {number|number[]}\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n\t TO_EXP_NEG = v[0] | 0;\n\t TO_EXP_POS = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n\t }\n\t }\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n\t // 'config() RANGE not an integer: {v}'\n\t // 'config() RANGE cannot be zero: {v}'\n\t // 'config() RANGE out of range: {v}'\n\t if ( has( p = 'RANGE' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n\t MIN_EXP = v[0] | 0;\n\t MAX_EXP = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n\t }\n\t }\n\t r[p] = [ MIN_EXP, MAX_EXP ];\n\n\t // ERRORS {boolean|number} true, false, 1 or 0.\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\n\t if ( has( p = 'ERRORS' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t id = 0;\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = ERRORS;\n\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\n\t // 'config() crypto unavailable: {crypto}'\n\t if ( has( p = 'CRYPTO' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t CRYPTO = !!( v && cryptoObj );\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', cryptoObj );\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = CRYPTO;\n\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n\t // 'config() MODULO_MODE not an integer: {v}'\n\t // 'config() MODULO_MODE out of range: {v}'\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n\t MODULO_MODE = v | 0;\n\t }\n\t r[p] = MODULO_MODE;\n\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n\t // 'config() POW_PRECISION not an integer: {v}'\n\t // 'config() POW_PRECISION out of range: {v}'\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t POW_PRECISION = v | 0;\n\t }\n\t r[p] = POW_PRECISION;\n\n\t // FORMAT {object}\n\t // 'config() FORMAT not an object: {v}'\n\t if ( has( p = 'FORMAT' ) ) {\n\n\t if ( typeof v == 'object' ) {\n\t FORMAT = v;\n\t } else if (ERRORS) {\n\t raise( 2, p + ' not an object', v );\n\t }\n\t }\n\t r[p] = FORMAT;\n\n\t return r;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the maximum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the minimum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n\t /*\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n\t * zeros are produced).\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t *\n\t * 'random() decimal places not an integer: {dp}'\n\t * 'random() decimal places out of range: {dp}'\n\t * 'random() crypto unavailable: {crypto}'\n\t */\n\t BigNumber.random = (function () {\n\t var pow2_53 = 0x20000000000000;\n\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n\t // Check if Math.random() produces more than 32 bits of randomness.\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n\t (Math.random() * 0x800000 | 0); };\n\n\t return function (dp) {\n\t var a, b, e, k, v,\n\t i = 0,\n\t c = [],\n\t rand = new BigNumber(ONE);\n\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n\t k = mathceil( dp / LOG_BASE );\n\n\t if (CRYPTO) {\n\n\t // Browsers supporting crypto.getRandomValues.\n\t if ( cryptoObj && cryptoObj.getRandomValues ) {\n\n\t a = cryptoObj.getRandomValues( new Uint32Array( k *= 2 ) );\n\n\t for ( ; i < k; ) {\n\n\t // 53 bits:\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n\t // 11111 11111111 11111111\n\t // 0x20000 is 2^21.\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n\t // Rejection sampling:\n\t // 0 <= v < 9007199254740992\n\t // Probability that v >= 9e15, is\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\t if ( v >= 9e15 ) {\n\t b = cryptoObj.getRandomValues( new Uint32Array(2) );\n\t a[i] = b[0];\n\t a[i + 1] = b[1];\n\t } else {\n\n\t // 0 <= v <= 8999999999999999\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 2;\n\t }\n\t }\n\t i = k / 2;\n\n\t // Node.js supporting crypto.randomBytes.\n\t } else if ( cryptoObj && cryptoObj.randomBytes ) {\n\n\t // buffer\n\t a = cryptoObj.randomBytes( k *= 7 );\n\n\t for ( ; i < k; ) {\n\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n\t // 0 <= v < 9007199254740992\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n\t if ( v >= 9e15 ) {\n\t cryptoObj.randomBytes(7).copy( a, i );\n\t } else {\n\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 7;\n\t }\n\t }\n\t i = k / 7;\n\t } else if (ERRORS) {\n\t raise( 14, 'crypto unavailable', cryptoObj );\n\t }\n\t }\n\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n\t if (!i) {\n\n\t for ( ; i < k; ) {\n\t v = random53bitInt();\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\n\t }\n\t }\n\n\t k = c[--i];\n\t dp %= LOG_BASE;\n\n\t // Convert trailing digits to zeros according to dp.\n\t if ( k && dp ) {\n\t v = POWS_TEN[LOG_BASE - dp];\n\t c[i] = mathfloor( k / v ) * v;\n\t }\n\n\t // Remove trailing elements which are zero.\n\t for ( ; c[i] === 0; c.pop(), i-- );\n\n\t // Zero?\n\t if ( i < 0 ) {\n\t c = [ e = 0 ];\n\t } else {\n\n\t // Remove leading elements which are zero and adjust exponent accordingly.\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n\t // Count the digits of the first element of c to determine leading zeros, and...\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n\t // adjust the exponent accordingly.\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\n\t }\n\n\t rand.e = e;\n\t rand.c = c;\n\t return rand;\n\t };\n\t })();\n\n\n\t // PRIVATE FUNCTIONS\n\n\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\n\t function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }\n\n\n\t // Perform division in the specified base. Called by div and convertBase.\n\t div = (function () {\n\n\t // Assume non-zero x and k.\n\t function multiply( x, k, base ) {\n\t var m, temp, xlo, xhi,\n\t carry = 0,\n\t i = x.length,\n\t klo = k % SQRT_BASE,\n\t khi = k / SQRT_BASE | 0;\n\n\t for ( x = x.slice(); i--; ) {\n\t xlo = x[i] % SQRT_BASE;\n\t xhi = x[i] / SQRT_BASE | 0;\n\t m = khi * xlo + xhi * klo;\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n\t x[i] = temp % base;\n\t }\n\n\t if (carry) x.unshift(carry);\n\n\t return x;\n\t }\n\n\t function compare( a, b, aL, bL ) {\n\t var i, cmp;\n\n\t if ( aL != bL ) {\n\t cmp = aL > bL ? 1 : -1;\n\t } else {\n\n\t for ( i = cmp = 0; i < aL; i++ ) {\n\n\t if ( a[i] != b[i] ) {\n\t cmp = a[i] > b[i] ? 1 : -1;\n\t break;\n\t }\n\t }\n\t }\n\t return cmp;\n\t }\n\n\t function subtract( a, b, aL, base ) {\n\t var i = 0;\n\n\t // Subtract b from a.\n\t for ( ; aL--; ) {\n\t a[aL] -= i;\n\t i = a[aL] < b[aL] ? 1 : 0;\n\t a[aL] = i * base + a[aL] - b[aL];\n\t }\n\n\t // Remove leading zeros.\n\t for ( ; !a[0] && a.length > 1; a.shift() );\n\t }\n\n\t // x: dividend, y: divisor.\n\t return function ( x, y, dp, rm, base ) {\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n\t yL, yz,\n\t s = x.s == y.s ? 1 : -1,\n\t xc = x.c,\n\t yc = y.c;\n\n\t // Either NaN, Infinity or 0?\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n\t return new BigNumber(\n\n\t // Return NaN if either NaN, or both Infinity or 0.\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n\t );\n\t }\n\n\t q = new BigNumber(s);\n\t qc = q.c = [];\n\t e = x.e - y.e;\n\t s = dp + e + 1;\n\n\t if ( !base ) {\n\t base = BASE;\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n\t s = s / LOG_BASE | 0;\n\t }\n\n\t // Result exponent may be one less then the current value of e.\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n\t if ( s < 0 ) {\n\t qc.push(1);\n\t more = true;\n\t } else {\n\t xL = xc.length;\n\t yL = yc.length;\n\t i = 0;\n\t s += 2;\n\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n\t n = mathfloor( base / ( yc[0] + 1 ) );\n\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n\t if ( n > 1 ) {\n\t yc = multiply( yc, n, base );\n\t xc = multiply( xc, n, base );\n\t yL = yc.length;\n\t xL = xc.length;\n\t }\n\n\t xi = yL;\n\t rem = xc.slice( 0, yL );\n\t remL = rem.length;\n\n\t // Add zeros to make remainder as long as divisor.\n\t for ( ; remL < yL; rem[remL++] = 0 );\n\t yz = yc.slice();\n\t yz.unshift(0);\n\t yc0 = yc[0];\n\t if ( yc[1] >= base / 2 ) yc0++;\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n\t do {\n\t n = 0;\n\n\t // Compare divisor and remainder.\n\t cmp = compare( yc, rem, yL, remL );\n\n\t // If divisor < remainder.\n\t if ( cmp < 0 ) {\n\n\t // Calculate trial digit, n.\n\n\t rem0 = rem[0];\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n\t // n is how many times the divisor goes into the current remainder.\n\t n = mathfloor( rem0 / yc0 );\n\n\t // Algorithm:\n\t // 1. product = divisor * trial digit (n)\n\t // 2. if product > remainder: product -= divisor, n--\n\t // 3. remainder -= product\n\t // 4. if product was < remainder at 2:\n\t // 5. compare new remainder and divisor\n\t // 6. If remainder > divisor: remainder -= divisor, n++\n\n\t if ( n > 1 ) {\n\n\t // n may be > base only when base is 3.\n\t if (n >= base) n = base - 1;\n\n\t // product = divisor * trial digit.\n\t prod = multiply( yc, n, base );\n\t prodL = prod.length;\n\t remL = rem.length;\n\n\t // Compare product and remainder.\n\t // If product > remainder.\n\t // Trial digit n too high.\n\t // n is 1 too high about 5% of the time, and is not known to have\n\t // ever been more than 1 too high.\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\n\t n--;\n\n\t // Subtract divisor from product.\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\n\t prodL = prod.length;\n\t cmp = 1;\n\t }\n\t } else {\n\n\t // n is 0 or 1, cmp is -1.\n\t // If n is 0, there is no need to compare yc and rem again below,\n\t // so change cmp to 1 to avoid it.\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\n\t if ( n == 0 ) {\n\n\t // divisor < remainder, so n must be at least 1.\n\t cmp = n = 1;\n\t }\n\n\t // product = divisor\n\t prod = yc.slice();\n\t prodL = prod.length;\n\t }\n\n\t if ( prodL < remL ) prod.unshift(0);\n\n\t // Subtract product from remainder.\n\t subtract( rem, prod, remL, base );\n\t remL = rem.length;\n\n\t // If product was < remainder.\n\t if ( cmp == -1 ) {\n\n\t // Compare divisor and new remainder.\n\t // If divisor < new remainder, subtract divisor from remainder.\n\t // Trial digit n too low.\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\n\t n++;\n\n\t // Subtract divisor from remainder.\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\n\t remL = rem.length;\n\t }\n\t }\n\t } else if ( cmp === 0 ) {\n\t n++;\n\t rem = [0];\n\t } // else cmp === 1 and n will be 0\n\n\t // Add the next digit, n, to the result array.\n\t qc[i++] = n;\n\n\t // Update the remainder.\n\t if ( rem[0] ) {\n\t rem[remL++] = xc[xi] || 0;\n\t } else {\n\t rem = [ xc[xi] ];\n\t remL = 1;\n\t }\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n\t more = rem[0] != null;\n\n\t // Leading zero?\n\t if ( !qc[0] ) qc.shift();\n\t }\n\n\t if ( base == BASE ) {\n\n\t // To calculate q.e, first get the number of digits of qc[0].\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n\t // Caller is convertBase.\n\t } else {\n\t q.e = e;\n\t q.r = +more;\n\t }\n\n\t return q;\n\t };\n\t })();\n\n\n\t /*\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\n\t * notation rounded to the specified decimal places or significant digits.\n\t *\n\t * n is a BigNumber.\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\n\t * rm is the rounding mode.\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n\t */\n\t function format( n, i, rm, caller ) {\n\t var c0, e, ne, len, str;\n\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n\t ? rm | 0 : ROUNDING_MODE;\n\n\t if ( !n.c ) return n.toString();\n\t c0 = n.c[0];\n\t ne = n.e;\n\n\t if ( i == null ) {\n\t str = coeffToString( n.c );\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n\t ? toExponential( str, ne )\n\t : toFixedPoint( str, ne );\n\t } else {\n\t n = round( new BigNumber(n), i, rm );\n\n\t // n.e may have changed if the value was rounded up.\n\t e = n.e;\n\n\t str = coeffToString( n.c );\n\t len = str.length;\n\n\t // toPrecision returns exponential notation if the number of significant digits\n\t // specified is less than the number of digits necessary to represent the integer\n\t // part of the value in fixed-point notation.\n\n\t // Exponential notation.\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n\t // Append zeros?\n\t for ( ; len < i; str += '0', len++ );\n\t str = toExponential( str, e );\n\n\t // Fixed-point notation.\n\t } else {\n\t i -= ne;\n\t str = toFixedPoint( str, e );\n\n\t // Append zeros?\n\t if ( e + 1 > len ) {\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n\t } else {\n\t i += e - len;\n\t if ( i > 0 ) {\n\t if ( e + 1 == len ) str += '.';\n\t for ( ; i--; str += '0' );\n\t }\n\t }\n\t }\n\t }\n\n\t return n.s < 0 && c0 ? '-' + str : str;\n\t }\n\n\n\t // Handle BigNumber.max and BigNumber.min.\n\t function maxOrMin( args, method ) {\n\t var m, n,\n\t i = 0;\n\n\t if ( isArray( args[0] ) ) args = args[0];\n\t m = new BigNumber( args[0] );\n\n\t for ( ; ++i < args.length; ) {\n\t n = new BigNumber( args[i] );\n\n\t // If any number is NaN, return NaN.\n\t if ( !n.s ) {\n\t m = n;\n\t break;\n\t } else if ( method.call( m, n ) ) {\n\t m = n;\n\t }\n\t }\n\n\t return m;\n\t }\n\n\n\t /*\n\t * Return true if n is an integer in range, otherwise throw.\n\t * Use for argument validation when ERRORS is true.\n\t */\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\n\t if ( n < min || n > max || n != truncate(n) ) {\n\t raise( caller, ( name || 'decimal places' ) +\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n\t }\n\n\t return true;\n\t }\n\n\n\t /*\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n\t * Called by minus, plus and times.\n\t */\n\t function normalise( n, c, e ) {\n\t var i = 1,\n\t j = c.length;\n\n\t // Remove trailing zeros.\n\t for ( ; !c[--j]; c.pop() );\n\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n\t // Overflow?\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n\t // Infinity.\n\t n.c = n.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t n.c = [ n.e = 0 ];\n\t } else {\n\t n.e = e;\n\t n.c = c;\n\t }\n\n\t return n;\n\t }\n\n\n\t // Handle values that fail the validity test in BigNumber.\n\t parseNumeric = (function () {\n\t var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n\t dotAfter = /^([^.]+)\\.$/,\n\t dotBefore = /^\\.([^.]+)$/,\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n\t whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n\t return function ( x, str, num, b ) {\n\t var base,\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n\t // No exception on ±Infinity or NaN.\n\t if ( isInfinityOrNaN.test(s) ) {\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n\t } else {\n\t if ( !num ) {\n\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n\t return !b || b == base ? p1 : m;\n\t });\n\n\t if (b) {\n\t base = b;\n\n\t // E.g. '1.' to '1', '.1' to '0.1'\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n\t }\n\n\t if ( str != s ) return new BigNumber( s, base );\n\t }\n\n\t // 'new BigNumber() not a number: {n}'\n\t // 'new BigNumber() not a base {b} number: {n}'\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n\t x.s = null;\n\t }\n\n\t x.c = x.e = null;\n\t id = 0;\n\t }\n\t })();\n\n\n\t // Throw a BigNumber Error.\n\t function raise( caller, msg, val ) {\n\t var error = new Error( [\n\t 'new BigNumber', // 0\n\t 'cmp', // 1\n\t 'config', // 2\n\t 'div', // 3\n\t 'divToInt', // 4\n\t 'eq', // 5\n\t 'gt', // 6\n\t 'gte', // 7\n\t 'lt', // 8\n\t 'lte', // 9\n\t 'minus', // 10\n\t 'mod', // 11\n\t 'plus', // 12\n\t 'precision', // 13\n\t 'random', // 14\n\t 'round', // 15\n\t 'shift', // 16\n\t 'times', // 17\n\t 'toDigits', // 18\n\t 'toExponential', // 19\n\t 'toFixed', // 20\n\t 'toFormat', // 21\n\t 'toFraction', // 22\n\t 'pow', // 23\n\t 'toPrecision', // 24\n\t 'toString', // 25\n\t 'BigNumber' // 26\n\t ][caller] + '() ' + msg + ': ' + val );\n\n\t error.name = 'BigNumber Error';\n\t id = 0;\n\t throw error;\n\t }\n\n\n\t /*\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\n\t */\n\t function round( x, sd, rm, r ) {\n\t var d, i, j, k, n, ni, rd,\n\t xc = x.c,\n\t pows10 = POWS_TEN;\n\n\t // if x is not Infinity or NaN...\n\t if (xc) {\n\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\n\t // ni is the index of n within x.c.\n\t // d is the number of digits of n.\n\t // i is the index of rd within n including leading zeros.\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\n\t out: {\n\n\t // Get the number of digits of the first element of xc.\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n\t i = sd - d;\n\n\t // If the rounding digit is in the first element of xc...\n\t if ( i < 0 ) {\n\t i += LOG_BASE;\n\t j = sd;\n\t n = xc[ ni = 0 ];\n\n\t // Get the rounding digit at index j of n.\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\n\t } else {\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n\t if ( ni >= xc.length ) {\n\n\t if (r) {\n\n\t // Needed by sqrt.\n\t for ( ; xc.length <= ni; xc.push(0) );\n\t n = rd = 0;\n\t d = 1;\n\t i %= LOG_BASE;\n\t j = i - LOG_BASE + 1;\n\t } else {\n\t break out;\n\t }\n\t } else {\n\t n = k = xc[ni];\n\n\t // Get the number of digits of n.\n\t for ( d = 1; k >= 10; k /= 10, d++ );\n\n\t // Get the index of rd within n.\n\t i %= LOG_BASE;\n\n\t // Get the index of rd within n, adjusted for leading zeros.\n\t // The number of leading zeros of n is given by LOG_BASE - d.\n\t j = i - LOG_BASE + d;\n\n\t // Get the rounding digit at index j of n.\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n\t }\n\t }\n\n\t r = r || sd < 0 ||\n\n\t // Are there any non-zero digits after the rounding digit?\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n\t r = rm < 4\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n\t // Check whether the digit to the left of the rounding digit is odd.\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( sd < 1 || !xc[0] ) {\n\t xc.length = 0;\n\n\t if (r) {\n\n\t // Convert sd to decimal places.\n\t sd -= x.e + 1;\n\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\t xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n\t x.e = -sd || 0;\n\t } else {\n\n\t // Zero.\n\t xc[0] = x.e = 0;\n\t }\n\n\t return x;\n\t }\n\n\t // Remove excess digits.\n\t if ( i == 0 ) {\n\t xc.length = ni;\n\t k = 1;\n\t ni--;\n\t } else {\n\t xc.length = ni + 1;\n\t k = pows10[ LOG_BASE - i ];\n\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n\t // j > 0 means i > number of leading zeros of n.\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n\t }\n\n\t // Round up?\n\t if (r) {\n\n\t for ( ; ; ) {\n\n\t // If the digit to be rounded up is in the first element of xc...\n\t if ( ni == 0 ) {\n\n\t // i will be the length of xc[0] before k is added.\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n\t j = xc[0] += k;\n\t for ( k = 1; j >= 10; j /= 10, k++ );\n\n\t // if i != k the length has increased.\n\t if ( i != k ) {\n\t x.e++;\n\t if ( xc[0] == BASE ) xc[0] = 1;\n\t }\n\n\t break;\n\t } else {\n\t xc[ni] += k;\n\t if ( xc[ni] != BASE ) break;\n\t xc[ni--] = 0;\n\t k = 1;\n\t }\n\t }\n\t }\n\n\t // Remove trailing zeros.\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\n\t }\n\n\t // Overflow? Infinity.\n\t if ( x.e > MAX_EXP ) {\n\t x.c = x.e = null;\n\n\t // Underflow? Zero.\n\t } else if ( x.e < MIN_EXP ) {\n\t x.c = [ x.e = 0 ];\n\t }\n\t }\n\n\t return x;\n\t }\n\n\n\t // PROTOTYPE/INSTANCE METHODS\n\n\n\t /*\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\n\t */\n\t P.absoluteValue = P.abs = function () {\n\t var x = new BigNumber(this);\n\t if ( x.s < 0 ) x.s = 1;\n\t return x;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of Infinity.\n\t */\n\t P.ceil = function () {\n\t return round( new BigNumber(this), this.e + 1, 2 );\n\t };\n\n\n\t /*\n\t * Return\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * 0 if they have the same value,\n\t * or null if the value of either is NaN.\n\t */\n\t P.comparedTo = P.cmp = function ( y, b ) {\n\t id = 1;\n\t return compare( this, new BigNumber( y, b ) );\n\t };\n\n\n\t /*\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\n\t * of this BigNumber is ±Infinity or NaN.\n\t */\n\t P.decimalPlaces = P.dp = function () {\n\t var n, v,\n\t c = this.c;\n\n\t if ( !c ) return null;\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n\t // Subtract the number of trailing zeros of the last number.\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n\t if ( n < 0 ) n = 0;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * n / 0 = I\n\t * n / N = N\n\t * n / I = 0\n\t * 0 / n = 0\n\t * 0 / 0 = N\n\t * 0 / N = N\n\t * 0 / I = 0\n\t * N / n = N\n\t * N / 0 = N\n\t * N / N = N\n\t * N / I = N\n\t * I / n = I\n\t * I / 0 = I\n\t * I / N = N\n\t * I / I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.dividedBy = P.div = function ( y, b ) {\n\t id = 3;\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\n\t * BigNumber by the value of BigNumber(y, b).\n\t */\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n\t id = 4;\n\t return div( this, new BigNumber( y, b ), 0, 1 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.equals = P.eq = function ( y, b ) {\n\t id = 5;\n\t return compare( this, new BigNumber( y, b ) ) === 0;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of -Infinity.\n\t */\n\t P.floor = function () {\n\t return round( new BigNumber(this), this.e + 1, 3 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.greaterThan = P.gt = function ( y, b ) {\n\t id = 6;\n\t return compare( this, new BigNumber( y, b ) ) > 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n\t id = 7;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n\t */\n\t P.isFinite = function () {\n\t return !!this.c;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\n\t */\n\t P.isInteger = P.isInt = function () {\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\n\t */\n\t P.isNaN = function () {\n\t return !this.s;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\n\t */\n\t P.isNegative = P.isNeg = function () {\n\t return this.s < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n\t */\n\t P.isZero = function () {\n\t return !!this.c && this.c[0] == 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.lessThan = P.lt = function ( y, b ) {\n\t id = 8;\n\t return compare( this, new BigNumber( y, b ) ) < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n\t id = 9;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n\t };\n\n\n\t /*\n\t * n - 0 = n\n\t * n - N = N\n\t * n - I = -I\n\t * 0 - n = -n\n\t * 0 - 0 = 0\n\t * 0 - N = N\n\t * 0 - I = -I\n\t * N - n = N\n\t * N - 0 = N\n\t * N - N = N\n\t * N - I = N\n\t * I - n = I\n\t * I - 0 = I\n\t * I - N = N\n\t * I - I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.minus = P.sub = function ( y, b ) {\n\t var i, j, t, xLTy,\n\t x = this,\n\t a = x.s;\n\n\t id = 10;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.plus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Either Infinity?\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n\t // Either zero?\n\t if ( !xc[0] || !yc[0] ) {\n\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n\t ROUNDING_MODE == 3 ? -0 : 0 );\n\t }\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Determine which is the bigger number.\n\t if ( a = xe - ye ) {\n\n\t if ( xLTy = a < 0 ) {\n\t a = -a;\n\t t = xc;\n\t } else {\n\t ye = xe;\n\t t = yc;\n\t }\n\n\t t.reverse();\n\n\t // Prepend zeros to equalise exponents.\n\t for ( b = a; b--; t.push(0) );\n\t t.reverse();\n\t } else {\n\n\t // Exponents equal. Check digit by digit.\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n\t for ( a = b = 0; b < j; b++ ) {\n\n\t if ( xc[b] != yc[b] ) {\n\t xLTy = xc[b] < yc[b];\n\t break;\n\t }\n\t }\n\t }\n\n\t // x < y? Point xc to the array of the bigger number.\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n\t b = ( j = yc.length ) - ( i = xc.length );\n\n\t // Append zeros to xc if shorter.\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n\t b = BASE - 1;\n\n\t // Subtract yc from xc.\n\t for ( ; j > a; ) {\n\n\t if ( xc[--j] < yc[j] ) {\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\n\t --xc[i];\n\t xc[j] += BASE;\n\t }\n\n\t xc[j] -= yc[j];\n\t }\n\n\t // Remove leading zeros and adjust exponent accordingly.\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\n\n\t // Zero?\n\t if ( !xc[0] ) {\n\n\t // Following IEEE 754 (2008) 6.3,\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\n\t y.c = [ y.e = 0 ];\n\t return y;\n\t }\n\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n\t // for finite x and y.\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * n % 0 = N\n\t * n % N = N\n\t * n % I = n\n\t * 0 % n = 0\n\t * -0 % n = -0\n\t * 0 % 0 = N\n\t * 0 % N = N\n\t * 0 % I = 0\n\t * N % n = N\n\t * N % 0 = N\n\t * N % N = N\n\t * N % I = N\n\t * I % n = N\n\t * I % 0 = N\n\t * I % N = N\n\t * I % I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n\t */\n\t P.modulo = P.mod = function ( y, b ) {\n\t var q, s,\n\t x = this;\n\n\t id = 11;\n\t y = new BigNumber( y, b );\n\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\n\t return new BigNumber(NaN);\n\n\t // Return x if y is Infinity or x is zero.\n\t } else if ( !y.c || x.c && !x.c[0] ) {\n\t return new BigNumber(x);\n\t }\n\n\t if ( MODULO_MODE == 9 ) {\n\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\n\t // r = x - qy where 0 <= r < abs(y)\n\t s = y.s;\n\t y.s = 1;\n\t q = div( x, y, 0, 3 );\n\t y.s = s;\n\t q.s *= s;\n\t } else {\n\t q = div( x, y, 0, MODULO_MODE );\n\t }\n\n\t return x.minus( q.times(y) );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\n\t * i.e. multiplied by -1.\n\t */\n\t P.negated = P.neg = function () {\n\t var x = new BigNumber(this);\n\t x.s = -x.s || null;\n\t return x;\n\t };\n\n\n\t /*\n\t * n + 0 = n\n\t * n + N = N\n\t * n + I = I\n\t * 0 + n = n\n\t * 0 + 0 = 0\n\t * 0 + N = N\n\t * 0 + I = I\n\t * N + n = N\n\t * N + 0 = N\n\t * N + N = N\n\t * N + I = N\n\t * I + n = I\n\t * I + 0 = I\n\t * I + N = N\n\t * I + I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.plus = P.add = function ( y, b ) {\n\t var t,\n\t x = this,\n\t a = x.s;\n\n\t id = 12;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.minus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Return ±Infinity if either ±Infinity.\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n\t // Either zero?\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\t if ( a = xe - ye ) {\n\t if ( a > 0 ) {\n\t ye = xe;\n\t t = yc;\n\t } else {\n\t a = -a;\n\t t = xc;\n\t }\n\n\t t.reverse();\n\t for ( ; a--; t.push(0) );\n\t t.reverse();\n\t }\n\n\t a = xc.length;\n\t b = yc.length;\n\n\t // Point xc to the longer array, and b to the shorter length.\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\t for ( a = 0; b; ) {\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n\t xc[b] %= BASE;\n\t }\n\n\t if (a) {\n\t xc.unshift(a);\n\t ++ye;\n\t }\n\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\t // ye = MAX_EXP + 1 possible\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * Return the number of significant digits of the value of this BigNumber.\n\t *\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n\t */\n\t P.precision = P.sd = function (z) {\n\t var n, v,\n\t x = this,\n\t c = x.c;\n\n\t // 'precision() argument not a boolean or binary digit: {z}'\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\n\t if ( z != !!z ) z = null;\n\t }\n\n\t if ( !c ) return null;\n\t v = c.length - 1;\n\t n = v * LOG_BASE + 1;\n\n\t if ( v = c[v] ) {\n\n\t // Subtract the number of trailing zeros of the last element.\n\t for ( ; v % 10 == 0; v /= 10, n-- );\n\n\t // Add the number of digits of the first element.\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\n\t }\n\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n\t * omitted.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'round() decimal places out of range: {dp}'\n\t * 'round() decimal places not an integer: {dp}'\n\t * 'round() rounding mode not an integer: {rm}'\n\t * 'round() rounding mode out of range: {rm}'\n\t */\n\t P.round = function ( dp, rm ) {\n\t var n = new BigNumber(this);\n\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n\t round( n, ~~dp + this.e + 1, rm == null ||\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n\t }\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n\t *\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t *\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n\t * otherwise.\n\t *\n\t * 'shift() argument not an integer: {k}'\n\t * 'shift() argument out of range: {k}'\n\t */\n\t P.shift = function (k) {\n\t var n = this;\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\n\t ? n.times( '1e' + truncate(k) )\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\n\t : n );\n\t };\n\n\n\t /*\n\t * sqrt(-n) = N\n\t * sqrt( N) = N\n\t * sqrt(-I) = N\n\t * sqrt( I) = I\n\t * sqrt( 0) = 0\n\t * sqrt(-0) = -0\n\t *\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.squareRoot = P.sqrt = function () {\n\t var m, n, r, rep, t,\n\t x = this,\n\t c = x.c,\n\t s = x.s,\n\t e = x.e,\n\t dp = DECIMAL_PLACES + 4,\n\t half = new BigNumber('0.5');\n\n\t // Negative/NaN/Infinity/zero?\n\t if ( s !== 1 || !c || !c[0] ) {\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n\t }\n\n\t // Initial estimate.\n\t s = Math.sqrt( +x );\n\n\t // Math.sqrt underflow/overflow?\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\t if ( s == 0 || s == 1 / 0 ) {\n\t n = coeffToString(c);\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\n\t s = Math.sqrt(n);\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n\t if ( s == 1 / 0 ) {\n\t n = '1e' + e;\n\t } else {\n\t n = s.toExponential();\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n\t }\n\n\t r = new BigNumber(n);\n\t } else {\n\t r = new BigNumber( s + '' );\n\t }\n\n\t // Check for zero.\n\t // r could be zero if MIN_EXP is changed after the this value was created.\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n\t // coeffToString to throw.\n\t if ( r.c[0] ) {\n\t e = r.e;\n\t s = e + dp;\n\t if ( s < 3 ) s = 0;\n\n\t // Newton-Raphson iteration.\n\t for ( ; ; ) {\n\t t = r;\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\n\n\t // The exponent of r may here be one less than the final result exponent,\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n\t // are indexed correctly.\n\t if ( r.e < e ) --s;\n\t n = n.slice( s - 3, s + 1 );\n\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n\t // iteration.\n\t if ( n == '9999' || !rep && n == '4999' ) {\n\n\t // On the first iteration only, check to see if rounding up gives the\n\t // exact result as the nines may infinitely repeat.\n\t if ( !rep ) {\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n\t if ( t.times(t).eq(x) ) {\n\t r = t;\n\t break;\n\t }\n\t }\n\n\t dp += 4;\n\t s += 4;\n\t rep = 1;\n\t } else {\n\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n\t // result. If not, then there are further digits and m will be truthy.\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n\t // Truncate to the first rounding digit.\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\n\t m = !r.times(r).eq(x);\n\t }\n\n\t break;\n\t }\n\t }\n\t }\n\t }\n\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n\t };\n\n\n\t /*\n\t * n * 0 = 0\n\t * n * N = N\n\t * n * I = I\n\t * 0 * n = 0\n\t * 0 * 0 = 0\n\t * 0 * N = N\n\t * 0 * I = N\n\t * N * n = N\n\t * N * 0 = N\n\t * N * N = N\n\t * N * I = N\n\t * I * n = I\n\t * I * 0 = N\n\t * I * N = N\n\t * I * I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\n\t * BigNumber(y, b).\n\t */\n\t P.times = P.mul = function ( y, b ) {\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n\t base, sqrtBase,\n\t x = this,\n\t xc = x.c,\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n\t // Either NaN, ±Infinity or ±0?\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n\t y.c = y.e = y.s = null;\n\t } else {\n\t y.s *= x.s;\n\n\t // Return ±Infinity if either is ±Infinity.\n\t if ( !xc || !yc ) {\n\t y.c = y.e = null;\n\n\t // Return ±0 if either is ±0.\n\t } else {\n\t y.c = [0];\n\t y.e = 0;\n\t }\n\t }\n\n\t return y;\n\t }\n\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n\t y.s *= x.s;\n\t xcL = xc.length;\n\t ycL = yc.length;\n\n\t // Ensure xc points to longer array and xcL to its length.\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n\t // Initialise the result array with zeros.\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n\t base = BASE;\n\t sqrtBase = SQRT_BASE;\n\n\t for ( i = ycL; --i >= 0; ) {\n\t c = 0;\n\t ylo = yc[i] % sqrtBase;\n\t yhi = yc[i] / sqrtBase | 0;\n\n\t for ( k = xcL, j = i + k; j > i; ) {\n\t xlo = xc[--k] % sqrtBase;\n\t xhi = xc[k] / sqrtBase | 0;\n\t m = yhi * xlo + xhi * ylo;\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n\t zc[j--] = xlo % base;\n\t }\n\n\t zc[j] = c;\n\t }\n\n\t if (c) {\n\t ++e;\n\t } else {\n\t zc.shift();\n\t }\n\n\t return normalise( y, zc, e );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toDigits() precision out of range: {sd}'\n\t * 'toDigits() precision not an integer: {sd}'\n\t * 'toDigits() rounding mode not an integer: {rm}'\n\t * 'toDigits() rounding mode out of range: {rm}'\n\t */\n\t P.toDigits = function ( sd, rm ) {\n\t var n = new BigNumber(this);\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n\t return sd ? round( n, sd, rm ) : n;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in exponential notation and\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toExponential() decimal places not an integer: {dp}'\n\t * 'toExponential() decimal places out of range: {dp}'\n\t * 'toExponential() rounding mode not an integer: {rm}'\n\t * 'toExponential() rounding mode out of range: {rm}'\n\t */\n\t P.toExponential = function ( dp, rm ) {\n\t return format( this,\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFixed() decimal places not an integer: {dp}'\n\t * 'toFixed() decimal places out of range: {dp}'\n\t * 'toFixed() rounding mode not an integer: {rm}'\n\t * 'toFixed() rounding mode out of range: {rm}'\n\t */\n\t P.toFixed = function ( dp, rm ) {\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n\t * of the FORMAT object (see BigNumber.config).\n\t *\n\t * FORMAT = {\n\t * decimalSeparator : '.',\n\t * groupSeparator : ',',\n\t * groupSize : 3,\n\t * secondaryGroupSize : 0,\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\n\t * fractionGroupSize : 0\n\t * };\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFormat() decimal places not an integer: {dp}'\n\t * 'toFormat() decimal places out of range: {dp}'\n\t * 'toFormat() rounding mode not an integer: {rm}'\n\t * 'toFormat() rounding mode out of range: {rm}'\n\t */\n\t P.toFormat = function ( dp, rm ) {\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\n\n\t if ( this.c ) {\n\t var i,\n\t arr = str.split('.'),\n\t g1 = +FORMAT.groupSize,\n\t g2 = +FORMAT.secondaryGroupSize,\n\t groupSeparator = FORMAT.groupSeparator,\n\t intPart = arr[0],\n\t fractionPart = arr[1],\n\t isNeg = this.s < 0,\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\n\t len = intDigits.length;\n\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n\t if ( g1 > 0 && len > 0 ) {\n\t i = len % g1 || g1;\n\t intPart = intDigits.substr( 0, i );\n\n\t for ( ; i < len; i += g1 ) {\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\n\t }\n\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n\t if (isNeg) intPart = '-' + intPart;\n\t }\n\n\t str = fractionPart\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n\t '$&' + FORMAT.fractionGroupSeparator )\n\t : fractionPart )\n\t : intPart;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\n\t * an integer numerator and an integer denominator. The denominator will be a positive\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\n\t * denominator is not specified, the denominator will be the lowest value necessary to\n\t * represent the number exactly.\n\t *\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n\t *\n\t * 'toFraction() max denominator not an integer: {md}'\n\t * 'toFraction() max denominator out of range: {md}'\n\t */\n\t P.toFraction = function (md) {\n\t var arr, d0, d2, e, exp, n, n0, q, s,\n\t k = ERRORS,\n\t x = this,\n\t xc = x.c,\n\t d = new BigNumber(ONE),\n\t n1 = d0 = new BigNumber(ONE),\n\t d1 = n0 = new BigNumber(ONE);\n\n\t if ( md != null ) {\n\t ERRORS = false;\n\t n = new BigNumber(md);\n\t ERRORS = k;\n\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n\t if (ERRORS) {\n\t raise( 22,\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n\t }\n\n\t // ERRORS is false:\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n\t }\n\t }\n\n\t if ( !xc ) return x.toString();\n\t s = coeffToString(xc);\n\n\t // Determine initial denominator.\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\t e = d.e = s.length - x.e - 1;\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n\t exp = MAX_EXP;\n\t MAX_EXP = 1 / 0;\n\t n = new BigNumber(s);\n\n\t // n0 = d1 = 0\n\t n0.c[0] = 0;\n\n\t for ( ; ; ) {\n\t q = div( n, d, 0, 1 );\n\t d2 = d0.plus( q.times(d1) );\n\t if ( d2.cmp(md) == 1 ) break;\n\t d0 = d1;\n\t d1 = d2;\n\t n1 = n0.plus( q.times( d2 = n1 ) );\n\t n0 = d2;\n\t d = n.minus( q.times( d2 = d ) );\n\t n = d2;\n\t }\n\n\t d2 = div( md.minus(d0), d1, 0, 1 );\n\t n0 = n0.plus( d2.times(n1) );\n\t d0 = d0.plus( d2.times(d1) );\n\t n0.s = n1.s = x.s;\n\t e *= 2;\n\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n\t ? [ n1.toString(), d1.toString() ]\n\t : [ n0.toString(), d0.toString() ];\n\n\t MAX_EXP = exp;\n\t return arr;\n\t };\n\n\n\t /*\n\t * Return the value of this BigNumber converted to a number primitive.\n\t */\n\t P.toNumber = function () {\n\t return +this;\n\t };\n\n\n\t /*\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n\t * If m is present, return the result modulo m.\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n\t * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n\t * ROUNDING_MODE.\n\t *\n\t * The modular power operation works efficiently when x, n, and m are positive integers,\n\t * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n\t *\n\t * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t * [m] {number|string|BigNumber} The modulus.\n\t *\n\t * 'pow() exponent not an integer: {n}'\n\t * 'pow() exponent out of range: {n}'\n\t *\n\t * Performs 54 loop iterations for n of 9007199254740991.\n\t */\n\t P.toPower = P.pow = function ( n, m ) {\n\t var k, y, z,\n\t i = mathfloor( n < 0 ? -n : +n ),\n\t x = this;\n\n\t if ( m != null ) {\n\t id = 23;\n\t m = new BigNumber(m);\n\t }\n\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n\t parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n\t k = Math.pow( +x, n );\n\t return new BigNumber( m ? k % m : k );\n\t }\n\n\t if (m) {\n\t if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n\t x = x.mod(m);\n\t } else {\n\t z = m;\n\n\t // Nullify m so only a single mod operation is performed at the end.\n\t m = null;\n\t }\n\t } else if (POW_PRECISION) {\n\n\t // Truncating each coefficient array to a length of k after each multiplication\n\t // equates to truncating significant digits to POW_PRECISION + [28, 41],\n\t // i.e. there will be a minimum of 28 guard digits retained.\n\t // (Using + 1.5 would give [9, 21] guard digits.)\n\t k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n\t }\n\n\t y = new BigNumber(ONE);\n\n\t for ( ; ; ) {\n\t if ( i % 2 ) {\n\t y = y.times(x);\n\t if ( !y.c ) break;\n\t if (k) {\n\t if ( y.c.length > k ) y.c.length = k;\n\t } else if (m) {\n\t y = y.mod(m);\n\t }\n\t }\n\n\t i = mathfloor( i / 2 );\n\t if ( !i ) break;\n\t x = x.times(x);\n\t if (k) {\n\t if ( x.c && x.c.length > k ) x.c.length = k;\n\t } else if (m) {\n\t x = x.mod(m);\n\t }\n\t }\n\n\t if (m) return y;\n\t if ( n < 0 ) y = ONE.div(y);\n\n\t return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\n\t * exponential notation.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toPrecision() precision not an integer: {sd}'\n\t * 'toPrecision() precision out of range: {sd}'\n\t * 'toPrecision() rounding mode not an integer: {rm}'\n\t * 'toPrecision() rounding mode out of range: {rm}'\n\t */\n\t P.toPrecision = function ( sd, rm ) {\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n\t ? sd | 0 : null, rm, 24 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n\t * TO_EXP_NEG, return exponential notation.\n\t *\n\t * [b] {number} Integer, 2 to 64 inclusive.\n\t *\n\t * 'toString() base not an integer: {b}'\n\t * 'toString() base out of range: {b}'\n\t */\n\t P.toString = function (b) {\n\t var str,\n\t n = this,\n\t s = n.s,\n\t e = n.e;\n\n\t // Infinity or NaN?\n\t if ( e === null ) {\n\n\t if (s) {\n\t str = 'Infinity';\n\t if ( s < 0 ) str = '-' + str;\n\t } else {\n\t str = 'NaN';\n\t }\n\t } else {\n\t str = coeffToString( n.c );\n\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n\t ? toExponential( str, e )\n\t : toFixedPoint( str, e );\n\t } else {\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n\t }\n\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n\t * number.\n\t */\n\t P.truncated = P.trunc = function () {\n\t return round( new BigNumber(this), this.e + 1, 1 );\n\t };\n\n\n\n\t /*\n\t * Return as toString, but do not accept a base argument, and include the minus sign for\n\t * negative zero.\n\t */\n\t P.valueOf = P.toJSON = function () {\n\t var str,\n\t n = this,\n\t e = n.e;\n\n\t if ( e === null ) return n.toString();\n\n\t str = coeffToString( n.c );\n\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n\t ? toExponential( str, e )\n\t : toFixedPoint( str, e );\n\n\t return n.s < 0 ? '-' + str : str;\n\t };\n\n\n\t // Aliases for BigDecimal methods.\n\t //P.add = P.plus; // P.add included above\n\t //P.subtract = P.minus; // P.sub included above\n\t //P.multiply = P.times; // P.mul included above\n\t //P.divide = P.div;\n\t //P.remainder = P.mod;\n\t //P.compareTo = P.cmp;\n\t //P.negate = P.neg;\n\n\n\t if ( configObj != null ) BigNumber.config(configObj);\n\n\t return BigNumber;\n\t }", "title": "" }, { "docid": "b3efa763e97140fd7c7f5e113797c644", "score": "0.47647238", "text": "function constructorFactory(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\n raise( id, tooManyDigits, x.s * n );\n }\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = constructorFactory;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === true || v === false || v === 1 || v === 0 ) {\n if (v) {\n v = typeof crypto == 'undefined';\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = true;\n } else if (ERRORS) {\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\n } else {\n CRYPTO = false;\n }\n } else {\n CRYPTO = false;\n }\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +this;\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\n * ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are positive integers,\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\n *\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n * [m] {number|string|BigNumber} The modulus.\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n *\n * Performs 54 loop iterations for n of 9007199254740991.\n */\n P.toPower = P.pow = function ( n, m ) {\n var k, y, z,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n if ( m != null ) {\n id = 23;\n m = new BigNumber(m);\n }\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\n k = Math.pow( +x, n );\n return new BigNumber( m ? k % m : k );\n }\n\n if (m) {\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\n x = x.mod(m);\n } else {\n z = m;\n\n // Nullify m so only a single mod operation is performed at the end.\n m = null;\n }\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n // (Using + 1.5 would give [9, 21] guard digits.)\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\n }\n\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if (k) {\n if ( y.c.length > k ) y.c.length = k;\n } else if (m) {\n y = y.mod(m);\n }\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n x = x.times(x);\n if (k) {\n if ( x.c && x.c.length > k ) x.c.length = k;\n } else if (m) {\n x = x.mod(m);\n }\n }\n\n if (m) return y;\n if ( n < 0 ) y = ONE.div(y);\n\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n var str,\n n = this,\n e = n.e;\n\n if ( e === null ) return n.toString();\n\n str = coeffToString( n.c );\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n\n return n.s < 0 ? '-' + str : str;\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "f1cbb3b3264a89bdd3b3e568b34a8fa2", "score": "0.47595", "text": "static configSchema() {\n let res = super.configSchema();\n res.escala = { type: Number, min: 0.1, max: 100, step: 0.1, default: 5 };\n res.velocidad = { type: Number, min: -50, max: 50, step: 0.1, default: -5 };\n res.centerY = { type: Number, min: -20, max: 40, step: 0.1, default: 0 };\n res.centerX = { type: Number, min: -50, max: 50, step: 0.1, default: 0 };\n res.power = { type: Number, min: 0, max: 10, step: 0.1, default: 1 };\n res.colorMap = { type: \"gradient\", default: \"\" };\n\n return res;\n }", "title": "" }, { "docid": "b1acb3b7788ede5c50ad148315067265", "score": "0.47553584", "text": "function createDecimalCustomValidator() {\n var val = Validator.makeRegExpValidator(\n 'decimal',\n /^[0-9]{1,18}?$/,\n \"The %displayName% is not a valid\");\n return val;\n }", "title": "" }, { "docid": "1224f171ce70e0d901367f478ec1c093", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem.push(xc[xi] || 0);\n remL = remL + 1;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "2dde7d8adb965ef92ba1aa3069274910", "score": "0.4734777", "text": "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "title": "" }, { "docid": "cdfffdb7c8116175996278d437669e25", "score": "0.4734101", "text": "function constructorFactory(configObj) {\r\n\t var div,\r\n\r\n\t // id tracks the caller function, so its name can be included in error messages.\r\n\t id = 0,\r\n\t P = BigNumber.prototype,\r\n\t ONE = new BigNumber(1),\r\n\r\n\r\n\t /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n\t /*\r\n\t * The default values below must be integers within the inclusive ranges stated.\r\n\t * The values can also be changed at run-time using BigNumber.config.\r\n\t */\r\n\r\n\t // The maximum number of decimal places for operations involving division.\r\n\t DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n\t /*\r\n\t * The rounding mode used when rounding to the above decimal places, and when using\r\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n\t * UP 0 Away from zero.\r\n\t * DOWN 1 Towards zero.\r\n\t * CEIL 2 Towards +Infinity.\r\n\t * FLOOR 3 Towards -Infinity.\r\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n\t */\r\n\t ROUNDING_MODE = 4, // 0 to 8\r\n\r\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n\t // The exponent value at and beneath which toString returns exponential notation.\r\n\t // Number type: -7\r\n\t TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n\t // The exponent value at and above which toString returns exponential notation.\r\n\t // Number type: 21\r\n\t TO_EXP_POS = 21, // 0 to MAX\r\n\r\n\t // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n\t // The minimum exponent value, beneath which underflow to zero occurs.\r\n\t // Number type: -324 (5e-324)\r\n\t MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n\t // The maximum exponent value, above which overflow to Infinity occurs.\r\n\t // Number type: 308 (1.7976931348623157e+308)\r\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n\t MAX_EXP = 1e7, // 1 to MAX\r\n\r\n\t // Whether BigNumber Errors are ever thrown.\r\n\t ERRORS = true, // true or false\r\n\r\n\t // Change to intValidatorNoErrors if ERRORS is false.\r\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n\t // Whether to use cryptographically-secure random number generation, if available.\r\n\t CRYPTO = false, // true or false\r\n\r\n\t /*\r\n\t * The modulo mode used when calculating the modulus: a mod n.\r\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n\t * The remainder (r) is calculated as: r = a - n * q.\r\n\t *\r\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n\t * DOWN 1 The remainder has the same sign as the dividend.\r\n\t * This modulo mode is commonly known as 'truncated division' and is\r\n\t * equivalent to (a % n) in JavaScript.\r\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n\t * The remainder is always positive.\r\n\t *\r\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n\t * modes are commonly used for the modulus operation.\r\n\t * Although the other rounding modes can also be used, they may not give useful results.\r\n\t */\r\n\t MODULO_MODE = 1, // 0 to 9\r\n\r\n\t // The maximum number of significant digits of the result of the toPower operation.\r\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n\t POW_PRECISION = 100, // 0 to MAX\r\n\r\n\t // The format specification used by the BigNumber.prototype.toFormat method.\r\n\t FORMAT = {\r\n\t decimalSeparator: '.',\r\n\t groupSeparator: ',',\r\n\t groupSize: 3,\r\n\t secondaryGroupSize: 0,\r\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\r\n\t fractionGroupSize: 0\r\n\t };\r\n\r\n\r\n\t /******************************************************************************************/\r\n\r\n\r\n\t // CONSTRUCTOR\r\n\r\n\r\n\t /*\r\n\t * The BigNumber constructor and exported function.\r\n\t * Create and return a new instance of a BigNumber object.\r\n\t *\r\n\t * n {number|string|BigNumber} A numeric value.\r\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n\t */\r\n\t function BigNumber( n, b ) {\r\n\t var c, e, i, num, len, str,\r\n\t x = this;\r\n\r\n\t // Enable constructor usage without new.\r\n\t if ( !( x instanceof BigNumber ) ) {\r\n\r\n\t // 'BigNumber() constructor call without new: {n}'\r\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\r\n\t return new BigNumber( n, b );\r\n\t }\r\n\r\n\t // 'new BigNumber() base not an integer: {b}'\r\n\t // 'new BigNumber() base out of range: {b}'\r\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n\t // Duplicate.\r\n\t if ( n instanceof BigNumber ) {\r\n\t x.s = n.s;\r\n\t x.e = n.e;\r\n\t x.c = ( n = n.c ) ? n.slice() : n;\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n\t // Fast path for integers.\r\n\t if ( n === ~~n ) {\r\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n\t x.e = e;\r\n\t x.c = [n];\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t str = n + '';\r\n\t } else {\r\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\t } else {\r\n\t b = b | 0;\r\n\t str = n + '';\r\n\r\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n\t // Allow exponential notation to be used with base 10 argument.\r\n\t if ( b == 10 ) {\r\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\r\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n\t }\r\n\r\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n\t // Any number in exponential form will fail due to the [Ee][+-].\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n\t return parseNumeric( x, str, num, b );\r\n\t }\r\n\r\n\t if (num) {\r\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t raise( id, tooManyDigits, n );\r\n\t }\r\n\r\n\t // Prevent later check for length on converted number.\r\n\t num = false;\r\n\t } else {\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\r\n\t str = convertBase( str, 10, b, x.s );\r\n\t }\r\n\r\n\t // Decimal point?\r\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n\t // Exponential form?\r\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n\t // Determine exponent.\r\n\t if ( e < 0 ) e = i;\r\n\t e += +str.slice( i + 1 );\r\n\t str = str.substring( 0, i );\r\n\t } else if ( e < 0 ) {\r\n\r\n\t // Integer.\r\n\t e = str.length;\r\n\t }\r\n\r\n\t // Determine leading zeros.\r\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n\t str = str.slice( i, len + 1 );\r\n\r\n\t if (str) {\r\n\t len = str.length;\r\n\r\n\t // Disallow numbers with over 15 significant digits if number type.\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n\t raise( id, tooManyDigits, x.s * n );\r\n\t }\r\n\r\n\t e = e - i - 1;\r\n\r\n\t // Overflow?\r\n\t if ( e > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t } else {\r\n\t x.e = e;\r\n\t x.c = [];\r\n\r\n\t // Transform base\r\n\r\n\t // e is the base 10 exponent.\r\n\t // i is where to slice str to get the first element of the coefficient array.\r\n\t i = ( e + 1 ) % LOG_BASE;\r\n\t if ( e < 0 ) i += LOG_BASE;\r\n\r\n\t if ( i < len ) {\r\n\t if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n\t for ( len -= LOG_BASE; i < len; ) {\r\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n\t }\r\n\r\n\t str = str.slice(i);\r\n\t i = LOG_BASE - str.length;\r\n\t } else {\r\n\t i -= len;\r\n\t }\r\n\r\n\t for ( ; i--; str += '0' );\r\n\t x.c.push( +str );\r\n\t }\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\r\n\t id = 0;\r\n\t }\r\n\r\n\r\n\t // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n\t BigNumber.another = constructorFactory;\r\n\r\n\t BigNumber.ROUND_UP = 0;\r\n\t BigNumber.ROUND_DOWN = 1;\r\n\t BigNumber.ROUND_CEIL = 2;\r\n\t BigNumber.ROUND_FLOOR = 3;\r\n\t BigNumber.ROUND_HALF_UP = 4;\r\n\t BigNumber.ROUND_HALF_DOWN = 5;\r\n\t BigNumber.ROUND_HALF_EVEN = 6;\r\n\t BigNumber.ROUND_HALF_CEIL = 7;\r\n\t BigNumber.ROUND_HALF_FLOOR = 8;\r\n\t BigNumber.EUCLID = 9;\r\n\r\n\r\n\t /*\r\n\t * Configure infrequently-changing library-wide settings.\r\n\t *\r\n\t * Accept an object or an argument list, with one or many of the following properties or\r\n\t * parameters respectively:\r\n\t *\r\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n\t * ERRORS {boolean|number} true, false, 1 or 0\r\n\t * CRYPTO {boolean|number} true, false, 1 or 0\r\n\t * MODULO_MODE {number} 0 to 9 inclusive\r\n\t * POW_PRECISION {number} 0 to MAX inclusive\r\n\t * FORMAT {object} See BigNumber.prototype.toFormat\r\n\t * decimalSeparator {string}\r\n\t * groupSeparator {string}\r\n\t * groupSize {number}\r\n\t * secondaryGroupSize {number}\r\n\t * fractionGroupSeparator {string}\r\n\t * fractionGroupSize {number}\r\n\t *\r\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n\t *\r\n\t * E.g.\r\n\t * BigNumber.config(20, 4) is equivalent to\r\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n\t *\r\n\t * Ignore properties/parameters set to null or undefined.\r\n\t * Return an object with the properties current values.\r\n\t */\r\n\t BigNumber.config = function () {\r\n\t var v, p,\r\n\t i = 0,\r\n\t r = {},\r\n\t a = arguments,\r\n\t o = a[0],\r\n\t has = o && typeof o == 'object'\r\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\r\n\t // 'config() DECIMAL_PLACES out of range: {v}'\r\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t DECIMAL_PLACES = v | 0;\r\n\t }\r\n\t r[p] = DECIMAL_PLACES;\r\n\r\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n\t // 'config() ROUNDING_MODE not an integer: {v}'\r\n\t // 'config() ROUNDING_MODE out of range: {v}'\r\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n\t ROUNDING_MODE = v | 0;\r\n\t }\r\n\t r[p] = ROUNDING_MODE;\r\n\r\n\t // EXPONENTIAL_AT {number|number[]}\r\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\r\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = v[0] | 0;\r\n\t TO_EXP_POS = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n\t }\r\n\t }\r\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n\t // 'config() RANGE not an integer: {v}'\r\n\t // 'config() RANGE cannot be zero: {v}'\r\n\t // 'config() RANGE out of range: {v}'\r\n\t if ( has( p = 'RANGE' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n\t MIN_EXP = v[0] | 0;\r\n\t MAX_EXP = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n\t }\r\n\t }\r\n\t r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n\t // ERRORS {boolean|number} true, false, 1 or 0.\r\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\r\n\t if ( has( p = 'ERRORS' ) ) {\r\n\r\n\t if ( v === !!v || v === 1 || v === 0 ) {\r\n\t id = 0;\r\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = ERRORS;\r\n\r\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\r\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n\t // 'config() crypto unavailable: {crypto}'\r\n\t if ( has( p = 'CRYPTO' ) ) {\r\n\r\n\t if ( v === !!v || v === 1 || v === 0 ) {\r\n\t CRYPTO = !!( v && cryptoObj );\r\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', cryptoObj );\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = CRYPTO;\r\n\r\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n\t // 'config() MODULO_MODE not an integer: {v}'\r\n\t // 'config() MODULO_MODE out of range: {v}'\r\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n\t MODULO_MODE = v | 0;\r\n\t }\r\n\t r[p] = MODULO_MODE;\r\n\r\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() POW_PRECISION not an integer: {v}'\r\n\t // 'config() POW_PRECISION out of range: {v}'\r\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t POW_PRECISION = v | 0;\r\n\t }\r\n\t r[p] = POW_PRECISION;\r\n\r\n\t // FORMAT {object}\r\n\t // 'config() FORMAT not an object: {v}'\r\n\t if ( has( p = 'FORMAT' ) ) {\r\n\r\n\t if ( typeof v == 'object' ) {\r\n\t FORMAT = v;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + ' not an object', v );\r\n\t }\r\n\t }\r\n\t r[p] = FORMAT;\r\n\r\n\t return r;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the maximum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the minimum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n\t * zeros are produced).\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t *\r\n\t * 'random() decimal places not an integer: {dp}'\r\n\t * 'random() decimal places out of range: {dp}'\r\n\t * 'random() crypto unavailable: {crypto}'\r\n\t */\r\n\t BigNumber.random = (function () {\r\n\t var pow2_53 = 0x20000000000000;\r\n\r\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n\t // Check if Math.random() produces more than 32 bits of randomness.\r\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n\t (Math.random() * 0x800000 | 0); };\r\n\r\n\t return function (dp) {\r\n\t var a, b, e, k, v,\r\n\t i = 0,\r\n\t c = [],\r\n\t rand = new BigNumber(ONE);\r\n\r\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n\t k = mathceil( dp / LOG_BASE );\r\n\r\n\t if (CRYPTO) {\r\n\r\n\t // Browsers supporting crypto.getRandomValues.\r\n\t if ( cryptoObj && cryptoObj.getRandomValues ) {\r\n\r\n\t a = cryptoObj.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 53 bits:\r\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n\t // 11111 11111111 11111111\r\n\t // 0x20000 is 2^21.\r\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n\t // Rejection sampling:\r\n\t // 0 <= v < 9007199254740992\r\n\t // Probability that v >= 9e15, is\r\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n\t if ( v >= 9e15 ) {\r\n\t b = cryptoObj.getRandomValues( new Uint32Array(2) );\r\n\t a[i] = b[0];\r\n\t a[i + 1] = b[1];\r\n\t } else {\r\n\r\n\t // 0 <= v <= 8999999999999999\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 2;\r\n\t }\r\n\t }\r\n\t i = k / 2;\r\n\r\n\t // Node.js supporting crypto.randomBytes.\r\n\t } else if ( cryptoObj && cryptoObj.randomBytes ) {\r\n\r\n\t // buffer\r\n\t a = cryptoObj.randomBytes( k *= 7 );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n\t // 0 <= v < 9007199254740992\r\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n\t if ( v >= 9e15 ) {\r\n\t cryptoObj.randomBytes(7).copy( a, i );\r\n\t } else {\r\n\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 7;\r\n\t }\r\n\t }\r\n\t i = k / 7;\r\n\t } else if (ERRORS) {\r\n\t raise( 14, 'crypto unavailable', cryptoObj );\r\n\t }\r\n\t }\r\n\r\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\r\n\t if (!i) {\r\n\r\n\t for ( ; i < k; ) {\r\n\t v = random53bitInt();\r\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\r\n\t }\r\n\t }\r\n\r\n\t k = c[--i];\r\n\t dp %= LOG_BASE;\r\n\r\n\t // Convert trailing digits to zeros according to dp.\r\n\t if ( k && dp ) {\r\n\t v = POWS_TEN[LOG_BASE - dp];\r\n\t c[i] = mathfloor( k / v ) * v;\r\n\t }\r\n\r\n\t // Remove trailing elements which are zero.\r\n\t for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n\t // Zero?\r\n\t if ( i < 0 ) {\r\n\t c = [ e = 0 ];\r\n\t } else {\r\n\r\n\t // Remove leading elements which are zero and adjust exponent accordingly.\r\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n\t // Count the digits of the first element of c to determine leading zeros, and...\r\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n\t // adjust the exponent accordingly.\r\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n\t }\r\n\r\n\t rand.e = e;\r\n\t rand.c = c;\r\n\t return rand;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t // PRIVATE FUNCTIONS\r\n\r\n\r\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n\t function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc.unshift(1);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }\r\n\r\n\r\n\t // Perform division in the specified base. Called by div and convertBase.\r\n\t div = (function () {\r\n\r\n\t // Assume non-zero x and k.\r\n\t function multiply( x, k, base ) {\r\n\t var m, temp, xlo, xhi,\r\n\t carry = 0,\r\n\t i = x.length,\r\n\t klo = k % SQRT_BASE,\r\n\t khi = k / SQRT_BASE | 0;\r\n\r\n\t for ( x = x.slice(); i--; ) {\r\n\t xlo = x[i] % SQRT_BASE;\r\n\t xhi = x[i] / SQRT_BASE | 0;\r\n\t m = khi * xlo + xhi * klo;\r\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n\t x[i] = temp % base;\r\n\t }\r\n\r\n\t if (carry) x.unshift(carry);\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t function compare( a, b, aL, bL ) {\r\n\t var i, cmp;\r\n\r\n\t if ( aL != bL ) {\r\n\t cmp = aL > bL ? 1 : -1;\r\n\t } else {\r\n\r\n\t for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n\t if ( a[i] != b[i] ) {\r\n\t cmp = a[i] > b[i] ? 1 : -1;\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t return cmp;\r\n\t }\r\n\r\n\t function subtract( a, b, aL, base ) {\r\n\t var i = 0;\r\n\r\n\t // Subtract b from a.\r\n\t for ( ; aL--; ) {\r\n\t a[aL] -= i;\r\n\t i = a[aL] < b[aL] ? 1 : 0;\r\n\t a[aL] = i * base + a[aL] - b[aL];\r\n\t }\r\n\r\n\t // Remove leading zeros.\r\n\t for ( ; !a[0] && a.length > 1; a.shift() );\r\n\t }\r\n\r\n\t // x: dividend, y: divisor.\r\n\t return function ( x, y, dp, rm, base ) {\r\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n\t yL, yz,\r\n\t s = x.s == y.s ? 1 : -1,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t // Either NaN, Infinity or 0?\r\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n\t return new BigNumber(\r\n\r\n\t // Return NaN if either NaN, or both Infinity or 0.\r\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n\t );\r\n\t }\r\n\r\n\t q = new BigNumber(s);\r\n\t qc = q.c = [];\r\n\t e = x.e - y.e;\r\n\t s = dp + e + 1;\r\n\r\n\t if ( !base ) {\r\n\t base = BASE;\r\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n\t s = s / LOG_BASE | 0;\r\n\t }\r\n\r\n\t // Result exponent may be one less then the current value of e.\r\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n\t if ( s < 0 ) {\r\n\t qc.push(1);\r\n\t more = true;\r\n\t } else {\r\n\t xL = xc.length;\r\n\t yL = yc.length;\r\n\t i = 0;\r\n\t s += 2;\r\n\r\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n\t n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n\t if ( n > 1 ) {\r\n\t yc = multiply( yc, n, base );\r\n\t xc = multiply( xc, n, base );\r\n\t yL = yc.length;\r\n\t xL = xc.length;\r\n\t }\r\n\r\n\t xi = yL;\r\n\t rem = xc.slice( 0, yL );\r\n\t remL = rem.length;\r\n\r\n\t // Add zeros to make remainder as long as divisor.\r\n\t for ( ; remL < yL; rem[remL++] = 0 );\r\n\t yz = yc.slice();\r\n\t yz.unshift(0);\r\n\t yc0 = yc[0];\r\n\t if ( yc[1] >= base / 2 ) yc0++;\r\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n\t do {\r\n\t n = 0;\r\n\r\n\t // Compare divisor and remainder.\r\n\t cmp = compare( yc, rem, yL, remL );\r\n\r\n\t // If divisor < remainder.\r\n\t if ( cmp < 0 ) {\r\n\r\n\t // Calculate trial digit, n.\r\n\r\n\t rem0 = rem[0];\r\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n\t // n is how many times the divisor goes into the current remainder.\r\n\t n = mathfloor( rem0 / yc0 );\r\n\r\n\t // Algorithm:\r\n\t // 1. product = divisor * trial digit (n)\r\n\t // 2. if product > remainder: product -= divisor, n--\r\n\t // 3. remainder -= product\r\n\t // 4. if product was < remainder at 2:\r\n\t // 5. compare new remainder and divisor\r\n\t // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n\t if ( n > 1 ) {\r\n\r\n\t // n may be > base only when base is 3.\r\n\t if (n >= base) n = base - 1;\r\n\r\n\t // product = divisor * trial digit.\r\n\t prod = multiply( yc, n, base );\r\n\t prodL = prod.length;\r\n\t remL = rem.length;\r\n\r\n\t // Compare product and remainder.\r\n\t // If product > remainder.\r\n\t // Trial digit n too high.\r\n\t // n is 1 too high about 5% of the time, and is not known to have\r\n\t // ever been more than 1 too high.\r\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n\t n--;\r\n\r\n\t // Subtract divisor from product.\r\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n\t prodL = prod.length;\r\n\t cmp = 1;\r\n\t }\r\n\t } else {\r\n\r\n\t // n is 0 or 1, cmp is -1.\r\n\t // If n is 0, there is no need to compare yc and rem again below,\r\n\t // so change cmp to 1 to avoid it.\r\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n\t if ( n == 0 ) {\r\n\r\n\t // divisor < remainder, so n must be at least 1.\r\n\t cmp = n = 1;\r\n\t }\r\n\r\n\t // product = divisor\r\n\t prod = yc.slice();\r\n\t prodL = prod.length;\r\n\t }\r\n\r\n\t if ( prodL < remL ) prod.unshift(0);\r\n\r\n\t // Subtract product from remainder.\r\n\t subtract( rem, prod, remL, base );\r\n\t remL = rem.length;\r\n\r\n\t // If product was < remainder.\r\n\t if ( cmp == -1 ) {\r\n\r\n\t // Compare divisor and new remainder.\r\n\t // If divisor < new remainder, subtract divisor from remainder.\r\n\t // Trial digit n too low.\r\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n\t n++;\r\n\r\n\t // Subtract divisor from remainder.\r\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\r\n\t remL = rem.length;\r\n\t }\r\n\t }\r\n\t } else if ( cmp === 0 ) {\r\n\t n++;\r\n\t rem = [0];\r\n\t } // else cmp === 1 and n will be 0\r\n\r\n\t // Add the next digit, n, to the result array.\r\n\t qc[i++] = n;\r\n\r\n\t // Update the remainder.\r\n\t if ( rem[0] ) {\r\n\t rem[remL++] = xc[xi] || 0;\r\n\t } else {\r\n\t rem = [ xc[xi] ];\r\n\t remL = 1;\r\n\t }\r\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n\t more = rem[0] != null;\r\n\r\n\t // Leading zero?\r\n\t if ( !qc[0] ) qc.shift();\r\n\t }\r\n\r\n\t if ( base == BASE ) {\r\n\r\n\t // To calculate q.e, first get the number of digits of qc[0].\r\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n\t // Caller is convertBase.\r\n\t } else {\r\n\t q.e = e;\r\n\t q.r = +more;\r\n\t }\r\n\r\n\t return q;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n\t * notation rounded to the specified decimal places or significant digits.\r\n\t *\r\n\t * n is a BigNumber.\r\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n\t * rm is the rounding mode.\r\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n\t */\r\n\t function format( n, i, rm, caller ) {\r\n\t var c0, e, ne, len, str;\r\n\r\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n\t ? rm | 0 : ROUNDING_MODE;\r\n\r\n\t if ( !n.c ) return n.toString();\r\n\t c0 = n.c[0];\r\n\t ne = n.e;\r\n\r\n\t if ( i == null ) {\r\n\t str = coeffToString( n.c );\r\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n\t ? toExponential( str, ne )\r\n\t : toFixedPoint( str, ne );\r\n\t } else {\r\n\t n = round( new BigNumber(n), i, rm );\r\n\r\n\t // n.e may have changed if the value was rounded up.\r\n\t e = n.e;\r\n\r\n\t str = coeffToString( n.c );\r\n\t len = str.length;\r\n\r\n\t // toPrecision returns exponential notation if the number of significant digits\r\n\t // specified is less than the number of digits necessary to represent the integer\r\n\t // part of the value in fixed-point notation.\r\n\r\n\t // Exponential notation.\r\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n\t // Append zeros?\r\n\t for ( ; len < i; str += '0', len++ );\r\n\t str = toExponential( str, e );\r\n\r\n\t // Fixed-point notation.\r\n\t } else {\r\n\t i -= ne;\r\n\t str = toFixedPoint( str, e );\r\n\r\n\t // Append zeros?\r\n\t if ( e + 1 > len ) {\r\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n\t } else {\r\n\t i += e - len;\r\n\t if ( i > 0 ) {\r\n\t if ( e + 1 == len ) str += '.';\r\n\t for ( ; i--; str += '0' );\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return n.s < 0 && c0 ? '-' + str : str;\r\n\t }\r\n\r\n\r\n\t // Handle BigNumber.max and BigNumber.min.\r\n\t function maxOrMin( args, method ) {\r\n\t var m, n,\r\n\t i = 0;\r\n\r\n\t if ( isArray( args[0] ) ) args = args[0];\r\n\t m = new BigNumber( args[0] );\r\n\r\n\t for ( ; ++i < args.length; ) {\r\n\t n = new BigNumber( args[i] );\r\n\r\n\t // If any number is NaN, return NaN.\r\n\t if ( !n.s ) {\r\n\t m = n;\r\n\t break;\r\n\t } else if ( method.call( m, n ) ) {\r\n\t m = n;\r\n\t }\r\n\t }\r\n\r\n\t return m;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Return true if n is an integer in range, otherwise throw.\r\n\t * Use for argument validation when ERRORS is true.\r\n\t */\r\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\r\n\t if ( n < min || n > max || n != truncate(n) ) {\r\n\t raise( caller, ( name || 'decimal places' ) +\r\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n\t }\r\n\r\n\t return true;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n\t * Called by minus, plus and times.\r\n\t */\r\n\t function normalise( n, c, e ) {\r\n\t var i = 1,\r\n\t j = c.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; !c[--j]; c.pop() );\r\n\r\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n\t // Overflow?\r\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t n.c = n.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t n.c = [ n.e = 0 ];\r\n\t } else {\r\n\t n.e = e;\r\n\t n.c = c;\r\n\t }\r\n\r\n\t return n;\r\n\t }\r\n\r\n\r\n\t // Handle values that fail the validity test in BigNumber.\r\n\t parseNumeric = (function () {\r\n\t var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n\t dotAfter = /^([^.]+)\\.$/,\r\n\t dotBefore = /^\\.([^.]+)$/,\r\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n\t whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n\t return function ( x, str, num, b ) {\r\n\t var base,\r\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n\t // No exception on ±Infinity or NaN.\r\n\t if ( isInfinityOrNaN.test(s) ) {\r\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n\t } else {\r\n\t if ( !num ) {\r\n\r\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n\t return !b || b == base ? p1 : m;\r\n\t });\r\n\r\n\t if (b) {\r\n\t base = b;\r\n\r\n\t // E.g. '1.' to '1', '.1' to '0.1'\r\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n\t }\r\n\r\n\t if ( str != s ) return new BigNumber( s, base );\r\n\t }\r\n\r\n\t // 'new BigNumber() not a number: {n}'\r\n\t // 'new BigNumber() not a base {b} number: {n}'\r\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n\t x.s = null;\r\n\t }\r\n\r\n\t x.c = x.e = null;\r\n\t id = 0;\r\n\t }\r\n\t })();\r\n\r\n\r\n\t // Throw a BigNumber Error.\r\n\t function raise( caller, msg, val ) {\r\n\t var error = new Error( [\r\n\t 'new BigNumber', // 0\r\n\t 'cmp', // 1\r\n\t 'config', // 2\r\n\t 'div', // 3\r\n\t 'divToInt', // 4\r\n\t 'eq', // 5\r\n\t 'gt', // 6\r\n\t 'gte', // 7\r\n\t 'lt', // 8\r\n\t 'lte', // 9\r\n\t 'minus', // 10\r\n\t 'mod', // 11\r\n\t 'plus', // 12\r\n\t 'precision', // 13\r\n\t 'random', // 14\r\n\t 'round', // 15\r\n\t 'shift', // 16\r\n\t 'times', // 17\r\n\t 'toDigits', // 18\r\n\t 'toExponential', // 19\r\n\t 'toFixed', // 20\r\n\t 'toFormat', // 21\r\n\t 'toFraction', // 22\r\n\t 'pow', // 23\r\n\t 'toPrecision', // 24\r\n\t 'toString', // 25\r\n\t 'BigNumber' // 26\r\n\t ][caller] + '() ' + msg + ': ' + val );\r\n\r\n\t error.name = 'BigNumber Error';\r\n\t id = 0;\r\n\t throw error;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\r\n\t */\r\n\t function round( x, sd, rm, r ) {\r\n\t var d, i, j, k, n, ni, rd,\r\n\t xc = x.c,\r\n\t pows10 = POWS_TEN;\r\n\r\n\t // if x is not Infinity or NaN...\r\n\t if (xc) {\r\n\r\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n\t // ni is the index of n within x.c.\r\n\t // d is the number of digits of n.\r\n\t // i is the index of rd within n including leading zeros.\r\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n\t out: {\r\n\r\n\t // Get the number of digits of the first element of xc.\r\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n\t i = sd - d;\r\n\r\n\t // If the rounding digit is in the first element of xc...\r\n\t if ( i < 0 ) {\r\n\t i += LOG_BASE;\r\n\t j = sd;\r\n\t n = xc[ ni = 0 ];\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t } else {\r\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n\t if ( ni >= xc.length ) {\r\n\r\n\t if (r) {\r\n\r\n\t // Needed by sqrt.\r\n\t for ( ; xc.length <= ni; xc.push(0) );\r\n\t n = rd = 0;\r\n\t d = 1;\r\n\t i %= LOG_BASE;\r\n\t j = i - LOG_BASE + 1;\r\n\t } else {\r\n\t break out;\r\n\t }\r\n\t } else {\r\n\t n = k = xc[ni];\r\n\r\n\t // Get the number of digits of n.\r\n\t for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n\t // Get the index of rd within n.\r\n\t i %= LOG_BASE;\r\n\r\n\t // Get the index of rd within n, adjusted for leading zeros.\r\n\t // The number of leading zeros of n is given by LOG_BASE - d.\r\n\t j = i - LOG_BASE + d;\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t }\r\n\t }\r\n\r\n\t r = r || sd < 0 ||\r\n\r\n\t // Are there any non-zero digits after the rounding digit?\r\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n\t r = rm < 4\r\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n\t // Check whether the digit to the left of the rounding digit is odd.\r\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( sd < 1 || !xc[0] ) {\r\n\t xc.length = 0;\r\n\r\n\t if (r) {\r\n\r\n\t // Convert sd to decimal places.\r\n\t sd -= x.e + 1;\r\n\r\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n\t xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n\t x.e = -sd || 0;\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t xc[0] = x.e = 0;\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t // Remove excess digits.\r\n\t if ( i == 0 ) {\r\n\t xc.length = ni;\r\n\t k = 1;\r\n\t ni--;\r\n\t } else {\r\n\t xc.length = ni + 1;\r\n\t k = pows10[ LOG_BASE - i ];\r\n\r\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n\t // j > 0 means i > number of leading zeros of n.\r\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n\t }\r\n\r\n\t // Round up?\r\n\t if (r) {\r\n\r\n\t for ( ; ; ) {\r\n\r\n\t // If the digit to be rounded up is in the first element of xc...\r\n\t if ( ni == 0 ) {\r\n\r\n\t // i will be the length of xc[0] before k is added.\r\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n\t j = xc[0] += k;\r\n\t for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n\t // if i != k the length has increased.\r\n\t if ( i != k ) {\r\n\t x.e++;\r\n\t if ( xc[0] == BASE ) xc[0] = 1;\r\n\t }\r\n\r\n\t break;\r\n\t } else {\r\n\t xc[ni] += k;\r\n\t if ( xc[ni] != BASE ) break;\r\n\t xc[ni--] = 0;\r\n\t k = 1;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n\t }\r\n\r\n\t // Overflow? Infinity.\r\n\t if ( x.e > MAX_EXP ) {\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow? Zero.\r\n\t } else if ( x.e < MIN_EXP ) {\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\r\n\t // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n\t */\r\n\t P.absoluteValue = P.abs = function () {\r\n\t var x = new BigNumber(this);\r\n\t if ( x.s < 0 ) x.s = 1;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of Infinity.\r\n\t */\r\n\t P.ceil = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 2 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return\r\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * 0 if they have the same value,\r\n\t * or null if the value of either is NaN.\r\n\t */\r\n\t P.comparedTo = P.cmp = function ( y, b ) {\r\n\t id = 1;\r\n\t return compare( this, new BigNumber( y, b ) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n\t * of this BigNumber is ±Infinity or NaN.\r\n\t */\r\n\t P.decimalPlaces = P.dp = function () {\r\n\t var n, v,\r\n\t c = this.c;\r\n\r\n\t if ( !c ) return null;\r\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n\t // Subtract the number of trailing zeros of the last number.\r\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n\t if ( n < 0 ) n = 0;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n / 0 = I\r\n\t * n / N = N\r\n\t * n / I = 0\r\n\t * 0 / n = 0\r\n\t * 0 / 0 = N\r\n\t * 0 / N = N\r\n\t * 0 / I = 0\r\n\t * N / n = N\r\n\t * N / 0 = N\r\n\t * N / N = N\r\n\t * N / I = N\r\n\t * I / n = I\r\n\t * I / 0 = I\r\n\t * I / N = N\r\n\t * I / I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.dividedBy = P.div = function ( y, b ) {\r\n\t id = 3;\r\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n\t * BigNumber by the value of BigNumber(y, b).\r\n\t */\r\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n\t id = 4;\r\n\t return div( this, new BigNumber( y, b ), 0, 1 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.equals = P.eq = function ( y, b ) {\r\n\t id = 5;\r\n\t return compare( this, new BigNumber( y, b ) ) === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of -Infinity.\r\n\t */\r\n\t P.floor = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 3 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.greaterThan = P.gt = function ( y, b ) {\r\n\t id = 6;\r\n\t return compare( this, new BigNumber( y, b ) ) > 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n\t id = 7;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n\t */\r\n\t P.isFinite = function () {\r\n\t return !!this.c;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n\t */\r\n\t P.isInteger = P.isInt = function () {\r\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n\t */\r\n\t P.isNaN = function () {\r\n\t return !this.s;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n\t */\r\n\t P.isNegative = P.isNeg = function () {\r\n\t return this.s < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n\t */\r\n\t P.isZero = function () {\r\n\t return !!this.c && this.c[0] == 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.lessThan = P.lt = function ( y, b ) {\r\n\t id = 8;\r\n\t return compare( this, new BigNumber( y, b ) ) < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n\t id = 9;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n - 0 = n\r\n\t * n - N = N\r\n\t * n - I = -I\r\n\t * 0 - n = -n\r\n\t * 0 - 0 = 0\r\n\t * 0 - N = N\r\n\t * 0 - I = -I\r\n\t * N - n = N\r\n\t * N - 0 = N\r\n\t * N - N = N\r\n\t * N - I = N\r\n\t * I - n = I\r\n\t * I - 0 = I\r\n\t * I - N = N\r\n\t * I - I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.minus = P.sub = function ( y, b ) {\r\n\t var i, j, t, xLTy,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 10;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.plus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Either Infinity?\r\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n\t // Either zero?\r\n\t if ( !xc[0] || !yc[0] ) {\r\n\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n\t ROUNDING_MODE == 3 ? -0 : 0 );\r\n\t }\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Determine which is the bigger number.\r\n\t if ( a = xe - ye ) {\r\n\r\n\t if ( xLTy = a < 0 ) {\r\n\t a = -a;\r\n\t t = xc;\r\n\t } else {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\r\n\t // Prepend zeros to equalise exponents.\r\n\t for ( b = a; b--; t.push(0) );\r\n\t t.reverse();\r\n\t } else {\r\n\r\n\t // Exponents equal. Check digit by digit.\r\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n\t for ( a = b = 0; b < j; b++ ) {\r\n\r\n\t if ( xc[b] != yc[b] ) {\r\n\t xLTy = xc[b] < yc[b];\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // x < y? Point xc to the array of the bigger number.\r\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n\t b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n\t // Append zeros to xc if shorter.\r\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n\t b = BASE - 1;\r\n\r\n\t // Subtract yc from xc.\r\n\t for ( ; j > a; ) {\r\n\r\n\t if ( xc[--j] < yc[j] ) {\r\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\r\n\t --xc[i];\r\n\t xc[j] += BASE;\r\n\t }\r\n\r\n\t xc[j] -= yc[j];\r\n\t }\r\n\r\n\t // Remove leading zeros and adjust exponent accordingly.\r\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n\t // Zero?\r\n\t if ( !xc[0] ) {\r\n\r\n\t // Following IEEE 754 (2008) 6.3,\r\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n\t y.c = [ y.e = 0 ];\r\n\t return y;\r\n\t }\r\n\r\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n\t // for finite x and y.\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n % 0 = N\r\n\t * n % N = N\r\n\t * n % I = n\r\n\t * 0 % n = 0\r\n\t * -0 % n = -0\r\n\t * 0 % 0 = N\r\n\t * 0 % N = N\r\n\t * 0 % I = 0\r\n\t * N % n = N\r\n\t * N % 0 = N\r\n\t * N % N = N\r\n\t * N % I = N\r\n\t * I % n = N\r\n\t * I % 0 = N\r\n\t * I % N = N\r\n\t * I % I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n\t */\r\n\t P.modulo = P.mod = function ( y, b ) {\r\n\t var q, s,\r\n\t x = this;\r\n\r\n\t id = 11;\r\n\t y = new BigNumber( y, b );\r\n\r\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n\t return new BigNumber(NaN);\r\n\r\n\t // Return x if y is Infinity or x is zero.\r\n\t } else if ( !y.c || x.c && !x.c[0] ) {\r\n\t return new BigNumber(x);\r\n\t }\r\n\r\n\t if ( MODULO_MODE == 9 ) {\r\n\r\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n\t // r = x - qy where 0 <= r < abs(y)\r\n\t s = y.s;\r\n\t y.s = 1;\r\n\t q = div( x, y, 0, 3 );\r\n\t y.s = s;\r\n\t q.s *= s;\r\n\t } else {\r\n\t q = div( x, y, 0, MODULO_MODE );\r\n\t }\r\n\r\n\t return x.minus( q.times(y) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n\t * i.e. multiplied by -1.\r\n\t */\r\n\t P.negated = P.neg = function () {\r\n\t var x = new BigNumber(this);\r\n\t x.s = -x.s || null;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n + 0 = n\r\n\t * n + N = N\r\n\t * n + I = I\r\n\t * 0 + n = n\r\n\t * 0 + 0 = 0\r\n\t * 0 + N = N\r\n\t * 0 + I = I\r\n\t * N + n = N\r\n\t * N + 0 = N\r\n\t * N + N = N\r\n\t * N + I = N\r\n\t * I + n = I\r\n\t * I + 0 = I\r\n\t * I + N = N\r\n\t * I + I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.plus = P.add = function ( y, b ) {\r\n\t var t,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 12;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.minus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Return ±Infinity if either ±Infinity.\r\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n\t // Either zero?\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n\t if ( a = xe - ye ) {\r\n\t if ( a > 0 ) {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t } else {\r\n\t a = -a;\r\n\t t = xc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\t for ( ; a--; t.push(0) );\r\n\t t.reverse();\r\n\t }\r\n\r\n\t a = xc.length;\r\n\t b = yc.length;\r\n\r\n\t // Point xc to the longer array, and b to the shorter length.\r\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n\t for ( a = 0; b; ) {\r\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n\t xc[b] %= BASE;\r\n\t }\r\n\r\n\t if (a) {\r\n\t xc.unshift(a);\r\n\t ++ye;\r\n\t }\r\n\r\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n\t // ye = MAX_EXP + 1 possible\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of significant digits of the value of this BigNumber.\r\n\t *\r\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n\t */\r\n\t P.precision = P.sd = function (z) {\r\n\t var n, v,\r\n\t x = this,\r\n\t c = x.c;\r\n\r\n\t // 'precision() argument not a boolean or binary digit: {z}'\r\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n\t if ( z != !!z ) z = null;\r\n\t }\r\n\r\n\t if ( !c ) return null;\r\n\t v = c.length - 1;\r\n\t n = v * LOG_BASE + 1;\r\n\r\n\t if ( v = c[v] ) {\r\n\r\n\t // Subtract the number of trailing zeros of the last element.\r\n\t for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n\t // Add the number of digits of the first element.\r\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n\t }\r\n\r\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n\t * omitted.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'round() decimal places out of range: {dp}'\r\n\t * 'round() decimal places not an integer: {dp}'\r\n\t * 'round() rounding mode not an integer: {rm}'\r\n\t * 'round() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.round = function ( dp, rm ) {\r\n\t var n = new BigNumber(this);\r\n\r\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n\t round( n, ~~dp + this.e + 1, rm == null ||\r\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n\t }\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n\t *\r\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t *\r\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n\t * otherwise.\r\n\t *\r\n\t * 'shift() argument not an integer: {k}'\r\n\t * 'shift() argument out of range: {k}'\r\n\t */\r\n\t P.shift = function (k) {\r\n\t var n = this;\r\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\r\n\t ? n.times( '1e' + truncate(k) )\r\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n\t : n );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * sqrt(-n) = N\r\n\t * sqrt( N) = N\r\n\t * sqrt(-I) = N\r\n\t * sqrt( I) = I\r\n\t * sqrt( 0) = 0\r\n\t * sqrt(-0) = -0\r\n\t *\r\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.squareRoot = P.sqrt = function () {\r\n\t var m, n, r, rep, t,\r\n\t x = this,\r\n\t c = x.c,\r\n\t s = x.s,\r\n\t e = x.e,\r\n\t dp = DECIMAL_PLACES + 4,\r\n\t half = new BigNumber('0.5');\r\n\r\n\t // Negative/NaN/Infinity/zero?\r\n\t if ( s !== 1 || !c || !c[0] ) {\r\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n\t }\r\n\r\n\t // Initial estimate.\r\n\t s = Math.sqrt( +x );\r\n\r\n\t // Math.sqrt underflow/overflow?\r\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n\t if ( s == 0 || s == 1 / 0 ) {\r\n\t n = coeffToString(c);\r\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n\t s = Math.sqrt(n);\r\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n\t if ( s == 1 / 0 ) {\r\n\t n = '1e' + e;\r\n\t } else {\r\n\t n = s.toExponential();\r\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n\t }\r\n\r\n\t r = new BigNumber(n);\r\n\t } else {\r\n\t r = new BigNumber( s + '' );\r\n\t }\r\n\r\n\t // Check for zero.\r\n\t // r could be zero if MIN_EXP is changed after the this value was created.\r\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n\t // coeffToString to throw.\r\n\t if ( r.c[0] ) {\r\n\t e = r.e;\r\n\t s = e + dp;\r\n\t if ( s < 3 ) s = 0;\r\n\r\n\t // Newton-Raphson iteration.\r\n\t for ( ; ; ) {\r\n\t t = r;\r\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n\t // The exponent of r may here be one less than the final result exponent,\r\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n\t // are indexed correctly.\r\n\t if ( r.e < e ) --s;\r\n\t n = n.slice( s - 3, s + 1 );\r\n\r\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n\t // iteration.\r\n\t if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n\t // On the first iteration only, check to see if rounding up gives the\r\n\t // exact result as the nines may infinitely repeat.\r\n\t if ( !rep ) {\r\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n\t if ( t.times(t).eq(x) ) {\r\n\t r = t;\r\n\t break;\r\n\t }\r\n\t }\r\n\r\n\t dp += 4;\r\n\t s += 4;\r\n\t rep = 1;\r\n\t } else {\r\n\r\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n\t // result. If not, then there are further digits and m will be truthy.\r\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n\t // Truncate to the first rounding digit.\r\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n\t m = !r.times(r).eq(x);\r\n\t }\r\n\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n * 0 = 0\r\n\t * n * N = N\r\n\t * n * I = I\r\n\t * 0 * n = 0\r\n\t * 0 * 0 = 0\r\n\t * 0 * N = N\r\n\t * 0 * I = N\r\n\t * N * n = N\r\n\t * N * 0 = N\r\n\t * N * N = N\r\n\t * N * I = N\r\n\t * I * n = I\r\n\t * I * 0 = N\r\n\t * I * N = N\r\n\t * I * I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.times = P.mul = function ( y, b ) {\r\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n\t base, sqrtBase,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n\t // Either NaN, ±Infinity or ±0?\r\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n\t y.c = y.e = y.s = null;\r\n\t } else {\r\n\t y.s *= x.s;\r\n\r\n\t // Return ±Infinity if either is ±Infinity.\r\n\t if ( !xc || !yc ) {\r\n\t y.c = y.e = null;\r\n\r\n\t // Return ±0 if either is ±0.\r\n\t } else {\r\n\t y.c = [0];\r\n\t y.e = 0;\r\n\t }\r\n\t }\r\n\r\n\t return y;\r\n\t }\r\n\r\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n\t y.s *= x.s;\r\n\t xcL = xc.length;\r\n\t ycL = yc.length;\r\n\r\n\t // Ensure xc points to longer array and xcL to its length.\r\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n\t // Initialise the result array with zeros.\r\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n\t base = BASE;\r\n\t sqrtBase = SQRT_BASE;\r\n\r\n\t for ( i = ycL; --i >= 0; ) {\r\n\t c = 0;\r\n\t ylo = yc[i] % sqrtBase;\r\n\t yhi = yc[i] / sqrtBase | 0;\r\n\r\n\t for ( k = xcL, j = i + k; j > i; ) {\r\n\t xlo = xc[--k] % sqrtBase;\r\n\t xhi = xc[k] / sqrtBase | 0;\r\n\t m = yhi * xlo + xhi * ylo;\r\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n\t zc[j--] = xlo % base;\r\n\t }\r\n\r\n\t zc[j] = c;\r\n\t }\r\n\r\n\t if (c) {\r\n\t ++e;\r\n\t } else {\r\n\t zc.shift();\r\n\t }\r\n\r\n\t return normalise( y, zc, e );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toDigits() precision out of range: {sd}'\r\n\t * 'toDigits() precision not an integer: {sd}'\r\n\t * 'toDigits() rounding mode not an integer: {rm}'\r\n\t * 'toDigits() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toDigits = function ( sd, rm ) {\r\n\t var n = new BigNumber(this);\r\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n\t return sd ? round( n, sd, rm ) : n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in exponential notation and\r\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toExponential() decimal places not an integer: {dp}'\r\n\t * 'toExponential() decimal places out of range: {dp}'\r\n\t * 'toExponential() rounding mode not an integer: {rm}'\r\n\t * 'toExponential() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toExponential = function ( dp, rm ) {\r\n\t return format( this,\r\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFixed() decimal places not an integer: {dp}'\r\n\t * 'toFixed() decimal places out of range: {dp}'\r\n\t * 'toFixed() rounding mode not an integer: {rm}'\r\n\t * 'toFixed() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFixed = function ( dp, rm ) {\r\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n\t * of the FORMAT object (see BigNumber.config).\r\n\t *\r\n\t * FORMAT = {\r\n\t * decimalSeparator : '.',\r\n\t * groupSeparator : ',',\r\n\t * groupSize : 3,\r\n\t * secondaryGroupSize : 0,\r\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n\t * fractionGroupSize : 0\r\n\t * };\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFormat() decimal places not an integer: {dp}'\r\n\t * 'toFormat() decimal places out of range: {dp}'\r\n\t * 'toFormat() rounding mode not an integer: {rm}'\r\n\t * 'toFormat() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFormat = function ( dp, rm ) {\r\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n\t if ( this.c ) {\r\n\t var i,\r\n\t arr = str.split('.'),\r\n\t g1 = +FORMAT.groupSize,\r\n\t g2 = +FORMAT.secondaryGroupSize,\r\n\t groupSeparator = FORMAT.groupSeparator,\r\n\t intPart = arr[0],\r\n\t fractionPart = arr[1],\r\n\t isNeg = this.s < 0,\r\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\r\n\t len = intDigits.length;\r\n\r\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n\t if ( g1 > 0 && len > 0 ) {\r\n\t i = len % g1 || g1;\r\n\t intPart = intDigits.substr( 0, i );\r\n\r\n\t for ( ; i < len; i += g1 ) {\r\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\r\n\t }\r\n\r\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n\t if (isNeg) intPart = '-' + intPart;\r\n\t }\r\n\r\n\t str = fractionPart\r\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n\t '$&' + FORMAT.fractionGroupSeparator )\r\n\t : fractionPart )\r\n\t : intPart;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\r\n\t * an integer numerator and an integer denominator. The denominator will be a positive\r\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n\t * denominator is not specified, the denominator will be the lowest value necessary to\r\n\t * represent the number exactly.\r\n\t *\r\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n\t *\r\n\t * 'toFraction() max denominator not an integer: {md}'\r\n\t * 'toFraction() max denominator out of range: {md}'\r\n\t */\r\n\t P.toFraction = function (md) {\r\n\t var arr, d0, d2, e, exp, n, n0, q, s,\r\n\t k = ERRORS,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t d = new BigNumber(ONE),\r\n\t n1 = d0 = new BigNumber(ONE),\r\n\t d1 = n0 = new BigNumber(ONE);\r\n\r\n\t if ( md != null ) {\r\n\t ERRORS = false;\r\n\t n = new BigNumber(md);\r\n\t ERRORS = k;\r\n\r\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n\t if (ERRORS) {\r\n\t raise( 22,\r\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n\t }\r\n\r\n\t // ERRORS is false:\r\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n\t }\r\n\t }\r\n\r\n\t if ( !xc ) return x.toString();\r\n\t s = coeffToString(xc);\r\n\r\n\t // Determine initial denominator.\r\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n\t e = d.e = s.length - x.e - 1;\r\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n\t exp = MAX_EXP;\r\n\t MAX_EXP = 1 / 0;\r\n\t n = new BigNumber(s);\r\n\r\n\t // n0 = d1 = 0\r\n\t n0.c[0] = 0;\r\n\r\n\t for ( ; ; ) {\r\n\t q = div( n, d, 0, 1 );\r\n\t d2 = d0.plus( q.times(d1) );\r\n\t if ( d2.cmp(md) == 1 ) break;\r\n\t d0 = d1;\r\n\t d1 = d2;\r\n\t n1 = n0.plus( q.times( d2 = n1 ) );\r\n\t n0 = d2;\r\n\t d = n.minus( q.times( d2 = d ) );\r\n\t n = d2;\r\n\t }\r\n\r\n\t d2 = div( md.minus(d0), d1, 0, 1 );\r\n\t n0 = n0.plus( d2.times(n1) );\r\n\t d0 = d0.plus( d2.times(d1) );\r\n\t n0.s = n1.s = x.s;\r\n\t e *= 2;\r\n\r\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n\t ? [ n1.toString(), d1.toString() ]\r\n\t : [ n0.toString(), d0.toString() ];\r\n\r\n\t MAX_EXP = exp;\r\n\t return arr;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the value of this BigNumber converted to a number primitive.\r\n\t */\r\n\t P.toNumber = function () {\r\n\t return +this;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n\t * If m is present, return the result modulo m.\r\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n\t * ROUNDING_MODE.\r\n\t *\r\n\t * The modular power operation works efficiently when x, n, and m are positive integers,\r\n\t * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n\t *\r\n\t * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t * [m] {number|string|BigNumber} The modulus.\r\n\t *\r\n\t * 'pow() exponent not an integer: {n}'\r\n\t * 'pow() exponent out of range: {n}'\r\n\t *\r\n\t * Performs 54 loop iterations for n of 9007199254740991.\r\n\t */\r\n\t P.toPower = P.pow = function ( n, m ) {\r\n\t var k, y, z,\r\n\t i = mathfloor( n < 0 ? -n : +n ),\r\n\t x = this;\r\n\r\n\t if ( m != null ) {\r\n\t id = 23;\r\n\t m = new BigNumber(m);\r\n\t }\r\n\r\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\r\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n\t parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n\t k = Math.pow( +x, n );\r\n\t return new BigNumber( m ? k % m : k );\r\n\t }\r\n\r\n\t if (m) {\r\n\t if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n\t x = x.mod(m);\r\n\t } else {\r\n\t z = m;\r\n\r\n\t // Nullify m so only a single mod operation is performed at the end.\r\n\t m = null;\r\n\t }\r\n\t } else if (POW_PRECISION) {\r\n\r\n\t // Truncating each coefficient array to a length of k after each multiplication\r\n\t // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n\t // i.e. there will be a minimum of 28 guard digits retained.\r\n\t // (Using + 1.5 would give [9, 21] guard digits.)\r\n\t k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n\t }\r\n\r\n\t y = new BigNumber(ONE);\r\n\r\n\t for ( ; ; ) {\r\n\t if ( i % 2 ) {\r\n\t y = y.times(x);\r\n\t if ( !y.c ) break;\r\n\t if (k) {\r\n\t if ( y.c.length > k ) y.c.length = k;\r\n\t } else if (m) {\r\n\t y = y.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t i = mathfloor( i / 2 );\r\n\t if ( !i ) break;\r\n\t x = x.times(x);\r\n\t if (k) {\r\n\t if ( x.c && x.c.length > k ) x.c.length = k;\r\n\t } else if (m) {\r\n\t x = x.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t if (m) return y;\r\n\t if ( n < 0 ) y = ONE.div(y);\r\n\r\n\t return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\r\n\t * exponential notation.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toPrecision() precision not an integer: {sd}'\r\n\t * 'toPrecision() precision out of range: {sd}'\r\n\t * 'toPrecision() rounding mode not an integer: {rm}'\r\n\t * 'toPrecision() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toPrecision = function ( sd, rm ) {\r\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n\t ? sd | 0 : null, rm, 24 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n\t * TO_EXP_NEG, return exponential notation.\r\n\t *\r\n\t * [b] {number} Integer, 2 to 64 inclusive.\r\n\t *\r\n\t * 'toString() base not an integer: {b}'\r\n\t * 'toString() base out of range: {b}'\r\n\t */\r\n\t P.toString = function (b) {\r\n\t var str,\r\n\t n = this,\r\n\t s = n.s,\r\n\t e = n.e;\r\n\r\n\t // Infinity or NaN?\r\n\t if ( e === null ) {\r\n\r\n\t if (s) {\r\n\t str = 'Infinity';\r\n\t if ( s < 0 ) str = '-' + str;\r\n\t } else {\r\n\t str = 'NaN';\r\n\t }\r\n\t } else {\r\n\t str = coeffToString( n.c );\r\n\r\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\t } else {\r\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n\t }\r\n\r\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n\t * number.\r\n\t */\r\n\t P.truncated = P.trunc = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 1 );\r\n\t };\r\n\r\n\r\n\r\n\t /*\r\n\t * Return as toString, but do not accept a base argument, and include the minus sign for\r\n\t * negative zero.\r\n\t */\r\n\t P.valueOf = P.toJSON = function () {\r\n\t var str,\r\n\t n = this,\r\n\t e = n.e;\r\n\r\n\t if ( e === null ) return n.toString();\r\n\r\n\t str = coeffToString( n.c );\r\n\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\r\n\t return n.s < 0 ? '-' + str : str;\r\n\t };\r\n\r\n\r\n\t // Aliases for BigDecimal methods.\r\n\t //P.add = P.plus; // P.add included above\r\n\t //P.subtract = P.minus; // P.sub included above\r\n\t //P.multiply = P.times; // P.mul included above\r\n\t //P.divide = P.div;\r\n\t //P.remainder = P.mod;\r\n\t //P.compareTo = P.cmp;\r\n\t //P.negate = P.neg;\r\n\r\n\r\n\t if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n\t return BigNumber;\r\n\t }", "title": "" }, { "docid": "cdfffdb7c8116175996278d437669e25", "score": "0.4734101", "text": "function constructorFactory(configObj) {\r\n\t var div,\r\n\r\n\t // id tracks the caller function, so its name can be included in error messages.\r\n\t id = 0,\r\n\t P = BigNumber.prototype,\r\n\t ONE = new BigNumber(1),\r\n\r\n\r\n\t /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n\t /*\r\n\t * The default values below must be integers within the inclusive ranges stated.\r\n\t * The values can also be changed at run-time using BigNumber.config.\r\n\t */\r\n\r\n\t // The maximum number of decimal places for operations involving division.\r\n\t DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n\t /*\r\n\t * The rounding mode used when rounding to the above decimal places, and when using\r\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n\t * UP 0 Away from zero.\r\n\t * DOWN 1 Towards zero.\r\n\t * CEIL 2 Towards +Infinity.\r\n\t * FLOOR 3 Towards -Infinity.\r\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n\t */\r\n\t ROUNDING_MODE = 4, // 0 to 8\r\n\r\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n\t // The exponent value at and beneath which toString returns exponential notation.\r\n\t // Number type: -7\r\n\t TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n\t // The exponent value at and above which toString returns exponential notation.\r\n\t // Number type: 21\r\n\t TO_EXP_POS = 21, // 0 to MAX\r\n\r\n\t // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n\t // The minimum exponent value, beneath which underflow to zero occurs.\r\n\t // Number type: -324 (5e-324)\r\n\t MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n\t // The maximum exponent value, above which overflow to Infinity occurs.\r\n\t // Number type: 308 (1.7976931348623157e+308)\r\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n\t MAX_EXP = 1e7, // 1 to MAX\r\n\r\n\t // Whether BigNumber Errors are ever thrown.\r\n\t ERRORS = true, // true or false\r\n\r\n\t // Change to intValidatorNoErrors if ERRORS is false.\r\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n\t // Whether to use cryptographically-secure random number generation, if available.\r\n\t CRYPTO = false, // true or false\r\n\r\n\t /*\r\n\t * The modulo mode used when calculating the modulus: a mod n.\r\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n\t * The remainder (r) is calculated as: r = a - n * q.\r\n\t *\r\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n\t * DOWN 1 The remainder has the same sign as the dividend.\r\n\t * This modulo mode is commonly known as 'truncated division' and is\r\n\t * equivalent to (a % n) in JavaScript.\r\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n\t * The remainder is always positive.\r\n\t *\r\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n\t * modes are commonly used for the modulus operation.\r\n\t * Although the other rounding modes can also be used, they may not give useful results.\r\n\t */\r\n\t MODULO_MODE = 1, // 0 to 9\r\n\r\n\t // The maximum number of significant digits of the result of the toPower operation.\r\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n\t POW_PRECISION = 100, // 0 to MAX\r\n\r\n\t // The format specification used by the BigNumber.prototype.toFormat method.\r\n\t FORMAT = {\r\n\t decimalSeparator: '.',\r\n\t groupSeparator: ',',\r\n\t groupSize: 3,\r\n\t secondaryGroupSize: 0,\r\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\r\n\t fractionGroupSize: 0\r\n\t };\r\n\r\n\r\n\t /******************************************************************************************/\r\n\r\n\r\n\t // CONSTRUCTOR\r\n\r\n\r\n\t /*\r\n\t * The BigNumber constructor and exported function.\r\n\t * Create and return a new instance of a BigNumber object.\r\n\t *\r\n\t * n {number|string|BigNumber} A numeric value.\r\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n\t */\r\n\t function BigNumber( n, b ) {\r\n\t var c, e, i, num, len, str,\r\n\t x = this;\r\n\r\n\t // Enable constructor usage without new.\r\n\t if ( !( x instanceof BigNumber ) ) {\r\n\r\n\t // 'BigNumber() constructor call without new: {n}'\r\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\r\n\t return new BigNumber( n, b );\r\n\t }\r\n\r\n\t // 'new BigNumber() base not an integer: {b}'\r\n\t // 'new BigNumber() base out of range: {b}'\r\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n\t // Duplicate.\r\n\t if ( n instanceof BigNumber ) {\r\n\t x.s = n.s;\r\n\t x.e = n.e;\r\n\t x.c = ( n = n.c ) ? n.slice() : n;\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n\t // Fast path for integers.\r\n\t if ( n === ~~n ) {\r\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n\t x.e = e;\r\n\t x.c = [n];\r\n\t id = 0;\r\n\t return;\r\n\t }\r\n\r\n\t str = n + '';\r\n\t } else {\r\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\t } else {\r\n\t b = b | 0;\r\n\t str = n + '';\r\n\r\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n\t // Allow exponential notation to be used with base 10 argument.\r\n\t if ( b == 10 ) {\r\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\r\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n\t }\r\n\r\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n\t // Any number in exponential form will fail due to the [Ee][+-].\r\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n\t return parseNumeric( x, str, num, b );\r\n\t }\r\n\r\n\t if (num) {\r\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t raise( id, tooManyDigits, n );\r\n\t }\r\n\r\n\t // Prevent later check for length on converted number.\r\n\t num = false;\r\n\t } else {\r\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n\t }\r\n\r\n\t str = convertBase( str, 10, b, x.s );\r\n\t }\r\n\r\n\t // Decimal point?\r\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n\t // Exponential form?\r\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n\t // Determine exponent.\r\n\t if ( e < 0 ) e = i;\r\n\t e += +str.slice( i + 1 );\r\n\t str = str.substring( 0, i );\r\n\t } else if ( e < 0 ) {\r\n\r\n\t // Integer.\r\n\t e = str.length;\r\n\t }\r\n\r\n\t // Determine leading zeros.\r\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n\t str = str.slice( i, len + 1 );\r\n\r\n\t if (str) {\r\n\t len = str.length;\r\n\r\n\t // Disallow numbers with over 15 significant digits if number type.\r\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n\t if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n\t raise( id, tooManyDigits, x.s * n );\r\n\t }\r\n\r\n\t e = e - i - 1;\r\n\r\n\t // Overflow?\r\n\t if ( e > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t } else {\r\n\t x.e = e;\r\n\t x.c = [];\r\n\r\n\t // Transform base\r\n\r\n\t // e is the base 10 exponent.\r\n\t // i is where to slice str to get the first element of the coefficient array.\r\n\t i = ( e + 1 ) % LOG_BASE;\r\n\t if ( e < 0 ) i += LOG_BASE;\r\n\r\n\t if ( i < len ) {\r\n\t if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n\t for ( len -= LOG_BASE; i < len; ) {\r\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n\t }\r\n\r\n\t str = str.slice(i);\r\n\t i = LOG_BASE - str.length;\r\n\t } else {\r\n\t i -= len;\r\n\t }\r\n\r\n\t for ( ; i--; str += '0' );\r\n\t x.c.push( +str );\r\n\t }\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\r\n\t id = 0;\r\n\t }\r\n\r\n\r\n\t // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n\t BigNumber.another = constructorFactory;\r\n\r\n\t BigNumber.ROUND_UP = 0;\r\n\t BigNumber.ROUND_DOWN = 1;\r\n\t BigNumber.ROUND_CEIL = 2;\r\n\t BigNumber.ROUND_FLOOR = 3;\r\n\t BigNumber.ROUND_HALF_UP = 4;\r\n\t BigNumber.ROUND_HALF_DOWN = 5;\r\n\t BigNumber.ROUND_HALF_EVEN = 6;\r\n\t BigNumber.ROUND_HALF_CEIL = 7;\r\n\t BigNumber.ROUND_HALF_FLOOR = 8;\r\n\t BigNumber.EUCLID = 9;\r\n\r\n\r\n\t /*\r\n\t * Configure infrequently-changing library-wide settings.\r\n\t *\r\n\t * Accept an object or an argument list, with one or many of the following properties or\r\n\t * parameters respectively:\r\n\t *\r\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n\t * ERRORS {boolean|number} true, false, 1 or 0\r\n\t * CRYPTO {boolean|number} true, false, 1 or 0\r\n\t * MODULO_MODE {number} 0 to 9 inclusive\r\n\t * POW_PRECISION {number} 0 to MAX inclusive\r\n\t * FORMAT {object} See BigNumber.prototype.toFormat\r\n\t * decimalSeparator {string}\r\n\t * groupSeparator {string}\r\n\t * groupSize {number}\r\n\t * secondaryGroupSize {number}\r\n\t * fractionGroupSeparator {string}\r\n\t * fractionGroupSize {number}\r\n\t *\r\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n\t *\r\n\t * E.g.\r\n\t * BigNumber.config(20, 4) is equivalent to\r\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n\t *\r\n\t * Ignore properties/parameters set to null or undefined.\r\n\t * Return an object with the properties current values.\r\n\t */\r\n\t BigNumber.config = function () {\r\n\t var v, p,\r\n\t i = 0,\r\n\t r = {},\r\n\t a = arguments,\r\n\t o = a[0],\r\n\t has = o && typeof o == 'object'\r\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\r\n\t // 'config() DECIMAL_PLACES out of range: {v}'\r\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t DECIMAL_PLACES = v | 0;\r\n\t }\r\n\t r[p] = DECIMAL_PLACES;\r\n\r\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n\t // 'config() ROUNDING_MODE not an integer: {v}'\r\n\t // 'config() ROUNDING_MODE out of range: {v}'\r\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n\t ROUNDING_MODE = v | 0;\r\n\t }\r\n\t r[p] = ROUNDING_MODE;\r\n\r\n\t // EXPONENTIAL_AT {number|number[]}\r\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\r\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = v[0] | 0;\r\n\t TO_EXP_POS = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n\t }\r\n\t }\r\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n\t // 'config() RANGE not an integer: {v}'\r\n\t // 'config() RANGE cannot be zero: {v}'\r\n\t // 'config() RANGE out of range: {v}'\r\n\t if ( has( p = 'RANGE' ) ) {\r\n\r\n\t if ( isArray(v) ) {\r\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n\t MIN_EXP = v[0] | 0;\r\n\t MAX_EXP = v[1] | 0;\r\n\t }\r\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n\t }\r\n\t }\r\n\t r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n\t // ERRORS {boolean|number} true, false, 1 or 0.\r\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\r\n\t if ( has( p = 'ERRORS' ) ) {\r\n\r\n\t if ( v === !!v || v === 1 || v === 0 ) {\r\n\t id = 0;\r\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = ERRORS;\r\n\r\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\r\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n\t // 'config() crypto unavailable: {crypto}'\r\n\t if ( has( p = 'CRYPTO' ) ) {\r\n\r\n\t if ( v === !!v || v === 1 || v === 0 ) {\r\n\t CRYPTO = !!( v && cryptoObj );\r\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', cryptoObj );\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + notBool, v );\r\n\t }\r\n\t }\r\n\t r[p] = CRYPTO;\r\n\r\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n\t // 'config() MODULO_MODE not an integer: {v}'\r\n\t // 'config() MODULO_MODE out of range: {v}'\r\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n\t MODULO_MODE = v | 0;\r\n\t }\r\n\t r[p] = MODULO_MODE;\r\n\r\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n\t // 'config() POW_PRECISION not an integer: {v}'\r\n\t // 'config() POW_PRECISION out of range: {v}'\r\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n\t POW_PRECISION = v | 0;\r\n\t }\r\n\t r[p] = POW_PRECISION;\r\n\r\n\t // FORMAT {object}\r\n\t // 'config() FORMAT not an object: {v}'\r\n\t if ( has( p = 'FORMAT' ) ) {\r\n\r\n\t if ( typeof v == 'object' ) {\r\n\t FORMAT = v;\r\n\t } else if (ERRORS) {\r\n\t raise( 2, p + ' not an object', v );\r\n\t }\r\n\t }\r\n\t r[p] = FORMAT;\r\n\r\n\t return r;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the maximum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the minimum of the arguments.\r\n\t *\r\n\t * arguments {number|string|BigNumber}\r\n\t */\r\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n\t * zeros are produced).\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t *\r\n\t * 'random() decimal places not an integer: {dp}'\r\n\t * 'random() decimal places out of range: {dp}'\r\n\t * 'random() crypto unavailable: {crypto}'\r\n\t */\r\n\t BigNumber.random = (function () {\r\n\t var pow2_53 = 0x20000000000000;\r\n\r\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n\t // Check if Math.random() produces more than 32 bits of randomness.\r\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n\t (Math.random() * 0x800000 | 0); };\r\n\r\n\t return function (dp) {\r\n\t var a, b, e, k, v,\r\n\t i = 0,\r\n\t c = [],\r\n\t rand = new BigNumber(ONE);\r\n\r\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n\t k = mathceil( dp / LOG_BASE );\r\n\r\n\t if (CRYPTO) {\r\n\r\n\t // Browsers supporting crypto.getRandomValues.\r\n\t if ( cryptoObj && cryptoObj.getRandomValues ) {\r\n\r\n\t a = cryptoObj.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 53 bits:\r\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n\t // 11111 11111111 11111111\r\n\t // 0x20000 is 2^21.\r\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n\t // Rejection sampling:\r\n\t // 0 <= v < 9007199254740992\r\n\t // Probability that v >= 9e15, is\r\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n\t if ( v >= 9e15 ) {\r\n\t b = cryptoObj.getRandomValues( new Uint32Array(2) );\r\n\t a[i] = b[0];\r\n\t a[i + 1] = b[1];\r\n\t } else {\r\n\r\n\t // 0 <= v <= 8999999999999999\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 2;\r\n\t }\r\n\t }\r\n\t i = k / 2;\r\n\r\n\t // Node.js supporting crypto.randomBytes.\r\n\t } else if ( cryptoObj && cryptoObj.randomBytes ) {\r\n\r\n\t // buffer\r\n\t a = cryptoObj.randomBytes( k *= 7 );\r\n\r\n\t for ( ; i < k; ) {\r\n\r\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n\t // 0 <= v < 9007199254740992\r\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n\t if ( v >= 9e15 ) {\r\n\t cryptoObj.randomBytes(7).copy( a, i );\r\n\t } else {\r\n\r\n\t // 0 <= (v % 1e14) <= 99999999999999\r\n\t c.push( v % 1e14 );\r\n\t i += 7;\r\n\t }\r\n\t }\r\n\t i = k / 7;\r\n\t } else if (ERRORS) {\r\n\t raise( 14, 'crypto unavailable', cryptoObj );\r\n\t }\r\n\t }\r\n\r\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\r\n\t if (!i) {\r\n\r\n\t for ( ; i < k; ) {\r\n\t v = random53bitInt();\r\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\r\n\t }\r\n\t }\r\n\r\n\t k = c[--i];\r\n\t dp %= LOG_BASE;\r\n\r\n\t // Convert trailing digits to zeros according to dp.\r\n\t if ( k && dp ) {\r\n\t v = POWS_TEN[LOG_BASE - dp];\r\n\t c[i] = mathfloor( k / v ) * v;\r\n\t }\r\n\r\n\t // Remove trailing elements which are zero.\r\n\t for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n\t // Zero?\r\n\t if ( i < 0 ) {\r\n\t c = [ e = 0 ];\r\n\t } else {\r\n\r\n\t // Remove leading elements which are zero and adjust exponent accordingly.\r\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n\t // Count the digits of the first element of c to determine leading zeros, and...\r\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n\t // adjust the exponent accordingly.\r\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n\t }\r\n\r\n\t rand.e = e;\r\n\t rand.c = c;\r\n\t return rand;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t // PRIVATE FUNCTIONS\r\n\r\n\r\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n\t function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc.unshift(1);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }\r\n\r\n\r\n\t // Perform division in the specified base. Called by div and convertBase.\r\n\t div = (function () {\r\n\r\n\t // Assume non-zero x and k.\r\n\t function multiply( x, k, base ) {\r\n\t var m, temp, xlo, xhi,\r\n\t carry = 0,\r\n\t i = x.length,\r\n\t klo = k % SQRT_BASE,\r\n\t khi = k / SQRT_BASE | 0;\r\n\r\n\t for ( x = x.slice(); i--; ) {\r\n\t xlo = x[i] % SQRT_BASE;\r\n\t xhi = x[i] / SQRT_BASE | 0;\r\n\t m = khi * xlo + xhi * klo;\r\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n\t x[i] = temp % base;\r\n\t }\r\n\r\n\t if (carry) x.unshift(carry);\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t function compare( a, b, aL, bL ) {\r\n\t var i, cmp;\r\n\r\n\t if ( aL != bL ) {\r\n\t cmp = aL > bL ? 1 : -1;\r\n\t } else {\r\n\r\n\t for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n\t if ( a[i] != b[i] ) {\r\n\t cmp = a[i] > b[i] ? 1 : -1;\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t return cmp;\r\n\t }\r\n\r\n\t function subtract( a, b, aL, base ) {\r\n\t var i = 0;\r\n\r\n\t // Subtract b from a.\r\n\t for ( ; aL--; ) {\r\n\t a[aL] -= i;\r\n\t i = a[aL] < b[aL] ? 1 : 0;\r\n\t a[aL] = i * base + a[aL] - b[aL];\r\n\t }\r\n\r\n\t // Remove leading zeros.\r\n\t for ( ; !a[0] && a.length > 1; a.shift() );\r\n\t }\r\n\r\n\t // x: dividend, y: divisor.\r\n\t return function ( x, y, dp, rm, base ) {\r\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n\t yL, yz,\r\n\t s = x.s == y.s ? 1 : -1,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t // Either NaN, Infinity or 0?\r\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n\t return new BigNumber(\r\n\r\n\t // Return NaN if either NaN, or both Infinity or 0.\r\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n\t );\r\n\t }\r\n\r\n\t q = new BigNumber(s);\r\n\t qc = q.c = [];\r\n\t e = x.e - y.e;\r\n\t s = dp + e + 1;\r\n\r\n\t if ( !base ) {\r\n\t base = BASE;\r\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n\t s = s / LOG_BASE | 0;\r\n\t }\r\n\r\n\t // Result exponent may be one less then the current value of e.\r\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n\t if ( s < 0 ) {\r\n\t qc.push(1);\r\n\t more = true;\r\n\t } else {\r\n\t xL = xc.length;\r\n\t yL = yc.length;\r\n\t i = 0;\r\n\t s += 2;\r\n\r\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n\t n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n\t if ( n > 1 ) {\r\n\t yc = multiply( yc, n, base );\r\n\t xc = multiply( xc, n, base );\r\n\t yL = yc.length;\r\n\t xL = xc.length;\r\n\t }\r\n\r\n\t xi = yL;\r\n\t rem = xc.slice( 0, yL );\r\n\t remL = rem.length;\r\n\r\n\t // Add zeros to make remainder as long as divisor.\r\n\t for ( ; remL < yL; rem[remL++] = 0 );\r\n\t yz = yc.slice();\r\n\t yz.unshift(0);\r\n\t yc0 = yc[0];\r\n\t if ( yc[1] >= base / 2 ) yc0++;\r\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n\t do {\r\n\t n = 0;\r\n\r\n\t // Compare divisor and remainder.\r\n\t cmp = compare( yc, rem, yL, remL );\r\n\r\n\t // If divisor < remainder.\r\n\t if ( cmp < 0 ) {\r\n\r\n\t // Calculate trial digit, n.\r\n\r\n\t rem0 = rem[0];\r\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n\t // n is how many times the divisor goes into the current remainder.\r\n\t n = mathfloor( rem0 / yc0 );\r\n\r\n\t // Algorithm:\r\n\t // 1. product = divisor * trial digit (n)\r\n\t // 2. if product > remainder: product -= divisor, n--\r\n\t // 3. remainder -= product\r\n\t // 4. if product was < remainder at 2:\r\n\t // 5. compare new remainder and divisor\r\n\t // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n\t if ( n > 1 ) {\r\n\r\n\t // n may be > base only when base is 3.\r\n\t if (n >= base) n = base - 1;\r\n\r\n\t // product = divisor * trial digit.\r\n\t prod = multiply( yc, n, base );\r\n\t prodL = prod.length;\r\n\t remL = rem.length;\r\n\r\n\t // Compare product and remainder.\r\n\t // If product > remainder.\r\n\t // Trial digit n too high.\r\n\t // n is 1 too high about 5% of the time, and is not known to have\r\n\t // ever been more than 1 too high.\r\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n\t n--;\r\n\r\n\t // Subtract divisor from product.\r\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n\t prodL = prod.length;\r\n\t cmp = 1;\r\n\t }\r\n\t } else {\r\n\r\n\t // n is 0 or 1, cmp is -1.\r\n\t // If n is 0, there is no need to compare yc and rem again below,\r\n\t // so change cmp to 1 to avoid it.\r\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n\t if ( n == 0 ) {\r\n\r\n\t // divisor < remainder, so n must be at least 1.\r\n\t cmp = n = 1;\r\n\t }\r\n\r\n\t // product = divisor\r\n\t prod = yc.slice();\r\n\t prodL = prod.length;\r\n\t }\r\n\r\n\t if ( prodL < remL ) prod.unshift(0);\r\n\r\n\t // Subtract product from remainder.\r\n\t subtract( rem, prod, remL, base );\r\n\t remL = rem.length;\r\n\r\n\t // If product was < remainder.\r\n\t if ( cmp == -1 ) {\r\n\r\n\t // Compare divisor and new remainder.\r\n\t // If divisor < new remainder, subtract divisor from remainder.\r\n\t // Trial digit n too low.\r\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n\t n++;\r\n\r\n\t // Subtract divisor from remainder.\r\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\r\n\t remL = rem.length;\r\n\t }\r\n\t }\r\n\t } else if ( cmp === 0 ) {\r\n\t n++;\r\n\t rem = [0];\r\n\t } // else cmp === 1 and n will be 0\r\n\r\n\t // Add the next digit, n, to the result array.\r\n\t qc[i++] = n;\r\n\r\n\t // Update the remainder.\r\n\t if ( rem[0] ) {\r\n\t rem[remL++] = xc[xi] || 0;\r\n\t } else {\r\n\t rem = [ xc[xi] ];\r\n\t remL = 1;\r\n\t }\r\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n\t more = rem[0] != null;\r\n\r\n\t // Leading zero?\r\n\t if ( !qc[0] ) qc.shift();\r\n\t }\r\n\r\n\t if ( base == BASE ) {\r\n\r\n\t // To calculate q.e, first get the number of digits of qc[0].\r\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n\t // Caller is convertBase.\r\n\t } else {\r\n\t q.e = e;\r\n\t q.r = +more;\r\n\t }\r\n\r\n\t return q;\r\n\t };\r\n\t })();\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n\t * notation rounded to the specified decimal places or significant digits.\r\n\t *\r\n\t * n is a BigNumber.\r\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n\t * rm is the rounding mode.\r\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n\t */\r\n\t function format( n, i, rm, caller ) {\r\n\t var c0, e, ne, len, str;\r\n\r\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n\t ? rm | 0 : ROUNDING_MODE;\r\n\r\n\t if ( !n.c ) return n.toString();\r\n\t c0 = n.c[0];\r\n\t ne = n.e;\r\n\r\n\t if ( i == null ) {\r\n\t str = coeffToString( n.c );\r\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n\t ? toExponential( str, ne )\r\n\t : toFixedPoint( str, ne );\r\n\t } else {\r\n\t n = round( new BigNumber(n), i, rm );\r\n\r\n\t // n.e may have changed if the value was rounded up.\r\n\t e = n.e;\r\n\r\n\t str = coeffToString( n.c );\r\n\t len = str.length;\r\n\r\n\t // toPrecision returns exponential notation if the number of significant digits\r\n\t // specified is less than the number of digits necessary to represent the integer\r\n\t // part of the value in fixed-point notation.\r\n\r\n\t // Exponential notation.\r\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n\t // Append zeros?\r\n\t for ( ; len < i; str += '0', len++ );\r\n\t str = toExponential( str, e );\r\n\r\n\t // Fixed-point notation.\r\n\t } else {\r\n\t i -= ne;\r\n\t str = toFixedPoint( str, e );\r\n\r\n\t // Append zeros?\r\n\t if ( e + 1 > len ) {\r\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n\t } else {\r\n\t i += e - len;\r\n\t if ( i > 0 ) {\r\n\t if ( e + 1 == len ) str += '.';\r\n\t for ( ; i--; str += '0' );\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return n.s < 0 && c0 ? '-' + str : str;\r\n\t }\r\n\r\n\r\n\t // Handle BigNumber.max and BigNumber.min.\r\n\t function maxOrMin( args, method ) {\r\n\t var m, n,\r\n\t i = 0;\r\n\r\n\t if ( isArray( args[0] ) ) args = args[0];\r\n\t m = new BigNumber( args[0] );\r\n\r\n\t for ( ; ++i < args.length; ) {\r\n\t n = new BigNumber( args[i] );\r\n\r\n\t // If any number is NaN, return NaN.\r\n\t if ( !n.s ) {\r\n\t m = n;\r\n\t break;\r\n\t } else if ( method.call( m, n ) ) {\r\n\t m = n;\r\n\t }\r\n\t }\r\n\r\n\t return m;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Return true if n is an integer in range, otherwise throw.\r\n\t * Use for argument validation when ERRORS is true.\r\n\t */\r\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\r\n\t if ( n < min || n > max || n != truncate(n) ) {\r\n\t raise( caller, ( name || 'decimal places' ) +\r\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n\t }\r\n\r\n\t return true;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n\t * Called by minus, plus and times.\r\n\t */\r\n\t function normalise( n, c, e ) {\r\n\t var i = 1,\r\n\t j = c.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; !c[--j]; c.pop() );\r\n\r\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n\t // Overflow?\r\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n\t // Infinity.\r\n\t n.c = n.e = null;\r\n\r\n\t // Underflow?\r\n\t } else if ( e < MIN_EXP ) {\r\n\r\n\t // Zero.\r\n\t n.c = [ n.e = 0 ];\r\n\t } else {\r\n\t n.e = e;\r\n\t n.c = c;\r\n\t }\r\n\r\n\t return n;\r\n\t }\r\n\r\n\r\n\t // Handle values that fail the validity test in BigNumber.\r\n\t parseNumeric = (function () {\r\n\t var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n\t dotAfter = /^([^.]+)\\.$/,\r\n\t dotBefore = /^\\.([^.]+)$/,\r\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n\t whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n\t return function ( x, str, num, b ) {\r\n\t var base,\r\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n\t // No exception on ±Infinity or NaN.\r\n\t if ( isInfinityOrNaN.test(s) ) {\r\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n\t } else {\r\n\t if ( !num ) {\r\n\r\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n\t return !b || b == base ? p1 : m;\r\n\t });\r\n\r\n\t if (b) {\r\n\t base = b;\r\n\r\n\t // E.g. '1.' to '1', '.1' to '0.1'\r\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n\t }\r\n\r\n\t if ( str != s ) return new BigNumber( s, base );\r\n\t }\r\n\r\n\t // 'new BigNumber() not a number: {n}'\r\n\t // 'new BigNumber() not a base {b} number: {n}'\r\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n\t x.s = null;\r\n\t }\r\n\r\n\t x.c = x.e = null;\r\n\t id = 0;\r\n\t }\r\n\t })();\r\n\r\n\r\n\t // Throw a BigNumber Error.\r\n\t function raise( caller, msg, val ) {\r\n\t var error = new Error( [\r\n\t 'new BigNumber', // 0\r\n\t 'cmp', // 1\r\n\t 'config', // 2\r\n\t 'div', // 3\r\n\t 'divToInt', // 4\r\n\t 'eq', // 5\r\n\t 'gt', // 6\r\n\t 'gte', // 7\r\n\t 'lt', // 8\r\n\t 'lte', // 9\r\n\t 'minus', // 10\r\n\t 'mod', // 11\r\n\t 'plus', // 12\r\n\t 'precision', // 13\r\n\t 'random', // 14\r\n\t 'round', // 15\r\n\t 'shift', // 16\r\n\t 'times', // 17\r\n\t 'toDigits', // 18\r\n\t 'toExponential', // 19\r\n\t 'toFixed', // 20\r\n\t 'toFormat', // 21\r\n\t 'toFraction', // 22\r\n\t 'pow', // 23\r\n\t 'toPrecision', // 24\r\n\t 'toString', // 25\r\n\t 'BigNumber' // 26\r\n\t ][caller] + '() ' + msg + ': ' + val );\r\n\r\n\t error.name = 'BigNumber Error';\r\n\t id = 0;\r\n\t throw error;\r\n\t }\r\n\r\n\r\n\t /*\r\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\r\n\t */\r\n\t function round( x, sd, rm, r ) {\r\n\t var d, i, j, k, n, ni, rd,\r\n\t xc = x.c,\r\n\t pows10 = POWS_TEN;\r\n\r\n\t // if x is not Infinity or NaN...\r\n\t if (xc) {\r\n\r\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n\t // ni is the index of n within x.c.\r\n\t // d is the number of digits of n.\r\n\t // i is the index of rd within n including leading zeros.\r\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n\t out: {\r\n\r\n\t // Get the number of digits of the first element of xc.\r\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n\t i = sd - d;\r\n\r\n\t // If the rounding digit is in the first element of xc...\r\n\t if ( i < 0 ) {\r\n\t i += LOG_BASE;\r\n\t j = sd;\r\n\t n = xc[ ni = 0 ];\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t } else {\r\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n\t if ( ni >= xc.length ) {\r\n\r\n\t if (r) {\r\n\r\n\t // Needed by sqrt.\r\n\t for ( ; xc.length <= ni; xc.push(0) );\r\n\t n = rd = 0;\r\n\t d = 1;\r\n\t i %= LOG_BASE;\r\n\t j = i - LOG_BASE + 1;\r\n\t } else {\r\n\t break out;\r\n\t }\r\n\t } else {\r\n\t n = k = xc[ni];\r\n\r\n\t // Get the number of digits of n.\r\n\t for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n\t // Get the index of rd within n.\r\n\t i %= LOG_BASE;\r\n\r\n\t // Get the index of rd within n, adjusted for leading zeros.\r\n\t // The number of leading zeros of n is given by LOG_BASE - d.\r\n\t j = i - LOG_BASE + d;\r\n\r\n\t // Get the rounding digit at index j of n.\r\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n\t }\r\n\t }\r\n\r\n\t r = r || sd < 0 ||\r\n\r\n\t // Are there any non-zero digits after the rounding digit?\r\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n\t r = rm < 4\r\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n\t // Check whether the digit to the left of the rounding digit is odd.\r\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( sd < 1 || !xc[0] ) {\r\n\t xc.length = 0;\r\n\r\n\t if (r) {\r\n\r\n\t // Convert sd to decimal places.\r\n\t sd -= x.e + 1;\r\n\r\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n\t xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n\t x.e = -sd || 0;\r\n\t } else {\r\n\r\n\t // Zero.\r\n\t xc[0] = x.e = 0;\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\t // Remove excess digits.\r\n\t if ( i == 0 ) {\r\n\t xc.length = ni;\r\n\t k = 1;\r\n\t ni--;\r\n\t } else {\r\n\t xc.length = ni + 1;\r\n\t k = pows10[ LOG_BASE - i ];\r\n\r\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n\t // j > 0 means i > number of leading zeros of n.\r\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n\t }\r\n\r\n\t // Round up?\r\n\t if (r) {\r\n\r\n\t for ( ; ; ) {\r\n\r\n\t // If the digit to be rounded up is in the first element of xc...\r\n\t if ( ni == 0 ) {\r\n\r\n\t // i will be the length of xc[0] before k is added.\r\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n\t j = xc[0] += k;\r\n\t for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n\t // if i != k the length has increased.\r\n\t if ( i != k ) {\r\n\t x.e++;\r\n\t if ( xc[0] == BASE ) xc[0] = 1;\r\n\t }\r\n\r\n\t break;\r\n\t } else {\r\n\t xc[ni] += k;\r\n\t if ( xc[ni] != BASE ) break;\r\n\t xc[ni--] = 0;\r\n\t k = 1;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n\t }\r\n\r\n\t // Overflow? Infinity.\r\n\t if ( x.e > MAX_EXP ) {\r\n\t x.c = x.e = null;\r\n\r\n\t // Underflow? Zero.\r\n\t } else if ( x.e < MIN_EXP ) {\r\n\t x.c = [ x.e = 0 ];\r\n\t }\r\n\t }\r\n\r\n\t return x;\r\n\t }\r\n\r\n\r\n\t // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n\t */\r\n\t P.absoluteValue = P.abs = function () {\r\n\t var x = new BigNumber(this);\r\n\t if ( x.s < 0 ) x.s = 1;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of Infinity.\r\n\t */\r\n\t P.ceil = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 2 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return\r\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * 0 if they have the same value,\r\n\t * or null if the value of either is NaN.\r\n\t */\r\n\t P.comparedTo = P.cmp = function ( y, b ) {\r\n\t id = 1;\r\n\t return compare( this, new BigNumber( y, b ) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n\t * of this BigNumber is ±Infinity or NaN.\r\n\t */\r\n\t P.decimalPlaces = P.dp = function () {\r\n\t var n, v,\r\n\t c = this.c;\r\n\r\n\t if ( !c ) return null;\r\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n\t // Subtract the number of trailing zeros of the last number.\r\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n\t if ( n < 0 ) n = 0;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n / 0 = I\r\n\t * n / N = N\r\n\t * n / I = 0\r\n\t * 0 / n = 0\r\n\t * 0 / 0 = N\r\n\t * 0 / N = N\r\n\t * 0 / I = 0\r\n\t * N / n = N\r\n\t * N / 0 = N\r\n\t * N / N = N\r\n\t * N / I = N\r\n\t * I / n = I\r\n\t * I / 0 = I\r\n\t * I / N = N\r\n\t * I / I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.dividedBy = P.div = function ( y, b ) {\r\n\t id = 3;\r\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n\t * BigNumber by the value of BigNumber(y, b).\r\n\t */\r\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n\t id = 4;\r\n\t return div( this, new BigNumber( y, b ), 0, 1 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.equals = P.eq = function ( y, b ) {\r\n\t id = 5;\r\n\t return compare( this, new BigNumber( y, b ) ) === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n\t * number in the direction of -Infinity.\r\n\t */\r\n\t P.floor = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 3 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.greaterThan = P.gt = function ( y, b ) {\r\n\t id = 6;\r\n\t return compare( this, new BigNumber( y, b ) ) > 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n\t id = 7;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n\t */\r\n\t P.isFinite = function () {\r\n\t return !!this.c;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n\t */\r\n\t P.isInteger = P.isInt = function () {\r\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n\t */\r\n\t P.isNaN = function () {\r\n\t return !this.s;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n\t */\r\n\t P.isNegative = P.isNeg = function () {\r\n\t return this.s < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n\t */\r\n\t P.isZero = function () {\r\n\t return !!this.c && this.c[0] == 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n\t * otherwise returns false.\r\n\t */\r\n\t P.lessThan = P.lt = function ( y, b ) {\r\n\t id = 8;\r\n\t return compare( this, new BigNumber( y, b ) ) < 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return true if the value of this BigNumber is less than or equal to the value of\r\n\t * BigNumber(y, b), otherwise returns false.\r\n\t */\r\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n\t id = 9;\r\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n - 0 = n\r\n\t * n - N = N\r\n\t * n - I = -I\r\n\t * 0 - n = -n\r\n\t * 0 - 0 = 0\r\n\t * 0 - N = N\r\n\t * 0 - I = -I\r\n\t * N - n = N\r\n\t * N - 0 = N\r\n\t * N - N = N\r\n\t * N - I = N\r\n\t * I - n = I\r\n\t * I - 0 = I\r\n\t * I - N = N\r\n\t * I - I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.minus = P.sub = function ( y, b ) {\r\n\t var i, j, t, xLTy,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 10;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.plus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Either Infinity?\r\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n\t // Either zero?\r\n\t if ( !xc[0] || !yc[0] ) {\r\n\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n\t ROUNDING_MODE == 3 ? -0 : 0 );\r\n\t }\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Determine which is the bigger number.\r\n\t if ( a = xe - ye ) {\r\n\r\n\t if ( xLTy = a < 0 ) {\r\n\t a = -a;\r\n\t t = xc;\r\n\t } else {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\r\n\t // Prepend zeros to equalise exponents.\r\n\t for ( b = a; b--; t.push(0) );\r\n\t t.reverse();\r\n\t } else {\r\n\r\n\t // Exponents equal. Check digit by digit.\r\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n\t for ( a = b = 0; b < j; b++ ) {\r\n\r\n\t if ( xc[b] != yc[b] ) {\r\n\t xLTy = xc[b] < yc[b];\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // x < y? Point xc to the array of the bigger number.\r\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n\t b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n\t // Append zeros to xc if shorter.\r\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n\t b = BASE - 1;\r\n\r\n\t // Subtract yc from xc.\r\n\t for ( ; j > a; ) {\r\n\r\n\t if ( xc[--j] < yc[j] ) {\r\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\r\n\t --xc[i];\r\n\t xc[j] += BASE;\r\n\t }\r\n\r\n\t xc[j] -= yc[j];\r\n\t }\r\n\r\n\t // Remove leading zeros and adjust exponent accordingly.\r\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n\t // Zero?\r\n\t if ( !xc[0] ) {\r\n\r\n\t // Following IEEE 754 (2008) 6.3,\r\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n\t y.c = [ y.e = 0 ];\r\n\t return y;\r\n\t }\r\n\r\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n\t // for finite x and y.\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n % 0 = N\r\n\t * n % N = N\r\n\t * n % I = n\r\n\t * 0 % n = 0\r\n\t * -0 % n = -0\r\n\t * 0 % 0 = N\r\n\t * 0 % N = N\r\n\t * 0 % I = 0\r\n\t * N % n = N\r\n\t * N % 0 = N\r\n\t * N % N = N\r\n\t * N % I = N\r\n\t * I % n = N\r\n\t * I % 0 = N\r\n\t * I % N = N\r\n\t * I % I = N\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n\t */\r\n\t P.modulo = P.mod = function ( y, b ) {\r\n\t var q, s,\r\n\t x = this;\r\n\r\n\t id = 11;\r\n\t y = new BigNumber( y, b );\r\n\r\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n\t return new BigNumber(NaN);\r\n\r\n\t // Return x if y is Infinity or x is zero.\r\n\t } else if ( !y.c || x.c && !x.c[0] ) {\r\n\t return new BigNumber(x);\r\n\t }\r\n\r\n\t if ( MODULO_MODE == 9 ) {\r\n\r\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n\t // r = x - qy where 0 <= r < abs(y)\r\n\t s = y.s;\r\n\t y.s = 1;\r\n\t q = div( x, y, 0, 3 );\r\n\t y.s = s;\r\n\t q.s *= s;\r\n\t } else {\r\n\t q = div( x, y, 0, MODULO_MODE );\r\n\t }\r\n\r\n\t return x.minus( q.times(y) );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n\t * i.e. multiplied by -1.\r\n\t */\r\n\t P.negated = P.neg = function () {\r\n\t var x = new BigNumber(this);\r\n\t x.s = -x.s || null;\r\n\t return x;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n + 0 = n\r\n\t * n + N = N\r\n\t * n + I = I\r\n\t * 0 + n = n\r\n\t * 0 + 0 = 0\r\n\t * 0 + N = N\r\n\t * 0 + I = I\r\n\t * N + n = N\r\n\t * N + 0 = N\r\n\t * N + N = N\r\n\t * N + I = N\r\n\t * I + n = I\r\n\t * I + 0 = I\r\n\t * I + N = N\r\n\t * I + I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.plus = P.add = function ( y, b ) {\r\n\t var t,\r\n\t x = this,\r\n\t a = x.s;\r\n\r\n\t id = 12;\r\n\t y = new BigNumber( y, b );\r\n\t b = y.s;\r\n\r\n\t // Either NaN?\r\n\t if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n\t // Signs differ?\r\n\t if ( a != b ) {\r\n\t y.s = -b;\r\n\t return x.minus(y);\r\n\t }\r\n\r\n\t var xe = x.e / LOG_BASE,\r\n\t ye = y.e / LOG_BASE,\r\n\t xc = x.c,\r\n\t yc = y.c;\r\n\r\n\t if ( !xe || !ye ) {\r\n\r\n\t // Return ±Infinity if either ±Infinity.\r\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n\t // Either zero?\r\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n\t }\r\n\r\n\t xe = bitFloor(xe);\r\n\t ye = bitFloor(ye);\r\n\t xc = xc.slice();\r\n\r\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n\t if ( a = xe - ye ) {\r\n\t if ( a > 0 ) {\r\n\t ye = xe;\r\n\t t = yc;\r\n\t } else {\r\n\t a = -a;\r\n\t t = xc;\r\n\t }\r\n\r\n\t t.reverse();\r\n\t for ( ; a--; t.push(0) );\r\n\t t.reverse();\r\n\t }\r\n\r\n\t a = xc.length;\r\n\t b = yc.length;\r\n\r\n\t // Point xc to the longer array, and b to the shorter length.\r\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n\t for ( a = 0; b; ) {\r\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n\t xc[b] %= BASE;\r\n\t }\r\n\r\n\t if (a) {\r\n\t xc.unshift(a);\r\n\t ++ye;\r\n\t }\r\n\r\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n\t // ye = MAX_EXP + 1 possible\r\n\t return normalise( y, xc, ye );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the number of significant digits of the value of this BigNumber.\r\n\t *\r\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n\t */\r\n\t P.precision = P.sd = function (z) {\r\n\t var n, v,\r\n\t x = this,\r\n\t c = x.c;\r\n\r\n\t // 'precision() argument not a boolean or binary digit: {z}'\r\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n\t if ( z != !!z ) z = null;\r\n\t }\r\n\r\n\t if ( !c ) return null;\r\n\t v = c.length - 1;\r\n\t n = v * LOG_BASE + 1;\r\n\r\n\t if ( v = c[v] ) {\r\n\r\n\t // Subtract the number of trailing zeros of the last element.\r\n\t for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n\t // Add the number of digits of the first element.\r\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n\t }\r\n\r\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n\t * omitted.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'round() decimal places out of range: {dp}'\r\n\t * 'round() decimal places not an integer: {dp}'\r\n\t * 'round() rounding mode not an integer: {rm}'\r\n\t * 'round() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.round = function ( dp, rm ) {\r\n\t var n = new BigNumber(this);\r\n\r\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n\t round( n, ~~dp + this.e + 1, rm == null ||\r\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n\t }\r\n\r\n\t return n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n\t *\r\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t *\r\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n\t * otherwise.\r\n\t *\r\n\t * 'shift() argument not an integer: {k}'\r\n\t * 'shift() argument out of range: {k}'\r\n\t */\r\n\t P.shift = function (k) {\r\n\t var n = this;\r\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\r\n\t ? n.times( '1e' + truncate(k) )\r\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n\t : n );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * sqrt(-n) = N\r\n\t * sqrt( N) = N\r\n\t * sqrt(-I) = N\r\n\t * sqrt( I) = I\r\n\t * sqrt( 0) = 0\r\n\t * sqrt(-0) = -0\r\n\t *\r\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t */\r\n\t P.squareRoot = P.sqrt = function () {\r\n\t var m, n, r, rep, t,\r\n\t x = this,\r\n\t c = x.c,\r\n\t s = x.s,\r\n\t e = x.e,\r\n\t dp = DECIMAL_PLACES + 4,\r\n\t half = new BigNumber('0.5');\r\n\r\n\t // Negative/NaN/Infinity/zero?\r\n\t if ( s !== 1 || !c || !c[0] ) {\r\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n\t }\r\n\r\n\t // Initial estimate.\r\n\t s = Math.sqrt( +x );\r\n\r\n\t // Math.sqrt underflow/overflow?\r\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n\t if ( s == 0 || s == 1 / 0 ) {\r\n\t n = coeffToString(c);\r\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n\t s = Math.sqrt(n);\r\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n\t if ( s == 1 / 0 ) {\r\n\t n = '1e' + e;\r\n\t } else {\r\n\t n = s.toExponential();\r\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n\t }\r\n\r\n\t r = new BigNumber(n);\r\n\t } else {\r\n\t r = new BigNumber( s + '' );\r\n\t }\r\n\r\n\t // Check for zero.\r\n\t // r could be zero if MIN_EXP is changed after the this value was created.\r\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n\t // coeffToString to throw.\r\n\t if ( r.c[0] ) {\r\n\t e = r.e;\r\n\t s = e + dp;\r\n\t if ( s < 3 ) s = 0;\r\n\r\n\t // Newton-Raphson iteration.\r\n\t for ( ; ; ) {\r\n\t t = r;\r\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n\t // The exponent of r may here be one less than the final result exponent,\r\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n\t // are indexed correctly.\r\n\t if ( r.e < e ) --s;\r\n\t n = n.slice( s - 3, s + 1 );\r\n\r\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n\t // iteration.\r\n\t if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n\t // On the first iteration only, check to see if rounding up gives the\r\n\t // exact result as the nines may infinitely repeat.\r\n\t if ( !rep ) {\r\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n\t if ( t.times(t).eq(x) ) {\r\n\t r = t;\r\n\t break;\r\n\t }\r\n\t }\r\n\r\n\t dp += 4;\r\n\t s += 4;\r\n\t rep = 1;\r\n\t } else {\r\n\r\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n\t // result. If not, then there are further digits and m will be truthy.\r\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n\t // Truncate to the first rounding digit.\r\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n\t m = !r.times(r).eq(x);\r\n\t }\r\n\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * n * 0 = 0\r\n\t * n * N = N\r\n\t * n * I = I\r\n\t * 0 * n = 0\r\n\t * 0 * 0 = 0\r\n\t * 0 * N = N\r\n\t * 0 * I = N\r\n\t * N * n = N\r\n\t * N * 0 = N\r\n\t * N * N = N\r\n\t * N * I = N\r\n\t * I * n = I\r\n\t * I * 0 = N\r\n\t * I * N = N\r\n\t * I * I = I\r\n\t *\r\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n\t * BigNumber(y, b).\r\n\t */\r\n\t P.times = P.mul = function ( y, b ) {\r\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n\t base, sqrtBase,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n\t // Either NaN, ±Infinity or ±0?\r\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n\t y.c = y.e = y.s = null;\r\n\t } else {\r\n\t y.s *= x.s;\r\n\r\n\t // Return ±Infinity if either is ±Infinity.\r\n\t if ( !xc || !yc ) {\r\n\t y.c = y.e = null;\r\n\r\n\t // Return ±0 if either is ±0.\r\n\t } else {\r\n\t y.c = [0];\r\n\t y.e = 0;\r\n\t }\r\n\t }\r\n\r\n\t return y;\r\n\t }\r\n\r\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n\t y.s *= x.s;\r\n\t xcL = xc.length;\r\n\t ycL = yc.length;\r\n\r\n\t // Ensure xc points to longer array and xcL to its length.\r\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n\t // Initialise the result array with zeros.\r\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n\t base = BASE;\r\n\t sqrtBase = SQRT_BASE;\r\n\r\n\t for ( i = ycL; --i >= 0; ) {\r\n\t c = 0;\r\n\t ylo = yc[i] % sqrtBase;\r\n\t yhi = yc[i] / sqrtBase | 0;\r\n\r\n\t for ( k = xcL, j = i + k; j > i; ) {\r\n\t xlo = xc[--k] % sqrtBase;\r\n\t xhi = xc[k] / sqrtBase | 0;\r\n\t m = yhi * xlo + xhi * ylo;\r\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n\t zc[j--] = xlo % base;\r\n\t }\r\n\r\n\t zc[j] = c;\r\n\t }\r\n\r\n\t if (c) {\r\n\t ++e;\r\n\t } else {\r\n\t zc.shift();\r\n\t }\r\n\r\n\t return normalise( y, zc, e );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toDigits() precision out of range: {sd}'\r\n\t * 'toDigits() precision not an integer: {sd}'\r\n\t * 'toDigits() rounding mode not an integer: {rm}'\r\n\t * 'toDigits() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toDigits = function ( sd, rm ) {\r\n\t var n = new BigNumber(this);\r\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n\t return sd ? round( n, sd, rm ) : n;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in exponential notation and\r\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toExponential() decimal places not an integer: {dp}'\r\n\t * 'toExponential() decimal places out of range: {dp}'\r\n\t * 'toExponential() rounding mode not an integer: {rm}'\r\n\t * 'toExponential() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toExponential = function ( dp, rm ) {\r\n\t return format( this,\r\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n\t *\r\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFixed() decimal places not an integer: {dp}'\r\n\t * 'toFixed() decimal places out of range: {dp}'\r\n\t * 'toFixed() rounding mode not an integer: {rm}'\r\n\t * 'toFixed() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFixed = function ( dp, rm ) {\r\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n\t * of the FORMAT object (see BigNumber.config).\r\n\t *\r\n\t * FORMAT = {\r\n\t * decimalSeparator : '.',\r\n\t * groupSeparator : ',',\r\n\t * groupSize : 3,\r\n\t * secondaryGroupSize : 0,\r\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n\t * fractionGroupSize : 0\r\n\t * };\r\n\t *\r\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toFormat() decimal places not an integer: {dp}'\r\n\t * 'toFormat() decimal places out of range: {dp}'\r\n\t * 'toFormat() rounding mode not an integer: {rm}'\r\n\t * 'toFormat() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toFormat = function ( dp, rm ) {\r\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n\t if ( this.c ) {\r\n\t var i,\r\n\t arr = str.split('.'),\r\n\t g1 = +FORMAT.groupSize,\r\n\t g2 = +FORMAT.secondaryGroupSize,\r\n\t groupSeparator = FORMAT.groupSeparator,\r\n\t intPart = arr[0],\r\n\t fractionPart = arr[1],\r\n\t isNeg = this.s < 0,\r\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\r\n\t len = intDigits.length;\r\n\r\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n\t if ( g1 > 0 && len > 0 ) {\r\n\t i = len % g1 || g1;\r\n\t intPart = intDigits.substr( 0, i );\r\n\r\n\t for ( ; i < len; i += g1 ) {\r\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\r\n\t }\r\n\r\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n\t if (isNeg) intPart = '-' + intPart;\r\n\t }\r\n\r\n\t str = fractionPart\r\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n\t '$&' + FORMAT.fractionGroupSeparator )\r\n\t : fractionPart )\r\n\t : intPart;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\r\n\t * an integer numerator and an integer denominator. The denominator will be a positive\r\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n\t * denominator is not specified, the denominator will be the lowest value necessary to\r\n\t * represent the number exactly.\r\n\t *\r\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n\t *\r\n\t * 'toFraction() max denominator not an integer: {md}'\r\n\t * 'toFraction() max denominator out of range: {md}'\r\n\t */\r\n\t P.toFraction = function (md) {\r\n\t var arr, d0, d2, e, exp, n, n0, q, s,\r\n\t k = ERRORS,\r\n\t x = this,\r\n\t xc = x.c,\r\n\t d = new BigNumber(ONE),\r\n\t n1 = d0 = new BigNumber(ONE),\r\n\t d1 = n0 = new BigNumber(ONE);\r\n\r\n\t if ( md != null ) {\r\n\t ERRORS = false;\r\n\t n = new BigNumber(md);\r\n\t ERRORS = k;\r\n\r\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n\t if (ERRORS) {\r\n\t raise( 22,\r\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n\t }\r\n\r\n\t // ERRORS is false:\r\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n\t }\r\n\t }\r\n\r\n\t if ( !xc ) return x.toString();\r\n\t s = coeffToString(xc);\r\n\r\n\t // Determine initial denominator.\r\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n\t e = d.e = s.length - x.e - 1;\r\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n\t exp = MAX_EXP;\r\n\t MAX_EXP = 1 / 0;\r\n\t n = new BigNumber(s);\r\n\r\n\t // n0 = d1 = 0\r\n\t n0.c[0] = 0;\r\n\r\n\t for ( ; ; ) {\r\n\t q = div( n, d, 0, 1 );\r\n\t d2 = d0.plus( q.times(d1) );\r\n\t if ( d2.cmp(md) == 1 ) break;\r\n\t d0 = d1;\r\n\t d1 = d2;\r\n\t n1 = n0.plus( q.times( d2 = n1 ) );\r\n\t n0 = d2;\r\n\t d = n.minus( q.times( d2 = d ) );\r\n\t n = d2;\r\n\t }\r\n\r\n\t d2 = div( md.minus(d0), d1, 0, 1 );\r\n\t n0 = n0.plus( d2.times(n1) );\r\n\t d0 = d0.plus( d2.times(d1) );\r\n\t n0.s = n1.s = x.s;\r\n\t e *= 2;\r\n\r\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n\t ? [ n1.toString(), d1.toString() ]\r\n\t : [ n0.toString(), d0.toString() ];\r\n\r\n\t MAX_EXP = exp;\r\n\t return arr;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return the value of this BigNumber converted to a number primitive.\r\n\t */\r\n\t P.toNumber = function () {\r\n\t return +this;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n\t * If m is present, return the result modulo m.\r\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n\t * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n\t * ROUNDING_MODE.\r\n\t *\r\n\t * The modular power operation works efficiently when x, n, and m are positive integers,\r\n\t * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n\t *\r\n\t * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n\t * [m] {number|string|BigNumber} The modulus.\r\n\t *\r\n\t * 'pow() exponent not an integer: {n}'\r\n\t * 'pow() exponent out of range: {n}'\r\n\t *\r\n\t * Performs 54 loop iterations for n of 9007199254740991.\r\n\t */\r\n\t P.toPower = P.pow = function ( n, m ) {\r\n\t var k, y, z,\r\n\t i = mathfloor( n < 0 ? -n : +n ),\r\n\t x = this;\r\n\r\n\t if ( m != null ) {\r\n\t id = 23;\r\n\t m = new BigNumber(m);\r\n\t }\r\n\r\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\r\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n\t parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n\t k = Math.pow( +x, n );\r\n\t return new BigNumber( m ? k % m : k );\r\n\t }\r\n\r\n\t if (m) {\r\n\t if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n\t x = x.mod(m);\r\n\t } else {\r\n\t z = m;\r\n\r\n\t // Nullify m so only a single mod operation is performed at the end.\r\n\t m = null;\r\n\t }\r\n\t } else if (POW_PRECISION) {\r\n\r\n\t // Truncating each coefficient array to a length of k after each multiplication\r\n\t // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n\t // i.e. there will be a minimum of 28 guard digits retained.\r\n\t // (Using + 1.5 would give [9, 21] guard digits.)\r\n\t k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n\t }\r\n\r\n\t y = new BigNumber(ONE);\r\n\r\n\t for ( ; ; ) {\r\n\t if ( i % 2 ) {\r\n\t y = y.times(x);\r\n\t if ( !y.c ) break;\r\n\t if (k) {\r\n\t if ( y.c.length > k ) y.c.length = k;\r\n\t } else if (m) {\r\n\t y = y.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t i = mathfloor( i / 2 );\r\n\t if ( !i ) break;\r\n\t x = x.times(x);\r\n\t if (k) {\r\n\t if ( x.c && x.c.length > k ) x.c.length = k;\r\n\t } else if (m) {\r\n\t x = x.mod(m);\r\n\t }\r\n\t }\r\n\r\n\t if (m) return y;\r\n\t if ( n < 0 ) y = ONE.div(y);\r\n\r\n\t return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\r\n\t * exponential notation.\r\n\t *\r\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n\t *\r\n\t * 'toPrecision() precision not an integer: {sd}'\r\n\t * 'toPrecision() precision out of range: {sd}'\r\n\t * 'toPrecision() rounding mode not an integer: {rm}'\r\n\t * 'toPrecision() rounding mode out of range: {rm}'\r\n\t */\r\n\t P.toPrecision = function ( sd, rm ) {\r\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n\t ? sd | 0 : null, rm, 24 );\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n\t * TO_EXP_NEG, return exponential notation.\r\n\t *\r\n\t * [b] {number} Integer, 2 to 64 inclusive.\r\n\t *\r\n\t * 'toString() base not an integer: {b}'\r\n\t * 'toString() base out of range: {b}'\r\n\t */\r\n\t P.toString = function (b) {\r\n\t var str,\r\n\t n = this,\r\n\t s = n.s,\r\n\t e = n.e;\r\n\r\n\t // Infinity or NaN?\r\n\t if ( e === null ) {\r\n\r\n\t if (s) {\r\n\t str = 'Infinity';\r\n\t if ( s < 0 ) str = '-' + str;\r\n\t } else {\r\n\t str = 'NaN';\r\n\t }\r\n\t } else {\r\n\t str = coeffToString( n.c );\r\n\r\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\t } else {\r\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n\t }\r\n\r\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\r\n\t }\r\n\r\n\t return str;\r\n\t };\r\n\r\n\r\n\t /*\r\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n\t * number.\r\n\t */\r\n\t P.truncated = P.trunc = function () {\r\n\t return round( new BigNumber(this), this.e + 1, 1 );\r\n\t };\r\n\r\n\r\n\r\n\t /*\r\n\t * Return as toString, but do not accept a base argument, and include the minus sign for\r\n\t * negative zero.\r\n\t */\r\n\t P.valueOf = P.toJSON = function () {\r\n\t var str,\r\n\t n = this,\r\n\t e = n.e;\r\n\r\n\t if ( e === null ) return n.toString();\r\n\r\n\t str = coeffToString( n.c );\r\n\r\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n\t ? toExponential( str, e )\r\n\t : toFixedPoint( str, e );\r\n\r\n\t return n.s < 0 ? '-' + str : str;\r\n\t };\r\n\r\n\r\n\t // Aliases for BigDecimal methods.\r\n\t //P.add = P.plus; // P.add included above\r\n\t //P.subtract = P.minus; // P.sub included above\r\n\t //P.multiply = P.times; // P.mul included above\r\n\t //P.divide = P.div;\r\n\t //P.remainder = P.mod;\r\n\t //P.compareTo = P.cmp;\r\n\t //P.negate = P.neg;\r\n\r\n\r\n\t if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n\t return BigNumber;\r\n\t }", "title": "" }, { "docid": "7813ddbb25028990d5c1b624f398b533", "score": "0.47154078", "text": "function constructorFactory(configObj) {\r\n var div,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.shift() );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz.unshift(0);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.shift();\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc.unshift(a);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.shift();\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n // Aliases for BigDecimal methods.\r\n //P.add = P.plus; // P.add included above\r\n //P.subtract = P.minus; // P.sub included above\r\n //P.multiply = P.times; // P.mul included above\r\n //P.divide = P.div;\r\n //P.remainder = P.mod;\r\n //P.compareTo = P.cmp;\r\n //P.negate = P.neg;\r\n\r\n\r\n if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "7813ddbb25028990d5c1b624f398b533", "score": "0.47154078", "text": "function constructorFactory(configObj) {\r\n var div,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.shift() );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz.unshift(0);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.shift();\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc.unshift(a);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.shift();\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n // Aliases for BigDecimal methods.\r\n //P.add = P.plus; // P.add included above\r\n //P.subtract = P.minus; // P.sub included above\r\n //P.multiply = P.times; // P.mul included above\r\n //P.divide = P.div;\r\n //P.remainder = P.mod;\r\n //P.compareTo = P.cmp;\r\n //P.negate = P.neg;\r\n\r\n\r\n if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "ba45fb4a0629ad38eccffa8043297811", "score": "0.47154078", "text": "function constructorFactory(configObj) {\r\n var div,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 100, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n CRYPTO = !!( v && cryptoObj );\r\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', cryptoObj );\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if ( cryptoObj && cryptoObj.getRandomValues ) {\r\n\r\n a = cryptoObj.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = cryptoObj.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if ( cryptoObj && cryptoObj.randomBytes ) {\r\n\r\n // buffer\r\n a = cryptoObj.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n cryptoObj.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else if (ERRORS) {\r\n raise( 14, 'crypto unavailable', cryptoObj );\r\n }\r\n }\r\n\r\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\r\n if (!i) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.shift() );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz.unshift(0);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.shift();\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] %= BASE;\r\n }\r\n\r\n if (a) {\r\n xc.unshift(a);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.shift();\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\r\n * (Performs 54 loop iterations for n of 9007199254740992.)\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n */\r\n P.toPower = P.pow = function (n) {\r\n var k, y,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) ) {\r\n return new BigNumber( Math.pow( +x, n ) );\r\n }\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication equates\r\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\r\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\r\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if ( k && y.c.length > k ) y.c.length = k;\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n\r\n x = x.times(x);\r\n if ( k && x.c && x.c.length > k ) x.c.length = k;\r\n }\r\n\r\n if ( n < 0 ) y = ONE.div(y);\r\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n // Aliases for BigDecimal methods.\r\n //P.add = P.plus; // P.add included above\r\n //P.subtract = P.minus; // P.sub included above\r\n //P.multiply = P.times; // P.mul included above\r\n //P.divide = P.div;\r\n //P.remainder = P.mod;\r\n //P.compareTo = P.cmp;\r\n //P.negate = P.neg;\r\n\r\n\r\n if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "7813ddbb25028990d5c1b624f398b533", "score": "0.47154078", "text": "function constructorFactory(configObj) {\r\n var div,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.shift() );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz.unshift(0);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.shift();\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.shift(), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc.unshift(a);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.shift();\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n // Aliases for BigDecimal methods.\r\n //P.add = P.plus; // P.add included above\r\n //P.subtract = P.minus; // P.sub included above\r\n //P.multiply = P.times; // P.mul included above\r\n //P.divide = P.div;\r\n //P.remainder = P.mod;\r\n //P.compareTo = P.cmp;\r\n //P.negate = P.neg;\r\n\r\n\r\n if ( configObj != null ) BigNumber.config(configObj);\r\n\r\n return BigNumber;\r\n }", "title": "" }, { "docid": "5f9e0fb36f76261b4a22c62e8f2cc8a7", "score": "0.46866488", "text": "constructor() {\n\t\tthis.accountNo = 1001;\n\t\tthis.balance = 0; // balance should only be modified in the functions deposit and withdraw\n\t}", "title": "" } ]
2952ff4d631bfc61b9363e2a4c91b35a
Add placeholder If the input object is empty it ads a placeholder to describe what to insert. Changes passwords into text to be able to display the placeholder
[ { "docid": "25f1d3b86afcd0c6109eebb1ddc33b10", "score": "0.80930173", "text": "function addPlaceholder(inputObject)\r\n{\r\n\tif (inputObject.value=='') {\r\n\t\tinputObject.value=getPlaceholderText(inputObject);\r\n\t\tinputObject.style.color='gray';\r\n\t\t\r\n\t\tif ($(inputObject).hasClass(\"password_placeholder\")) {\r\n\t\t\tinputObject.type='text';\r\n\t\t}\r\n\t}\r\n}", "title": "" } ]
[ { "docid": "c9275bb3b13b9ead6e30c2b171a79648", "score": "0.7230693", "text": "function setPlaceholder(element,placeholder){\n\tif(element.value==''||element.value==placeholder){\n\t\telement.value=placeholder;\n\t\telement.style.color='gray';\n\t\tif(placeholder=='Password'){\n\t\t\telement.type='text';\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63ea303cba6f537a5e4305c425d8e1e1", "score": "0.70315605", "text": "function removePlaceholder(inputObject)\r\n{\r\n\tif ($(inputObject).hasClass(\"password_placeholder\")) {\r\n\t\tinputObject.type=\"password\";\r\n\t}\r\n\tif (inputObject.value==getPlaceholderText(inputObject)) {\r\n\t\tinputObject.value='';\r\n\t\tinputObject.style.color='black';\r\n\t}\r\n}", "title": "" }, { "docid": "6389ca27d334fe28774463582a6163f2", "score": "0.69417304", "text": "function insertPlaceholders() { \r\n\t\tif (!Modernizr.input.placeholder) {\r\n\t\t\tdocument.getElementById(\"nameinput\").value = \"first and last name\";\r\n\t\t\tdocument.getElementById(\"emailinput\").value = \"[email protected]\";\r\n\t\t\tdocument.getElementById(\"phoneinput\").value = \"###-###-####\"; \r\n\t\t}\r\n\t}", "title": "" }, { "docid": "c605a28b901430b12e956ecde8ce2bc3", "score": "0.684417", "text": "function AddPlaceholder($input) {\n\t\tvar placeholder = $input.atter('placeholder');\n\t\t\n\t\tif(placeholder != '') {\n\t\t\tvar value = $input.val();\n\t\t\tif(value == '') {\n\t\t\t\t$input.val(placeholder);\n\t\t\t\t$input.addClass('js-placeholder');\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "c840b3d09e027af50ffaa97e68188410", "score": "0.6731688", "text": "function setPlaceHolder(value, inputElement, placeholder) {\n if (value && value.length) {\n inputElement.placeholder = '';\n }\n else {\n inputElement.placeholder = placeholder;\n }\n}", "title": "" }, { "docid": "2c8ed7e3126e1e888235087309f5b101", "score": "0.6731004", "text": "function checkUserInput() {\n if (nameInput.value === \"\") {\n nameInput.placeholder = '*Your name required';\n }\n}", "title": "" }, { "docid": "dad7ecc739ac948c8911c944e9c1fa35", "score": "0.6694739", "text": "function removePlaceholder(element,placeholder){\n\tif(element.value==placeholder){\n\t\telement.value='';\n\t element.style.color='black';\n\t\tif(placeholder=='Password'){\n\t\t\telement.type='password';\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b600eff1b2597e76a0418edf6ef06ef", "score": "0.6685715", "text": "function placeHolder() {\n document.getElementById(\"boitedisc\").placeholder = \"\";\n}", "title": "" }, { "docid": "b10fb14b6c515749484c6801ff4fda1e", "score": "0.66675264", "text": "function placeHolder () {\n document.getElementById('chatbox').placeholder = ''\n}", "title": "" }, { "docid": "17941c69c06a552232057650a1f83115", "score": "0.66097546", "text": "function placeHolder() {\n document.getElementById(\"chatbox\").placeholder = \"\";\n}", "title": "" }, { "docid": "17941c69c06a552232057650a1f83115", "score": "0.66097546", "text": "function placeHolder() {\n document.getElementById(\"chatbox\").placeholder = \"\";\n}", "title": "" }, { "docid": "17941c69c06a552232057650a1f83115", "score": "0.66097546", "text": "function placeHolder() {\n document.getElementById(\"chatbox\").placeholder = \"\";\n}", "title": "" }, { "docid": "3550d4aca2f6b4c215fbcdb50bd16bec", "score": "0.6590645", "text": "function placeHolder() {\r\n document.getElementById(\"chatbox\").placeholder = \"\";\r\n}", "title": "" }, { "docid": "7d53fb969b61d92b3a091d436a84bc54", "score": "0.65480864", "text": "function checkPlaceholder() {\r\n\t\tvar messageBox = document.getElementById(\"customText\");\r\n\t\tif(messageBox.value === \"\") {\r\n\t\t\tmessageBox.style.color = \"rgb(178,184,183)\";\r\n\t\t\tmessageBox.value = messageBox.placeholder;\r\n\t\t}\r\n\t}", "title": "" }, { "docid": "74fddbc032162888571c3eb8af0d20c0", "score": "0.6518669", "text": "function buildPasswordInput(id, placeholder) {\n var input = document.createElement(\"input\");\n input.type = \"password\";\n input.id = id;\n input.placeholder = placeholder;\n return input;\n}", "title": "" }, { "docid": "e1b04aaf7e9b1673b78ddfeea5ceb27d", "score": "0.65138364", "text": "_applyPlaceholder(value, old) {\n this.getChildControl(\"textfield\").setPlaceholder(value);\n }", "title": "" }, { "docid": "400a122855245ece43ff49ebcb3d7deb", "score": "0.6504247", "text": "resetInputPlaceholder () {\n document.getElementById('title').placeholder = \"Please enter a title...\"; // Reset the title placeholder.\n document.getElementById('info').placeholder = \"Please enter some info...\"; // Reset the info placerholder.\n }", "title": "" }, { "docid": "e29b7e43d0f63fc9156c5a428d0126d5", "score": "0.6454243", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n if (password) {\n passwordText.value = password;\n }\n else {\n passwordText.value = '';\n }\n\n\n}", "title": "" }, { "docid": "dca0b00ba5ae8b1d5322496cfa94d5f9", "score": "0.6452069", "text": "function checkPlaceholder() {\n var messageBox = document.getElementById(\"fname\");\n if (messageBox.value === \"\") {\n messageBox.style.color = \"rgb(178,184,183)\";\n messageBox.value = messageBox.placeholder;\n }\n}", "title": "" }, { "docid": "29fae9504489e82545f6a6b66ecdaa6d", "score": "0.64354146", "text": "function UserInput(pw) {\n document.getElementById(\"password\").textContent = pw;\n\n }", "title": "" }, { "docid": "26bc058313a1bc70963ac5b3f127af71", "score": "0.6413797", "text": "function placeHolder(value) { return new HtmlAttr(\"placeholder\", [\"input\", \"textarea\"], value); }", "title": "" }, { "docid": "2d2e0c85c3cbab37b3fd9e05001e34c3", "score": "0.64134294", "text": "function checkPlaceholder() {\n var addressBox = document.getElementById(\"addrinput\");\n addressBox.style.color = \"black\";\n if (addressBox.value === \"\") {\n addressBox.style.color = \"rgb(178,184,183)\";\n addressBox.value = addressBox.placeholder;\n }\n}", "title": "" }, { "docid": "6c96b3c0735abef95dc78d91595a9e99", "score": "0.64074904", "text": "function checkPlaceholder() {\r\n\tvar messageBox = document.getElementById(\"customText\");\r\n\t\r\n\tif (messageBox.value === \"\") {\r\n\t\tmessageBox.style.color = \"rgb(178,184,183)\";\r\n\t\tmessageBox.value = messageBox.placeholder;\r\n\t}\r\n}", "title": "" }, { "docid": "cc3d25eaa7ffda82ab0e987f22f8fc38", "score": "0.63971967", "text": "_updateAttributedPlaceholder() {\n let stringValue = this.hint;\n if (stringValue === null || stringValue === void 0) {\n stringValue = '';\n }\n else {\n stringValue = stringValue + '';\n }\n if (stringValue === '') {\n // we do not use empty string since initWithStringAttributes does not return proper value and\n // nativeView.attributedPlaceholder will be null\n stringValue = ' ';\n }\n const attributes = {};\n if (this.textFieldHintColor) {\n attributes[NSForegroundColorAttributeName] = this.textFieldHintColor.ios;\n }\n const attributedPlaceholder = NSAttributedString.alloc().initWithStringAttributes(stringValue, attributes);\n this._textField.attributedPlaceholder = attributedPlaceholder;\n }", "title": "" }, { "docid": "c918515de021b413ad1ea401f1df499d", "score": "0.6356186", "text": "function placeHolder() {\r\ndocument.getElementById(\"qurybox\").placeholder = \"\";\r\n}", "title": "" }, { "docid": "683170144de1dfb4a771e4d13d96e6b2", "score": "0.63559693", "text": "function UserInput(password) {\n document.getElementById(\"password\").textContent = password;\n}", "title": "" }, { "docid": "6ed0f0400236632645fd5a6302eb288f", "score": "0.63278884", "text": "set placeholder(placeholder) {\n this._palette.inputNode.placeholder = placeholder;\n }", "title": "" }, { "docid": "cea49e52d04bc4b37b5e3e33b1ecb6f8", "score": "0.63097465", "text": "function showPlaceholder(elem) {\n var type,\n val = elem.getAttribute(ATTR_CURRENT_VAL);\n if (elem.value === \"\" && val) {\n elem.setAttribute(ATTR_ACTIVE, \"true\");\n elem.value = val;\n elem.className += \" \" + placeholderClassName;\n\n // If the type of element needs to change, change it (e.g. password inputs)\n type = elem.getAttribute(ATTR_INPUT_TYPE);\n if (type) {\n elem.type = \"text\";\n } else if (elem.type === \"password\") {\n if (Utils.changeType(elem, \"text\")) {\n elem.setAttribute(ATTR_INPUT_TYPE, \"password\");\n }\n }\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "ff8ebb07fefb1b3588e0652dc9b09899", "score": "0.6280551", "text": "function setDefaultText(){\r\n\ttry{\r\n\t\t$('input, textarea')\r\n\t\t.each(function(){\r\n\t\t\tvar thisInputObj = $(this);\r\n\t\t\tif(thisInputObj.attr('title') != thisInputObj.attr('placeholder') || !thisInputObj.attr('placeholder')) thisInputObj.attr('placeholder',thisInputObj.attr('title'));\r\n\t\t})\r\n\t\t// $('input, textarea').placeholder();\r\n\t} catch (e) {\r\n\t\tsetTimeout(function(){\r\n\t\t\t$(\"input[type='text'][title!=''], textarea[title!=''], input[type='password'][title!=''][password='password']\")\r\n\t\t\t.each(function(){\r\n\t\t\t\tvar thisInputObj = $(this);\r\n\t\t\t\t$(this.form).submit(function(){\r\n\t\t\t\t\tif(thisInputObj.val() == thisInputObj.attr('title')) thisInputObj.val('');\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t\t.bind('focusin focusout keydown',function(event){\r\n\t\t\t\tif(event.type=='focusout')\r\n\t\t\t\t{\r\n\t\t\t\t\tif($(this).val() == '')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( $(this).attr('password') == 'password' && $(this).attr('title')) {\r\n\t\t\t\t\t\t\tif(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {\r\n\t\t\t\t\t\t\t\tif( $(this).attr(\"id\")){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById($(this).attr(\"id\")).type = \"text\";\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\tdocument.getElementsByName($(this).attr(\"name\")).type = \"text\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$(this).val($(this).attr('title')).addClass('input-box-default-text');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).val($(this).attr('title')).addClass('input-box-default-text');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(event.type=='focusin' || event.type=='keydown')\r\n\t\t\t\t{\r\n\t\t\t\t\tif($(this).val() == $(this).attr('title') ){\r\n\t\t\t\t\t\tif ( $(this).attr('password') == 'password' && $(this).attr('title')) {\r\n\t\t\t\t\t\t\tif(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {\r\n\t\t\t\t\t\t\t\tif( $(this).attr(\"id\")){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById($(this).attr(\"id\")).type = \"password\";\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\tdocument.getElementsByName($(this).attr(\"name\")).type = \"password\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$(this).val('');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).val('');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$(this).removeClass('input-box-default-text');\r\n\t\t\t\t}\r\n\t\t\t}).focusout();\r\n\t\t},300);\r\n\r\n\t\tsetTimeout(function(){\r\n\t\t\t$(\"input[type='password'][title][password!='password']\")\r\n\t\t\t.each(function(){\r\n\t\t\t\tvar thisInputObj = $(this);\r\n\t\t\t\tif(!thisInputObj.attr('uniqCloneId')){\r\n\t\t\t\t\tvar uniqCloneId = uniqid();\r\n\t\t\t\t\tvar thisCloneObj = $(\"<input type='text' />\");\r\n\t\t\t\t\tthisCloneObj\r\n\t\t\t\t\t.attr('style',$(this).attr('style'))\r\n\t\t\t\t\t.attr('size',$(this).attr('size'))\r\n\t\t\t\t\t.attr('class',$(this).attr('class'))\r\n\t\t\t\t\t.addClass('input-box-default-text');\r\n\t\t\t\t\t//var thisCloneObj = $(this).clone().attr({'type':'text','name':'','id':uniqCloneId});\r\n\t\t\t\t\tif($(this).attr('tabIndex')) thisCloneObj.attr('tabIndex',$(this).attr('tabIndex'));\r\n\t\t\t\t\t$(this).attr('uniqCloneId',uniqCloneId);\r\n\t\t\t\t\t$(thisCloneObj).attr({'value':$(this).attr('title'),'title':''});\r\n\r\n\t\t\t\t\tthisCloneObj.bind('focus',function(){\r\n\t\t\t\t\t\tthisInputObj.show().focus();\r\n\t\t\t\t\t\t$(this).hide();\r\n\t\t\t\t\t});\r\n\t\t\t\t\t$(this).hide().after(thisCloneObj);\r\n\r\n\t\t\t\t\t$(this).bind('focusout',function(event){\r\n\t\t\t\t\t\tif($(this).val() == '')\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$(this).hide();\r\n\t\t\t\t\t\t\tthisCloneObj.show();\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).show();\r\n\t\t\t\t\t\t\tthisCloneObj.hide();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}).focusout();\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t},300);\r\n\t}\r\n}", "title": "" }, { "docid": "1f36550ef5eff1dc4c5141986181613b", "score": "0.6280304", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n if (password == null) {\n password = \"\";\n } else {\n passwordText.value = password;\n }\n}", "title": "" }, { "docid": "3d3f0a18add965184b3a990894c6db78", "score": "0.62623954", "text": "function generatePlaceholder() {\n if (!Modernizr.input.placeholder) {\n var addressBox = document.getElementById(\"addrinput\");\n addressBox.value = addressBox.placeholder;\n addressBox.style.color = \"rgb(178,184,183)\";\n if (addressBox.addEventListener) {\n addressBox.addEventListener(\"focus\", zeroPlaceholder, false);\n addressBox.addEventListener(\"blur\", checkPlaceholder, false);\n } else if (addressBox.attachEvent) {\n addressBox.attachEvent(\"onfocus\", zeroPlaceholder);\n addressBox.attachEvent(\"onblur\", checkPlaceholder);\n }\n }\n}", "title": "" }, { "docid": "8a91ad034e90b3c56cafc5c9c5c9389e", "score": "0.6261479", "text": "function writePassword() {\n var password = generatePassword();\n //not sure why this popped up in field but clears it\n password = password.replace('[object HTMLTextAreaElement]', '');\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "title": "" }, { "docid": "caab0032f2b54145613ef5cc196541e1", "score": "0.62446475", "text": "function writePassword() {\n var password = generatePassword();\n\n if (password !== undefined) {\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n }\n\n}", "title": "" }, { "docid": "062d100608bac2e57036cbc53bf8eac9", "score": "0.6240561", "text": "function zeroPlaceholder() {\n var messageBox = document.getElementById(\"fname\");\n messageBox.style.color = \"black\";\n if (messageBox.value === messageBox.placeholder) {\n messageBox.value = \"\";\n }\n}", "title": "" }, { "docid": "8f7471ea885167dff4efe0b8dfe44eab", "score": "0.6236583", "text": "function writePassword() {\n let password = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n\n if(password !== undefined) {\n passwordText.value = password;\n }\n}", "title": "" }, { "docid": "db4f294a6df59f0326b5c684d4e2f989", "score": "0.6234228", "text": "function addDefaultText(inputname, text) {\n $(inputname).focusin(function() {\n $(this).attr(\"placeholder\", \"\");\n });\n $(inputname).focusout(function() {\n $(this).attr(\"placeholder\", text);\n }).focusout();\n}", "title": "" }, { "docid": "f459bfae95e5cec3f02fa9e0da0dc6a3", "score": "0.623004", "text": "function initInputs() {\r\n PlaceholderInput.replaceByOptions({\r\n // filter options\r\n clearInputs: true,\r\n clearTextareas: true,\r\n clearPasswords: true,\r\n skipClass:'default',\r\n \r\n // input options\r\n wrapWithElement:false,\r\n showUntilTyping:false,\r\n getParentByClass:false,\r\n placeholderAttr: 'value'\r\n });\r\n}", "title": "" }, { "docid": "6e7f0437a2b1c0b2fe09ba8b96efb7e0", "score": "0.6226238", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n if(password == null){\n return\n }\n passwordText.value = password;\n}", "title": "" }, { "docid": "846b98ebb73ac02e235e7c1aa73c86cd", "score": "0.622392", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n if (password.length === 0)\n alert(\"Invalid input\");\n else \n passwordText.value = password;\n}", "title": "" }, { "docid": "1ee68be6241c8b5358ce7ebdba36458d", "score": "0.6221218", "text": "function writePassword() {\n var passwordText = document.querySelector(\"#password\");\n var password = generatePassword();\n\n // checks if password is not undefined\n if(password != undefined){\n // displays the users password onto the html id #password\n passwordText.value = password;\n }\n\n}", "title": "" }, { "docid": "b36f0d64fd1ce0bf5dfd389751a626e0", "score": "0.6218668", "text": "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;}", "title": "" }, { "docid": "6c1cd8b1601700a2c6bae20878837b0b", "score": "0.62184894", "text": "function userInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "title": "" }, { "docid": "2e271edc840241a4f63a86dadf5bafb7", "score": "0.62112314", "text": "function writePlaceHolder() {\n wordPlaceHolder.innerHTML = placeholderChars.join(\"\");\n }", "title": "" }, { "docid": "4095f8d7e33743b3a008893e02d8c319", "score": "0.6211185", "text": "function addPlacehoder(object) {\n if (regexIe8.test(userAgent)) {\n $(object).find(\"input[type=text],input[type=password]\").each(function () {\n if ($(this).val() === \"\") {\n $($(\"<div>\", { \"class\": \"placeholder\", text: $(this).attr(\"placeholder\") })).insertAfter(this).show();\n }\n else {\n $($(\"<div>\", { \"class\": \"placeholder\", text: $(this).attr(\"placeholder\") })).insertAfter(this).hide();\n }\n });\n }\n}", "title": "" }, { "docid": "e5dd0c9c8071c47e9ff54c279a63dab0", "score": "0.620976", "text": "function pwclearfield(element) {\n if (element.value == element.defaultValue) {\n element.value = \"\";\n element.type = \"password\";\n }\n}", "title": "" }, { "docid": "f5f92c6a07d9461d760321fe772cadb4", "score": "0.6206436", "text": "function generatePlaceholder() {\r\n\t if (!Modernizr.input.placeholder) {\r\n\t\t var messageBox = document.getElementById(\"customText\");\r\n\t\t messageBox.value = messageBox.placeholder;\r\n\t\t messageBox.style.color = \"rgb(178,184,183)\";\r\n\t\t if (messageBox.addEventListener) {\r\n\t\t\t messageBox.addEventListener(\"focus\", zeroPlaceholder, false); \r\n\t\t\t messageBox.addEventListener(\"blur\", checkPlaceholder, false); \r\n\t\t } else if (messageBox.attachEvent) {\r\n\t\t\t messageBox.attachEvent(\"onfocus\", zeroPlaceholder);\r\n\t\t\t messageBox.attachEvent(\"onblur\", checkPlaceholder); \r\n\t\t }\r\n\t }\r\n\t}", "title": "" }, { "docid": "3f8dacc5141e5ccb9a159f2adc406b25", "score": "0.620476", "text": "function UserInput(pass) {\n document.getElementById(\"password\").textContent = pass;\n\n}", "title": "" }, { "docid": "d44ba56d089fbececb2ce09855230a44", "score": "0.62031054", "text": "function zeroPlaceholder() {\r\n\tvar messageBox = document.getElementById(\"customText\");\r\n\tmessageBox.style.color = \"black\";\r\n\t\r\n\tif (messageBox.value === messageBox.placeholder) {\r\n\t\tmessageBox.value = \"\";\r\n\t}\r\n}", "title": "" }, { "docid": "c7aa2151db4538cbfc1b9d9904006723", "score": "0.62025726", "text": "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "title": "" }, { "docid": "782118265592c643e94f29668c04d739", "score": "0.6200046", "text": "function zeroPlaceholder() {\r\n\t var messageBox = document.getElementById(\"customText\");\r\n\t messageBox.style.color = \"black\";\r\n\t if (messageBox.value === messageBox.placeholder) {\r\n\t\t messageBox.value = \"\";\r\n\t }\r\n\t}", "title": "" }, { "docid": "25a8dde215109136fb37df9b3665c662", "score": "0.61887866", "text": "function generatePlaceholder() {\r\n\tif (!Modernizr.input.placeholder) {\r\n\t\tvar messageBox = document.getElementById(\"customText\");\r\n\t\tmessageBox.value = messageBox.placeholder;\r\n\t\tmessageBox.style.color = \"rgb(178,184,183)\";\r\n\t\t\r\n\t\tif (messageBox.addEventListener) {\r\n\t\t\tmessageBox.addEventListener(\"focus\", zeroPlaceholder, false);\r\n\t\t\tmessageBox.addEventListener(\"blur\", checkPlaceholder, false);\r\n\t\t} else if (messageBox.attachEvent) {\r\n\t\t\tmessageBox.attachEvent(\"onfocus\", zeroPlaceholder);\r\n\t\t\tmessageBox.attachEvent(\"onblur\", checkPlaceholder);\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "2a3032067d615eb6523da2f81b32c9a3", "score": "0.6187688", "text": "function areaSetDefaultText(obj){\r\n\ttry{\r\n\t\t$(obj).find('input, textarea')\r\n\t\t.each(function(){\r\n\t\t\tvar thisInputObj = $(this);\r\n\t\t\tif(thisInputObj.attr('title') != thisInputObj.attr('placeholder') || !thisInputObj.attr('placeholder')) thisInputObj.attr('placeholder',thisInputObj.attr('title'));\r\n\t\t})\r\n\t\t// $('input, textarea').placeholder();\r\n\t} catch (e) {\r\n\t\tsetTimeout(function(){\r\n\t\t\t$(obj).find(\"input[type='text'][title!=''], textarea[title!=''], input[type='password'][title!=''][password='password']\")\r\n\t\t\t.each(function(){\r\n\t\t\t\tvar thisInputObj = $(this);\r\n\t\t\t\t$(this.form).submit(function(){\r\n\t\t\t\t\tif(thisInputObj.val() == thisInputObj.attr('title')) thisInputObj.val('');\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t\t.bind('focusin focusout keydown',function(event){\r\n\t\t\t\tif(event.type=='focusout')\r\n\t\t\t\t{\r\n\t\t\t\t\tif($(this).val() == '')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( $(this).attr('password') == 'password' && $(this).attr('title')) {\r\n\t\t\t\t\t\t\tif(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {\r\n\t\t\t\t\t\t\t\tif( $(this).attr(\"id\")){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById($(this).attr(\"id\")).type = \"text\";\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\tdocument.getElementsByName($(this).attr(\"name\")).type = \"text\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$(this).val($(this).attr('title')).addClass('input-box-default-text');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).val($(this).attr('title')).addClass('input-box-default-text');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(event.type=='focusin' || event.type=='keydown')\r\n\t\t\t\t{\r\n\t\t\t\t\tif($(this).val() == $(this).attr('title') ){\r\n\t\t\t\t\t\tif ( $(this).attr('password') == 'password' && $(this).attr('title')) {\r\n\t\t\t\t\t\t\tif(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {\r\n\t\t\t\t\t\t\t\tif( $(this).attr(\"id\")){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById($(this).attr(\"id\")).type = \"password\";\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\tdocument.getElementsByName($(this).attr(\"name\")).type = \"password\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$(this).val('');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).val('');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$(this).removeClass('input-box-default-text');\r\n\t\t\t\t}\r\n\t\t\t}).focusout();\r\n\t\t},300);\r\n\r\n\t\tsetTimeout(function(){\r\n\t\t\t$(obj).find(\"input[type='password'][title][password!='password']\")\r\n\t\t\t.each(function(){\r\n\t\t\t\tvar thisInputObj = $(this);\r\n\t\t\t\tif(!thisInputObj.attr('uniqCloneId')){\r\n\t\t\t\t\tvar uniqCloneId = uniqid();\r\n\t\t\t\t\tvar thisCloneObj = $(\"<input type='text' />\");\r\n\t\t\t\t\tthisCloneObj\r\n\t\t\t\t\t.attr('style',$(this).attr('style'))\r\n\t\t\t\t\t.attr('size',$(this).attr('size'))\r\n\t\t\t\t\t.attr('class',$(this).attr('class'))\r\n\t\t\t\t\t.addClass('input-box-default-text');\r\n\t\t\t\t\t//var thisCloneObj = $(this).clone().attr({'type':'text','name':'','id':uniqCloneId});\r\n\t\t\t\t\tif($(this).attr('tabIndex')) thisCloneObj.attr('tabIndex',$(this).attr('tabIndex'));\r\n\t\t\t\t\t$(this).attr('uniqCloneId',uniqCloneId);\r\n\t\t\t\t\t$(thisCloneObj).attr({'value':$(this).attr('title'),'title':''});\r\n\r\n\t\t\t\t\tthisCloneObj.bind('focus',function(){\r\n\t\t\t\t\t\tthisInputObj.show().focus();\r\n\t\t\t\t\t\t$(this).hide();\r\n\t\t\t\t\t});\r\n\t\t\t\t\t$(this).hide().after(thisCloneObj);\r\n\r\n\t\t\t\t\t$(this).bind('focusout',function(event){\r\n\t\t\t\t\t\tif($(this).val() == '')\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$(this).hide();\r\n\t\t\t\t\t\t\tthisCloneObj.show();\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$(this).show();\r\n\t\t\t\t\t\t\tthisCloneObj.hide();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}).focusout();\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t},300);\r\n\t}\r\n}", "title": "" }, { "docid": "ad19e51854604665434a5f97be9a04d4", "score": "0.61842793", "text": "function writePassword() {\n var password = generatePassword();\n if (password !=\"\")\n {\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n }\n}", "title": "" }, { "docid": "bd6014a9c522fd4208ead2f201982040", "score": "0.6179491", "text": "function notePassword() {\n let password = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "cc9320f4507f770824c2951fb63ceafe", "score": "0.6162449", "text": "function createPassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n }", "title": "" }, { "docid": "78b37540a5d35bbffd0a09b92e2a7aac", "score": "0.61478865", "text": "function placeholderInit(){\n\t$('[placeholder]').placeholder();\n}", "title": "" }, { "docid": "ee4c2cbe284b4716aea2b5d7815f8af8", "score": "0.6126417", "text": "function resetTxtCommandPlaceHolder() {\n txtCommand.placeholder=\"Type a command or \\\"Help\\\" then press [Enter].\";\n }", "title": "" }, { "docid": "cb5ff27eb1a1741b600a7b89c1d887d1", "score": "0.61239475", "text": "function UserInput(finalGenPass) {\n document.getElementById(\"password\").textContent=finalGenPass;\n}", "title": "" }, { "docid": "07c482465469fa1f92b977fc9ca445c5", "score": "0.61191314", "text": "function writePassword() {\n if(!upperCase && !lowerCase && !specialChar && !numbers) return alert('you must check at least one of the boxes')\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "507d6b1d4371590987c3179517da5e0d", "score": "0.61169416", "text": "function showPassword() {\n inputPassword.attr('type', 'text');\n }", "title": "" }, { "docid": "36edf58e7bf9085b4fcd562237b14aed", "score": "0.6114322", "text": "function writePassword() {\n var password = generatePassword();\n if (password === undefined){\n password = \"\"\n }\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "title": "" }, { "docid": "526ac10da9694c5ab07314f1603852e8", "score": "0.6109027", "text": "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "title": "" }, { "docid": "3820202f3ee85ebab72156bf637ac8c7", "score": "0.610738", "text": "function textareaApplyPlaceHolder() {\n\tif (!elementSupportsAttribute('textarea', 'placeholder')) {\n\t// Fallback for browsers that don't support HTML5 placeholder attribute\n\t$('#code')\n\t\t.data('Type your instruction here...', $('#code').text())\n\t\t.css('color', '#999')\n\t\t.focus(function() {\n\t\t\tvar $el = $(this);\n\t\t\tif (this.value == $el.data('Type your instruction here...')) {\n\t\t\t\tthis.value = '';\n\t\t\t}\n\t\t})\n\t\t.blur(function() {\n\t\t\tif (this.value == '') {\n\t\t\t\tthis.value = $(this).data('Type your instruction here...');\n\t\t\t}\n\t\t});\n\t}\n\telse {\n\t\t// Browser does support HTML5 placeholder attribute, so use it.\n\t\t$('#code').attr('placeholder', 'Type your instruction here...');\n\t}\n}", "title": "" }, { "docid": "bf8649824260b90041422b45f995b2bf", "score": "0.6105457", "text": "function placeholder(){\n\t$('input[placeholder], textarea[placeholder]').placeholder();\n}", "title": "" }, { "docid": "bf8649824260b90041422b45f995b2bf", "score": "0.6105457", "text": "function placeholder(){\n\t$('input[placeholder], textarea[placeholder]').placeholder();\n}", "title": "" }, { "docid": "13a357936f7013e97fa44af5219fcadd", "score": "0.61015284", "text": "function placeholderInit() {\n\t$('[placeholder]').placeholder();\n}", "title": "" }, { "docid": "e929d05d62d15c8361f1c720d901de28", "score": "0.60914487", "text": "function placeholderInit() {\n $('[placeholder]').placeholder();\n}", "title": "" }, { "docid": "57b417ab27d470418263672415b53611", "score": "0.6089276", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = '';\n passwordText.value = password;\n}", "title": "" }, { "docid": "8e589441e75ee2bf9ebe1f5b48e55af4", "score": "0.6080729", "text": "function createPassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "title": "" }, { "docid": "4edd0c1ae2db53cc5da28cff6106a14e", "score": "0.6079092", "text": "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n\n}", "title": "" }, { "docid": "4edd0c1ae2db53cc5da28cff6106a14e", "score": "0.6079092", "text": "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n\n}", "title": "" }, { "docid": "dd49dc19e43f08b9037a1d275e1f1df0", "score": "0.6069629", "text": "function showPlaceholder(elem) {\n var type,\n maxLength,\n val = elem.getAttribute(ATTR_CURRENT_VAL);\n if (elem.value === \"\" && val) {\n elem.setAttribute(ATTR_ACTIVE, \"true\");\n elem.value = val;\n elem.className += \" \" + placeholderClassName;\n\n // Store and remove the maxlength value\n maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n if (!maxLength) {\n elem.setAttribute(ATTR_MAXLENGTH, elem.maxLength);\n elem.removeAttribute(\"maxLength\");\n }\n\n // If the type of element needs to change, change it (e.g. password inputs)\n type = elem.getAttribute(ATTR_INPUT_TYPE);\n if (type) {\n elem.type = \"text\";\n } else if (elem.type === \"password\") {\n if (Utils.changeType(elem, \"text\")) {\n elem.setAttribute(ATTR_INPUT_TYPE, \"password\");\n }\n }\n return true;\n }\n return false;\n }", "title": "" }, { "docid": "de2a9de4bd269dc1d48a0728c5bf1ef5", "score": "0.60667473", "text": "function setInputValue (input) {\n input.value = input.placeholder;\n dom.addClass(input, 'placeholder');\n}", "title": "" }, { "docid": "d412ac3654a391aa1f7424c4f9905eea", "score": "0.6059439", "text": "function textInput(x, y, placeholder) {\n return game.add.inputField(x, y, {\n font: '18px Arial',\n fill: '#212121',\n fontWeight: 'bold',\n width: 200,\n height: 10,\n padding: 5,\n borderWidth: 1,\n borderColor: '#000',\n borderRadius: 6,\n placeHolder: placeholder\n });\n}", "title": "" }, { "docid": "fa33c07d200208eb677de3e2747bec3c", "score": "0.60493904", "text": "function writePassword() {\n var password = generatePassword();\n if (password) {\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n }\n}", "title": "" }, { "docid": "786323e1041425b87e44ab635f01e281", "score": "0.60489887", "text": "function writePassword(word) {\n\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = word; //word is placeholder for the value of password text (so that something shows up)\n}", "title": "" }, { "docid": "016d402c0f8c4ce5e5c11ad1b0c07aa9", "score": "0.60428596", "text": "function generatePlaceholder() {\n if (!Modernizr.input.placeholder) {\n var messageBox = document.getElementById(\"fname\");\n messageBox.value = messageBox.placeholder;\n messageBox.style.color = \"rgb(178,184,183)\";\n if (messageBox.addEventListener) {\n messageBox.addEventListener(\"focus\", zeroPlaceholder, false); \n messageBox.addEventListener(\"blur\", checkPlaceholder, false); \n } else if (messageBox.attachEvent) {\n messageBox.attachEvent(\"onfocus\", zeroPlaceholder);\n messageBox.attachEvent(\"onblur\", checkPlaceholder); \n }\n } // END IF NOT MODERNIZR\n}", "title": "" }, { "docid": "46e13f354246998ffbd726f68cc4cfc7", "score": "0.6036518", "text": "function set_placeholder(){\n if (o.placeholder && !tag_list.length && !$('.deleted, .placeholder, input', ed).length)\n ed.append('<li class=\"placeholder\"><div>'+o.placeholder+'</div></li>');\n }", "title": "" }, { "docid": "27189fe051b706c8bf85343d147e84de", "score": "0.6032775", "text": "initPlaceholders(){\n this.jQueryElement.find('input').toArray().forEach((element)=>{\n if($(element).attr('type') !== 'checkbox' && $(element).attr('type') !== 'button' && $(element).attr('type') !== 'submit'){\n $(element).addPlaceholder('Enter '+$(element).attr('name')+'...');\n }\n });\n }", "title": "" }, { "docid": "2aabd628baf936d91b74d0483c9f1533", "score": "0.6022814", "text": "function displayPassword() {\n\n let newPassword = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n\n passwordText.value = newPassword;\n}", "title": "" }, { "docid": "e862ca1e90ab4180074a6cb944db6dd0", "score": "0.60168546", "text": "function UserInput(pw) {\n document.getElementById(\"password\").textContent = pw;\n console.log(pw);\n}", "title": "" }, { "docid": "80e6ba949a7553be32f426d0f4ed59c2", "score": "0.6014111", "text": "function writePassword() {\n //var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = pwordInfo.password;\n\n}", "title": "" }, { "docid": "dae18a292c6f426e35471912ea308f33", "score": "0.6006264", "text": "function showPlaceholder(elem) {\n\n var val = elem.getAttribute(ATTR_CURRENT_VAL);\n\n if (elem.value === '' && val) {\n\n elem.setAttribute(ATTR_ACTIVE, 'true');\n elem.value = val;\n elem.className += ' ' + placeholderClassName;\n\n // Store and remove the maxlength value.\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n if (!maxLength) {\n elem.setAttribute(ATTR_MAXLENGTH, elem.maxLength);\n elem.removeAttribute('maxLength');\n }\n\n // If the type of element needs to change, change it (e.g. password\n // inputs).\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n if (type) {\n elem.type = 'text';\n } else if (elem.type === 'password' && changeType(elem, 'text')) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n }\n\n return true;\n }\n\n return false;\n }", "title": "" }, { "docid": "dc0334fac9249d34593602ef878b0059", "score": "0.6002634", "text": "function writePassword() {\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "899a8fb28c44337f2e5fc346cafd2a02", "score": "0.59989953", "text": "function writePassword() {\n var password = createPassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "fa63a582a8ca65a43646cf9ffee61489", "score": "0.5996635", "text": "function writePassword() {\n var password = buildPassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "31c615f93acb58b345e62d4d304acdb0", "score": "0.59947574", "text": "function showPlaceholder( elem ) {\n\n var val = elem.getAttribute(ATTR_CURRENT_VAL);\n\n if ( elem.value === '' && val ) {\n\n elem.setAttribute(ATTR_ACTIVE, 'true');\n elem.value = val;\n elem.className += ' ' + placeholderClassName;\n\n // Store and remove the maxlength value.\n var maxLength = elem.getAttribute(ATTR_MAXLENGTH);\n if ( !maxLength ) {\n elem.setAttribute(ATTR_MAXLENGTH, elem.maxLength);\n elem.removeAttribute('maxLength');\n }\n\n // If the type of element needs to change, change it (e.g. password\n // inputs).\n var type = elem.getAttribute(ATTR_INPUT_TYPE);\n if ( type ) {\n elem.type = 'text';\n } else if ( elem.type === 'password' && changeType(elem, 'text') ) {\n elem.setAttribute(ATTR_INPUT_TYPE, 'password');\n }\n\n return true;\n }\n\n return false;\n }", "title": "" }, { "docid": "acdc074772452162920fbd2e305eaec0", "score": "0.5993898", "text": "function placeholderMod() {\n\tvar UA = window.navigator.userAgent;\n\tvar brIE = /MSIE *\\d+\\.\\w+/i;\t/*IE browser*/\n\tvar brSafari = /Version\\/\\w+\\.\\w+/i;\t/*Safari browser*/\n\t/*Keeps out IE*/\n\tvar brResult = UA.match(brIE);\n\tif (! brResult){\n\t\tvar inp = ':text, :password, textarea';\n\t\t/*Keeps out Safari*/\n\t\tbrResult = UA.match(brSafari);\n\t\tif (! brResult){\n\t\t\t$(inp).on('click, focus', function(){\n\t\t\t\tvar self = $(this);\n\t\t\t\tvar plac = self.attr('placeholder');\n\t\t\t\t\tself.removeAttr('placeholder');\n\t\t\t\t\tself.on('blur', function(){\n\t\t\t\t\t\t$(this).attr('placeholder', plac);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t} else{\n\t\t\t/*fix alignment placeholder safari*/\n\t\t\t$(inp).focus(function() {\n\t\t\t\tvar input = $(this);\n\t\t\t\tif (input.val() == input.attr('placeholder')) {\n\t\t\t\t\tif (this.originalType) {\n\t\t\t\t\t\tthis.type = this.originalType;\n\t\t\t\t\t\tdelete this.originalType;\n\t\t\t\t\t}\n\t\t\t\t\tinput.val('');\n\t\t\t\t\tinput.removeClass('placeholder');\n\t\t\t\t}\n\t\t\t}).blur(function() {\n\t\t\t\tvar input = $(this);\n\t\t\t\tif (input.val() == '') {\n\t\t\t\t\tif (this.type == 'password') {\n\t\t\t\t\t\tthis.originalType = this.type;\n\t\t\t\t\t\tthis.type = 'text';\n\t\t\t\t\t}\n\t\t\t\t\tinput.addClass('placeholder');\n\t\t\t\tinput.val(input.attr('placeholder'));\n\t\t\t\t}\n\t\t\t}).blur();\n\t\t\t/*fix alignment placeholder safari end*/\n\t\t}\n\t}\n}", "title": "" }, { "docid": "18b7002f39062c859afe016dce9f158e", "score": "0.5987297", "text": "function writePassword() {\n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n \n passwordText.value = password;\n \n \n }", "title": "" }, { "docid": "dde748517eee45da278edce744186ebd", "score": "0.59790397", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n\n passwordText.value = password;\n\n}", "title": "" }, { "docid": "8dd545b55ea708ba2fae9ac7e5ee4661", "score": "0.5976118", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n //if user entered an invalid length, or failed to select at least one type of character, prompt them again.\n passwordText.value = password;\n if (password===null){\n writePassword();\n }\n\n}", "title": "" }, { "docid": "38f58474525f2efe2dbdfdda2314013b", "score": "0.5970708", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n\n passwordText.value = password;\n \n\n}", "title": "" }, { "docid": "140af072d38ad8ca0f8e81e239820c39", "score": "0.5970507", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n \n \n passwordText.value = password;\n}", "title": "" }, { "docid": "040d6f970ae5a480f8cd34dec3f3d752", "score": "0.5969406", "text": "function insertPlaceholder() {\n\n $('#js-search-term').focusin(function(event) {\n $(this).attr('placeholder', 'Example: \"Denver\"');\n });\n $('#js-search-term').focusout(function(event) {\n $(this).attr('placeholder', '');\n });\n\n $('#js-state').focusin(function(event) {\n $(this).attr('placeholder', 'Example: \"CO\"');\n });\n $('#js-state').focusout(function(event) {\n $(this).attr('placeholder', '');\n });\n}", "title": "" }, { "docid": "18bb9312a844dd359eee385c9ca570c6", "score": "0.5965447", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n\n}", "title": "" }, { "docid": "18bb9312a844dd359eee385c9ca570c6", "score": "0.5965447", "text": "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n\n}", "title": "" }, { "docid": "5a6c69d27d12e8b2a3be4e897eade27a", "score": "0.5962331", "text": "function addPlaceHolderSupport(){\n\t\tif(!jQuery.support.placeholder) { \n\t\t\tvar active = document.activeElement;\n\t\t\tjQuery(':text').focus(function () {\n\t\t\t\tif (jQuery(this).attr('placeholder') != '' && jQuery(this).val() == jQuery(this).attr('placeholder')) {\n\t\t\t\t\tjQuery(this).val('').removeClass('hasPlaceholder');\n\t\t\t\t}\n\t\t\t}).blur(function () {\n\t\t\t\tif (jQuery(this).attr('placeholder') != '' && (jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('placeholder'))) {\n\t\t\t\t\tjQuery(this).val(jQuery(this).attr('placeholder')).addClass('hasPlaceholder');\n\t\t\t\t}\n\t\t\t});\n\t\t\tjQuery(':text').blur();\n\t\t\tjQuery(active).focus();\n\t\t\tjQuery('form').submit(function () {\n\t\t\t\tjQuery(this).find('.hasPlaceholder').each(function() { jQuery(this).val(''); });\n\t\t\t});\n\t\t}\n}", "title": "" }, { "docid": "dae2e7d6f35433f0caf10f4c10f8e32a", "score": "0.59619665", "text": "function placeholderEdit() {\n\tif ($.browser.webkit || $.browser.mozilla) {\n\t\t$('input,textarea').on('focus', function(){\n\t\t\tvar placeholder = $(this).attr('placeholder');\n\t\t\t$(this).removeAttr('placeholder');\n\t\t\t// var input_text = $(this).attr('value');\n\t\t\t// $(this).removeAttr('value');\n\t\t\t\n\t\t\t$(this).on('blur', function(){\n\t\t\t\t$(this).attr('placeholder',placeholder);\n\t\t\t});\n\t\t});\n\t}\n}", "title": "" }, { "docid": "5393b43f60f9204125330f084141cf91", "score": "0.5957619", "text": "function resetTextBox() {\n id(\"input\").value = \"\";\n id(\"input\").placeholder = \"Add Another TO-DO\";\n }", "title": "" }, { "docid": "5598fba477cf55ea5eb259a09751a6b2", "score": "0.5954453", "text": "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n\n}", "title": "" } ]
fe598f6cf50710cd6f2f10fd7d724d8a
This module populates the database with values for 'Target Config' Without variables defined here, registration is not possible. This will produce an error when you try and insert a value where there is already one.
[ { "docid": "6258a83f4c6f5dcb9ce36899d18d0243", "score": "0.7259326", "text": "async function createTargetConfig() {\n const con = await pool.connect();\n try {\n await con.query(\n \"INSERT INTO target_config (target_id, description) VALUES (4,'Default');\"\n );\n\n \n } finally {\n await con.release();\n }\n}", "title": "" } ]
[ { "docid": "9c1ebd3587d59a2f0f2167816c8cd9d2", "score": "0.5459601", "text": "function getConfigDataToBuildTable() { \n FileMapper.getConfigDataToBuildTable(); \n}", "title": "" }, { "docid": "5e833817165f3010693f00a181a113b4", "score": "0.54271567", "text": "function setupConfigDb(cb) {\n coux.put([config.host, config.admin_db], function(err) {\n if (err && err.error != \"file_exists\") {\n console.error(err)\n } else {\n createConfigDDoc(cb) \n }\n })\n }", "title": "" }, { "docid": "668e4f71c27ff11a27cda6f080aedcee", "score": "0.5126515", "text": "function init_target_values() {\r\n // open database\r\n let db = new sqlite3.Database(path_db, sqlite3.OPEN_READWRITE, (err) => { // connect to database\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.error(err.message);\r\n }\r\n });\r\n\r\n // fetch all cars\r\n db.serialize(() => {\r\n db.each(`SELECT id as id, value as value FROM target_values`, (err, row) => {\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n console.error(err.message); // log\r\n }\r\n \r\n if(row.id == \"pressure\") {\r\n target_pressure = row.value;\r\n } else if(row.id == \"fan_speed\") {\r\n target_fan_speed = row.value;\r\n } else if(row.id == \"mode\") {\r\n cur_mode = row.value;\r\n }\r\n });\r\n });\r\n\r\n // close the database connection\r\n db.close((err) => { // close database connection\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.error(err.message); // log\r\n }\r\n \r\n if(cur_mode) {\r\n mqtt_client.publish(mqtt_topic_pub, '{\"auto\": false, \"speed\": ' + target_fan_speed + '}');\r\n } else {\r\n mqtt_client.publish(mqtt_topic_pub, '{\"auto\": true, \"pressure\": ' + target_pressure + '}');\r\n }\r\n });\r\n}", "title": "" }, { "docid": "810047513fb410c8a5f5db69f8849a77", "score": "0.5073293", "text": "function createTargetDatabase()\n{\n return new TargetDatabase();\n}", "title": "" }, { "docid": "84278611d72013667691279892e14ec3", "score": "0.49960935", "text": "function _populateDatabase(tx) {\n\t\t//tx.executeSql('DROP TABLE partners');\n \ttx.executeSql('CREATE TABLE IF NOT EXISTS partners (id, param_name, param_value)');\n\t}", "title": "" }, { "docid": "c86bd70bd874b320a84178da7a23bcd0", "score": "0.4806437", "text": "function populateDBEngineDefaults(root, dbEngineType) {\n if (dbEngineType === DB_ENGINE_MYSQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_MYSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_MYSQL_URL);\n } else if (dbEngineType === DB_ENGINE_MSSQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_MSSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_MSSQL_URL);\n } else if (dbEngineType === DB_ENGINE_ORACLE) {\n $(\"#ds-driver-class-input\").val(DEFAULT_ORACLE_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_ORACLE_URL);\n } else if (dbEngineType === DB_ENGINE_H2) {\n $(\"#ds-driver-class-input\").val(DEFAULT_H2_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_H2_URL);\n } else if (dbEngineType === DB_ENGINE_POSTGRESQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_POSTGRESQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_POSTGRESQL_URL);\n } else if (dbEngineType === DB_ENGINE_INFORMIX) {\n $(\"#ds-driver-class-input\").val(DEFAULT_INFORMIX_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_INFORMIX_URL);\n } else if (dbEngineType === DB_ENGINE_HSQLDB) {\n $(\"#ds-driver-class-input\").val(DEFAULT_HSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_HSQL_URL);\n } else if (dbEngineType === DB_ENGINE_SYBASE) {\n $(\"#ds-driver-class-input\").val(DEFAULT_SYBASE_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_SYBASE_URL);\n } else if (dbEngineType === DB_ENGINE_APACHEDERBY) {\n $(\"#ds-driver-class-input\").val(DEFAULT_DERBY_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_DERBY_URL);\n } else if (dbEngineType === DB_ENGINE_IBMDB2) {\n $(\"#ds-driver-class-input\").val(DEFAULT_IBMDB2_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_IBMDB2_URL);\n }\n}", "title": "" }, { "docid": "c86bd70bd874b320a84178da7a23bcd0", "score": "0.4806437", "text": "function populateDBEngineDefaults(root, dbEngineType) {\n if (dbEngineType === DB_ENGINE_MYSQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_MYSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_MYSQL_URL);\n } else if (dbEngineType === DB_ENGINE_MSSQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_MSSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_MSSQL_URL);\n } else if (dbEngineType === DB_ENGINE_ORACLE) {\n $(\"#ds-driver-class-input\").val(DEFAULT_ORACLE_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_ORACLE_URL);\n } else if (dbEngineType === DB_ENGINE_H2) {\n $(\"#ds-driver-class-input\").val(DEFAULT_H2_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_H2_URL);\n } else if (dbEngineType === DB_ENGINE_POSTGRESQL) {\n $(\"#ds-driver-class-input\").val(DEFAULT_POSTGRESQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_POSTGRESQL_URL);\n } else if (dbEngineType === DB_ENGINE_INFORMIX) {\n $(\"#ds-driver-class-input\").val(DEFAULT_INFORMIX_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_INFORMIX_URL);\n } else if (dbEngineType === DB_ENGINE_HSQLDB) {\n $(\"#ds-driver-class-input\").val(DEFAULT_HSQL_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_HSQL_URL);\n } else if (dbEngineType === DB_ENGINE_SYBASE) {\n $(\"#ds-driver-class-input\").val(DEFAULT_SYBASE_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_SYBASE_URL);\n } else if (dbEngineType === DB_ENGINE_APACHEDERBY) {\n $(\"#ds-driver-class-input\").val(DEFAULT_DERBY_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_DERBY_URL);\n } else if (dbEngineType === DB_ENGINE_IBMDB2) {\n $(\"#ds-driver-class-input\").val(DEFAULT_IBMDB2_DRIVER_CLASS);\n $(\"#ds-url-input\").val(DEFAULT_IBMDB2_URL);\n }\n}", "title": "" }, { "docid": "ca978a792d8dc76a1d182023662eeaa5", "score": "0.47394267", "text": "addNewTarget() {\n this.target = Target.addNewTargetToGame(this.board);\n }", "title": "" }, { "docid": "d600f5e637dc0f39c195419566235da6", "score": "0.47303593", "text": "function saveConfig() {\n nconf.set(\"mqtt:host\", mqttHost);\n nconf.set(\"mqtt:port\", mqttPort);\n nconf.set(\"mqtt:topic\", mqttTopic);\n nconf.set(\"mqtt:interval\", mqttInterval);\n nconf.set(\"sensor:interval\", sensorInterval);\n nconf.set(\"sensor:mac\", tagData.payload.sensorMac);\n nconf.set(\"device:mac\", tagData.payload.deviceMac);\n nconf.save(function(err) {});\n}", "title": "" }, { "docid": "c6ad5adb776e6a712e40748d1d64c8ee", "score": "0.47098136", "text": "function loadConfig() {\n\t//Can be encapsulated in getInfo()\n\tvar data = getInfo('Config');\n\t\n\t//Remove imageDatabase\n\timageDatabase = data[\"imageDatabase\"];\n\tdatabaseLocation = data[\"databaseLocation\"];\n}", "title": "" }, { "docid": "d10d6aa4faf404d0b2567c3bb22fbf64", "score": "0.46817893", "text": "function setForDestination(d, cb) {\n list(appId, d, function(err, config){\n if(err) return cb(err);\n var payload = {payload:{\"template\":appId, destination: d, config: config}};\n payload.payload.config[k] = v;\n var uri = \"box/srv/1.1/ide/\" + fhc.curTarget + \"/config/update\";\n common.doApiCall(fhreq.getFeedHenryUrl(), uri, payload, \"Error setting destination config: \", cb);\n });\n }", "title": "" }, { "docid": "8e05640dad757caa301433768dfc130a", "score": "0.46691826", "text": "function loadFromXmlConfig(modelDef, source, target) {\n \n var sourceProps = [];\n \n // Accumulate a list of children from the attributes and child nodes\n if (source.attributes) {\n for (var i = 0; i < source.attributes.length; i++) {\n var attribute = source.attributes[i];\n \n // Just skip a bunch of attributes that we don't process\n if (attribute.name === \"xmlns\") {\n continue;\n }\n sourceProps.push({\n name : attribute.name,\n value : attribute.value\n });\n } \n }\n if (source.firstElementChild) {\n var child = source.firstElementChild;\n while (child) {\n sourceProps.push({\n name : child.nodeName,\n value : child.textContent,\n element : child\n });\n child = child.nextElementSibling;\n }\n }\n \n // Figure out the current target object path through the prototype and constructor\n var currentPath = Object.getPrototypeOf(target).constructor.keyPath;\n \n // Loop through all source properties\n for (var i = 0; i < sourceProps.length; i++) {\n var sourceProp = sourceProps[i];\n var propName = sourceProp.name;\n \n // Check to see if target also have this property. If so, then clone it\n if (target[propName] === undefined) {\n throw \"Source has property '\" + propName + \"' which is not supported\"; \n }\n\n var newElement = null;\n var targetType = determinePropertyType(target, propName);\n \n switch (targetType) {\n case \"string\" :\n case \"number\" :\n case \"boolean\" :\n if (targetType === \"string\") {\n newElement = sourceProp.value;\n } else {\n newElement = JSON.parse(sourceProp.value);\n }\n\n // Check the new element type created by parse to make sure it matches\n if (typeof newElement !== targetType) {\n throw \"Source's property '\" + propName + \"' has type not matching target's property type\"; \n }\n target[propName] = newElement;\n break;\n case \"array\" : \n case \"object\" :\n if (sourceProp.element === undefined) {\n // If objNode is undefined, then this is an xml attribute, which means the source doesn't have\n // an object here. It's an error in this case\n throw \"Source's property '\" + propName + \"' has type not matching target's property type\";\n }\n\n // Use the prop name to find the constructor defined in the model definition, then\n // invoke to create the new object\n newElement = constructObject(modelDef, currentPath + \"/\" + propName);\n loadFromXmlConfig(modelDef, sourceProp.element, newElement);\n \n if (targetType === \"array\") {\n if (target[propName] === null) {\n target[propName] = [];\n }\n target[propName].push(newElement);\n } else {\n target[propName] = newElement; \n }\n \n break;\n default:\n break;\n } \n }\n }", "title": "" }, { "docid": "ff6a09ec04e67104defb00d6784305cd", "score": "0.46669483", "text": "function populateStage2Config3pas(configData) {\n // define range of A1Notation for populating values in config sheet\n var configSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\n CONFIG_SHEET_NAME_3PAS);\n var configRangeA1Notation = 'A7:G';\n configSheet.getRange(configRangeA1Notation).clear();\n\n var numRows = configData.length;\n\n var configRange = configSheet.getRange(7, 1, numRows, 7);\n configRange.clearFormat();\n\n configRange.clearDataValidations();\n configRange.setValues(configData);\n\n SpreadsheetApp.flush(); // Finish updating before resizing column widths.\n\n configSheet.getRange(configRangeA1Notation).clearDataValidations();\n}", "title": "" }, { "docid": "5da4ff53d7aa08084d76f53dc00661e0", "score": "0.4662277", "text": "function updConfig() {\n console.log(\"UPDATE CONFIG\");\n var db = window.openDatabase(\"../../../storage/extSdCard/TelefonesUteis/telefonesuteis\", \"1.0\", \"TelefonesUteis\", 1000000);\n db.transaction(function (transaction) {\n transaction.executeSql(\"INSERT INTO config (cod_config,configdb) VALUES(?,?) \", [1, 'T'], function (tx, results) {\n console.log(results);\n console.log(\"CONFIG ATUALIZADO\");\n getTelefones();\n }, function (err) {\n console.log(\"ERROR INSERT CONFIG\");\n console.log(err.code);\n console.log(err.message);\n });\n }, function (error) {\n console.log('BASE ERROR: ' + error.message);\n }, function () {\n\n });\n}", "title": "" }, { "docid": "487c7ed5cc09720c5d0ed03f710b0fee", "score": "0.46491706", "text": "set targets(value) {}", "title": "" }, { "docid": "b020bf08ecc2640e4c44d6ec4548fe25", "score": "0.4645813", "text": "_injectApiConfiguration(apiTarget, apiSource) {\n // any defaults in the apiConfig are to be maintained!\n apiTarget.hidden = apiSource.hidden;\n }", "title": "" }, { "docid": "5f53c56b6de914fdb4a1d8572c0164d1", "score": "0.4590388", "text": "async function autoGenerateParameterRef(clearTableBefore){\n\t\n\tif(clearTableBefore === true ){\n\t\tawait queryHelper.runQuery(\"TRUNCATE TABLE telecomlib.parameter_reference\");\n\t}\n\t\n\tconst VENDOR_CM_INFO = [\n\t\t{\n\t\t\tvendor: \"HUAWEI\",\n\t\t\tcm_schema: \"huawei_cm\"\n\t\t},\n\t\t{\n\t\t\tvendor: \"ERICSSON\",\n\t\t\tcm_schema: \"ericsson_cm\"\n\t\t},\n\t\t{\n\t\t\tvendor: \"NOKIA\",\n\t\t\tcm_schema: \"nokia_cm\"\n\t\t},\n\t\t{\n\t\t\tvendor: \"ZTE\",\n\t\t\tcm_schema: \"zte_cm\"\n\t\t}\n\t];\n\t\n\tfor(let v of VENDOR_CM_INFO){\t\t\n\t\tconst colSql = `SELECT DISTINCT table_name \n\t\tFROM information_schema.tables \n\t\tWHERE table_schema = '${v.cm_schema}' \n\t\tAND table_type = 'BASE TABLE'`;\n\n\t\tconst colSqlRes = await queryHelper.runQuery(colSql);\n\t\t\n\t\tfor( let t of colSqlRes.rows){\n\t\t\tconst sql = `\n\t\t\tINSERT INTO telecomlib.parameter_reference \n\t\t\t(vendor, technology, mo, parameter_id, parameter_name, granurality)\n\t\t\tSELECT \n\t\t\t\t'${v.vendor}' as vendor, \n\t\t\t\t COALESCE(t2.technology,'UNKNOWN') AS technology,\n\t\t\t\t'${t.table_name}' as mo,\n\t\t\t\tkey as parameter_id,\n\t\t\t\tkey as parameter_name,\n\t\t\t\tCOALESCE(t2.granurality, 'UNKNOWN') as granurality\n\t\t\t\t\n\t\t\tFROM (\n\t\t\t\tSELECT DISTINCT jsonb_object_keys(data) AS key\n\t\t\t\tFROM\n\t\t\t\t${v.cm_schema}.\"${t.table_name}\"\n\t\t\t) t1\n\t\t\tLEFT JOIN telecomlib.managed_objects t2 \n\t\t\t\tON t2.vendor = '${v.vendor}' \n\t\t\t\tAND t2.mo = '${t.table_name}'\n\t\t\tWHERE \n\t\t\t\tt2.technology IS NOT NULL\n\t\t\tON CONFLICT ON CONSTRAINT unq_parameter_reference DO NOTHING\n\t\t\t`;\n\t\t\t\n\t\tconsole.log(sql)\n\t\tawait queryHelper.runQuery(sql);\n\t\t}\n\t\t\n\t}\n}", "title": "" }, { "docid": "01a529e4db1ccf8c1b9fbec30a459619", "score": "0.45889032", "text": "function fireBaseAdd() {\n for (var i = 0; i < commodityLookUp.length; i++) {\n for (var j = 0; j < commodityLookUp[i].queryWord.length; j++) {\n database.ref('lookUpTable/' + commodityLookUp[i].queryWord[j]).set({\n target: commodityLookUp[i].targetWord,\n category: \"currency\"\n });\n }\n }\n}", "title": "" }, { "docid": "5abb3af311001c293db9f32c72a13c3c", "score": "0.4575487", "text": "configDatabaseSetup() {\n var client = new pg_1.Client(this.postUrl);\n // creating the client object or instance and pass the database Url\n client.connect(function (err) {\n // call the method to verify the connection of postgresql\n if (err) {\n // if error occurs then return the error on console\n return console.error(\"could not connect to postgres\", err);\n }\n // connection established\n client.query(\"SELECT NOW()\", function (err, result) {\n // if error occurs on query then return error on console\n if (err) {\n return console.error(\"error running query\", err);\n }\n // if query succeded then return the current time on console\n // console.log(\"Connected to PostGreSQL at \", result.rows[0].theTime);\n console.log(\"Postgresql server started\");\n // >> output: 2018-08-23T14:02:57.117Z\n // closing the connection when it is not in used\n client.end();\n });\n });\n }", "title": "" }, { "docid": "2890802157d79b4d50a41ba67f68ee79", "score": "0.45725542", "text": "config(state) {\n db.table('setups').toArray().then((setups) => {\n state.init = true\n\n if (setups.length > 0) {\n state.setups = setups\n\n db.table('current').toArray().then((current) => {\n if (current.length > 0) {\n let currentData = {'id': current[0].id, 'code': current[0].code}\n state.current = currentData\n\n let currentSetup = setups.filter(setup => setup.id === currentData.id)[0]\n state.prono = currentSetup.prono\n\n if (state.prono) state.hiding = [1, 2, 3]\n else state.hiding = [1, 2]\n\n db.table('fish').toArray().then((fish) => {\n if (fish.length > 0) {\n let currentFish = fish.filter(fishka => fishka.setup === currentData.id)\n if (currentFish.length > 0) state.fish = currentFish\n else state.fish = []\n } else state.fish = []\n })\n\n db.table('tags').toArray().then((tags) => {\n if (tags.length > 0) {\n let currentTags = tags.filter(tag => tag.setup === currentData.id)\n if (currentTags.length > 0) state.tags = currentTags\n else state.tags = []\n } else state.tags = []\n })\n } \n })\n }\n })\n }", "title": "" }, { "docid": "3e67eddb861a3de2b6d395de39de8e1a", "score": "0.45691594", "text": "function PopulateEpilogPage() {\n ConfigCommand(\"SetConfig\",Config);\n }", "title": "" }, { "docid": "ffed9c6503283a396f2ac759ce286775", "score": "0.4548412", "text": "function save_target_values() {\r\n // open database\r\n let db = new sqlite3.Database(path_db, sqlite3.OPEN_READWRITE, (err) => { // connect to database\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.error(err.message);\r\n }\r\n });\r\n\r\n db.run('UPDATE target_values SET value = ' + target_pressure + ' WHERE id = \"pressure\";', function(err) {\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.log(err.message); // log\r\n }\r\n });\r\n \r\n db.run('UPDATE target_values SET value = ' + target_fan_speed + ' WHERE id = \"fan_speed\";', function(err) {\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.log(err.message); // log\r\n }\r\n });\r\n\r\n // close the database connection\r\n db.close((err) => { // close database connection\r\n if (err) { // catch errors\r\n res.status(500).send('Internal Error'); // send error information to client\r\n return console.error(err.message); // log\r\n }\r\n });\r\n}", "title": "" }, { "docid": "663906a201f192c5ab98d4be17fe7888", "score": "0.45363808", "text": "writeDestinationTarget() {\n // Get the existing value.\n let tmpArray = _.get(\n this.scheme[this.getDestination()],\n this.getTarget(),\n []\n );\n // Ensure it is an array.\n if (!_.isArray(tmpArray)) {\n tmpArray = [tmpArray];\n }\n // Push the provided value to the array.\n tmpArray.push(this.getValue());\n // Set this in the object.\n _.set(this.scheme[this.getDestination()], this.getTarget(), tmpArray);\n }", "title": "" }, { "docid": "a9843178bac10b0c99926c1465e622ac", "score": "0.4534425", "text": "function readTarget(record, serviceDefinitions) {\n var target = Object.assign(Object.assign({}, defaultTarget), record);\n\n if (((typeof target.id) != \"string\") || (target.id.length === 0)) {\n console.error(\"Invalid target configuration, 'id' property must be a non-empty string. Ignoring target\");\n return null;\n }\n\n if (((typeof target.type) != \"string\") || (!serviceDefinitions.hasOwnProperty(target.type))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"', 'type' property must be a valid string in ('\" + Object.keys(serviceDefinitions).join(\"', '\") + \"'), found '\" + target.type + \"'. Ignoring target\");\n return null;\n }\n\n if (((typeof target.collapse) != \"string\") || (!collapseRegex.test(target.collapse))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'collapse' property must be a valid collapse type (JSON, concat, concat-b64, none). Ignoring target\");\n return null;\n }\n\n // Force collapse, check role, check region\n switch (target.type) {\n case \"es\":\n case \"firehose\":\n case \"kinesis\": {\n target.collapse = \"API\";\n break;\n }\n case \"memcached\":\n case \"redis\": {\n target.collapse = \"multiple\";\n if (target.role) {\n console.error(\"Ignoring parameter 'role' for target '\" + target.id + \"' of type '\" + target.type + \"'\");\n target.role = null;\n }\n if (target.region) {\n console.error(\"Ignoring parameter 'region' for target type '\" + target.type + \"'\");\n target.region = null;\n }\n }\n case \"sqs\":\n case \"sns\":\n case \"iot\": {\n // Nothing to do for the collapse\n }\n default: {\n target.collapse = null;\n }\n }\n\n if (((typeof target.sourceArn) != \"string\") || (!sourceRegex.test(target.sourceArn))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'sourceArn' property must be a valid ARN of an Amazon Kinesis Stream or Amazon DynamoDB Stream. Ignoring target\");\n return null;\n }\n if (((typeof target.destination) != \"string\") || (!serviceDefinitions[target.type].destinationRegex.test(target.destination))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'destination' property must be valid for the specified target type, check documentation. Ignoring target\");\n return null;\n }\n\n if ((typeof target.active) != \"boolean\") {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'active' property must be a boolean. Ignoring target\");\n return null;\n }\n if ((typeof target.parallel) != \"boolean\") {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'parallel' property must be a boolean. Ignoring target\");\n return null;\n }\n\n if ((target.role !== null) && (!roleRegex.test(target.role))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'role' property must be a valid string. Ignoring target\");\n return null;\n }\n if ((target.externalId !== null) && ((typeof target.externalId) != \"string\")) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'externalId' property must be a valid string. Ignoring target\");\n return null;\n }\n if ((target.region !== null) && (!regionRegex.test(target.region))) {\n console.error(\"Invalid configuration for target '\" + target.id + \"' of type '\" + target.type + \"', 'region' property must be a valid string. Ignoring target\");\n return null;\n }\n return target;\n}", "title": "" }, { "docid": "607ef58dfc1a4baa173f1ace67f3f5dc", "score": "0.4520289", "text": "modelSpecificSetup() {\n // make sure that we have the fan deviceId, not sure if this is required for local calls even on the miot protocol(maybe only required for cloud calls)\n try {\n if (!this.deviceId) throw new Error(`Could not find deviceId for ${this.name}! deviceId is required for miot devices! Please specify a deviceId in the 'config.json' file!`);\n } catch (error) {\n this.logError(error);\n return;\n }\n\n // prepare/reset the variables\n this.properties = {};\n this.propertiesDefs = {};\n this.commandDefs = {};\n }", "title": "" }, { "docid": "4871e243b96e889c86363e1fcdcb576f", "score": "0.45087096", "text": "setupconsts() {\n this.databaseType = this.config.get('databaseType');\n if (!this.databaseType) {\n this.databaseType = 'angular';\n }\n }", "title": "" }, { "docid": "f653edfb7e1af55a5a0f42358781f4e8", "score": "0.44830045", "text": "static createConfig() {\n const model = this;\n\n const config = {\n model,\n _fields: {},\n _virtuals: {},\n _options: {},\n fieldsToColumns: {},\n unique: [],\n notUpdated: [],\n fieldNames: [],\n };\n\n Object.defineProperties(config, {\n primary: {\n get() {\n if (!config._primary) {\n throw new Error(`\\`${model.name}\\` has no primary field`);\n }\n return config._primary;\n },\n },\n fields: {\n get() {\n return config._fields;\n },\n set(fields) {\n Object.entries(fields).forEach(([name, config]) => {\n if (typeof config === 'string') {\n config = { type: config };\n }\n\n if (config instanceof model.Field) {\n config = Object.assign({}, config.config, { model });\n } else {\n config = Object.assign({}, config, { name, model });\n }\n\n model.addField(new model.Field(config));\n });\n },\n },\n virtuals: {\n get() {\n return config._virtuals;\n },\n set(virtuals) {\n Object.entries(virtuals).forEach(([name, descriptor]) => {\n model.addVirtual(new model.Virtual({ name, model, descriptor }));\n });\n },\n },\n options: {\n get() {\n return config._options;\n },\n set(options) {\n config._options = merge(config._options, options);\n },\n },\n });\n\n return config;\n }", "title": "" }, { "docid": "e442fda433328fe15a73d982070cc334", "score": "0.4476421", "text": "function setGadgetTargetFields(gadget){\n \n $scope.targetDatasource=\"\";\n var gadgetData = angular.element(document.getElementsByClassName(gadget.id)[0]).scope().$$childHead.vm;\n if(gadget.type === 'livehtml'){\n if(typeof gadgetData.datasource !== 'undefined'){\n $scope.targetDatasource = gadgetData.datasource.name;\n var dsId = gadgetData.datasource.id;\n }\n }else if(gadget.type === 'gadgetfilter'){\n if(typeof gadgetData.datasource !== 'undefined'){\n $scope.targetDatasource = gadgetData.datasource.name;\n var dsId = gadgetData.datasource.id;\n }\n }else {\n $scope.targetDatasource = gadgetData.measures[0].datasource.identification;\n var dsId = gadgetData.measures[0].datasource.id;\n }\n if(typeof dsId !== 'undefined'){\n httpService.getFieldsFromDatasourceId(dsId).then(\n function(data){\n $scope.gadgetTargetFields = utilsService.transformJsonFieldsArrays(utilsService.getJsonFields(data.data[0],\"\", []));\n }\n )\n }\n $scope.gadgetTargetFields = [];\n }", "title": "" }, { "docid": "21877d26d87ea0f75c64ed8bbe7e04fe", "score": "0.4473154", "text": "function setupConfig() {\n var configObject = {};\n var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"Configuration\");\n \n \n var range = ss.getDataRange();\n var values = range.getValues();\n \n // This logs the spreadsheet in CSV format with a trailing comma\n for (var i = 1; i < values.length; i++) {\n if (values[i][0] && values[i][1]) {\n Logger.log(\"found config property: value: \" + values[i][0] + \": \" + values[i][1]);\n \n configObject[values[i][0]] = values[i][1];\n }\n \n }\n return configObject; \n }", "title": "" }, { "docid": "1c07a10c521fd51a2e1786196738ee04", "score": "0.44522345", "text": "setTarget(target) {\n const oldTarget = this.target\n if (target) {\n target.dispatchEvent('beforeAdd', this);\n this.dispatchEvent('beforeAdd', target);\n }\n if (oldTarget) {\n oldTarget.dispatchEvent('beforeRemove', this);\n this.dispatchEvent('beforeRemove', oldTarget);\n }\n \n this.loaded = true;\n \n if (target?.cid != this.target?.cid) {\n this.target = target;\n if (target) {\n if(target.primaryKey()){\n let attributes = {\n [this.reflection.foreignKey()]: target.primaryKey()\n };\n if (this.reflection.polymorphic) {\n attributes[this.reflection.foreignType()] = target.modelName.name;\n }\n this.owner.setAttributes(attributes);\n }\n this.dispatchEvent('afterAdd', target);\n target.dispatchEvent('afterAdd', this);\n } else {\n this.owner.setAttributes({\n [this.reflection.foreignKey()]: null\n });\n this.dispatchEvent('afterRemove', oldTarget);\n oldTarget?.dispatchEvent('afterRemove', this);\n }\n }\n\n }", "title": "" }, { "docid": "ed7e3b60856371b268319c5843237f15", "score": "0.44515532", "text": "function initialize() {\n var db = getDatabase();\n db.transaction(\n function(tx) {\n // Create the settings table if it doesn't already exist\n // If the table exists, this is skipped\n tx.executeSql('CREATE TABLE IF NOT EXISTS settings(setting TEXT UNIQUE, value TEXT)');\n });\n}", "title": "" }, { "docid": "06f627478ad24125bc5bcb24d900e02b", "score": "0.44402635", "text": "_onChange(source, args) {\n source.setProperty();\n /**\n * @type {ModuleConfig}\n */\n let config = args['config'];\n // update the config entity with this section\n config.sections[args['valueHolder']['involved-in']] = source.getBinding();\n this._beteiligtBinding.rememberFocus(source);\n // update the involved part of the entity\n this.persist.call(this, args['config']).then(function () {\n console.log(\"Stored: \" + source.getBoundProperty() + \" = \" + source.getValue(), args['config']);\n });\n }", "title": "" }, { "docid": "fe32a8ca572a05f7edce9c9b10e1f21c", "score": "0.44368973", "text": "initConfig(config) {\n let { mijia } = config;\n let { sids, passwords, devices } = mijia;\n if (sids && passwords) {\n if (sids.length != passwords.length) {\n throw new Error('sids length and passwords length must be equal');\n }\n }\n sids.map((sid, index) => {\n this.gateways[sid] = { password: passwords[index], devices: {} };\n });\n if (devices && devices.length > 0) { //for wifi devices\n devices.map((device) => {\n if (device.sid != undefined) {\n this.devices[device.sid] = device;\n } else if (device.name != undefined) {\n this.devices[device.name] = device;\n } else {\n this.log.warn('device do not have sid or name,will discard to register');\n }\n });\n }\n this.log.debug('initConfig done');\n }", "title": "" }, { "docid": "bacfb1116804abfdee9535c4605fe6e0", "score": "0.44313365", "text": "static getDatabaseConfig() {\n return {\n LOCAL: 'local',\n DEVELOPMENT: 'development',\n STAGING: 'staging',\n PRODUCTION: 'production',\n environment: {\n 'local': {config: 'mongodb://localhost:27017/adviqo-local'},\n 'development': {config: 'mongodb://localhost:27017/adviqo-develop'},\n 'staging': {config: 'mongodb://localhost:27017/adviqo-staging'},\n 'production': {config: 'mongodb://localhost:27017/adviqo-production'}\n }\n };\n }", "title": "" }, { "docid": "b33ad587006d7d3d9c38eefec5110e53", "score": "0.44297153", "text": "function setGadgetTargetFields(gadget){ \n $scope.targetDatasource=\"\";\n var gadgetData = angular.element(document.getElementsByClassName(gadget.id)[0]).scope().$$childHead.vm;\n if(gadget.type === 'livehtml'){\n if(typeof gadgetData.datasource !== 'undefined'){\n $scope.targetDatasource = gadgetData.datasource.name;\n var dsId = gadgetData.datasource.id;\n }\n }else if(gadget.type === 'gadgetfilter'){\n $scope.targetDatasource = gadgetData.datasource.name;\n var dsId = gadgetData.datasource.id;\n }\n else{\n $scope.targetDatasource = gadgetData.measures[0].datasource.identification;\n var dsId = gadgetData.measures[0].datasource.id;\n }\n if(typeof dsId !== 'undefined'){\n httpService.getFieldsFromDatasourceId(dsId).then(\n function(data){\n $scope.gadgetTargetFields = utilsService.transformJsonFieldsArrays(utilsService.getJsonFields(data.data[0],\"\", []));\n }\n )\n }\n $scope.gadgetTargetFields = [];\n }", "title": "" }, { "docid": "49b7a925b6e783e31f162817784f8894", "score": "0.4429432", "text": "static execute(target) {\n if (target.__meta) {\n target.__meta.forEach((data) => {\n exports.MetaTypeInitialiser.execute(target, data);\n });\n }\n }", "title": "" }, { "docid": "e80bc31329f85b973f953b6975d9c0cf", "score": "0.4426542", "text": "function generateDatabaseConfig(database, dbengine) {\n switch (dbengine) {\n case 'postgresql':\n return {\n development: {\n client: 'pg',\n host: 'localhost', port: 5432, database\n },\n test: {\n client: 'pg',\n host: 'localhost', 'port': 5432, database\n },\n production: {\n client: 'pg',\n host: 'localhost', port: 5432, database\n }\n };\n default:\n return {\n development: {\n client: 'sqlite3',\n filename: './db/development.sqlite3'\n },\n test: {\n client: 'sqlite3',\n filename: './db/test.sqlite3'\n },\n production: {\n client: 'sqlite3',\n filename: './db/production.sqlite3'\n },\n };\n }\n}", "title": "" }, { "docid": "d107e98570c1281a3e2938c989d079f3", "score": "0.44228563", "text": "function setDatabase(){\n var nuclTargetDB = document.settings.database_dna;\n var protTargetDB = document.settings.database_peptide;\n\n // Create an array of selected species\n var selSpecies = getSpecies();\n var selQType = getQueryType();\n\n var databaseDna = getDatabaseDna();\n var databasePeptide = getDatabasePeptide();\n if( databaseDna != 0 ){ lastDatabaseDna = databaseDna }\n if( databasePeptide != 0 ){ lastDatabasePeptide = databasePeptide }\n\n var optNuclValues = new Array();\n var optProtValues = new Array();\n for( var i=0; i<selSpecies.length; i++ ){\n var sp = selSpecies[i];\n\n var nAry = new Array();\n var pAry = new Array();\n\n for( var j=0; j<databaseAry.length; j++ ){\n var db = databaseAry[j];\n if( typeof getConf( selQType, sp, 'dna', db ) == 'object' ) { nAry.push( db ); }\n if( typeof getConf( selQType, sp, 'peptide', db ) == 'object' ) { pAry.push( db ); }\n }\n optNuclValues.push( nAry );\n optProtValues.push( pAry );\n }\n var optNuclValues = arrayUnion( optNuclValues );\n var optProtValues = arrayUnion( optProtValues );\n var optNuclLabels = new Array();\n var optProtLabels = new Array();\n\n setSelectOptions( nuclTargetDB, optNuclValues, dbDnaLabels, lastDatabaseDna );\n setSelectOptions( protTargetDB, optProtValues, dbPeptideLabels, lastDatabasePeptide );\n\n}", "title": "" }, { "docid": "79b6dc927746e6c99d5de375db4d2ae2", "score": "0.44214758", "text": "function generateDatabaseConfig(database, dbengine) {\n switch (dbengine) {\n case 'postgresql':\n return {\n development: {\n client: \"pg\",\n host: \"localhost\", port: 5432, database\n },\n test: {\n client: \"pg\",\n host: \"localhost\", \"port\": 5432, database\n },\n production: {\n client: \"pg\",\n host: \"localhost\", port: 5432, database\n }\n }\n default:\n return {\n development: {\n client: \"sqlite3\",\n filename: \"./db/development.sqlite3\"\n },\n test: {\n client: \"sqlite3\",\n filename: \"./db/test.sqlite3\"\n },\n production: {\n client: \"sqlite3\",\n filename: \"./db/production.sqlite3\"\n },\n }\n }\n}", "title": "" }, { "docid": "eec4c2057a3facd32a1c72c5fd12d5d4", "score": "0.44201893", "text": "saveConfig(config) {\n return wrapTrans(\n this._db.transaction(TBL_CONFIG, 'readwrite')\n .objectStore(TBL_CONFIG)\n .put(config, 'config'));\n }", "title": "" }, { "docid": "4e51d76ad80d67ea09e2eb0cb0d9dbd4", "score": "0.4398936", "text": "function configUpdate() {\n var cfg = devConfigMap.get(vm.configType);\n if (cfg === undefined) {\n alert('未知类型' + vm.configType);\n } else {\n angular.extend(cfg, vm.modal);\n cfg.createOrUpdate()\n .then(successCallback)\n .catch(errorCallback);\n }\n\n function successCallback(res) {\n Notification.success({ message: '<i class=\"glyphicon glyphicon-ok\"></i> 配置信息保存成功!' });\n $('#' + vm.configType + 'Modal').modal('hide');\n $('#configTable').bootstrapTable('refresh', { url: DevconfigManagementService.apiMap.get(vm.configType) });\n }\n\n function errorCallback(res) {\n Notification.error({ message: res.data.message, title: '<i class=\"glyphicon glyphicon-remove\"></i> 配置信息保存失败!' });\n }\n }", "title": "" }, { "docid": "6cb40ceacd353b449b674234502a062b", "score": "0.4398461", "text": "function toTargetNow() {\n for (let gn in target)\n currentGenes[gn] = target[gn];\n target = {};\n}", "title": "" }, { "docid": "ffbbc58b4c82ed912a6c001242c2b6c1", "score": "0.43911266", "text": "_importConfig() {\n _userEvents.importConfig();\n }", "title": "" }, { "docid": "027c7a142f48576e5634d43aa4639096", "score": "0.43890277", "text": "function UpdaterConfigFirstTime(callback) {\n log.info('Configuring the updater for the first time...');\n switch(config.platform) {\n case 'linux':\n var confFile = '/etc/wpa_supplicant/wpa_supplicant.conf';\n try {\n var text = fs.readFileSync(confFile, 'utf8');\n if(text.match(/device_name=Edison/)) {\n log.info('Intel Edison Platform Detected');\n config.updater.set('platform', 'edison');\n hooks.getUniqueID(function(err, id) {\n if(err) {\n var id = '';\n log.error('There was a problem generating the factory ID:');\n log.error(err);\n for(var i=0; i<8; i++) {\n id += (Math.floor(Math.random()*15)).toString(16);\n }\n }\n var hostname = 'FabMo-' + id;\n config.updater.set('name', hostname);\n callback();\n })\n } else {\n////## Don't know what this was intended for or why functionality missing; defaulted out?\n // require('./util').getCpuInfo(function(err,cpus){\n // if(err) return log.warn(err);\n // for( c in cpus ){\n // if (cpus[c].Hardware === \"BCM2708\" || cpus[c].Hardware === \"BCM2709\"){\n // log.info(\"Raspberry Pi platform detected\");\n // config.updater.set('platform', 'raspberry-pi');\n // hooks.getUniqueID(function(err, id) {\n // if(err) {\n // var id = '';\n // log.error('There was a problem generating the factory ID:');\n // log.error(err);\n // for(var i=0; i<6; i++) {\n // id += (Math.floor(Math.random()*15)).toString(16);\n // }\n // }\n // var hostname = 'FabMo-' + id;\n // config.updater.set('name', hostname.substring(0,30));\n // callback();\n // })\n\n // }\n // } \n // });\n }\n } catch(e) {\n log.error(e);\n }\n break;\n\n case 'darwin':\n // Like in the engine, we host on 9876/9877 by default since 80/81 are typically blocked\n log.info('OSX Detected.');\n config.updater.set('server_port',9877);\n config.updater.set('engine_server_port',9876);\n config.updater.update({network : {mode : 'station', networks : []}});\n callback();\n break;\n default:\n config.updater.set('server_port',9877);\n config.updater.set('engine_server_port',9876);\n callback();\n break;\n }\n}", "title": "" }, { "docid": "113402172902a8e945f2733de1ef23c1", "score": "0.4387445", "text": "processConfig() {\n this.store.dispatch(\n importConfig(\n deepmerge(getConfigFromPlugins(this.plugins), this.config),\n ),\n );\n }", "title": "" }, { "docid": "bec26e10f01da40f562f4178603f8732", "score": "0.43807238", "text": "@Post('insert')\n public async postDbDetails(@Response() res, @Request() req, @Body() dbConfigDetails: DbConfigDetails) {\n const { postDbDetails } = this.dbService;\n const { sendSuccess, sendError} = this.Utility;\n try {\n const result = await postDbDetails(dbConfigDetails)\n return sendSuccess(req, res, result, ResMessage.SUCCESS);\n } catch (e) {\n return sendError(req, res, e);\n }\n }", "title": "" }, { "docid": "b0bb475458067bfa9693816b069dbfaa", "score": "0.436423", "text": "function op_autonumberconfigOnLoad(executionContext)\n{\n formInit(executionContext);\n _setDefaultValues();\n \n _setDisabled();\n}", "title": "" }, { "docid": "678ee0780c1bfc78ee67f67553395a04", "score": "0.43573022", "text": "function setTarget(newTarget) {\n if (project) {\n project.save();\n }\n if (runner !== null) {\n // A previous job is running, stop it now.\n runner.stop();\n runner = null;\n }\n loadProject(newTarget).then(() => {\n update();\n document.querySelector('#btn-flash').disabled = project.board.config.firmwareFormat === undefined;\n });\n}", "title": "" }, { "docid": "c39530dbfaa335b0b78546409f31f5d1", "score": "0.4355735", "text": "assignMappings(target,source) {\n \n const sourceKeys = Object.keys(source);\n sourceKeys.forEach((key) => {\n if (target.hasOwnProperty(key)) {\n if (source[key].hasOwnProperty('tableName')) {\n target[key].tableName = source[key].tableName\n }\n if (source[key].hasOwnProperty('columnMappings')) {\n target[key].columnMappings = target[key].columnMappings || []\n Object.keys(source[key].columnMappings).forEach((sourceName) => {\n target[key].columnMappings[sourceName] = source[key].columnMappings[sourceName]\n })\n }\n }\n else {\n target[key] = source[key]\n }\n })\n return target\n }", "title": "" }, { "docid": "78c344bef0bb0eb3a0a78d8dab6f129d", "score": "0.43556553", "text": "_loadInfoFromDatabase() {\n // default values\n this._prefix = \"\";\n this._enabled = true;\n\n db.select(\"Plugins\", [\"prefix\", \"disabled\"], {\n id: this.id\n }).then((rows) => {\n if (rows.length > 0) {\n this._prefix = rows[0].prefix;\n this._enabled = (rows[0].disabled === 0);\n } else {\n return db.insert(\"Plugins\", {\n id: this.id,\n prefix: \"\",\n disabled: 0\n });\n }\n }).catch(Logger.err);\n }", "title": "" }, { "docid": "21aae085a98d13b8e03b228aa4e254fc", "score": "0.43519655", "text": "async function migration() {\n var values = await Readconfig('Input.json');\n let option = values.prod.options;\n option.method = 'POST';\n option.path = '/elements/api-v2/formulas';\n let files = fs.readdirSync('dev');\n let mapper = {};\n\n for (i in files) {\n let map = await upload(option, files[i]).catch(err => {\n console.log(\"Failed to upload formula\");\n });\n mapper = Object.assign(map, mapper);\n }\n\n values.mapper = mapper;\n\n fs.writeFile('Input.json', JSON.stringify(values), () => { });\n console.log(\"All formulas are successfully uploaded to production\");\n}", "title": "" }, { "docid": "c1ae032563e904920661200cc67fa3dc", "score": "0.43514284", "text": "function init_config_form(){\n load_config();\n build_table();\n render_plugin_data();\n }", "title": "" }, { "docid": "1cea08b1470f6d9a8a55274b0c1da71b", "score": "0.43511763", "text": "function addTargetMotionModel (req, res) {\r\n\tconsole.log ('POST /targets/motionmodel');\r\n\tTarget.findById(req.body.targetID, function(err, target) {\r\n\t if (err) {\r\n\t \tres.status(500).send({ message : 'Error while retrieving the target from the DB'});\r\n\t } else {\r\n\t \tif (!target) {\r\n\t \t\tres.status(404).send({ message : 'Target does not exist in the DB'});\r\n\t \t} else {\r\n\t \t\t// read the input data\r\n\t \t\ttarget.motionModel.method = req.body.method;\r\n\t \t\t// save the data\r\n\t \t\ttarget.save (function (err, targetSaved) {\r\n\t\t\t\t\tif (err) {\r\n\t\t\t\t\t\tres.status(500).send({ message : 'Error while saving the Target in the DB'});\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tres.status(200).send ({Target : targetSaved});\r\n\t\t\t\t\t}\r\n\t \t\t});\r\n\t \t}\r\n\t }\r\n\t});\r\n}", "title": "" }, { "docid": "3f3d1d7e912cbe94ed2c243fb1cd1e57", "score": "0.43460056", "text": "function initializeDomVariables() {\n btnResetDemoTable = document.getElementById(\"btnResetDemoTable\");\n btnResetPGTable = document.getElementById(\"btnResetPGTable\");\n btnApplyConfig = document.getElementById(\"btnApplyConfig\");\n txtPGConfig = document.getElementById(\"txtPGConfig\");\n demoTableContainer = document.getElementById(\"demo-table-container\");\n pgTableContainer = document.getElementById(\"pg-table-container\");\n\n txtPGConfig.value = JSON.stringify(DEFAULT_CONFIG, null, 2);\n }", "title": "" }, { "docid": "0745fb0543841d9ff0341681101e96cb", "score": "0.4340785", "text": "get targetParams() {\n if (this.__targetParams === null) {\n throw new Error(\"placementtool cannot be null instantiate in the __setupDefinitions\");\n }\n\n return this.__targetParams;\n }", "title": "" }, { "docid": "1963d77b2f99d60ba9603b5ae853cd6f", "score": "0.43406937", "text": "async setup() {\n debug(\"Setup Mysql Test Environment\");\n\n const { databaseOptions } = JSON.parse(\n fs.readFileSync(mysqlConfig, \"utf-8\")\n );\n\n this.global.db = mysql.createConnection(databaseOptions);\n this.global.db.connect();\n debug(\"Global Mysql connection established!\");\n await super.setup();\n }", "title": "" }, { "docid": "62c143577728052a3fca7ea5ec789e58", "score": "0.43372437", "text": "function setUpConfigurationMenu() {\n\t\tvar configurationHtml = \"<table>\" +\n\t\t\t\"<tr><td>Passing Stats:</td><td>\" + getStatTypeList(\"passing\", passingStats) + \"</td>\" +\n\t\t\t\"<td>Hitting Stats:</td><td>\" + getStatTypeList(\"hitting\", hittingStats) + \"</td></tr></table>\";\n\t\tvar configDiv = $(\"#\" + myTargetDivId + ' .configuration');\n\t\tvar contentDiv = $(\"#\" + myTargetDivId + ' .content');\n\t\tconfigDiv.html(configurationHtml);\n\n\t\t$(\"<input type='submit' value='Done Configuring' class='hoverGreen'/>\").appendTo(configDiv).click(function (jsEvent) {\n\t\t\tjsEvent.preventDefault();\n\t\t\tjsEvent.stopPropagation();\n\t\t\t\n\t\t\tpassingStats = [];\n\t\t\t$(\"#\" + myTargetDivId + ' .configuration .passing:checked').each(function () {\n\t\t\t\tpassingStats.push(Number($(this).val()));\n\t\t\t});\n\t\t\thittingStats = [];\n\t\t\t$(\"#\" + myTargetDivId + ' .configuration .hitting:checked').each(function () {\n\t\t\t\thittingStats.push(Number($(this).val()));\n\t\t\t});\n\n\t\t\trefreshDisplay();\n\t\t\t\n\t\t\tpersistValues();\n\t\t\t\n\t\t\tconfigDiv.hide(500);\n\t\t\tcontentDiv.show(500);\n\t\t});\n\t}", "title": "" }, { "docid": "3873124ade0eef5382d19750facda0d0", "score": "0.4336862", "text": "setupTaskField(aTarget, aDisable, aValue) {\n aTarget.value = aValue;\n aTarget.readOnly = aDisable;\n aTarget.ariaDisabled = aDisable;\n }", "title": "" }, { "docid": "ab9c4184ef4095c3be54a9e7a642eae8", "score": "0.43353403", "text": "function updateTarget (req, res) {\r\n\tconsole.log ('PUT /targets');\r\n\t// search for the Target in the DB\r\n\tTarget.findById(req.body.targetID, function(err, target) {\r\n\t if (err) res.status(500).send({ message : 'Error while searching the target in the DB'});\r\n\t if (!target) {\r\n\t \tres.status(404).send({ message : 'Target does not exist in the DB'});\r\n\t } else {\r\n\t\t\ttarget.name = req.body.name;\r\n\t\t\t// save the target in the DB\r\n\t\t\ttarget.save (function (err, targetStored) {\r\n\t\t\t\tif (err) res.status(500).send({ message : 'Error while saving the target in the DB'});\r\n\t\t\t\tres.status(200).send ({Target : targetStored});\r\n\t\t\t});\r\n\t }\r\n\t});\r\n}", "title": "" }, { "docid": "53082e7edec56afdc63b0a7e244057c1", "score": "0.43318933", "text": "function handle_device(topicArray, payload) {\n switch (topicArray[3]) {\n case \"config\":\n for (var obj in payload) {\n var cfg = payload[obj];\n if (cfg.enable == \"1\") {\n var insertStr = \"INSERT INTO flmconfig\" + \" (sensor, name)\" + ' VALUES (\"' + cfg.id + '\",' + ' \"' + cfg.function + '\")' + \" ON DUPLICATE KEY UPDATE\" + \" sensor = VALUES(sensor),\" + \" name = VALUES(name);\";\n database.query(insertStr, function(err, res) {\n if (err) {\n database.end();\n throw err;\n }\n });\n console.log(\"Detected sensor \" + cfg.id + \" (\" + cfg.function + \")\");\n }\n }\n break;\n\n default:\n break;\n }\n }", "title": "" }, { "docid": "6787788e3445e2bad16f1017ff812506", "score": "0.43284264", "text": "function saveTargetCount(txn, metadata) {\r\n var globalStore = txn.store(DbTargetGlobal.store);\r\n var targetStore = txn.store(DbTarget.store);\r\n return targetStore.count().next(function (count) {\r\n metadata.targetCount = count;\r\n return globalStore.put(DbTargetGlobal.key, metadata);\r\n });\r\n}", "title": "" }, { "docid": "3b346714a3b0eb32e5355f42b83edc33", "score": "0.4323831", "text": "function loadManual() {\n const $$form = $$(`hhm-config-form-manual`);\n\n const config = {\n room: {\n roomName: $$form.elements.roomName.getValue(),\n playerName: $$form.elements.playerName.getValue(),\n maxPlayers: parseInt($$form.elements.maxPlayers.getValue()) || 16,\n public: Boolean($$form.elements.public.getValue()),\n geo: {\n code: $$form.elements.geoCode.getValue(),\n lat: parseFloat($$form.elements.geoLat.getValue()) || 60.192059,\n lon: parseFloat($$form.elements.geoLon.getValue()) || 24.945831,\n }\n },\n dryRun: Boolean($$form.elements.dryRun.getValue()),\n repositories: [\n {\n url: `https://haxplugins.tk/plugins/`,\n }\n ]\n };\n\n if ($$form.elements.password.getValue() !== ``) {\n config.room.password = $$form.elements.password.getValue();\n }\n\n if ($$form.elements.postInitCode.getValue() !== ``) {\n config.postInit = $$form.elements.postInitCode.getValue();\n }\n\n HHM.config = config;\n\n HHM.deferreds.configLoaded.resolve();\n}", "title": "" }, { "docid": "d80bf090df6d797195b1de86feafd61b", "score": "0.4320027", "text": "getInitialDBConfig(skillParams) {\n var paramValueObj = skillParams.paramsObj;\n var initialConfig = {\n \"objects\": []\n };\n var DataJSON = this.importDialogInputJSON\n // change objType name - done\n for (var objtype in DataJSON){\n var DBObj = {\n \"objectType\":objtype,\n \"names\":[]\n };\n for(var dataObject in DataJSON[objtype])\n {\n DBObj.names.push(DataJSON[objtype][dataObject].name);\n }\n initialConfig.objects.push(DBObj);\n }\n // change name of the saveXMLDynamicResource - changes to saveTaskDynamicResource\n return skillParams.taskParams.dbFilestoreMgr.saveTaskDynamicResource(skillParams.taskParams,JSON.stringify(initialConfig),\"InitialConfig.json\").then( (resolvePath)=>{\n var preloadResArr = [];\n var finalPath = resolvePath\n preloadResArr.push({ \"path\": \"\" + finalPath, \"type\": \"json\" })\n var resolveParams = { \"attrValue\": finalPath, \"preloadResArr\": preloadResArr }\n\n return Promise.resolve(resolveParams);\n });\n }", "title": "" }, { "docid": "8f1b9fb510e08b674960a1f1c8644ef4", "score": "0.4319645", "text": "prepareBaseData() {}", "title": "" }, { "docid": "e048c5c7551bf17637fbeb40e52cc733", "score": "0.43165746", "text": "function TargetGroupsConfig() {\n _classCallCheck(this, TargetGroupsConfig);\n\n TargetGroupsConfig.initialize(this);\n }", "title": "" }, { "docid": "54b55a1a5cc0920b75497d72e736934f", "score": "0.43096384", "text": "configure() {\n // Only link adjacent Modules if they are both active\n this._links.forEach(([linkKey, linkedValue, consumerKey, producerKey]) => {\n if (this._dag.node(consumerKey).value() === 'active' && this._dag.node(producerKey).value() === 'active') {\n this._dag.node(linkKey)._value = linkedValue;\n } else {\n this._dag.node(linkKey)._value = 'standAlone';\n }\n }); // Enable/disable DagNodes based on whether their Module is active/inactive\n\n\n this._modules.forEach(([moduleKey, prefixes]) => {\n this._dag.setEnabled(prefixes, this._dag.node(moduleKey).value() === 'active');\n });\n }", "title": "" }, { "docid": "f0a3e7406f4a60bb3b2bfb06ab4c94a3", "score": "0.4305769", "text": "function setup() {\n User.sync({ force: true }) // Using 'force: true' drops the table Users if it already exists and then creates a new one.\n .then(function() {\n // Add default users to the database\n // for (var i = 0; i < users.length; i++) {\n // // loop through all users\n User.create({ name: users[0] }); // create a new entry in the users table\n // }\n });\n Activity.sync({ force: true }).then(() => {\n defaultActivities.forEach(a => {\n Activity.create({\n title: a,\n active: true\n });\n });\n });\n ActivityLog.sync({ force: false });\n}", "title": "" }, { "docid": "cac9443128cba8d7f9dfa6e1a6ec8394", "score": "0.42994165", "text": "function populateDataSources(root) {\n\tif (typeof root == \"object\") {\n\t\tlet dsConfigs = root.getElementsByTagName(\"config\");\n\n\t if (dsConfigs.length == 0 || dsConfigs === undefined || dsConfigs === null) {\n\t $(\"#ds-datasources-table\").hide();\n\t $(\"#ds-table-notification-alert-holder\").show();\n\t showDSTableNotification(\"info\", \"No data sources available. Click 'Add New' to create a new data source.\", 0);\n\t return;\n\t }\n\n\t $(\"#ds-datasources-table\").show();\n\t $(\"#ds-table-notification-alert-holder\").hide();\n\t $(\"#ds-datasources-table tbody tr\").remove();\n\t for (let i = 0, len = dsConfigs.length; i < len; i++) {\n\t let dsName = dsConfigs[i].id;\n\t if (dsName == undefined) {\n\t \tdsName = dsConfigs[i].attributes.getNamedItem(\"id\").value;\n\t }\n\t let markup = \"<tr\" + \" data-id='\" + dsName + \"'\" + \"><td>\" + dsName + \"</td><td class='text-center'>\" +\n\t \"<i class='fa fa-edit'></i><i class='fa fa-trash'></i></td></tr>\";\n\n\t $(\"#ds-datasources-table tbody\").append(markup);\n\t }\n\t}\n}", "title": "" }, { "docid": "cac9443128cba8d7f9dfa6e1a6ec8394", "score": "0.42994165", "text": "function populateDataSources(root) {\n\tif (typeof root == \"object\") {\n\t\tlet dsConfigs = root.getElementsByTagName(\"config\");\n\n\t if (dsConfigs.length == 0 || dsConfigs === undefined || dsConfigs === null) {\n\t $(\"#ds-datasources-table\").hide();\n\t $(\"#ds-table-notification-alert-holder\").show();\n\t showDSTableNotification(\"info\", \"No data sources available. Click 'Add New' to create a new data source.\", 0);\n\t return;\n\t }\n\n\t $(\"#ds-datasources-table\").show();\n\t $(\"#ds-table-notification-alert-holder\").hide();\n\t $(\"#ds-datasources-table tbody tr\").remove();\n\t for (let i = 0, len = dsConfigs.length; i < len; i++) {\n\t let dsName = dsConfigs[i].id;\n\t if (dsName == undefined) {\n\t \tdsName = dsConfigs[i].attributes.getNamedItem(\"id\").value;\n\t }\n\t let markup = \"<tr\" + \" data-id='\" + dsName + \"'\" + \"><td>\" + dsName + \"</td><td class='text-center'>\" +\n\t \"<i class='fa fa-edit'></i><i class='fa fa-trash'></i></td></tr>\";\n\n\t $(\"#ds-datasources-table tbody\").append(markup);\n\t }\n\t}\n}", "title": "" }, { "docid": "b800ccb91901f65835d3b0bd50beaeb2", "score": "0.4298377", "text": "async function storeRecord(targetTempValue, actualTempValue, room) {\n //Generate a date/timestamp \n let date = new Date();\n let hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n let min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n let sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n let year = date.getFullYear();\n let month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n let day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n let dateAndTimeFormatting = year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + min + \":\" + sec;\n\n const connection = await mysql.createConnection(info.config)\n let sql = `INSERT INTO temperaturelog(Room, DateTime, Temperature, Target_Temperature) VALUES('${room}', '${dateAndTimeFormatting}', '${actualTempValue}', '${targetTempValue}')`;\n await connection.query(sql);\n}", "title": "" }, { "docid": "d94bf9f25a520718c75bb4c718614a1c", "score": "0.42951918", "text": "function addNameConfig(config, modName, prefix)\n{\n let baseName = modName.split('/').pop(); // GPIO\n let fullName = modName.replace(/\\//g, '_').substring(1); // ti_drivers_GPIO\n //let docsDir = modName.split('/').slice(0, -1).join(\"\"); // tidrivers\n let docsDir = \"tidrivers\"; // Since this function is tidrivers specific\n\n let nameCfg = {\n name: \"$name\",\n description: \"The C/C++ identifier used in applications as the index\"\n + \" parameter passed to \" + baseName + \" runtime APIs\",\n\n /* TODO: The name should be declared as an extern const in ti_drivers_config.h\n * and defined in ti_drivers_config.c. Using an extern const\n * allows libraries to define symbolic names for GPIO\n * signals they require for their use _without_ requiring\n * editing or rebuilding of the library source files.\n */\n longDescription: \"This name is declared in the generated ti_drivers_config.h\"\n + \" file so applications can reference this instance\"\n + \" symbolically. It can be set to any globally unique\"\n + \" name that is also a valid C/C++ identifier.\"\n + \"\\n[More ...](/\" + docsDir\n + \"/syscfg/html/ConfigDoc.html#\"\n + fullName + \"_$name \\\"\"\n + baseName + \" Name reference documentation\\\")\",\n\n documentation: \"\\n\\n\"\n + \"The SysConfig tooling ensures that _all_ names defined\"\n + \" in a configuration are unique. When instances are\"\n + \" first created, SysConfig gives them a default name,\"\n + \" `\" + prefix + \"`, that's made unique by appending a\"\n + \" numeric id. If you provide a name, it's checked\"\n + \" against all other instance names in the configuration\"\n + \" and, if another instance has the same name, an error is\"\n + \" triggered.\"\n + \"\\n\\n\"\n + \"Note: since not all names are added to ti_drivers_config.h,\"\n + \" it's possible that some names will not be allowed even\"\n + \" though they do not actually collide in the generated\"\n + \" files.\"\n };\n\n return ([nameCfg].concat(config));\n}", "title": "" }, { "docid": "7530b1bbe460064be48f19d3704dde37", "score": "0.4293923", "text": "_saveConfig() {\n let confData = _userEvents.loadUserConfig();\n\n let title = $(\"#conf-input-title\").val();\n confData.dashboardConfig.setTitle(title);\n\n let serverList = [];\n let servers = $(\".conf-server-table tr\");\n\n servers.each(index => {\n serverList.push({\n name: servers[index].childNodes[0].innerHTML,\n url: servers[index].childNodes[1].innerHTML\n });\n });\n // Remove invalid entry for the last row\n serverList.pop();\n\n serverList.sort((s1, s2) => {\n if (s1.name != s2.name) return s1.name.localeCompare(s2.name);\n else return s1.url.localeCompare(s2.url);\n });\n\n confData.dashboardConfig.setServerList(serverList);\n _userConfigurationView._setModified(false);\n }", "title": "" }, { "docid": "11fa6943b04da5a00b642e97cd2b1591", "score": "0.42899418", "text": "function _handleConfigure () {\n app.commands.execute('application:preferences', 'psqlddl')\n}", "title": "" }, { "docid": "2973226dce7c06e157bde35da53c54de", "score": "0.4280385", "text": "function setupLinkedNode(nodes, contextObj, targetRecordset, ix, keyingValue) {\n if (targetRecordset.length < 1 || targetRecordset[0] === null) {\n return null;\n }\n let idValuesForFieldName = {}\n const currentContextDef = contextObj.getContextDef()\n const linkedElements\n = INTERMediatorLib.seekLinkedAndWidgetNodes(nodes, INTERMediator.crossTableStage === 0)\n const currentWidgetNodes = linkedElements.widgetNode\n const currentLinkedNodes = linkedElements.linkedNode\n try {\n const keyField = contextObj.getKeyField()\n if (targetRecordset[ix] && (targetRecordset[ix][keyField] || targetRecordset[ix][keyField] === 0)) {\n for (let k = 0; k < currentLinkedNodes.length; k++) {\n // for each linked element\n const nodeId = currentLinkedNodes[k].getAttribute('id')\n const replacedNode = INTERMediator.setIdValue(currentLinkedNodes[k])\n contextObj.setupLookup(currentLinkedNodes[k], targetRecordset[ix][keyField])\n const typeAttr = replacedNode.getAttribute('type')\n if (typeAttr === 'checkbox' || typeAttr === 'radio') {\n const children = replacedNode.parentNode.childNodes\n for (let i = 0; i < children.length; i++) {\n if (children[i].nodeType === 1 && children[i].tagName === 'LABEL' &&\n nodeId === children[i].getAttribute('for')) {\n children[i].setAttribute('for', replacedNode.getAttribute('id'))\n break\n }\n }\n }\n }\n for (let k = 0; k < currentWidgetNodes.length; k++) {\n const wInfo = INTERMediatorLib.getWidgetInfo(currentWidgetNodes[k])\n if (wInfo[0]) {\n IMParts_Catalog[wInfo[0]].instanciate(currentWidgetNodes[k])\n if (imPartsShouldFinished.indexOf(IMParts_Catalog[wInfo[0]]) < 0) {\n imPartsShouldFinished.push(IMParts_Catalog[wInfo[0]])\n }\n }\n }\n }\n } catch (ex) {\n if (ex.message === '_im_auth_required_') {\n throw ex\n } else {\n INTERMediatorLog.setErrorMessage(ex, 'EXCEPTION-101')\n }\n }\n\n const nameTable = {}\n for (let k = 0; k < currentLinkedNodes.length; k++) {\n try {\n let nodeId = currentLinkedNodes[k].getAttribute('id')\n if (INTERMediatorLib.isWidgetElement(currentLinkedNodes[k])) {\n nodeId = currentLinkedNodes[k]._im_getComponentId()\n // INTERMediator.widgetElementIds.push(nodeId)\n }\n // get the tag name of the element\n const typeAttr = currentLinkedNodes[k].getAttribute('type')// type attribute\n const linkInfoArray = INTERMediatorLib.getLinkedElementInfo(currentLinkedNodes[k])\n // info array for it set the name attribute of radio button\n // should be different for each group\n if (typeAttr === 'radio') { // set the value to radio button\n const nameTableKey = linkInfoArray.join('|')\n if (!nameTable[nameTableKey]) {\n nameTable[nameTableKey] = nameAttrCounter\n nameAttrCounter++\n }\n const nameNumber = nameTable[nameTableKey]\n const nameAttr = currentLinkedNodes[k].getAttribute('name')\n if (nameAttr) {\n currentLinkedNodes[k].setAttribute('name', nameAttr + '-' + nameNumber)\n } else {\n currentLinkedNodes[k].setAttribute('name', 'IM-R-' + nameNumber)\n }\n }\n for (let j = 0; j < linkInfoArray.length; j++) {\n const nInfo = INTERMediatorLib.getNodeInfoArray(linkInfoArray[j])\n const curVal = targetRecordset[ix][nInfo.field]\n if (!INTERMediator.isDBDataPreferable || curVal) {\n IMLibCalc.updateCalculationInfo(contextObj, keyingValue, nodeId, nInfo, targetRecordset[ix])\n }\n if (nInfo.table === currentContextDef.name) {\n const curTarget = nInfo.target\n if (IMLibElement.setValueToIMNode(currentLinkedNodes[k], curTarget, curVal)) {\n postSetFields.push({'id': nodeId, 'value': curVal})\n }\n contextObj.setValue(keyingValue, nInfo.field, curVal, nodeId, curTarget)\n if (typeof (idValuesForFieldName[nInfo.field]) === 'undefined') {\n idValuesForFieldName[nInfo.field] = []\n }\n idValuesForFieldName[nInfo.field].push(nodeId)\n }\n }\n } catch (ex) {\n if (ex.message === '_im_auth_required_') {\n throw ex\n } else {\n INTERMediatorLog.setErrorMessage(ex, 'EXCEPTION-27')\n }\n }\n }\n return idValuesForFieldName\n }", "title": "" }, { "docid": "fe0538d8b236fa7813cdf28172d27422", "score": "0.4280368", "text": "function saveTargetCount(txn, metadata) {\n var globalStore = txn.store(DbTargetGlobal.store);\n var targetStore = txn.store(DbTarget.store);\n return targetStore.count().next(function (count) {\n metadata.targetCount = count;\n return globalStore.put(DbTargetGlobal.key, metadata);\n });\n}", "title": "" }, { "docid": "fe0538d8b236fa7813cdf28172d27422", "score": "0.4280368", "text": "function saveTargetCount(txn, metadata) {\n var globalStore = txn.store(DbTargetGlobal.store);\n var targetStore = txn.store(DbTarget.store);\n return targetStore.count().next(function (count) {\n metadata.targetCount = count;\n return globalStore.put(DbTargetGlobal.key, metadata);\n });\n}", "title": "" }, { "docid": "fe0538d8b236fa7813cdf28172d27422", "score": "0.4280368", "text": "function saveTargetCount(txn, metadata) {\n var globalStore = txn.store(DbTargetGlobal.store);\n var targetStore = txn.store(DbTarget.store);\n return targetStore.count().next(function (count) {\n metadata.targetCount = count;\n return globalStore.put(DbTargetGlobal.key, metadata);\n });\n}", "title": "" }, { "docid": "021163967dabd39c9953aaf8331d7895", "score": "0.4272812", "text": "function targetDropdownChange(args) {\n targetID = args.value;\n}", "title": "" }, { "docid": "509cdaaba5796001a7ac6aee6d69e78b", "score": "0.427083", "text": "setup()\n {\n // Some helpers\n const siteTemplate = this.options.siteTemplate || '${site.name.urlify()}';\n const entityCategoryTemplate = siteTemplate + '/' + (this.options.entityCategoryTemplate || '${entityCategory.pluralName.urlify()}');\n const entityIdTemplate = entityCategoryTemplate + '/' + (this.options.entityIdTemplate || '${entityCategory.shortName.urlify()}-${entityId.name.urlify()}');\n\n // Settings\n this.settings.add(\n {\n formats:\n {\n date: 'DD.MM.YYYY',\n number: '0.00'\n }\n });\n if (this.options.settings)\n {\n this.settings.add(this.options.settings);\n }\n\n // Urls\n this.urls.add(\n {\n root: '',\n siteTemplate: '${root}/' + siteTemplate,\n entityCategoryTemplate: '${root}/' + entityCategoryTemplate,\n entityIdTemplate: '${root}/' + entityIdTemplate\n });\n\n // Pathes\n this.pathes.add(\n this.clean(\n {\n root: this.options.pathes.root,\n entojTemplate: this.options.pathes.entoj || '${root}',\n cacheTemplate: '${entoj}/cache',\n sitesTemplate: '${root}/sites',\n siteTemplate: '${sites}/' + siteTemplate,\n entityCategoryTemplate: '${sites}/' + entityCategoryTemplate,\n entityIdTemplate: '${sites}/' + entityIdTemplate\n }));\n\n // Sites\n this.mappings.add(require('../model/index.js').site.SitesLoader,\n {\n '!plugins':\n [\n require('../model/index.js').loader.documentation.PackagePlugin,\n require('../model/index.js').loader.documentation.MarkdownPlugin\n ]\n });\n\n // EntityCategories\n const entityCategories = this.options.entityCategories ||\n [\n {\n longName: 'Global',\n pluralName: 'Global',\n isGlobal: true\n },\n {\n longName: 'Atom'\n },\n {\n longName: 'Molecule'\n },\n {\n longName: 'Organism'\n },\n {\n longName: 'Template'\n },\n {\n longName: 'Page'\n }\n ];\n this.mappings.add(require('../model/index.js').entity.EntityCategoriesLoader,\n this.clean(\n {\n categories: entityCategories\n }));\n\n // Entities\n this.mappings.add(require('../parser/index.js').entity.CompactIdParser,\n {\n options:\n {\n useNumbers: this.options.entityIdUseNumbers || false\n }\n });\n this.mappings.add(require('../model/index.js').entity.EntitiesLoader,\n {\n '!plugins':\n [\n require('../model/index.js').loader.documentation.PackagePlugin,\n {\n type: require('../model/index.js').loader.documentation.MarkdownPlugin,\n options:\n {\n sections:\n {\n DESCRIPTION: 'Abstract',\n FUNCTIONAL: 'Functional'\n }\n }\n },\n require('../model/index.js').loader.documentation.JinjaPlugin,\n require('../model/index.js').loader.documentation.ExamplePlugin,\n require('../model/index.js').loader.documentation.StyleguidePlugin\n ]\n });\n\n // ViewModel\n this.mappings.add(require('../model/index.js').viewmodel.ViewModelRepository,\n {\n '!plugins':\n [\n require('../model/index.js').viewmodel.plugin.ViewModelImportPlugin,\n require('../model/index.js').viewmodel.plugin.ViewModelLipsumPlugin,\n require('../model/index.js').viewmodel.plugin.ViewModelLipsumHtmlPlugin,\n require('../model/index.js').viewmodel.plugin.ViewModelTranslatePlugin\n ]\n });\n\n // Translations\n this.mappings.add(require('../model/index.js').translation.TranslationsLoader,\n this.clean(\n {\n filenameTemplate: this.options.models.translationFileTemplate || this.options.models.translationsFile\n }));\n\n // Settings\n this.mappings.add(require('../model/index.js').setting.SettingsLoader,\n this.clean(\n {\n filenameTemplate: this.options.models.settingsFile\n }));\n\n // ModelSynchronizer\n this.mappings.add(require('../watch/index.js').ModelSynchronizer,\n {\n '!plugins':\n [\n require('../watch/index.js').ModelSynchronizerTranslationsPlugin,\n require('../watch/index.js').ModelSynchronizerSettingsPlugin,\n require('../watch/index.js').ModelSynchronizerEntitiesPlugin,\n require('../watch/index.js').ModelSynchronizerSitesPlugin\n ]\n });\n\n // Nunjucks filter & tags\n this.mappings.add(require('../nunjucks/index.js').Environment,\n {\n options:\n {\n templatePaths: this.pathes.root + '/sites'\n },\n '!helpers':\n [\n {\n type: require('../nunjucks/index.js').helper.LipsumHelper\n }\n ],\n '!tags':\n [\n {\n type: require('../nunjucks/index.js').tag.ConfigurationTag\n }\n ],\n '!filters': this.clean(\n [\n {\n type: require('../nunjucks/index.js').filter.AssetUrlFilter,\n baseUrl: this.options.filters.assetUrl\n },\n {\n type: require('../nunjucks/index.js').filter.AttributeFilter\n },\n {\n type: require('../nunjucks/index.js').filter.AttributesFilter\n },\n {\n type: require('../nunjucks/index.js').filter.ConfigurationFilter\n },\n {\n type: require('../nunjucks/index.js').filter.DebugFilter\n },\n {\n type: require('../nunjucks/index.js').filter.EmptyFilter\n },\n {\n type: require('../nunjucks/index.js').filter.FormatDateFilter\n },\n {\n type: require('../nunjucks/index.js').filter.FormatNumberFilter\n },\n {\n type: require('../nunjucks/index.js').filter.HyphenateFilter\n },\n {\n type: require('../nunjucks/index.js').filter.JsonEncodeFilter\n },\n {\n type: require('../nunjucks/index.js').filter.LinkUrlFilter,\n dataProperties: this.options.filters.linkProperties\n },\n {\n type: require('../nunjucks/index.js').filter.LipsumFilter\n },\n {\n type: require('../nunjucks/index.js').filter.LoadFilter\n },\n {\n type: require('../nunjucks/index.js').filter.MarkdownFilter\n },\n {\n type: require('../nunjucks/index.js').filter.MarkupFilter,\n styles: this.options.filters.markupStyles\n },\n {\n type: require('../nunjucks/index.js').filter.MediaQueryFilter\n },\n {\n type: require('../nunjucks/index.js').filter.ModuleClassesFilter\n },\n {\n type: require('../nunjucks/index.js').filter.NotEmptyFilter\n },\n {\n type: require('../nunjucks/index.js').filter.GetFilter\n },\n {\n type: require('../nunjucks/index.js').filter.SetFilter\n },\n {\n type: require('../nunjucks/index.js').filter.SettingFilter\n },\n {\n type: require('../nunjucks/index.js').filter.SvgUrlFilter,\n baseUrl: this.options.filters.svgUrl || '/'\n },\n {\n type: require('../nunjucks/index.js').filter.SvgViewBoxFilter,\n basePath: this.options.filters.svgPath || '/'\n },\n {\n type: require('../nunjucks/index.js').filter.TranslateFilter\n },\n {\n type: require('../nunjucks/index.js').filter.TranslationsFilter\n },\n {\n type: require('../nunjucks/index.js').filter.UniqueFilter\n }\n ])\n }\n );\n\n // Linter\n this.commands.add(require('../command/index.js').LintCommand,\n {\n '!linters':\n [\n {\n type: require('../linter/index.js').NunjucksFileLinter\n }\n ]\n });\n\n // Server\n this.commands.add(require('../command/index.js').ServerCommand,\n {\n options:\n {\n port: this.options.server.port || this.local.port || 3000,\n http2: this.options.server.http2 || this.local.http2 || false,\n sslKey: this.options.server.sslKey || this.local.sslKey || false,\n sslCert: this.options.server.sslCert || this.local.sslCert || false,\n authentication: this.local.authentication || false,\n credentials: this.options.server.credentials || this.local.credentials || { username: 'entoj', password: 'entoj' },\n routes:\n [\n {\n type: require('../server/index.js').route.StaticFileRoute,\n options:\n {\n basePath: '${sites}',\n allowedExtensions: this.options.server.staticExtensions\n }\n },\n {\n type: require('../server/index.js').route.EntityTemplateRoute,\n options:\n {\n basePath: '${sites}'\n }\n }\n ]\n }\n }\n );\n\n\n // Config\n this.commands.add(require('../command/index.js').ConfigCommand);\n }", "title": "" }, { "docid": "5f3d3404ee7b56022b21ed34c88beeb0", "score": "0.42696488", "text": "function AddDefaultValusForScenarios () {\n\tvar DBFeaso = Ti.Database.open('QwikFeaso');\n DBFeaso.execute('create table if not exists DefaultValusForScenarios(DefaultValusForScenariosID INTEGER PRIMARY KEY AUTOINCREMENT,CostGroupsID INT,CostElementID INT,FeasibilityID INT,DefaultValue INT,IsDeleted INT);');\n DBFeaso.execute('BEGIN;');\n resultset=DBFeaso.execute('select * from DefaultValusForScenarios');\n \n var DefaultScenarioValus=[{geID:10,GrpID:4,IsDeleted:0,fesibilityID:1,Value:500},{geID:10,GrpID:4,IsDeleted:0,fesibilityID:2,Value:20000},{geID:10,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:10,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:11,GrpID:4,IsDeleted:0,fesibilityID:1,Value:3500},{geID:11,GrpID:4,IsDeleted:0,fesibilityID:2,Value:15000},{geID:11,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:11,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:12,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:12,GrpID:4,IsDeleted:0,fesibilityID:2,Value:2500},{geID:12,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:12,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:13,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:13,GrpID:4,IsDeleted:0,fesibilityID:2,Value:3000},{geID:13,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:13,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:14,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:14,GrpID:4,IsDeleted:0,fesibilityID:2,Value:1500},{geID:14,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:14,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:15,GrpID:4,IsDeleted:0,fesibilityID:1,Value:2000},{geID:15,GrpID:4,IsDeleted:0,fesibilityID:2,Value:5000},{geID:15,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:15,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:16,GrpID:4,IsDeleted:0,fesibilityID:1,Value:2500},{geID:16,GrpID:4,IsDeleted:0,fesibilityID:2,Value:4000},{geID:16,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:16,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:17,GrpID:4,IsDeleted:0,fesibilityID:1,Value:1500},{geID:17,GrpID:4,IsDeleted:0,fesibilityID:2,Value:2500},{geID:17,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:17,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:18,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:18,GrpID:4,IsDeleted:0,fesibilityID:2,Value:5000},{geID:18,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:18,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:19,GrpID:4,IsDeleted:0,fesibilityID:1,Value:1500},{geID:19,GrpID:4,IsDeleted:0,fesibilityID:2,Value:1500},{geID:19,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:19,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:20,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:20,GrpID:4,IsDeleted:0,fesibilityID:2,Value:5000},{geID:20,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:20,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:21,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:21,GrpID:4,IsDeleted:0,fesibilityID:2,Value:1000},{geID:21,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:21,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:22,GrpID:4,IsDeleted:0,fesibilityID:1,Value:0},{geID:22,GrpID:4,IsDeleted:0,fesibilityID:2,Value:20000},{geID:22,GrpID:4,IsDeleted:0,fesibilityID:3,Value:0},{geID:22,GrpID:4,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{geID:23,GrpID:5,IsDeleted:0,fesibilityID:1,Value:0},{geID:23,GrpID:5,IsDeleted:0,fesibilityID:2,Value:20000},{geID:23,GrpID:5,IsDeleted:0,fesibilityID:3,Value:20000},{geID:23,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:24,GrpID:5,IsDeleted:0,fesibilityID:1,Value:2000},{geID:24,GrpID:5,IsDeleted:0,fesibilityID:2,Value:3000},{geID:24,GrpID:5,IsDeleted:0,fesibilityID:3,Value:3000},{geID:24,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:25,GrpID:5,IsDeleted:0,fesibilityID:1,Value:0},{geID:25,GrpID:5,IsDeleted:0,fesibilityID:2,Value:2000},{geID:25,GrpID:5,IsDeleted:0,fesibilityID:3,Value:2000},{geID:25,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:26,GrpID:5,IsDeleted:0,fesibilityID:1,Value:2000},{geID:26,GrpID:5,IsDeleted:0,fesibilityID:2,Value:5000},{geID:26,GrpID:5,IsDeleted:0,fesibilityID:3,Value:5000},{geID:26,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:27,GrpID:5,IsDeleted:0,fesibilityID:1,Value:0},{geID:27,GrpID:5,IsDeleted:0,fesibilityID:2,Value:5000},{geID:27,GrpID:5,IsDeleted:0,fesibilityID:3,Value:5000},{geID:27,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:28,GrpID:5,IsDeleted:0,fesibilityID:1,Value:0},{geID:28,GrpID:5,IsDeleted:0,fesibilityID:2,Value:12000},{geID:28,GrpID:5,IsDeleted:0,fesibilityID:3,Value:12000},{geID:28,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:29,GrpID:5,IsDeleted:0,fesibilityID:1,Value:0},{geID:29,GrpID:5,IsDeleted:0,fesibilityID:2,Value:7500},{geID:29,GrpID:5,IsDeleted:0,fesibilityID:3,Value:7500},{geID:29,GrpID:5,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t\n \t\t\t\t{geID:32,GrpID:6,IsDeleted:0,fesibilityID:1,Value:26000},{geID:32,GrpID:6,IsDeleted:0,fesibilityID:2,Value:25000},{geID:32,GrpID:6,IsDeleted:0,fesibilityID:3,Value:25000},{geID:32,GrpID:6,IsDeleted:0,fesibilityID:4,Value:25000},\n\t\t\t\t\n\t\t\t\t{geID:33,GrpID:8,IsDeleted:0,fesibilityID:1,Value:0},{geID:33,GrpID:8,IsDeleted:0,fesibilityID:2,Value:80000},{geID:33,GrpID:8,IsDeleted:0,fesibilityID:3,Value:65000},{geID:33,GrpID:8,IsDeleted:0,fesibilityID:4,Value:50000},\n\t\t\t\t{geID:34,GrpID:7,IsDeleted:0,fesibilityID:1,Value:2500},{geID:34,GrpID:7,IsDeleted:0,fesibilityID:2,Value:25000},{geID:34,GrpID:7,IsDeleted:0,fesibilityID:3,Value:25000},{geID:34,GrpID:7,IsDeleted:0,fesibilityID:4,Value:25000},\n\t\t\t\t{geID:35,GrpID:7,IsDeleted:0,fesibilityID:1,Value:2500},{geID:35,GrpID:7,IsDeleted:0,fesibilityID:2,Value:10000},{geID:35,GrpID:7,IsDeleted:0,fesibilityID:3,Value:10000},{geID:35,GrpID:7,IsDeleted:0,fesibilityID:4,Value:10000},\n\t\t\t\t{geID:36,GrpID:7,IsDeleted:0,fesibilityID:1,Value:0},{geID:36,GrpID:7,IsDeleted:0,fesibilityID:2,Value:5000},{geID:36,GrpID:7,IsDeleted:0,fesibilityID:3,Value:5000},{geID:36,GrpID:7,IsDeleted:0,fesibilityID:4,Value:5000},\n\t\t\t\t{geID:37,GrpID:7,IsDeleted:0,fesibilityID:1,Value:1500},{geID:37,GrpID:7,IsDeleted:0,fesibilityID:2,Value:2500},{geID:37,GrpID:7,IsDeleted:0,fesibilityID:3,Value:2500},{geID:37,GrpID:7,IsDeleted:0,fesibilityID:4,Value:2500},\n\t\t\t\t{geID:38,GrpID:7,IsDeleted:0,fesibilityID:1,Value:0},{geID:38,GrpID:7,IsDeleted:0,fesibilityID:2,Value:2000},{geID:38,GrpID:7,IsDeleted:0,fesibilityID:3,Value:2000},{geID:38,GrpID:7,IsDeleted:0,fesibilityID:4,Value:2000},\n\t\t\t\t{geID:39,GrpID:7,IsDeleted:0,fesibilityID:1,Value:0},{geID:39,GrpID:7,IsDeleted:0,fesibilityID:2,Value:5000},{geID:39,GrpID:7,IsDeleted:0,fesibilityID:3,Value:5000},{geID:39,GrpID:7,IsDeleted:0,fesibilityID:4,Value:5000},\n\t\t\t\t{geID:40,GrpID:7,IsDeleted:0,fesibilityID:1,Value:0},{geID:40,GrpID:7,IsDeleted:0,fesibilityID:2,Value:0},{geID:40,GrpID:7,IsDeleted:0,fesibilityID:3,Value:0},{geID:40,GrpID:7,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:41,GrpID:7,IsDeleted:0,fesibilityID:1,Value:1500},{geID:41,GrpID:7,IsDeleted:0,fesibilityID:2,Value:1500},{geID:41,GrpID:7,IsDeleted:0,fesibilityID:3,Value:1500},{geID:41,GrpID:7,IsDeleted:0,fesibilityID:4,Value:1500},\n\t\t\t\t{geID:42,GrpID:7,IsDeleted:0,fesibilityID:1,Value:0},{geID:42,GrpID:7,IsDeleted:0,fesibilityID:2,Value:40000},{geID:42,GrpID:7,IsDeleted:0,fesibilityID:3,Value:40000},{geID:42,GrpID:7,IsDeleted:0,fesibilityID:4,Value:40000},\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{geID:47,GrpID:9,IsDeleted:0,fesibilityID:1,Value:4000},{geID:47,GrpID:9,IsDeleted:0,fesibilityID:2,Value:8000},{geID:47,GrpID:9,IsDeleted:0,fesibilityID:3,Value:8000},{geID:47,GrpID:9,IsDeleted:0,fesibilityID:4,Value:8000},\n\t\t\t\t{geID:48,GrpID:9,IsDeleted:0,fesibilityID:1,Value:2000},{geID:48,GrpID:9,IsDeleted:0,fesibilityID:2,Value:6000},{geID:48,GrpID:9,IsDeleted:0,fesibilityID:3,Value:6000},{geID:48,GrpID:9,IsDeleted:0,fesibilityID:4,Value:6000},\n\t\t\t\t{geID:49,GrpID:9,IsDeleted:0,fesibilityID:1,Value:1000},{geID:49,GrpID:9,IsDeleted:0,fesibilityID:2,Value:2000},{geID:49,GrpID:9,IsDeleted:0,fesibilityID:3,Value:2000},{geID:49,GrpID:9,IsDeleted:0,fesibilityID:4,Value:2000},\n\t\t\t\t{geID:50,GrpID:9,IsDeleted:0,fesibilityID:1,Value:1000},{geID:50,GrpID:9,IsDeleted:0,fesibilityID:2,Value:10000},{geID:50,GrpID:9,IsDeleted:0,fesibilityID:3,Value:10000},{geID:50,GrpID:9,IsDeleted:0,fesibilityID:4,Value:10000},\n\t\t\t\t\n\t\t\t\t{geID:53,GrpID:12,IsDeleted:0,fesibilityID:1,Value:1},{geID:53,GrpID:12,IsDeleted:0,fesibilityID:2,Value:1},{geID:53,GrpID:12,IsDeleted:0,fesibilityID:3,Value:1},{geID:53,GrpID:12,IsDeleted:0,fesibilityID:4,Value:1},\n\t\t\t\t{geID:54,GrpID:12,IsDeleted:0,fesibilityID:1,Value:1},{geID:54,GrpID:12,IsDeleted:0,fesibilityID:2,Value:3},{geID:54,GrpID:12,IsDeleted:0,fesibilityID:3,Value:3},{geID:54,GrpID:12,IsDeleted:0,fesibilityID:4,Value:3},\n\t\t\t\t{geID:55,GrpID:12,IsDeleted:0,fesibilityID:1,Value:1},{geID:55,GrpID:12,IsDeleted:0,fesibilityID:2,Value:12},{geID:55,GrpID:12,IsDeleted:0,fesibilityID:3,Value:0},{geID:55,GrpID:12,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:56,GrpID:12,IsDeleted:0,fesibilityID:1,Value:0},{geID:56,GrpID:12,IsDeleted:0,fesibilityID:2,Value:3},{geID:56,GrpID:12,IsDeleted:0,fesibilityID:3,Value:3},{geID:56,GrpID:12,IsDeleted:0,fesibilityID:4,Value:0},\n\t\t\t\t{geID:57,GrpID:12,IsDeleted:0,fesibilityID:1,Value:0},{geID:57,GrpID:12,IsDeleted:0,fesibilityID:2,Value:9},{geID:57,GrpID:12,IsDeleted:0,fesibilityID:3,Value:9},{geID:57,GrpID:12,IsDeleted:0,fesibilityID:4,Value:9},\n\t\t\t\t{geID:58,GrpID:12,IsDeleted:0,fesibilityID:1,Value:3},{geID:58,GrpID:12,IsDeleted:0,fesibilityID:2,Value:3},{geID:58,GrpID:12,IsDeleted:0,fesibilityID:3,Value:3},{geID:58,GrpID:12,IsDeleted:0,fesibilityID:4,Value:3},\n\t\t\t];\n if(!resultset.isValidRow())\n \t{\n \t\tfor(var i=0;i<DefaultScenarioValus.length;i++)\n \t\t{\n \t\tDBFeaso.execute('insert into DefaultValusForScenarios(CostGroupsID,CostElementID,FeasibilityID,DefaultValue,IsDeleted) values(?,?,?,?,?)',\n \t\t\tDefaultScenarioValus[i].GrpID,DefaultScenarioValus[i].geID,DefaultScenarioValus[i].fesibilityID,DefaultScenarioValus[i].Value,DefaultScenarioValus[i].IsDeleted);\n \t\t}\n \t\t//resultset.next();\n \t}\n \tresultset.close();\n \tDBFeaso.execute('COMMIT;');\n DBFeaso.close();\n}", "title": "" }, { "docid": "9a5760bc32481aa37d4056c3a4d2bc0b", "score": "0.42684665", "text": "function setFieldsProperties(mms) {\n\n send('\\n-- definition of field properties (unique, not null, default value)\\n');\n for (var mm in mms) {\n var model = mms[mm].sql;\n for (var m in model.structure) {\n var modi = model.structure[m],\n modt = model.modules[modi.module],\n uniqueFields = [],\n inst = 'ALTER TABLE ' + quote(modi.tableName);\n for (var i=0; i < modt.fields.length; i++) {\n var f = modt.fields[i];\n if (f.unique) {\n uniqueFields.push(f.name);\n }\n if (f.mandatory) { // mandatory\n if (target == 'mysql') {\n send(inst + ' MODIFY ' + quote(f.name) + ' ' + f.type + ' NOT NULL;\\n');\n }\n if (target == 'postgresql') {\n send(inst + ' ALTER COLUMN ' + quote(f.name) + ' SET NOT NULL;\\n');\n }\n }\n if (f.defaultValue && f.type != 'text') { // default value, forbidden for text/blob\n if (target == 'mysql') {\n send(inst + ' MODIFY ' + quote(f.name) + ' ' + f.type + ' DEFAULT '\n + getVal(f.defaultValue, f.type) + ';\\n');\n }\n if (target == 'postgresql') {\n send(inst + ' ALTER COLUMN ' + quote(f.name) + ' ' + ' SET DEFAULT '\n + getVal(f.defaultValue, f.type) + ';\\n');\n }\n }\n }\n // unique constraint\n if (uniqueFields.length) {\n inst += ' ADD CONSTRAINT ' + quote(m + '_unique') + ' '; // beware of too long identifiers causing errors!\n inst += 'UNIQUE (';\n for (var i=0; i < uniqueFields.length; i++) {\n inst += quote(uniqueFields[i]);\n if (i < uniqueFields.length - 1) {\n inst += ', ';\n }\n }\n inst += ');\\n';\n send(inst);\n }\n }\n }\n }", "title": "" }, { "docid": "b836ca810d190e3f5a157fbf0973d45b", "score": "0.42617732", "text": "initializeProducts(targetField) {\n\t\tif (targetField) {\n\t\t\tfor (p of this.products) {\n\t\t\t\tp.field = targetField;\n\t\t\t\tp.initializeItem();\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"error - field is not set up for initialization\");\n\t\t}\n\t}", "title": "" }, { "docid": "52274c4a2f7166d9cc9d41b2efb8e146", "score": "0.42540354", "text": "updateConfig(blockNumber) {\n let onConfigInitialization;\n if (this.initializingConfig) {\n onConfigInitialization = () => this.updateConfig(blockNumber);\n return;\n }\n\n if (!this.config.lastBlock || this.config.lastBlock < blockNumber) {\n this.config.lastBlock = blockNumber;\n\n if (!this.config._id) this.initializingConfig = true;\n\n this.model.findOneAndUpdate(\n {},\n this.config,\n { upsert: true, new: true },\n (err, numAffected, affectedDocs, upsert) => {\n if (err) logger.error('updateConfig ->', err);\n\n if (upsert) {\n this.config._id = affectedDocs._id;\n this.initializingConfig = false;\n if (onConfigInitialization) onConfigInitialization();\n }\n },\n );\n }\n }", "title": "" }, { "docid": "47cc2ef3dd76733aed333fa19fdc7501", "score": "0.42531338", "text": "function configureModule(data, properties) {\n console.log(\"configModule:\",data,properties);\n if (typeof properties == 'undefined') {\n vm.currentModule.config = data;\n } else {\n for (var i = 0; i < properties.length; i++) {\n vm.currentModule.config[properties[i]] = data[properties[i]];\n }\n }\n console.log(vm.currentModule);\n }", "title": "" }, { "docid": "480dfeb02aaf195bd58c142c7647e938", "score": "0.42516938", "text": "function _adjustList(next) {\n log.verbose(\"Resolver#load#_adjustList()\");\n const defaultTarget = \"emulator\";\n let inDevices = cliData.getDeviceList(true);\n\n // count targes does not have \"default field\"\n const defaultFields = inDevices.filter(function(device) {\n return (device.default !== undefined );\n });\n if (defaultFields.length < 1) {\n log.silly(\"Resolver#load#_adjustList()\", \"rewrite default field\");\n inDevices = inDevices.map(function(dev) {\n if (defaultTarget === dev.name) {\n dev.default = true;\n } else {\n dev.default = false;\n }\n return dev;\n });\n this.save(inDevices);\n }\n setImmediate(next);\n }", "title": "" }, { "docid": "79f44830d2850e36ca2806dd2c25f6a6", "score": "0.42474836", "text": "function setupDefaultConfigValues() {\n\t\toptions.get().then((data) => {\n\t\t\tfor (let key in defaultOptionsMap) {\n\t\t\t\tif (data[key] === undefined) {\n\t\t\t\t\tdata[key] = defaultOptionsMap[key];\n\t\t\t\t}\n\t\t\t}\n\t\t\toptions.set(data).then(() => {\n\t\t\t\toptions.debugLog();\n\t\t\t});\n\t\t});\n\t\tconnectorsOptions.get().then((data) => {\n\t\t\tfor (let connectorKey in defaultConnectorsOptionsMap) {\n\t\t\t\tif (data[connectorKey] === undefined) {\n\t\t\t\t\tdata[connectorKey] = defaultConnectorsOptionsMap[connectorKey];\n\t\t\t\t} else {\n\t\t\t\t\tfor (let key in defaultConnectorsOptionsMap[connectorKey]) {\n\t\t\t\t\t\tif (data[connectorKey][key] === undefined) {\n\t\t\t\t\t\t\tdata[connectorKey][key] = defaultConnectorsOptionsMap[connectorKey][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconnectorsOptions.set(data).then(() => {\n\t\t\t\toptions.debugLog();\n\t\t\t});\n\t\t});\n\t}", "title": "" }, { "docid": "3332444b0aad6f97ff4e2e4f2405dca7", "score": "0.42462105", "text": "function setDatabaseEntry(field,value) {\n if (isStringVariableSet(info.changes[field.toString()])) {\n updateExpressionValue = updateExpressionValue + \", #\" + field+ \" = :\" + field;\n updateAttributeNames['#' + field] = field.toString();\n if (info.changes[field.toString()] !== '') {\n updateAttributeValues[':' + field] = info.changes[field.toString()];\n } else {\n updateAttributeValues[':' + field] = null;\n }\n fieldsToChange++;\n }\n }", "title": "" }, { "docid": "9950bacb1971bf57f92c98eec356c25a", "score": "0.42429838", "text": "getConfigurations(target) {\n return this.rest.get(`${this.baseUrl}/configurations/${target}`);\n }", "title": "" }, { "docid": "9950bacb1971bf57f92c98eec356c25a", "score": "0.42429838", "text": "getConfigurations(target) {\n return this.rest.get(`${this.baseUrl}/configurations/${target}`);\n }", "title": "" }, { "docid": "aeb51f34ce6245031c2c48f8eba4c6a0", "score": "0.42396975", "text": "function module() {\n\n var ENABLE_DEBUG_LOG = true;\n function debugLog() {\n if(ENABLE_DEBUG_LOG) {\n var dataToPrint = [];\n dataToPrint.push('(hello_world.js)');\n for(var i = 0; i < arguments.length; i++) {\n dataToPrint.push(arguments[i]);\n }\n console.log.apply(console, dataToPrint);\n }\n }\n\n this.debug_validators = false;\n \n this.moduleConstants = {};\n this.configOnlyRegisters = {};\n this.ethernetRegisters = {};\n this.wifiRegisters = {};\n this.ethernetStatusRegisters = {};\n this.wifiStatusRegisters = {};\n\n this.moduleContext = {};\n this.templates = {};\n this.moduleData = undefined;\n\n this.activeDevice = undefined;\n this.connectionType = -1;\n\n this.isEthernetConnected = false;\n this.isWifiConnected = false;\n\n this.refreshEthernetInfo = false;\n this.refreshWifiInfo = false;\n\n this.currentValues = dict();\n this.bufferedValues = dict();\n\n this.dhcpText = ['Manual','Use DHCP'];\n\n this.saveBufferedValue = function(address,value,formattedVal) {\n self.bufferedValues.set(address,{val:value,fVal:formattedVal});\n };\n this.commitBufferedValues = function(address,value,formattedVal) {\n self.bufferedValues.forEach(function(data,name){\n self.currentValues.set(name,data);\n });\n };\n this.saveConfigResult = function(address, value, status) {\n if(status === 'success') {\n if(address === 'WIFI_SSID') {\n if(value !== '') {\n self.currentValues.set(address,value);\n } else {\n self.currentValues.set(address,{val:null,fVal:null,status:'error'});\n }\n } else {\n self.currentValues.set(address,value);\n }\n } else {\n self.currentValues.set(address,{val:null,fVal:null,status:'error'});\n }\n };\n this.saveCurrentValue = function(address,value,formattedVal) {\n self.currentValues.set(address,{val:value,fVal:formattedVal});\n };\n\n this.formatIPAddress = function(info) {\n var ipAddress = info.value;\n var ipString = \"\";\n ipString += ((ipAddress>>24)&0xFF).toString();\n ipString += \".\";\n ipString += ((ipAddress>>16)&0xFF).toString();\n ipString += \".\";\n ipString += ((ipAddress>>8)&0xFF).toString();\n ipString += \".\";\n ipString += ((ipAddress)&0xFF).toString();\n return ipString;\n };\n this.unformatIPAddress = function(ipString) {\n var value = 0;\n var stringArray = ipString.split('.');\n value += stringArray[0] << 24;\n value += stringArray[1] << 16;\n value += stringArray[2] << 8;\n value += stringArray[3];\n return value;\n };\n this.dot2num = function(dot) {\n var d = dot.split('.');\n return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]);\n };\n this.formatStatus = function(info) {\n var status = info.value;\n var statusString = \"\";\n if(status > 0) {\n statusString = \"Enabled\";\n } else {\n statusString = \"Disabled\";\n }\n return statusString;\n };\n // Test function for trying to get WiFi module to report RSSI;\n this.sendUDPMessage = function() {\n try {\n var dgram = require('dgram');\n // var message = new Buffer('Some bytes');\n // var message = Buffer.from('Some bytes');\n var client = dgram.createSocket('udp4');\n\n var message = 'Some Bytes';\n var ip = self.currentValues.get('WIFI_IP').fVal;\n client.send(message,0,message.length,5002,ip, function(err) {\n client.close();\n });\n } catch(err) {\n console.log('err',err);\n }\n };\n this.formatRSSI = function(info) {\n var rssi = info.value;\n var rssiString = \"\";\n rssiString = rssi.toString() + \"dB\";\n return rssiString;\n };\n this.formatWifiStatus = function(info) {\n var status = info.value;\n var statusString = {\n 2900: 'Associated',\n 2901: 'Associating',\n 2902: 'Association Failed',\n 2903: 'Un-Powered',\n 2904: 'Booting Up',\n 2905: 'Could Not Start',\n 2906: 'Applying Settings',\n 2907: 'DHCP Started',\n 2908: 'Unknown',\n 2909: 'Other'\n }[status];\n if (statusString === undefined) {\n statusString = \"Status Unknown\";\n }\n return statusString + ' ('+status.toString()+')';\n };\n this.hideEthernetAlerts = function() {\n $('#ethernet_settings .configSettingsTable .alert').hide();\n };\n this.selectivelyShowEthernetAlerts = function() {\n var elements = $('#ethernet_settings .configSettingsTable .networkSetting input');\n elements.trigger('change');\n };\n this.showManualEthernetSettings = function() {\n $('#ethernet_settings .Auto_Value').hide();\n $('#ethernet_settings .Manual_Value').show();\n var dhcpToggleEl = $('#ethernet-DHCP-Select-Toggle .btnText');\n dhcpToggleEl.text($('#ethernet-DHCP-Select-Toggle #Ethernet_DHCP_Manual').text());\n self.selectivelyShowEthernetAlerts();\n };\n this.showAutoEthernetSettings = function() {\n $('#ethernet_settings .Manual_Value').hide();\n $('#ethernet_settings .Auto_Value').show();\n var dhcpToggleEl = $('#ethernet-DHCP-Select-Toggle .btnText');\n dhcpToggleEl.text($('#ethernet-DHCP-Select-Toggle #Ethernet_DHCP_Auto').text());\n self.hideEthernetAlerts();\n };\n this.setEthernetSettings = function(mode) {\n if(mode === 'auto') {\n self.showAutoEthernetSettings();\n } else {\n self.showManualEthernetSettings();\n }\n };\n this.toggleEthernetSettings = function() {\n if($('#ethernet_settings .Manual_Value').css('display') === 'none') {\n self.showManualEthernetSettings();\n } else {\n self.showAutoEthernetSettings();\n }\n };\n this.hideWifiAlerts = function() {\n $('#wifi_settings .wifiConfigSettingsTable .alert').hide();\n };\n this.selectivelyShowWifiAlerts = function() {\n var elements = $('#wifi_settings .configSettingsTable .networkSetting input');\n elements.trigger('change');\n };\n this.updateInput = function(element, value) {\n var isFocused = element.is(\":focus\");\n if(isFocused) {\n // don't update the element\n } else {\n // Update the element\n element.val(value);\n }\n };\n this.updateDetailedStatusTable = function(type) {\n var list = [];\n if(type === 'wifi') {\n list = self.getOrganizedWiFiIPSettingsRegList();\n } else {\n list = self.getOrganizedEthernetIPSettingsRegList();\n }\n list.forEach(function(reg) {\n var curVal = self.currentValues.get(reg.current.reg).fVal;\n var defVal = self.currentValues.get(reg.default.reg).fVal;\n var curEl = $('#CURRENT_VAL_'+reg.current.reg);\n var defEl = $('#DEFAULT_VAL_'+reg.current.reg);\n\n curEl.text(curVal);\n defEl.text(defVal);\n });\n };\n this.updateIPSettings = function(type) {\n debugLog('Updating IP Settings',type);\n var list = [];\n if(type === 'wifi') {\n list = self.getWiFiIPRegisterList();\n } else {\n list = self.getEthernetIPRegisterList();\n }\n list.forEach(function(reg) {\n var strVal = self.currentValues.get(reg).fVal;\n var autoEl = $('#'+reg+'_VAL .'+reg+'_AUTO_VAL');\n var manEl = $('#'+reg+'_VAL .'+reg+'_MAN_VAL');\n\n autoEl.text(strVal);\n // manEl.attr('placeholder',strVal);\n self.updateInput(manEl, strVal);\n });\n \n try {\n self.updateDetailedStatusTable(type);\n } catch(err) {\n console.error('err updating detailed status table:',err);\n }\n };\n this.updateEthernetSettings = function() {\n var dhcpDefault = self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT').val;\n var dhcp = self.currentValues.get('ETHERNET_DHCP_ENABLE').val;\n\n var dhcpTextEl = $('#ethernet-DHCP-Select-Toggle .btnText');\n // dhcpTextEl.text(self.dhcpText[dhcpDefault]);\n // if(dhcpDefault === 0) {\n // self.showManualEthernetSettings();\n // } else {\n // self.showAutoEthernetSettings();\n // }\n self.updateIPSettings('ethernet');\n };\n this.updateWifiSettings = function() {\n var wifiSSID = self.currentValues.get('WIFI_SSID').val;\n var dhcpDefault = self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT').val;\n \n\n var ssidEl = $('#WIFI_SSID_DEFAULT_VAL .WIFI_SSID_DEFAULT_AUTO_VAL');\n // ssidEl.val('');\n ssidEl.attr('placeholder',wifiSSID);\n // ssidEl.trigger('change');\n\n var dhcpTextEl = $('#wifi-DHCP-Select-Toggle .btnText');\n // dhcpTextEl.text(self.dhcpText[dhcpDefault]);\n // if(dhcpDefault === 0) {\n // self.showManualWifiSettings();\n // } else {\n // self.showAutoWifiSettings();\n // }\n var wifiPower = self.currentValues.get('POWER_WIFI').val;\n if(wifiPower === 0) {\n self.saveCurrentValue('WIFI_IP',0,'0.0.0.0');\n self.saveCurrentValue('WIFI_SUBNET',0,'0.0.0.0');\n self.saveCurrentValue('WIFI_GATEWAY',0,'0.0.0.0');\n }\n self.updateIPSettings('wifi');\n };\n this.showManualWifiSettings = function() {\n $('#wifi_settings .Auto_Value').hide();\n $('#wifi_settings .Manual_Value').show();\n var dhcpToggleEl = $('#wifi-DHCP-Select-Toggle .btnText');\n dhcpToggleEl.text($('#wifi-DHCP-Select-Toggle #WiFi_DHCP_Manual').text());\n self.selectivelyShowWifiAlerts();\n KEYBOARD_EVENT_HANDLER.initInputListeners();\n };\n this.showAutoWifiSettings = function() {\n $('#wifi_settings .Manual_Value').hide();\n $('#wifi_settings .Auto_Value').show();\n var dhcpToggleEl = $('#wifi-DHCP-Select-Toggle .btnText');\n dhcpToggleEl.text($('#wifi-DHCP-Select-Toggle #WiFi_DHCP_Auto').text());\n self.hideWifiAlerts();\n };\n this.setWifiSettings = function(mode) {\n if(mode === 'auto') {\n self.showAutoWifiSettings();\n } else {\n self.showManualWifiSettings();\n }\n };\n this.toggleWifiSettings = function() {\n if($('#wifi_settings .Manual_Value').css('display') === 'none') {\n self.showManualWifiSettings();\n } else {\n self.showAutoWifiSettings();\n }\n };\n this.buildJqueryIDStr = function(idStr) {\n var jqueryStr = \"\";\n if(idStr.indexOf('#') === 0) {\n jqueryStr = idStr;\n } else {\n jqueryStr = \"#\"+idStr;\n }\n return jqueryStr;\n };\n this.buildJqueryClassStr = function(idStr) {\n var jqueryStr = \"\";\n if(idStr.indexOf('.') === 0) {\n jqueryStr = idStr;\n } else {\n jqueryStr = \".\"+idStr;\n }\n return jqueryStr;\n };\n this.setAutoVal = function(settingID,val) {\n var autoValEl = $(self.buildJqueryIDStr(settingID) + '.Auto_Value');\n autoValEl.text(val);\n };\n this.getAutoVal = function(settingID) {\n var autoValEl = $(self.buildJqueryIDStr(settingID) + '.Auto_Value');\n return {value:autoValEl.text()};\n };\n this.setManualVal = function(settingID, val) {\n var manStr = \" .Manual_Value input\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n\n // manualValEl[0].value = val;\n self.updateInput(manualValEl, val);\n };\n this.getManualVal = function(settingID) {\n var manStr = \" .Manual_Value input\";\n // console.log('Element String', self.buildJqueryIDStr(settingID) + manStr);\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n var value = \"\";\n var isNew = false;\n if(manualValEl.hasClass('inputVerified')) {\n value = manualValEl.val();\n isNew = true;\n } else {\n // value = manualValEl[0].placeholder;\n value = manualValEl.val();\n isNew = false;\n }\n return {value:value, isNew:isNew};\n };\n this.getDHCPVal = function(settingID) {\n var manStr = \" .btnText\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n var dhcpValues = {};\n dhcpValues[self.dhcpText[0]] = 0;\n dhcpValues[self.dhcpText[1]] = 1;\n \n var strVal = manualValEl.text();\n var value = \"\";\n var isNew = false;\n\n if(manualValEl.hasClass('inputVerified')) {\n value = dhcpValues[strVal];\n isNew = true;\n } else {\n value = dhcpValues[strVal];\n isNew = false;\n }\n return {value:value, isNew:isNew};\n };\n this.getToggleVal = function(settingID) {\n var manStr = \" input\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n var value = \"\";\n var isNew = false;\n if(manualValEl.hasClass('inputVerified')) {\n value = manualValEl.val();\n isNew = true;\n } else {\n value = manualValEl[0].placeholder;\n isNew = false;\n }\n return {value:value, isNew:isNew};\n };\n this.getInputVal = function(settingID) {\n var manStr = \" input\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n var value = \"\";\n var isNew = false;\n if(manualValEl.hasClass('inputVerified')) {\n value = manualValEl.val();\n isNew = true;\n } else {\n // value = manualValEl[0].placeholder;\n value = manualValEl.val();\n isNew = false;\n }\n return {value:value, isNew:isNew};\n };\n this.setInputVal = function(settingID, val) {\n var manStr = \" input\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n // manualValEl.val(val);\n self.updateInput(manualValEl, val);\n };\n this.setNetworkName = function(networkName) {\n self.setInputVal('#WIFI_SSID_DEFAULT_VAL',networkName);\n };\n this.setWifiPassword = function(password) {\n self.setInputVal('#WIFI_PASSWORD_DEFAULT_VAL',password);\n };\n this.clearManualVal = function(settingID) {\n var manStr = \" .Manual_Value input\";\n var manualValEl = $(self.buildJqueryIDStr(settingID) + manStr);\n manualValEl.val('');\n manualValEl.trigger('change');\n };\n this.getIPRegisters = function(constList, attribute) {\n var regList = [];\n constList.forEach(function(reg) {\n var initValObj = self.currentValues.get(reg.name);\n if(initValObj !== null) {\n reg.initVal = initValObj.fVal;\n }\n if ((reg.type === 'ip') && (reg.isConfig)){\n if ((attribute === '')||(typeof(attribute) === 'undefined')) {\n regList.push(reg);\n } else {\n regList.push(reg[attribute]);\n }\n }\n });\n return regList;\n };\n this.getOrganizedIPSettingsRegisterList = function(constList) {\n var regList = [];\n var curDevType = self.activeDevice.savedAttributes.deviceTypeName;\n constList.forEach(function(reg) {\n var info = JSON.parse(JSON.stringify(reg));\n info.current.val = \"0.0.0.0\";\n info.default.val = \"0.0.0.0\";\n\n var currentStateVal = self.currentValues.get(reg.current.reg);\n if(currentStateVal !== null) {\n info.current.val = currentStateVal.fVal;\n }\n var defaultStateVal = self.currentValues.get(reg.default.reg);\n if(defaultStateVal !== null) {\n info.default.val = defaultStateVal.fVal;\n }\n\n if(reg.deviceTypes.indexOf(curDevType) >= 0) {\n regList.push(info);\n }\n });\n return regList;\n };\n this.getOrganizedEthernetIPSettingsRegList = function() {\n return self.getOrganizedIPSettingsRegisterList(self.ethernetStatusRegisters);\n };\n this.getOrganizedWiFiIPSettingsRegList = function() {\n return self.getOrganizedIPSettingsRegisterList(self.wifiStatusRegisters);\n };\n this.getWiFiIPRegisterList = function() {\n return self.getIPRegisters(self.wifiRegisters,'name');\n };\n this.getEthernetIPRegisterList = function() {\n return self.getIPRegisters(self.ethernetRegisters,'name');\n };\n this.clearNewEthernetSettings = function() {\n self.getEthernetIPRegisterList().forEach(function(regName){\n var configData = self.clearManualVal(regName+'_VAL');\n });\n };\n\n this.getNewEthernetSettings = function() {\n var newEthernetSettingRegs = [];\n var newEthernetSettingVals = [];\n var ethernetSettingRegs = [];\n var ethernetSettingVals = [];\n self.getEthernetIPRegisterList().forEach(function(regName){\n var configData = self.getManualVal(regName+'_VAL');\n // console.log('Getting Ethernet IP Data', regName, configData);\n var ipVal = parseInt(self.dot2num(configData.value));\n if(configData.isNew) {\n newEthernetSettingRegs.push(regName+'_DEFAULT');\n newEthernetSettingVals.push(ipVal);\n }\n ethernetSettingRegs.push(regName+'_DEFAULT');\n ethernetSettingVals.push(ipVal);\n });\n var dhcpSetting = self.getDHCPVal('#ethernetDHCPSelect');\n if(dhcpSetting.isNew) {\n newEthernetSettingRegs.push('ETHERNET_DHCP_ENABLE_DEFAULT');\n newEthernetSettingVals.push(dhcpSetting.value);\n }\n ethernetSettingRegs.push('ETHERNET_DHCP_ENABLE_DEFAULT');\n ethernetSettingVals.push(dhcpSetting.value);\n return {\n newRegisters: newEthernetSettingRegs,\n newValues: newEthernetSettingVals,\n registers: ethernetSettingRegs,\n values: ethernetSettingVals\n };\n };\n this.getNewWifiSettings = function() {\n var newWifiSettingRegs = [];\n var newWifiSettingVals = [];\n var wifiSettingRegs = [];\n var wifiSettingVals = [];\n self.getWiFiIPRegisterList().forEach(function(regName){\n var configData = self.getManualVal(regName+'_VAL');\n var ipVal = parseInt(self.dot2num(configData.value));\n if(configData.isNew) {\n newWifiSettingRegs.push(regName+'_DEFAULT');\n newWifiSettingVals.push(ipVal);\n }\n wifiSettingRegs.push(regName+'_DEFAULT');\n wifiSettingVals.push(ipVal);\n });\n var dhcpSetting = self.getDHCPVal('#wifiDHCPSelect');\n if(dhcpSetting.isNew) {\n newWifiSettingRegs.push('WIFI_DHCP_ENABLE_DEFAULT');\n newWifiSettingVals.push(dhcpSetting.value);\n }\n wifiSettingRegs.push('WIFI_DHCP_ENABLE_DEFAULT');\n wifiSettingVals.push(dhcpSetting.value);\n return {\n newRegisters: newWifiSettingRegs, \n newValues: newWifiSettingVals,\n registers: wifiSettingRegs,\n values: wifiSettingVals\n };\n };\n this.resetAlertIcon = function(alertEl,inputTextEl) {\n var alertMessageEl = alertEl.find('.messageIcon');\n alertEl.hide();\n alertMessageEl.removeClass('icon-close');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.removeClass('alert-block');\n alertEl.addClass('alert-success');\n alertEl.attr('title',\"Valid IP Address\");\n inputTextEl.removeClass('inputVerified');\n };\n this.showInvalidAlertIcon = function(alertEl,inputTextEl) {\n var alertMessageEl = alertEl.find('.messageIcon');\n alertMessageEl.addClass('icon-close');\n alertEl.addClass('alert-block');\n alertEl.attr('title',\"Invalid IP Address\");\n inputTextEl.removeClass('inputVerified');\n alertEl.show(); \n };\n this.showValidAlertIcon = function(alertEl,inputTextEl) {\n var alertMessageEl = alertEl.find('.messageIcon');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.addClass('alert-success');\n alertEl.attr('title',\"Valid IP Address\");\n inputTextEl.addClass('inputVerified');\n alertEl.show();\n };\n this.updateValidationStatus = function(isValid,classId,applyButtonId) {\n if(isValid) {\n var numInvalid = $('#'+classId+' .icon-close').length;\n var numNew = $('#'+classId+' .inputVerified').length;\n if((numInvalid === 0) && (numNew > 0)) {\n $('#'+applyButtonId+'').removeAttr('disabled');\n } else {\n $('#'+applyButtonId+'').attr('disabled','disabled');\n }\n } else {\n $('#'+applyButtonId+'').attr('disabled','disabled');\n }\n };\n this.updateWifiValidationStatus = function(isValid) {\n self.updateValidationStatus(isValid,'wifi_settings','wifiApplyButton');\n };\n this.ipAddressValidator = function(event) {\n var settingID = event.target.parentElement.parentElement.parentElement.id;\n var alertJQueryStr = '#'+settingID+' .alert';\n var alertEl = $(alertJQueryStr);\n var alertMessageJQueryStr = alertJQueryStr + ' .messageIcon';\n var alertMessageEl = $(alertMessageJQueryStr);\n var inputTextEl = $('#'+settingID+' input');\n var inputText = event.target.value;\n var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\n var isValid = true;\n\n var currentRegister = settingID.split('_VAL')[0];\n var currentValue = self.currentValues.get(currentRegister).fVal;\n if(self.debug_validators) {\n console.info('in ipAddressValidator', currentValue, inputText);\n }\n\n if(inputText !== currentValue) {\n // Remove Existing styles \n alertMessageEl.removeClass('icon-checkmark-3');\n alertEl.removeClass('alert-success');\n alertMessageEl.removeClass('icon-close');\n alertEl.removeClass('alert-block');\n alertEl.removeAttr('title');\n inputTextEl.removeClass('inputVerified');\n\n // Add appropriate styles\n if(inputText.match(ipformat)) {\n self.showValidAlertIcon(alertEl,inputTextEl);\n if(settingID === 'ETHERNET_IP_VAL') {\n if(inputText === '0.0.0.0') {\n isValid = false;\n }\n } else {\n isValid = true;\n }\n } else {\n self.showInvalidAlertIcon(alertEl,inputTextEl);\n isValid = false;\n } \n } else {\n self.resetAlertIcon(alertEl,inputTextEl);\n isValid = true;\n }\n if (settingID.search('ETHERNET') >= 0 ) {\n self.updateValidationStatus(isValid,'ethernet_settings','ethernetApplyButton');\n } else {\n self.updateWifiValidationStatus(isValid);\n }\n inputTextEl.blur();\n };\n this.networkNameValidator = function(event) {\n var settingID = event.target.parentElement.parentElement.id;\n var alertJQueryStr = '#'+settingID+' .alert';\n var alertEl = $(alertJQueryStr);\n var alertMessageJQueryStr = alertJQueryStr + ' .messageIcon';\n var alertMessageEl = $(alertMessageJQueryStr);\n var inputTextEl = $('#'+settingID+' input');\n var inputText = event.target.value;\n var isValid = false;\n inputTextEl.removeClass('inputVerified');\n\n var currentRegister = settingID.split('_VAL')[0];\n var currentValue = self.currentValues.get(currentRegister).fVal;\n if(self.debug_validators) {\n console.info('in networkNameValidator', currentValue, inputText);\n }\n\n if(inputText !== currentValue) {\n if(true) {\n alertMessageEl.removeClass('icon-close');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.removeClass('alert-block');\n alertEl.addClass('alert-success');\n alertEl.attr('title','Valid Input');\n inputTextEl.addClass('inputVerified');\n alertEl.show();\n }\n isValid = true;\n } else {\n alertEl.hide();\n // alertMessageEl.removeClass('icon-checkmark-3');\n // alertMessageEl.addClass('icon-close');\n alertMessageEl.removeClass('icon-close');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.addClass('alert-success');\n // alertEl.removeClass('alert-block');\n alertEl.attr('title','Valid Input');\n inputTextEl.removeClass('inputVerified');\n isValid = true;\n }\n self.updateWifiValidationStatus(isValid);\n inputTextEl.blur();\n };\n this.networkPasswordValidator = function(event) {\n var settingID = event.target.parentElement.parentElement.id;\n var alertJQueryStr = '#'+settingID+' .alert';\n var alertEl = $(alertJQueryStr);\n var alertMessageJQueryStr = alertJQueryStr + ' .messageIcon';\n var alertMessageEl = $(alertMessageJQueryStr);\n var inputTextEl = $('#'+settingID+' input');\n var inputText = event.target.value;\n var isValid = false;\n inputTextEl.removeClass('inputVerified');\n var currentRegister = settingID.split('_VAL')[0];\n var currentValue = self.currentValues.get(currentRegister);\n if(self.debug_validators) {\n console.info('in networkPasswordValidator', currentValue, inputText);\n }\n\n if(inputText !== \"\") {\n if(true) {\n alertMessageEl.removeClass('icon-close');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.removeClass('alert-block');\n alertEl.addClass('alert-success');\n alertEl.attr('title','Password Required Before Applying Settings');\n inputTextEl.addClass('inputVerified');\n alertEl.show();\n }\n isValid = true;\n } else {\n // alertMessageEl.removeClass('icon-checkmark-3');\n // alertMessageEl.addClass('icon-close');\n alertMessageEl.removeClass('icon-close');\n alertMessageEl.addClass('icon-checkmark-3');\n alertEl.removeClass('alert-success');\n alertEl.addClass('alert-block');\n // alertEl.removeClass('alert-block');\n // alertEl.addClass('alert-success');\n alertEl.attr('title','Password Required Before Applying Settings, Currently Blank');\n // inputTextEl.removeClass('inputVerified');\n inputTextEl.addClass('inputVerified');\n alertEl.show();\n isValid = true;\n }\n self.updateWifiValidationStatus(isValid);\n inputTextEl.blur();\n };\n this.attachIPInputValidators = function() {\n var inputElements = $('.networkSetting .ipAddress');\n inputElements.bind('change',self.ipAddressValidator);\n // console.log('attaching validators',inputElements);\n };\n this.attachNetworkNameValidator = function() {\n var networkNameEl = $('#WIFI_SSID_DEFAULT_VAL input');\n // console.log('attaching validator...',networkNameEl);\n networkNameEl.bind('change',self.networkNameValidator);\n };\n this.attachNetworkPasswordValidator = function() {\n var networkPasswordEl = $('#WIFI_PASSWORD_DEFAULT_VAL input');\n // console.log('attaching validator...',networkPasswordEl);\n networkPasswordEl.bind('change',self.networkPasswordValidator);\n };\n this.attachInputValidators = function() {\n self.attachIPInputValidators();\n self.attachNetworkNameValidator();\n self.attachNetworkPasswordValidator();\n };\n this.ethernetPowerButton = function(data, onSuccess) {\n // console.log('in ethernetPowerButton listener');\n self.refreshEthernetInfo = true;\n var getEthernetResFunc = function(val,type) {\n var messages = [\n {'success':'disable ethernet success','err':'disable ethernet error'},\n {'success':'enable ethernet success','err':'enable ethernet error'}\n ];\n var fValStr = ['Disabled','Enabled'];\n var btnText = ['Turn Ethernet On','Turn Ethernet Off'];\n return function(result) {\n // console.log(messages[val][type],result);\n self.saveCurrentValue('POWER_ETHERNET',val,fValStr[val]);\n self.saveCurrentValue('POWER_ETHERNET_DEFAULT',val,fValStr[val]);\n $('#ethernetPowerButton .buttonText').text(btnText[val]);\n onSuccess();\n };\n };\n var curStatus = sdModule.currentValues.get('POWER_ETHERNET').val;\n // console.log('in ethernetPowerButton',curStatus);\n if(curStatus === 0) {\n self.activeDevice.iWriteMany(\n ['POWER_ETHERNET','POWER_ETHERNET_DEFAULT'],\n [1,1]\n )\n .then(getEthernetResFunc(1,'success'),getEthernetResFunc(1,'err'));\n } else {\n self.activeDevice.iWriteMany(\n ['POWER_ETHERNET','POWER_ETHERNET_DEFAULT'],\n [0,0]\n )\n .then(getEthernetResFunc(0,'success'),getEthernetResFunc(0,'err'));\n }\n };\n this.showEthernetDHCPChanged = function() {\n $('#ethernetDHCPSelect .dhcpAlert').show();\n };\n this.hideEthernetDHCPChanged = function() {\n $('#ethernetDHCPSelect .dhcpAlert').hide();\n };\n this.showWifiDHCPChanged = function() {\n $('#wifiDHCPSelect .dhcpAlert').show();\n };\n this.hideWifiDHCPChanged = function() {\n $('#wifiDHCPSelect .dhcpAlert').hide();\n };\n this.toggleDHCP = function() {\n var isEthernet = $('#ethernetDHCPSelect .dhcpAlert').css('display');\n var isWifi = $('#wifiDHCPSelect .dhcpAlert').css('display');\n if(isEthernet === 'none') {\n self.showEthernetDHCPChanged();\n } else {\n self.hideEthernetDHCPChanged();\n }\n if(isWifi === 'none') {\n self.showWifiDHCPChanged();\n } else {\n self.hideWifiDHCPChanged();\n }\n };\n this.ethernetDHCPSelect = function(data, onSuccess) {\n // console.log('in ethernetDHCPSelect listener',data.eventData);\n var dhcpOption = data.eventData.toElement.id;\n var dhcpTextId;\n var dhcpTextEl;\n\n if (dhcpOption === 'Ethernet_DHCP_Auto') {\n dhcpTextId = data.eventData.toElement.parentElement.parentElement.parentElement.id;\n dhcpTextEl = $('#'+dhcpTextId+' .btnText');\n self.showAutoEthernetSettings();\n if(self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT').val === 0) {\n self.showEthernetDHCPChanged();\n dhcpTextEl.addClass('inputVerified');\n } else {\n self.hideEthernetDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n }\n self.updateValidationStatus(true,'ethernet_settings','ethernetApplyButton');\n } else if (dhcpOption === 'Ethernet_DHCP_Manual') {\n dhcpTextId = data.eventData.toElement.parentElement.parentElement.parentElement.id;\n dhcpTextEl = $('#'+dhcpTextId+' .btnText');\n self.showManualEthernetSettings();\n if(self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT').val === 0) {\n self.hideEthernetDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n } else {\n self.showEthernetDHCPChanged();\n dhcpTextEl.addClass('inputVerified');\n }\n self.updateValidationStatus(true,'ethernet_settings','ethernetApplyButton');\n }\n onSuccess();\n };\n this.qPowerCycleEthernet = function() {\n var ioDeferred = q.defer();\n self.activeDevice.iWriteMany(\n ['POWER_ETHERNET','POWER_ETHERNET'],\n [0,1]\n );\n \n ioDeferred.resolve();\n return ioDeferred.promise;\n };\n this.powerCycleEthernet = function() {\n self.qPowerCycleEthernet()\n .then(function() {\n console.log('Success!');\n }, function(err) {\n console.log('err',err);\n });\n };\n this.ethernetApplyButton = function(data, onSuccess) {\n console.log('in ethernetApplyButton listener');\n var configData = self.getNewEthernetSettings();\n var newNames = configData.newRegisters;\n var newVals = configData.newVals;\n var names = configData.registers;\n var vals = configData.values;\n\n var applySettings = false;\n var ioError = function(err) {\n var ioDeferred = q.defer();\n if(typeof(err) === 'number') {\n console.log(self.ljmDriver.errToStrSync(err));\n } else {\n console.log('Ethernet Applying Settings Error',err);\n }\n ioDeferred.resolve();\n return ioDeferred.promise;\n };\n var writeSettings = function() {\n var ioDeferred = q.defer();\n if(newNames.length > 0) {\n applySettings = true;\n // console.log('Writing',names,vals);\n self.activeDevice.iWriteMany(names,vals)\n .then(function() {\n // console.log('Finished Writing Ethernet Settings');\n ioDeferred.resolve();\n }, function() {\n ioDeferred.reject();\n });\n } else {\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n var applyEthernetSettings = function() {\n var ioDeferred = q.defer();\n var promise;\n var useApply = true;\n if(useApply) {\n promise = self.activeDevice.iWrite('ETHERNET_APPLY_SETTINGS', 0);\n } else {\n promise = self.activeDevice.iWriteMany(\n ['POWER_ETHERNET','POWER_ETHERNET'],\n [0,1]);\n }\n promise.then(function(){\n // console.log('Successfully configured ethernet',names,vals);\n ioDeferred.resolve();\n },function(err){\n console.log('Error configuring Ethernet...',err);\n ioDeferred.reject(err);\n });\n return ioDeferred.promise;\n };\n writeSettings()\n .then(applyEthernetSettings,ioError)\n // self.activeDevice.iWriteMany(newNames,newVals)\n .then(function() {\n names.forEach(function(name,index) {\n var stringVal = '';\n if(name === 'ETHERNET_DHCP_ENABLE_DEFAULT') {\n if(vals[index] === 0) {\n stringVal = 'Disabled';\n } else {\n stringVal = 'Enabled';\n }\n } else {\n stringVal = self.formatIPAddress({value:vals[index]});\n }\n self.saveCurrentValue(name,vals[index],stringVal);\n });\n self.clearEthernetInputs();\n onSuccess();\n },function(err) {\n console.log('Error Applying Ethernet Settings',err);\n onSuccess();\n });\n };\n this.ethernetCancelButton = function(data, onSuccess) {\n console.log('in ethernetCancelButton listener');\n var dhcp = self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT').val;\n var buttonText = self.dhcpText[dhcp];\n $('#ethernetDHCPSelect .btnText').text(buttonText);\n if(dhcp === 0) {\n self.showManualEthernetSettings();\n } else {\n self.showAutoEthernetSettings();\n }\n self.clearEthernetInputs();\n onSuccess();\n };\n this.ethernetHelpButton = function(data, onSuccess) {\n console.log('in wifiHelpButton listener');\n // gui.Shell.openExternal(\"http://labjack.com/support/app-notes/basic-networking-troubleshooting\");\n gui.Shell.openExternal(\"https://labjack.com/support/app-notes/wifi-and-ethernet-t7-t4-t7-pro\");\n onSuccess();\n };\n this.updateActiveEthernetSettings = function() {\n var innerDeferred = q.defer();\n var wifiIPRegisters = self.getEthernetIPRegisterList();\n var newNames = [];\n var newVals = [];\n var getErrHandle = function(step) {\n return function() {\n var ioDeferred = q.defer();\n console.log('Read Error',step);\n ioDeferred.resolve();\n return ioDeferred.promise;\n };\n };\n var readAndSaveInfo = function() {\n var ioDeferred = q.defer();\n self.activeDevice.sReadMany(wifiIPRegisters)\n .then(function(newResults) {\n var results = newResults.map(function(newResult) {\n return newResult.res;\n });\n newNames = newNames.concat(wifiIPRegisters);\n newVals = newVals.concat(results);\n results.forEach(function(result,index) {\n var ipStr = self.formatIPAddress({value:result});\n self.saveCurrentValue(\n wifiIPRegisters[index],\n result,\n ipStr\n );\n });\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n var readAndSaveDHCP = function() {\n var ioDeferred = q.defer();\n self.activeDevice.qRead('ETHERNET_DHCP_ENABLE')\n .then(function(result) {\n newNames = newNames.concat('ETHERNET_DHCP_ENABLE');\n newVals = newVals.concat(result);\n var strRes = 'Enabled';\n if(result === 0) {\n strRes = 'Disabled';\n }\n self.saveCurrentValue(\n 'ETHERNET_DHCP_ENABLE',\n result,\n strRes\n );\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n readAndSaveInfo()\n .then(readAndSaveDHCP,getErrHandle('readAndSaveInfo'))\n .then(function() {\n // console.log('Ethernet Status Regs Updated',newNames,newVals);\n innerDeferred.resolve();\n },getErrHandle('readAndSaveDHCP'))\n .then(function() {\n innerDeferred.resolve();\n },innerDeferred.reject);\n return innerDeferred.promise;\n };\n this.updateActiveWifiSettings = function() {\n var innerDeferred = q.defer();\n var wifiIPRegisters = self.getWiFiIPRegisterList();\n var newNames = [];\n var newVals = [];\n var getErrHandle = function(step) {\n return function() {\n var ioDeferred = q.defer();\n console.log('Read Error',step);\n ioDeferred.resolve();\n return ioDeferred.promise;\n };\n };\n var readAndSaveInfo = function() {\n var ioDeferred = q.defer();\n self.activeDevice.sReadMany(wifiIPRegisters)\n .then(function(newResults) {\n var results = newResults.map(function(newResult) {\n return newResult.res;\n });\n newNames = newNames.concat(wifiIPRegisters);\n newVals = newVals.concat(results);\n results.forEach(function(result,index) {\n var ipStr = self.formatIPAddress({value:result});\n self.saveCurrentValue(\n wifiIPRegisters[index],\n result,\n ipStr\n );\n });\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n var readAndSaveSSID = function() {\n var ioDeferred = q.defer();\n self.activeDevice.qRead('WIFI_SSID')\n .then(function(result) {\n newNames = newNames.concat('WIFI_SSID');\n newVals = newVals.concat(result);\n self.saveCurrentValue(\n 'WIFI_SSID',\n result,\n result\n );\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n var readAndSaveDHCP = function() {\n var ioDeferred = q.defer();\n self.activeDevice.qRead('WIFI_DHCP_ENABLE')\n .then(function(result) {\n newNames = newNames.concat('WIFI_DHCP_ENABLE');\n newVals = newVals.concat(result);\n var strRes = 'Enabled';\n if(result === 0) {\n strRes = 'Disabled';\n }\n self.saveCurrentValue(\n 'WIFI_DHCP_ENABLE',\n result,\n strRes\n );\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n var readAndSaveRSSI = function() {\n var ioDeferred = q.defer();\n self.activeDevice.qRead('WIFI_RSSI')\n .then(function(result) {\n newNames = newNames.concat('WIFI_RSSI');\n newVals = newVals.concat(result);\n var strRes = self.formatRSSI({value:result});\n self.saveCurrentValue(\n 'WIFI_RSSI',\n result,\n strRes\n );\n ioDeferred.resolve();\n }, function(err) {\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n readAndSaveInfo()\n .then(readAndSaveSSID,getErrHandle('readAndSaveInfo'))\n .then(readAndSaveDHCP,getErrHandle('readAndSaveSSID'))\n .then(readAndSaveRSSI,getErrHandle('readAndSaveDHCP'))\n .then(function() {\n // console.log('Wifi Status Regs Updated',newNames,newVals);\n innerDeferred.resolve();\n },getErrHandle('readAndSaveRSSI'))\n .then(function() {\n innerDeferred.resolve();\n },innerDeferred.reject);\n return innerDeferred.promise;\n };\n this.wifiPowerButton = function(data, onSuccess) {\n self.refreshWifiInfo = true;\n var getWifiResFunc = function(val,type) {\n var messages = [\n {'success':'disable wifi success','err':'disable wifi error'},\n {'success':'enable wifi success','err':'enable wifi error'}\n ];\n var fValStr = ['Disabled','Enabled'];\n var btnText = ['Turn WiFi On','Turn WiFi Off'];\n return function(result) {\n console.log(messages[val][type],result);\n self.saveCurrentValue('POWER_WIFI',val,fValStr[val]);\n self.saveCurrentValue('POWER_WIFI_DEFAULT',val,fValStr[val]);\n $('#wifiPowerButton .buttonText').text(btnText[val]);\n onSuccess();\n };\n };\n var curStatus = sdModule.currentValues.get('POWER_WIFI').val;\n console.log('in wifiPowerButton',curStatus);\n if(curStatus === 0) {\n self.activeDevice.iWriteMany(\n ['POWER_WIFI','POWER_WIFI_DEFAULT'],\n [1,1]\n )\n .then(getWifiResFunc(1,'success'),getWifiResFunc(1,'err'));\n } else {\n self.activeDevice.iWriteMany(\n ['POWER_WIFI','POWER_WIFI_DEFAULT'],\n [0,0]\n )\n .then(getWifiResFunc(0,'success'),getWifiResFunc(0,'err'));\n }\n };\n this.readWifiStatus = function(onSuccess) {\n self.activeDevice.sReadMany(\n ['POWER_WIFI','POWER_WIFI_DEFAULT']\n )\n .then(function(newResults){\n var data = newResults.map(function(newResult) {\n return newResult.res;\n });\n console.log(data);\n onSuccess(data);\n },function(err){\n console.log(err);\n }\n );\n };\n this.wifiDHCPSelect = function(data, onSuccess) {\n // console.log('in wifiDHCPSelect listener');\n var dhcpOption = data.eventData.toElement.id;\n var dhcpTextId;\n var dhcpTextEl;\n\n if (dhcpOption === 'WiFi_DHCP_Auto') {\n dhcpTextId = data.eventData.toElement.parentElement.parentElement.parentElement.id;\n dhcpTextEl = $('#'+dhcpTextId+' .btnText');\n self.showAutoWifiSettings();\n if(self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT').val === 0) {\n self.showWifiDHCPChanged();\n dhcpTextEl.addClass('inputVerified');\n } else {\n self.hideWifiDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n }\n } else if (dhcpOption === 'WiFi_DHCP_Manual') {\n dhcpTextId = data.eventData.toElement.parentElement.parentElement.parentElement.id;\n dhcpTextEl = $('#'+dhcpTextId+' .btnText');\n self.showManualWifiSettings();\n if(self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT').val === 0) {\n self.hideWifiDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n } else {\n self.showWifiDHCPChanged();\n dhcpTextEl.addClass('inputVerified');\n }\n }\n self.updateWifiValidationStatus(true);\n onSuccess();\n };\n // Function that stalls the execution queue to wait for proper wifi state\n this.waitForWifiNotBlocking = function() {\n var ioDeferred = q.defer();\n var checkWifiStatus = function() {\n var innerIODeferred = q.defer();\n console.log('Reading Wifi Status (reg)');\n self.activeDevice.qRead('WIFI_STATUS')\n .then(function(result) {\n console.log('Wifi status (reg)',result);\n if((result != 2904) && (result != 2902)) {\n innerIODeferred.resolve();\n } else {\n innerIODeferred.reject();\n }\n },innerIODeferred.reject);\n return innerIODeferred.promise;\n };\n var getDelayAndCheck = function(iteration) {\n var iteration = 0;\n var timerDeferred = q.defer();\n var configureTimer = function() {\n console.log('configuring wifi status timer');\n setTimeout(delayedCheckWifiStatus,500);\n };\n var delayedCheckWifiStatus = function() {\n console.log('Reading Wifi Status (delay)',iteration);\n self.activeDevice.qRead('WIFI_STATUS')\n .then(function(result) {\n console.log('Wifi status (delay)',result,iteration);\n if((result != 2904) && (result != 2902)) {\n timerDeferred.resolve();\n } else {\n iteration += 1;\n configureTimer();\n }\n },timerDeferred.reject);\n };\n configureTimer();\n return timerDeferred.promise;\n };\n checkWifiStatus()\n .then(ioDeferred.resolve,getDelayAndCheck)\n .then(ioDeferred.resolve,function(err){\n console.log('Failed to wait for WIFI_STATUS',err);\n ioDeferred.reject();\n });\n return ioDeferred.promise;\n };\n this.clearEthernetInputs = function() {\n var dhcpTextEl = $('#ethernetDHCPSelect .btnText');\n self.hideEthernetDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n var ethernetRegisters = self.getEthernetIPRegisterList();\n console.log('Clearing Ethernet Inputs');\n ethernetRegisters.forEach(function(reg) {\n var autoVal = $('#'+reg+'_VAL .'+reg+'_AUTO_VAL');\n var manVal = $('#'+reg+'_VAL .'+reg+'_MAN_VAL');\n var newVal = self.currentValues.get(reg).fVal;\n autoVal.text(newVal);\n // manVal.attr('placeholder',newVal);\n manVal.val(newVal);\n manVal.trigger('change');\n });\n console.log('Ethernet Inputs Cleared');\n };\n this.clearWifiInputs = function() {\n var dhcpTextEl = $('#wifiDHCPSelect .btnText');\n self.hideWifiDHCPChanged();\n dhcpTextEl.removeClass('inputVerified');\n var wifiRegisters = self.getWiFiIPRegisterList();\n console.log('Clearing Wifi Inputs');\n wifiRegisters.forEach(function(reg) {\n var autoVal = $('#'+reg+'_VAL .'+reg+'_AUTO_VAL');\n var manVal = $('#'+reg+'_VAL .'+reg+'_MAN_VAL');\n var newVal = self.currentValues.get(reg).fVal;\n autoVal.text(newVal);\n // manVal.attr('placeholder',newVal);\n manVal.val(newVal);\n manVal.trigger('change');\n });\n console.log('Wifi Inputs Cleared');\n };\n this.wifiApplyButton = function(data, onSuccess) {\n var configData = self.getNewWifiSettings();\n var newNames = configData.newRegisters;\n var newVals = configData.newVals;\n var names = configData.registers;\n var vals = configData.values;\n var networkName = self.getInputVal('WIFI_SSID_DEFAULT_VAL');\n var networkPassword = self.getInputVal('WIFI_PASSWORD_DEFAULT_VAL');\n\n var applySettings = false;\n\n var getIOError = function(message) {\n return function(err) {\n var ioDeferred = q.defer();\n if(typeof(err) === 'number') {\n console.log(message,self.ljmDriver.errToStrSync(err));\n } else {\n console.log('Wifi Applying Settings Error',message,err);\n }\n ioDeferred.resolve();\n return ioDeferred.promise;\n };\n };\n // Function that stalls the execution queue to wait for proper wifi state\n var waitForWifi = function() {\n var ioDeferred = q.defer();\n var checkWifiStatus = function() {\n var innerIODeferred = q.defer();\n // console.log('Reading Wifi Status (reg)');\n self.activeDevice.qRead('WIFI_STATUS')\n .then(function(result) {\n if(result != 2904) {\n innerIODeferred.resolve();\n } else {\n innerIODeferred.reject();\n }\n },innerIODeferred.reject);\n return innerIODeferred.promise;\n };\n var getDelayAndCheck = function(iteration) {\n var timerDeferred = q.defer();\n var configureTimer = function() {\n setTimeout(delayedCheckWifiStatus,500);\n };\n var delayedCheckWifiStatus = function() {\n // console.log('Reading Wifi Status (delay)',iteration);\n self.activeDevice.qRead('WIFI_STATUS')\n .then(function(result) {\n if(result != 2904) {\n timerDeferred.resolve();\n } else {\n iteration += 1;\n configureTimer();\n }\n },timerDeferred.reject);\n };\n configureTimer();\n return function() {\n return timerDeferred.promise;\n };\n };\n checkWifiStatus()\n .then(ioDeferred.resolve,getDelayAndCheck(0))\n .then(ioDeferred.resolve,ioDeferred.reject);\n return ioDeferred.promise;\n };\n\n var writeSettings = function() {\n var ioDeferred = q.defer();\n if(newNames.length > 0) {\n applySettings = true;\n self.activeDevice.iWriteMany(names,vals)\n .then(ioDeferred.resolve,ioDeferred.reject);\n } else {\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n var writeNetworkName = function() {\n var ioDeferred = q.defer();\n if(networkName.isNew) {\n applySettings = true;\n self.activeDevice.iWrite('WIFI_SSID',networkName.value)\n .then(ioDeferred.resolve,ioDeferred.reject);\n } else {\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n var writeNetworkNameDefault = function() {\n var ioDeferred = q.defer();\n if(networkName.isNew) {\n applySettings = true;\n self.activeDevice.iWrite('WIFI_SSID_DEFAULT',networkName.value)\n .then(ioDeferred.resolve,ioDeferred.reject);\n } else {\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n var writeNetworkPassword = function() {\n var ioDeferred = q.defer();\n if(networkPassword.isNew) {\n applySettings = true;\n self.activeDevice.iWrite('WIFI_PASSWORD_DEFAULT',networkPassword.value)\n .then(ioDeferred.resolve,ioDeferred.reject);\n } else {\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n var enableWifiByDefault = function() {\n var ioDeferred = q.defer();\n self.activeDevice.iWrite('POWER_WIFI_DEFAULT',1)\n .then(ioDeferred.resolve,ioDeferred.reject);\n return ioDeferred.promise;\n };\n var applyWifiSettings = function() {\n var ioDeferred = q.defer();\n // self.ljmDriver.writeLibrarySync('LJM_SEND_RECEIVE_TIMEOUT_MS',2000);\n if(applySettings) {\n self.activeDevice.iWrite('WIFI_APPLY_SETTINGS',1)\n .then(function(res) {\n console.log('WIFI_APPLY_SETTINGS-suc',res);\n // self.ljmDriver.writeLibrarySync('LJM_SEND_RECEIVE_TIMEOUT_MS',20000);\n ioDeferred.resolve();\n },function(err) {\n console.log('WIFI_APPLY_SETTINGS-err',err);\n // self.ljmDriver.writeLibrarySync('LJM_SEND_RECEIVE_TIMEOUT_MS',20000);\n ioDeferred.resolve();\n });\n } else {\n console.log('Not Applying Wifi Settings');\n ioDeferred.resolve();\n }\n return ioDeferred.promise;\n };\n \n var performWrites = networkPassword.isNew;\n if(performWrites) {\n waitForWifi()\n .then(writeSettings,getIOError('disableWifi'))\n // .then(writeNetworkName,getIOError('writeSettings'))\n .then(writeNetworkNameDefault,getIOError('writeSettings'))\n .then(writeNetworkPassword,getIOError('writeNetworkNameDefault'))\n .then(enableWifiByDefault,getIOError('writeNetworkPassword'))\n .then(applyWifiSettings,getIOError('enableWifiByDefault'))\n .then(function() {\n console.log('Successfully Applied Wifi Settings',names,vals,configData);\n // Save Current Settings\n self.saveCurrentValue(\n 'WIFI_SSID_DEFAULT',\n networkName.value,\n networkName.value\n );\n self.saveCurrentValue(\n 'WIFI_SSID',\n networkName.value,\n networkName.value\n );\n self.saveCurrentValue(\n 'WIFI_PASSWORD_DEFAULT',\n networkPassword.value,\n networkPassword.value\n );\n names.forEach(function(name,index){\n var strVal = '';\n if(name === 'WIFI_DHCP_ENABLE_DEFAULT') {\n if(vals[index] === 0) {\n strVal = 'Disabled';\n } else {\n strVal = 'Enabled';\n }\n } else {\n strVal = self.formatIPAddress({value:vals[index]});\n }\n console.log(name,vals[index],strVal);\n self.saveCurrentValue(\n name,\n vals[index],\n strVal\n );\n });\n self.clearWifiInputs();\n onSuccess();\n },function(err) {\n console.log('Error Applying Wifi Settings',err);\n showAlert('Failed to Apply Wifi Settings');\n onSuccess();\n });\n } else {\n console.log('Must Enter a Network Password before applying settings');\n onSuccess();\n }\n };\n this.wifiCancelButton = function(data, onSuccess) {\n console.log('in wifiCancelButton listener');\n var dhcp = self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT').val;\n var buttonText = self.dhcpText[dhcp];\n $('#wifiDHCPSelect .btnText').text(buttonText);\n if(dhcp === 0) {\n self.showManualWifiSettings();\n } else {\n self.showAutoWifiSettings();\n }\n self.clearWifiInputs();\n onSuccess();\n };\n this.wifiHelpButton = function(data, onSuccess) {\n console.log('in wifiHelpButton listener');\n // gui.Shell.openExternal(\"http://labjack.com/support/app-notes/basic-networking-troubleshooting\");\n gui.Shell.openExternal(\"https://labjack.com/support/app-notes/wifi-and-ethernet-t7-t4-t7-pro\");\n onSuccess();\n };\n this.getEthernetStatus = function() {\n var statusString = '';\n var power = self.currentValues.get('POWER_ETHERNET').val;\n var ip = self.currentValues.get('ETHERNET_IP').val;\n if(power === 0) {\n statusString = 'Un-Powered';\n } else {\n if(ip === 0) {\n statusString = 'Disconnected';\n } else {\n statusString = 'Connected';\n }\n }\n return statusString;\n };\n this.getStatusMessage = function(type) {\n var statusString = '';\n if (type === 'ethernet') {\n var isPowered = self.currentValues.get('POWER_ETHERNET').val;\n var ethernetIP = self.currentValues.get('ETHERNET_IP').val;\n var ethernetIPs = self.currentValues.get('ETHERNET_IP').fVal;\n var isDHCP = self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT').val;\n var defaultIPs = self.currentValues.get('ETHERNET_IP_DEFAULT').fVal;\n if (isPowered === 0) {\n statusString = 'Ethernet is currently not powered.';\n } else {\n if(ethernetIP === 0) {\n // statusString = 'Ethernet is not connected but is trying to connect';\n // if (isDHCP === 0) {\n // statusString += ' with the IP address ';\n // statusString += defaultIPs;\n // } else {\n // statusString += ' with DHCP enabled';\n // }\n // statusString += '.';\n statusString = 'Either the cable for Ethernet is not'\n statusString += ' plugged in or the device at the other '\n statusString += 'end is not responding.'\n } else {\n statusString = 'Ethernet is connected and has the IP address ';\n statusString += ethernetIPs;\n statusString += '.';\n }\n }\n } else if (type === 'wifi') {\n var ssidDefault = self.currentValues.get('WIFI_SSID_DEFAULT').val;\n var ssid = self.currentValues.get('WIFI_SSID').val;\n var wifiStatus = self.currentValues.get('WIFI_STATUS').val;\n var wifiIP = self.currentValues.get('WIFI_IP').fVal;\n var wifiDHCP = self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT').val;\n var wifiDefaultIP = self.currentValues.get('WIFI_IP_DEFAULT').fVal;\n var wifiRSSI = self.currentValues.get('WIFI_RSSI').fVal;\n\n if(((wifiStatus == 2900) && (ssid === ssidDefault) && (ssid === ''))\n || ((wifiStatus == 2900) && (ssid !== ''))) {\n statusString = 'WiFi is connected to ';\n statusString += ssid;\n statusString += ' and has the IP address ';\n statusString += wifiIP;\n statusString +=' with an initial signal strength of ';\n statusString += wifiRSSI;\n statusString += '.';\n } else if (wifiStatus == 2903) {\n statusString = 'WiFi is currently not powered.';\n } else {\n statusString = 'WiFi is not connected but is trying to connect to ';\n statusString += ssidDefault;\n if (wifiDHCP === 0) {\n statusString += ' with the IP address ';\n statusString += wifiDefaultIP;\n } else {\n statusString += ' with DHCP enabled';\n }\n statusString += '.';\n }\n } else {\n throw 'getStatusMessage, wrong type';\n }\n return statusString;\n };\n\n this.compileTemplate = function(templateName) {\n try {\n self.templates[templateName] = handlebars.compile(\n self.moduleData.htmlFiles[templateName]\n );\n } catch(err) {\n console.error(\n 'Error compiling template',\n templateName,\n err\n );\n }\n };\n \n var templatesToCompile = [\n 'ethernet_settings',\n 'wifi_settings',\n 'current_pc_settings',\n ];\n\n /**\n * Function is called once every time the module tab is selected, loads the module.\n * @param {[type]} framework The active framework instance.\n * @param {[type]} onError Function to be called if an error occurs.\n * @param {[type]} onSuccess Function to be called when complete.\n **/\n this.onModuleLoaded = function(framework, onError, onSuccess) {\n // Save Module Constant objects\n self.moduleConstants = framework.moduleConstants;\n self.configOnlyRegisters = framework.moduleConstants.configOnlyRegisters;\n self.ethernetRegisters = framework.moduleConstants.ethernetRegisters;\n self.wifiRegisters = framework.moduleConstants.wifiRegisters;\n\n self.ethernetStatusRegisters = framework.moduleConstants.ethernetStatusRegisters;\n self.wifiStatusRegisters = framework.moduleConstants.wifiStatusRegisters;\n\n\n self.moduleData = framework.moduleData;\n\n // Compile module templates\n \n templatesToCompile.forEach(self.compileTemplate);\n\n \n onSuccess();\n };\n \n /**\n * Function is called once every time a user selects a new device. \n * @param {object} framework The active framework instance.\n * @param {[type]} device The active framework instance.\n * @param {[type]} onError Function to be called if an error occurs.\n * @param {[type]} onSuccess Function to be called when complete.\n **/\n this.onDeviceSelected = function(framework, device, onError, onSuccess) {\n // Save the selected device as the module's activeDevice\n self.activeDevice = device;\n\n // Save the devices current connection type\n self.connectionType = device.savedAttributes.connectionType;\n\n // Configure bindings...\n var genericConfigCallback = function(data, onSuccess) {\n // console.log('genericConfigCallback');\n onSuccess();\n };\n var genericPeriodicCallback = function(data, onSuccess) {\n // console.log('genericPeriodicCallback');\n // self.saveCurrentValue(data.binding.binding,data.value,data.stringVal);\n self.saveBufferedValue(data.binding.binding,data.value,data.stringVal);\n if(data.binding.binding === 'ETHERNET_IP') {\n // console.log(data.binding.binding,data.value,data.stringVal);\n }\n onSuccess();\n };\n var ethernetStatusListner = function(data, onSuccess) {\n // console.log('in ethernetStatusListner!');\n self.bufferedValues.forEach(function(data,name){\n // console.log(name,data);\n });\n var currentIP = self.currentValues.get('ETHERNET_IP').val;\n var currentIPs = self.currentValues.get('ETHERNET_IP').fVal;\n var newIP = self.bufferedValues.get('ETHERNET_IP').val;\n var newIPs = self.bufferedValues.get('ETHERNET_IP').fVal;\n var currentPower = self.currentValues.get('POWER_ETHERNET').val;\n var newPower = self.currentValues.get('POWER_ETHERNET').val;\n var updateInfo = self.refreshEthernetInfo;\n // var newIsPowered = self.activeDevice.read('POWER_ETHERNET');\n var currentIsPowered = self.currentValues.get('POWER_ETHERNET');\n var checkEthernetConnection = function() {\n if(currentIP == newIP) {\n\n } else {\n updateInfo = true;\n if (newIP === 0) {\n // console.log('Ethernet Disconnected!');\n self.isEthernetConnected = false;\n } else {\n // console.log('Ethernet Connected!');\n self.isEthernetConnected = true;\n }\n }\n };\n var checkEthernetPower = function() {\n if(currentPower == newPower) {\n \n } else {\n updateInfo = true;\n }\n };\n checkEthernetPower();\n checkEthernetConnection();\n // updateActiveEthernetSettings()\n var updateEthernetInfo = function() {\n var message = self.getStatusMessage('ethernet');\n $('#ethernetStatusMessage').text(message);\n var ip = self.currentValues.get('ETHERNET_IP').val;\n var ethStatusString = self.getEthernetStatus();\n $('#ethernet_connection_status').text(ethStatusString);\n self.updateEthernetSettings();\n self.refreshEthernetInfo = false;\n };\n if(updateInfo) {\n self.commitBufferedValues();\n self.updateActiveEthernetSettings()\n .then(function() {\n updateEthernetInfo();\n onSuccess();\n },function() {\n console.log('onModuleLoaded.ethernetStatusListner error');\n updateEthernetInfo();\n onSuccess();\n });\n \n } else {\n onSuccess();\n }\n };\n\n var wifiStatusListner = function(data, onSuccess) {\n\n var currentStatus = self.currentValues.get('WIFI_STATUS').val;\n var newStatus = data.value;\n var updateStatusMessage = self.refreshWifiInfo;\n if(currentStatus == newStatus) {\n if (newStatus == 2903 ) {\n self.saveCurrentValue('POWER_WIFI',0,'Disabled');\n $('#wifiPowerButton .buttonText').text('Turn WiFi On');\n } else if (newStatus == 2900) {\n var curSSID = self.currentValues.get('WIFI_SSID').val;\n if(curSSID === '') {\n updateStatusMessage = true;\n } else {\n var curDefaultSSID = self.currentValues.get('WIFI_SSID_DEFAULT').val;\n if (curSSID === curDefaultSSID) {\n updateStatusMessage = false;\n } else {\n updateStatusMessage = true;\n }\n }\n }\n } else {\n // console.log('WiFi Status has changed',data.value,data.stringVal);\n self.saveCurrentValue('WIFI_STATUS',data.value,data.stringVal);\n updateStatusMessage = true;\n if( newStatus == 2900 ) {\n self.saveCurrentValue('POWER_WIFI',1,'Enabled');\n $('#wifiPowerButton .buttonText').text('Turn WiFi Off');\n self.isWifiConnected = true;\n // console.log('Wifi Connected!');\n self.activeDevice.sRead('WIFI_SSID');\n // console.log('Wifi SSID: (on connect-change)',);\n } else if (newStatus == 2903) {\n self.saveCurrentValue('POWER_WIFI',0,'Disabled');\n $('#wifiPowerButton .buttonText').text('Turn WiFi On');\n } else {\n self.saveCurrentValue('POWER_WIFI',1,'Enabled');\n $('#wifiPowerButton .buttonText').text('Turn WiFi Off');\n self.isWifiConnected = false;\n // console.log('Wifi Disconnected!');\n }\n }\n var updateWifiInfo = function() {\n var message = self.getStatusMessage('wifi');\n $('#wifiStatusMessage').text(message);\n var ssidDefault = self.currentValues.get('WIFI_SSID_DEFAULT').val;\n var ssid = self.currentValues.get('WIFI_SSID').val;\n if(self.isWifiConnected) {\n if(ssid === '') {\n if(ssid === ssidDefault) {\n self.updateWifiSettings();\n }\n } else {\n self.updateWifiSettings();\n }\n }\n self.refreshWifiInfo = false;\n };\n if(updateStatusMessage) {\n self.updateActiveWifiSettings()\n .then(function() {\n updateWifiInfo();\n onSuccess();\n },function() {\n console.log('onModuleLoaded.wifiStatusListner error');\n updateWifiInfo();\n onSuccess();\n });\n \n } else {\n onSuccess();\n }\n };\n var genericCallback = function(data, onSuccess) {\n console.log('genericCallback');\n onSuccess();\n };\n // console.log('moduleConstants', self.moduleConstants);\n var smartBindings = [];\n\n // Add setupOnlyRegisters\n self.configOnlyRegisters.forEach(function(regInfo){\n if(regInfo.deviceTypes.indexOf(self.activeDevice.savedAttributes.deviceTypeName) >= 0) {\n smartBindings.push({\n bindingName: regInfo.name, \n smartName: 'setupOnlyRegister',\n configCallback: genericConfigCallback\n });\n }\n });\n\n var addSmartBinding = function(regInfo) {\n if(regInfo.deviceTypes.indexOf(self.activeDevice.savedAttributes.deviceTypeName) >= 0) {\n var binding = {};\n var format;\n var customFormatFunc;\n var isPeriodic = (typeof(regInfo.isPeriodic) === 'boolean');\n isPeriodic &= (regInfo.isPeriodic);\n if (regInfo.type === 'ip') {\n format = 'customFormat';\n customFormatFunc = self.formatIPAddress; \n } else if (regInfo.type === 'status') {\n format = 'customFormat';\n customFormatFunc = self.formatStatus; \n } else if (regInfo.type === 'rssi') {\n format = 'customFormat';\n customFormatFunc = self.formatRSSI;\n } else if (regInfo.type === 'wifiStatus') {\n format = 'customFormat';\n customFormatFunc = self.formatWifiStatus;\n }\n \n binding.bindingName = regInfo.name;\n binding.format = format;\n binding.customFormatFunc = customFormatFunc;\n \n if (isPeriodic) {\n binding.smartName = 'readRegister';\n // if (regInfo.name === 'ETHERNET_IP') {\n // binding.periodicCallback = ethernetStatusListner;\n // } else \n if (regInfo.name === 'WIFI_STATUS') {\n binding.periodicCallback = wifiStatusListner;\n } else {\n binding.periodicCallback = genericPeriodicCallback;\n }\n } else {\n binding.smartName = 'setupOnlyRegister';\n }\n binding.configCallback = genericConfigCallback;\n smartBindings.push(binding);\n }\n };\n\n // Add Ethernet readRegisters\n self.ethernetRegisters.forEach(addSmartBinding);\n\n // Add Wifi readRegisters\n self.wifiRegisters.forEach(addSmartBinding);\n\n var customSmartBindings = [\n {\n // Define binding to handle Ethernet-Status updates.\n bindingName: 'ethernetStatusManager', \n smartName: 'periodicFunction',\n periodicCallback: ethernetStatusListner\n },{\n // Define binding to handle Ethernet Power button presses.\n bindingName: 'ethernetPowerButton', \n smartName: 'clickHandler',\n callback: self.ethernetPowerButton\n },{\n // Define binding to handle Ethernet DHCP-select button presses.\n bindingName: 'ethernet-DHCP-Select-Toggle', \n smartName: 'clickHandler',\n callback: self.ethernetDHCPSelect\n },{\n // Define binding to handle Ethernet Apply button presses.\n bindingName: 'ethernetApplyButton', \n smartName: 'clickHandler',\n callback: self.ethernetApplyButton\n },{\n // Define binding to handle Ethernet Cancel button presses.\n bindingName: 'ethernetCancelButton', \n smartName: 'clickHandler',\n callback: self.ethernetCancelButton\n },{\n // Define binding to handle Ethernet Cancel button presses.\n bindingName: 'ethernetHelpButton', \n smartName: 'clickHandler',\n callback: self.ethernetHelpButton\n },{\n // Define binding to handle Wifi Power button presses.\n bindingName: 'wifiPowerButton', \n smartName: 'clickHandler',\n callback: self.wifiPowerButton\n },{\n // Define binding to handle Wifi DHCP-select button presses.\n bindingName: 'wifi-DHCP-Select-Toggle', \n smartName: 'clickHandler',\n callback: self.wifiDHCPSelect\n },{\n // Define binding to handle Wifi Apply button presses.\n bindingName: 'wifiApplyButton', \n smartName: 'clickHandler',\n callback: self.wifiApplyButton\n },{\n // Define binding to handle Wifi Cancel button presses.\n bindingName: 'wifiCancelButton', \n smartName: 'clickHandler',\n callback: self.wifiCancelButton\n },{\n // Define binding to handle Ethernet Cancel button presses.\n bindingName: 'wifiHelpButton', \n smartName: 'clickHandler',\n callback: self.wifiHelpButton\n }\n ];\n // Save the smartBindings to the framework instance.\n framework.putSmartBindings(smartBindings);\n // Filter the \"customSmartBindings\" to get rid of WiFi handlers if the\n // device doesn't have WiFi.\n var filteredCustomSmartBindings = customSmartBindings;\n\n if(self.activeDevice.savedAttributes.deviceTypeName === 'T4') {\n filteredCustomSmartBindings = customSmartBindings.filter(function(binding) {\n if(binding.bindingName.indexOf('wifi') >= 0) {\n // console.log('Using a T4, filtering out wifi customSmartBinding', binding);\n return false;\n } else {\n return true;\n }\n });\n }\n // Save the customSmartBindings to the framework instance.\n framework.putSmartBindings(filteredCustomSmartBindings);\n // Clear current config bindings to prevent from double-event listeners.\n framework.clearConfigBindings();\n framework.setStartupMessage('Reading Device Configuration');\n\n // Indicate to the framework that it is ok to continue\n onSuccess();\n };\n\n /**\n * Function to configure the module's view.html template.\n * @param {object} framework the sdFramework object returned by the \n * framework.\n **/\n this.configureModuleContext = function(framework) {\n var ethernetWarningMessage = '';\n var wifiWarningMessage = '';\n var ethernetPowerButtonWarning = '';\n var wifiPowerButtonWarning = '';\n var showWifiWarning = false;\n var showEthernetWarning = false;\n if(self.connectionType == driver_const.LJM_CT_TCP) {\n showEthernetWarning = true;\n showWifiWarning = true;\n ethernetWarningMessage = 'Current Connection type is TCP, applying settings may break your connection.';\n wifiWarningMessage = 'Current Connection type is TCP, applying settings may break your connection.';\n ethernetPowerButtonWarning = 'Current Connection type is Ethernet, turning off Ethernet may break your connection.';\n wifiPowerButtonWarning = 'Current Connection type is WiFi, turning off Wifi may break your connection.';\n } else if (self.connectionType == driver_const.LJM_CT_ETHERNET) {\n showEthernetWarning = true;\n ethernetWarningMessage = 'Current Connection type is Ethernet, applying settings may break your connection.';\n ethernetPowerButtonWarning = 'Current Connection type is Ethernet, turning off Ethernet will break your connection.';\n } else if(self.connectionType == driver_const.LJM_CT_WIFI) {\n showWifiWarning = true;\n wifiWarningMessage = 'Current Connection type is WiFi, applying settings may break your connection.';\n wifiPowerButtonWarning = 'Current Connection type is WiFi, turning off Wifi will break your connection.';\n }\n self.moduleContext.showEthernetWarning = showEthernetWarning;\n self.moduleContext.ethernetWarningMessage = ethernetWarningMessage;\n self.moduleContext.ethernetPowerButtonWarning = ethernetPowerButtonWarning;\n self.moduleContext.showWifiWarning = showWifiWarning;\n self.moduleContext.wifiWarningMessage = wifiWarningMessage;\n self.moduleContext.wifiPowerButtonWarning = wifiPowerButtonWarning;\n\n var hasWiFi = false;\n self.moduleContext.hasWiFi = null;\n if(self.activeDevice.savedAttributes.deviceTypeName === 'T7') {\n if (self.activeDevice.savedAttributes.isPro) {\n hasWiFi = true;\n self.moduleContext.hasWiFi = true;\n }\n }\n\n var hasPowerEthernet = true;\n if(self.activeDevice.savedAttributes.deviceTypeName === 'T4') {\n hasPowerEthernet = false;\n }\n self.moduleContext.hasPowerEthernet = hasPowerEthernet;\n\n var networkNameDefault;\n if(hasWiFi) {\n // Get and save wifiNetworkName\n networkNameDefault = self.currentValues.get('WIFI_SSID_DEFAULT').fVal;\n self.moduleContext.wifiNetworkName = networkNameDefault;\n }\n\n // Get and save ethernetPowerStatus\n var isEthernetPowered = self.currentValues.get('POWER_ETHERNET').val;\n if(isEthernetPowered === 0) {\n self.moduleContext.isEthernetPowered = false;\n self.moduleContext.ethernetPowerButtonString = 'Turn Ethernet On';\n } else {\n self.moduleContext.isEthernetPowered = true;\n self.moduleContext.ethernetPowerButtonString = 'Turn Ethernet Off';\n }\n\n var isWifiPowered;\n if(hasWiFi) {\n // Get and save wifiPowerStatus\n isWifiPowered = self.currentValues.get('POWER_WIFI').val;\n if(isWifiPowered === 0) {\n self.moduleContext.isWifiPowered = false;\n self.saveCurrentValue('POWER_WIFI',0,'Disabled');\n self.moduleContext.wifiPowerButtonString = 'Turn WiFi On';\n } else {\n self.moduleContext.isWifiPowered = true;\n self.saveCurrentValue('POWER_WIFI',1,'Enabled');\n self.moduleContext.wifiPowerButtonString = 'Turn WiFi Off';\n }\n if(isWifiPowered === 0) {\n self.saveCurrentValue('WIFI_IP',0,'0.0.0.0');\n self.saveCurrentValue('WIFI_SUBNET',0,'0.0.0.0');\n self.saveCurrentValue('WIFI_GATEWAY',0,'0.0.0.0');\n }\n }\n\n \n\n var initialEthernetDHCPStatus = self.currentValues.get('ETHERNET_DHCP_ENABLE_DEFAULT');\n if (initialEthernetDHCPStatus.val === 0) {\n self.moduleContext.ethernetDHCPStatusBool = false;\n self.moduleContext.ethernetDHCPStatusString = self.dhcpText[0];\n } else {\n self.moduleContext.ethernetDHCPStatusBool = true;\n self.moduleContext.ethernetDHCPStatusString = self.dhcpText[1];\n }\n\n var initialWifiDHCPStatus;\n if(hasWiFi) {\n initialWifiDHCPStatus = self.currentValues.get('WIFI_DHCP_ENABLE_DEFAULT');\n if (initialWifiDHCPStatus.val === 0) {\n self.moduleContext.wifiDHCPStatusBool = false;\n self.moduleContext.wifiDHCPStatusString = self.dhcpText[0];\n } else {\n self.moduleContext.wifiDHCPStatusBool = true;\n self.moduleContext.wifiDHCPStatusString = self.dhcpText[1];\n }\n }\n self.moduleContext.dhcpDisabledText = self.dhcpText[0];\n self.moduleContext.dhcpEnabledText = self.dhcpText[1];\n\n var initialEthernetIP = self.currentValues.get('ETHERNET_IP').val;\n if(initialEthernetIP === 0) {\n self.isEthernetConnected = false;\n } else {\n self.isEthernetConnected = true;\n }\n var ethStatusString = self.getEthernetStatus();\n self.moduleContext.ethernetConnectionStatus = ethStatusString;\n\n var initialWifiStatus;\n if(hasWiFi) {\n initialWifiStatus = self.currentValues.get('WIFI_STATUS').val;\n if (initialWifiStatus === 2900) {\n self.isWifiConnected = true;\n } else {\n self.isWifiConnected = false;\n }\n }\n\n var ethernetStatusMessage = self.getStatusMessage('ethernet');\n self.moduleContext.ethernetStatusMessage = ethernetStatusMessage;\n \n var wifiStatusMessage;\n if(hasWiFi) {\n wifiStatusMessage = self.getStatusMessage('wifi');\n self.moduleContext.wifiStatusMessage = wifiStatusMessage;\n }\n\n var i;\n var dhcpStatus;\n // Get and save ethernetIPRegisterList\n var ethernetIPRegisters = self.getIPRegisters(self.ethernetRegisters);\n //Add the isDHCPAuto flag\n for(i=0;i<ethernetIPRegisters.length;i++){\n dhcpStatus = self.moduleContext.ethernetDHCPStatusBool;\n ethernetIPRegisters[i].isDHCPAuto = dhcpStatus;\n }\n self.moduleContext.ethernetIPRegisters = ethernetIPRegisters;\n\n self.moduleContext.ethernetStatusRegisters = self.getOrganizedEthernetIPSettingsRegList();\n\n \n if(hasWiFi) {\n // Get and save wifiIPRegisterList\n var wifiIPRegisters = self.getIPRegisters(self.wifiRegisters);\n //Add the isDHCPAuto flag\n for(i=0;i<wifiIPRegisters.length;i++){\n dhcpStatus = self.moduleContext.wifiDHCPStatusBool;\n wifiIPRegisters[i].isDHCPAuto = dhcpStatus;\n }\n self.moduleContext.wifiIPRegisters = wifiIPRegisters;\n self.moduleContext.wifiStatusRegisters = self.getOrganizedWiFiIPSettingsRegList();\n }\n\n // console.log('Init context',self.moduleContext);\n\n self.moduleContext.availableNetworkInterfaces = {};\n try {\n var os = require('os');\n var networkInterfaces = {};\n var availableInterfaces = os.networkInterfaces();\n var keys = Object.keys(availableInterfaces);\n keys.forEach(function(key) {\n var interfaceID = key.split(' ').join('_');\n networkInterfaces[interfaceID] = {};\n networkInterfaces[interfaceID].addresses = availableInterfaces[key];\n networkInterfaces[interfaceID].id = interfaceID;\n networkInterfaces[interfaceID].name = key;\n \n });\n console.log('Available network interfaces (network_settings/controller.js)', networkInterfaces);\n self.moduleContext.networkInterfaces = networkInterfaces;\n } catch(err) {\n // Error...\n console.log('Error getting networkInterfaces info', err);\n }\n\n templatesToCompile.forEach(function(templateName) {\n try {\n self.moduleContext[templateName] = self.templates[templateName](\n self.moduleContext\n );\n } catch(err) {\n console.error('error populating template', templateName);\n }\n });\n framework.setCustomContext(self.moduleContext);\n };\n\n this.onDeviceConfigured = function(framework, device, setupBindings, onError, onSuccess) {\n // console.log('In onDeviceConfigured');\n var isConfigError = false;\n var errorAddresses = [];\n var errorBindings = dict();\n setupBindings.forEach(function(setupBinding){\n if(setupBinding.status === 'error') {\n isConfigError = true;\n var addr = setupBinding.address;\n var dnrAddr = [\n 'WIFI_MAC',\n 'ETHERNET_MAC',\n 'WIFI_PASSWORD_DEFAULT'\n ];\n if(dnrAddr.indexOf(addr) < 0) {\n errorAddresses.push(addr);\n errorBindings.set(addr,framework.setupBindings.get(addr));\n }\n }\n self.saveConfigResult(\n setupBinding.address,\n {val:setupBinding.result,fVal:setupBinding.formattedResult,status:setupBinding.status},\n setupBinding.status\n );\n });\n\n // Asynchronously loop through the addresses that failed to read during \n // the modules initial load step. This commonly happens when the T7's\n // flash is un-available (wifi-module is starting) aka reading _DEFAULT \n // values.\n async.eachSeries(\n errorAddresses,\n function( addr, callback) {\n var binding = errorBindings.get(addr);\n self.activeDevice.qRead(addr)\n .then(function(result){\n var strRes = \"\";\n if(binding.format === 'customFormat') {\n strRes = binding.formatFunc({value:result});\n } else {\n strRes = result;\n }\n console.log('re-read-success',addr,result,strRes);\n callback();\n }, function(err) {\n console.log('re-read-err',addr,err);\n showAlert('Issues Loading Module'+err.toString());\n callback();\n });\n }, function(err){\n // When we are finished re-reading values call function to \n // configure the module's initial display context & return \n // control back to the framework.\n // console.log('Configure module context');\n self.configureModuleContext(framework);\n onSuccess();\n });\n };\n\n /**\n * Function to be called when template is loaded to automatically fill\n * inputs with information.\n **/\n this.configureInputsForTesting = function() {\n // var os = require(\"os\");\n // var computerName = os.hostname();\n // if(computerName === 'chris-johnsons-macbook-pro-2.local' && window.toolbar.visible) {\n // // self.setNetworkName('AAA');\n // self.setWifiPassword('timmarychriskevin');\n // }\n\n // self.setNetworkName('5PoundBass');\n // self.setNetworkName('- DEN Airport Free WiFi');\n // self.setNetworkName('Courtyard_GUEST');\n // self.setWifiPassword('smgmtbmb3cmtbc');\n // self.setNetworkName('AAA');\n };\n\n /**\n * Function gets called by the framework when the module's template has\n * been loaded.\n * @param {object} framework the framework object\n * @param {function} onError function to be called if an error occurs.\n * @param {function} onSuccess function to be called when finished \n * successfully.\n **/\n this.onTemplateLoaded = function(framework, onError, onSuccess) {\n // Attach the input validators to the ui boxes.\n self.attachInputValidators();\n\n // force validations to occur\n self.selectivelyShowEthernetAlerts();\n self.selectivelyShowWifiAlerts();\n \n // Collapse tables\n $('.collapse').collapse();\n \n onSuccess();\n };\n this.onRegisterWrite = function(framework, binding, value, onError, onSuccess) {\n onSuccess();\n };\n this.onRegisterWritten = function(framework, registerName, value, onError, onSuccess) {\n onSuccess();\n };\n this.onRefresh = function(framework, registerNames, onError, onSuccess) {\n onSuccess();\n };\n this.onRefreshed = function(framework, results, onError, onSuccess) {\n onSuccess();\n };\n this.onCloseDevice = function(framework, device, onError, onSuccess) {\n framework.deleteAllSmartBindings();\n onSuccess();\n };\n this.onUnloadModule = function(framework, onError, onSuccess) {\n onSuccess();\n };\n this.onLoadError = function(framework, description, onHandle) {\n console.log('in onLoadError', description);\n onHandle(true);\n };\n this.onWriteError = function(framework, registerName, value, description, onHandle) {\n console.log('in onConfigError', description);\n onHandle(true);\n };\n this.onRefreshError = function(framework, registerNames, description, onHandle) {\n console.log('in onRefreshError', description);\n if(typeof(description.retError) === 'number') {\n var info = modbus_map.getErrorInfo(description.retError);\n console.log('in onRefreshError',info);\n } else {\n console.log('Type of error',typeof(description.retError),description.retError);\n }\n onHandle(true);\n };\n\n var self = this;\n}", "title": "" }, { "docid": "2db61add746aa252cf1477064880b1ed", "score": "0.4235158", "text": "function init_targets_if_dne(){\n targets\n .count()\n .then(function(result){\n console.log(result)\n if(result != 4){\n targets.destroy({where: {},truncate: true})\n .then(function(){;\n var data = [{incubator: 1}, {incubator: 2}, {incubator: 3},{incubator: 4}];\n targets.bulkCreate(data, { validate: true }).catch(errors => {\n res.json(errors);\n return;\n });\n });\n }\n });\n}", "title": "" }, { "docid": "f3312d50f46d1ebb0ccfc1a417154d4c", "score": "0.42349905", "text": "function getConfig() {\n activeTarget = $(\"#selected-targets\").attr(\"target\");\n\n if ($(\"#hand-btn\").hasClass(\"right-active\")) {\n activeHand = \"R\";\n } else {\n activeHand = \"L\";\n }\n\n //target selection\n if (activeTarget == \"none\") {\n targetCommand = 0;\n } else if (activeTarget == \"mouth\") {\n targetCommand = 1;\n } else if (activeTarget == \"front\") {\n targetCommand = 2;\n } else if (activeTarget == \"top\") {\n targetCommand = 3;\n } else if (activeTarget == \"back\") {\n targetCommand = 4;\n } else if (activeTarget == \"right\") {\n targetCommand = 5;\n } else if (activeTarget == \"left\") {\n targetCommand = 6;\n }\n\n if (activeHand == \"R\") targetCommand = targetCommand + 10;\n //});\n}", "title": "" }, { "docid": "fa22269918143f98510b3d3e6cb0ecb4", "score": "0.4230981", "text": "setTargetType(newTargetType) {\n\t\tthis.instructions.targetType = newTargetType;\n\t}", "title": "" }, { "docid": "0193e22ae20fce4870fbc1fc18038049", "score": "0.42240745", "text": "function mergeConfig(target, source) {\n if (_.isArray(target)) {\n _.forEach((_.isArray(source) ? source : [ source ]), function (object) {\n if (object && !_.contains(target, object)) {\n target.push(object);\n }\n });\n } else {\n _.forEach(source, function (value, key) {\n if (_.isObject(target[key])) {\n mergeConfig(target[key], value);\n } else {\n target[key] = value;\n }\n });\n }\n\n return target;\n}", "title": "" }, { "docid": "cef81d5e4704a4d10eb9843fd8a27e98", "score": "0.42222401", "text": "function populateLocation(tx) {\n\ttx.executeSql('INSERT INTO TrailLocationData (trailId, raceId, spotId, latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed, totalTime) VALUES (' + $('#create-trail-page-trail-id').val() + ', ' + $('#create-race-page-race-id').val() + ', ' + $('#create-spot-page-spot-id').val() + ', ' + latitude + ', ' + longitude + ', ' + altitude + ', ' + accuracy + ', ' + altitudeAccuracy + ', ' + heading + ', ' + speed + ', \"' + timestamp + '\")');\n\n\t// We only want to record the spot once - so we clear the spot id after insert always\n\t$('#create-spot-page-spot-id').val('0');\n}", "title": "" }, { "docid": "395cbeb2c4daa31684fa57de542a442f", "score": "0.42200717", "text": "function insertForwardproxyRoutingInfo(count, targeturl, forwardurl, latency, https, originalres, modifiedres)\n{\n\tvar routingdb = new RoutingInfo;\n\troutingdb.configid = count;\n\troutingdb.targeturl = targeturl;\n\troutingdb.forwardurl = forwardurl;\n\troutingdb.latency = latency;\n\troutingdb.https = https;\n\troutingdb.status = false;\n\troutingdb.originalresponse = originalres;\n\troutingdb.modifiedresponse = modifiedres;\n\n\n\t\troutingdb.save(function(err){\n\t\n\t\t\tif(err)\n\t\t\t\tthrow err;\n\t\n\t\t\tconsole.log(\"routing info added : \" + routingdb);\n\t\t});\n}", "title": "" }, { "docid": "2e47ada3fa8854c332fe07409f85c6b1", "score": "0.42082903", "text": "function addDataSource(root) {\n // Check if data source name already exists\n let dsConfigs = root.getElementsByTagName(\"config\");\n let datasourceId = $(\"#ds-ds-id-input\").val();\n\n for (let i = 0, len = dsConfigs.length; i < len; i++) {\n if (dsConfigs[i].id == datasourceId && !$(\"#ds-ds-id-input\").prop('disabled')) {\n showDSNotification(\"danger\", \"A data source with the given name already exists.\", 4000);\n return false;\n }\n }\n\n // Process the form\n let formData = $(\"#create-ds-form\").find(':visible').serializeArray();\n let dataObj = {};\n\n $(formData).each(function(i, field){\n dataObj[field.name] = field.value;\n });\n\n let metadata = processDSInputData(root, dataObj, true);\n\n return {\n status: true,\n metadata: metadata\n }\n}", "title": "" }, { "docid": "529c11593086d8a3bdc10bba5586122c", "score": "0.4204931", "text": "function add(chosen, arr, target) {\n inquirer.prompt([{\n type: \"input\",\n name: table[chosen][0],\n message: `Enter ${table[chosen][0]}:`\n }, {\n type: \"input\",\n name: table[chosen][1],\n when: chosen !== \"department\",\n message: `Enter ${table[chosen][1]}:`\n }, {\n type: \"list\",\n name: table[chosen][2].concat(\"_id\"),\n when: chosen !== \"department\",\n message: `Select ${table[chosen][2]}:`,\n choices: arr\n }]).then(async res => {\n var query = `INSERT INTO ${chosen} SET ?`\n if (target) { query = `UPDATE ${chosen} SET ? WHERE id = \"${target}\"` }\n db.query(query, { ...res }, (err, res) => {\n if (err) throw err\n print(display)\n })\n })\n}", "title": "" }, { "docid": "de7e7a54be7e8da26091dbd0114c277b", "score": "0.42033577", "text": "function addDataSource(root) {\n // Check if data source name already exists\n let dsConfigs = root.getElementsByTagName(\"config\");\n let datasourceId = $(\"#ds-ds-id-input\").val();\n\n for (let i = 0, len = dsConfigs.length; i < len; i++) {\n if (dsConfigs[i].getAttribute(\"id\") == datasourceId && !$(\"#ds-ds-id-input\").prop('disabled')) {\n showDSNotification(\"danger\", \"A data source with the given name already exists.\", 4000);\n return false;\n }\n }\n\n // Process the form\n let formData = $(\"#create-ds-form\").find(':visible').serializeArray();\n let dataObj = {};\n\n $(formData).each(function(i, field){\n dataObj[field.name] = field.value;\n });\n\n let metadata = processDSInputData(root, dataObj, true);\n\n return {\n status: true,\n metadata: metadata\n }\n}", "title": "" }, { "docid": "1551701526e7b93eac48e346b551c10d", "score": "0.41980457", "text": "async seedDB(entity) {\n\t\t\tawait this.adapter.insertMany([\n\t\t\t\t{ target: \"localhost:3000/test1\"},\n\t\t\t\t{ target: \"localhost:3000/test2\"},\n\t\t\t\t{ target: \"localhost:3000/test3\"},\n\t\t\t\t{ target: \"localhost:3000/test4\"},\n\t\t\t]);\n\t\t}", "title": "" } ]
bc68ae67034be78df77aae87ff1f356e
Removes all keyvalue entries from the stack.
[ { "docid": "9cf18bb232d9cceb97488edcf17cdd2d", "score": "0.0", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}", "title": "" } ]
[ { "docid": "80193fbab2eb3b220e32ebc83b1e644d", "score": "0.63291264", "text": "function stackClear(){this.__data__={'array':[],'map':null};}", "title": "" }, { "docid": "80193fbab2eb3b220e32ebc83b1e644d", "score": "0.63291264", "text": "function stackClear(){this.__data__={'array':[],'map':null};}", "title": "" }, { "docid": "10cbd8bbea7508b3595aa7aebabbdb1a", "score": "0.6287714", "text": "clearStack() {\n\t\tthis._stack = [];\n\t\tthis.refresh();\n\t}", "title": "" }, { "docid": "10cbd8bbea7508b3595aa7aebabbdb1a", "score": "0.6287714", "text": "clearStack() {\n\t\tthis._stack = [];\n\t\tthis.refresh();\n\t}", "title": "" }, { "docid": "bd3e949db7ce49538a106d29557572af", "score": "0.62734073", "text": "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t }", "title": "" }, { "docid": "3ca784ee8359b8be2d52e8c0387ab913", "score": "0.62398714", "text": "function stackClear() {\r\n\t\t this.__data__ = { 'array': [], 'map': null };\r\n\t\t}", "title": "" }, { "docid": "60bd992c39e8f57c3be5b8e40ee2f6e0", "score": "0.62393975", "text": "function stackClear() {\n this.__data__ = {\n 'array': [],\n 'map': null\n };\n }", "title": "" }, { "docid": "60bd992c39e8f57c3be5b8e40ee2f6e0", "score": "0.62393975", "text": "function stackClear() {\n this.__data__ = {\n 'array': [],\n 'map': null\n };\n }", "title": "" }, { "docid": "fce2ffb1dffdbe506189e3ece415c9db", "score": "0.62274295", "text": "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "title": "" }, { "docid": "fce2ffb1dffdbe506189e3ece415c9db", "score": "0.62274295", "text": "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "title": "" }, { "docid": "2cebee8a90519d5f3ae394a75109ca00", "score": "0.62171006", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "title": "" }, { "docid": "2cebee8a90519d5f3ae394a75109ca00", "score": "0.62171006", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "title": "" }, { "docid": "2cebee8a90519d5f3ae394a75109ca00", "score": "0.62171006", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "title": "" }, { "docid": "2cebee8a90519d5f3ae394a75109ca00", "score": "0.62171006", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "title": "" }, { "docid": "88a08469bf012d608f5696ed17f369a1", "score": "0.62076813", "text": "function clear(){\n _stack.length = _map.length = 0;\n }", "title": "" }, { "docid": "2db2f15c47086623a7849cd73eab720e", "score": "0.6151879", "text": "function stackClear() {\n this.__data__ = new ListCache(), this.size = 0;\n }", "title": "" }, { "docid": "dca645cbcd6311aa19bc5a4b409df23c", "score": "0.61408246", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "0344d052d6f534012a773fc1fea8f0e7", "score": "0.6117471", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "title": "" }, { "docid": "0344d052d6f534012a773fc1fea8f0e7", "score": "0.6117471", "text": "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "title": "" }, { "docid": "60ecf5024a5fb68cea1af9bb305e4ef3", "score": "0.6113855", "text": "function stackClear() {\n\t this.__data__ = new _ListCache();\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "a71186f60c12f73a2d2b9050ade918c9", "score": "0.6111464", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "45e683739553361fd63d68169728328e", "score": "0.6104759", "text": "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "e9ba085e4befd9cc771d119fb5141279", "score": "0.6098207", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "e9ba085e4befd9cc771d119fb5141279", "score": "0.6098207", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "e87062d13d41523b66a25707a50e4b13", "score": "0.60848427", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "e87062d13d41523b66a25707a50e4b13", "score": "0.60848427", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "e87062d13d41523b66a25707a50e4b13", "score": "0.60848427", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "94e69cfb0944bdaea97b8df674242f3f", "score": "0.606967", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "94e69cfb0944bdaea97b8df674242f3f", "score": "0.606967", "text": "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "title": "" }, { "docid": "3d05af5f691e4a39e99ff19c0751dfad", "score": "0.6068411", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "2f109f6bfa80900c4a4cdaf44650eebf", "score": "0.606763", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "title": "" }, { "docid": "25b8320cbf8a4f99bd19be8135324bac", "score": "0.6055952", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "25b8320cbf8a4f99bd19be8135324bac", "score": "0.6055952", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "10cb81e090ea09958f9766205e713ec8", "score": "0.60451716", "text": "function stackClear() {\n this.__data__ = new _ListCache.default();\n this.size = 0;\n}", "title": "" }, { "docid": "10cb81e090ea09958f9766205e713ec8", "score": "0.60451716", "text": "function stackClear() {\n this.__data__ = new _ListCache.default();\n this.size = 0;\n}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4fc479eeb6fe432e6a526e952b4f03d3", "score": "0.60430735", "text": "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" }, { "docid": "4b6fa61cd8aa52063bcbd1f24fb65cd5", "score": "0.6040322", "text": "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "title": "" } ]
2c9df4e7f67925cc4be857e701061b30
New Zealand Map Grid Inverse x/y to long/lat
[ { "docid": "b190664428292c05bd761971db2e8da6", "score": "0.0", "text": "function inverse$i(p) {\n var n;\n var x = p.x;\n var y = p.y;\n var delta_x = x - this.x0;\n var delta_y = y - this.y0; // 1. Calculate z\n\n var z_re = delta_y / this.a;\n var z_im = delta_x / this.a; // 2a. Calculate theta - first approximation gives km accuracy\n\n var z_n_re = 1;\n var z_n_im = 0; // z^0\n\n var z_n_re1;\n var z_n_im1;\n var th_re = 0;\n var th_im = 0;\n\n for (n = 1; n <= 6; n++) {\n z_n_re1 = z_n_re * z_re - z_n_im * z_im;\n z_n_im1 = z_n_im * z_re + z_n_re * z_im;\n z_n_re = z_n_re1;\n z_n_im = z_n_im1;\n th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;\n th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;\n } // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n\n\n for (var i = 0; i < this.iterations; i++) {\n var th_n_re = th_re;\n var th_n_im = th_im;\n var th_n_re1;\n var th_n_im1;\n var num_re = z_re;\n var num_im = z_im;\n\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n th_n_re = 1;\n th_n_im = 0;\n var den_re = this.B_re[1];\n var den_im = this.B_im[1];\n\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n } // Complex division\n\n\n var den2 = den_re * den_re + den_im * den_im;\n th_re = (num_re * den_re + num_im * den_im) / den2;\n th_im = (num_im * den_re - num_re * den_im) / den2;\n } // 3. Calculate d_phi ... // and d_lambda\n\n\n var d_psi = th_re;\n var d_lambda = th_im;\n var d_psi_n = 1; // d_psi^0\n\n var d_phi = 0;\n\n for (n = 1; n <= 9; n++) {\n d_psi_n = d_psi_n * d_psi;\n d_phi = d_phi + this.D[n] * d_psi_n;\n } // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n\n\n var lat = this.lat0 + d_phi * SEC_TO_RAD * 1E5;\n var lon = this.long0 + d_lambda;\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" } ]
[ { "docid": "514adf72f5a7174531d8ebe9b9d13366", "score": "0.69027275", "text": "function inverse$15(p) {\n\t p.x -= this.x0;\n\t p.y -= this.y0;\n\t var lon, lat;\n\n\t if (this.sphere) {\n\t lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n\t lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n\t }\n\t else {\n\t lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n\t lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n\t }\n\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t}", "title": "" }, { "docid": "7e7f78a7e5adf71a9d9526f106cb55ab", "score": "0.6901445", "text": "function inverse$e(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}", "title": "" }, { "docid": "ffac01b1ea7dd3b2e452965fd9d52af8", "score": "0.6889294", "text": "function inverse$j(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon = adjust_lon(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" }, { "docid": "dc4df5e4048715dcefdc249a2a68c05f", "score": "0.6879615", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "dc4df5e4048715dcefdc249a2a68c05f", "score": "0.6879615", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "dc4df5e4048715dcefdc249a2a68c05f", "score": "0.6879615", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "d222ed550fbd75327c427b2b0b176040", "score": "0.68762064", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = (0, _adjust_lon.default)(this.long0 + p.x / this.a / Math.cos(this.lat_ts));\n lat = Math.asin(p.y / this.a * Math.cos(this.lat_ts));\n } else\n {\n lat = (0, _iqsfnz.default)(this.e, 2 * p.y * this.k0 / this.a);\n lon = (0, _adjust_lon.default)(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "c4807205c10b7582aef46ae34203b12a", "score": "0.68538874", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "e493a80fa9e89bfd9090fcfeb93f098a", "score": "0.6844638", "text": "function inverse$j(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = adjust_lon(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "895c0dcb6d86300d4c3462157238fb42", "score": "0.6844442", "text": "function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = (0, _adjust_lon.default)(this.long0 + (x - this.x0) / (this.a * this.rc));\n p.y = (0, _adjust_lat.default)(this.lat0 + (y - this.y0) / this.a);\n return p;\n}", "title": "" }, { "docid": "d3364febb1e72082ed5c39090418a26f", "score": "0.68137556", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = (0,_common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, 2 * p.y * this.k0 / this.a);\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "7e4ce981bcef6184a91f103399e0c46a", "score": "0.6791525", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = (0, _adjust_lon.default)(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "ec8e4c364997c72db0b7401d1b4211ae", "score": "0.67864025", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = Object(_common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, 2 * p.y * this.k0 / this.a);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "ec8e4c364997c72db0b7401d1b4211ae", "score": "0.67864025", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = Object(_common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, 2 * p.y * this.k0 / this.a);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "ec8e4c364997c72db0b7401d1b4211ae", "score": "0.67864025", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = Object(_common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, 2 * p.y * this.k0 / this.a);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "66b834526992ac9aacffd3ef6f6d2f92", "score": "0.6784657", "text": "function inverse$f(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + p.x / this.a / Math.cos(this.lat_ts));\n lat = Math.asin(p.y / this.a * Math.cos(this.lat_ts));\n } else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" }, { "docid": "61651701a51ae4cb9deb2d5751cd1215", "score": "0.6740069", "text": "function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = (0,_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}", "title": "" }, { "docid": "60d8ef1ee66429e22d4989d5f60dc0f6", "score": "0.6715818", "text": "function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}", "title": "" }, { "docid": "60d8ef1ee66429e22d4989d5f60dc0f6", "score": "0.6715818", "text": "function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}", "title": "" }, { "docid": "60d8ef1ee66429e22d4989d5f60dc0f6", "score": "0.6715818", "text": "function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}", "title": "" }, { "docid": "e851b6a391d4fc2a5fbe71431a7eaabb", "score": "0.6690776", "text": "function inverse$f(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + p.x / this.a / Math.cos(this.lat_ts));\n lat = Math.asin(p.y / this.a * Math.cos(this.lat_ts));\n } else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "a2dabdf26526f84bfd62a6630073925c", "score": "0.6680714", "text": "function inverse$16(p) {\n\n\t var x = p.x;\n\t var y = p.y;\n\n\t p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n\t p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));\n\t return p;\n\t}", "title": "" }, { "docid": "0f8f06c5d485f8982c8519a1be84de5d", "score": "0.6649268", "text": "function inverse$f(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "21fb11f310ef5d25bd2acdc0b08ac696", "score": "0.664201", "text": "function inverse$g(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = adjust_lon(this.long0 + (x - this.x0) / (this.a * this.rc));\n p.y = adjust_lat(this.lat0 + (y - this.y0) / this.a);\n return p;\n}", "title": "" }, { "docid": "f86d0744ecf088a7d424957502e8f051", "score": "0.65511256", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (this.lat0 > 0) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n lon = this.con * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"] + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "f86d0744ecf088a7d424957502e8f051", "score": "0.65511256", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (this.lat0 > 0) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n lon = this.con * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"] + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "f86d0744ecf088a7d424957502e8f051", "score": "0.65511256", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (this.lat0 > 0) {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n lon = this.con * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"EPSLN\"]) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"] + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "028c5e7adde9923e3a9e3b3a94a2080b", "score": "0.6545888", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__.EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__.EPSLN) {\n if (this.lat0 > 0) {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__.EPSLN) {\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__.EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * (0,_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n lon = this.con * (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__.EPSLN) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * (0,_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__.HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "031eb6454fb7196882b97151f634424d", "score": "0.6538681", "text": "function inverse$b(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = adjust_lon(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "f6a43c30ac278b844ad8d991d6b2305c", "score": "0.6483007", "text": "function inverse(p) {\n\n\t var x = p.x - this.x0;\n\t var y = p.y - this.y0;\n\t var lon, lat;\n\n\t if (this.sphere) {\n\t lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n\t }\n\t else {\n\t var ts = Math.exp(-y / (this.a * this.k0));\n\t lat = phi2z(this.e, ts);\n\t if (lat === -9999) {\n\t return null;\n\t }\n\t }\n\t lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t}", "title": "" }, { "docid": "9458dfc902a1e404cc657d415f33c48d", "score": "0.64357203", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__.HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = (0,_common_phi2z__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "a6f1c7e95954f4b572dd9b85db0fa9c8", "score": "0.64349174", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "a6f1c7e95954f4b572dd9b85db0fa9c8", "score": "0.64349174", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "a6f1c7e95954f4b572dd9b85db0fa9c8", "score": "0.64349174", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "50d19ac49d0e5cbcf6f489ec390bee6d", "score": "0.64337635", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n } else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "fe327b401ba216a89771b153adf7637c", "score": "0.6421002", "text": "function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = _values.HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n } else\n {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = (0, _phi2z.default)(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = (0, _adjust_lon.default)(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "4405fff8339a8c03a5a70a054421ba34", "score": "0.6411227", "text": "function inverse$19(p) {\n\t p.x -= this.x0;\n\t p.y -= this.y0;\n\n\t var lon = adjust_lon(this.long0 + p.x / this.a);\n\t var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t}", "title": "" }, { "docid": "d81567fe2d0d44d9b72c42fd1066fd24", "score": "0.64093083", "text": "function inverse(p) {\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n } else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n\n if (lat === -9999) {\n return null;\n }\n }\n\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" }, { "docid": "2213ee73b09b262b9643a3a74c6f413f", "score": "0.63921636", "text": "function inverse$9(p) {\n\n\t var rh1, con, ts;\n\t var lat, lon;\n\t var x = (p.x - this.x0) / this.k0;\n\t var y = (this.rh - (p.y - this.y0) / this.k0);\n\t if (this.ns > 0) {\n\t rh1 = Math.sqrt(x * x + y * y);\n\t con = 1;\n\t }\n\t else {\n\t rh1 = -Math.sqrt(x * x + y * y);\n\t con = -1;\n\t }\n\t var theta = 0;\n\t if (rh1 !== 0) {\n\t theta = Math.atan2((con * x), (con * y));\n\t }\n\t if ((rh1 !== 0) || (this.ns > 0)) {\n\t con = 1 / this.ns;\n\t ts = Math.pow((rh1 / (this.a * this.f0)), con);\n\t lat = phi2z(this.e, ts);\n\t if (lat === -9999) {\n\t return null;\n\t }\n\t }\n\t else {\n\t lat = -HALF_PI;\n\t }\n\t lon = adjust_lon(theta / this.ns + this.long0);\n\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t}", "title": "" }, { "docid": "5e094589ee1798ba81321d6936293b5c", "score": "0.63743794", "text": "function inverse$9(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = this.rh - (p.y - this.y0) / this.k0;\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * x, con * y);\n }\n if (rh1 !== 0 || this.ns > 0) {\n con = 1 / this.ns;\n ts = Math.pow(rh1 / (this.a * this.f0), con);\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n } else {\n lat = -HALF_PI;\n }\n lon = adjust_lon(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "20b6b141903489142b37341e8063114b", "score": "0.6366695", "text": "function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < _constants_values__WEBPACK_IMPORTED_MODULE_1__[\"EPSLN\"]) {\n lon = this.long0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "20b6b141903489142b37341e8063114b", "score": "0.6366695", "text": "function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < _constants_values__WEBPACK_IMPORTED_MODULE_1__[\"EPSLN\"]) {\n lon = this.long0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "20b6b141903489142b37341e8063114b", "score": "0.6366695", "text": "function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < _constants_values__WEBPACK_IMPORTED_MODULE_1__[\"EPSLN\"]) {\n lon = this.long0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "a0c52825411e2b1b8c44b067f2d706f3", "score": "0.63658404", "text": "function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < _constants_values__WEBPACK_IMPORTED_MODULE_1__.EPSLN) {\n lon = this.long0;\n }\n else {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "d45b49d9a969545115a537dbfc8c9660", "score": "0.63305545", "text": "function changeLocationGrid(lat, lon) {\n const RE = 6371.00877\n const GRID = 5.0\n const SLAT1 = 30.0\n const SLAT2 = 60.0\n const OLON = 126.0\n const OLAT = 38.0\n const XO = 43\n const YO = 136\n\n const DEGRAD = Math.PI / 180.0\n const RADDEG = 180.0 / Math.PI\n\n const re = RE / GRID\n const slat1 = SLAT1 * DEGRAD\n const slat2 = SLAT2 * DEGRAD\n const olon = OLON * DEGRAD\n const olat = OLAT * DEGRAD\n\n let sn = Math.tan(Math.PI*0.25 + slat2*0.5)\n / Math.tan(Math.PI*0.25 + slat1*0.5)\n sn = Math.log(Math.cos(slat1) / Math.cos(slat2)) / Math.log(sn)\n let sf = Math.tan(Math.PI*0.25 + slat1*0.5)\n sf = (Math.pow(sf, sn) * Math.cos(slat1)) / sn\n let ro = Math.tan(Math.PI*0.25 + olat*0.5)\n ro = (re*sf) / Math.pow(ro, sn)\n\n const rs = []\n let ra = Math.tan(Math.PI*0.25 + lat*DEGRAD*0.5)\n ra = (re*sf) / Math.pow(ra, sn)\n let theta = lon*DEGRAD - olon\n if(theta > Math.PI) theta -= 2.0 * Math.PI\n if(theta < -Math.PI) theta += 2.0 * Math.PI\n theta *= sn\n rs[0] = Math.floor(ra*Math.sin(theta) + XO + 0.5)\n rs[1] = Math.floor(ro - ra*Math.cos(theta) + YO + 0.5)\n\n return rs\n}", "title": "" }, { "docid": "6273af266ccb841ffdc327ddcee80e76", "score": "0.63051295", "text": "function u (x, y) { return queryGrid(x, y, 0, -1); }", "title": "" }, { "docid": "764b19df41c96b623ff4a78ea512a25f", "score": "0.628199", "text": "function inverse$n(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = 3 * d / a1 / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n } else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n } else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n } else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "e71ff37a38a11305950f4266644d6655", "score": "0.62513363", "text": "function ll_to_xy(lat, lon) {\n var x = lon / 360. + .5;\n var rlat = lat * Math.PI / 180.;\n var merc_y = Math.log(Math.tan(.5 * rlat + .25 * Math.PI));\n var y = .5 - merc_y / (2. * Math.PI);\n return {x: x, y: y};\n}", "title": "" }, { "docid": "4ee923fc729b7f3b48fb76f2b8cba6b1", "score": "0.6230342", "text": "function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= _values.EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < _values.EPSLN) {\n if (this.lat0 > 0) {\n lon = (0, _adjust_lon.default)(this.long0 + Math.atan2(p.x, -1 * p.y));\n } else\n {\n lon = (0, _adjust_lon.default)(this.long0 + Math.atan2(p.x, p.y));\n }\n } else\n {\n lon = (0, _adjust_lon.default)(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n } else\n {\n if (Math.abs(this.coslat0) <= _values.EPSLN) {\n if (rh <= _values.EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * (0, _phi2z.default)(this.e, ts);\n lon = this.con * (0, _adjust_lon.default)(this.con * this.long0 + Math.atan2(p.x, -1 * p.y));\n } else\n {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= _values.EPSLN) {\n Chi = this.X0;\n } else\n {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = (0, _adjust_lon.default)(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * (0, _phi2z.default)(this.e, Math.tan(0.5 * (_values.HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "b9fb3aac6d29356ae382c93edceb3da4", "score": "0.62257403", "text": "function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = this.rh - (p.y - this.y0) / this.k0;\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n } else\n {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * x, con * y);\n }\n if (rh1 !== 0 || this.ns > 0) {\n con = 1 / this.ns;\n ts = Math.pow(rh1 / (this.a * this.f0), con);\n lat = (0, _phi2z.default)(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n } else\n {\n lat = -_values.HALF_PI;\n }\n lon = (0, _adjust_lon.default)(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "3bff1e1319be5271b6da40fccb66f1a9", "score": "0.62252027", "text": "function inverse$n(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n /* inverse equations\n -----------------*/\n\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = 3 * d / a1 / m1;\n\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n } else {\n con = -1;\n }\n }\n\n th1 = Math.acos(con) / 3;\n\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n } else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n } else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" }, { "docid": "0482e8c0a7e1776da6108b50eef91dad", "score": "0.6220496", "text": "function inverse$6(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < EPSLN) {\n if (this.lat0 > 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n }\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (rh <= EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * phi2z(this.e, ts);\n lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -1 * p.y));\n } else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= EPSLN) {\n Chi = this.X0;\n } else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n}", "title": "" }, { "docid": "9679b6b12e5569af67866099cd1c657d", "score": "0.6216064", "text": "function inverse$u(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "000a7b81b6b05be2dc5119a97f9fa59c", "score": "0.6213107", "text": "function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = 3 * d / a1 / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n } else\n {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n } else\n {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < _values.EPSLN) {\n lon = this.long0;\n } else\n {\n lon = (0, _adjust_lon.default)(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "1cf1de7b300c6444659b2692652983f1", "score": "0.6204799", "text": "function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if (g === 0 && h === 0) {\n lon = 0;\n } else\n {\n lon = (0, _adjust_lon.default)(Math.atan2(g, h) + this.long0);\n }\n } else\n {// ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = (0, _pj_inv_mlfn.default)(con, this.es, this.en);\n\n if (Math.abs(phi) < _values.HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > _values.EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - con * ds / (1 - this.es) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = (0, _adjust_lon.default)(this.long0 + d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi);\n } else\n {\n lat = _values.HALF_PI * (0, _sign.default)(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "d3787f5a9d67732d14f551def464f409", "score": "0.61978847", "text": "function inverse$7(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n }\n else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "8f3e77f12064e41148819d4c9e7ccc42", "score": "0.61887777", "text": "function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -_constants_values__WEBPACK_IMPORTED_MODULE_5__[\"HALF_PI\"];\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "8f3e77f12064e41148819d4c9e7ccc42", "score": "0.61887777", "text": "function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -_constants_values__WEBPACK_IMPORTED_MODULE_5__[\"HALF_PI\"];\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "8f3e77f12064e41148819d4c9e7ccc42", "score": "0.61887777", "text": "function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -_constants_values__WEBPACK_IMPORTED_MODULE_5__[\"HALF_PI\"];\n }\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "34b7baca343d2786e82f1424d661b348", "score": "0.6161863", "text": "function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = (0,_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(con, this.es, this.en);\n\n if (Math.abs(phi) < _constants_values__WEBPACK_IMPORTED_MODULE_4__.HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__.EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__.HALF_PI * (0,_common_sign__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "437003fab9f33b30c3254ec18040b986", "score": "0.6149538", "text": "function inverse$6(p) {\n\t p.x -= this.x0;\n\t p.y -= this.y0;\n\t var lon, lat, ts, ce, Chi;\n\t var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n\t if (this.sphere) {\n\t var c = 2 * Math.atan(rh / (0.5 * this.a * this.k0));\n\t lon = this.long0;\n\t lat = this.lat0;\n\t if (rh <= EPSLN) {\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t }\n\t lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n\t if (Math.abs(this.coslat0) < EPSLN) {\n\t if (this.lat0 > 0) {\n\t lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));\n\t }\n\t else {\n\t lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n\t }\n\t }\n\t else {\n\t lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n\t }\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t }\n\t else {\n\t if (Math.abs(this.coslat0) <= EPSLN) {\n\t if (rh <= EPSLN) {\n\t lat = this.lat0;\n\t lon = this.long0;\n\t p.x = lon;\n\t p.y = lat;\n\t //trace(p.toString());\n\t return p;\n\t }\n\t p.x *= this.con;\n\t p.y *= this.con;\n\t ts = rh * this.cons / (2 * this.a * this.k0);\n\t lat = this.con * phi2z(this.e, ts);\n\t lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n\t }\n\t else {\n\t ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n\t lon = this.long0;\n\t if (rh <= EPSLN) {\n\t Chi = this.X0;\n\t }\n\t else {\n\t Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n\t lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n\t }\n\t lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n\t }\n\t }\n\t p.x = lon;\n\t p.y = lat;\n\n\t //trace(p.toString());\n\t return p;\n\n\t}", "title": "" }, { "docid": "7440171b96e5a2a4282847fe751f25a6", "score": "0.61412096", "text": "CameraToGlobalCoordinates(xp, yp) {\n // # Radius of earth is 6378100.0 meters\n var Re = 6378100.0;\n var lo = this.CameraToLocalCoordinates(xp, yp);\n var xl = lo.x;\n var yl = lo.y;\n var xe = xl * Math.cos(this.Theta) - yl * Math.sin(this.Theta);\n var yn = yl * Math.cos(this.Theta) + xl * Math.sin(this.Theta);\n var lat = this.lat + (yn / Re * 180.0 / Math.PI);\n var lon = this.lon + (xe / Re * 180.0 / Math.PI);\n return { lat:lat, lon:lon };\n }", "title": "" }, { "docid": "c9352bfd6ad00f09e7a1fc565d376abe", "score": "0.6116643", "text": "function lat2tile(lat,zoom) { return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom))); }", "title": "" }, { "docid": "35834c87267779a2d69b98746c08a3c1", "score": "0.61145014", "text": "function getTileCoords(){\n minRow = lat2tile(TOP_LAT, MAP_ZOOM);\n maxRow = lat2tile(BOTTOM_LAT, MAP_ZOOM)+1;\n minCol = long2tile(LEFT_LON, MAP_ZOOM);\n maxCol = long2tile(RIGHT_LON, MAP_ZOOM)+1;\n}", "title": "" }, { "docid": "c412a0a51b4ea8d28868b864810bab1d", "score": "0.6112558", "text": "function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = (0,_common_phi2z__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -_constants_values__WEBPACK_IMPORTED_MODULE_5__.HALF_PI;\n }\n lon = (0,_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "59d6b40df39d33a1316b2d9cf9e316be", "score": "0.611073", "text": "function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = Object(_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(con, this.es, this.en);\n\n if (Math.abs(phi) < _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"]) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"EPSLN\"] ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] * Object(_common_sign__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "59d6b40df39d33a1316b2d9cf9e316be", "score": "0.611073", "text": "function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = Object(_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(con, this.es, this.en);\n\n if (Math.abs(phi) < _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"]) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"EPSLN\"] ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] * Object(_common_sign__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "59d6b40df39d33a1316b2d9cf9e316be", "score": "0.611073", "text": "function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = Object(_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(con, this.es, this.en);\n\n if (Math.abs(phi) < _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"]) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"EPSLN\"] ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__[\"HALF_PI\"] * Object(_common_sign__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "103adb5d6372ed3aa49ae671269c8caf", "score": "0.6097129", "text": "function inverse$23(p) {\n\t var lon, lat;\n\t var xx, yy, xys, c1, c2, c3;\n\t var a1;\n\t var m1;\n\t var con;\n\t var th1;\n\t var d;\n\n\t /* inverse equations\n\t -----------------*/\n\t p.x -= this.x0;\n\t p.y -= this.y0;\n\t con = Math.PI * this.R;\n\t xx = p.x / con;\n\t yy = p.y / con;\n\t xys = xx * xx + yy * yy;\n\t c1 = -Math.abs(yy) * (1 + xys);\n\t c2 = c1 - 2 * yy * yy + xx * xx;\n\t c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n\t d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n\t a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n\t m1 = 2 * Math.sqrt(-a1 / 3);\n\t con = ((3 * d) / a1) / m1;\n\t if (Math.abs(con) > 1) {\n\t if (con >= 0) {\n\t con = 1;\n\t }\n\t else {\n\t con = -1;\n\t }\n\t }\n\t th1 = Math.acos(con) / 3;\n\t if (p.y >= 0) {\n\t lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n\t }\n\t else {\n\t lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n\t }\n\n\t if (Math.abs(xx) < EPSLN) {\n\t lon = this.long0;\n\t }\n\t else {\n\t lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n\t }\n\n\t p.x = lon;\n\t p.y = lat;\n\t return p;\n\t}", "title": "" }, { "docid": "f8a38607dcf31c9aeb34bfd528d5dd33", "score": "0.60946923", "text": "function projectMercator(lon, lat) {\n return { \n 'x': lon, \n 'y': degrees(log(tan(radians(lat)) + 1.0/cos(radians(lat)))) \n };\n}", "title": "" }, { "docid": "f8a38607dcf31c9aeb34bfd528d5dd33", "score": "0.60946923", "text": "function projectMercator(lon, lat) {\n return { \n 'x': lon, \n 'y': degrees(log(tan(radians(lat)) + 1.0/cos(radians(lat)))) \n };\n}", "title": "" }, { "docid": "2db474a22564c810193aa0b8bf30f8ef", "score": "0.6070309", "text": "function inverse$2(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if (g === 0 && h === 0) {\n lon = 0;\n } else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0);\n }\n } else {\n // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - con * ds / (1 - this.es) * 0.5 * (1 - ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs - ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c - ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = adjust_lon(this.long0 + d * (1 - ds / 6 * (1 + 2 * t + c - ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c - ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi);\n } else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "113cd8439fba030c509c86ba068720f8", "score": "0.60682505", "text": "function inverse$2(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if (g === 0 && h === 0) {\n lon = 0;\n } else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0);\n }\n } else {\n // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n lat = phi - con * ds / (1 - this.es) * 0.5 * (1 - ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs - ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c - ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n lon = adjust_lon(this.long0 + d * (1 - ds / 6 * (1 + 2 * t + c - ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c - ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi);\n } else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n }", "title": "" }, { "docid": "a719a545b6e7c599cfbadebccf9e0661", "score": "0.60291225", "text": "function hackMapProjection(lat, lon, originLat, originLon) {\n var lonCorrection = 1.5;\n var rMajor = 6378137.0;\n\n function lonToX(lon) {\n return rMajor * (lon * Math.PI / 180);\n }\n\n function latToY(lat) {\n if (lat === 0) {\n return 0;\n } else {\n return rMajor * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI / 180) / 2));\n }\n }\n\n var x = lonToX(lon - originLon) / lonCorrection;\n var y = latToY(lat - originLat);\n return {'x': x, 'y': y};\n}", "title": "" }, { "docid": "49eb65286065040eabfb3f39f5938cd7", "score": "0.6020985", "text": "function inverse$l(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -HALF_PI;\n }\n lon = adjust_lon(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}", "title": "" }, { "docid": "72820488ddbcb347c6f1a2c9c4611f68", "score": "0.6018491", "text": "function inverse$2(p) {\n\t var con, phi;\n\t var lat, lon;\n\t var x = (p.x - this.x0) * (1 / this.a);\n\t var y = (p.y - this.y0) * (1 / this.a);\n\n\t if (!this.es) {\n\t var f = Math.exp(x / this.k0);\n\t var g = 0.5 * (f - 1 / f);\n\t var temp = this.lat0 + y / this.k0;\n\t var h = Math.cos(temp);\n\t con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n\t lat = Math.asin(con);\n\n\t if (y < 0) {\n\t lat = -lat;\n\t }\n\n\t if ((g === 0) && (h === 0)) {\n\t lon = 0;\n\t }\n\t else {\n\t lon = adjust_lon(Math.atan2(g, h) + this.long0);\n\t }\n\t }\n\t else { // ellipsoidal form\n\t con = this.ml0 + y / this.k0;\n\t phi = pj_inv_mlfn(con, this.es, this.en);\n\n\t if (Math.abs(phi) < HALF_PI) {\n\t var sin_phi = Math.sin(phi);\n\t var cos_phi = Math.cos(phi);\n\t var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n\t var c = this.ep2 * Math.pow(cos_phi, 2);\n\t var cs = Math.pow(c, 2);\n\t var t = Math.pow(tan_phi, 2);\n\t var ts = Math.pow(t, 2);\n\t con = 1 - this.es * Math.pow(sin_phi, 2);\n\t var d = x * Math.sqrt(con) / this.k0;\n\t var ds = Math.pow(d, 2);\n\t con = con * tan_phi;\n\n\t lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n\t ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n\t ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n\t ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n\t lon = adjust_lon(this.long0 + (d * (1 -\n\t ds / 6 * (1 + 2 * t + c -\n\t ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n\t ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n\t }\n\t else {\n\t lat = HALF_PI * sign(y);\n\t lon = 0;\n\t }\n\t }\n\n\t p.x = lon;\n\t p.y = lat;\n\n\t return p;\n\t}", "title": "" }, { "docid": "6516b4739e12bd13d1537fa4ad1de766", "score": "0.59913504", "text": "function centerCleveland(){\n map.setView([41.502405, -81.673895],13);\n}", "title": "" }, { "docid": "22abfa29652a8a005032e52088fd1851", "score": "0.5953194", "text": "function convertGridToScreen(x, y) {\n return { x: zoom * (y - x) * tileWidth / 2 + gridX + offsetY, y: zoom * (x + y) * tileHeight / 2 + gridY + offsetX }\n}", "title": "" }, { "docid": "1980f6ad335706e1d1dff8d5ff967ba2", "score": "0.59354216", "text": "function project(lnglat) {\n var px = mercator.px(lnglat, 0);\n px = {\n x: px[0] - basePlaneDimension / 2,\n y: 0,\n z: px[1] - basePlaneDimension / 2,\n };\n return px;\n }", "title": "" }, { "docid": "0bb6f7879170c6ad9a4f902605d11d64", "score": "0.59347266", "text": "function getCoords() {\n var bounds = myMap.getBounds();\n var NE = bounds.getNorthEast();\n var SW = bounds.getSouthWest();\n getWeather(NE.lat(), NE.lng(), SW.lat(), SW.lng());\n }", "title": "" }, { "docid": "834a42a6a8cac4393061d1318442d9cf", "score": "0.5924762", "text": "function inverse$s(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = adjust_lon(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "title": "" }, { "docid": "f93fd2cae919fd97940f500da5fd1be1", "score": "0.591963", "text": "function convertScreenToGrid(x, y) {\n const a = (((x - gridX - offsetY) / zoom) / (tileWidth / 2)) / 2\n const b = (((y - gridY - offsetX) / zoom) / (tileHeight / 2)) / 2\n return { x: Math.floor(b - a), y: Math.floor(a + b) }\n}", "title": "" }, { "docid": "1dad875777470e513ceb7c37ae5da403", "score": "0.59134746", "text": "function inverse$o(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < EPSLN) {\n if (this.lat0 > 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (rh <= EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * phi2z(this.e, ts);\n lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= EPSLN) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}", "title": "" }, { "docid": "27e9cfef498be5d78001fd34eac369cc", "score": "0.58866364", "text": "function latToY(lat){\n\tvar len = (lat-boundingBox.s)/(boundingBox.n-boundingBox.s);\n\treturn len*maxY-maxY/2;\n}", "title": "" }, { "docid": "ff4ac3341001594f4c21c7555f76cca0", "score": "0.58833957", "text": "function fromTileIndicesGoogle(loc, zoom) {\n const t = powersOf2[zoom];\n return {\n lon: loc.x / t * 360 - 180,\n lat: Math.atan( Math.sinh(π * (1 - 2 * loc.y / t) ) ) * RAD2DEG\n };\n }", "title": "" }, { "docid": "093f7e90437a4fba3d7abaa1427ceced", "score": "0.58689475", "text": "function degree2tile(lat, lng, zoom) {\n // See http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames\n var latRad = lat * Math.PI / 180;\n var n = Math.pow(2, zoom);\n var x = (lng + 180) / 360 * n\n var y = (1 - Math.log(Math.tan(latRad) + (1 / Math.cos(latRad))) / Math.PI) / 2 * n\n return {x: x, y: y};\n }", "title": "" }, { "docid": "18f54b11e8fc398d657c359928567ae2", "score": "0.58666027", "text": "function LBMapProjection(){}", "title": "" }, { "docid": "79498f137dd3c8aa6fefb45ebb3c8327", "score": "0.58607626", "text": "function unproject(coord) {\n return map.unproject(coord, map.getMaxZoom());\n}", "title": "" }, { "docid": "5ec6d1cd04ab247d79e707ea64404ee2", "score": "0.58487433", "text": "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "title": "" }, { "docid": "5ec6d1cd04ab247d79e707ea64404ee2", "score": "0.58487433", "text": "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "title": "" }, { "docid": "5ec6d1cd04ab247d79e707ea64404ee2", "score": "0.58487433", "text": "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "title": "" }, { "docid": "5ec6d1cd04ab247d79e707ea64404ee2", "score": "0.58487433", "text": "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "title": "" }, { "docid": "143f5f86d7b39bb97240a786e09c6293", "score": "0.58394545", "text": "function project(latLng) {\n let siny = Math.sin((latLng.lat() * Math.PI) / 180);\n // Truncating to 0.9999 effectively limits latitude to 89.189. This is\n // about a third of a tile past the edge of the world tile.\n siny = Math.min(Math.max(siny, -0.9999), 0.9999);\n return new google.maps.Point(\n TILE_SIZE * (0.5 + latLng.lng() / 360),\n TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI))\n );\n }", "title": "" }, { "docid": "df7dfce7968a414b7e9196657e6ccda4", "score": "0.58351284", "text": "function getNauticalCoordinates() {\n\txMod = x - c.WORLD_WIDTH/2;\n\tyMod = y - c.WORLD_HEIGHT/2;\n\tWE = \"W\";\n\tNS = \"N\";\n\tif (xMod > 0) {\n\t\tWE = \"E\";\n\t}\n\tif (yMod > 0) {\n\t\tNS = \"S\";\n\t}\n\tyMod = Math.abs(yMod);\n\txMod = Math.abs(xMod);\n\t\n\tlat = Math.floor(xMod/c.LATITUDE_SIZE_PX);\n\tlon = Math.floor(yMod/c.LATITUDE_SIZE_PX);\n\tlatSec = (xMod - lat*c.LATITUDE_SIZE_PX) * 2;\n\tlonSec = (yMod - lon*c.LATITUDE_SIZE_PX) * 2;\n\treturn lon+\"'\"+lonSec+\"\\\"\"+NS+\" \"+lat+\"\\'\"+latSec+\"\\\"\"+WE;\n}", "title": "" }, { "docid": "4e72780e03b9397557a291a89945ee1e", "score": "0.58307326", "text": "function updateCoordinates(event, map) {\r\n const latitudeHolder = document.getElementById('latitude');\r\n const longitudeHolder = document.getElementById('longitude');\r\n const mapCoords = map.documentToMapCoords(event.clientX, event.clientY);\r\n const x = mapCoords[0];\r\n const y = mapCoords[1];\r\n if(-1 < x && x < 1 && -1 < y & y < 1) {\r\n map.selectShapeAt(x, y);\r\n const coords = map.P.inverseProjection.apply(map, mapCoords);\r\n const latitude = latitudeToString(coords[1]);\r\n const longitude = longitudeToString(coords[0]);\r\n latitudeHolder.innerHTML = latitude;\r\n longitudeHolder.innerHTML = longitude;\r\n }\r\n}", "title": "" }, { "docid": "46d3c6fcb89e326216fccc68bc0d17ca", "score": "0.5825818", "text": "function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }", "title": "" }, { "docid": "46d3c6fcb89e326216fccc68bc0d17ca", "score": "0.5825818", "text": "function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }", "title": "" }, { "docid": "46d3c6fcb89e326216fccc68bc0d17ca", "score": "0.5825818", "text": "function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }", "title": "" }, { "docid": "206afab022f321788b3e7911584dfee6", "score": "0.58173215", "text": "function tileIndicesGoogle(loc, zoom) {\n const pos = project2( project1(loc) );\n const t = powersOf2[zoom];\n return {\n x: Math.round(pos.x * t),\n y: t - Math.round(pos.y * t) - 1\n };\n }", "title": "" }, { "docid": "c8b9af9e9bd3d2f075f7dbe28ed5f14a", "score": "0.58161354", "text": "function lng2tile(lng,zoom) { return (Math.floor((lng+180)/360*Math.pow(2,zoom))); }", "title": "" }, { "docid": "c8b9af9e9bd3d2f075f7dbe28ed5f14a", "score": "0.58161354", "text": "function lng2tile(lng,zoom) { return (Math.floor((lng+180)/360*Math.pow(2,zoom))); }", "title": "" } ]
3831dd798706058f5dc655003e19fbd4
Get data from MongoDB.
[ { "docid": "e1384c268ef33d559713cef3a0ece2b7", "score": "0.63166744", "text": "function fetch() {\n mongo.get(function open(db) {\n db.collection('fs.files')\n .find()\n .sort({ filename: 1, uploadDate: recover ? 1 : -1 })\n .toArray(processFile);\n });\n }", "title": "" } ]
[ { "docid": "fc145473364c8517ca181a64af60867e", "score": "0.7364616", "text": "function get_mongo_data(docs){\n db_verguenza = docs;\n}", "title": "" }, { "docid": "a9e2a25ae80f9db901b5690ad5ede9b4", "score": "0.68900186", "text": "function selectData(){\n MongoClient.connect(url, function(err, db){\n if (err) throw err; \n const dbo = db.db ('mydb'); \n dbo.collection ('medidas').findOne({}, {sort:{$natural:-1}},function(err, doc){\n //dbo.collection ('medidas').findOne({Medida:'humedad'}, {sort:{$natural:-1}},function(err, doc){ //Filtrar datos por medida\n if(err) throw err;\n console.log(doc);\n dato = doc;\n //Obtener datos del json\n /*console.log(\"Temperatura:\" + doc.temperatura);\n console.log(\"Viento:\" + doc.viento);\n console.log(\"Temperatura:\" + doc.humedad);*/\n db.close();\n }); \n\n });\n}", "title": "" }, { "docid": "5da6eb724761d3842841475372ae89ce", "score": "0.6849627", "text": "function get_voitures(cb){\n MongoClient.connect(url, function (err, db) {\n if (err) throw err;\n var dbo = db.db(\"concession\");\n dbo.collection(\"voitures\").find({}).toArray(function (err, result) {\n if (err) throw err;\n \n cb(result);\n db.close();\n });\n });\n\n}", "title": "" }, { "docid": "5da6eb724761d3842841475372ae89ce", "score": "0.6849627", "text": "function get_voitures(cb){\n MongoClient.connect(url, function (err, db) {\n if (err) throw err;\n var dbo = db.db(\"concession\");\n dbo.collection(\"voitures\").find({}).toArray(function (err, result) {\n if (err) throw err;\n \n cb(result);\n db.close();\n });\n });\n\n}", "title": "" }, { "docid": "dc0b0bd002cb4e5b78eaf6c2a5525091", "score": "0.6731749", "text": "function findSpecific(res){\n MongoClient.connect(uri, {useNewUrlParser:true}, (err,client)=>{\n console.log('connected');\n const db = client.db(dbName);\n find_specific_data(db, res, ()=>{\n console.log('received specific mongoDB content!');\n client.close();\n });\n });\n}", "title": "" }, { "docid": "8f22a12670e4cb5d0d49c840b1d153fc", "score": "0.66397756", "text": "async function loadDataCollection() {\n const client = await mongodb.MongoClient.connect(\n \"mongodb+srv://beedataRW:[email protected]/beedata?retryWrites=true&w=majority\",\n {\n useNewUrlParser: true,\n useUnifiedTopology: true,\n }\n );\n return client.db(\"beedata\").collection(\"dataV3\");\n}", "title": "" }, { "docid": "d6cd7fea52eeb127e29a5fa23ee9006c", "score": "0.65762824", "text": "function mongo() { //quick wrapper for improving usability of database connection.\n return mongoClient.connect(url);\n}", "title": "" }, { "docid": "fa97ee477908b2741b0ee6507ce9e002", "score": "0.65649843", "text": "async function getData(username, postid=null){\n\tlet posts = client.db('BlogServer').collection('Posts');\n\n\tlet data;\n\tif(postid==null){\n\t\tdata = await posts.find({ username : username }).toArray();\n\t} else {\n\t\t//throw error if postid does not exist.\n\t\tdata = await posts.find({username : username, postid : postid }).limit(1).toArray();\n\t\tif(data.length==0){\n\t\t\tawait console.log(\"Couldn't find post.\");\n\t\t\tthrow new Error('Post not found.');\n\t\t}\n\t}\n\treturn data;\n}", "title": "" }, { "docid": "c63a7eca993aa6a85ee1be7a22f0538b", "score": "0.64564335", "text": "function findDocs(res){\n MongoClient.connect(uri, {useNewUrlParser:true}, (err,client)=>{\n console.log('connected..');\n const db = client.db(dbName);\n get_documents(db, res, ()=>{\n console.log('received mongoDB contents!');\n client.close(); // closing the client connection after query is done, within the anonymous callback method\n });\n });\n}", "title": "" }, { "docid": "27052aa2af951d0b3017dd5c6d4ddd4e", "score": "0.6454415", "text": "async _get(collection, searchSpecs) {\n const mongoInfo = toMongoInfo(searchSpecs);\n let cursor;\n if (mongoInfo._id !== undefined) {\n cursor = await collection.find({_id: mongoInfo._id});\n }\n else {\n const [ count, index ] = [ mongoInfo._count, mongoInfo._index ];\n assert(index !== undefined);\n assert(count !== undefined);\n const query = Object.assign({}, mongoInfo);\n for (const k of Object.keys(mongoInfo)) {\n\tif (k.startsWith('_') && k !== '_id') delete query[k];\n }\n cursor = collection.find(query).sort({_id: 1}).skip(index).limit(count);\n }\n const mongoInfos = await cursor.toArray();\n return mongoInfos.map(e => fromMongoInfo(e));\n }", "title": "" }, { "docid": "1d30bb530412f38d035aa391528f823a", "score": "0.6440187", "text": "function getAllItemsFromDb() {\n db.collection('Todos2')\n .find()\n .toArray()\n .then((docs) => {\n console.log(JSON.stringify(docs, undefined, 2));\n console.log('------------------');\n }).catch(e => {\n console.log(e);\n })\n }", "title": "" }, { "docid": "a6d881b9cee43741f88278a1b5fee17f", "score": "0.6393851", "text": "function load_db(){\n // database\n mydb = \"mongodb://\" + CONFIG.MONGO_USER + \":\" + CONFIG.MONGO_PASS + \"@cl0-shard-00-00-fw6xy.mongodb.net:27017,cl0-shard-00-01-fw6xy.mongodb.net:27017,cl0-shard-00-02-fw6xy.mongodb.net:27017/\" + CONFIG.MONGO_DOC + \"?ssl=true&replicaSet=CL0-shard-0&authSource=admin\"\n\n var db = mongojs(mydb, ['proyecto']);\n\n // sort by date\n db.proyecto.find({}).sort({date: 1}, function (err, docs) {\n \tif(err) {\n console.log(err);\n } else {\n console.log(\"db ordered by date\");\n }\n });\n\n // get data\n db.proyecto.find({}, function (err, docs) {\n if(err) {\n console.log(\"ERROR GETTING DATA FROM MONGODB!\\n\"+err);\n } else if (!docs) {\n console.log(\"NO DATA IN MONGODB\");\n } else {\n get_mongo_data(docs);\n // console.log(\"DATA:\")\n // list_all(db_verguenza);\n }\n db.close();\n });\n}", "title": "" }, { "docid": "d95208c830374e7d9a77f007d4de9c15", "score": "0.633642", "text": "async function loadOrdersCollection() {\n const client = await mongodb.MongoClient.connect('mongodb+srv://dbAdmin:[email protected]/<Coursework2>?retryWrites=true&w=majority', {\n useUnifiedTopology: true\n });\n\n return client.db('Coursework2').collection('OrderInfo');\n}", "title": "" }, { "docid": "1a1766578e48b80588f14141632bce0b", "score": "0.632765", "text": "async function get(){\n let db = await MongoClient.connect(mongourl, {useNewUrlParser: true, useUnifiedTopology: true});\n return db;\n}", "title": "" }, { "docid": "2ea6759f0b5af618f2b3ab3ac1d93200", "score": "0.63031185", "text": "function fetchConveyorData(res) {\n var cursor = mongoose.connection.collection('Conveyor').find({\"conveyor_belt_on_time\":10},\n { \"_id\":0\n , \"conveyor_belt_on_time\":1\n\n }\n ) .toArray(function (err, queryResult) {\n //returnQueryResult = queryResult;\n res.send(queryResult);\n });\n}", "title": "" }, { "docid": "a8518d10265332e9f2aaeed0470f3b9c", "score": "0.6301304", "text": "async function get({id}) {\r\n return withDb(async (collection) => {\r\n const film = await collection.findOne({_id: new ObjectId(id)});\r\n console.log(JSON.stringify(film, null, 4));\r\n });\r\n}", "title": "" }, { "docid": "f336e4d2190288285b226b450bc9ffab", "score": "0.62752", "text": "getMeteorData(){\n var teamname = Session.get(\"team\");\n return {\n channels: Channels.find({\"team.teamName\": teamname}).fetch()\n };\n }", "title": "" }, { "docid": "49d969fcaafd0304274150fcb931b9bc", "score": "0.62691694", "text": "function finditemsByObjectId() {\n db.collection('Todos')\n .find({\n _id : new ObjectID('5b424f995f33c02a4afff47d')\n })\n .toArray()\n .then((docs) => {\n console.log(JSON.stringify(docs, undefined, 2));\n console.log('-------------------');\n }).catch(e => {\n console.log(e);\n })\n }", "title": "" }, { "docid": "84a075fb52c95dedf16785b636a2766c", "score": "0.62436575", "text": "async function loadMongo() {\n // Connect to the db\n const c = await mongoose.connect(config.databaseURL, {\n useUnifiedTopology: true,\n useNewUrlParser: true,\n useCreateIndex: true,\n });\n\n // Au cas ou mais magic\n return c.connection.db;\n}", "title": "" }, { "docid": "af324b63dd83e497a98bac220f6236b9", "score": "0.6242816", "text": "async function loadPostsCollection() {\r\n const client = await driver.MongoClient.connect('mongodb://localhost:27017/vueposts',{\r\n useNewUrlParser: true\r\n });\r\n return client.db('vueposts').collection('vueposts');\r\n}", "title": "" }, { "docid": "71709e8622ecb2027f67c95547d9be9a", "score": "0.62184566", "text": "function getTodos() {\r\n dbtodos.find( (err, todo) => {\r\n if(err){console.log(err);};\r\n sendtoFront('todos', todo);\r\n });\r\n}", "title": "" }, { "docid": "551c0d4c1c038fc79286cba795478366", "score": "0.62149495", "text": "async function list() {\r\n return withDb(async (collection) => {\r\n const films = await collection.find().toArray();\r\n console.log(JSON.stringify(films, null, 4));\r\n });\r\n}", "title": "" }, { "docid": "e0dd1e5789632bc1ee762f5f59ee621e", "score": "0.6212219", "text": "async openMongoClient () {\n\t\tthis.mongoClient = new MongoClient({ collections: COLLECTIONS });\n\t\ttry {\n\t\t\tawait this.mongoClient.openMongoClient(ApiConfig.getPreferredConfig().storage.mongo);\n\t\t\tthis.data = this.mongoClient.mongoCollections;\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow `unable to open mongo client: ${JSON.stringify(error)}`;\n\t\t}\n\t}", "title": "" }, { "docid": "a2ba23587e93319c76d015f802d72503", "score": "0.618237", "text": "async function fetchDB(MONGO_DB_NAME, COLLNAME) {\n let collections;\n try {\n collections = await createDynamicModel(url, MONGO_DB_NAME, COLLNAME)\n } catch (e) {\n testBugger.errorLog(e);\n testBugger.errorLog(\"Error in getting Collection OBJ\")\n }\n let output;\n try {\n output = collections.find({});\n } catch (e) {\n testBugger.errorLog(e);\n testBugger.errorLog(\"Error in data fetching from \" + COLLNAME)\n }\n\n if (output == undefined) {\n console.log(\"Data fatched from\" + COLLNAME)\n return true\n }\n return output\n}", "title": "" }, { "docid": "bd615ace33f986cfdc0dfd0be26f2917", "score": "0.6167097", "text": "function allUsers(){\nMongoClient.connect(url, function(err, db) {\n if (err) throw err;\n db.collection(\"Users\").find({}).toArray(function(err, result) {\n if (err) throw err;\n console.log(result);\n db.close();\n });\n}); \n}", "title": "" }, { "docid": "7f44d672bbe9f12cb56a58780d19212f", "score": "0.6165442", "text": "function getUsers_DB() {\n\tdb.collection(USERS_COLLECTION).find({}).toArray(function(err, doc) {\n\t if (err) {\n\t \thandleError(err.message, \"Failed to get users.\");\n\t \treturn \"\";\n\t } else {\n\t \t//Doc es un array de los diferentes usuarios y sus diferentes campos\n\t\t /**for (var i in doc) {\n\t\t \tfor (var elem in doc[i]){\n\t \t\t\tconsole.log(\"Users got: doc[i]-elements-> \"+doc[i]+\"-\"+elem);\n\t \t\t}\n\t \t}**/\n\t \treturn doc;\n\t }\n \t});\n}", "title": "" }, { "docid": "6a68de997a5857119c02f80aaee8a486", "score": "0.614742", "text": "getAll(cb){\n this.bp_collection.find({}, (err, doc) => {\n return returnSimpleResult(err, doc, cb);\n });\n }", "title": "" }, { "docid": "7933b020aea93646ed678c33fe348e04", "score": "0.6129367", "text": "function getUser_DB(id) {\n\tdb.collection(USERS_COLLECTION).findOne({ _id: id}, function(err, doc) {\n\t if (err) {\n\t handleError(err.message, \"Failed to get a specific user\");\n\t } else {\n\t \tfor (var elem in doc) {\n\t \t\tconsole.log(\"User got: \"+elem);\n\t \t}\n\t }\n\t});\n}", "title": "" }, { "docid": "3674d350aff157e87ab8beb5a0acd57c", "score": "0.6121299", "text": "mongoRequest(res, query, classify) {\n\t\tdb.tweet.aggregate([{\n\t\t\t$match: query\n\t\t}], function(err, result) {\n\t\t\tMongoRequest.readFileSources(res, classify, JSON.stringify({\n\t\t\t\tresult\n\t\t\t}));\n\t\t});\n\t}", "title": "" }, { "docid": "744efd917b63d55850fc9b31b45eabe5", "score": "0.6118995", "text": "function getData(key){\n return db.get(key)\n}", "title": "" }, { "docid": "4211f611ae548156b6717626f15cc740", "score": "0.60835654", "text": "async function Get() {\n try {\n const Institution = await getDB();\n return await Institution.find({});\n } catch (err) {}\n}", "title": "" }, { "docid": "8fad67c6d655925c0574c728e355c8f5", "score": "0.6082551", "text": "getMeteorData() {\n return {\n tasks: Tasks.find({}).fetch()\n }\n }", "title": "" }, { "docid": "1e6b490d9dcc82635f44d20a75361553", "score": "0.6079747", "text": "function getItemsByQuery() {\n db.collection('Todos').find({text : 'some text'}).toArray()\n .then((docs) => {\n //console.log(JSON.stringify(docs, undefined, 2));\n docs.map(item => {\n console.log(item);\n });\n console.log('-------------------');\n }).catch(e => {\n console.log(e);\n })\n }", "title": "" }, { "docid": "ccedf72710e681824438e66ea41735c7", "score": "0.6073011", "text": "async readBook(id) {\n const bookCollection = await bookCollection();\n const book = await bookCollection.findOne({ _id: id });\n\n if (!book) throw \"Book not found\";\n\n //for the console.log\n return book;\n }", "title": "" }, { "docid": "b23120d85f7d582fb11b1275e7847ff9", "score": "0.607077", "text": "function getProduct(req, res) {\n\n var collectionRef = db.collection('products');\n collectionRef.where('name', '==', req.params.id).get()\n .then(function(snapshot) {\n snapshot.forEach(function (doc) {\n //console.log(doc.id, '=>', doc.data());\n res.jsonp(doc.data());\n });\n })\n .catch(function(err) {\n console.log('Error getting documents', err);\n error(res, err);\n });\n}", "title": "" }, { "docid": "f7c7e44d80690ea5583729ff8deb81ef", "score": "0.60666376", "text": "async read() {\n let contenido = await modelo.find({});\n return contenido;\n }", "title": "" }, { "docid": "2831e20cb1bfda7234327800c195cc9f", "score": "0.60483277", "text": "async function getAllPlants(){\n plantsCollection.find({}).toArray(function(err, result) {\n console.log(\"Your entries in MongoDB are: \");\n console.log(result);\n });\n}", "title": "" }, { "docid": "f23a9e0e8ad1e529f5d33438bf0f90ff", "score": "0.60405993", "text": "async getData () {\n // data can be a promise, so we wait until it resolves\n const data = await this.data\n\n // if data is a lucid collection, return just the array with the data\n if (data && data.rows) {\n return data.rows\n }\n\n // data is an item, so we return it as is\n return data\n }", "title": "" }, { "docid": "2dc59b713f935e12b1f49aff1c2c6ec2", "score": "0.60276824", "text": "function getFromDB() {\n $http.get('http://192.168.1.123:3000/blip').then(function(blips) {\n if (blips.data) {\n _store(blips.data);\n _transformForMap(blips.data);\n }\n $rootScope.$emit('blipsRetrieved');\n });\n }", "title": "" }, { "docid": "effba60b95f31c4ab725721d3fa880ca", "score": "0.6027083", "text": "getMeteorData() {\n return {\n currentUser:Meteor.user(),\n events:Events.find({}).fetch()\n };\n }", "title": "" }, { "docid": "2cd941d56213644b48e4fdff6ae80d3b", "score": "0.60201925", "text": "async function mongoDb() {\n const client = await MongoClient.connect(url, { useNewUrlParser: true });\n return client;\n}", "title": "" }, { "docid": "85602472f5a27e549a68ffa08969371d", "score": "0.60133964", "text": "function find() {\n return db(\"users\");\n}", "title": "" }, { "docid": "0e8a20b32fee95e370b27839cb968520", "score": "0.5989533", "text": "get(req, res) {\n this.store.findOne(this.name, {id: req.params.id})\n\n .then((doc) => {\n if (doc) {\n res.status(200).json(doc).end();\n }\n else {\n res.status(404).end();\n }\n })\n\n .catch(this._err(req, res));\n }", "title": "" }, { "docid": "4c1e603b6f6dde357ee485a4d82f1be0", "score": "0.5974821", "text": "function readDocument(collection, id) {\n // Clone the data. We do this to model a database, where you receive a\n // *copy* of an object and not the object itself.\n var collectionObj = data[collection];\n if (!collectionObj) {\n throw new Error(`Object collection ${collection} does not exist in the database!`);\n }\n var obj = collectionObj[id];\n if (obj === undefined) {\n throw new Error(`Object ${id} does not exist in object collection ${collection} in the database!`);\n }\n return JSONClone(data[collection][id]);\n}", "title": "" }, { "docid": "4c1e603b6f6dde357ee485a4d82f1be0", "score": "0.5974821", "text": "function readDocument(collection, id) {\n // Clone the data. We do this to model a database, where you receive a\n // *copy* of an object and not the object itself.\n var collectionObj = data[collection];\n if (!collectionObj) {\n throw new Error(`Object collection ${collection} does not exist in the database!`);\n }\n var obj = collectionObj[id];\n if (obj === undefined) {\n throw new Error(`Object ${id} does not exist in object collection ${collection} in the database!`);\n }\n return JSONClone(data[collection][id]);\n}", "title": "" }, { "docid": "4c1e603b6f6dde357ee485a4d82f1be0", "score": "0.5974821", "text": "function readDocument(collection, id) {\n // Clone the data. We do this to model a database, where you receive a\n // *copy* of an object and not the object itself.\n var collectionObj = data[collection];\n if (!collectionObj) {\n throw new Error(`Object collection ${collection} does not exist in the database!`);\n }\n var obj = collectionObj[id];\n if (obj === undefined) {\n throw new Error(`Object ${id} does not exist in object collection ${collection} in the database!`);\n }\n return JSONClone(data[collection][id]);\n}", "title": "" }, { "docid": "5747ef98e0185fdbeb1e4c934cf2c733", "score": "0.5967383", "text": "get(collection, id)\n {\n return new Promise((resolve, reject) => {\n this.connect().then((db) => {\n return db.collection(collection).findOne({_id: ObjectID(id)});\n }).then((result) => {\n resolve(result);\n }).catch((error) => {\n reject(error);\n });\n });\n }", "title": "" }, { "docid": "4963aa9f47e8542c11a065637f0414b9", "score": "0.5965315", "text": "async function getPersona(req, res)\n{\n try\n {\n let condiciones=req.body;\n \n logger.debug(\"En getPersona: \");\n const cursorPersonas=await collection.find(condiciones);\n await sleep(5000)\n const personas=await cursorPersonas.toArray();\n \n res.status(201).send(personas);\n } catch (ex)\n {\n res.status(501).send(\"Error at getPersona: \"+ex.message);\n }\n}", "title": "" }, { "docid": "ba681e418547b047381356ce800c481a", "score": "0.5961017", "text": "async fetchDocuments(collectionName){\n\t\tconsole.log(\"fetching documents from \"+collectionName+\" collection\");\n\t\treturn new Promise((resolve, reject)=>{\n\t\t\tthis.dbConnect(function(db){\n\t\t\t\tif(db){\n\t\t\t\t\tdb.collection(collectionName).find().sort({\"_id\":-1}).toArray(function(err,items){\n\t\t\t\t\t\tresolve(items);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tconsole.log(\"Error in dbConnect while fetching documents\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t});\n\n\t}", "title": "" }, { "docid": "c66d4518017c5ca60dc82ba6b308c626", "score": "0.5958645", "text": "async function getData() {\n //console.log(\"hello from cards\");\n const cardsData = await cards.find();\n return cardsData;\n}", "title": "" }, { "docid": "950ac8957327e26a6993ea51e714930b", "score": "0.5956572", "text": "getAllPetsAdmin() {\n return this.collection.find({}).fetch();\n }", "title": "" }, { "docid": "1a218a79b4993b1b5419d5f80b28ab6b", "score": "0.5947512", "text": "async function getUserData(userID) {\n\tlet db;\n\ttry {\n\t\tconst oId = ObjectId(userID);\n\t\tconst myObjt = { _id: oId };\n\t\tdb = await connectDb();\n\t\tconst collection = await selectUsersCollection(db);\n\t\tconst result = await collection.findOne(myObjt);\n\t\tdb.close();\n\t\treturn result;\n\t} catch (e) {\n\t\tconsole.log(`UPS!!!! FEHLER: ${e}`);\n\t} finally {\n\t\tif (db) db.close();\n\t}\n}", "title": "" }, { "docid": "01ff93baf9df1b9ea16fb14a8fd20593", "score": "0.5946795", "text": "function find() {\n return db('users')\n}", "title": "" }, { "docid": "76e46fdf0087b8a596e17b7dbae81619", "score": "0.59425753", "text": "function getAllData () {\n return db_tk.allDocs(options);\n }", "title": "" }, { "docid": "ccae09a30c511fbd3c1f06d134bf3e6b", "score": "0.59249765", "text": "async mongoToArray(mongo) {\n return mongo.toArray();\n }", "title": "" }, { "docid": "b9178586933c32a92f2be0524373233d", "score": "0.5922835", "text": "async readAllBooks() {\n const bookCollection = await books();\n\n //console log all\n return await bookCollection.find({}).toArray();\n }", "title": "" }, { "docid": "b75c6f00bba439766ea49c4ea0a5359f", "score": "0.5908885", "text": "function find(){\n return db('notesdb')\n .select('id','title', 'content')\n}", "title": "" }, { "docid": "09ec064269f6e9c0a7350833cdfcd1bf", "score": "0.590464", "text": "function initial(req, res, module, problem) {\n //var problems = req.db.collection('problems')\n Lesson.find({\n module: module,\n name: problem\n }).then(function(result){\n //console.log(result[0]._doc);\n res.json(result[0]._doc)\n })\n}", "title": "" }, { "docid": "4964d4a9b84378dd3f894bddff81bf4f", "score": "0.58979356", "text": "async function loadPostsCollection() {\n const client = await mongodb.MongoClient.connect(\n \"mongodb+srv://disabledbarrel:<password>@vue-express-ebdrj.mongodb.net/test?retryWrites=true&w=majority\",\n {\n useUnifiedTopology: true\n }\n );\n\n return client.db(\"vue-express\").collection(\"posts\");\n}", "title": "" }, { "docid": "445665615af16c66ab60593a242c1316", "score": "0.5894524", "text": "function find() {\n return db('users');\n}", "title": "" }, { "docid": "c4b84e97d689435b0198ccc59b7fbf16", "score": "0.5884218", "text": "function GetCassetteAPI(req, res, next) {\t\n\t\n\t// This is the callback we pass to mongoIO.readItem\n\t// When the Mongo read operation finishes, it will\n\t// run our callback, which is:\n\t// send the data from Mongo back to the browser as \n\t// JSON, OR handle any errors that come up.\n\tfunction sendDataCallback(err, data) {\n if (data) {\n res.json(data)\n } else {\n console.log('ouch');\n console.log(err);\n next(err);\n }\t\t\n\t}\t\n\t// Here we make the call to readItem and pass in the \n\t// callback\n\tmongoIO.readItem(sendDataCallback);\t\n}", "title": "" }, { "docid": "4439b838e34f47914d74a032e2c37ab6", "score": "0.5867018", "text": "async function getPersona(req, res)\n{\n try\n {\n let condiciones=req.body;\n \n logger.debug(\"En getPersona: \");\n const cursorPersonas=await Person.find(condiciones); \n res.status(200).send(cursorPersonas);\n } catch (ex)\n {\n res.status(501).send(\"Error at getPersona: \"+ex.message);\n }\n}", "title": "" }, { "docid": "d37bed09442a87b75dd71ac4fdfbe5f1", "score": "0.5865517", "text": "function getBooks (req,res){\n // Querry the DB and in no erros , send all the boods \n let querry = Book.find({});\n querry.exec((err,books)=>{\n if(err) res.send(err);\n // if no errors,send them back to the client ;\n res.json(books)\n });\n}", "title": "" }, { "docid": "b221a134d9867cfa0416b0a621e7f046", "score": "0.5863742", "text": "static get mongo() { \n if (clientInstances.mongo === null) {\n throw Error(`[DBFactory, MongoDB] Can't get mongo client instance because it's not ready. \n Call async \"await DBFactory.connectMongo()\" and then you can use sync \"DBFactory.mongo\"`);\n }\n return clientInstances.mongo;\n }", "title": "" }, { "docid": "c5bc83cb1175b5a1fd7b5bb1059b9d8f", "score": "0.585808", "text": "async function loadFactsCollection() { \n const client = await mongodb.MongoClient.connect(process.env.MONGO_URL, {useNewUrlParser: true});\n return client.db('vue_express').collection('facts')\n}", "title": "" }, { "docid": "5f42a115fcbc6396e3319ae64b4ffc0a", "score": "0.5857208", "text": "async openMongoClient () {\n\t\tthis.mongoClient = new MongoClient({ collections: ['__all', 'migrationVersion'] });\n\t\ttry {\n\t\t\tawait this.mongoClient.openMongoClient(ApiConfig.getPreferredConfig().storage.mongo);\n\t\t\tthis.data = this.mongoClient.mongoCollections;\n\t\t}\n\t\tcatch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : JSON.stringify(error);\n\t\t\tthrow `unable to open mongo client: ${message}`;\n\t\t}\n\t}", "title": "" }, { "docid": "e125bca87c0e9084a5a34965eae8c4cd", "score": "0.585583", "text": "async function loadReceiptsCollection() {\n\tconst client = await mongodb.MongoClient\n\t\t.connect(process.env.MONGO_DB_URI, {\n\t\t\tuseNewUrlParser: true\n\t\t});\n\n\treturn client.db(process.env.MONGO_DB).collection('receipts');\n}", "title": "" }, { "docid": "f8850654415800205d0351bc82b50f06", "score": "0.58537227", "text": "async exec(req, res) {\n const query = {}\n if (req.query.hasOwnProperty('online')) {\n query['onlineStatus'] = req.query.online === 'true'\n }\n\n try {\n MongoClient.connect(mongouri, (err, db) => {\n if (err) throw err\n const dbo = db.db('nukkit')\n dbo.collection('players').find(query).toArray((err, result) => {\n if (err) throw err\n console.log(result)\n res.json({\n status: 'ok',\n players: result\n })\n db.close()\n })\n })\n } catch (mongoException) {\n res.json({\n status: 'error',\n error: mongoException\n })\n }\n }", "title": "" }, { "docid": "d1ae063e0bff97e8a74744ef11c1f798", "score": "0.5849431", "text": "function getAllBooks() {\n console.log(\"model.getAllBooks()\");\n return collection.find().toArray()\n}", "title": "" }, { "docid": "6cac2fe30c22039a54218bd1a1232bcd", "score": "0.5849253", "text": "static get(query, options) {\n return __awaiter(this, void 0, void 0, function* () {\n const cursor = yield new this().collection().find(query, options);\n const results = yield cursor.toArray();\n return results.map(doc => Serializer_1.hydrateModel(doc, this));\n });\n }", "title": "" }, { "docid": "9feaa7782a979416cf7f28768c4e66da", "score": "0.5840127", "text": "async function asyncGetDoc(dbName,_id){\n try {\n const dbInstance = await nano.use(dbName)\n const result = await dbInstance.get(_id)\n console.log(result)\n \n } catch (error) {\n console.log(error)\n }\n}", "title": "" }, { "docid": "b3b313663f466826b0487340565e7f77", "score": "0.58397484", "text": "async toMongo() {\n await query.finalize();\n const criteria = query.get('criteria');\n const lateCriteria = query.get('lateCriteria');\n if (lateCriteria) {\n _.assign(criteria, lateCriteria);\n }\n if (query.get('log') || process.env.APOS_LOG_ALL_QUERIES) {\n self.apos.util.log(util.inspect({\n criteria: query.get('criteria'),\n skip: query.get('skip'),\n limit: query.get('limit'),\n sort: query.get('sortMongo'),\n project: query.get('project')\n }, { depth: 20 }));\n }\n return query.lowLevelMongoCursor(query.req, query.get('criteria'), query.get('project'), {\n skip: query.get('skip'),\n limit: query.get('limit'),\n sort: query.get('sortMongo')\n });\n }", "title": "" }, { "docid": "5291c41d0cd308c4123df0b5f31d4e14", "score": "0.5838129", "text": "function FindQuery(result) {\n const myDataBase = result.db(\"Students\");\n\n const myCollection = myDataBase.collection(\"lists\");\n\n let query = { City: \"Dhaka\", Roll: \"03\" };\n\n myCollection.find(query).toArray(function (error, rslt) {\n console.log(rslt);\n });\n}", "title": "" }, { "docid": "1c3a26b0eae6b128e45ed13186e560d4", "score": "0.58330107", "text": "async function get(dbName, collectionName, str) {\n var MongoClient = require('mongodb').MongoClient;\n var url = \"mongodb://localhost:27017/\";\n let user;\n let promise = new Promise((resolve,reject)=> {\n MongoClient.connect(url, {useUnifiedTopology: true}, function(err, db) {\n if(err) reject (err) ;\n var dbo = db.db(dbName);\n dbo.collection(collectionName).findOne({$or:[{_id: str}, {name: str}]}, function(err, result) {\n if(err) reject(err);\n //console.log(result);\n //console.log('1111111111');\n user = result;\n db.close();\n resolve(user);\n });\n });\n });\n user = await promise;\n return user;\n}", "title": "" }, { "docid": "5c6ec5e877dd3ae9eafdb33d2aabc131", "score": "0.58300406", "text": "function getRecentSearch(res){\n MongoClient.connect(db_url, function(err, db){\n if(err){\n console.log(err);\n return;\n }\n \n //Select the collection\n var recentSearchs = db.collection('recent_searches');\n \n recentSearchs.find({},{_id: 0, term: 1, when: 1}).sort({when: -1}).toArray(function(err, data){\n if(err) console.log(err);\n res.send(JSON.stringify(data));\n })\n \n db.close();\n });\n}", "title": "" }, { "docid": "57a34401ed49b478716f57bc1dc3111d", "score": "0.5820655", "text": "async function main(){\n const url = \" mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&ssl=false\"\n\n const client = new MongoClient(url);\n\ntry {\nawait client.connect( { useUnifiedTopology: true});\n\nawait findOneBrandByName(client, \"tori\");\n} catch (err){\n console.error(err);\n} finally {\n await client.close();\n}\n}", "title": "" }, { "docid": "f7a9ab1fa9c56220c28a57d85d7cb6ce", "score": "0.58173597", "text": "static connectToMongo() {\n if (this.db) return Promise.resolve(this.db);\n return MongoClient.connect(url, this.options)\n .then(client => this.db = client.db(mongo_DBNAME));\n }", "title": "" }, { "docid": "4c0b4289140e64964e1a941d616ecf8f", "score": "0.58154076", "text": "static async getAll() {\n try{\n const db = mongodb.getDB();\n let data = await db.db().collection(collectionName).aggregate(\n [\n {\"$match\":{\"deleted\":{\"$ne\":true}}},\n {\"$unwind\":\"$clients\"},\n {\"$unwind\":\"$projects\"},\n {\"$lookup\":\n {\"from\":\"client\",\"localField\":\"clients\",\"foreignField\":\"_id\",\"as\":\"client\"}\n },\n {\"$unwind\":\"$client\"},\n {\"$lookup\":\n {\"from\":\"project\",\"localField\":\"projects\",\"foreignField\":\"_id\",\"as\":\"project\"}\n },\n {\"$unwind\":\"$project\"},\n {\"$group\":\n {\n \"_id\":\"$_id\",\n \"client\":{\"$addToSet\": \"$client.name\"},\n \"project\":{\"$addToSet\": \"$project.name\"},\n \"userName\":{\"$first\": \"$userName\"},\n \"clients\":{\"$addToSet\":\"$client._id\"},\n \"projects\":{\"$addToSet\":\"$project._id\"}\n }\n }\n ]).toArray();\n return data;\n } catch(err) {\n throw err;\n }\n\n }", "title": "" }, { "docid": "903f9464b48a4a9c8c587f7a7d42610c", "score": "0.58153063", "text": "async function getDocsList(dbName){\n try {\n const dbInstance = await nano.use(dbName)\n const result = await dbInstance.list({include_docs: true})\n result.rows.forEach((doc) => {\n console.log(doc.doc);\n });\n } catch (error) {\n console.log(error)\n }\n}", "title": "" }, { "docid": "a6aa9d7c7902020b6a65b51409764f91", "score": "0.58087695", "text": "function usersModel() {\n return MongoClient.connect(url, { useNewUrlParser: true })\n .then( function(client) {\n // Return the dbo object after we load the database\n return client.db(dbName);\n })\n .then( function(dbo) {\n return dbo.collection('rrtm_users').find().toArray();\n })\n .then( function(result) {\n response = result;\n return result;\n })\n .catch (function (error) {\n console.log(error);\n });\n}", "title": "" }, { "docid": "d4c53031beba9d1d566b295f4c397914", "score": "0.5798812", "text": "function getNumber(cb) {\n MongoClient.connect('mongodb://localhost:27017/mydb', function (err, db) {\n if (err) {\n console.log(\"Database not Connected !\");\n } else {\n //console.log(\"We are connected !\");\n // check if the collection exists or not\n db.collection('script_executed', {strict: true}, function (err, collection) {\n if (err) {\n console.log(\"Collection does not exists\");\n }\n });\n\n var collection = db.collection('script_executed');\n collection.find({\"executed\": {\"$exists\": 1}}).toArray(function (err, result) {\n if (err) {\n console.log(err);\n }\n else if (result.length) {\n // console.log('Found ',result[0].executed);\n cb(result[0].executed);\n db.close();\n\n }\n else {\n console.log(\"No document found\");\n }\n });\n }\n db.close();\n });\n}", "title": "" }, { "docid": "38cfc35d747c6c78c6acad21b13493b9", "score": "0.5798561", "text": "function _getDocument(model, res) {\n var collection = DB.collection(COLLECTION_NAME);\n console.log(model);\n var q = model.map(function(item) {\n return { \"name\": item };\n });\n collection.find({ $or: q }).toArray(function(err, result) {\n if (err) {\n console.log(err);\n } else if (result.length) {\n res.json({ success: true, results: result });\n } else {\n\n }\n });\n}", "title": "" }, { "docid": "3406463d56ec83ebf23ba16045fbd502", "score": "0.5795015", "text": "async function main(){\r\n const client = new MongoClient(process.env.DATABASE);\r\n try {\r\n await client.connect(); \r\n collections = await client.db(\"vueproject\").collection(\"lessons\").find().toArray();\r\n sortedData = await client.db(\"vueproject\").collection(\"lessons\").find().sort(mySort).toArray(); \r\n\r\n } catch (e) {\r\n console.error(e);\r\n } \r\n}", "title": "" }, { "docid": "e5ae80bc3602de17cfeb4a55ec888a7a", "score": "0.57910144", "text": "function getData(req, res){\n\tdb.findAll(function(success, results){\n\t\tres.send(new AXResponse(success, results));\n\t});\n}", "title": "" }, { "docid": "c60e928e88c9e929f10215477212a4a8", "score": "0.5786632", "text": "function retrieveDocument(collectionName, query, next) {\n\n const collection = database.collection(collectionName);\n\n collection.findOne(query).then(doc => {\n next(doc);\n });\n\n}", "title": "" }, { "docid": "5823abb9d622f7444abea65cda470a10", "score": "0.57840395", "text": "static produit_all(request,response,callback)\n {\n \n base.basededonnee(function(MongoClient,assert,url,dbName,db){\n \n // console.log(url);\n \n const carte = db.collection('carte');\n\n\n carte.find({}).toArray((error,result)=>{\n if(error) throw error;\n \n callback(result);\n });\n \n });\n }", "title": "" }, { "docid": "d2cf1b94000c6b48e27bd41959d14a6a", "score": "0.57823616", "text": "function getDataJ() {\n \nreturn fetch(url)\n.then(response => response.text())\n.then(body => {\n const $ = cheerio.load(body);\n\n var numGames = $(\".field--name-field-games-won .field__item\").text();\n var totalMoney = $(\".field--name-field-total-money-earned .field__item\").text();\n var currentDate = $(\".field--name-field-as-of .field__item\").text();\n\n const jamesData = {\n \tnumGames,\n \ttotalMoney,\n \tcurrentDate\n }\n return jamesData;\n});\n\n\n\n// const gamesWon = db.collection(\"James Info\").doc();\n// gamesWon.set(jamesData);\n\n\n}", "title": "" }, { "docid": "25c40f63a1e2630842052be000318eb1", "score": "0.57758003", "text": "function readOrders(findParams, callback){\n var client = new MongoClient(url);\n client.connect((err)=>{\n assert.equal(null, err);\n\n const db = client.db(dbName);\n const collection= db.collection(collectionName);\n\n collection.find(findParams).toArray(function(err, docs) {\n assert.equal(err, null);\n callback(docs)\n });\n client.close();\n })\n}", "title": "" }, { "docid": "299d05a81f3c9b3801f3eec77fd038de", "score": "0.5775574", "text": "async getCards(cardName){\n \n //Checking for valid connection\n if(!collection || !db){\n throw \"No Connection To Database\";\n }\n\n let result; \n try {\n\n //Getting Data and Filtering For Nessecary Headers\n result = await collection.find(\n {'$text' : {'$search' : cardName}},\n {'projection' : {'CardName' : 1, 'CardType': 1, 'CreditNetwork' : 1, \"Bank\" : 1, \"CoverageType\" : 1}} \n ).toArray();\n\n } catch (error) {\n console.log(chk.red(`GetData.js: ${error}`));\n result = 'Error';\n } finally {\n return (result);\n }\n\n\n }", "title": "" }, { "docid": "101817f9715cba92b539d07153712164", "score": "0.5774653", "text": "function getClicks(callback) {\n \n new mongo.Db('nodensity', \n \n new mongo.Server(\"127.0.0.1\", 27017), {}).open(function(err, db) {\n \n // Open the clicks collection\n db.collection('clicks', function(err, collection) {\n \n // Get all clicks as an array\n collection.find().toArray(function(err, clicks) {\n\n // Send the clicks back\n callback.apply(this, [clicks]);\n\n });\n \n });\n\n }\n );\n \n}", "title": "" }, { "docid": "3bffa1262f80773a9e6b7126a96b51eb", "score": "0.5757115", "text": "function getQnaper(req, res) {\n\tQnaper_Documents.findById(req.params.id, (err, qnaper) => {\n\t\tif(err) res.send(err);\n\t\t//If no errors, send it back to the client\n\t\tres.json(qnaper);\n\t});\t\t\n}", "title": "" }, { "docid": "76456a46076bee70c7ddf8e2db9e7f2e", "score": "0.5752056", "text": "function get() {\n return db;\n}", "title": "" }, { "docid": "5aab3e6ef1d07802668d7b728fbfea1d", "score": "0.5743032", "text": "function getDB() {\n\n let MongoClient = require('mongodb').MongoClient;\n // let MongoClient = mongodb.MongoClient;\n let url = 'mongodb://localhost:27017/zhhydb';\n\n return MongoClient.connect(url, function(err, db) {\n console.log(123456);\n let DB = db.db('boysAndGirls');\n let connection = DB.collection(\"boyTypes\");\n connection.insert(\n [\n {\n \"type\":\"sexyBeautyBoys\",\n \"name\":\"性感帅哥\"\n },{\n \"type\":\"sportBoys\",\n \"name\":\"运动帅哥\"\n },\n {\n \"type\":\"muscleBoys\",\n \"name\":\"肌肉帅哥\"\n },\n {\n \"type\":\"asianBoys\",\n \"name\":\"亚洲帅哥\"\n },\n {\n \"type\":\"EuropeUsaBoys\",\n \"name\":\"欧美帅哥\"\n },\n {\n \"type\":\"maturityBoys\",\n \"name\":\"熟男帅哥\"\n },\n {\n \"type\":\"handsomeBoys\",\n \"name\":\"小帅哥\"\n },\n {\n \"type\":\"militaryPoliceBoys\",\n \"name\":\"军警帅哥\"\n }\n\n\n ]\n );\n console.log(DB,connection)\n });\n}", "title": "" }, { "docid": "cd27ff516aa4635edb2a677bb2cb749a", "score": "0.5739294", "text": "async function loadPostsCollection() {\n const MongoClient = require(\"mongodb\").MongoClient;\n const uri =\n \"mongodb://admin:[email protected]:27017,dt162g-shard-00-01-je3jq.mongodb.net:27017,dt162g-shard-00-02-je3jq.mongodb.net:27017/test?ssl=true&replicaSet=dt162g-shard-0&authSource=admin&retryWrites=true&w=majority\";\n const client = await new MongoClient.connect(uri, {\n useNewUrlParser: true,\n useUnifiedTopology: true\n });\n\n return client.db(\"dt162g\").collection(\"posts\");\n}", "title": "" }, { "docid": "af0ff216f12c70ab7ef187e9397b0232", "score": "0.5733421", "text": "async function getJsonMongo(roomName){\n let data = await Room.findOne({\n room_id:roomName\n },{_id: 0 });\n if(data)\n return data;\n data = await Room.create({ room_id:roomName })\n return data\n}", "title": "" }, { "docid": "06149ded898b1f19f214585903621bdd", "score": "0.5726786", "text": "function GetData() {\n\n $.get(\"http://localhost:3000/university/\")\n .done(res => SuccessGet(res)) // wanna loop through some collection and get it\n .fail(res => Error(res));\n }", "title": "" }, { "docid": "b16b9ced66be57e55f7cd9ec375bed37", "score": "0.57250965", "text": "function getCollectionData(collection) {\n return collection.docs.map(getDocData);\n}", "title": "" }, { "docid": "dfb04b8da17d8743944f456209e68dea", "score": "0.5719269", "text": "function readDocument(db,BookingNumber)\r\n{\r\n var BookingNumberStr=BookingNumber.toString();\r\n return new Promise(function(resolve,reject)\r\n {\r\n db.get(BookingNumberStr, function(err, data) \r\n {\r\n if (!err) \r\n {\r\n resolve(data);\r\n } else \r\n {\r\n \r\n reject(err);\r\n }\r\n \r\n \r\n });\r\n });\r\n \r\n}", "title": "" }, { "docid": "24e436b7c4e28d7449c2c78aa8fa78b7", "score": "0.5717779", "text": "function getAllStats() {\n //using mongoose to get all Stats\n return StatCollection.find();\n}", "title": "" }, { "docid": "5fb5853d2e7f79054a5421cc53af30c2", "score": "0.570027", "text": "function getCity() {\nvar docRef = db.collection(\"cities\").doc(\"SF\");\n\ndocRef.get().then(function(doc) {\n if (doc.exists) {\n console.log(\"Document data:\", doc.data());\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document!\");\n }\n}).catch(function(error) {\n console.log(\"Error getting document:\", error);\n});\n\n}", "title": "" } ]
accfb960fedaad54e8c46994540ae82f
function to get node obj given it is id
[ { "docid": "3848bf62fde47ef690f9cdf21a22d1f0", "score": "0.6557322", "text": "function getNodeOfId(graphId, nodeId) {\n\tvar nodes = MAIN_GRAPHS[graphId].allNodes;\n\tfor (var i = 0; i < nodes.length; i++) {\n\t\tif (nodes[i].id == nodeId) {\n\t\t\treturn nodes[i];\n\t\t}\n\t}\n\treturn null;\n}", "title": "" } ]
[ { "docid": "44c5fc0c42c008ae7fe21526ed4e2cde", "score": "0.7490394", "text": "static get_by_id(id, node) {\n return Tree.select_first(function (n) {\n return n.id === id;\n }, node);\n }", "title": "" }, { "docid": "9e62a5119a02c898f6d2c6037b4be2b3", "score": "0.7463843", "text": "function findNode(id) {\n return $('#nbSDtreeView').jstree(true).get_node(id);\n }", "title": "" }, { "docid": "42ed86e20bea23e69b778de01f83f3a0", "score": "0.7338974", "text": "function getNode(id){\n\t\t\tfor(var i=0;i<exportableNodeSet.length;i++){\n\t\t\t\tif(exportableNodeSet[i].id == id){\n\t\t\t\t\treturn exportableNodeSet[i];\n\t\t\t\t}\t\n\t\t\t}\n\t\t\treturn null;\n\t\t}", "title": "" }, { "docid": "b0b978f61f29ff633bebec1969ce0b29", "score": "0.7275641", "text": "function id2node(nodeid) { // @param String: nodeid\r\n // @return Node/void 0:\r\n return _nodedb[nodeid];\r\n}", "title": "" }, { "docid": "95ffd688758842644a272948d54c639b", "score": "0.7275071", "text": "function FindNode(nodes, id) {\n node = null;\n $(nodes).each(function() { if (this.value.id == id) { node = this.value; return false; } });\n return node;\n }", "title": "" }, { "docid": "014b22425e4749e9c3c418ed0ffdb63d", "score": "0.7228701", "text": "function Node(id)\n{\n var node = document.getElementById(id);\n if (!node) \n {\n \talert(\"ERROR! Node id not found:\\n\" + id + \"\\n\" + stacktrace());\n \tBUGOUT();\n \treturn null;\n }\n return node;\n}", "title": "" }, { "docid": "9c2dcf6ebadbdddb3509b43160dcbce2", "score": "0.71530384", "text": "function svg_selectNode(id){\n\tswitch(typeof (id)){\n \tcase 'string':node = svgDoc.getElementById(id);break;\n\t\tcase 'object':node = id;break;\n default:node = null;break;\n\t}\n\treturn node;\n}", "title": "" }, { "docid": "bcd0be11dbda6b1325d562afd4de39db", "score": "0.69995546", "text": "function findNodeId(id, nodes){\n\tfor (var i = 0; i < nodes.length; i++){\n\t\t//console.log(nodes[i].label,label, nodes[i].label == label);\n\t\tif (nodes[i].id == id) {\n\t\t\treturn nodes[i];\n\t\t}\n\t} \n\treturn null;\n}", "title": "" }, { "docid": "525974c2d21329ce991671c620d4bee2", "score": "0.69467753", "text": "function Node(elementId) {\n if (!elementId) return null;\n return document.getElementById(String(elementId).replace(/^\\$/, \"\"));\n }", "title": "" }, { "docid": "f6e6639c628cd3ee34ede891d8b76ebf", "score": "0.69379437", "text": "function findNode(nodes, id) {\n for (var i in nodes) {\n if ( nodes[i].id == id ) {\n return nodes[i];\n }\n }\n return [];\n}", "title": "" }, { "docid": "0312cc17a91c336acb17be35b7a886bb", "score": "0.69262445", "text": "findID(id) {\n const lookup = (id, node) => {\n if (node.id === id) {\n return node;\n } else if (node.children && node.children.length > 0) {\n let i = 0;\n let result = null;\n for (i = 0; result == null && i < node.children.length; i++) {\n result = lookup(id, node.children[i]);\n }\n return result;\n }\n return null;\n };\n\n return lookup(id, this.root);\n }", "title": "" }, { "docid": "d9d45c786455165103043af28e192bc4", "score": "0.68385196", "text": "function getNode(nodeid){\n\t\tfor(var i=0; i<$scope.nodes.children.length; i++){\n\t\t\tif( parseInt($scope.nodes.children[i].nodeid) == nodeid )\n\t\t\t\treturn $scope.nodes.children[i];\n\t\t}\n\t\treturn null;\n\t}", "title": "" }, { "docid": "82a8fa7c50f3b825750c2fcb5c90847a", "score": "0.6701111", "text": "function get_index_node_by_id(id) {\n for (var count = 0; count < nodes.length; count++) {\n if (nodes[count].id == id) return count;\n }\n }", "title": "" }, { "docid": "cba47bb89f775157f15856747f668b62", "score": "0.6700106", "text": "get(id) {\n this.node.logger.silly(`Get node ${id} from swarm`)\n var node = this.db.database.get(id)\n if (node.length === 1) {\n return node[0]\n }\n }", "title": "" }, { "docid": "fb378346fd2b6c57f324454443a832bb", "score": "0.6687646", "text": "fetchNode () {\n const $node = $(`#${this.nodeID}`); \n return $node; \n }", "title": "" }, { "docid": "748193e3f83717a282199844620d6dd1", "score": "0.6677597", "text": "function getNode(id) {\n const node = NODES.get(id);\n\n if (node && node.nodeName === 'BODY') {\n // If the node requested is the \"BODY\"\n // Then we return the base node this specific <amp-script> comes from.\n // This encapsulates each <amp-script> node.\n return BASE_ELEMENT;\n }\n\n return node;\n }", "title": "" }, { "docid": "49d9eb9b57c3b323540a8ba82fea83f6", "score": "0.6650119", "text": "function findNode(searchId) {\n for (var idx in graphData.nodes) {\n if (graphData.nodes[idx][\"id\"] == searchId) {\n return graphData.nodes[idx];\n }\n }\n\n return null;\n }", "title": "" }, { "docid": "bf5c1a5d40489d695502ab5e5ad7f876", "score": "0.6640657", "text": "function returnObjById( id ){ \r\n\t\t\tif (document.getElementById)\r\n\t\t\t\t\treturn document.getElementById(id);\r\n\t\t\telse if (document.all)\r\n\t\t\t\t\treturn document.all[id];\r\n\t\t\telse if (document.layers)\r\n\t\t\t\t\treturn document.layers[id];\r\n\t}", "title": "" }, { "docid": "e116742388c33c60cbb212fb64f3dc5f", "score": "0.6639997", "text": "function GetElemById() {}", "title": "" }, { "docid": "31a12fd86b6b66516c903ae6b0a2970b", "score": "0.6603927", "text": "function elementByID(node, id) {\n\tfor (var i in node.childNodes) {\n\t\tvar child = node.childNodes[i];\n\t\tif (child.id == id) {\n\t\t\treturn child;\n\t\t} else {\n\t\t\tchild = elementByID(child, id);\n\t\t\tif (child != null) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}", "title": "" }, { "docid": "cb666659b5758ffa7a477e77f759bdea", "score": "0.6580475", "text": "function getElementId(node){\n\treturn node.element_id;\n}", "title": "" }, { "docid": "60e6944674a2d9d1ba967ad9c0605aa5", "score": "0.65753096", "text": "function getObjectID (id)\n{\n\tif (document.all) \n\t\treturn document.all[id];\n\treturn document.getElementById (id);\n}", "title": "" }, { "docid": "c80e5e2827c3c195d4da7e248316090e", "score": "0.65689194", "text": "getNode(nodeId) {\n const id = nodeId.endsWith('R') ? nodeId.slice(0, nodeId.length - 1) : nodeId\n return this.roads.find(r => r.id === id)\n }", "title": "" }, { "docid": "519c02f777271ceca878198ce8b5485b", "score": "0.6548484", "text": "function get_object(id) {\n\t\t\tvar object = null;\n\t\t\tif( document.layers )\t{\t\t\t\n\t\t\t\tobject = document.layers[id];\n\t\t\t} else if( document.all ) {\n\t\t\t\tobject = document.all[id];\n\t\t\t} else if( document.getElementById ) {\n\t\t\t\tobject = document.getElementById(id);\n\t\t\t}\n\t\t\treturn object;\n\t\t}", "title": "" }, { "docid": "ff456dee2c9f4dbe96477365e847185a", "score": "0.6543218", "text": "function getEmpNode(id){\n graph.forEachNode(node => {\n if (node.EmployeesPresent.contains(id))\n {\n return node;\n }\n else \n {\n console.warn(\"Employee with ID: \" + id +\" was not found present in any of the room nodes.\");\n }\n });\n}", "title": "" }, { "docid": "c94069dfaa48a16e3394c45a176f67ca", "score": "0.64673704", "text": "findNode(id, stop = false) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.nodes.hasOwnProperty(id)) {\n return this.getInfo(id);\n }\n for (const key in this.nodesInfo) {\n if (this.nodesInfo.hasOwnProperty(key) && this.haveChildId(key, id)) {\n const children = yield this.getChildren(key);\n for (const child of children) {\n if (child.id.get() === id)\n return child;\n }\n }\n }\n return undefined;\n });\n }", "title": "" }, { "docid": "de45a8de1b1f54df0992d966d469e076", "score": "0.64623207", "text": "function getEle(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "82135678673de6738eeb768462b23f35", "score": "0.6439281", "text": "function getObjectById(id) { \n\tvar obj; \n\tif (document.getElementById){ \n\tobj = document.getElementById(id); \n\t}else if(document.layers){ obj = document.layers[id];\n\t}else{ \n\t\tobj = document.all.item(id); \n\t} return obj; \n}", "title": "" }, { "docid": "a315d6407988336eb3e9d98929335bc6", "score": "0.6436296", "text": "function get(id) {\n\tvar el = global.doc.getElementById(id);\n\tElement.extend(el);\n\treturn el;\n}", "title": "" }, { "docid": "1411c2947a3e855c138f7aaea22a234d", "score": "0.6433516", "text": "function i_obj_get(obj_id) {\n return document.getElementById(obj_id);\n}", "title": "" }, { "docid": "d7a66fcbc6dd4fd974a5394c82679cfa", "score": "0.6418152", "text": "function getId(node) {\n\tid = $(node).attr(\"id\").substring(2);\n\treturn parseInt(id);\n}", "title": "" }, { "docid": "bafb1af5a37ef2df521a63a2b8d0d90c", "score": "0.64128894", "text": "function getEle(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "a09b6d77720ce1159a80b76e0f178c9a", "score": "0.6410124", "text": "function getObj(id) {\n\tvar returnVal = {};\n\t\n\tif (document.getElementById)\n\t\treturnVar = document.getElementById(id);\n\n\telse if (document.all)\n\t\treturnVar = document.all[id];\n\n\telse if (document.layers)\n\t\treturnVar = document.layers[id];\n\n\treturn returnVar;\n}", "title": "" }, { "docid": "9712cadd08c1b07122575eb58f7d8912", "score": "0.6408403", "text": "function findChildById(thisNode, id)\n{\n if (!thisNode) {\n return false;\n }\n\n var childNode = thisNode.firstChild;\n while (childNode) {\n if (childNode.nodeType == 1) {\n if (childNode.getAttributeNS(null, 'id') == id) {\n return childNode;\n }\n }\n childNode = childNode.nextSibling;\n }\n return false;\n}", "title": "" }, { "docid": "485ff86681e4ac6cf8169ecda4e8fec4", "score": "0.6390783", "text": "function elmId(id) { \r\n return document.getElementById(id);\r\n}", "title": "" }, { "docid": "36bf02d8a0d8818a0f0058f41a955568", "score": "0.63873225", "text": "getNode(modifier=0, prefix=null) {\n return document.getElementById(this.getHtmlId(modifier, prefix));\n }", "title": "" }, { "docid": "a7be0b26aa48181a50950363607ba023", "score": "0.638143", "text": "function DOMObject(fid){return document.getElementById(fid)}", "title": "" }, { "docid": "9632e03c414d85947a7bad72ed89992f", "score": "0.63775396", "text": "function getId(id) {\r\n\treturn document.getElementById(id);\r\n}", "title": "" }, { "docid": "6e4dd7448dfbceb8a4745270b8d1af9e", "score": "0.636595", "text": "getNode( x, y ){\n\t\treturn this.forterator.getObject( this.getNodePointer( x, y ));\n\t}", "title": "" }, { "docid": "ef2ea2f7d712e4c785a15d7bbfe1912e", "score": "0.63654625", "text": "function getId(id){\n var i = document.getElementById(id)\n return i;\n}", "title": "" }, { "docid": "6b85eecb449f1998e63e5a15e158d1f3", "score": "0.6357369", "text": "function getId ( id ) {\n return document.getElementById(id)\n }", "title": "" }, { "docid": "5c11cd73709c28fa94636ae6944a04d9", "score": "0.6354752", "text": "function selectId(id) {\n var object = document.getElementById(id);\n return object;\n}", "title": "" }, { "docid": "be64f51ec0d890fc3671d82e25d96a48", "score": "0.6347295", "text": "function idGetEl(id) {\r\n var el = document.getElementById(id);\r\n return el;\r\n}", "title": "" }, { "docid": "e8eaf58a193ed71e2ee003a89ec290d1", "score": "0.6341453", "text": "function Node(id) {\n this.type = 'single';\n this.id = undefined;\n this.kindredID = undefined;\n this.uniqueID = id; //use phovea defined unique id\n this.hidden = false;\n this.aggregated = false;\n this.generation = -1;\n this.descendant = false;\n this.familyIds = [];\n this.clicked = false;\n this.primary = undefined;\n this.secondary = undefined;\n this.hasChildren = false;\n this.children = [];\n this.spouse = [];\n this.duplicates = [];\n this.visited = false;\n this.deceased = 'Y';\n this.affected = false;\n this.state = layoutState.Expanded;\n this.inferredBdate = false;\n this.hasDdate = true;\n }", "title": "" }, { "docid": "6c337a1ffc8ab7b0230ed95b602ddccb", "score": "0.6334728", "text": "retrieveNodeOnId(eventId) {\n\n //get the node by event id\n let node = this.eventMap[eventId];\n \n //if the node isn't present display an error\n if(!node) {\n console.log(`Inside retrieveNodeOnId()`); \n console.log(eventId); \n //this.print();\n throw `Node node with the id: ${eventId} does not exist in the code list`;\n }\n\n return node;\n }", "title": "" }, { "docid": "c200910fe64cf0e2739ce5364fa457fd", "score": "0.63319266", "text": "function getId(id) {\r\n return document.getElementById(id);\r\n}", "title": "" }, { "docid": "cd807f7f5f2e22eaad675e0e21dc2f2b", "score": "0.63294524", "text": "function getElement(id){\r\n\t\t\tif(typeof id == 'string'){\r\n\t\t\t\treturn doc.getElementById(id);\r\n\t\t\t}\r\n\t\t\treturn id;\r\n\t\t}", "title": "" }, { "docid": "4d7a148ce55ba20b44f40f38afd5912d", "score": "0.63164604", "text": "function _getId(id){\n\t\n\t\n\t\n\treturn document.getElementById(id);\n\t\n\t\n}// End of get element id function", "title": "" }, { "docid": "4ac334024bd78db13d40f4fcee1133f0", "score": "0.6297309", "text": "function get(id) {\n return document.getElementById(id); \n }", "title": "" }, { "docid": "4ca50f251f1365b7473d5bbee4296100", "score": "0.6282896", "text": "function findElementById(doc, id) {\n if (doc.getElementById) {\n return doc.getElementById(id);\n }\n\n let nodes = childNodesOfElement(doc);\n let node;\n\n while (nodes.length) {\n node = nodes.shift();\n\n if (node.getAttribute && node.getAttribute('id') === id) {\n return node;\n }\n nodes = childNodesOfElement(node).concat(nodes);\n }\n }", "title": "" }, { "docid": "8f4f5c29199cd45ddf2bfd6800aad076", "score": "0.6282056", "text": "function getElement(id) {\n return document.getElementById(id);\n }", "title": "" }, { "docid": "9356826e7afe273b64007afe89c0ce27", "score": "0.6281036", "text": "function Node(id) {\n\t\t\t\t\tthis.id = id;\n\t\t\t\t\tthis.links = [];\n\t\t\t\t\tthis.data = null;\n\t\t\t\t}", "title": "" }, { "docid": "7cf802dc7200af5ed3fec04bb568c79a", "score": "0.6273578", "text": "function getElementById(element, id, level = 0) {\n log(element, level)\n // base case, we found the element!\n if (element.id === id) return element\n\n // iterate over element's children\n for (let i = 0; i < element.children.length; i++) {\n const child = element.children[i]\n // recursive loop\n const foundNode = getElementById(child, id, level + 1)\n // check if the recursive fn call returns what we're looking for\n if (foundNode) return foundNode\n }\n\n return null\n}", "title": "" }, { "docid": "9f8ffd66d564610b28426523fe367b5d", "score": "0.62625647", "text": "function getNodeId(node){\n\treturn node.node_id;\n}", "title": "" }, { "docid": "8d3dcafe3b4f1dd262b7468c68265b70", "score": "0.62589747", "text": "findNode(tabId){\r\n for(var i = 0; i<this.treeArray.length; ++i){\r\n if(this.treeArray[i].id == tabId){\r\n var find = this.treeArray[i];\r\n // break;\r\n }\r\n }\r\n return find;\r\n }", "title": "" }, { "docid": "32cc995ce925e8e74dccfa38bf171f81", "score": "0.62564725", "text": "function elByID(id){\n\treturn document.getElementById(id);\n}", "title": "" }, { "docid": "cef413b9a436f159fb519e0949cb1c47", "score": "0.62504315", "text": "function getJsonNetObjectById(parentObj, id) {\n // check if $id key exists.\n var objId = parentObj[\"$id\"];\n if (typeof (objId) !== \"undefined\" && objId != null && objId == id) {\n // $id key exists, and the id matches the id of interest, so you have the object... return it\n return parentObj;\n }\n for (var i in parentObj) {\n if (typeof (parentObj[i]) == \"object\" && parentObj[i] != null) {\n //going one step down in the object tree\n var result = getJsonNetObjectById(parentObj[i], id);\n if (result != null) {\n // return found object\n return result;\n }\n }\n }\n return null;\n }", "title": "" }, { "docid": "840aff422b28d1a65d0d156854c9c551", "score": "0.6242752", "text": "function get(id) {\n return document.getElementById(id);\n }", "title": "" }, { "docid": "14d9a45fe7e17babc203fc74b03ff9dd", "score": "0.6231295", "text": "function getVisNodeById(nodeId){\r\n let nodesDataset = visData.nodes._data;\r\n for(var key in nodesDataset){\r\n if(nodesDataset[key].id == nodeId){\r\n return nodesDataset[key];\r\n }\r\n }\r\n return null;\r\n}", "title": "" }, { "docid": "5a2c8c148ddcd3e7d8b160c2aaa0e6ec", "score": "0.6229317", "text": "function getId(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "5a2c8c148ddcd3e7d8b160c2aaa0e6ec", "score": "0.6229317", "text": "function getId(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "843179a97650f352e93f49473dbe39ea", "score": "0.6219289", "text": "function getById(id)\n{\n\treturn document.getElementById(id)\n}", "title": "" }, { "docid": "1b62d33ac220627615017a69b8d16772", "score": "0.62147593", "text": "function getNode ({ typeName, id }) {\n const node = api._app.store.getNode(typeName, id)\n delete node.$loki\n delete node.$uid\n return node\n }", "title": "" }, { "docid": "f766e5ed50ab453abbc3ef4a08ed5fc1", "score": "0.62139165", "text": "function EchoNode(id){\n\talert ('Node ' + id + ' Selected by user!');\n}", "title": "" }, { "docid": "5078bd99ff4d95f25596c6be752c70e4", "score": "0.62110764", "text": "function getNode(findID) {\n for (var i = nClickedNodes; i < nodes.length; i++) {\n if (nodes[i].id == findID) {\n return i;\n }\n }\n return null;\n}", "title": "" }, { "docid": "3248b52e6d33fff9affae1a62972a4f6", "score": "0.6209738", "text": "function getId(id) {\n\t\t\treturn document.getElementById(id);\n\t\t}", "title": "" }, { "docid": "901de744da8747a3e73212a90ae40059", "score": "0.6208196", "text": "function my_getbyid(id)\n{\n\titm = null;\n\t\n\tif (document.getElementById)\n\t{\n\t\titm = document.getElementById(id);\n\t}\n\telse if (document.all)\n\t{\n\t\titm = document.all[id];\n\t}\n\telse if (document.layers)\n\t{\n\t\titm = document.layers[id];\n\t}\n\t\n\treturn itm;\n}", "title": "" }, { "docid": "8dc91cff8ae5a3e6250680dfd53bc7b1", "score": "0.62078047", "text": "function id(id) {\r\n return document.getElementById(id);\r\n}", "title": "" }, { "docid": "2bb3b0ad4b1daca20711da44175c1bc9", "score": "0.62047786", "text": "getNodeWithId(mazeNodeId) {\n if (this.containsNodeWithId(mazeNodeId)) {\n return this.state.nodes[mazeNodeId];\n }\n return null;\n }", "title": "" }, { "docid": "59a494b393360c557f9008408da2fb54", "score": "0.62013924", "text": "function createNode(obj, node, id) {\n node.type = 'node';\n node.children = [];\n const nodeType = getNodeType(node);\n if (nodeType === 'normal' || nodeType === 'data') {\n obj[id] = node;\n }\n return obj;\n }", "title": "" }, { "docid": "202fc3ef631c8a1f597a9803fa7bc78d", "score": "0.6192735", "text": "function getById(id)\n{\n\treturn document.getElementById(id);\n}", "title": "" }, { "docid": "da025468f1d91b61b37288950d5acb8b", "score": "0.6192674", "text": "function getID(id){\n\treturn document.getElementById(id);\n}", "title": "" }, { "docid": "209c7523f09f9dcfb124a3b443aa613b", "score": "0.6191328", "text": "function getObjectForID(id) {\n for (let i = 0; i < specif.objects.length; i++)\n if (specif.objects[i].id === id) return specif.objects[i]\n }", "title": "" }, { "docid": "173fe59af88f5f2550fd88dc7fa76ca0", "score": "0.61857516", "text": "function Node(id) {\n this.id = id;\n this.links = null;\n this.data = null;\n}", "title": "" }, { "docid": "173fe59af88f5f2550fd88dc7fa76ca0", "score": "0.61857516", "text": "function Node(id) {\n this.id = id;\n this.links = null;\n this.data = null;\n}", "title": "" }, { "docid": "5c72a1b81777dda84ec56d297cea1d3e", "score": "0.6176045", "text": "function getObjectById(id){\n\tfor (var i=0; i<allObjects.length; i++){\n\t\tif(allObjects[i].id == id)\n\t\t\treturn allObjects[i];\n\t}\n\treturn null;\n}", "title": "" }, { "docid": "6a16d27595742862ebd79d9f52f164ec", "score": "0.61715287", "text": "function getDOMElementById(nodeid) {\n var node;\n if (document.getElementById) {\n node = document.getElementById(nodeid);\n } else if (document.all) {\n node = document.all[nodeid];\n } else {\n throw new Error(\"Finding dom nodes not supported; cannot run tests.\");\n }\n if (!node || node == null) {\n throw new Error(\"Unable to locate node with id \" + nodeid);\n }\n return node;\n}", "title": "" }, { "docid": "177483af51b9f66a0645b7a8ef3c3f79", "score": "0.61641055", "text": "function o(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "0272c1081c36b8db29e93fadc21cf1f2", "score": "0.61596406", "text": "function getElmnt2(x, id) {\n var i, l, y = x.getElementsByTagName(\"*\"), z = id.toUpperCase();\n l = y.length;\n for (i = 0; i < l; i++) {\n if (y[i].id.toUpperCase() === z) {return y[i]; }\n }\n }", "title": "" }, { "docid": "c4d3ec06c1301786b045bd28c140ff31", "score": "0.6146586", "text": "getNode( x, y ){\n\t\treturn this.listOfEntities.getObject( this.getNodePointer( x, y ));\n\t}", "title": "" }, { "docid": "da2632001c98f960197ce19cad3dd3a3", "score": "0.6146028", "text": "function GetDOMObject(nodeType, nodeID)\n{\n var targetList = GetDOMObjectList(nodeType);\n\n // Catch error case\n if(nodeID >= targetList.length || targetList == undefined)\n {\n ConsolePrint('ERROR: Node with id='+nodeID+' does not exist for type='+nodeType+'!');\n return undefined;\n }\n\n return targetList[nodeID];\n}", "title": "" }, { "docid": "80274a67fab0052de8e324e452c53537", "score": "0.61427504", "text": "function getNode(nodeName){\n return nodes[nodeName];\n}", "title": "" }, { "docid": "f764c84c3f85ed162b7d24e6bdcbf37a", "score": "0.61423886", "text": "function getid(id, callback){\n\tvar basic = document.getElementById(id);\t//obtain the base with all the general informations\n\t\n\tif(basic){\n\t\tbasic = basic.firstChild;\t//go to the first node\n\t\tbasic = basic.lastChild;\t//go to the last node (second <div>)\n\t\t\n\t\tfor(var i = 0; i < basic.childNodes.length; i++){\n\t\t\tif(basic.childNodes[i].title != null){\n\t\t\t\ttry{\n\t\t\t\t\tvar nodeval = basic.childNodes[i].firstChild.firstChild.firstChild.lastChild.firstChild; //get the node value\n\t\t\t\t\tvar title = basic.childNodes[i].title;\n\t\t\t\t\tcallback(title, nodeval);\n\t\t\t\t}catch(err){\n\t\t\t\t\tconsole.error(\"fb get by id error\" + basic.childNodes[i].title);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "798fb621e0cbf4bedb540094b1f5fcbb", "score": "0.6136685", "text": "getNode(nodeId) {\n return this.nodes[nodeId];\n }", "title": "" }, { "docid": "171108ba6928265ae5d7d05264ed78a2", "score": "0.6125413", "text": "function byId(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "171108ba6928265ae5d7d05264ed78a2", "score": "0.6125413", "text": "function byId(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "532a89e0c7b3c62ecc6a045c5a830875", "score": "0.61241716", "text": "function getElem(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "b3f009a4b18c3d983bd92bcc44e28a8b", "score": "0.6121966", "text": "function findDescendentById(thisNode, id)\n{\n if (!thisNode) {\n return false;\n }\n\n var childNode = thisNode.firstChild;\n while (childNode) {\n if (childNode.nodeType == 1) {\n if (childNode.getAttributeNS(null, 'id') == id) {\n return childNode;\n }\n }\n // recursively search descendent\n mychildNode = findDescendentById(childNode,id);\n if (mychildNode !== false)\n return mychildNode;\n childNode = childNode.nextSibling;\n }\n return false;\n}", "title": "" }, { "docid": "67ec9669fc460c1798a5383d6e992f1e", "score": "0.6118407", "text": "function findObj(id){\n for (x of users){\n if ((x[\"_id\"] + \"\") === id){\n return x;\n }\n }\n return \"\";\n}", "title": "" }, { "docid": "deab55bb6c9120d43ebe8c04b5822a06", "score": "0.61170524", "text": "function get_id() { return id; }", "title": "" }, { "docid": "deab55bb6c9120d43ebe8c04b5822a06", "score": "0.61170524", "text": "function get_id() { return id; }", "title": "" }, { "docid": "9388389c3f397bebc8486e3f50266e46", "score": "0.61167526", "text": "getEntryNodeWithParentsAndConfig(id) {\n\t\tconst currentNode = document.getElementById(id);\n\t\tconst parentElement = this._getParentElementFromChildElement(currentNode);\n\t\t// Get the main and view elements of the currentObj\n\t\tconst mainElement = this._getMainElementFromChildElement(currentNode);\n\t\tconst isMain = this.datasetIsMain(currentNode.dataset);\n\t\tconst viewElement = this._getViewElementFromChildElement(currentNode);\n\t\t// Get any possible rootCompiler\n\t\tconst currentRootCompilerElement = this._getRootCompilerElementFromChildElement(currentNode, this);\n\t\tconst isInnerCompiler = (currentRootCompilerElement && this.datasetIsCompiler(currentNode.dataset));\n\n\t\treturn {\n\t\t\tcurrentNode: currentNode,\n\t\t\tparent: parentElement,\n\t\t\tmain: mainElement,\n\t\t\tisMain: isMain,\n\t\t\tview: viewElement,\n\t\t\tisInnerCompiler: isInnerCompiler,\n\t\t\trootCompiler: currentRootCompilerElement,\n\t\t};\n\t}", "title": "" }, { "docid": "38491ecf7bea6f9430d9e56423849ce9", "score": "0.61140984", "text": "function CmsNodeFindByIdDB( iddb )\n{\n\tvar i ;\n\tfor( i=0 ; i<cmsnodes.length ; i++ )\n\t\t{\n\t\tif( iddb == cmsnodes[i].iddb ) return cmsnodes[i] ;\n\t\t}\n\treturn null ;\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "3e8b7fcecc2d3c6f226e865ac8c95f34", "score": "0.61050504", "text": "function id(id) {\n return document.getElementById(id);\n}", "title": "" }, { "docid": "a277cb313a4eeeeedf09b9792e2eee23", "score": "0.6103268", "text": "function getElement(id) {\n\n if (isElement(id)) {\n return id;\n }\n\n if (typeof id === 'string') {\n var element = document.getElementById(id);\n\n if (element) {\n return element;\n }\n\n if (document.querySelector) {\n return document.querySelector(id);\n }\n }\n}", "title": "" } ]
b4e268dd996bb47c4e90f3f447453d7e
Function to create map
[ { "docid": "a4b4b85bb1e3b7e56f6ea7c24ab9cd58", "score": "0.0", "text": "function createMap(earthquakes, plates) {\n\n // Define satellite, grayscale & outdoor layers\n var satellitemap = L.tileLayer(\"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/256/{z}/{x}/{y}?access_token={accessToken}\", {\n attribution: \"Map data &copy; <a href=\\\"https://www.openstreetmap.org/\\\">OpenStreetMap</a> Quan SHUANG, <a href=\\\"https://creativecommons.org/licenses/by-sa/2.0/\\\">CC-BY-SA</a>, Imagery © <a href=\\\"https://www.mapbox.com/\\\">Mapbox</a>\",\n maxZoom: 18,\n id: \"mapbox.satellite\",\n accessToken: API_KEY\n });\n\n var graymap = L.tileLayer(\"https://api.mapbox.com/styles/v1/mapbox/light-v9/tiles/256/{z}/{x}/{y}?access_token={accessToken}\", {\n attribution: \"Map data &copy; <a href=\\\"https://www.openstreetmap.org/\\\">OpenStreetMap</a> Quan SHUANG, <a href=\\\"https://creativecommons.org/licenses/by-sa/2.0/\\\">CC-BY-SA</a>, Imagery © <a href=\\\"https://www.mapbox.com/\\\">Mapbox</a>\",\n maxZoom: 18,\n id: \"mapbox.gray\",\n accessToken: API_KEY\n });\n\n var outdoormap = L.tileLayer(\"https://api.mapbox.com/styles/v1/mapbox/outdoors-v9/tiles/256/{z}/{x}/{y}?access_token={accessToken}\", {\n attribution: \"Map data &copy; <a href=\\\"https://www.openstreetmap.org/\\\">OpenStreetMap</a> Quan SHUANG, <a href=\\\"https://creativecommons.org/licenses/by-sa/2.0/\\\">CC-BY-SA</a>, Imagery © <a href=\\\"https://www.mapbox.com/\\\">Mapbox</a>\",\n maxZoom: 18,\n id: \"mapbox.outdoor\",\n accessToken: API_KEY\n });\n\n // Define baseMaps object to hold our base layers\n var baseMaps = {\n \"Satellite\": satellitemap,\n \"Grayscale\": graymap,\n \"Outdoors\": outdoormap\n };\n\n // Create overlayMaps object to hold our overlay map layer\n var overlayMaps = {\n \"Earthquakes\": earthquakes,\n \"Fault Lines\": plates\n };\n\n // Create our map, giving it the satellitemap, earthquakes & plates layers to display on load\n var myMap = L.map(\"map\", {\n center: [43.6529, -79.3849],\n zoom: 2.5,\n layers: [satellitemap, earthquakes, plates]\n });\n\n // Create a layer control to enable toggle among our baseMaps and overlayMaps\n // Add the layer control to the map\n L.control.layers(baseMaps, overlayMaps, {\n collapsed: false\n }).addTo(myMap);\n\n\n // Adding legend\n var legend = L.control({position: 'bottomright'});\n\n legend.onAdd = function (map) {\n\n var div = L.DomUtil.create('div', 'info legend'),\n grades = [0, 1, 2, 3, 4, 5, 6],\n labels = [];\n\n // loop through magnitude intervals and generate a label with a colored square for each interval\n for (var i = 0; i < grades.length; i++) {\n div.innerHTML +=\n '<i style=\"background:' + getColor(grades[i] + 1) + '\"></i> ' +\n grades[i] + (grades[i + 1] ? '&ndash;' + grades[i + 1] + '<br>' : '+');\n }\n\n return div;\n };\n\n legend.addTo(myMap);\n}", "title": "" } ]
[ { "docid": "72ea66759c12e50be94f5d9b0d95d668", "score": "0.7679828", "text": "function createMap(){return new ts.Map();}", "title": "" }, { "docid": "9b9fb323738ffc92f34be6ac007da6e1", "score": "0.7195664", "text": "function mapCreator(keys, values) {\n let map_object = new Map();\n let iterator = 0;\n for (let value of values) {\n\n\n if (typeof value == \"string\") {\n map_object.set(keys[iterator], value)\n }\n iterator++\n\n\n }\n\n\n return map_object\n}", "title": "" }, { "docid": "d1a2b1fdbae469c5d17855c23d0ec165", "score": "0.6921585", "text": "function createUnderscoreEscapedMap(){return new ts.Map();}", "title": "" }, { "docid": "eef719881be650b5a9af2c283b3b936e", "score": "0.6837675", "text": "function Map() {}", "title": "" }, { "docid": "6b1feb19694a171c483ae1c0ac14b3d2", "score": "0.6789083", "text": "function Map(){}", "title": "" }, { "docid": "8e371efa6622d9ca4b3523ffdfd69f3b", "score": "0.678482", "text": "function Map () {}", "title": "" }, { "docid": "7a9be73adaa90b94340bbc6cf605db9f", "score": "0.6758677", "text": "function createMap() {\n return new Blank();\n}", "title": "" }, { "docid": "f3ba061d6e13e11e45c99afe46ff3dd2", "score": "0.67264736", "text": "function createMapFromEntries(entries){var map=createMap();for(var _i=0,entries_1=entries;_i<entries_1.length;_i++){var _a=entries_1[_i],key=_a[0],value=_a[1];map.set(key,value);}return map;}", "title": "" }, { "docid": "c64a05406888630d54652dc7740bc042", "score": "0.67108434", "text": "function generateBoxesMap(listOfBoxes) {\n\tvar map = new Map();\n\tvar index;\n\n\n\tfor (index = 0; index < listOfBoxes.length; index += 1) {\n\t\tmap.set(listOfBoxes[index], listOfBoxes[index].material);\n\t}\n\n\n\tconsole.log(map);\n\tconsole.log(map.get(listOfBoxes[index - 1]).name);\n\n\treturn map;\n}", "title": "" }, { "docid": "90733abbcee57b2e8bbf77af37aa007f", "score": "0.66645765", "text": "function createMaps(map) {\n //This is used to convert the world map arrays from numbers, to effectively pointers to other arrays\n var mapRows = map.length;\n var mapColumns = map[0].length;\n var currentType;\n for (var rows = 0; rows < mapRows; rows++) {\n for (var columns = 0; columns < mapColumns; columns++) {\n currentType = map[rows][columns];\n switch (currentType) {\n case EMPTY:\n //Create map object\n var object = Object.create(mapObject);\n //Set the id for the object\n object.id = EMPTY;\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n\n case SETTLEMENT_MAP:\n //Create map object\n var object = Object.create(mapObject);\n object.mapArray = [\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 94, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72]\n ];\n object.objectArray = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 10, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n object.inside = false;\n //Set the id for the object\n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n\n if (!gameStarted) {\n playerRow = rows;\n playerColumn = columns;\n curMap = map[rows][columns];\n };\n\n break;\n case WASTE_1:\n //Create map object\n var object = Object.create(mapObject);\n object.mapArray = [\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 54, 53, 72, 72, 72, 72, 72, 72],\n [72, 72, 43, 62, 72, 72, 72, 72, 72, 72],\n [72, 72, 52, 51, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72]\n ];\n object.objectArray= [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 20, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n\n object.inside = false;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n case WASTE_2:\n //Create map object\n var object = Object.create(mapObject);\n object.mapArray = [\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72]\n ];\n object.objectArray = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 20, 0, 0, 0, 20, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 20, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],];\n object.inside = false;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n case WASTE_3:\n //Create map object\n var object = Object.create(mapObject);\n object.mapArray = [\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 74, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 74, 72, 72, 72, 72, 72],\n [72, 72, 73, 73, 78, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 74, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 74, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 74, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72],\n [72, 72, 72, 72, 72, 72, 72, 72, 72, 72]\n ];\n object.objectArray = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 31, 0, 0, 0],\n [0, 0, 20, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 31, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 35, 0, 0],\n [0, 0, 0, 0, 20, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ];\n object.inside = false;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n case BUILDING:\n //Create map object\n var object = Object.create(mapObject);\n\n object.innerMap = [\n [0, 0, 0],\n [0, 22, 0],\n [0, 23, 0],\n [0, 0, 0],\n ];\n\n createMaps(object.innerMap);\n \n object.inside = true;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n\n case BUILDING_ENTRANCE_1:\n //Create map object\n var object = Object.create(mapObject);\n object.mapArray = [\n [79, 79, 79, 79, 64, 79, 79, 79, 79, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 79, 79, 79, 71, 71, 79, 79, 79, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 79, 71, 71, 71, 71, 71, 71, 79, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79]\n ];\n object.objectArray = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 20, 0, 0, 0, 0, 0, 0, 20, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n\n object.inside = true;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n\n case BUILDING_1:\n var object = Object.create(mapObject);\n object.mapArray = [\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 79, 79, 71, 71, 71, 71, 79, 79, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 71, 71, 71, 71, 71, 71, 71, 71, 79],\n [79, 79, 79, 79, 79, 79, 79, 79, 79, 79]\n ];\n object.objectArray = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 33, 34, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n object.inside = true;\n //Set the id for the object \n object.id = map[rows][columns];\n //Then replace that position in the map array with effectively a reference to that object\n map[rows][columns] = object;\n break;\n };\n };\n };\n }", "title": "" }, { "docid": "9996c188aba489c952bc390396184644", "score": "0.66586465", "text": "function createMapFromTemplate(template){var map=new ts.Map();// Copies keys/values from template. Note that for..in will not throw if\n// template is undefined, and instead will just exit the loop.\nfor(var key in template){if(hasOwnProperty.call(template,key)){map.set(key,template[key]);}}return map;}", "title": "" }, { "docid": "2b3f4cf2b2e1b14412ac961be5e760ca", "score": "0.66522133", "text": "function genMap() {\n mazeMap = new Array(height);\n for (y = 0; y < height; y++) {\n mazeMap[y] = new Array(width);\n for (x = 0; x < width; ++x) {\n mazeMap[y][x] = {\n n: false,\n s: false,\n e: false,\n w: false,\n visited: false,\n priorPos: null\n };\n }\n }\n }", "title": "" }, { "docid": "b9c3b811c68b22a3340db65d4b45c1cd", "score": "0.66163963", "text": "function createMap(rows, cols, initial) {\n var matrix = [];\n for (var x = 0; x < rows; x++) {\n var columns = []\n for (var y = 0; y < cols; y++) {\n columns[y] = \"[\" + x + \",\" + y + \"]\";\n }\n matrix[x] = columns;\n }\n return matrix;\n}", "title": "" }, { "docid": "c32b35b61b31485b4519e5d7df752d42", "score": "0.6596335", "text": "function makeMapWith(mapHelpers, mapTemplate) {\n const getFuncBody = (fct) => {\n const entire = fct.toString();\n return entire.substring(entire.indexOf('{') + 1, entire.lastIndexOf('}'));\n };\n return new Function(\n [getFuncBody(mapHelpers), getFuncBody(mapTemplate)].join('\\n'),\n );\n}", "title": "" }, { "docid": "6e43451279b659b4b85afad596c47ad1", "score": "0.6592249", "text": "function genMap() \r\n {\r\n mazeMap = new Array(height);\r\n for (y = 0; y < height; y++) \r\n {\r\n mazeMap[y] = new Array(width);\r\n for (x = 0; x < width; ++x) \r\n {\r\n mazeMap[y][x] = {\r\n n: false,\r\n s: false,\r\n e: false,\r\n w: false,\r\n visited: false,\r\n priorPos: null\r\n };\r\n }\r\n }\r\n }", "title": "" }, { "docid": "1075f8033ebec41524342731900e62af", "score": "0.65804785", "text": "function makeMap(start, w, h) {\n var ix, jx, data;\n\n for (ix = 0; ix < h; ix++) {\n map[ix] = [];\n mark[ix] = [];\n\n data = input[start + ix].trim().split(' ');\n\n for (jx = 0; jx < w; jx++) {\n map[ix][jx] = +data[jx];\n mark[ix][jx] = 0;\n }\n }\n}", "title": "" }, { "docid": "c9831e39c47c745876699620a126e234", "score": "0.65765613", "text": "function myMap(array) {\n}", "title": "" }, { "docid": "f6123d9a83f3986e9f62bf758954139f", "score": "0.65624154", "text": "function populateMapWithObstructions() {\n for (const obstruction of obstructions) {\n var x = obstruction[0];\n var y = obstruction[1];\n\n map[x][y] = \"x\";\n }\n}", "title": "" }, { "docid": "f8e43cfdd84ee650870ee10581ca1949", "score": "0.6525986", "text": "function NewSubMap() {\n const m = {};\n return m;\n }", "title": "" }, { "docid": "8c4c2bdd65292e05fc2cd8e6a1636394", "score": "0.6489037", "text": "function CoordMapType() {}", "title": "" }, { "docid": "7b5de056064cb6331e08b4efa78e107a", "score": "0.64872104", "text": "function newEntryMap() {\n const m = {};\n return m;\n }", "title": "" }, { "docid": "0850b4db3e213838a07df8233ccd1885", "score": "0.64704335", "text": "function make_map ()\n {\n return (wait_for_map ().then (wait_for_map_loaded).then (domap));\n }", "title": "" }, { "docid": "802d60c5e896f0d338b7808068270534", "score": "0.64068437", "text": "function newMap(width, height) {\n const map = [];\n\n const horizontalBorder = [[true, true]];\n for (let i = 1; i < width-1; i++) {\n horizontalBorder.push([true, false]);\n }\n horizontalBorder.push([true, true]);\n\n map.push(horizontalBorder);\n\n for (let i = 1; i < height-1; i++) {\n const row = [[false, true]];\n for (let j = 1; j < width-1; j++) {\n row.push([Math.random() < 0.125, Math.random() < 0.125]);\n }\n row.push([false, true]);\n map.push(row);\n }\n\n map.push(horizontalBorder);\n\n return map;\n}", "title": "" }, { "docid": "4b90f838ce134a5b6859a40773d7e8fe", "score": "0.63943017", "text": "function initMap() {\n createRoscoesMap();\n createOhMap();\n createGreenEggsMap();\n createBirrieriaMap();\n createNandosMap();\n createMisoyaMap();\n}", "title": "" }, { "docid": "c955f31d0e371eae44cf9c8c37181acd", "score": "0.6379028", "text": "function createMap(value) {\n const hasLength = hasOwnProperty(value, \"length\");\n const length = value.length;\n\n if (hasLength) {\n value.length = `${value.length}`;\n }\n\n let map = I.Seq(value).map(fromJS).toMap();\n\n if (hasLength) {\n map = map.set(\"length\", length);\n value.length = length;\n }\n\n return map;\n}", "title": "" }, { "docid": "8952d206c0fe712914d41773f16c4e5b", "score": "0.63710517", "text": "function createLookupMap(map) {\n let output = {}\n Object.entries(map).forEach(([replacementTag, array]) => {\n array.forEach(customTag => {\n output[customTag] = replacementTag\n })\n })\n return output\n}", "title": "" }, { "docid": "a9153f4e7740c8e6c24a4b4a56e268b4", "score": "0.63556665", "text": "function customBuild(map) {\n\n}", "title": "" }, { "docid": "f326bccb300150193bd266ea11f663f7", "score": "0.63410753", "text": "function copyMap(map) {\n var newMap = new Map();\n \n newMap.set('bools', []);\n newMap.set('floats', []);\n newMap.set('ints', []);\n newMap.set('strings', []);\n newMap.set('lists', []);\n\n for(var i = 0; i < map.get('bools').length; i++) {\n var newVar = newVariable(map.get('bools')[i].name, 'bool', map.get('bools')[i].value);\n newMap.get('bools').push(newVar);\n }\n for(var i = 0; i < map.get('floats').length; i++) {\n var newVar = newVariable(map.get('floats')[i].name, 'float', map.get('floats')[i].value);\n newMap.get('floats').push(newVar);\n }\n for(var i = 0; i < map.get('ints').length; i++) {\n var newVar = newVariable(map.get('ints')[i].name, 'int', map.get('ints')[i].value);\n newMap.get('ints').push(newVar);\n }\n for(var i = 0; i < map.get('strings').length; i++) {\n var newVar = newVariable(map.get('strings')[i].name, 'str', map.get('strings')[i].value);\n newMap.get('strings').push(newVar);\n }\n\n return newMap;\n}", "title": "" }, { "docid": "02b19baa6afcdfa1319203278769dcce", "score": "0.63029915", "text": "function createMap(numCourses, prerequisites) {\n var map = {};\n \n for (var i = 0; i < numCourses; i++) {\n map[i] = [];\n }\n \n for (var p of prerequisites) {\n map[p[0]].push(p[1]);\n }\n \n return map;\n}", "title": "" }, { "docid": "795f68121c8524849c48352aa5ad1e4a", "score": "0.6293185", "text": "function genTripMap(trips) {\n\n var tripMap = { /*\n station_in: {\n station_out_1: n trips,\n station_out_2: m trips,\n ...: ...,\n name: station_name_in,\n lat: lat_in,\n lng: lng_in\n }\n */};\n\n trips.forEach(function (trip) {\n let station_in = trip.station_in;\n let station_out = trip.station_out;\n\n // Station details for easy access from frontend.\n if (!tripMap[station_in]) {\n tripMap[station_in] = {\n name: trip.station_name_in,\n lat: trip.lat_in,\n lng: trip.lng_in\n }\n }\n\n // Increment trip count between stations,\n // And make sure to init to 0 correctly.\n var tripsFromInToOut = tripMap[station_in][station_out] || 0;\n tripMap[station_in][station_out] = tripsFromInToOut + 1;\n });\n\n return tripMap;\n}", "title": "" }, { "docid": "f2add1c70cfef7aea55cb3d5f3b6c0c7", "score": "0.62856495", "text": "function Map() {\n\t\n}", "title": "" }, { "docid": "e35059fee09c1f8f7222e334a89d90f9", "score": "0.6283556", "text": "function createMap(width, height) {\n var map= [];\n for (var i = 0 ; i < width; i++) {\n map[i] = [];\n for (var j = 0; j < height; j++) {\n map[i][j] = EMPTY;\n }\n }\n return map;\n}", "title": "" }, { "docid": "10c52e1a1b3ccf88044ed3e0acdbb369", "score": "0.6282649", "text": "function createMap() {\n // tslint:disable-next-line:no-any\n return new Blank();\n}", "title": "" }, { "docid": "064cb470bd145b43d494c296e0d283f8", "score": "0.6280455", "text": "function MyMap(arr,func){\n var Map=[]\n for(var i=0;i<arr.length;i++){\n Map.push(func(arr[i]));\n }\n return Map;\n}", "title": "" }, { "docid": "f853d5d6d2024c9088c4a509bf2a4e56", "score": "0.6266173", "text": "generateDefaultMap() {\n let hexMap = this;\n let map = Array.apply(null, { length: hexMap.width }).map(\n Number.call,\n Number\n );\n map.forEach(function(element) {\n map[element] = Array.apply(null, { length: hexMap.length }).map(\n Number.call,\n function() {\n return 0;\n }\n );\n });\n console.log(map);\n return map;\n }", "title": "" }, { "docid": "aac37798c2e2633af3566949ed9d7aee", "score": "0.6239461", "text": "function makeMap(str,expectsLowerCase){var map=(0,_create4.default)(null);var list=str.split(',');for(var i=0;i<list.length;i++){map[list[i]]=true;}return expectsLowerCase?function(val){return map[val.toLowerCase()];}:function(val){return map[val];};}", "title": "" }, { "docid": "c3b42781774b7e03e71f05dc723990b9", "score": "0.6221738", "text": "createMap() {\n const map = this.make.tilemap({key: 'map1'});\n map.addTilesetImage('rpl_grass', 'tilesGrass', 32, 32);\n map.addTilesetImage('rpl_sand','tilesSand', 32, 32);\n map.addTilesetImage('rpl_paths-export', 'tilesPaths', 32, 32);\n \n return map;\n }", "title": "" }, { "docid": "aeafee87d2fa413600efd7e153235499", "score": "0.61613154", "text": "static map(keyType, valueType) {\n if (!keyType.isPrimitive) {\n throw new Error(`the key type of a 'map' must be a primitive, but was ${keyType.inputString}`);\n }\n return {\n isPrimitive: false,\n inputString: `map<${keyType.inputString},${valueType.inputString}>`\n };\n }", "title": "" }, { "docid": "d13fd6b6e91ca368d1769ba4deda1900", "score": "0.61559343", "text": "EncodedMap() {\n return {\n charOne: { 0: 3, 1: 7, 2: 11, 3: 15, 4: 19, 5: 23, 6: 27, 7: 31 },\n charTwo: { 0: 2, 1: 6, 2: 10, 3: 14, 4: 18, 5: 22, 6: 26, 7: 30 },\n charThree: { 0: 1, 1: 5, 2: 9, 3: 13, 4: 17, 5: 21, 6: 25, 7: 29 },\n charFour: { 0: 0, 1: 4, 2: 8, 3: 12, 4: 16, 5: 20, 6: 24, 7: 28 },\n };\n }", "title": "" }, { "docid": "8c85faadbecab7da216940b3ab494ec0", "score": "0.61529267", "text": "mapGenerate() {\n for (let i = 0; i < this.ySize; i++) {\n this.map[i] = [];\n for (let j = 0; j < this.xSize; j++) {\n let mapValue = this.empty;\n this.map[i].push(mapValue);\n }\n }\n }", "title": "" }, { "docid": "4e10b4331db53f224ac19d207901f9d6", "score": "0.61318934", "text": "function createCharToJamoMap(jamoList) {\n var charToJamoMap = new Map();\n for (let jamoVal of jamoList) {\n charToJamoMap.set(jamoVal.letter, jamoVal);\n }\n return charToJamoMap;\n}", "title": "" }, { "docid": "f97985e17b15cfb0e85cbd819a52c826", "score": "0.61318505", "text": "function Map()\n{\n map = [];\n for (var i = 0; i < 3; ++i) {\n row = [];\n for (var j = 0; j < 3; ++j)\n row.push(Chess.EMPTY);\n map.push(row);\n }\n return map;\n}", "title": "" }, { "docid": "b2a099d48e974e068c111946dad45335", "score": "0.61310816", "text": "function mapAB(map) {\n\n if (map[\"a\"] && map[\"b\"]) {\n var ab = map[\"a\"] + map[\"b\"];\n map = {\"a\": map[\"a\"], \"b\": map[\"b\"], \"ab\": ab};\n }\n return map;\n}", "title": "" }, { "docid": "875f9474b56be88976662d62abde2598", "score": "0.61267126", "text": "function InstantiatableMap() {\n\t\tthis.container= {};\n\t\tthis.keyArray=null;\n\t\tthis.sizeValue=0;\n\t}", "title": "" }, { "docid": "47611c30805f5e1222927f9fbb8816fa", "score": "0.612342", "text": "function createEmptyMap() {\n return new Map();\n}", "title": "" }, { "docid": "efea9e08ecd3fe1a667f5b4c4518e909", "score": "0.6119141", "text": "function makeMap(name, relName) {\r var prefix, plugin,\r index = name.indexOf('!');\r\r if (index !== -1) {\r prefix = normalize(name.slice(0, index), relName);\r name = name.slice(index + 1);\r plugin = defined[prefix];\r\r //Normalize according\r if (plugin && plugin.normalize) {\r name = plugin.normalize(name, makeNormalize(relName));\r } else {\r name = normalize(name, relName);\r }\r } else {\r name = normalize(name, relName);\r }\r\r //Using ridiculous property names for space reasons\r return {\r f: prefix ? prefix + '!' + name : name, //fullName\r n: name,\r p: plugin\r };\r }", "title": "" }, { "docid": "4a9015322fe69020aecac3262b06a4ae", "score": "0.61144793", "text": "function convert2map (inputArray) {\n let m = new Map();\n for (let e of inputArray) {\n m.set(e.key, e.value);\n }\n return m;\n}", "title": "" }, { "docid": "c6b4fe00d14a52f834c900886571d750", "score": "0.6104774", "text": "function createMap(array, n1, n2) {\n for (let i = 0; i < n1; i++) {\n array.push([]);\n for (let j = 0; j < n2; j++) {\n array[i].push(0);\n let cell = document.createElement('div');\n grid.appendChild(cell);\n cell.classList.add(\"cell\", \"cell-back\");\n cell.setAttribute(`X`, `${i}`);\n cell.setAttribute(`Y`, `${j}`);\n };\n };\n}", "title": "" }, { "docid": "4516b883c73ea5927a1f1be42b5786eb", "score": "0.60931087", "text": "function makeMap(str) {\n var obj = {}, items = str.split(\",\");\n for (var i = 0; i < items.length; i++) {\n obj[items[i]] = true;\n }\n return obj;\n }", "title": "" }, { "docid": "47fcda4c104b547e3d2241f313b5b8f7", "score": "0.6089227", "text": "function createMap(words) {\n\n const dict = new Map();\n\n for (let word of words) {\n dict[reverseWord(word)] = word;\n }\n return dict;\n}", "title": "" }, { "docid": "f7ff82a2911b6e314b6ebcbfc458d094", "score": "0.6085452", "text": "function buildNewMapping() {\n\t\tif(!fullyLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\t// //$log.log(preDebugMsg + \"buildNewMapping()\");\n\n\t\tvar mapping = {};\n\t\tmapping.plugins = [];\n\n\t\tfor(var p = 0; p < listOfPlugins.length; p++) {\n\t\t\tvar plugin = listOfPlugins[p];\n\t\t\tvar pMapping = {};\n\n\t\t\tmapping.plugins.push(pMapping);\n\t\t\tpMapping.name = plugin.name;\n\t\t\tpMapping.grouping = plugin.grouping;\n\t\t\tpMapping.sets = [];\n\n\t\t\tfor(var is = 0; is < plugin.format.length; is++) {\n\t\t\t\tvar inputSet = plugin.format[is].fields;\n\t\t\t\tvar setMapping = {};\n\t\t\t\tpMapping.sets.push(setMapping);\n\t\t\t\tsetMapping.fields = [];\n\n\t\t\t\tfor(var f = 0; f < inputSet.length; f++) {\n\t\t\t\t\tvar inputField = inputSet[f];\n\t\t\t\t\tvar fMapping = {};\n\t\t\t\t\tsetMapping.fields.push(fMapping);\n\t\t\t\t\tfMapping.name = inputField.name;\n\t\t\t\t\tfMapping.assigned = [];\n\t\t\t\t\tfMapping.template = inputField.template;\n\t\t\t\t\tfMapping.added = inputField.added;\n\n\t\t\t\t\tfor(var a in inputField.assigned) {\n\t\t\t\t\t\tif(inputField.assigned.hasOwnProperty(a)) {\n\t\t\t\t\t\t\tvar aMap = {};\n\t\t\t\t\t\t\tvar dsID = inputField.assigned[a][0].toString();\n\n\t\t\t\t\t\t\tif(mapDataSourceIdToIdx.hasOwnProperty(dsID)) {\n\t\t\t\t\t\t\t\tvar ds = mapDataSourceIdToIdx[dsID];\n\t\t\t\t\t\t\t\tif(ds < listOfDataSources.length && inputField.assigned[a][1] < listOfDataSources[ds].dataSets.length && inputField.assigned[a][2] < listOfDataSources[ds].dataSets[inputField.assigned[a][1]].fields.length) {\n\t\t\t\t\t\t\t\t\taMap.sourceName = listOfDataSources[ds].name;\n\t\t\t\t\t\t\t\t\taMap.dataSetName = listOfDataSources[ds].dataSets[inputField.assigned[a][1]].name;\n\t\t\t\t\t\t\t\t\taMap.dataSetIdx = inputField.assigned[a][1];\n\t\t\t\t\t\t\t\t\taMap.fieldName = listOfDataSources[ds].dataSets[inputField.assigned[a][1]].fields[inputField.assigned[a][2]].name;\n\t\t\t\t\t\t\t\t\tfMapping.assigned.push(aMap);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar oldMapping = $scope.gimme(\"Mapping\");\n\t\tif(JSON.stringify(oldMapping) != JSON.stringify(mapping)) {\n\t\t\t// //$log.log(preDebugMsg + \"BuildMapping new mapping:\" + JSON.stringify(mapping));\n\t\t\t// //$log.log(preDebugMsg + \"BuildMapping old mapping:\" + JSON.stringify(oldMapping));\n\t\t\tinternalMappingSetTo = mapping;\n\t\t\t$scope.set(\"Mapping\", mapping);\n\t\t}\n\t}", "title": "" }, { "docid": "4e95a360488ffeda80928629fe5e1e5f", "score": "0.60656613", "text": "function ParamMap() {}", "title": "" }, { "docid": "927d90ebf1ef00a7b6ac2373c222cd80", "score": "0.60488075", "text": "function b(){\r\n var c= new Map ([[22,1],[2,40],[1,3]]);\r\n //console.log(Array.from(c.values()));\r\n //console.log(Array.from(c.keys()));\r\n}", "title": "" }, { "docid": "912bd4b84be04e60b2ad4e626e5b3d38", "score": "0.6047799", "text": "function createMap(){\r\n\t\tvar mapOptions = {\r\n\t\t\tcenter: new google.maps.LatLng(_config.map.initialLatitude, _config.map.initialLongitude),\r\n\t\t\tzoom: 8,\r\n\t\t\tmaptypeId: google.maps.MapTypeId.ROADMAP\r\n\t\t}\r\n\t\tvar mapContainer = $('#map-container')[0];\r\n\t\tvar map = new google.maps.Map(mapContainer, mapOptions);\r\n\t\t/* Determinar cual capa mostrar segun el tipo de mapa */\r\n\t\tvar mapId = parseInt($(mapContainer).attr('map-type'));\r\n\t\t$.each(mapsLayer, function(index, value){\r\n\t\t\tif(value.id == mapId){\r\n\t\t\t\t$.each(value.layer, function(i, v){\r\n\t\t\t\t\tnew google.maps.KmlLayer(v).setMap(map);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t}", "title": "" }, { "docid": "fe42231b620b2dd77a3b7ebe852a68de", "score": "0.6041574", "text": "function makeMap() {\n //console.log('mm')\n var m = [0, 0, 0, 0, 0, 0, 0, 0, 0]\n // row scan\n for (c = 0; c < cols; c++) {\n nCell++\n if (grid[row][c].t != 'u') {\n m[grid[row][c].v] = 1\n //console.log('c',grid[row][c].v)\n }\n }\n // col scan\n for (r = 0; r < rows; r++) {\n nCell++\n if (grid[r][col].t != 'u')\n m[grid[r][col].v] = 1\n }\n // sector scan\n var cl = 3 * Math.floor(col / 3)\n var rl = 3 * Math.floor(row / 3)\n for (r = rl; r < rl + 3; r++) {\n if (r == row) continue // our row already done above\n for (c = cl; c < cl + 3; c++) {\n if (c == col) continue // col already\n nCell++\n if (grid[r][c].t != 'u')\n m[grid[r][c].v] = 1\n }\n }\n //console.log('mm', m)\n return m\n}", "title": "" }, { "docid": "7a2906b190e7f742cfe2e50dc8bb454e", "score": "0.6038791", "text": "function create_map(container,sysmapid,id){\n\tif(typeof(id) == 'undefined'){\n\t\tvar id = ZBX_SYSMAPS.length;\n\t}\n\n\tif(is_number(sysmapid) && (sysmapid > 100000000000000)){\n\t\tthrow('Error: Wrong type of arguments passed to function [create_map]');\n\t}\n\n\n\tZBX_SYSMAPS[id] = new Object;\n\tZBX_SYSMAPS[id].map = new Cmap(container,sysmapid,id);\n}", "title": "" }, { "docid": "41194599825b77c3de3cf608ed54c65f", "score": "0.6037032", "text": "function create_empty_map(filename, source, lines) {\n return {\n version: 3,\n sources: [ filename ],\n sourcesContent: [ source ],\n mappings: 'AAAA;' + 'AACA;'.repeat(lines - 1)\n };\n}", "title": "" }, { "docid": "8cb307c8aec3a25ac40444f1dd3fda60", "score": "0.6027988", "text": "function getMapping(counter){\n\tlet dataSet\t=\t[];\n\t for(let i=2; i<=Object.keys(counter).length+1; i++){\n\t\t let row\t=\t{};\n\t\t row[\"from\"]=\t1;\n\t\t row[\"to\"]\t=\ti;\t\n\t\t dataSet.push(row);\t\n\t }\n\treturn dataSet;\n}", "title": "" }, { "docid": "221f5442a4aa7f3ce59f89b1418f74bb", "score": "0.6025393", "text": "function ParamMap() { }", "title": "" }, { "docid": "221f5442a4aa7f3ce59f89b1418f74bb", "score": "0.6025393", "text": "function ParamMap() { }", "title": "" }, { "docid": "0df3c413720a022a3726a1672038fc92", "score": "0.6014024", "text": "static create(aInput = null, aMapFunction = null, aOutputName = null) {\n\t\tlet newMapArray = new MapArray();\n\t\t\n\t\tnewMapArray.setInputWithoutNull(\"input\", aInput);\n\t\tnewMapArray.setInputWithoutNull(\"mapFunction\", aMapFunction);\n\t\tnewMapArray.setInputWithoutNull(\"outputName\", aOutputName);\n\t\t\n\t\treturn newMapArray;\n\t}", "title": "" }, { "docid": "5f3f000641ac63ff5ccfdf2449057633", "score": "0.60129464", "text": "function createVariableMapping(){\n\thashMap = new HashTable();\n\thashMap.setItem('connectivity', 'Long-range connectivity');\n\t// zunaechst erstmal fuer a und b die gleiche Ueberschrift gewaehlt\n\thashMap.setItem('coupling_parameters_option_Linear_a', 'Long-range coupling function');\n\thashMap.setItem('coupling_parameters_option_Linear_b', 'Long-range coupling function');\n\t\n\thashMap.setItem('conduction_speed', 'Conduction Speed');\n\thashMap.setItem('surface', 'Cortical Surface');\n\thashMap.setItem('stimulus', 'Spatiotemporal stimulus');\n\thashMap.setItem('model', 'Local dynamic model');\n\t\n\t// zunaechst fuer V und W nur die Uebrschrift highlighten\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_state_variable_range_parameters_V', 'State Variable ranges [lo, hi]');\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_state_variable_range_parameters_W', 'State Variable ranges [lo, hi]');\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_variables_of_interest', 'Variables watched by Monitors');\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_noise', 'Initial Conditions Noise');\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_noise_parameters_option_Noise_random_stream', 'Random Stream');\n\thashMap.setItem('model_parameters_option_Generic2dOscillator_noise_parameters_option_Noise_random_stream_parameters_option_RandomStream_init_seed', 'A random seed');\n\thashMap.setItem('integrator', 'Integration scheme');\n\thashMap.setItem('monitors', 'Monitor(s)');\n\thashMap.setItem('simulation_length', 'Simulation Length (ms)');\n\t// hashMap.setItem('surface', 'Surface');\n\t// hashMap.setItem('surface', 'Surface');\n\t// hashMap.setItem('surface', 'Surface');\n\t// hashMap.setItem('surface', 'Surface');\n\t// hashMap.setItem('surface', 'Surface');\t\n}", "title": "" }, { "docid": "d30d872fb86d09fbc4b83bf35c1330e3", "score": "0.5990909", "text": "function makeMap(){ \n for(var i = 0; i < rows; i++){\n map.push([])\n for(var j = 0; j < columns; j++){\n var ind = i*columns+j;\n var point = 0;\n \n if(blocks.children[ind].alive > 0) point = 1;\n \n map[i].push(point)\n }\n }\n}", "title": "" }, { "docid": "06162f99e8e440c0baa7738cd248dcbd", "score": "0.5989527", "text": "function initMap() {\r\n var i;\r\n var j;\r\n for (i = 0; i < map.length; i++) {\r\n map[i] = 0;\r\n }\r\n for (i = 0; i < 6; i++) {\r\n map[i] = 1;\r\n map[i * 6] = 1;\r\n }\r\n // put values in map[]\r\n for (i = 0; i < 4; i++) {\r\n for (j = 0; j < 4; j++) {\r\n map[7 + i * 6 + j] = (i * 4 + j + 1) & 15;\r\n }\r\n }\r\n // tileMap maps row-column codes \"11\", \"12\", \"13\", ... to array indexes 0, 1, 2 ...\r\n if (tileMap.length < 6) {\r\n tileMap.splice(0, 0, \"11\", \"12\", \"13\", \"14\", \"21\", \"22\", \"23\", \"24\", \"31\", \"32\", \"33\", \"34\", \"41\", \"42\", \"43\", \"44\");\r\n }\r\n}", "title": "" }, { "docid": "4b55c54cb1b2347b727de3522c39c5aa", "score": "0.5988659", "text": "generateLevelMap(mapSeed) {\n\t\t\treturn {\n\t\t\t\tcells: [],\n\t\t\t\tentry: {\n\t\t\t\t\tx: undefined,\n\t\t\t\t\ty: undefined\n\t\t\t\t}\n\t\t\t};\n\t\t}", "title": "" }, { "docid": "f771e9e8e8b0bd5310cd87afdcd61fcc", "score": "0.59747434", "text": "makeMapTileSet(game, mapKey, mapTileSetRef, tileKey) {\n let map = game.make.tilemap({ key: mapKey });\n let tiles = map.addTilesetImage(mapTileSetRef, tileKey);\n return {'map': map, 'tiles': tiles};\n }", "title": "" }, { "docid": "bae43788c08e4b11e682cf124678ede5", "score": "0.5960047", "text": "function makeMap(str,expectsLowerCase){var map=Object.create(null);var list=str.split(',');for(var i=0;i<list.length;i++){map[list[i]]=true;}return expectsLowerCase?function(val){return map[val.toLowerCase()];}:function(val){return map[val];};}", "title": "" }, { "docid": "bae43788c08e4b11e682cf124678ede5", "score": "0.5960047", "text": "function makeMap(str,expectsLowerCase){var map=Object.create(null);var list=str.split(',');for(var i=0;i<list.length;i++){map[list[i]]=true;}return expectsLowerCase?function(val){return map[val.toLowerCase()];}:function(val){return map[val];};}", "title": "" }, { "docid": "bae43788c08e4b11e682cf124678ede5", "score": "0.5960047", "text": "function makeMap(str,expectsLowerCase){var map=Object.create(null);var list=str.split(',');for(var i=0;i<list.length;i++){map[list[i]]=true;}return expectsLowerCase?function(val){return map[val.toLowerCase()];}:function(val){return map[val];};}", "title": "" }, { "docid": "32ec2fe2e8e0eb82c673835fea0a4ce6", "score": "0.59573954", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null)\n var list = str.split(\",\")\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true\n }\n return expectsLowerCase\n ? function(val) {\n return map[val.toLowerCase()]\n }\n : function(val) {\n return map[val]\n }\n }", "title": "" }, { "docid": "85e0ef16bc22a0bd33687fdb45c8cb6c", "score": "0.5957165", "text": "function makeMap(xMax, yMax) {\n let map = []\n for (let y = 0; y < yMax; y++) {\n map[y] = []\n for (let x = 0; x < xMax; x++) {\n map[y][x] = isWall(x, y) ? '#' : '.'\n }\n }\n return map\n}", "title": "" }, { "docid": "f4b15633f03319135b6373c3d2e11e21", "score": "0.5944601", "text": "static generateIdMap() {\n // Get Map Size:\n CardMapper.MAP_SIZE = 0;\n CardMapper.MAP_SIZE += CARDOBJECTS.Suspects.length;\n CardMapper.MAP_SIZE += CARDOBJECTS.Weapons.length;\n CardMapper.MAP_SIZE += CARDOBJECTS.Rooms.length;\n\n // Add Suspects to \"Master Map\"...\n for (const suspect of CARDOBJECTS.Suspects) {\n CardMapper.idMapping[suspect.Id] = suspect;\n }\n // Add Weapons to \"Master Map\"...\n for (const weapon of CARDOBJECTS.Weapons) {\n CardMapper.idMapping[weapon.Id] = weapon;\n }\n // Add Rooms to \"Master Map\"...\n for (const room of CARDOBJECTS.Rooms) {\n CardMapper.idMapping[room.Id] = room;\n }\n return;\n }", "title": "" }, { "docid": "7198f0008a132e8ffec4c00355094d48", "score": "0.59430355", "text": "function buildMap(c: String) {\n\tswitch(c){\n\t\tcase \"1\" : return \"Heavy\"; break;\n\t\tcase \"2\" : return \"Muscular\"; break;\n\t\tcase \"3\" : return \"Medium\"; break;\n\t\tcase \"4\" : return \"Thin\"; break;\n\t\tdefault : return \"\";\n\t}\n}", "title": "" }, { "docid": "3f75023dd773e9e827f456b1f3439165", "score": "0.59373933", "text": "function map_to_map(encoder,value){if(!(value instanceof Map))return obj_to_map(encoder,value);var length=value.size;var type=length<16?0x80+length:length<=0xFFFF?0xde:0xdf;token[type](encoder,length);var encode=encoder.codec.encode;value.forEach(function(val,key,m){encode(encoder,key);encode(encoder,val);});}// raw 16 -- 0xda", "title": "" }, { "docid": "6e6db21911964f39d9df781ed003e040", "score": "0.5928554", "text": "buildTiles(){\n if(this.tiles){\n return this.tiles;\n }\n let tiles = new Map(); // A map of [TileNode, TileObject] pairs\n for(var i = 1; i < this.tilesCount; i++){\n let tile = new Tile(i);\n tiles.set(tile.node, tile);\n this.node.appendChild(tile.node);\n }\n this.missing = i; // Empty slot is always initialized at last position\n this.inPositionCount = i; // All tiles are in position on initialization\n return tiles;\n }", "title": "" }, { "docid": "83cbba8993fdb90f66761a4c0b9389a4", "score": "0.59143645", "text": "function buildNumericMap(alphabet) {\n const theMap = new Map();\n let count = 1;\n const arrAlphabet = alphabet.split(\"\");\n for (let val of arrAlphabet) {\n theMap.set(val, count++);\n }\n return theMap;\n }", "title": "" }, { "docid": "e7971af3c8a60d8956a2a85ac687de45", "score": "0.5907003", "text": "createMap() {\n // let map = null;\n\n // switch(this.type) {\n // case LeafVMap.MAP_TYPES.AMap:\n // map = AMap;\n // break;\n // case LeafVMap.MAP_TYPES.BMap:\n // map = BMap;\n // break;\n // case LeafVMap.MAP_TYPES.GOOGLE:\n // map = GoogleMap;\n // break;\n // default:\n // // do nothing.\n // }\n\n this.vMap = new LeafVMap.MAPS[this.type](this.container, this.styles, this.opts).createMap();\n return this;\n }", "title": "" }, { "docid": "f39c7bf92e1fe555d38330ccc1847731", "score": "0.58983904", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n }", "title": "" }, { "docid": "f39c7bf92e1fe555d38330ccc1847731", "score": "0.58983904", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n }", "title": "" }, { "docid": "f39c7bf92e1fe555d38330ccc1847731", "score": "0.58983904", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n }", "title": "" }, { "docid": "f39c7bf92e1fe555d38330ccc1847731", "score": "0.58983904", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n }", "title": "" }, { "docid": "fded7bf9f66566aa717213bf8dae37e0", "score": "0.5893856", "text": "function createMap ()\n{\n // boucle qui va créer toutes les \"<td></td>\" en rapport avec var map_x\n for ( var i = 0; i <= map_x; i++ )\n {\n td += \"<td></td>\";\n }\n\n // boucle qui va créer toutes les \"<tr>\"+td+\"</tr>\" en rapport avec var map_y\n for ( var i = 0; i <= map_y; i++ )\n {\n tr.push( \"<tr>\" + td + \"</tr>\" );\n }\n\n // sélectionne <main> puis .append() insère \"<table>\"+tr.join(\"\\n\")+\"</table>\"\n $( \"main\" ).append( \"<table>\" + tr.join( \"\\n\" ) + \"</table>\" );\n // dans </main > en tant que dernier enfant\n}", "title": "" }, { "docid": "56276f0f4ab11737386933dabed971c9", "score": "0.58926535", "text": "function makeMap(str, expectsLowerCase) {\n\t var map = Object.create(null);\n\t var list = str.split(',');\n\t for (var i = 0; i < list.length; i++) {\n\t map[list[i]] = true;\n\t }\n\t return expectsLowerCase ? function (val) {\n\t return map[val.toLowerCase()];\n\t } : function (val) {\n\t return map[val];\n\t };\n\t}", "title": "" }, { "docid": "c5609df3cce96db6dd2825fc791365a9", "score": "0.58914596", "text": "function obj_to_map(encoder,value){var keys=Object.keys(value);var length=keys.length;var type=length<16?0x80+length:length<=0xFFFF?0xde:0xdf;token[type](encoder,length);var encode=encoder.codec.encode;keys.forEach(function(key){encode(encoder,key);encode(encoder,value[key]);});}// fixmap -- 0x80 - 0x8f", "title": "" }, { "docid": "fe5049f5b23e704ef0aaa9e763a856b4", "score": "0.58912253", "text": "function generateProductsMap(products) {\n var productObj = products.reduce(function(obj, val) {\n\n obj[val.id] = val;\n\n return obj\n }, {});\n return productObj;\n}", "title": "" }, { "docid": "c2ab77f5ef828a7079c80a72326c9b96", "score": "0.5889289", "text": "_map_data() { }", "title": "" }, { "docid": "a4ed4a45ba7ac629cdc13df2559999c9", "score": "0.58768725", "text": "function makeMap (\n\t str,\n\t expectsLowerCase\n\t) {\n\t var map = Object.create(null);\n\t var list = str.split(',');\n\t for (var i = 0; i < list.length; i++) {\n\t map[list[i]] = true;\n\t }\n\t return expectsLowerCase\n\t ? function (val) { return map[val.toLowerCase()]; }\n\t : function (val) { return map[val]; }\n\t}", "title": "" }, { "docid": "a4ed4a45ba7ac629cdc13df2559999c9", "score": "0.58768725", "text": "function makeMap (\n\t str,\n\t expectsLowerCase\n\t) {\n\t var map = Object.create(null);\n\t var list = str.split(',');\n\t for (var i = 0; i < list.length; i++) {\n\t map[list[i]] = true;\n\t }\n\t return expectsLowerCase\n\t ? function (val) { return map[val.toLowerCase()]; }\n\t : function (val) { return map[val]; }\n\t}", "title": "" }, { "docid": "a4ed4a45ba7ac629cdc13df2559999c9", "score": "0.58768725", "text": "function makeMap (\n\t str,\n\t expectsLowerCase\n\t) {\n\t var map = Object.create(null);\n\t var list = str.split(',');\n\t for (var i = 0; i < list.length; i++) {\n\t map[list[i]] = true;\n\t }\n\t return expectsLowerCase\n\t ? function (val) { return map[val.toLowerCase()]; }\n\t : function (val) { return map[val]; }\n\t}", "title": "" }, { "docid": "a4ed4a45ba7ac629cdc13df2559999c9", "score": "0.58768725", "text": "function makeMap (\n\t str,\n\t expectsLowerCase\n\t) {\n\t var map = Object.create(null);\n\t var list = str.split(',');\n\t for (var i = 0; i < list.length; i++) {\n\t map[list[i]] = true;\n\t }\n\t return expectsLowerCase\n\t ? function (val) { return map[val.toLowerCase()]; }\n\t : function (val) { return map[val]; }\n\t}", "title": "" }, { "docid": "94f0dee6b3535b4ce84049d3ac46cd63", "score": "0.5875934", "text": "function initializeMap(list) {\n var result = {};\n var accessors = {};\n var hasAccessors = false;\n var i;\n for (i = 0; i < list.length; i += 2) {\n if (typeof list[i] === 'string') {\n if (result.hasOwnProperty(list[i])) {\n throw new SyntaxError('Duplicate keys: ' + list[i]);\n }\n if (isNumericName(list[i])) {\n result[list[i]] = asFirstClass(list[i + 1]);\n } else {\n result.DefineOwnProperty___(\n list[i],\n {\n value: asFirstClass(list[i + 1]),\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n } else {\n hasAccessors = true;\n var name = list[i][0];\n if (isNumericName(name)) {\n throw new TypeError('Accessors not supported for numerics.');\n }\n var type = list[i][1];\n accessors[name] = accessors[name] || {};\n if (accessors[name].hasOwnProperty(type)) {\n throw new SyntaxError('Duplicate accessor keys: ' +\n type + ' ' + list[i]);\n }\n accessors[name][type] = asFirstClass(list[i + 1]);\n }\n }\n if (hasAccessors) {\n for (i in accessors) {\n if (!accessors.hasOwnProperty(i)) { continue; }\n if (endsWith__.test(i)) { continue; }\n result.DefineOwnProperty___(i, {\n get: accessors[i].get,\n set: accessors[i].set,\n enumerable: true,\n configurable: true\n });\n }\n }\n return result;\n }", "title": "" }, { "docid": "887d20aa3fa8bf1c615a557381871ffe", "score": "0.586708", "text": "function BuildMap(width, height, multX, multY, tileSize) {\n\t\t\n\t\ttileDict = {};\n\t\t$('#map').empty();\n\n\t\tvar cols = Math.floor((width / tileSize) * multX);\n\t\tvar rows = Math.floor((height / tileSize) * multY);\n\n\t\tvar displayTileSizeX = 16;\n\t\tvar displayTileSizeY = 16;\n\n\t\tdocument.getElementById('map').style.setProperty('--ncols', cols.toString());\n\t\tdocument.getElementById('map').style.setProperty('--nrows', rows.toString());\n\t\tdocument.getElementById('map').style.setProperty('--tileX', displayTileSizeX.toString() + \"px\");\n\t\tdocument.getElementById('map').style.setProperty('--tileY', displayTileSizeY.toString() + \"px\");\n\n\t\tvar index = 0;\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\t$('#map').append('<div class=\"tile\" id=\"'+ index + '\" style=\"width:' + displayTileSizeX + 'px;height:' + displayTileSizeY + 'px;\"></div>');\n\t\t \tvar entry = {\n\t\t \t\tterrainPiece:selectedTerrainKey,\n\t\t \t\tsittingObject:selectedSittingObjectKey,\n\t\t \t\tregionName:selectedRegionName\n\t\t \t};\n\t \t\ttileDict[index] = entry;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\n\t\t$('#nTiles').text((cols * rows));\n\t\t$('#cols').text(cols);\n\t\t$('#rows').text(rows);\n\t\t\n\t\t//TODO - make tiles and map not draggable\n\t\t\n\t\t// color the origin\n\t\tvar origin = Math.floor(((cols * rows) / 2) - (cols/2));\n\t\t$('#'+origin).css('background-color', 'red');\n\t}", "title": "" }, { "docid": "1cec2a000ec10d0e2fcf31b105429853", "score": "0.58653814", "text": "function SadMap() {\n this.keys = [];\n this.values = [];\n}", "title": "" }, { "docid": "2e32cbd8d4f9b9a2a213d70fe06ab420", "score": "0.58626246", "text": "static mergeMaps(map1, map2) {\n\t return new Map([...map1, ...map2]);\n\t}", "title": "" }, { "docid": "173ee104804aae1edca23dde1adab9bc", "score": "0.5855129", "text": "function getMap(){ return map; }", "title": "" }, { "docid": "beb1dfc3522b599b49ed4f5f268f1c59", "score": "0.58485085", "text": "function makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n }", "title": "" }, { "docid": "2b8984f261e579663eaa66f5cdfe5dc0", "score": "0.5842732", "text": "function initMap() {\n displayMap(0, 0, 2);\n }", "title": "" }, { "docid": "b793091bb937eef8e56dde18c4af23c6", "score": "0.5835743", "text": "generateMap(width, length) {\n let arr = this.makeEmptyMap(width, length);\n\n for (let i = 0; i < width; i++) {\n for (let j = 0; j < length; j++) {\n if (!i || !j || i + 1 == width || j + 1 == length) {\n arr[i][j].tile = tiles.wall;\n } else {\n if(ROT.RNG.getPercentage() > 95) {\n arr[i][j].tile = tiles.grass2;\n } else {\n arr[i][j].tile = tiles.grass;\n }\n }\n }\n }\n\n return arr;\n }", "title": "" }, { "docid": "2b6badb6e1aa7761ac70d69b669afb52", "score": "0.5832796", "text": "function createRandomMap(seed) {\n let rand = createRandomizer(seed);\n let map = [];\n for (let i=0; i<8;i++) {\n let row = [];\n for (let j=0; j<8;j++) {\n row.push(Math.floor(rand()*4))\n }\n map.push(row);\n }\n return map;\n}", "title": "" }, { "docid": "b530aae47f84268908949e38540662b4", "score": "0.5831686", "text": "function makeMap(\n str,\n expectsLowerCase\n ) {\n var map = Object.create( null );\n var list = str.split( ',' );\n for ( var i = 0; i < list.length; i++ ) {\n map[ list[ i ] ] = true;\n }\n return expectsLowerCase\n ? function (val) {\n return map[ val.toLowerCase() ];\n }\n : function (val) {\n return map[ val ];\n }\n }", "title": "" }, { "docid": "4d15c58f7f132c933f59e015a5fbc8ea", "score": "0.5828931", "text": "function toMap(n) {\r\n\treturn Math.floor(n / settings.tileSize);\r\n}", "title": "" } ]
ba652203393c7354ac12d73f11f0afa1
Fetch the columns in each project
[ { "docid": "d055660cc9c58a951b029e27a316d2bf", "score": "0.7625523", "text": "function fetchColumns(project_id, project_name) {\n\n\tfetchData(url + `projects/${project_id}/columns`).then(response => {\n\n\t\t//Get the projects column id and the name of \n\t\t//the column it's in. Send the results to fetchCards\n\t\t//function\n\t\tresponse.forEach(element => {\n\t\t\tfetchCards(element.id, format(element.name), project_name);\n\t\t});\n\n\t});\n}", "title": "" } ]
[ { "docid": "12fd565fda140dfe3fe7986f72eccc2d", "score": "0.7230201", "text": "function fetchProjects() {\n\n\tfetchData(url + 'repos/CoInvestor/webtest-2019/projects').then(response => {\n\t\t\n\t\t//Get the projects id and the name of the project board\n\t\t//Send results to fetchColumns function\n\t\tresponse.forEach(element => {\n\t\t\tfetchColumns(element.id, element.name);\n\t\t});\n\n\t});\n\n}", "title": "" }, { "docid": "462434125a22bae97d14970990d25c2c", "score": "0.6270503", "text": "async function getSelectedColumnsData() {\n console.log(\"Initialized \" + dbPath + \" \", db);\n\n // Select all rows from the data_table\n const query =\n \"select file_name , sheet_name ,field_name \" +\n \" from fields_meta_data as fm \" +\n \" inner join sheet_meta_data as smd on fm.sheet_id = smd.sheet_id \" +\n \" inner join file_meta_data as fmd on smd.file_id = fmd.file_id \" +\n \" order by fmd.file_id, smd.sheet_id, fm.field_id\";\n\n try {\n // Fetch data as JSON\n const data = await allQuery(query);\n\n const jsonData = JSON.stringify(data);\n return jsonData;\n } catch (err) {\n console.error(\"Error executing query:\", err.message);\n } finally {\n }\n}", "title": "" }, { "docid": "2bc22b6ec4fd49a6cc4d56dfcd4a206e", "score": "0.61415577", "text": "function getColunas(\n objConexao,\n ds_table_name\n) {\n return new Promise(\n function (resolve, reject) {\n var ds_query = 'show columns from ' + ds_table_name;\n\n objConexao.connect();\n\n objConexao.query(\n ds_query,\n function (error, arrColunas) {\n\n objConexao.end();\n\n if (error){\n reject(error);\n return;\n }\n\n var arrCampos = arrColunas.map(\n function(objColuna) {\n return {\n ds_nome : objColuna.Field,\n ds_tipo : objColuna.Type,\n is_null : objColuna.Null,\n ds_key : objColuna.Key,\n ds_default : objColuna.Default,\n ds_extra : objColuna.Extra\n };\n }\n );\n\n resolve(arrCampos);\n }\n );\n }\n );\n}", "title": "" }, { "docid": "8fd0f51bbc7871c177894a30188cf889", "score": "0.61326003", "text": "function grabProjects() {\n sql = 'SELECT o.Name, o.Project_Type, o.sDate, o.eDate, p.Role, p.Project_Org_Address, p.Project_Org_Name,p.Country_Name, p.Country_Name, f.Funder_Name, per.Person_Name FROM project_name_table o INNER JOIN project_collaborators p ON o.Project_ID = p.Project_ID INNER JOIN project_funders f ON f.Project_ID = o.Project_ID INNER JOIN person per ON o.person_fk = per.Person_ID GROUP BY o.Project_ID LIMIT 20'\n projectsArray = []\n \n let query = conn.query(sql, (err, results) => {\n if (err) throw err;\n \n \n \n const geoPromise = param => new Promise((resolve, reject) => {\n geo.geocode('mapbox.places', param, function (err, geoData) {\n if (err) return reject(err);\n if (geoData) {\n resolve(geoData.features[0])\n } else {\n reject('No result found');\n }\n });\n });\n\n \n\n\n \n const promises = results.map(result =>\n \n Promise.all([\n result.Name,\n result.Project_Type,\n result.sDate,\n result.eDate,\n result.Role,\n geoPromise(result.Project_Org_Address),\n result.Project_Org_Name,\n geoPromise(result.Country_Name),\n result.Country_Name,\n result.Funder_Name,\n result.Person_Name\n \n ])\n \n );\n \n Promise.all(promises)\n .then((values) => {\n \n \n let pNames = values.map(elmt => elmt[0])\n let pType = values.map(elmt => elmt[1])\n let sDate = values.map(elmt => elmt[2])\n let eDate = values.map(elmt => elmt[3])\n let roles = values.map(elmt => elmt[4])\n let projects = values.map(elmt => elmt[5])\n let collabNames = values.map(elmt => elmt[6])\n let countryNames = values.map(elmt => elmt[7])\n let countryProjects = values.map(elmt => elmt[8])\n let names = values.map(elmt => elmt[9])\n let person_name = values.map(elmt => elmt[10])\n\n projectsArray.push(pNames, pType, sDate, eDate, roles, projects, collabNames, countryNames, countryProjects, names, person_name)\n \n \n })\n \n \n });\n\n \n \n\n\n return projectsArray\n \n \n \n }", "title": "" }, { "docid": "42ea37af520b27ab199c25c0e3d54c59", "score": "0.59989256", "text": "async function getJIRAColumns(boardId, filterNames) {\n console.log(\"getJIRABoard(\" + boardId + \")\");\n let response = null;\n try {\n response = await http.get(\"https://opuscapita.atlassian.net/rest/agile/latest/board/\" + boardId + \"/configuration\")\n\t .set(\"Accept\", \"application/json\")\n .auth(jiraUser, jiraToken);\n \n console.log(\"project config= \", response.body);\n \n let result = {};\n let filteredColumns = response.body.columnConfig.columns\n .filter( (column) => {return !filterNames || filterNames.indexOf(column.name) > -1} );\n \n console.log(\"filtered columns= \", filteredColumns);\n \n filteredColumns.map( (column) => {result[column.name] = column});\n \n return result;\n \n }\n catch (err) {\n console.error(\"caught: \", err);\n }\n}", "title": "" }, { "docid": "efb5d080eeb8cb1c9aa72f7a41f908e9", "score": "0.59876263", "text": "function fetchProjectDetail(projectId, cb) {\n db.getPool().query(\"SELECT * FROM project_detail WHERE id=?\", [projectId], cb);\n}", "title": "" }, { "docid": "2fb0e1f37992eae8196e07f06e2bbb19", "score": "0.5918634", "text": "function getProjects() {\n fetch('http://localhost/web3api2020-master/src/model/projects.php', {\n method: 'GET'\n })\n .then(response => response.json())\n .then(projects => {\n fetchedProjects = projects;\n document.querySelector('#projectList').innerHTML = '';\n\n projects.forEach(function(project) {\n document.querySelector('#projectList').innerHTML += `\n <tr>\n <td>${project.startdate} - ${project.enddate}</td>\n <td>${project.project}</td>\n <td>${project.title}</td>\n <td>${project.description}</td>\n <td><button onClick=\"openUpdateProjectModal(${project.id})\">Update</button></td>\n <td><button onClick=\"openDeleteProjectModal(${project.id})\">Delete</button></td>\n </tr>\n `;\n });\n });\n}", "title": "" }, { "docid": "4682266fbb730a8b86a2eda7c7694f18", "score": "0.5861093", "text": "get fieldsAsColumns(){return self.columns.reduce((res,column)=>{if(!column.parent){res.push(...column.asField);}return res;},[]);}", "title": "" }, { "docid": "63a826c903f2caa50f7c512e1ce3a6a6", "score": "0.5834884", "text": "function getColObjects() { return colObjects; }", "title": "" }, { "docid": "9274e4e7aa38d2bb7935e9afcdacc4c5", "score": "0.5808759", "text": "function DB_getAllProjects() {\n return new mongoose_1.Promise((resolve, reject) => {\n db_1.Projectmodel.find({}).exec((err, data) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(data);\n }\n });\n });\n}", "title": "" }, { "docid": "c05313d6209f99d2378595dda2e4861e", "score": "0.57884276", "text": "fetchAll() {\n return new Promise(async resolve => {\n let data = [];\n let newQuery = `select * from ${TABLE_NAME}`;\n\n const res = await recordFetch(newQuery);\n if (res) {\n var len = res.rows.length;\n\n\n for (let i = 0; i < len; i++) {\n let row = res.rows.item(i);\n\n const { id } = row;\n let title = row[COL_TITLE];\n let description = row[COL_DESCRIPTION];\n let propertyID = row[COL_PROPERTY_ID];\n let logType = row[COL_LOG_TYPE];\n let remoteLogID = row[COL_REMOTE_LOG_ID];\n\n data.push({ id, title, description, propertyID, logType, remoteLogID });\n }\n\n }\n resolve(data);\n\n });\n }", "title": "" }, { "docid": "eb7907445806cf6c9d23cb1f8fa379ab", "score": "0.5722318", "text": "function getProjects() {\n return db.collection(\"projects\").find({}).toArray();\n}", "title": "" }, { "docid": "c86ee22b6b2a34043cf9f0c59483b19d", "score": "0.57030606", "text": "async function run() {\n\n let project = null;\n try {\n /*\n project = await getProject(\"BusinessNetwork\");\n let columns = await getColumns(project.id, ['Requested', 'Ready', 'On Hold', 'In Progress', 'Review']);\n console.log(\"columns: \", columns);\n for(let columnName in columns) {\n // now get all cards in column\n let cards = await getCards(columns[columnName].id);\n console.log(\"got cards in \" + columnName + \": \", cards.map( (card) => {return card[\"content_url\"] }));\n }\n */\n let board = await getJIRABoard(\"TB board\");\n console.log(\"got JIRA board:\", board);\n let columns = await getJIRAColumns(board.id, ['Requested', 'Ready', 'On Hold', 'In Progress', 'Review']);\n console.log(\"columns: \", columns);\n for(let columnName in columns) {\n // now get all cards in column\n //let cards = await getCards(columns[columnName].id);\n //console.log(\"got cards in \" + columnName + \": \", cards.map( (card) => {return card[\"content_url\"] }));\n } \n }\n catch(err) {\n console.log(\"error getting project: \", err);\n process.exit(1);\n }\n //console.log(\"id = \", project.id);\n}", "title": "" }, { "docid": "fd8210484e91b1cb0c69231004c6324e", "score": "0.56294876", "text": "function setupColumns() {\n var leftCol = getLeftColValue(),\n centerCol = getCenterColValue(),\n rightCol = getRightColValue();\n\n getData(leftCol, 0);\n getData(centerCol, 1);\n getData(rightCol, 2);\n}", "title": "" }, { "docid": "507663da1f799481ad07459455d2be2d", "score": "0.5595801", "text": "static dataProject(pool, projectid) {\n let sqlProjectName = `SELECT name FROM projects WHERE projectid = $1`;\n let sqlMembers = `SELECT userid FROM members WHERE projectid = $1`;\n return new Promise((resolve, reject) => {\n pool.query(sqlProjectName, [projectid]).then(projectName => {\n projectName = projectName.rows[0].name;\n pool.query(sqlMembers, [projectid]).then(userid => {\n userid = userid.rows;\n resolve({ projectName, userid });\n }).catch(err => reject(err));\n }).catch(err => reject(err));\n })\n }", "title": "" }, { "docid": "d51b25960f7565beb4ee184d31cf3972", "score": "0.55473906", "text": "function GetUserBasedGridColumList() {\n var _filter = {\n \"SAP_FK\": authService.getUserInfo().AppPK,\n \"TenantCode\": authService.getUserInfo().TenantCode,\n \"SourceEntityRefKey\": authService.getUserInfo().UserId,\n \"EntitySource\": \"WMS_CLIENTCONFIG\",\n };\n var _input = {\n \"searchInput\": helperService.createToArrayOfObject(_filter),\n \"FilterID\": appConfig.Entities.UserSettings.API.FindAll.FilterID\n };\n\n apiService.post(\"eAxisAPI\", appConfig.Entities.UserSettings.API.FindAll.Url + authService.getUserInfo().AppPK, _input).then(function (response) {\n if (response.data.Response[0]) {\n ClientConfigCtrl.ePage.Masters.UserValue = response.data.Response[0];\n if (response.data.Response[0].Value != '') {\n var obj = JSON.parse(response.data.Response[0].Value)\n ClientConfigCtrl.ePage.Entities.Header.TableProperties.WmsClientParameterByWarehouse = obj;\n ClientConfigCtrl.ePage.Masters.UserHasValue = true;\n }\n } else {\n ClientConfigCtrl.ePage.Masters.UserValue = undefined;\n }\n })\n }", "title": "" }, { "docid": "e3ba1e65163b5027dd9d2450cae54724", "score": "0.55447805", "text": "function retrieveColumnCells() {\n return JSON.parse(storageManager.getItem(\"copiedCols\")) || {};\n }", "title": "" }, { "docid": "65e99ca535271d4973de441ceb4bd533", "score": "0.55438197", "text": "function getColumns(data) {\n\t \tcolumns = {};\n\t \t\n\t \tcolNamesArray = [];\n\t \tcolModelsArray = [];\n\t \t\n\t \t// adding edit column \n\t \tcolNamesArray.push(\" \");\n\t \tcolModel = {};\n\t \tcolModel.name = '_edit';\n\t \tcolModel.width = 25;\n\t \tcolModel.align = 'center';\n\t \tcolModel.resizable = false;\n\t \tcolModel.sortable = false;\n\t \tcolModel.formatter = editFormatter;\n\t \tcolModelsArray.push(colModel);\n\t \t\n\t \t// adding fields columns\n\t \tjQuery.each(data.fields, function(index, row) {\n\t \t\t//if (row.frontpage) {\n\t \t\t\tcolNamesArray.push(row.name);\n\t \t\t\t\n\t \t\t\tcolModel = {};\n\t \t\t\tcolModel.name = row.restName;\n\t \t\t\tcolModel.index = row.restName;\n\t \t\t\tcolModel.align = 'left';\n\t \t\t\tcolModel.resizable = false;\n\t \t\t\tcolModel.sortable = true;\n\t \t\t\tcolModel.cellattr = function (rowId, tv, rawObject, cm, rdata) { return 'style=\"white-space: normal;\"' };\n\t \t\t\tcolModel.hidden = !row.frontpage;\n\t \t\t\tcolModel.formatter = function(cellvalue, options, rowObject) {\n\t \t\t\t\treturn buildFilePreview(cellvalue, row, \"\");\n\t \t\t\t}\n\t \t\t\tcolModelsArray.push(colModel);\n\t \t\t\t\n\t \t\t\t// hidden columns with content for each language, for update\n\t \t\t\tjQuery.each(SUPPORTED_LOCALES, function(index, locale) {\n\t \t\t\t\tcolNamesArray.push(\" \");\n\t \t\t\t\tcolModel = {};\n\t \t\t\t\tcolModel.name = row.restName + \"_\" + locale;\n\t \t\t\t\tcolModel.hidden = true;\n\t \t\t\t\tcolModelsArray.push(colModel);\n\t \t\t\t\t\n\t \t\t\t\tcolNamesArray.push(\" \");\n\t \t\t\t\tcolModel = {};\n\t \t\t\t\tcolModel.name = row.restName + \"_\" + locale + \"@id\";\n\t \t\t\t\tcolModel.hidden = true;\n\t \t\t\t\tcolModelsArray.push(colModel);\n\t \t\t\t});\n\t \t\t//}\n\t \t});\n\t \t\n\t \t// adding delete column \n\t \tcolNamesArray.push(\" \");\n\t \tcolModel = {};\n\t \tcolModel.name = '_delete';\n\t \tcolModel.width = 25;\n\t \tcolModel.align = 'center';\n\t \tcolModel.resizable = false;\n\t \tcolModel.sortable = false;\n\t \tcolModel.formatter = deleteFormatter;\n\t \tcolModelsArray.push(colModel);\n\t \t\n\t \t// group_id column\n\t \tcolNamesArray.push(\" \");\n\t \tcolModel = {};\n\t \tcolModel.name = 'groupId';\n\t \tcolModel.hidden = true;\n\t \tcolModelsArray.push(colModel);\n\t \t\n\t \tcolumns.colNames = colNamesArray;\n\t \tcolumns.colModels = colModelsArray;\n\t \t\n\t \treturn columns;\t\n\t }", "title": "" }, { "docid": "b45241df2346e2f95c89368abf41da95", "score": "0.5540877", "text": "function getProjectData(cb) {\n \n async.parallel({\n public: (nestedCb) => {\n\n countProjects({ \n public: true, \n real: true\n })\n .then(({count}) => {\n nestedCb(null, count);\n })\n .catch((err) => {\n nestedCb(err);\n });\n\n },\n data: (nestedCb) => {\n\n const query = {\n limit: 5,\n filters: {\n public: true,\n real: true\n },\n select: {\n _id: 1, \n title: 1, \n createdDate: 1, \n lastUpdate: 1, \n public: 1,\n favourite: 1, \n git: 1 \n }\n };\n\n fetchProjects(query)\n .then(({projects}) => {\n const formattedProject = projects.map((m) => {\n return {\n _id: m._id,\n title: m.title,\n createdDate: displayDate(m.createdDate),\n lastUpdate: displayDate(m.lastUpdate),\n public: m.public,\n favourite: m.favourite,\n git: m.git,\n };\n });\n nestedCb(null, formattedProject);\n })\n .catch(({err}) => {\n nestedCb(err);\n });\n }\n }, function returnProjects(err, projectData) {\n if (err) {\n cb(err);\n } else {\n cb(null, projectData);\n }\n }); \n}", "title": "" }, { "docid": "883d78355fe07a9ef636b422923e6420", "score": "0.5533003", "text": "function fetchCards(column_id, column_name, project_name) {\n\n\tfetchData(url + `projects/columns/${column_id}/cards`).then(response => {\n\n\t\t//Get the card data and create a card adding it\n\t\t//to the HTML\n\t\tresponse.forEach(element => {\n\t\t\tcreateCard(element.note,\n\t\t\t\tproject_name, \n\t\t\t\telement.creator.login, \n\t\t\t\telement.creator.html_url, \n\t\t\t\telement.created_at, \n\t\t\t\tcolumn_name);\n\t\t});\n\n\t});\n\n}", "title": "" }, { "docid": "9eba03543db73308cfd319e7e0a7d71b", "score": "0.5499405", "text": "function getProject(projects, projectFilter){\n var oneProject = []\n projects.forEach(function (element) {\n\t var name = element[focusAreaColumn]\n\t if (name === projectFilter) oneProject.push(element)\n })\n return oneProject\n}", "title": "" }, { "docid": "8deed0f583e75ab06897a71acbee7359", "score": "0.5493518", "text": "function getFields(force) {\n if(self.view == null && ColumnsService.tableName != null)\n ColumnsService.get(force).then(successHandler, errorHandler)\n }", "title": "" }, { "docid": "41d3f3c447056a3807129324334adc1b", "score": "0.54902697", "text": "function getColumns() {\n return Object.getOwnPropertyNames(data[0])\n }", "title": "" }, { "docid": "93a40e65dae3001203ebc430e78e51d3", "score": "0.5478785", "text": "function getProjects() {\n return db('projects');\n}", "title": "" }, { "docid": "b4bd131f39dc681d20ba3f82ab11edf2", "score": "0.54735357", "text": "function loadColumns(){\n columnList = DictInDict(data);\n}", "title": "" }, { "docid": "ea88a533f076a489aff9a3265c99b017", "score": "0.54561603", "text": "function getGridColumns() {\n var funtionName = \"getGridColumns\";\n var columns = [];\n try {\n columns = [\n { field: \"triipcrm_viewcolumnid\", hidden: true, template: '<span id=\"recordId\">#: triipcrm_viewcolumnid #</span>' },\n { field: \"triipcrm_columnlogicalname\", width: \"25px\", hidden: false, title: \"Logical Name\" },\n { field: \"triipcrm_columndisplayname\", width: \"25px\", hidden: false, title: \"Display Name\" },\n { field: \"triipcrm_width\", width: \"25px\", hidden: false, title: \"Width\" },\n { field: \"triipcrm_isreadonly\", width: \"25px\", hidden: false, title: \"Read Only\", template: \"<span id='isReadOnly'>#var check=displayCheckBox('triipcrm_isreadonly',triipcrm_isreadonly);##=check#</span>\" },\n { field: \"triipcrm_isrequired\", width: \"15px\", hidden: false, title: \"Is Required\", template: \"<span id='isRequired'>#var check=displayCheckBox('triipcrm_isrequired',triipcrm_isrequired);##=check#</span>\" },\n { field: \"triipcrm_allowfilter\", width: \"15px\", hidden: false, title: \"Allow Filter\", template: \"<span id='isAllowFilter'>#var check=displayCheckBox('triipcrm_allowfilter',triipcrm_allowfilter);##=check#</span>\" }\n ];\n\n } catch (e) {\n throwError(e, funtionName);\n }\n return columns;\n}", "title": "" }, { "docid": "c54366644a7a5707f7641ad2cbd95553", "score": "0.54515785", "text": "function getColumns(sqlData, entityData, titre, code) {\n Pace.track(function(){\n $.ajax({\n method: \"POST\",\n url: '../../api/datatable/columns',\n data: {\n sql: sqlData,\n entity: entityData\n }\n })\n .done(function( data ) {\n // Tags\n for (var column in extraArray[code]) {\n data[column] = \"extrafield\";\n }\n \n setTableHeaders(data, code);\n setTitle(titre, code);\n\n if (data) {\n addToolsButton(code);\n addArchiveButton(code);\n }\n \n // New\n if (\n code in configArray && \"new\" in configArray[code] && configArray[code]['new']\n ) {\n addNewButton(entityData, code);\n } \n \n initTable(data, sqlData, entityData, code);\n return data;\n });\n });\n}", "title": "" }, { "docid": "40251389e6cb5e3d8e988047974c7673", "score": "0.5443582", "text": "function find() {\n return db(\"tasks\")\n .join(\"projects\", \"projects.id\", \"tasks.project_id\")\n .select(\"tasks.id as Task_ID\", \"tasks.name as Task_Name\", \"projects.name as Project_Name\", \"projects.description as Project_Desc\", \"tasks.description as Task_Desc\", \"tasks.notes as Task_Notes\",);\n \n}", "title": "" }, { "docid": "ac87351cc87414c619539f055a3e4b7b", "score": "0.5441338", "text": "function loadAllProjects() {\n // perform authentication\n authenticate();\n // initiate URL, header, options\n var getAllProjectURL = \"https://api.teamgantt.com/v1/projects/all?\"\n var header = {\n 'TG-Authorization' : 'Bearer ' + PropertiesService.getUserProperties().getProperty('authKey'),\n 'TG-Api-Key' : api_key,\n 'TG-User-Token' : user_token\n }\n var options = {\n 'method' : 'get',\n 'contentType' : 'application/json',\n 'headers' : header\n }; \n // call the API and parse the response\n var response = UrlFetchApp.fetch(getAllProjectURL, options);\n var json = response.getContentText();\n var data = JSON.parse(json);\n var myMap = [];\n // map name, id, status, and public key\n for (i = 0; i < data.projects.length; i++) {\n myMap.push([data.projects[i].name, data.projects[i].id.toString(), data.projects[i].status, data.projects[i].public_key]);\n }\n return myMap;\n}", "title": "" }, { "docid": "e3f353bb70410f4bc80c1e443aa67e55", "score": "0.5441278", "text": "function getProjectInformation(project) {\n var jobSearchObj = search.create({\n type: \"job\",\n filters: [\n [\"jobname\", \"contains\", project]\n ],\n columns: [\n search.createColumn({\n name: \"internalid\",\n join: \"customer\",\n label: \"Customer Internal ID\"\n }),\n search.createColumn({\n name: \"custentitycert_billing_uom\",\n label: \"Invoice Billing Unit of Measure\"\n }),\n search.createColumn({\n name: \"custentitycert_proj_location\",\n label: \"Location\"\n }),\n search.createColumn({\n name: \"custentity_cert_proj_dept\",\n label: \"Department\"\n }),\n search.createColumn({\n name: \"custentity_cert_proj_class\",\n label: \"Class\"\n }),\n search.createColumn({\n name: \"cseg_cert_custype\",\n label: \"Customer Type\"\n })\n ]\n });\n\n var projectdata = jobSearchObj.run().getRange(0, 999);\n return projectdata;\n }", "title": "" }, { "docid": "4bef0f818e3fb95334b334ba957e14be", "score": "0.5439638", "text": "async function fetchData() {\n const fetcher = await window.fetch(\n `${address()}projects`,\n {\n headers: { \"accept-language\": `${i18n.language}` },\n },\n {\n items: (page) => page.results,\n params: true,\n }\n );\n const response = await fetcher.json();\n const project = filterProjects(projectType, response);\n setLoading(false);\n }", "title": "" }, { "docid": "2c114919d71f39bd210f4f9acad65608", "score": "0.54067504", "text": "getCurrentColumns() {\n let currentColumns = [];\n if (this._currentColumns && Array.isArray(this._currentColumns) && this._currentColumns.length > 0) {\n currentColumns = this._currentColumns;\n }\n else {\n currentColumns = this.getAssociatedCurrentColumns(this._grid.getColumns());\n }\n return currentColumns;\n }", "title": "" }, { "docid": "ca5195e1a0b7a225fa13db1f31e50df1", "score": "0.5405817", "text": "async function asyncColumnInfos(databaseName, tablePrefix, tables = [], config = {}) {\n let promises = tables.map((table) => {\n return new Promise((resolve, reject) => {\n\n let providerPath = `${config['providerPath']}${config['sep']}provider`.replace(/\\\\/g, '/')\n \n let options = config['database']\n var connection = mysql.createConnection(options);\n\n\n let sql = `${DATA_BASE_COLUMN_INFO_SQL}`\n\n let tableName = table['tableName'] || ''\n let tableNameTemp = tableName.replace(tablePrefix, '')\n let entityName = functions.toEntity(tableNameTemp)\n let tableComment = (table['tableComment'] || '').replace(/\\\\s*|\\\\t|\\\\r|\\\\n/g, '') || `${entityName}`\n\n let controllerMapping = functions.toSplitLine(entityName).toLowerCase()\n let sqlBuilderAnnotationName = functions.firstToLowerCase(entityName)\n\n let tableInfo = {\n convert: false,\n tableName: tableName,\n catalog: `${databaseName}`,\n comment: `${tableComment}` || '',\n entityName: `${entityName}`,\n dtoName: `${entityName}DTO`,\n repositoryName: `${entityName}Repository`,\n sqlBuilderName: `${entityName}SqlBuilder`,\n sqlBuilderAnnotationName: `${sqlBuilderAnnotationName}`,\n hbmName: `${entityName}`,\n serviceName: `${entityName}Service`,\n serviceImplName: `${entityName}ServiceImpl`,\n mapperName: `${entityName}Mapper`,\n controllerName: `${entityName}Controller`,\n controllerMapping: `/${controllerMapping}`,\n fields: [],\n guzzs: [],\n importPackages: [],\n package: {\n controller: (`${providerPath}.controller`).replace(/\\//g, '.'),\n dto: (`${providerPath}/core/domain/dto`).replace(/\\//g, '.'),\n entity: (`${providerPath}/core/domain/entity`).replace(/\\//g, '.'),\n mapper: (`${providerPath}/service/mapper`).replace(/\\//g, '.'),\n repository: (`${providerPath}/repository`).replace(/\\//g, '.'),\n service: (`${providerPath}/service`).replace(/\\//g, '.'),\n serviceImpl: (`${providerPath}/service/impl`).replace(/\\//g, '.'),\n }\n }\n\n // repository.guzz.hbm.xml's path\n let repositoryPath = `${providerPath}/repository`\n\n let guzzs = []\n let guzz = new Guzz(`${entityName}`, `${repositoryPath}/${entityName}`)\n\n guzzs.push(guzz)\n tableInfo.guzzs = guzzs\n\n connection.connect();\n\n connection.query({\n sql: sql,\n values: [`${databaseName}`, `${table['tableName']}`]\n }, (error, resultSet) => {\n\n if (error) {\n reject(error)\n }\n\n // let results = Array.prototype.slice.call(resultSet);\n let results = Array.from(resultSet);\n\n let tableFields = []\n\n results.forEach(element => {\n\n let columnName = element.columnName || ''\n if (!!functions.contains(columnName, \"_\")) {\n // hello_world -> HelloWorld\n columnName = functions.toCamelCase(columnName)\n }\n\n // HelloWorld -> helloWorld\n let fieldName = functions.firstToLowerCase(columnName)\n\n let columnComment = (element['columnComment'] || '').replace(/\\\\s*|\\\\t|\\\\r|\\\\n/g, '')\n\n let tableField = {\n primaryKey: (element.primaryKey === 'PRI'),\n notNull: (element.notNull === 'NO'),\n fieldName: `${element.columnName}` || '',\n dataType: element.dataType,\n fieldLength: element.dataLength || 0,\n maxBit: element.maxBit || 0,\n minBit: element.minBit || 0,\n comment: `${columnComment}` || '',\n entityComment: `${tableComment}`,\n fieldType: '',\n propertyType: '',\n propertyName: `${fieldName}`\n }\n\n // populate fieldType && propertyType && importPackages\n functions.convertToJavaDataType(element.dataType, tableInfo, tableField)\n // toUnique\n tableInfo.importPackages = functions.toUnique(tableInfo.importPackages)\n\n tableFields.push(tableField)\n });\n\n tableInfo.fields = tableFields\n resolve(tableInfo)\n })\n connection.end();\n })\n })\n\n let tableInfos = await Promise.all(promises)\n return new Promise((resolve, reject) => {\n resolve(tableInfos)\n })\n}", "title": "" }, { "docid": "81719e80b66b9e7dc61f6bde936346d5", "score": "0.5391715", "text": "static async getAll() {\n let projection = {}\n try {\n let result = await DatabaseService.getAll(collectionName, projection);\n\n return result;\n } catch (err) {\n throw err;\n }\n }", "title": "" }, { "docid": "246e80486592e6c369bada47333cecea", "score": "0.5374779", "text": "function getProjectData(name) {\n const data = Projects.findOne({ name });\n const tags = _.pluck(ProjectsTags.find({ project: name }).fetch(), 'tag');\n const ratings = _.pluck(ProjectsRatings.find({ project: name }).fetch(), 'rating');\n const avgRating = ratings.reduce((a, b) => a + b, 0) / ratings.length;\n const profiles = _.pluck(ProfilesProjects.find({ project: name }).fetch(), 'profile');\n const profilePictures = profiles.map(profile => Profiles.findOne({ email: profile }).picture);\n return _.extend({ }, data, { tags, avgRating, participants: profilePictures });\n}", "title": "" }, { "docid": "266b0127562516db19085303877cb5f2", "score": "0.53595406", "text": "function viewProducts() {\n connection.query(\"SELECT * FROM products LEFT JOIN departments ON products.department_id = departments.department_id ORDER BY item_id\", function (err, results) {\n if (err) throw err;\n var columnData = '';\n var columnArray = [];\n for (var i = 0; i < results.length; i++) {\n columnData = {\n item: results[i].item_id,\n product: results[i].product_name,\n price: \"$\" + (results[i].price).toFixed(2),\n quantity: (results[i].stock_quantity),\n department: (results[i].department_name)\n }\n columnArray.push(columnData);\n }\n console.log(columnify(columnArray));\n start();\n });\n}", "title": "" }, { "docid": "85caff26d919d8cae836d9baf2364508", "score": "0.5349333", "text": "function _currentlyConfiguredCols() {\n var currentlyConfiguredCols = [];\n query(\".\"+constants.COL_NAME_CLASS, dom.byId(constants.TABLE_CONTAINER)).forEach(function(node) {\n currentlyConfiguredCols.push(registry.getEnclosingWidget(node).get('value'));\n });\n return currentlyConfiguredCols;\n }", "title": "" }, { "docid": "9689f4bbae06b9f4c15f71182eddf3ed", "score": "0.5342255", "text": "static async all() {\n const res = await db.query(\n `\n SELECT e.name, e.id, e.start_date, e.start_time FROM events e \n ORDER BY e.start_time ASC\n LIMIT 20\n `\n );\n return res.rows;\n }", "title": "" }, { "docid": "6790c7653c10d99d3b1fbc013dee0198", "score": "0.5339804", "text": "getDatasetFields() {\n\t\tconst results = [];\n\t\tconst fields = this.props.controller.getDatasetMetadataFields();\n\t\tfor (const field of fields) {\n\t\t\tresults.push(field.name);\n\t\t}\n\t\treturn results;\n\t}", "title": "" }, { "docid": "d89e96a45ec3e593bdba17f4a4ca0052", "score": "0.5338421", "text": "async function fetchAndModifyColumns() {\n const jsonData = await fetchUserColumns();\n\n const columnObject = parseNewColumnObject(jsonData);\n setcolumnsObject(columnObject);\n\n const orderedColumnIds = parseNewColumnArray(jsonData);\n setcolumnsIdArray(orderedColumnIds);\n }", "title": "" }, { "docid": "f8d27759968c5ea0a4e583036d0f0ab8", "score": "0.53314376", "text": "getAssociatedCurrentColumns(gridColumns) {\n const currentColumns = [];\n if (gridColumns && Array.isArray(gridColumns)) {\n gridColumns.forEach((column, index) => {\n if (column && column.id) {\n currentColumns.push({\n columnId: column.id,\n cssClass: column.cssClass || '',\n headerCssClass: column.headerCssClass || '',\n width: column.width || 0\n });\n }\n });\n }\n this._currentColumns = currentColumns;\n return currentColumns;\n }", "title": "" }, { "docid": "b3072803f03277aeb6082b92d21f0885", "score": "0.53277665", "text": "function fetchProjects() {\n let projects;\n let projectsKeys;\n let xhttp = new XMLHttpRequest();\n\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n projects = JSON.parse(this.responseText);\n projectsKeys = Object.keys(projects);\n\n projectsTable.innerHTML = \"\";\n\n for (i = 0; i < projectsKeys.length; i++) {\n projectId = projectsKeys[i];\n project = projects[projectId];\n tr = document.createElement(\"tr\");\n tr.setAttribute(\"project-id\", projectsKeys[i]);\n tr.setAttribute(\"is-imported\", project.is_imported);\n tr.setAttribute(\"is-exported\", project.is_exported);\n tr.setAttribute(\"task\", project.task);\n\n td = document.createElement(\"td\");\n td.className = \"project-title\";\n td.innerHTML = project.title;\n tr.append(td);\n\n td = document.createElement(\"td\");\n td.className = \"source language\";\n td.setAttribute(\"lang-code\", project.source_language_code);\n td.innerHTML = project.source_language;\n tr.append(td);\n\n td = document.createElement(\"td\");\n td.className = \"target language\";\n td.setAttribute(\"lang-code\", project.target_language_code)\n td.innerHTML = project.target_language;\n tr.append(td);\n\n tr.ondblclick = function() {\n window.projectTitle = this.getElementsByTagName(\"td\")[0].innerHTML;\n window.fileTitle = undefined;\n setFooter();\n\n langPair = [this.children[1].getAttribute(\"lang-code\"), this.children[2].getAttribute(\"lang-code\")];\n window.setSpellCheckerLanguages(langPair);\n\n fetchProject(this.getAttribute(\"project-id\"),\n this.getAttribute(\"is-imported\"),\n this.getAttribute(\"task\"));\n\n if (activeProject != null) {\n activeProject.classList.remove(\"active\");\n }\n this.classList.add(\"active\");\n activeProject = this;\n\n if (this.getAttribute(\"is-imported\") == \"true\") {\n document.getElementById(\"btn-create-new-project-package\").style.display = \"none\";\n document.getElementById(\"btn-create-return-project-package\").style.display = \"inline-block\";\n document.getElementById(\"btn-update-from-package\").style.display = \"none\";\n }\n else if (this.getAttribute(\"is-exported\") == \"true\") {\n document.getElementById(\"btn-create-return-project-package\").style.display = \"none\";\n document.getElementById(\"btn-update-from-package\").style.display = \"inline-block\";\n document.getElementById(\"btn-create-new-project-package\").style.display = \"inline-block\";\n }\n else {\n document.getElementById(\"btn-create-return-project-package\").style.display = \"none\";\n document.getElementById(\"btn-update-from-package\").style.display = \"none\";\n document.getElementById(\"btn-create-new-project-package\").style.display = \"inline-block\";\n }\n }\n\n if (project.due_datetime) {\n td = document.createElement(\"td\");\n td.className = \"deadline\";\n td.textContent = getDatetimeString(new Date(project.due_datetime));\n tr.appendChild(td);\n }\n\n if (project.notes) {\n tr.setAttribute(\"title\", project.notes);\n }\n\n projectsTable.prepend(tr);\n }\n tr = document.createElement(\"tr\");\n th = document.createElement(\"th\");\n th.className = \"name\";\n th.innerHTML = \"Project Name\";\n tr.append(th);\n th = document.createElement(\"th\");\n th.innerHTML = \"Source Language\";\n tr.append(th);\n th = document.createElement(\"th\");\n th.innerHTML = \"Target Language\";\n tr.append(th)\n th = document.createElement(\"th\");\n th.innerHTML = \"Deadline\";\n tr.append(th)\n projectsTable.prepend(tr);\n\n console.log(\"Projects fetched.\")\n }\n else if (this.readyState == 4 && this.status != 200) {\n console.error(\"Projects not fetched. Trying again in 2 seconds.\")\n setTimeout(() => {\n fetchProjects();\n }, 2000)\n }\n }\n\n xhttp.open(\"GET\", \"http://127.0.0.1:8000/\");\n xhttp.send();\n }", "title": "" }, { "docid": "6236dc7f63a6331c558eb033b696859a", "score": "0.53147936", "text": "function getProjects(employee, startWeeks, endWeeks, peDates, res){\n var projects = [];\n var tasks = [];\n\n var connection = new Connection(config);\n var sql = \"select DISTINCT(PJPENTEM.Pjt_entity) Task, PJPENT.pjt_entity_desc TaskDesc, \" +\n \"PJPENTEM.Project Proj, PJPROJ.project_desc ProjDesc, \" +\n \"PJPENT.pe_id01 TaskSub, PJPROJ.gl_subacct ProjSub, \" +\n\t\t\t\t\t\t\"PJPENT.pe_id03 EarnType, PJPROJ.alloc_method_cd BillTo \" +\n \"from dbo.PJPENTEM \" +\n \"inner join dbo.PJPENT \" +\n \"on PJPENT.pjt_entity = PJPENTEM.Pjt_entity \" +\n \"inner join dbo.PJPROJ \" +\n \"on PJPROJ.project = PJPENTEM.Project \" +\n \"where (PJPENTEM.Employee = @employee \" +\n \"OR PJPENT.project = 'WWTAS1FRNG1020') \" +\n \"AND PJPROJ.status_pa = 'A' \" +\n \"AND PJPENT.status_pa = 'A'\";\n\n var request = new Request(sql, function(err, rowCount) {\n if (err) {\n console.log(err);\n\t\t\t\tres.send(500, {success: false});\n } else {\n\t\t\t\t//we've got what we can from this pull and started building the response\n\t\t\t\t//next step is get default GL Account info\n getGLDefaults({success: true, userId: employee, startWeeks: startWeeks,\n endWeeks: endWeeks, peDates: peDates, projects: projects, tasks: tasks}, res);\n }\n });\n\n request.addParameter('employee',TYPES.VarChar, employee);\n\n\n request.on('row', function(columns) {\n var rowProject = {proj: columns[2].value.trim(), projDesc: columns[3].value.trim()};\n if (alreadyIn(projects, rowProject) == false){\n projects.push(rowProject);\n }\n\n\n var subAcct;\n if (columns[4].value.trim()){\n subAcct = columns[4].value.trim();\n } else {\n subAcct = columns[5].value.trim();\n }\n\t\t\tvar billable;\n\t\t\tif (columns[7].value.trim()){\n\t\t\t\tbillable = true;\n\t\t\t} else {\n\t\t\t\tbillable = false;\n\t\t\t}\n\n tasks.push({task: columns[0].value.trim(), taskDesc: columns[1].value.trim(),\n proj: columns[2].value.trim(), projDesc: columns[3].value.trim(),\n subAcct: subAcct, earnType: columns[6].value.trim(), billable: billable});\n });\n\n connection.on('connect', function(err){\n if (err) {\n console.log(err);\n } else {\n connection.execSql(request);\n }\n });\n}", "title": "" }, { "docid": "a5a2f97f006c64d34b110928b5692d2f", "score": "0.53093415", "text": "function getFieldsFromWorksheet(worksheet){\n // Return the promise for getSummaryDataAsync()\n return worksheet.getSummaryDataAsync().then(function(response) {\n // Return the columns array\n return response.columns;\n })\n }", "title": "" }, { "docid": "51db682484cf52426b61906c520e04e1", "score": "0.5304111", "text": "allData() {\n const sql = 'SELECT * FROM courses';\n return this.db.many(sql);\n }", "title": "" }, { "docid": "798e88c3bb85bd28348f6f01cefc57fe", "score": "0.5300902", "text": "get columnPairs() {\n return null;\n }", "title": "" }, { "docid": "5bf5229ce62bb70532f5ee7f4766f100", "score": "0.5297551", "text": "function getGridColumns(columns) {\r\n\tvar gridDisplayColumns = '', gridHeaderColumns = '', label = '';\r\n\tcolumns.filter(function (obj) {\r\n\t\t\t\treturn obj.showInGrid;\r\n\t\t\t})\r\n\t\t\t.forEach(function (element, index, array) {\r\n if(element.type === 'Reference'){\r\n gridDisplayColumns += '<div class=\"col-1\">${'+element.name+'.'+element.referenceFieldName+'}</div>';\r\n }else{\r\n\t\t\t\t gridDisplayColumns += '<div class=\"col-1\">${'+\r\n (element.type === 'Date' ? 'app.formatDate('+element.name+')' : element.name )\r\n +'}</div>';\r\n }\r\n label = (element.label === undefined) ? element.name : element.label;\r\n\t\t\t\tgridHeaderColumns += '<div class=\"col-1\">'+\r\n\t\t\t\t\t\t\t\t\t(element.sortable ? '<a href=\"#\" data-sort-expression=\"' + element.name +\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\" data-sort-order=\"none\">'+label+'</a>' \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: label)\r\n\t\t\t\t\t\t\t\t\t +'</div>';\r\n\t\t\t\tif (index + 1 < array.length) {\r\n\t\t\t\t\tgridDisplayColumns += '\\r\\t\\t\\t';\r\n\t\t\t\t\tgridHeaderColumns += '\\r\\t\\t\\t';\r\n\t\t\t\t}\r\n\t\t\t});\r\n\treturn { header: gridHeaderColumns, display: gridDisplayColumns};\r\n}", "title": "" }, { "docid": "40c18d5e24b9a172009b17e7c1844366", "score": "0.529423", "text": "fetchAll() {\n const sql = 'SELECT r.id, r.title, r.salary, d.name AS department FROM role r LEFT JOIN department d ON d.id = r.department_id';\n return this.db.query(sql)\n .then(([rows, junk]) => {\n return rows;\n });\n }", "title": "" }, { "docid": "4ee24e7376aa65bc1ab6d76cae25d66d", "score": "0.5292652", "text": "_setupColumns() {\n let processedColumns = new A(get(this, 'columns').map(column => {\n let c = ColumnDefinition.create(column);\n\n if(isNone(c.get('sortPath'))) {\n c.set('sortPath', c.get('contentPath'));\n }\n\n return c;\n }));\n\n return processedColumns;\n }", "title": "" }, { "docid": "084da277e5fdee70fadc08b604b15209", "score": "0.52902204", "text": "async function getProjects(){\n // const session = await Auth.currentUserInfo();\n // const clientID = await session.attributes.sub;\n let response = await fetch(`${config.api.invokeUrl}/users/${clientID}`);\n // let response = await fetch(`${config.api.invokeUrl}/users/${11111}`);\n let data = await response.json();\n setProjects(data.projects)\n }", "title": "" }, { "docid": "ebf32b4d954bfe94e913cd42f47c8776", "score": "0.52865434", "text": "get columns() {\n return this._columns;\n }", "title": "" }, { "docid": "ebf32b4d954bfe94e913cd42f47c8776", "score": "0.52865434", "text": "get columns() {\n return this._columns;\n }", "title": "" }, { "docid": "50e40b75b887b0d76cb9b1b836fa45af", "score": "0.52820015", "text": "function all() {\n var deferred = $q.defer(); // init promise\n LocalStorageFactory.getDb().projectDb.iterate(function (value, key) {\n if (key === 'active_datasets') activeDatasets = value;\n else if (key === 'spots_dataset') spotsDataset = value;\n else if (key.startsWith('dataset_')) currentDatasets.push(value);\n else if (key.startsWith('spots_')) spotIds[key.split('_')[1]] = value;\n else currentProject[key] = value;\n }).then(function () {\n $log.log('Finished loading current project:', currentProject);\n $log.log('Finished loading current datasets:', currentDatasets);\n $log.log('Finished loading active datasets:', activeDatasets);\n $log.log('Finished loading spots dataset', spotsDataset);\n $log.log('Finished loading spots in datasets', spotIds);\n deferred.resolve();\n });\n return deferred.promise;\n }", "title": "" }, { "docid": "c5a49c71eb3ec614475dd9ccd87a3e2a", "score": "0.52775216", "text": "get fieldsAsColumns() {\n return self.columns.reduce((res, column) => {\n if (!column.parent) {\n res.push(...column.asField);\n }\n return res;\n }, []);\n }", "title": "" }, { "docid": "84736867089369189eeccaf82719e743", "score": "0.5277259", "text": "function GetAllProjects() {\r\n debugger;\r\n var getData = apiService.getList(\"Project/getAllProj\");\r\n debugger;\r\n getData.then(function (proj) {\r\n $scope.projects = proj.data;\r\n }, function () {\r\n alert('Error in getting records');\r\n });\r\n }", "title": "" }, { "docid": "0002e256e47af2ee27a966b25d9a0f6d", "score": "0.5277098", "text": "function getTasks() {\n return db(\"tasks\")\n .join(\"projects\", \"tasks.projectID\", \"projects.id\")\n .select(\n \"tasks.id\",\n \"projects.projectName\",\n \"projects.projectDescription\",\n \"tasks.taskDescription\",\n \"tasks.taskNotes\",\n \"tasks.completed\"\n );\n}", "title": "" }, { "docid": "9ad51bcb3299dbb25e90e3ca6caad245", "score": "0.5273837", "text": "function readColumns(root, columns) {\n columns = columns || [];\n\n if (angular.isDefined(root.rows)) {\n angular.forEach(root.rows, function (row) {\n angular.forEach(row.columns, function (col) {\n columns.push(col);\n // keep reading columns until we can't any more\n readColumns(col, columns);\n });\n });\n }\n\n return columns;\n }", "title": "" }, { "docid": "eadc064b58b0ac7ea0edfc1cc98d84f5", "score": "0.52664524", "text": "async function getColumnsData(sheetId) {\n const query =\n \"SELECT * FROM fields_meta_data where sheet_id = \" +\n sheetId +\n \" ORDER BY field_id \";\n\n try {\n // Fetch data as JSON\n const data = await allQuery(query);\n return data;\n } catch (err) {\n console.error(\"Error executing query:\", err.message);\n } finally {\n }\n}", "title": "" }, { "docid": "06486ee85a43f8a5be1e5899b4e518b0", "score": "0.52659535", "text": "columns() {\n let distinct = false;\n if (this.onlyUnions()) return ''\n const columns = this.grouped.columns || []\n let i = -1, sql = [];\n if (columns) {\n while (++i < columns.length) {\n const stmt = columns[i];\n if (stmt.distinct) distinct = true\n if (stmt.type === 'aggregate') {\n sql.push(this.aggregate(stmt))\n }\n else if (stmt.value && stmt.value.length > 0) {\n sql.push(this.formatter.columnize(stmt.value))\n }\n }\n }\n if (sql.length === 0) sql = ['*'];\n return `select ${distinct ? 'distinct ' : ''}` +\n sql.join(', ') + (this.tableName\n ? ` from ${this.single.only ? 'only ' : ''}${this.tableName}`\n : '');\n }", "title": "" }, { "docid": "7a8f2e0f6785fac527c1456dcfbdd697", "score": "0.5255218", "text": "getAssociatedGridColumns(grid, currentColumns) {\n const columns = [];\n const gridColumns = grid.getColumns();\n if (currentColumns && Array.isArray(currentColumns)) {\n currentColumns.forEach((currentColumn, index) => {\n const gridColumn = gridColumns.find((c) => c.id === currentColumn.columnId);\n if (gridColumn && gridColumn.id) {\n columns.push(Object.assign({}, gridColumn, { cssClass: currentColumn.cssClass, headerCssClass: currentColumn.headerCssClass, width: currentColumn.width }));\n }\n });\n }\n this._columns = columns;\n return columns;\n }", "title": "" }, { "docid": "d54623876bdd22ad2757321cacf514a9", "score": "0.5240376", "text": "static async getAll(collectionName, projection) {\n try {\n const db = mongodb.getDB();\n let resultSet = await db.db().collection(collectionName).find(SOFT_DELETE_FIND_QUERY).project(projection).toArray();\n\n return resultSet;\n } catch (err) {\n throw err;\n }\n }", "title": "" }, { "docid": "3a61437e0708455970395a62d3898b72", "score": "0.5236739", "text": "async obtenerFacturaExportes() {\n let query = `select f.facturaexportacionid, facnumero, f.compradorid,e.emprazonsocial as comprador,f.vendedorid, em.emprazonsocial as vendedor, TO_CHAR(facfecha, 'YYYY-MM-DD')as facfecha,\n facpuertoembarque, facpuertodestino, facvapor, facsubtotal12,facsubtotal0,facsubtotalsiniva, facsubtotalivaexcento, facsubtotalsinimpuestos,\n factotaldesc,facice,faciva12,facirbpn,facvalortotal,facformapago,facplazo,factiempo,facdae,facpesoneto,faclote,facpesobruto,faccontenedor,facsemana,TO_CHAR(facfechazarpe, 'YYYY-MM-DD')as facfechazarpe,facmarca,faccertificaciones from facturaexportacion f join empresa e on e.empresaid = f.compradorid\n join empresa em on em.empresaid =f.vendedorid`\n let result = await pool.query(query);\n return result.rows;\n // return result.rows; // Devuelve el array de json\n }", "title": "" }, { "docid": "d1e9c55ba77e24ffd8f22e01013b6b86", "score": "0.5236124", "text": "getColumns() {\n return this._columns;\n }", "title": "" }, { "docid": "110ca062b755b33c81f8b6eea25b3b3d", "score": "0.5230912", "text": "function getDataColumns(data) {\n let len = data.fieldscount;\n let fields_ = [], val;\n let otherfields_ = [];\n\n for(let i = 0; i < len; i++) {\n if(data['row_' + i] == \"n_0\") {\n val = null;\n } else if(data['row_' + i] == \"n_f\") {\n // val = data['newfield_' + i];\n otherfields_.push({name: data['newfield_' + i], num: i});\n // otherfields[data['newfield_' + i]] = '';\n } else {\n val = data['row_' + i]\n }\n fields_.push(val);\n }\n\n if(Object.keys(otherfields_).length) {\n otherfields = otherfields_;\n fields_.push({otherfields});\n }\n console.log('FILS ARE = ' + JSON.stringify(fields_));\n return fields_;\n }", "title": "" }, { "docid": "2f2fc60b06bfc9d7e480ab0c0e3e48bf", "score": "0.52291226", "text": "function getTasks(){\n return db.select(['*', 'tasks.id as id', 'projects.id as project_id'])\n .from('tasks')\n .leftJoin('projects', 'tasks.project_id' , 'projects.id')\n}", "title": "" }, { "docid": "bced63324241384f96a892d5dfdb19f9", "score": "0.5223107", "text": "projectTargets(projectID) {\n\n // Return all\n let proj = this.object(projectID).value\n return proj.targets.map(targetInfo => {\n\n // Fetch object\n return this.object(targetInfo.value)\n\n })\n\n }", "title": "" }, { "docid": "38ffc2f2f2386fc5b81ccd4659f0ae8b", "score": "0.5221667", "text": "async list({ fields = [] } = {}) {\n const dbService = await this.service('dbService');\n const table = this.tableName;\n\n // The scanner route\n const result = await dbService.helper\n .scanner()\n .table(table)\n .filter('attribute_exists(latest)')\n .limit(2000)\n .projection(fields)\n .scan();\n return _.map(result, item => toDataObject(item));\n }", "title": "" }, { "docid": "186a19828384451420897af7bd82c8ba", "score": "0.5211927", "text": "function getProjectsByResourceID(resourceID, on_success) {\n var url = baseUrl + 'api/index.cgi?method=get_projects' + '&ip_block_id=' + resourceID.toString();\n fetch(url, {\n method: 'get',\n credentials: 'include'\n }).then(function(response) {\n\n response.json().then(function(json) {\n console.log(json);\n on_success(json.results);\n });\n\n }).catch(function(err) {\n console.log(err);\n });\n}", "title": "" }, { "docid": "c31b8cd724e3857a69dd63a99f21c19c", "score": "0.5205688", "text": "function load_projects() {\n var xmlhttp = new XMLHttpRequest();\n \n xmlhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n var projects = JSON.parse(this.responseText);\n var count = 0;\n var left = false;\n\n for ([key, value] of Object.entries(projects)) {\n if (count < 4) {\n // Fill highlights\n if (left) {\n feature_project(value, 'left');\n } else {\n feature_project(value, 'right');\n }\n left = !left;\n count += 1;\n } else {\n project_grid(value);\n }\n }\n }\n };\n \n xmlhttp.open(\"GET\", \"/v6/projects/project_info.php?get_list=1\", true);\n xmlhttp.send();\n }", "title": "" }, { "docid": "61fbaa7899476368cb168f0a629b6249", "score": "0.52002794", "text": "columns() {\n let distinctClause = '';\n if (this.onlyUnions()) return '';\n const columns = this.grouped.columns || [];\n let i = -1,\n sql = [];\n if (columns) {\n while (++i < columns.length) {\n const stmt = columns[i];\n if (stmt.distinct) distinctClause = 'distinct ';\n if (stmt.distinctOn) {\n distinctClause = this.distinctOn(stmt.value);\n continue;\n }\n if (stmt.type === 'aggregate') {\n sql.push(...this.aggregate(stmt));\n } else if (stmt.type === 'aggregateRaw') {\n sql.push(this.aggregateRaw(stmt));\n } else if (stmt.value && stmt.value.length > 0) {\n sql.push(this.formatter.columnize(stmt.value));\n }\n }\n }\n if (sql.length === 0) sql = ['*'];\n return (\n `select ${distinctClause}` +\n sql.join(', ') +\n (this.tableName\n ? ` from ${this.single.only ? 'only ' : ''}${this.tableName}`\n : '')\n );\n }", "title": "" }, { "docid": "527c84206c28639fe7144764fa912a62", "score": "0.5198908", "text": "function printProjectData() {\n \n }", "title": "" }, { "docid": "0e6f1d27b6d82e1adc24626a8524e3a4", "score": "0.51986057", "text": "function get_column_specs()\r\n {\r\n return my_column_specs\r\n }", "title": "" }, { "docid": "8f4947db894a70979b4fda4bcae9dd00", "score": "0.51981825", "text": "function getColumns(model, rtablas, Data) {\r\n // var model = [{ field: '$estado', visible: true, name: '$D', datatype: '$estado', readOnly: true }]\r\n var result = model.filter(m => (m.visible)).map(m => parseModelAsColumn(m.field, m, rtablas, Data));// Desacoplar\r\n return result;\r\n }", "title": "" }, { "docid": "aa04b81ed14fb8e4f38dab8a56f94243", "score": "0.51871556", "text": "getColumns(){\n return this.columns;\n }", "title": "" }, { "docid": "58a7f7ade05b4c5bffffbacafb5b1d8a", "score": "0.51851505", "text": "static findAll() {\n\t\treturn db.query('select * from ??', [DEVELOPER])\n\t\t\t.then(rows => rows.map(row => new Developer(row)));\n\t}", "title": "" }, { "docid": "09871fddb3dcc7ecb92472ffa6afd6ec", "score": "0.5172817", "text": "fetchAllData() {\n this.fetchListings();\n this.fetchOrgs();\n this.fetchPendingOrgs();\n this.fetchVenues();\n this.fetchPendingVenues();\n }", "title": "" }, { "docid": "5dfb9ab296688ef406ab1f768b83c864", "score": "0.51697433", "text": "async deploy() {\n let column = this.column;\n if (!column) {\n const keyData = await this.mysql.getPrimaryKey(this.table);\n column = keyData[0].Column_name;\n }\n this._setColumn(column);\n\n await this.listTopRows(column);\n }", "title": "" }, { "docid": "ee843fb88737ea187dda75d215a4bf82", "score": "0.5169403", "text": "function _getProjects (cb) {\n _gitlabRequest('GET', '/projects?per_page=100', cb);\n }", "title": "" }, { "docid": "f77a9d6fa94f58aeedcc83580d55ce93", "score": "0.5167395", "text": "function readColumns(root, columns) {\n columns = columns || [];\n\n if (angular.isDefined(root.rows)) {\n angular.forEach(root.rows, function (row) {\n angular.forEach(row.columns, function (col) {\n columns.push(col);\n // keep reading columns until we can't any more\n readColumns(col, columns);\n });\n });\n }\n\n return columns;\n }", "title": "" }, { "docid": "82ca0cf3ff166c091331f0d726c0c41a", "score": "0.5162459", "text": "function getAllprojects(req,res){\n Project.find(function(err,projects){\n if (err) {\n res.send(500,err.message);\n } else {\n res.json(projects);\n };\n });\n}", "title": "" }, { "docid": "b28a10fc46e7c270abaabaec654f2988", "score": "0.5160713", "text": "get _columnDefinitions() {\r\n return (this._grid && this._grid.getColumns) ? this._grid.getColumns() : [];\r\n }", "title": "" }, { "docid": "84a531da2b3aca45bd7597b29a7bb264", "score": "0.51502657", "text": "async columnsInfo(table, column) {\n const query = this.knexClient.select(table);\n const result = await (column ? query.columnInfo(column) : query.columnInfo());\n return result;\n }", "title": "" }, { "docid": "f4d1921229819787cb5883da510a72c6", "score": "0.5149444", "text": "function fetchProject(projectId, isImported, task) {\n let files;\n let filesKeys;\n let xhttp = new XMLHttpRequest();\n\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n responseJSON = JSON.parse(this.responseText);\n\n files = responseJSON.files;\n filesKeys = Object.keys(files);\n\n filesTable.innerHTML = \"\";\n\n tr = document.createElement(\"tr\");\n th = document.createElement(\"th\");\n th.className = \"name\";\n th.innerHTML = \"File Name\";\n tr.append(th);\n\n filesTable.append(tr);\n\n for (i = 0; i < filesKeys.length; i++) {\n fId = filesKeys[i];\n tr = document.createElement(\"tr\");\n tr.setAttribute(\"file-id\", fId);\n tr.setAttribute(\"file-path\", files[fId].path);\n tr.setAttribute(\"can-generate-target-file\", files[fId].can_generate_target_file);\n\n td = document.createElement(\"td\");\n td.innerHTML = files[fId].title;\n tr.append(td);\n\n tr.ondblclick = function() {\n window.fileTitle = this.getElementsByTagName(\"td\")[0].innerHTML;\n setFooter();\n\n fetchSegments(projectId,\n this.getAttribute(\"file-id\"),\n this.getAttribute(\"can-generate-target-file\"),\n task);\n\n if (activeFile != null) {\n activeFile.classList.remove(\"active\");\n }\n this.classList.add(\"active\");\n activeFile = this;\n }\n tr.oncontextmenu = function(e) {\n openFileContextMenu(e,\n this.getAttribute(\"file-id\"),\n this.getAttribute(\"file-path\"),\n this.getAttribute(\"can-generate-target-file\"),\n isImported,\n task);\n }\n\n filesTable.append(tr);\n }\n\n reports = responseJSON.reports;\n reportsKeys = Object.keys(reports);\n\n projectReportsTable = document.getElementById(\"reports-table\").tBodies[0];\n projectReportsTable.innerHTML = \"<tr><th><h4>Reports</h4></th></tr>\"\n\n if (reportsKeys.length === 0) {\n tr = document.createElement(\"tr\");\n\n td = document.createElement(\"td\");\n td.textContent = \"-\";\n tr.appendChild(td);\n\n projectReportsTable.appendChild(tr);\n }\n\n for (i = reportsKeys.length - 1; i >= 0; i--) {\n report = reports[reportsKeys[i]];\n reportDateString = getDatetimeString(new Date(report.timestamp));\n\n tr = document.createElement(\"tr\");\n tr.id = reportsKeys[i];\n tr.setAttribute(\"json\", report.json)\n tr.ondblclick = function() {\n viewProjectReport(this);\n }\n\n td = document.createElement(\"td\");\n td.textContent = reportDateString;\n tr.appendChild(td);\n\n projectReportsTable.appendChild(tr);\n }\n\n reportTable = document.getElementById(\"project-report\");\n reportTable.innerHTML = \"<tr>\"\n + \"<th class=\\\"name\\\"></th><th>Repetitions</th><th>100%</th><th>95%-99%</th><th>85%-94%</th><th>75%-84%</th><th>50%-74%</th><th>New</th><th>Total</th>\"\n + \"</tr><tr>\"\n + \"<td class=\\\"name\\\">-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td>\"\n + \"</tr>\"\n\n filesView.setAttribute(\"cur-p-id\", projectId);\n toggleView(\"files-view\", \"grid\", \"files-header\", \"btn-files-view\");\n document.getElementById(\"btn-files-view\").disabled = false;\n }\n }\n\n xhttp.open(\"GET\", \"http://127.0.0.1:8000/project/\" + projectId);\n xhttp.send();\n }", "title": "" }, { "docid": "5b227b113e8a9d95553947ffc48ad2bc", "score": "0.5147229", "text": "function gv() {\r\n return grid.getVisibleColumnManager().getColumns();\r\n }", "title": "" }, { "docid": "dc3c571669c61add1eeb5e8ca63335fa", "score": "0.51416546", "text": "getProjectsForPlanningGrid(feature_class_name) {\n return new Promise((resolve, reject) => {\n //get a list of the projects for the planning grid\n this._get(\n \"listProjectsForPlanningGrid?feature_class_name=\" + feature_class_name\n ).then((response) => {\n resolve(response.projects);\n });\n });\n }", "title": "" }, { "docid": "62a1129e7a5dc69aff69dae588bd57a8", "score": "0.5136571", "text": "function retrieveGridVisibleColumns(grid) {\n var visibleColumns = [];\n var length = grid.columns.length;\n for (var i = 0; i < length; i++) {\n var column = grid.columns[i];\n if (!column.hidden) {\n visibleColumns.push(column.field);\n }\n }\n return visibleColumns;\n }", "title": "" }, { "docid": "66b85ba4f3535a13988edac2735812d9", "score": "0.51355386", "text": "function getCurrentColumns(tabId) {\n var textDivs = $('.text-section', $(tabId)), columns = [];\n $.each(textDivs, function(i, div){\n columns.push($(div).attr('collection'));\n });\n return columns;\n}", "title": "" }, { "docid": "7333b2910a84c0da899f1183ce33b9aa", "score": "0.513471", "text": "buildColumns(){\n\t\t\n\t\tlet output = []\n\n\t\t// Enumerates the react-table properties that can be set via props\n\t\tlet supportedReactTableColumnProps = [\n\t\t\t\"filterable\",\n\t\t\t\"sortable\",\n\t\t\t\"resizable\",\n\t\t\t\"width\",\n\t\t\t\"minWidth\",\n\t\t\t\"maxWidth\"\n\t\t]\n\t\t\n\t\tfor(let col of this.props.columns){\n\t\t\t\n\t\t\t// Fetch the supported react-table properties from the columns\n\t\t\tlet reactTableColumnProps = pick(col, supportedReactTableColumnProps)\n\n\t\t\tlet obj = {\n\t\t\t\tHeader : col.label,\n\t\t\t\tid: col.id,\n\t\t\t\taccessor: (d => (d[col.id] !== null ? d[col.id].toString() : \"\")), // Defaulty make accessor the ID\n\t\t\t\t...reactTableColumnProps\n\t\t\t}\n \n\t\t\t// Determine if custom Filter UI Component is being utilized\n\t\t\tif(\"custom_filter_ui\" in col){\n\t\t\t\t\n\t\t\t\tswitch(col.custom_filter_ui){\n\t\t\t\t\t\n\t\t\t\t\tcase \"UniqueValuesSelectFilter\" : {\n\t\t\t\t\t\tobj[\"Filter\"] = (({filter, onChange}) => UniqueValuesSelectFilter(filter, onChange, this.state.data, col.id));\n\t\t\t\t\t\tobj[\"filterable\"] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tcase \"ArrayValuesSelectFilter\" : {\n\t\t\t\t\t\tobj[\"Filter\"] = (({filter, onChange}) => ArrayValuesSelectFilter(filter, onChange, col.custom_filter_array));\n\t\t\t\t\t\tobj[\"filterable\"] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdefault : {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// Determine if a custom accessor function is being utilized\n\t\t\tif(\"custom_accessor\" in col){\n\t\t\t\t\n\t\t\t\tswitch(col.custom_accessor.method){\n\t\t\t\t\t\n\t\t\t\t\tcase \"ArrayTabularDataAccessor\": {\n\t\t\t\t\t\tobj[\"accessor\"] = (d => ArrayTabularDataAccessor(d, col.id, col.custom_accessor.keys))\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tdefault : {\n\t\t\t\t\t\tobj[\"accessor\"] = (d => (d[col.id] !== null ? d[col.id].toString() : \"\"));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Determine if a custom output formatter function is being utilized\n\t\t\t\tif(\"formatter\" in col.custom_accessor){\n\t\t\t\t\t\n\t\t\t\t\tlet showLabel = col.custom_accessor.formatter.show_label;\n\t\t\t\n\t\t\t\t\t// Display data based on the specified custom formatter\n\t\t\t\t\tswitch(col.custom_accessor.formatter.method){\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"BulletedListFormatter\": {\n\t\t\t\t\t\t\tobj[\"Cell\"] = ( cellData => {\n\t\t\t\t\t\t\t\treturn BulletedListFormatter(cellData.value, showLabel)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tdefault : {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput.push(obj)\t\n\t\t}\n\t\treturn output;\n\t}", "title": "" }, { "docid": "c8a0495da1ea02cbada778c544b9a5c9", "score": "0.5132128", "text": "async function getAll() {\n let response = await client.select('id', 'name', 'construction_site', 'volume_cubic_meter', 'cost_cubic_meter', 'color', 'delivery_date')\n .from(TABLE);\n \n return response;\n}", "title": "" }, { "docid": "bcd59f8eaeb9c663ff8bc554078782a7", "score": "0.5128997", "text": "getColumns () {\n return [{\n id: 'page_id',\n alias: 'Page ID',\n dataType: this.tableauDataTypeObject.int\n }, {\n id: 'page_name',\n alias: 'Name',\n dataType: this.tableauDataTypeObject.string\n }, {\n id: 'page_category',\n alias: 'Category',\n dataType: this.tableauDataTypeObject.string\n }, {\n id: 'page_image',\n alias: 'Picture',\n dataType: this.tableauDataTypeObject.string\n }, {\n id: 'page_about',\n alias: 'About',\n dataType: this.tableauDataTypeObject.string\n }, {\n id: 'page_link',\n alias: 'Link',\n dataType: this.tableauDataTypeObject.string\n }]\n }", "title": "" }, { "docid": "dfedc0f8827aa42a24a44763c28e9aeb", "score": "0.5116487", "text": "listByProject(req, res) {\n let sql = \"select * from vw_Kpis \" +\n \"where projectId = \" + req.params.projid + \" and active = 1\";\n logger.debug(`${callerType} create Kpi -> sql: ${sql}`);\n return models.sequelize\n .query(sql,\n {\n type: models.sequelize.QueryTypes.SELECT\n }\n )\n .then(_k => {\n logger.debug(`${callerType} listByProject -> successful, count: ${_k.length}`);\n res.status(201).send(_k);\n })\n .catch(error => {\n logger.error(`${callerType} listByProject -> error: ${error.stack}`);\n res.status(400).send(error);\n });\n }", "title": "" }, { "docid": "66383c2592059261b7034fc8688a7470", "score": "0.51155573", "text": "loadProjects()\n\t{\n\t\tconsole.log('----- loadProjects -----');\n\t\t// INSERT YOUR CODE HERE\n\t\tapi.makeRequest('GET', `/t-api/companies/${this.company_id}/projects`, {}, this.fillProjectsWithResponse.bind(this));\n\n\t\tif(this.projects!= null)\n\t\t{\n\t\t\tthis.loadTimeEntries();\n\t\t}\n\n\t}", "title": "" }, { "docid": "fff1dc561401d17860c64364c437a95e", "score": "0.51113486", "text": "function ga() {\r\n return grid.getColumnManager().getColumns();\r\n }", "title": "" }, { "docid": "1e3496c48c0f75f112d18d1f6ed1f21a", "score": "0.51083523", "text": "function getProjects(prjid) {\n // console.log(prjid)\n var pagina = 'WorkInputContent/listProjects';\n var par = `[{\"pjt_id\":\"${prjid}\"}]`;\n var tipo = 'json';\n var selector = putProjects;\n fillField(pagina, par, tipo, selector);\n}", "title": "" }, { "docid": "5d3877259aacdc25eee709dc49913ed1", "score": "0.5105071", "text": "async loadData () {\n this.setState({ loading: true, projects: [] })\n const response = await fetch(\n createRequestUri(this.props.query),\n { mode: 'cors' }\n )\n const responseBody = await response.json()\n this.setState({\n projects: responseBody.items,\n loading: false\n })\n }", "title": "" }, { "docid": "9715600dae1a0f90abd8aee8ffdafb24", "score": "0.51048404", "text": "function getProjects(on_success) {\n fetch(baseUrl + 'api/index.cgi?method=get_projects', {\n method: 'get',\n credentials: 'include'\n }).then(function(response) {\n\n response.json().then(function(json) {\n console.log(json);\n on_success(json.results);\n });\n\n }).catch(function(err) {\n console.log(err);\n });\n}", "title": "" }, { "docid": "18031dcc345ee1cc6f64a818ca6bb058", "score": "0.5101832", "text": "queryAll() {\n\t\tvar promise = new Promise((resolve, reject) => { // LIMIT 0, 500\n\t\t\tthis.db.all(\"SELECT _id, title, category, modified FROM markdown WHERE category is NULL ORDER BY title\", function(err, row) {\n\t\t\t\tif (err) {\n\t\t\t\t\treject(err)\n\t\t\t\t} else {\n\t\t\t\t\tresolve(row)\n\t\t\t\t}\n\t\t\t})\n\n\t\t})\n\t\treturn promise;\n\t}", "title": "" }, { "docid": "635c21c9d5b6254883fb86f8b2fadb33", "score": "0.51008016", "text": "function allProjects(userId) {\n return db('projects')\n .where({ user_id: userId })\n}", "title": "" }, { "docid": "405f5a8b3313a3de529adbd173bc20a3", "score": "0.5098418", "text": "function getVisibleColumns() {\n \n var allHeaders = $rootScope.headerColumnStatus;\n var visibleColumns = [];\n \n for (var i = 0; i < allHeaders.length; i++) {\n if(allHeaders[i].visible != false) {\n visibleColumns.push(allHeaders[i].name);\n }\n }\n return visibleColumns;\n }", "title": "" }, { "docid": "7a0b0686715de5abaed39331f87b08c9", "score": "0.50977695", "text": "function populateDetailColumn(projectId) {\n // Update the current project id stored in the detail column to that of the newly displayed project.\n detailColumn.data('currentProjectId', projectId);\n\n // Store a reference to the current detail container being displayed and hide it.\n let current = $('.show').addClass('hide').removeClass('show');\n\n // Store a reference to the new detail container to be displayed.\n let container = $('.detail-container').filter(function (index, element) {\n return $(element).data('projectId') === projectId;\n });\n\n // Disable the display of the current project details.\n current.addClass('no-display');\n\n // Enable the display of the new project details.\n container.removeClass('no-display');\n\n // Change the z-index of the shadow box to be above the non-focused project cards and start its fade-in\n // animation.\n shadowBox.css('z-index', '1').addClass('show-shadow').removeClass('hide-shadow');\n\n // Start new project details container's fade-in animation.\n container.addClass('show').removeClass('hide');\n }", "title": "" } ]
eb1615bf794b9cd5865b9650b14e715c
STATE UPDATES Used to get the editor into a consistent state again when options change.
[ { "docid": "7688cc241473ef10008d30311cab8e70", "score": "0.0", "text": "function loadMode(cm) {\n\t cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);\n\t resetModeState(cm);\n\t }", "title": "" } ]
[ { "docid": "f7b3adbea9126e40d32ca2b21e25ce19", "score": "0.6985878", "text": "function EditorState() {\n\t}", "title": "" }, { "docid": "ce6c5078077292e5cff0084765814c8d", "score": "0.646162", "text": "function updateEditorMode() {\n\tif (!EDITOR) {\n\t\treturn;\n\t}\n\tlet text = getTextFromEditorRaw();\n\tif (!text) {\n\t\t// This check is needed to prevent intermediate\n\t\t// states when the editor has been cleared in preparation\n\t\t// for new contents.\n\t\t// console.log(\"EDITOR IS EMPTY\");\n\t\treturn;\n\t}\n\tlet shorttext = text.substring(0, 2000);\n\tlet xmod = getMode(shorttext);\n\tif (xmod !== EditorMode) {\n\t\tEditorMode = xmod;\n\t\tsetEditorModeAndKeyboard();\n\t\tconsole.log(\"Changing to\", xmod, \"mode.\");\n\t}\n}", "title": "" }, { "docid": "eea86745770f288b218886facb2c05b2", "score": "0.64495224", "text": "function setState() {\n if (state_.selected == \"eval\")\n state_.eval = textarea_.value;\n else if (state_.selected == 'log')\n state_.eval = CONSOLE_LOG;\n else if (state_.selected == 'highlight')\n state_.eval = HIGHLIGHT;\n else if (state_.selected == 'font_color')\n state_.eval = FONT_COLOR;\n else if (state_.selected == 'warning_icon')\n state_.eval = WARNING_ICON;\n\n return new Promise(resolve => {\n chrome.storage.sync.set({state: state_}, result => {\n chrome.runtime.sendMessage({updateCode: \"true\"}, (response) => resolve());\n });\n });\n }", "title": "" }, { "docid": "2e18571ce16f78592dec4c0660d58e73", "score": "0.63010013", "text": "function updateEditState(){\n setEditState(false)\n setValue(props.text)\n alterDataByKeyValue();\n }", "title": "" }, { "docid": "d29a8e4bd63d6ec34d9275305d9c5754", "score": "0.6149379", "text": "function configChanged(option, state) {\n currentState[option] = state;\n return isModified();\n }", "title": "" }, { "docid": "fa1ef18d85819475277bfbdf943993df", "score": "0.6136856", "text": "forceUpdateState(props = this.props) {\n // Convert incoming to somethign draft-js friendly\n const content = convertContentFrom(props.value, props.type);\n\n // Generate new date\n const updatedEditorState = EditorState.push(this.state.editorState, content);\n\n // Update\n this.handleEditorChange(updatedEditorState);\n }", "title": "" }, { "docid": "f5069941d33047bfa752265349d94c2e", "score": "0.6061418", "text": "function updateVolumesChangesState() {\n var isSomeVolumeChanged = lodash.some(ctrl.volumes, ['ui.changed', true]);\n var isSomeVolumeInEditMode = lodash.some(ctrl.volumes, ['ui.editModeActive', true]);\n\n lodash.set(ctrl.version, 'ui.isVolumesChanged', isSomeVolumeChanged && isSomeVolumeInEditMode);\n }", "title": "" }, { "docid": "455eb3462a43190dfbb0ec33d7b4fdb9", "score": "0.60400164", "text": "function changedOptions () {\r\n\t\t // If path option changed, update any open search result \r\n\t\t if (reversePath_option_old != options.reversePath) {\r\n\t\t\t// Update displayed HN\r\n\t\t\tif (cellHighlight != null) {\r\n\t\t\t displayHN(cellHighlight.parentElement.dataset.id);\r\n\t\t\t}\r\n\t\t }\r\n\t\t // If match FF theme option changed\r\n\t\t if (matchTheme_option_old != options.matchTheme) {\r\n\t\t\tif (options.matchTheme) {\r\n\t\t\t // Align colors with window theme \r\n\t\t\t browser.theme.getCurrent(myWindowId)\r\n\t\t\t .then(setPanelColors);\r\n\r\n\t\t\t // Register listener\r\n\t\t\t browser.theme.onUpdated.addListener(themeRefreshedHandler);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t resetPanelColors();\r\n\r\n\t\t\t // Remove listener\r\n\t\t\t browser.theme.onUpdated.removeListener(themeRefreshedHandler);\r\n\t\t\t}\r\n\t\t }\r\n\t\t // If set colors option changed, or if one of the colors changed while that option is set\r\n\t\t if (setColors_option_old != options.setColors\r\n\t\t\t || (options.setColors && ((textColor_option_old != options.textColor)\r\n\t\t\t\t\t\t\t\t\t || (bckgndColor_option_old != options.bckgndColor)\r\n\t\t\t\t \t\t\t\t\t )\r\n\t\t\t\t )\r\n\t\t\t ) {\r\n\t\t\tif (options.setColors) {\r\n\t\t\t // Align colors with chosen ones \r\n\t\t\t setPanelColorsTB(options.textColor, options.bckgndColor);\r\n\t\t\t}\r\n\t\t\telse { // Cannot change while machTheme option is set, so no theme to match, reset ..\r\n\t\t\t resetPanelColors();\r\n\t\t\t}\r\n\t\t }\r\n\t\t // If folder image options changed\r\n\t\t if ((options.useAltFldr && (altFldrImg_option_old != options.altFldrImg))\r\n\t\t\t || (useAltFldr_option_old != options.useAltFldr)\r\n\t\t\t ) {\r\n\t\t\tsetPanelFolderImg(options.useAltFldr, options.altFldrImg);\r\n\t\t }\r\n\t\t // If no-favicon image options changed\r\n\t\t if ((options.useAltNoFav && (altNoFavImg_option_old != options.altNoFavImg))\r\n\t\t\t || (useAltNoFav_option_old != options.useAltNoFav)\r\n\t\t\t ) {\r\n\t\t\tsetPanelNoFaviconImg(options.useAltNoFav, options.altNoFavImg);\r\n\t\t }\r\n\t\t}", "title": "" }, { "docid": "a8a9e48af1da74a3ec4d37940006c527", "score": "0.60037", "text": "updateState() {\n }", "title": "" }, { "docid": "299f430c2cfa12a0ce2944908808c4f0", "score": "0.59921867", "text": "onSettingsUpdate() {\n if (\n this.$inputWidth.state.value !== this.props.game.matrix[0].length ||\n this.$inputHeight.state.value !== this.props.game.matrix.length ||\n this.$inputVictoryChainsLength.state.value !== this.props.game.victoryChainsLength\n ) {\n this.setState({\n wasChanged: true,\n });\n } else {\n this.setState({\n wasChanged: false,\n });\n }\n\n this.setState({\n maxVictoryChainsLength: Math.min(this.$inputWidth.state.value, this.$inputHeight.state.value),\n });\n }", "title": "" }, { "docid": "541eedc25004a8ffb1f40826e6ce1586", "score": "0.5989861", "text": "componentDidUpdate(prevState) {\r\n if (prevState.options.length !== this.state.options.length) {\r\n const json = JSON.stringify(this.state.options);\r\n localStorage.setItem(\"options\", json);\r\n }\r\n }", "title": "" }, { "docid": "dc844126f9ff452ee0a15fd58e724a53", "score": "0.59735495", "text": "function saveState () {\n if (self.selectedOptionValues && self.selectedOptionValues.length > 0) {\n var options = self.selectedOptionValues.map(function (option) {\n // When non-primitive object, store as json\n if (angular.isObject(option.value)) {\n return ':(' + angular.toJson(option.value) + ')';\n }\n // Handle basic primitive value\n return option.value;\n }).join(PARAM_DELIMITER);\n self.gridController.state[self.id] = options;\n } else {\n delete self.gridController.state[self.id];\n }\n }", "title": "" }, { "docid": "e97ec121bac0a08747a6cec418a9e908", "score": "0.5948608", "text": "componentDidUpdate (prevProps, prevState) {\n this.toggleMediumEditor();\n }", "title": "" }, { "docid": "2035abb1ca3c93a51ee70bac6195a222", "score": "0.59467757", "text": "function setEditorCommandState(cmd, state) {\n try {\n editor.getDoc().execCommand(cmd, false, state);\n } catch (ex) {\n // Ignore\n }\n }", "title": "" }, { "docid": "51b50520f6dada2b9e565781de4a18a7", "score": "0.5930461", "text": "function updateBoxes() {\n\t// collect the things we'll be using/editing\n\tvar selectorBox = document.unclickable_options.unclickable_options_selector;\n\t\n\tif (radios.checked) {\n\t\tsetOptions(false);\n\t} else {\n\t\tsetOptions(true);\n\t}\n\t\n}", "title": "" }, { "docid": "2eb0de64ce3323f49a8463e5407dcdd2", "score": "0.5923579", "text": "_onChange() {\n this._updateState();\n }", "title": "" }, { "docid": "74d8694f38d7c20af51075d932326136", "score": "0.58949363", "text": "function updateState() {\n\t$(stateCanvas).remove();\n\tvar prevState = state;\n\tstate = problem.currentState;\n\tstateCanvas = state.makeCanvas();\n\tstateDisplay.append($(stateCanvas));\n\tstate.animateMove(prevState);\n }", "title": "" }, { "docid": "03e6aae9fa83b9dddddaf8896c9a3d9f", "score": "0.58561474", "text": "_editModeChanged(newValue,oldValue){if(newValue){// enable it some how\nthis.__editIcon=\"icons:save\";this.__editText=\"Save\"}else{// disable it some how\nthis.__editIcon=\"editor:mode-edit\";this.__editText=\"Edit\"}if(typeof oldValue!==typeof void 0){_haxcmsSiteStore.store.editMode=newValue}}", "title": "" }, { "docid": "c50bf36ea42d1a438da04d1fd0b816bd", "score": "0.58512086", "text": "applySettings() {\n\t\t\t\tconst editor = atom.workspace.getActiveTextEditor();\n\t\t\t\tconst settings = this.settings;\n\n\t\t\t\tif (editor && editor.getBuffer() === buffer) {\n\t\t\t\t\tif (settings.indent_style !== 'auto') {\n\t\t\t\t\t\teditor.setSoftTabs(settings.indent_style === 'space');\n\t\t\t\t\t}\n\t\t\t\t\tif (settings.tab_width !== 'auto') {\n\t\t\t\t\t\teditor.setTabLength(settings.tab_width);\n\t\t\t\t\t}\n\t\t\t\t\tif (settings.end_of_line !== 'auto') {\n\t\t\t\t\t\tbuffer.setPreferredLineEnding(settings.end_of_line);\n\t\t\t\t\t}\n\t\t\t\t\tif (settings.charset !== 'auto') {\n\t\t\t\t\t\tbuffer.setEncoding(settings.charset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetState(this);\n\t\t\t}", "title": "" }, { "docid": "bd948a7a06b04f6509b2b01130bae76f", "score": "0.58447635", "text": "function EditorState() {\n\tthis.paletteIndex = 0;\n\tthis.platform = PlatformType.Desktop; // default to desktop\n}", "title": "" }, { "docid": "bf9fd006797204df8f18d9a086acc120", "score": "0.58348393", "text": "function restoreOptions() {\n $(\"#gitlabPath\").val(config.getGitlabPath());\n $(\"#apiPath\").val(config.getApiPath());\n $(\"#privateToken\").val(config.getPrivateToken());\n $(\"#pollingSecond\").val(config.getPollingSecond());\n $(\"#maxEventCount\").val(config.getMaxEventCount());\n $(\"#maxNotificationCount\").val(config.getMaxNotificationCount());\n $(\"#newMarkMinute\").val(config.getNewMarkMinute());\n }", "title": "" }, { "docid": "70fe347551a471b5d37f59414f82d595", "score": "0.5832043", "text": "updateOptions(){\n for( let i = 0; i < this.array.option.length; i++ ){\n let index = this.array.option[i].index;\n let delta = this.contactByIndex( index );\n if( delta.status == 'forgotten' )\n delta.status = 'proposed';\n }\n }", "title": "" }, { "docid": "2bdd6289aef2e237e670a756e20e4a7c", "score": "0.5826348", "text": "function changeEnded() {\n leaveEditMode(currentMode);\n enterEditMode(currentMode);\n }", "title": "" }, { "docid": "12988c40efbe44a1ed532e51c6ec99ac", "score": "0.58164614", "text": "updateOptions(options) {\n if (options) {\n withRestart(() => controller.init(options));\n }\n }", "title": "" }, { "docid": "9885beff1e5d49831bfc1be70621232b", "score": "0.581505", "text": "function restoreOptions() {\n $(\"#gitlabPath\").val(config.getGitlabPath());\n $(\"#apiPath\").val(config.getApiPath());\n $(\"#privateToken\").val(config.getPrivateToken());\n $(\"#pollingSecond\").val(config.getPollingSecond());\n $(\"#maxEventCount\").val(config.getMaxEventCount());\n $(\"#newMarkMinute\").val(config.getNewMarkMinute());\n }", "title": "" }, { "docid": "2336e407f2d043608325cefeed4c891c", "score": "0.5782912", "text": "function update_options_from_state() {\n if (debug) {\n console.log(\"update_options_from_state\");\n }\n\n for (const thing in state) {\n try {\n let element = document.getElementById(thing);\n for (const i in element.options) {\n const option = element.options[i];\n if (option.value === state[thing]) {\n element.selectedIndex = i;\n } else {\n if (debug) {\n // console.log(option, option.value, state[thing]);\n }\n }\n }\n } catch (error) { // wow_class, wow_spec\n if (debug) {\n console.log(error, thing, state);\n }\n }\n }\n}", "title": "" }, { "docid": "9a7348e1b3d94b5bce0e50878c16a681", "score": "0.57721865", "text": "componentDidUpdate(prevProps, prevState) {\n const hasChanged = prevState.options.length != this.state.options.length;\n if (hasChanged) {\n const jsonData = JSON.stringify({ options: this.state.options });\n console.log(\"Saving data: \" + jsonData);\n\n localStorage.setItem(\"options\", jsonData);\n }\n }", "title": "" }, { "docid": "643d44bc05be54130f3239c9fa923b2d", "score": "0.5771625", "text": "function updateOptions ( optionsToUpdate ) {\n\n\t\tvar v = valueGet(), i, newOptions = testOptions({\n\t\t\tstart: [0, 0],\n\t\t\tmargin: optionsToUpdate.margin,\n\t\t\tlimit: optionsToUpdate.limit,\n\t\t\tstep: optionsToUpdate.step,\n\t\t\trange: optionsToUpdate.range,\n\t\t\tanimate: optionsToUpdate.animate,\n\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\n\t\t});\n\n\t\t['margin', 'limit', 'step', 'range', 'animate'].forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [-1, -1];\n\t\tvalueSet(v);\n\n\t\tfor ( i = 0; i < scope_Handles.length; i++ ) {\n\t\t\tfireEvent('update', i);\n\t\t}\n\t}", "title": "" }, { "docid": "80ec7da0d4c4d7f8a70c02b4132d2834", "score": "0.57593703", "text": "function save_options() {\n chrome.storage.sync.set(\n {\n total: total.checked,\n remaining: remaining.checked\n },\n function() {\n M.toast({ html: 'Settings Updated!', displayLength: 1000 });\n update_preview();\n }\n );\n }", "title": "" }, { "docid": "a9e5057f2198756d306e116f45107ae5", "score": "0.57535887", "text": "function updateOptions() {\n\t$('#rbrFd').val( bg.get_option('rbrFd') );\n\t$('#rbrFd').change(function() {\n\t\tconsole.log('rbrF: ' + bg.get_option('rbrFd'));\n bg.set_option( 'rbrFd', $('#rbrFd').val() );\n\t\tconsole.log('rbrF: ' + bg.get_option('rbrFd'));\n\t});\n\n\t$('#delOnRead').prop( 'checked', bg.get_option('delOnRead') );\n\t$('#delOnRead').click(function() {\n\t\tconsole.log('delOnRead: ' + bg.get_option('delOnRead'));\n\t\tbg.set_option( 'delOnRead', $('#delOnRead').prop('checked') );\n\t\tconsole.log('delOnRead: ' + bg.get_option('delOnRead'));\n\t});\n\t\n\t$('#showUnread').prop( 'checked', bg.get_option('showUnread') );\n\t$('#showUnread').click(function() {\n\t\tconsole.log('showUnread: ' + bg.get_option('showUnread'));\n\t\tbg.set_option( 'showUnread', $('#showUnread').prop('checked') );\n\t\tconsole.log('showUnread: ' + bg.get_option('showUnread'));\n\t\tbg.updateBadge();\n\t});\n\n\t$('#showUnreadColor').val( bg.get_option('showUnreadColor') );\n\t$(\"#showUnreadColor\").on(\"change\",function(){\n\t\tconsole.log('showUnreadColor: ' + bg.get_option('showUnreadColor'));\n bg.set_option( 'showUnreadColor', $('#showUnreadColor').val() );\n\t\tconsole.log('showUnreadColor: ' + bg.get_option('showUnreadColor'));\n\t\tbg.updateBadge();\n\t});\n\t\n\t$('#openNewTab').prop( 'checked', bg.get_option('openNewTab') );\n\t$('#openNewTab').click(function() {\n\t\tconsole.log('openNewTab: ' + bg.get_option('openNewTab'));\n\t\tbg.set_option( 'openNewTab', $('#openNewTab').prop('checked') );\n\t\tconsole.log('openNewTab: ' + bg.get_option('openNewTab'));\n\t});\n\t\n\t$('#showPopup').prop( 'checked', bg.get_option('showPopup') );\n\t$('#showPopup').click(function() {\n\t\tconsole.log('showPopup: ' + bg.get_option('showPopup'));\n\t\tbg.set_option( 'showPopup', $('#showPopup').prop('checked') );\n\t\tconsole.log('showPopup: ' + bg.get_option('showPopup'));\n\t});\n}", "title": "" }, { "docid": "db5dbf40f763c1e7e7558eef60361881", "score": "0.5736685", "text": "on_setting_changed() {\n // Prevent any refresh until we have set up the UI\n if (this.timeout > 0) {\n Mainloop.source_remove(this.timeout);\n }\n\n if (this.cfgEnableCustomCommand) {\n this.cfgTopCommand = this.cfgTopCommand || DEFAULT_TOP_COMMAND;\n } else {\n this.cfgTopCommand = DEFAULT_TOP_COMMAND;\n }\n\n // Nuke the mainContainer\n this.mainContainer = null;\n\n // Set up the UI\n this.setupUI();\n\n // Show the UI and call refresh to populate initial values.\n this.setContent(this.mainContainer);\n\n // Update the display values and start the refresh timer.\n this._refresh();\n }", "title": "" }, { "docid": "25da595d64ab39bfd23b8d1978f45679", "score": "0.5719606", "text": "function onModeOptionUpdated(newMode) {\n debug(\"onModeOptionUpdated: new mode=\" + newMode);\n\n if (! isEnabledOnThisPage())\n return;\n\n // If mode has changed\n var oldMode = displayMode;\n displayMode = newMode;\n if (typeof(oldMode) == 'undefined' || displayMode != oldMode)\n refreshAllFolds();\n}", "title": "" }, { "docid": "51580d9866bdd38e43df616f95e15c0d", "score": "0.57147455", "text": "async function handleUpdate() {\n try {\n setLoading(true);\n const rawState = convertToRaw(editorState.getCurrentContent());\n await updateSyllabus(course, JSON.stringify(rawState));\n setisSaved(true);\n setisPreview(true);\n } catch (error) {\n console.log(error);\n }\n setLoading(false);\n }", "title": "" }, { "docid": "b21ce7e570bdfd7d9dee0ad65306b86a", "score": "0.5714428", "text": "_changed()\n\t{\n\t\tthis._options = Hanzipad.LookupCharacter( this.glyphCode );\n\t\tthis._activeIndex = 0;\n\n\t\tvar opts = new Event(\"options\");\n\t\topts.characterOptions = JSON.parse(JSON.stringify(this._options));\n\n\t\tthis.dispatchEvent(opts);\n\t\tthis.dispatchEvent(new Event(\"change\"));\n\t\tthis.redraw();\n\t}", "title": "" }, { "docid": "81bb7a9cdd55173d601c716fbd4eca51", "score": "0.5710247", "text": "function updateOptionsView() {\n if (fudgeConfig.isActive()) {\n $('#fudge-active-options').show();\n $('#fudge-inactive-options').hide();\n } else {\n $('#fudge-active-options').hide();\n $('#fudge-inactive-options').show();\n }\n }", "title": "" }, { "docid": "813d0dacc830ecb6d6a31b64e81f2635", "score": "0.57076806", "text": "resetCurrentSelections() {\n const { previousSettings } = this.state;\n this.setState({\n currentSettings: previousSettings,\n saved: false,\n });\n }", "title": "" }, { "docid": "291af80fa729409de604d97d591a123c", "score": "0.5706123", "text": "function updateDropletMode(aceEditor) {\n }", "title": "" }, { "docid": "4b166628fc41739b76532f55a6c099cc", "score": "0.5703042", "text": "onOptionsReset () {\n for (const name of this.featureOptions.names) {\n this.featureOptionStateChange(name)\n this.store.commit('settings/incrementFeatureResetCounter')\n }\n for (const name of this.resourceOptions.names) { // eslint-disable-line no-unused-vars\n this.store.commit('settings/incrementResourceResetCounter')\n }\n for (const name of this.uiOptions.names) {\n this.uiOptionStateChange(name)\n this.store.commit('settings/incrementUiResetCounter')\n }\n }", "title": "" }, { "docid": "55b76b2227d97ef9cc9c7fc6eb4e66ab", "score": "0.56977105", "text": "_resetOptions() {\n const changedOrDestroyed = Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(this.options.changes, this._destroy);\n this.optionSelectionChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed)).subscribe(event => {\n this._onSelect(event.source, event.isUserInput);\n if (event.isUserInput && !this.multiple && this._panelOpen) {\n this.close();\n this.focus();\n }\n });\n // Listen to changes in the internal state of the options and react accordingly.\n // Handles cases like the labels of the selected options changing.\n Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(...this.options.map(option => option._stateChanges))\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed))\n .subscribe(() => {\n this._changeDetectorRef.markForCheck();\n this.stateChanges.next();\n });\n }", "title": "" }, { "docid": "55b76b2227d97ef9cc9c7fc6eb4e66ab", "score": "0.56977105", "text": "_resetOptions() {\n const changedOrDestroyed = Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(this.options.changes, this._destroy);\n this.optionSelectionChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed)).subscribe(event => {\n this._onSelect(event.source, event.isUserInput);\n if (event.isUserInput && !this.multiple && this._panelOpen) {\n this.close();\n this.focus();\n }\n });\n // Listen to changes in the internal state of the options and react accordingly.\n // Handles cases like the labels of the selected options changing.\n Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(...this.options.map(option => option._stateChanges))\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed))\n .subscribe(() => {\n this._changeDetectorRef.markForCheck();\n this.stateChanges.next();\n });\n }", "title": "" }, { "docid": "6d9dd011a3471b1f42a722ae30a06063", "score": "0.56966615", "text": "function _update_editor_(){\n var stmt = _current_statement_.statement;\n editor.setValue(JSON.stringify(stmt, undefined, 4)); // or session.setValue\n editor.clearSelection(); // or session.setValue\n}", "title": "" }, { "docid": "c019e8333c22409bd7d020c313b1ee4d", "score": "0.569033", "text": "set updateMode(value) {}", "title": "" }, { "docid": "3f1da005aa8c2f1848df23fe3ae7ecaf", "score": "0.56867784", "text": "componentDidUpdate(prevProps, prevState){\n if (prevState.options.length !== this.state.options.length ) {\n const json = JSON.stringify(this.state.options)\n localStorage.setItem(\"options\", json)\n }\n }", "title": "" }, { "docid": "49d022dea9a1e5d7340cd3d181e43885", "score": "0.5678963", "text": "function restore_options() {\r\n chrome.storage.sync.get('ranking', function(response) {\r\n if (response.ranking == undefined) {\r\n scrubOptionToggles()\r\n save_options()\r\n }\r\n else setRanking(response.ranking);\r\n });\r\n\r\n chrome.storage.sync.get('width', function(response) {\r\n setWidth(response.width);\r\n });\r\n\r\n chrome.storage.sync.get('colors', function(response) {\r\n setColors(response.colors);\r\n });\r\n\r\n chrome.storage.sync.get('switchBoxes', function(response) {\r\n setBoxes(response.switchBoxes);\r\n });\r\n\r\n chrome.storage.sync.get('commentPages', function (response) {\r\n setCommentPages(response.commentPages);\r\n });\r\n\r\n chrome.storage.sync.get('blockUsers', function (response) {\r\n setBlockUsers(response.blockUsers);\r\n });\r\n\r\n chrome.storage.sync.get('hideMales', function (response) {\r\n setHideMales(response.hideMales);\r\n });\r\n\r\n chrome.storage.sync.get('hideFemales', function (response) {\r\n setHideFemales(response.hideFemales);\r\n });\r\n\r\n chrome.storage.sync.get('hideCasters', function (response) {\r\n setHideCasters(response.hideCasters);\r\n });\r\n\r\n chrome.storage.sync.get('hideOthers', function (response) {\r\n setHideOthers(response.hideOthers);\r\n });\r\n\r\n chrome.storage.sync.get('hideAds', function (response) {\r\n setHideAds(response.hideAds);\r\n });\r\n}", "title": "" }, { "docid": "4bb1379a6cfdeb21ae77e90ef68eb457", "score": "0.565946", "text": "componentDidUpdate(prevProps,prevState){\n if(prevState.options.length !== this.state.options.length){\n const json = JSON.stringify(this.state.options);\n localStorage.setItem('options',json)\n }\n console.log('componenDidUpdate');\n }", "title": "" }, { "docid": "7c5f17ae655b3431dd4c662eeb29bdb9", "score": "0.56588405", "text": "update() {\r\n // Save the previous values\r\n this.saveValues();\r\n\r\n // Category + option 1 selections\r\n this._fillCatSelect(this.cat1Select, this.cat1);\r\n let category = this.puzzle.getCategoryById(this.cat1Select.value);\r\n this._fillOptionSelect(category, this.option1Select, this.option1);\r\n\r\n // Category + option 2 selections\r\n this._fillCatSelect(this.cat2Select, this.cat2);\r\n category = this.puzzle.getCategoryById(this.cat2Select.value);\r\n this._fillOptionSelect(category, this.option2Select, this.option2);\r\n }", "title": "" }, { "docid": "f1ecf9130ca58b7f357108a8544aac6c", "score": "0.5657419", "text": "function updateState() {\n if (!ui) {\n throw new Error(\n 'Cannot render UI without defining a node for the widget. Have you run `widget.attach()`?'\n );\n }\n const state = fsm.getCurrentState();\n const jobState = jobManager.getJob();\n try {\n FSMBar.showFsmBar({\n ui,\n state,\n job: jobState,\n });\n } catch (error) {\n console.warn('Could not display FSM state:', error);\n }\n\n if (!viewOnly && model.getItem('outdated')) {\n const outdatedBtn = ui.getElement('outdated');\n outdatedBtn.setAttribute(\n 'data-content',\n 'This app has a newer version available! ' +\n \"There's probably nothing wrong with this version, \" +\n 'but the new one may include new features. Add a new \"' +\n model.getItem('newAppName') +\n '\" app cell for the update.'\n );\n }\n\n let stateName;\n // hideous way to find the name of the current state\n for (const name of Object.keys(AppStates.STATE)) {\n if (_.isEqual(AppStates.STATE[name], state.state)) {\n stateName = name;\n break;\n }\n }\n\n // set the execMessage\n if (stateName && stateName in stateMessages) {\n setExecMessage(stateMessages[stateName]);\n } else if (jobState) {\n setExecMessage(Jobs.createJobStatusSummary(jobState));\n }\n\n // Tab state\n\n // TODO: let user-selection override auto-selection of tab, unless\n // the user-selected tab is no longer enabled or is hidden.\n\n // disable tab buttons\n // If current tab is not enabled in this state, then forget that the user\n // made a selection.\n\n const userStateTab = state.ui.tabs[selectedTabId()];\n if (!userStateTab || !userStateTab.enabled || userStateTab.hidden) {\n userSelectedTab = false;\n }\n\n let tabSelected = false;\n Object.keys(state.ui.tabs).forEach((tabId) => {\n const tab = state.ui.tabs[tabId];\n let tabState;\n if (tab instanceof Array) {\n tabState = tab.filter((mode) => {\n if (\n (mode.selector.viewOnly && viewOnly) ||\n (!mode.selector.viewOnly && !viewOnly)\n ) {\n return true;\n }\n })[0].settings;\n } else {\n tabState = tab;\n }\n tabState.enabled ? ui.enableButton(tabId) : ui.disableButton(tabId);\n\n // TODO honor user-selected tab.\n // Unless the tab is not enabled in this state, in which case\n // we do switch to the one called for by the state.\n if (tabState.selected && !userSelectedTab) {\n tabSelected = true;\n selectTab(tabId);\n }\n tabState.hidden ? ui.hideButton(tabId) : ui.showButton(tabId);\n });\n // If no new tabs selected (even re-selecting an existing open tab)\n // close the open tab.\n if (!tabSelected && !userSelectedTab) {\n unselectTab();\n }\n\n actionButtonWidget.setState(state.ui.actionButton);\n }", "title": "" }, { "docid": "b3bbfe88b884b33d0f5e9866c39b636b", "score": "0.56546843", "text": "function updateEditor({ clientId, value, patch, otherPos, actionType }) {\n const editor = ace.edit(\"editor\");\n if (actionType !== \"CURSOR\") {\n applyEdits(patch, value, actionType);\n }\n // always clear selection\n clearOtherSelection(clientId);\n if (otherPos) {\n updateOtherCursor(otherPos, clientId);\n updateOtherSelection(otherPos, clientId);\n } else {\n clearOtherCursor(clientId);\n }\n}", "title": "" }, { "docid": "b8cb34b7f5f6480ef46f109de3fd65c6", "score": "0.565237", "text": "function updateState(op){\n\t\tvar target = editor.getObjectByUuid(op.uuid);\n\t\tif(target){\n\t\t\tUpdateState.updateObject(target, op.key, op.after);\n\t\t\treturn true;\n\t\t}\n\n\t\t//update the material\n\t\ttarget = editor.getMaterial(op.uuid);\n\t\tif(target){\n\t\t\tUpdateState.updateMaterial(target, op.key, op.after);\n\t\t\treturn true;\n\t\t}\n\n\t\ttarget = editor.getGeometry(op.uuid);\n\t\tif(target){\n\t\t\tUpdateState.updateGeometry(target, op.key, op.after);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "title": "" }, { "docid": "a67b14a39f21a1b510ef0ceb35a158c6", "score": "0.5649129", "text": "changeSettings(values) {\n\t\tconst prevState = this.state;\n\t\tthis.setState(values);\n\t\tif (typeof values.cols === 'number' && prevState.cols < values.cols) {\n\t\t\tlocation.reload();\n\t\t}\n\t}", "title": "" }, { "docid": "5326600663d3d6b9e83f6f0a5ec3f96d", "score": "0.5644196", "text": "function restore_options() {\n el_status.textContent = chrome.i18n.getMessage(\"opt_loading\");\n\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get(current_cfg, function (cfg) {\n Object.assign(current_cfg, cfg);\n el_un.value = current_cfg.un;\n el_pw.value = current_cfg.pw;\n el_otp.value = current_cfg.otp;\n el_auto_login.checked = current_cfg.auto_login;\n el_status.textContent = \"\"\n });\n}", "title": "" }, { "docid": "87bee83bd4a4f62b6b1c7a8021de434d", "score": "0.5643933", "text": "onEditOptions() {\n showPanel('configuration');\n }", "title": "" }, { "docid": "a33e439fdf5da08db35380959ea2859d", "score": "0.5640547", "text": "function updateOptions() {\n\t /*jshint validthis:true */\n\t var propValue = this.getValue();\n\t var value = propValue != null ? propValue : this.state.value;\n\t var options = this.getDOMNode().options;\n\t var selectedValue = '' + value;\n\t\n\t for (var i = 0, l = options.length; i < l; i++) {\n\t var selected = this.props.multiple ?\n\t selectedValue.indexOf(options[i].value) >= 0 :\n\t selected = options[i].value === selectedValue;\n\t\n\t if (selected !== options[i].selected) {\n\t options[i].selected = selected;\n\t }\n\t }\n\t}", "title": "" }, { "docid": "a33e439fdf5da08db35380959ea2859d", "score": "0.5640547", "text": "function updateOptions() {\n\t /*jshint validthis:true */\n\t var propValue = this.getValue();\n\t var value = propValue != null ? propValue : this.state.value;\n\t var options = this.getDOMNode().options;\n\t var selectedValue = '' + value;\n\t\n\t for (var i = 0, l = options.length; i < l; i++) {\n\t var selected = this.props.multiple ?\n\t selectedValue.indexOf(options[i].value) >= 0 :\n\t selected = options[i].value === selectedValue;\n\t\n\t if (selected !== options[i].selected) {\n\t options[i].selected = selected;\n\t }\n\t }\n\t}", "title": "" }, { "docid": "1162a1598fbd29f302974438a1654d53", "score": "0.5620754", "text": "function setState(ecfg) {\n\tconst messages = [];\n\tlet statcon = 0;\n\n\t// Check if any editorconfig-setting is in use\n\tif (Object.keys(ecfg.settings).reduce((prev, curr) => {\n\t\treturn ecfg.settings[curr] !== 'auto' || prev;\n\t}, false)) {\n\t\tstatcon = Math.max(statcon, 1);\n\t}\n\n\t// Check the 'Tab Type'-setting\n\tif (ecfg.settings.indent_style !== 'auto' &&\n\t\tatom.config.get('editor.tabType') !== 'auto') {\n\t\tconst tabType = atom.config.get('editor.tabType');\n\n\t\tmessages.push(`**Tab Type:** You editor's configuration setting \"Tab Type\"\n\t\t(currently \"${tabType}\" prevents the editorconfig-property \\`indent_style\\` from working.\n\t\t@\"Tab Type\" **must** be set to \"auto\" to fix this issue.`);\n\n\t\tstatcon = Math.max(statcon, 4);\n\t}\n\n\t// Check for BLACKLISTED packages\n\tconst suspiciuousPackages = {};\n\tlet affectedProperties;\n\tfor (const packageName in BLACKLISTED_PACKAGES) {\n\t\tif ({}.hasOwnProperty.call(BLACKLISTED_PACKAGES, packageName)) {\n\t\t\taffectedProperties = BLACKLISTED_PACKAGES[packageName].filter(prop => {\n\t\t\t\treturn ecfg.settings[prop] !== 'auto';\n\t\t\t});\n\t\t\tif (affectedProperties.length > 0 &&\n\t\t\t\tatom.packages.isPackageActive(packageName)) {\n\t\t\t\tsuspiciuousPackages[packageName] = affectedProperties;\n\t\t\t}\n\t\t}\n\t}\n\tif (Object.keys(suspiciuousPackages).length > 0) {\n\t\tfor (const packageName in suspiciuousPackages) {\n\t\t\tif ({}.hasOwnProperty.call(suspiciuousPackages, packageName)) {\n\t\t\t\tconst properties = suspiciuousPackages[packageName];\n\t\t\t\tmessages.push(`**${packageName}:** It is likely that the\n\t\t\t\t${packageName}-package prevents the following\n\t\t\t\tpropert${properties.length > 1 ? 'ies' : 'y'} from working reliably:\n\t\t\t\t\\`${properties.join('`, `')}\\`.@You may deactivate or disable the ${packageName}-package\n\t\t\t\tto fix that issue.`);\n\t\t\t}\n\t\t}\n\t\tstatcon = Math.max(statcon, 3);\n\t}\n\n\tswitch (statcon) {\n\t\tcase 1:\n\t\t\tmessages.push(`The editorconfig was applied successfully and the editor for this file\n\t\t\tshould work as expected. If you face any unexpected behavior please report us the issue.\n\t\t\t♥️`);\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tmessages.push(`For this file were no editorconfig-settings applied.`);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t// Apply changes\n\tecfg.messages = messages;\n\tecfg.state = STATES[statcon];\n\tstatusTile().updateIcon(ecfg.state);\n}", "title": "" }, { "docid": "7c7eadca5f552f937ffa264dbbc8543e", "score": "0.5620754", "text": "function setState(ecfg) {\n\tconst messages = [];\n\tlet statcon = 0;\n\n\t// Check if any editorconfig-setting is in use\n\tif (Object.keys(ecfg.settings).reduce((prev, curr) => {\n\t\treturn ecfg.settings[curr] !== 'auto' || prev;\n\t}, false)) {\n\t\tstatcon = Math.max(statcon, 1);\n\t}\n\n\t// Check the 'Tab Type'-setting\n\tif (ecfg.settings.indent_style !== 'auto' &&\n\t\tatom.config.get('editor.tabType') !== 'auto') {\n\t\tconst tabType = atom.config.get('editor.tabType');\n\n\t\tmessages.push(`**Tab Type:** You editor's configuration setting \"Tab Type\"\n\t\t(currently \"${tabType}\" prevents the editorconfig-property \\`indent_style\\` from working.\n\t\t@\"Tab Type\" **must** be set to \"auto\" to fix this issue.`);\n\n\t\tstatcon = Math.max(statcon, 4);\n\t}\n\n\t// Check for BLACKLISTED packages\n\tconst suspiciuousPackages = {};\n\tlet affectedProperties;\n\tfor (const packageName in BLACKLISTED_PACKAGES) {\n\t\tif ({}.hasOwnProperty.call(BLACKLISTED_PACKAGES, packageName)) {\n\t\t\taffectedProperties = BLACKLISTED_PACKAGES[packageName].filter(prop => {\n\t\t\t\treturn ecfg.settings[prop] !== 'auto';\n\t\t\t});\n\t\t\tif (affectedProperties.length > 0 &&\n\t\t\t\tatom.packages.isPackageActive(packageName)) {\n\t\t\t\tsuspiciuousPackages[packageName] = affectedProperties;\n\t\t\t}\n\t\t}\n\t}\n\tif (Object.keys(suspiciuousPackages).length > 0) {\n\t\tfor (const packageName in suspiciuousPackages) {\n\t\t\tif ({}.hasOwnProperty.call(suspiciuousPackages, packageName)) {\n\t\t\t\tconst properties = suspiciuousPackages[packageName];\n\t\t\t\tmessages.push(`**${packageName}:** It is likely that the\n\t\t\t\t${packageName}-package prevents the following\n\t\t\t\tpropert${properties.length > 1 ? 'ies' : 'y'} from working reliably:\n\t\t\t\t\\`${properties.join('`, `')}\\`.@You may deactivate or disable the ${packageName}-package\n\t\t\t\tto fix that issue.`);\n\t\t\t}\n\t\t}\n\t\tstatcon = Math.max(statcon, 3);\n\t}\n\n\tswitch (statcon) {\n\t\tcase 1:\n\t\t\tmessages.push(`The editorconfig was applied successfully and the editor for this file\n\t\t\tshould work as expected. If you face any unexpected behavior please report us the issue.\n\t\t\t♥️`);\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tmessages.push(`For this file were no editorconfig-settings applied.`);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t// Apply changes\n\tecfg.messages = messages;\n\tecfg.state = STATES[statcon];\n\tstatusTile().update(ecfg.state);\n}", "title": "" }, { "docid": "bdfc29c5ea25ff212abd9849a2f5bd68", "score": "0.5612187", "text": "_onChange() {\n this.setState(getStates());\n }", "title": "" }, { "docid": "1404e9ff76380adbc176668f31d1304d", "score": "0.56118995", "text": "function reapplyEditorconfig() {\n\tconst textEditors = atom.workspace.getTextEditors();\n\ttextEditors.forEach(editor => {\n\t\tobserveTextEditor(editor);\n\t});\n}", "title": "" }, { "docid": "a336fb1c574d1fef00096ac6561ce8e2", "score": "0.5610535", "text": "function updateOutput(){\n\t\tval = editor.getValue();\n\t\tif (ide == \"st3\"){\n\t\t\t// format for Sublime Text\n\t\t\toutput.session.setMode(\"ace/mode/html\") // Sublime text format for snippets\n\t\t\toutput.session.setUseWorker(false) // disables error\n\t\t\toutput.setValue(formatSublime())\n\t\t\toutput.clearSelection();\n\t\t}\n\t\telse if (ide == \"vsc\"){\n\t\t\t// format for VS Code\n\t\t\toutput.session.setMode(\"ace/mode/python\") // VS Code format for snippets\n\t\t\tcode = formatVSCode()\n\t\t\toutput.setValue(code)\n\t\t\toutput.clearSelection();\n\t\t}\n\t}", "title": "" }, { "docid": "8f22b1b7f020ba84d802e4a89efe9294", "score": "0.56006145", "text": "_optionDidChange(sender, key) {\n this.get('codeMirror').setOption(key, this.get(key));\n }", "title": "" }, { "docid": "b7a495a9109fd76da381eafc22903f7a", "score": "0.55985653", "text": "function updateOptions(optionsToUpdate) {\n var v = valueGet(),\n i, newOptions = testOptions({\n start: [0, 0],\n margin: optionsToUpdate.margin,\n limit: optionsToUpdate.limit,\n step: optionsToUpdate.step,\n range: optionsToUpdate.range,\n animate: optionsToUpdate.animate,\n snap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate\n .snap\n });\n ['margin', 'limit', 'step', 'range', 'animate'].forEach(function(\n name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = optionsToUpdate[name];\n }\n });\n // Save current spectrum direction as testOptions in testRange call\n // doesn't rely on current direction\n newOptions.spectrum.direction = scope_Spectrum.direction;\n scope_Spectrum = newOptions.spectrum;\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [-1, -1];\n valueSet(v);\n for (i = 0; i < scope_Handles.length; i++) {\n fireEvent('update', i);\n }\n }", "title": "" }, { "docid": "5e0acf4a5cc368717507113802f2745e", "score": "0.55983496", "text": "apply() {\n this.stored = JSON.parse(JSON.stringify(this.settings));\n this.changed = false;\n }", "title": "" }, { "docid": "1de14cf0227e975cce4dc97f95284a8f", "score": "0.55978954", "text": "function menuState() {\n lava.update();\n }", "title": "" }, { "docid": "d834504cd1ed18df0ebd1dac96d3e35d", "score": "0.55918926", "text": "componentWillUpdate(nextProps, nextState) {\n // If content is provided, update.\n if (nextProps.app && nextProps.app != this.state.app) {\n // Update state.\n this.setState({\n app: nextProps.app\n })\n // Make sure editor is updated only on source change.\n if (nextProps.app.source != this.state.app.source) {\n this.setValue(nextProps.app.source)\n }\n }\n }", "title": "" }, { "docid": "abc2959ebd0c52a45088189bee82443e", "score": "0.5587239", "text": "function reapplyEditorconfig() {\n\tconst textEditors = atom.workspace.getTextEditors();\n\tfor (const index in textEditors) { // eslint-disable-line guard-for-in\n\t\tobserveTextEditor(textEditors[index]);\n\t}\n}", "title": "" }, { "docid": "dfe7fff5e77774d89f083815a9efd457", "score": "0.55846834", "text": "onChange(editorState) {\n this.setState({\n editorState,\n });\n console.log('basic editorState: ', this.state.editorState);\n console.log('basic GetCurrentContent: ', this.state.editorState.getCurrentContent());\n }", "title": "" }, { "docid": "9bdb3c261b171009f1d5ff60cf967cb9", "score": "0.5583552", "text": "saveState() {\n\t\tlet id = get(this, 'selected.id');\n\t\tset(this, '__saveState', {\n\t\t\tisCustom: id === 'custom',\n\t\t\tselectedId: id,\n\t\t\tstart: getStart(this),\n\t\t\tend: getEnd(this)\n\t\t});\n\t}", "title": "" }, { "docid": "7bdef8ae9a56a68b0272d67bcebe2504", "score": "0.5581635", "text": "update() {\r\n // Save the previous values\r\n this.saveValues();\r\n\r\n // Category + option 1 selections\r\n this._fillCatSelect(this.cat1Select, this.cat1);\r\n let category = this.puzzle.getCategoryById(this.cat1Select.value);\r\n this._fillOptionSelect(category, this.option1Select, this.option1);\r\n this._fillCatSelect(this.subCat1Select, this.subCat1);\r\n\r\n // Category + option 2 selections\r\n this._fillCatSelect(this.cat2Select, this.cat2);\r\n category = this.puzzle.getCategoryById(this.cat2Select.value);\r\n this._fillOptionSelect(category, this.option2Select, this.option2);\r\n this._fillCatSelect(this.subCat2Select, this.subCat2);\r\n }", "title": "" }, { "docid": "403dee93c68b550b9d807a5e3e2e001c", "score": "0.5566354", "text": "updateOptions(data) {\n this.options = data;\n }", "title": "" }, { "docid": "573be4e384d969954a9e21f82047eab1", "score": "0.5556504", "text": "function setStateForEditing() {\n if ($stateParams.editing) {\n $scope.aboutYou = SignupFactory.signupInfo.aboutYou;\n $scope.basicInfo = SignupFactory.signupInfo.basicInfo;\n $scope.socialMedia = SignupFactory.signupInfo.socialMedia;\n }\n }", "title": "" }, { "docid": "f75e043e3250304dd98c47f05bd3b3fe", "score": "0.55525404", "text": "function updateMode() {\n // If all prechecks are ok, move to the next step\n vm.mode.active = vm.prechecks.valid;\n if (vm.mode.type === UPGRADE_MODES.nondisruptive) {\n vm.mode.valid = true;\n }\n }", "title": "" }, { "docid": "3ea4df98461e413a37999826917ebf20", "score": "0.55524814", "text": "_stateChanged(state) {\n const status = activeDisabledKindsSelector(state);\n this._active = status.active;\n this._disabled = status.disabled;\n this._selected = selectedMatesSelector(state);\n }", "title": "" }, { "docid": "12363678cab32e7aa079a7ae1cc15dcd", "score": "0.5552023", "text": "function optionChanged(updateSelect) {\n dropdownMenu(updateSelect);\n barplot(updateSelect);\n bubble(updateSelect);\n demoInfo(updateSelect)\n}", "title": "" }, { "docid": "be3ea0522f6eea7f194ed2c4d2f4614f", "score": "0.5551169", "text": "shouldComponentUpdate(nextProps,nextState) {\n return this.isSwitchEditMode(nextState);\n }", "title": "" }, { "docid": "b80ea7e4ba79f83fb11cb6b1eacb0439", "score": "0.55506814", "text": "revertPreviousUpdated() {\n this.setState({ shippingMode: this.findModeSelected(), quantity: this.props.data.quantity });\n }", "title": "" }, { "docid": "665075b91f91b18831408387bb44a9bb", "score": "0.5541512", "text": "update(state) {\n }", "title": "" }, { "docid": "1c68432b3686d3bc70c33cfbdf9b0179", "score": "0.5539513", "text": "function setState() {\n var stateString = arguments.length === 1 ? arguments[0] : arguments[1];\n state = JSON.parse(stateString);\n editor.setValue(state.default);\n }", "title": "" }, { "docid": "c2cc9164a530e87a6f88b4509ed68229", "score": "0.5538105", "text": "setState(state) {\n this.state = state;\n\n if (!this.cmDoc) return;\n\n if (this.isDirty) {\n if (state === 'start') {\n this.workingFinalText = this.contents;\n } else {\n this.workingStartText = this.contents;\n }\n }\n\n const history = this.cmDoc.getHistory();\n const cursorPos = this.cmDoc.getCursor();\n\n this.cmDoc.setValue(this.activeText);\n this.cmDoc.clearHistory();\n\n this.cmDoc.setCursor(cursorPos);\n if (this.inactiveStateHistory) {\n this.cmDoc.setHistory(this.inactiveStateHistory);\n }\n\n this.inactiveStateHistory = history;\n\n if (state === 'start') {\n if (this.workingStartText === this.originalStartText) {\n this.cmDoc.markClean();\n }\n }\n\n if (state === 'final') {\n if (this.workingFinalText === this.originalFinalText) {\n this.cmDoc.markClean();\n }\n }\n }", "title": "" }, { "docid": "bc1de78008c0f831c5188ce2c5fea96c", "score": "0.55364954", "text": "function menuState() {\n sea.update();\n player.update();\n }", "title": "" }, { "docid": "34746917964f1df611b8e5477aa39ec7", "score": "0.5535323", "text": "handleDeleteOptions() {\n //To change state, we call this.setState and pass in a function that takes in the previous state\n //This then returns an object that contains the only portion of state we want to change.\n\n this.setState(prevState => {\n return {\n options: [] //Clear all options\n };\n });\n }", "title": "" }, { "docid": "34746917964f1df611b8e5477aa39ec7", "score": "0.5535323", "text": "handleDeleteOptions() {\n //To change state, we call this.setState and pass in a function that takes in the previous state\n //This then returns an object that contains the only portion of state we want to change.\n\n this.setState(prevState => {\n return {\n options: [] //Clear all options\n };\n });\n }", "title": "" }, { "docid": "c9841327705bb80b2adf0e4891fe833b", "score": "0.5531007", "text": "updateOptions(options) {\n dispatch.questions.SET_OPTIONS(options);\n }", "title": "" }, { "docid": "7bbf1ac86d51bdbf838d2a14f593060a", "score": "0.5530462", "text": "function update () {\n\t\toptions.clear();\n\t\tgetAvailableOptions(datetimeInterval.time.length()).forEach(function (optionId) {\n\t\t\toptions.get(optionId).selected = true;\n\t\t});\n\t\tupdateUrlParams();\n\t}", "title": "" }, { "docid": "3dbbe81f53ecf422b2e23e4fe55ac5a9", "score": "0.5526429", "text": "function setUpdateOption() {\n sessionStorage['updateOption'] = ($('#updateOpt').val());\n }", "title": "" }, { "docid": "0ce80c941785465c27ad41500e5f484a", "score": "0.5523821", "text": "_onChange() {\n this.setState(this._getStateFromStore());\n }", "title": "" }, { "docid": "a198660c0a64767bb467d575fba8d837", "score": "0.5521958", "text": "function update () {\n otLocationState.setStateFor(stateId, $scope.view);\n otLocationState.setStateFor(cancersExcId, $scope.cancers);\n }", "title": "" }, { "docid": "8f9468197aad209f6d378b76b6c2520a", "score": "0.5521115", "text": "function goUpdateGlobalEditMenuItems()\n{\n goUpdateCommand('cmd_undo');\n goUpdateCommand('cmd_redo');\n goUpdateCommand('cmd_cut');\n goUpdateCommand('cmd_copy');\n goUpdateCommand('cmd_paste');\n goUpdateCommand('cmd_selectAll');\n goUpdateCommand('cmd_delete');\n if (gShowBiDi)\n goUpdateCommand('cmd_switchTextDirection');\n}", "title": "" }, { "docid": "78a58d8d4949e64594888ea21c7146d6", "score": "0.5519253", "text": "updateState(data) {\n\t\t/* Keep a copy of the state. */\n\t\tthis.adversaryArena.setState(data.state);\n\n\t\t/* Additional logic for some of the state changes. */\n\t\tif (data.state == STATE_PLAY || data.state == STATE_WAIT_ADVERSARY_SELECTION) {\n\t\t\t/* Keep a copy of the level and update adversary arena. */\n\t\t\tthis.arenaInfo.adversary.initialLevelSelected = data.level;\n\t\t\tthis.adversaryArena.setInitialLevel(data.level);\n\n\t\t\t/* Set both players to play if state is play. */\n\t\t\tif (data.state == STATE_PLAY) {\n\t\t\t\tthis.activeArena.setState(STATE_PLAY);\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "cf2fc28f8f465b3b1b2cdcbf250301fa", "score": "0.55184114", "text": "finishUpdate() {\n this.setState({\n isEditing: false\n });\n }", "title": "" }, { "docid": "800136d4950368fef54cc76de1f6b1c2", "score": "0.551121", "text": "function _updatePreview(ignoreSelection) {\n\t\tvar index = !ignoreSelection && _itemList.selectedItems.length == 1 ? _itemList.selectedIndex : undefined;\n\t\tvar editor = document.getElementById('editor');\n\n\t\tif (_lastSelectedItemID) {\n\t\t\tvar newValue = editor.value;\n\t\t\tif (_lastSelectedValue != newValue) {\n\t\t\t\tbibEditInterface.setCustomText(_lastSelectedItemID, newValue);\n\t\t\t}\n\t\t}\n\n\t\teditor.readonly = index === undefined;\n\t\tif (index !== undefined) {\n\t\t\tvar itemID = bibEditInterface.bib[0].entry_ids[index];\n\t\t\teditor.value = bibEditInterface.bib[1][index];\n\t\t\t_lastSelectedIndex = index;\n\t\t\t_lastSelectedItemID = itemID;\n\t\t\t_lastSelectedValue = editor.value;\n\t\t} else {\n\t\t\teditor.value = \"\";\n\t\t\t_lastSelectedIndex = _lastSelectedItemID = _lastSelectedValue = false;\n\t\t}\n\n\t\t_revertAllButton.disabled = !bibEditInterface.isAnyEdited();\n\t}", "title": "" }, { "docid": "1f869d5773e4dea776215e4de871200a", "score": "0.5508196", "text": "function isUpdated() {\n return $timeout(function() {\n return $scope.options;\n });\n }", "title": "" }, { "docid": "125e14cb6d36f64cde4e26d9032f056b", "score": "0.55038524", "text": "updateMode (mode) {\n this.state.mode = mode;\n\n this.emitChange();\n }", "title": "" }, { "docid": "29a910b1da6ba40a82b32a3d26f90e8e", "score": "0.54946697", "text": "function optionsChanged(newObj) {\n // If there is still data to load, don't save yet.\n // Loading new data can cause subscription updates\n if (left_to_load != 0) {\n return;\n }\n // If already planning to save, just reset timer\n if (saveTimer) {\n clearTimeout(saveTimer);\n saveTimer = setTimeout(putData, saveDelay);\n }\n else {\n // Need to make a timer, so we don't save on every keystroke\n saveTimer = setTimeout(putData, saveDelay);\n $('#saved-alert')[0].style.display = 'none';\n $('#unsaved-alert').fadeIn(150);\n }\n }", "title": "" }, { "docid": "f4ec6525498964b3c4678a66d3114306", "score": "0.5493605", "text": "edit() {\n this.switchEditMode(true);\n }", "title": "" }, { "docid": "2d891cd54e7efe0e617e510fd98f3bcb", "score": "0.5485584", "text": "function updateOptions() {\n /*jshint validthis:true */\n var propValue = this.getValue();\n var value = propValue != null ? propValue : this.state.value;\n var options = this.getDOMNode().options;\n var selectedValue = '' + value;\n\n for (var i = 0, l = options.length; i < l; i++) {\n var selected = this.props.multiple ?\n selectedValue.indexOf(options[i].value) >= 0 :\n selected = options[i].value === selectedValue;\n\n if (selected !== options[i].selected) {\n options[i].selected = selected;\n }\n }\n}", "title": "" }, { "docid": "79c9f5d99649b5b576e9c43a3e0243ed", "score": "0.54829293", "text": "componentDidUpdate(prevProps, prevState) {\n // save the data!\n // if the previous state is not the same, then save the data\n if(prevState.options.length !== this.state.options.length) {\n const json = JSON.stringify(this.state.options);\n localStorage.setItem('options', json); // save in the localStorage only when data changes.\n } \n }", "title": "" }, { "docid": "1aa2cdb2d7c383736f039857b8b29c87", "score": "0.5482907", "text": "updated() { }", "title": "" }, { "docid": "1aa2cdb2d7c383736f039857b8b29c87", "score": "0.5482907", "text": "updated() { }", "title": "" }, { "docid": "32c259de2c9040a561df1990b81adb0c", "score": "0.54802936", "text": "function goUpdateGlobalEditMenuItems()\n{\n // Don't bother updating the edit commands if they aren't visible in any way\n // (i.e. the Edit menu isn't open, nor is the context menu open, nor have the\n // cut, copy, and paste buttons been added to the toolbars) for performance.\n // This only works in applications/on platforms that set the gEditUIVisible\n // flag, so we check to see if that flag is defined before using it.\n if (typeof gEditUIVisible != \"undefined\" && !gEditUIVisible)\n return;\n\n goUpdateCommand(\"cmd_undo\");\n goUpdateCommand(\"cmd_redo\");\n goUpdateCommand(\"cmd_cut\");\n goUpdateCommand(\"cmd_copy\");\n goUpdateCommand(\"cmd_paste\");\n goUpdateCommand(\"cmd_selectAll\");\n goUpdateCommand(\"cmd_delete\");\n goUpdateCommand(\"cmd_switchTextDirection\");\n}", "title": "" }, { "docid": "4bbde5c198a971d8624a46b0f54663a6", "score": "0.5471504", "text": "_stateChanged(state) {\n this.selectedHokken = state.selectedHokken;\n }", "title": "" }, { "docid": "d21f9ca5b8a981da558a8a63fda56929", "score": "0.5465892", "text": "function restore_options() {\n\n}", "title": "" } ]
330a64ccbe3246e65bc5a16a0bad4eee
Get the marks that would be added to text at the current selection.
[ { "docid": "fab1a6417638d5f0799566cf71185e82", "score": "0.751387", "text": "marks(editor) {\n var {\n marks,\n selection\n } = editor;\n\n if (!selection) {\n return null;\n }\n\n if (marks) {\n return marks;\n }\n\n if (Range.isExpanded(selection)) {\n var [match] = Editor.nodes(editor, {\n match: Text.isText\n });\n\n if (match) {\n var [_node] = match;\n\n var _rest = _objectWithoutProperties(_node, [\"text\"]);\n\n return _rest;\n } else {\n return {};\n }\n }\n\n var {\n anchor\n } = selection;\n var {\n path\n } = anchor;\n var [node] = Editor.leaf(editor, path);\n\n if (anchor.offset === 0) {\n var prev = Editor.previous(editor, {\n at: path,\n match: Text.isText\n });\n var block = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n)\n });\n\n if (prev && block) {\n var [prevNode, prevPath] = prev;\n var [, blockPath] = block;\n\n if (Path.isAncestor(blockPath, prevPath)) {\n node = prevNode;\n }\n }\n }\n\n var rest = _objectWithoutProperties(node, [\"text\"]);\n\n return rest;\n }", "title": "" } ]
[ { "docid": "25b96836cab73be9ee499b47048d0645", "score": "0.6521697", "text": "get selectionOfInterest() {\n if (!this.selection_.length && this.highlight_.length)\n return this.highlight_;\n return this.selection_;\n }", "title": "" }, { "docid": "25b96836cab73be9ee499b47048d0645", "score": "0.6521697", "text": "get selectionOfInterest() {\n if (!this.selection_.length && this.highlight_.length)\n return this.highlight_;\n return this.selection_;\n }", "title": "" }, { "docid": "88b6a180e610541c81b1674a39c22fd1", "score": "0.63630587", "text": "function mark() {\n var editor = EditorManager.getCurrentFullEditor(),\n results = editor.getSelections(),\n cm = editor._codeMirror,\n start, end;\n\n results.forEach(function (position) {\n start = position.start;\n end = position.end;\n cm.markText(start, end, {\n className: 'xie-marker'\n });\n });\n }", "title": "" }, { "docid": "4cdd932cdce2c139e58bd107a2b1d653", "score": "0.60937506", "text": "function highlightedText() {\n try {\n if (window.ActiveXObject) {\n var c = document.selection.createRange();\n return c.htmlText;\n }\n \n var nNd = document.createElement(\"span\");\n nNd.setAttribute(\"id\", \"answer\");\n var w = getSelection().getRangeAt(0);\n w.surroundContents(nNd);\n return nNd.innerHTML;\n } catch (e) {\n if (window.ActiveXObject) {\n return document.selection.createRange();\n } else {\n return getSelection();\n }\n }\n }", "title": "" }, { "docid": "54fd32f6c9d2d97e5c3c98b00d37a964", "score": "0.60503036", "text": "function getSelectionInfo() {\n let doc = window.document;\n let sel = doc.selection, range, rects, rect;\n let x = 0, y = 0, text ='';\n // find x and y coordinates of selection and text of selection\n if (sel) {\n if (sel.type == \"Text\") {\n range = sel.createRange();\n text = range.text;\n range.collapse(true);\n x = range.boundingLeft;\n y = range.boundingTop;\n }\n } else if (typeof window.getSelection != \"undefined\") {\n sel = window.getSelection();\n text = sel.toString();\n if (text != '' && sel.rangeCount) {\n range = sel.getRangeAt(0).cloneRange();\n if (range.getClientRects) {\n range.collapse(true);\n rects = range.getClientRects();\n if (rects.length > 0) {\n rect = rects[0];\n }\n x = rect.left;\n y = rect.top;\n }\n // Fall back to inserting a temporary element\n if (x == 0 && y == 0) {\n var span = doc.createElement(\"span\");\n if (span.getClientRects) {\n // Ensure span has dimensions and position by\n // adding a zero-width space character\n span.appendChild( doc.createTextNode(\"\\u200b\") );\n range.insertNode(span);\n rect = span.getClientRects()[0];\n x = rect.left;\n y = rect.top;\n var spanParent = span.parentNode;\n spanParent.removeChild(span);\n\n // Glue any broken text nodes back together\n spanParent.normalize();\n }\n }\n }\n }\n // if use selected multiple words, extract the first word\n if(text != '')\n {\n text = (text.split(/\\W/)[0]).trim();\n }\n\n return { x,y,text };\n}", "title": "" }, { "docid": "15463e72483786cd6bd39dd1516df6fd", "score": "0.60269165", "text": "getSelectedText() {\n return this.selection.getRangeAt(0).toString();\n }", "title": "" }, { "docid": "8076fb9e10ace04807555fa276ccd5f8", "score": "0.6007923", "text": "function attachMarks(d) {\n d.mark = select(this.parentNode).datum();\n select(this).select('text').attr(d.mark.attributes);\n }", "title": "" }, { "docid": "f13883de8731d28f3a4837f124b66b5a", "score": "0.5875057", "text": "function saveTextAsMark() {\r\n let mark = \"\"\r\n for(let cell of document.querySelectorAll(\".cell\")) {\r\n let mirror = cell.editor.CodeMirror\r\n mark += mirror.getValue() + \"\\n<br>\\n\"\r\n }\r\n return mark\r\n}", "title": "" }, { "docid": "bc525d76430cd530187c0e6d900eb661", "score": "0.5732597", "text": "function getCurrentSelectedText()\n{\n\tvar currentSelection = \"\";\n\n\tvar sel = window.getSelection();\n\tif (sel.rangeCount) \n\t{\n\t\tfor (var i = 0, len = sel.rangeCount; i < len; ++i) \n\t\t{\n\t\t\tcurrRange = sel.getRangeAt(i);\n\t\t\tcurrentSelection += sel.getRangeAt(i).toString();\n\t\t}\n\t}\n \n\treturn currentSelection.replace(/\\n/g,\"\");\n}", "title": "" }, { "docid": "88c04bbd174e42e8440c6be8841565af", "score": "0.56122077", "text": "function getMarkToRender(props){// find index of mark we were asked to render\nvar requestedMarkIndex=getRenderIndexOfMark(props);// render the mark that would be at that index if unhandled marks were removed\nreturn getHandledMarkAtIndex(props,requestedMarkIndex);}", "title": "" }, { "docid": "a6e5795b56b865a4824f7f0377d48216", "score": "0.55990314", "text": "function getMarkArray(marks) {\n if (!marks || marks == \"-\") return [];\n let markArray = ArrayFun.init(V.size.x, V.size.y, false);\n const squares = marks.split(\",\");\n for (let i = 0; i < squares.length; i++) {\n const coords = V.SquareToCoords(squares[i]);\n markArray[coords.x][coords.y] = true;\n }\n return markArray;\n}", "title": "" }, { "docid": "d698870c933fe2f8d07f95a8b35ec6a7", "score": "0.5581842", "text": "function returnSpans(selText){\n var spanArray = [];\n var spanLineArray = [];\n var rangeObject = $(selText.getRangeAt(0));\n // var startSpan = rangeObject.attr(\"startContainer\").parentNode;\n // var endSpan = rangeObject.attr(\"endContainer\").parentNode;\n var startSpan = rangeObject.attr(\"startContainer\");\n var endSpan = rangeObject.attr(\"endContainer\");\n var startLine = startSpan.parentNode.parentNode; // table row\n var endLine = endSpan.parentNode.parentNode;\n // collect all parent items in an array\n var linesList = [];\n var currentSpan = startSpan;\n console.log(rangeObject);\n var currentLine = startLine;\n if (currentSpan != null){\n do {\n // go through all the lines in the collection until the end\n // of the selection is reached.\n linesList.push(currentLine);\n var lineEndSpan = currentLine.lastChild.lastChild;\n var tempSpanLine = [];\n do {\n // In each line, go over all the spans until the end of\n // the selection is reached.\n spanArray.push(currentSpan);\n tempSpanLine.push(currentSpan);\n if (currentSpan == endSpan) {\n break;\n }\n var prevSib = currentSpan;\n currentSpan = currentSpan.nextSibling;\n // Even if the last span of the current line is reached,\n // the above process must be performed. So check for the\n // \"previous sibling\" of the current span. If that is\n // equal to the last span in the line, then break the\n // loop.\n } while (prevSib != lineEndSpan);\n // create an organized array of spans, linewise\n spanLineArray.push(tempSpanLine);\n var prevLine = currentLine;\n if (currentLine != endLine){\n currentLine = currentLine.nextSibling;\n }\n var lineStartSpan = currentLine.lastChild.firstChild;\n currentSpan = lineStartSpan;\n // the same logic as above (with the previous sibling at the\n // span-level) applies to the lines.\n } while (prevLine != endLine);\n }\n return [spanArray, linesList, spanLineArray];\n}", "title": "" }, { "docid": "ade11e48c7107d031635bcf2f3d6b3de", "score": "0.55666983", "text": "function getSelectedText() { \r\nif (window.getSelection) return window.getSelection().toString();\r\n else if (document.getSelection) return document.getSelection();\r\n else if (document.selection) return document.selection.createRange().text; \r\n}", "title": "" }, { "docid": "c04bba3f9d338a28f3759aa4de4101bb", "score": "0.55603963", "text": "function getMarkedSpanFor(spans, marker) {\n\t\t if (spans) { for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.marker == marker) { return span }\n\t\t } }\n\t\t }", "title": "" }, { "docid": "0cd5943a25b40e14421ed7da8705a25b", "score": "0.55551463", "text": "function positionMark() {\n\t\t// _.forEach($collections, function(collection, i) {\n\t\t// \t$collection = $(collection);\n\t\t// \tcw = $collection.outerWidth();\n\t\t// \tch = $collection.outerHeight();\n\t\t// \tkw = cw/iw;\n\t\t// \tkh = ch/ih;\n\t\t// \tkc = cw/ch;\n\n\t\t// \tif(kc>=ki) {\n\t\t// \t\tk = kw;\n\t\t// \t} else {\n\t\t// \t\tk = kh;\n\t\t// \t}\n\n\t\t// \t$marks = $collection.find('.collection__item-mark');\n\t\t// \t_.forEach($marks, function(mark, i) {\n\t\t// \t\t$mark = $(mark);\n\t\t// \t\tmx = k*($mark.data('x')-iw/2);\n\t\t// \t\tmy = k*($mark.data('y')-ih/2);\n\t\t// \t\tif(mx < -cw/2 + mmargin) {\n\t\t// \t\t\tmx = -cw/2 + mmargin;\n\t\t// \t\t} else if(mx > cw/2 - mmargin) {\n\t\t// \t\t\tmx = cw/2 - mmargin;\n\t\t// \t\t}\n\t\t// \t\tif(my < -ch/2 + mmargin) {\n\t\t// \t\t\tmy = -ch/2 + mmargin;\n\t\t// \t\t} else if(my > ch/2 - mmargin) {\n\t\t// \t\t\tmy = ch/2 - mmargin;\n\t\t// \t\t}\n\n\t\t// \t\ttranslate = 'translate(' + mx + 'px, ' + my + 'px)'; \n\t\t// \t\t$mark.css({\n\t\t// \t\t\t'-webkit-transform': translate,\n\t\t// \t\t\t '-moz-transform': translate,\n\t\t// \t\t\t '-ms-transform': translate,\n\t\t// \t\t\t '-o-transform': translate,\n\t\t// \t\t\t 'transform': translate\n\t\t// \t\t})\n\t\t// \t});\n\t\t// });\n\n\t\tvar $marks = $('.collection__item-mark');\n\t\t_.forEach($marks, function(mark, i) {\n\t\t\t$mark = $(mark);\n\t\t\tmx = (100*$mark.data('x')/iw).toPrecision(4);\n\t\t\tmy = (100*$mark.data('y')/ih).toPrecision(4);\n\t\t\t$mark.css({\n\t\t\t\ttop: mx + '%',\n\t\t\t\tleft: my + '%',\n\t\t\t})\n\t\t});\n\t}", "title": "" }, { "docid": "adbe9f74ea46f04c15791b97706151c3", "score": "0.554466", "text": "function markify (text) {\n const { mark } = tags\n return text\n .split(/<\\/?mark>/g)\n .map((el, i) => i % 2 ? mark(el) : el)\n}", "title": "" }, { "docid": "bbb370b20d78021ea746cf5a02a477d6", "score": "0.5507829", "text": "function getMarkedSpanFor(spans, marker) {\n\t if (spans) {\n\t for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) {\n\t return span;\n\t }\n\t }\n\t }\n\t }", "title": "" }, { "docid": "2190aada4d19c14576ac575fc6b68ba9", "score": "0.5472115", "text": "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "title": "" }, { "docid": "2190aada4d19c14576ac575fc6b68ba9", "score": "0.5472115", "text": "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "title": "" }, { "docid": "2190aada4d19c14576ac575fc6b68ba9", "score": "0.5472115", "text": "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "title": "" }, { "docid": "5c1da60c5a4c791f21a1d9fbe930a636", "score": "0.54700685", "text": "function getSelectionDetails(selectionRange) {\n // const selectionRange = selection.getRangeAt(0);\n // obtain selection start and end positions\n const selectionStart = selectionRange.startOffset;\n const selectionEnd = selectionRange.endOffset;\n const selectionContainerLength = selectionRange.commonAncestorContainer.length;\n console.log(\"raw selection\", selectionRange);\n\n // obtain previous and next annotation siblings for RELATIONAL position gathering [Should eventuall be gathered into separate previousAnnotation and nextAnnotation objects]\n\n // check if previous node exists, then collect annotation node details\n const previousAnnoNode = selectionRange.commonAncestorContainer.previousElementSibling\n ? getNodeDetails(selectionRange.commonAncestorContainer.previousElementSibling)\n : null;\n console.log(\"previousAnnoNode: \", previousAnnoNode);\n\n // check if next node exists, then collect annotation node details\n const nextAnnoNode = selectionRange.commonAncestorContainer.nextElementSibling\n ? getNodeDetails(selectionRange.commonAncestorContainer.nextElementSibling)\n : null;\n console.log(\"nextAnnoNode: \", nextAnnoNode);\n\n // if previous node exists, use it for new anno positioning calculation, if not try the next node.\n // if neither, use original selection positioning\n const newAnnoStartPosition = previousAnnoNode ? previousAnnoNode.endPosition + selectionStart + 1 // previous\n : selectionStart; // original selection (non-comparative, in case of no previous/any annotations)\n console.log(\"new anno start: \", newAnnoStartPosition);\n\n const newAnnoEndPosition = previousAnnoNode ? newAnnoStartPosition + (selectionEnd - selectionStart) - 1 // previous\n : selectionEnd - 1;\n console.log(\"new anno end: \", newAnnoEndPosition);\n\n const newAnnoIndex = previousAnnoNode ? previousAnnoNode.arrayElementIndex // insert/splice into annotations array at current index\n : nextAnnoNode ? nextAnnoNode.arrayElementIndex + 1 // place after other annotations\n : 0; // no surrounding nodes (unshift to annotations)\n\n // temporary div to capture exact contents including children span nodes\n const tempDiv = document.createElement(\"div\");\n tempDiv.appendChild(selectionRange.cloneContents());\n console.log(\"tempDiv\", tempDiv);\n\n const selectionHtml = tempDiv.innerHTML;\n\n console.log(\"selection HTML: \", selectionHtml);\n\n // return a detailed selection object\n return { selectionStart, selectionEnd, newAnnoIndex, tempDiv, selectionHtml, newAnnoStartPosition, newAnnoEndPosition }\n }", "title": "" }, { "docid": "66eb5f29a085fa0550473910d1aeec69", "score": "0.545335", "text": "getSelectedAnnotations () {\n return this.getAllAnnotations().filter(a => a.selected)\n }", "title": "" }, { "docid": "66eb5f29a085fa0550473910d1aeec69", "score": "0.545335", "text": "getSelectedAnnotations () {\n return this.getAllAnnotations().filter(a => a.selected)\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "e2b80c9e45075f5e6be3b37e83817147", "score": "0.5452649", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "76d7a1cb96d3b0787fddaebb96cd0ccf", "score": "0.54496604", "text": "function getMarkedSpanFor(spans, marker) {\r\n if (spans) { for (var i = 0; i < spans.length; ++i) {\r\n var span = spans[i]\r\n if (span.marker == marker) { return span }\r\n } }\r\n}", "title": "" }, { "docid": "7e371e1bcda84a818826e43931e61576", "score": "0.54492325", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "title": "" }, { "docid": "501129d0c47e311d23a8dae20e242ac9", "score": "0.5431207", "text": "function renderMark(name) {\n for (var ii = 0; ii < MarkNodes.length; ii++) {\n for (var jj = 0; jj < MarkNodes[ii].Marks.length; jj++) {\n var mark = MarkNodes[ii].Marks[jj];\n if (mark.Name === 'text' && mark.Value === name) {\n MarkNodes[ii].Node.innerHTML = Mark.get(name);\n } else if (mark.Name === 'value' && mark.Value === name) {\n MarkNodes[ii].Node.value = Mark.get(name);\n } else if (mark.Name === 'check' && mark.Value === name) {\n MarkNodes[ii].Node.checked = Mark.get(name);\n }\n\n }\n }\n }", "title": "" }, { "docid": "bd2d15a35da41a6c5102c875f41ce883", "score": "0.54236764", "text": "function geSelectionText() {\n let selectedText = \"\";\n if (window.getSelection) {\n selectedText = window.getSelection().toString();\n }\n return selectedText;\n}", "title": "" }, { "docid": "d0c0b26a004ed3cb02fa674ac2046c37", "score": "0.5397815", "text": "getStudentMark(idStudent) {\n return this[STUDENT_MARKS].get(idStudent);\n }", "title": "" }, { "docid": "8e82637baa24a865053b2717cb074c1f", "score": "0.53975123", "text": "function getMarkedSpanFor(spans, marker) {\n\t if (spans) { for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i]\n\t if (span.marker == marker) { return span }\n\t } }\n\t}", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "1dfffb768b9def345d4adcbce9b26914", "score": "0.5392467", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "04d2e3ceb670eb2176eb5f034d831d16", "score": "0.5390693", "text": "function getSelectedText() {\n var text = \"\";\n if (typeof window.getSelection != \"undefined\") {\n text = window.getSelection().toString();\n } else if (typeof document.selection != \"undefined\" && document.selection.type == \"Text\") {\n text = document.selection.createRange().text;\n }\n console.log(text);\n return text;\n }", "title": "" }, { "docid": "922962260d4b55546ae341cbe68c758c", "score": "0.5380389", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i]\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "922962260d4b55546ae341cbe68c758c", "score": "0.5380389", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i]\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "d7494c89b3eed00ea20238a51f03fe13", "score": "0.5379412", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}", "title": "" }, { "docid": "35edc7d839fd938f2d0cb1b37640fe6b", "score": "0.537907", "text": "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "title": "" }, { "docid": "b696ad1b2e6cf69027e1d36203b35fd2", "score": "0.5373592", "text": "function getHighlightCoords() {\n let pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1; \n let page = PDFViewerApplication.pdfViewer.getPageView(pageIndex);\n let pageRect = page.canvas.getClientRects()[0];\n let selectionRects = window.getSelection().getRangeAt(0).getClientRects();\n let viewport = page.viewport;\n let selected = [];\n console.log(`pageRect: `,pageRect);\n console.log(`selectionRects: `,selectionRects);\n for (let r of selectionRects) {\n console.log(r);\n selected.push(viewport.convertToPdfPoint(r.left - pageRect.left, r.top - pageRect.top).concat(\n viewport.convertToPdfPoint(r.right - pageRect.left, r.bottom - pageRect.top))); \n };\n return {page: pageIndex, coords: selected};\n}", "title": "" }, { "docid": "b728906ea0e14024b154c3f5b37caace", "score": "0.53651357", "text": "get_pencil() {\n\t\treturn this.pencilMarks;\n\t}", "title": "" }, { "docid": "2f2be7fd55f96ffca24e21e97d8be4d2", "score": "0.53520954", "text": "function getSelectedText(){\n\tselected = editor.getSelection(); //Gets the start index and length of text currently selected in the editor\n\ttext = editor.getText(selected.index, selected.length); //Get the text corresponding to that start index and length\n\treturn text;\n}", "title": "" }, { "docid": "12819e8cf8f00a96523fe24fc47b1217", "score": "0.5322469", "text": "function getSelection(part) {\n var pos = this.value.length;\n\n // Work out the selection part.\n part = (part.toLowerCase() == 'start' ? 'Start' : 'End');\n\n if (document.selection) {\n // The current selection\n var range = document.selection.createRange(), stored_range, selectionStart, selectionEnd;\n // We'll use this as a 'dummy'\n stored_range = range.duplicate();\n // Select all text\n //stored_range.moveToElementText( this );\n stored_range.expand('textedit');\n // Now move 'dummy' end point to end point of original range\n stored_range.setEndPoint('EndToEnd', range);\n // Now we can calculate start and end points\n selectionStart = stored_range.text.length - range.text.length;\n selectionEnd = selectionStart + range.text.length;\n return part == 'Start' ? selectionStart : selectionEnd;\n }\n\n else if (typeof (this['selection' + part]) != \"undefined\") {\n pos = this['selection' + part];\n }\n return pos;\n }", "title": "" }, { "docid": "c7e0e6764ee7ae36a7a7b9cf907d82d1", "score": "0.53200793", "text": "getStudentMarks() {\n let gtArray = GradedTask.getStudentMarks(this.getId()).reverse();\n return gtArray.slice(0, context.showNumGradedTasks);\n }", "title": "" }, { "docid": "8a419a97cc3f225aa89d8bdcb34e0ec2", "score": "0.53191215", "text": "function Selection () {\n\n // from https://stackoverflow.com/a/4812022/999162\n var setSelectionByCharacterOffsets = null;\n\n if (window.getSelection && document.createRange) {\n setSelectionByCharacterOffsets = function (containerEl, start, end) {\n var charIndex = 0,\n range = document.createRange();\n range.setStart(containerEl, 0);\n range.collapse(true);\n var nodeStack = [containerEl],\n node, foundStart = false,\n stop = false;\n\n while (!stop && (node = nodeStack.pop())) {\n if (node.nodeType == 3) {\n var nextCharIndex = charIndex + node.length;\n if (!foundStart && start >= charIndex && start <= nextCharIndex) {\n range.setStart(node, start - charIndex);\n foundStart = true;\n }\n if (foundStart && end >= charIndex && end <= nextCharIndex) {\n range.setEnd(node, end - charIndex);\n stop = true;\n }\n charIndex = nextCharIndex;\n } else {\n var i = node.childNodes.length;\n while (i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n }\n\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n };\n } else if (document.selection) {\n setSelectionByCharacterOffsets = function (containerEl, start, end) {\n var textRange = document.body.createTextRange();\n textRange.moveToElementText(containerEl);\n textRange.collapse(true);\n textRange.moveEnd(\"character\", end);\n textRange.moveStart(\"character\", start);\n textRange.select();\n };\n }\n\n\n // From https://stackoverflow.com/a/4812022/999162\n function getCaretCharacterOffsetWithin(element) {\n var caretOffset = 0;\n var doc = element.ownerDocument || element.document;\n var win = doc.defaultView || doc.parentWindow;\n var sel;\n if (typeof win.getSelection != \"undefined\") {\n sel = win.getSelection();\n if (sel.rangeCount > 0) {\n var range = win.getSelection().getRangeAt(0);\n var preCaretRange = range.cloneRange();\n preCaretRange.selectNodeContents(element);\n preCaretRange.setEnd(range.endContainer, range.endOffset);\n caretOffset = preCaretRange.toString().length;\n }\n } else if ((sel = doc.selection) && sel.type != \"Control\") {\n var textRange = sel.createRange();\n var preCaretTextRange = doc.body.createTextRange();\n preCaretTextRange.moveToElementText(element);\n preCaretTextRange.setEndPoint(\"EndToEnd\", textRange);\n caretOffset = preCaretTextRange.text.length;\n }\n return caretOffset;\n }\n\n return {\n setCaret: setSelectionByCharacterOffsets,\n getCaret: getCaretCharacterOffsetWithin\n };\n\n}", "title": "" }, { "docid": "baf2c73ef732a86cf2a47338f37f62f4", "score": "0.5294173", "text": "function setupMarking() {\n let mouseDown = false;\n let start = 0;\n let pos2 = 0;\n function getClosestDataPoint(x) {\n let closestIndex = 0;\n let lastDistance = Number.MAX_VALUE;\n let distance = 0;\n for (let i = 0; i < dataPoints.length; i++) {\n distance = Math.abs(x - dataPoints[i].x);\n if (distance < lastDistance) {\n closestIndex = i;\n } else {\n break;\n }\n lastDistance = distance;\n }\n return closestIndex;\n }\n function drawSelection() {\n g.fillStyle = \"rgba(0, 150, 255, 0.5)\";\n that.clear();\n g.beginPath();\n g.fillRect(dataPoints[start].x, 0, dataPoints[pos2].x - dataPoints[start].x, g.canvas.height);\n that.draw(false);\n }\n canvas.addEventListener(\"mousedown\", function(e) {\n if (markedHandler != null && (e.button === 0 || e.button === 1)) {\n let mouseX = e.clientX - e.currentTarget.getBoundingClientRect().left;\n e.preventDefault();\n start = getClosestDataPoint(mouseX);\n mouseDown = true;\n pos2 = getClosestDataPoint(mouseX);\n drawSelection();\n markedHandler(Math.min(start, pos2), Math.max(start, pos2), dataPoints);\n }\n });\n canvas.addEventListener(\"mouseup\", function(e) {\n if (markedHandler != null && (e.button === 0 || e.button === 1)) {\n let mouseX = e.clientX - e.currentTarget.getBoundingClientRect().left;\n e.preventDefault();\n mouseDown = false;\n pos2 = getClosestDataPoint(mouseX);\n if (start === pos2) {\n that.draw();\n markedHandler(-1, -1, null);\n } else {\n drawSelection();\n markedHandler(Math.min(start, pos2), Math.max(start, pos2), dataPoints);\n }\n }\n });\n canvas.addEventListener(\"mousemove\", function(e) {\n if (markedHandler != null) {\n if (mouseDown) {\n let mouseX = e.clientX - e.currentTarget.getBoundingClientRect().left;\n pos2 = getClosestDataPoint(mouseX);\n drawSelection();\n markedHandler(Math.min(start, pos2), Math.max(start, pos2), dataPoints);\n }\n }\n });\n window.addEventListener(\"resize\", function() {\n if (markedHandler != null) markedHandler(-1, -1, null);\n });\n canvas.addEventListener(\"mouseleave\", function() {\n mouseDown = false;\n });\n }", "title": "" }, { "docid": "2c711e1b80cac41618c9c0b971fa3a26", "score": "0.52929777", "text": "function getSupportedMark(channel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n\n // falls through\n\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return {\n point: 'always',\n geoshape: 'always'\n };\n case TEXT$1:\n return {\n text: 'always'\n };\n case ANGLE:\n return {\n point: 'always',\n square: 'always',\n text: 'always'\n };\n case URL:\n return {\n image: 'always'\n };\n case THETA:\n return {\n text: 'always',\n arc: 'always'\n };\n case RADIUS:\n return {\n text: 'always',\n arc: 'always'\n };\n case THETA2:\n case RADIUS2:\n return {\n arc: 'always'\n };\n }\n }", "title": "" }, { "docid": "b04db8eba911e051373a75eb4f2b4cba", "score": "0.5289639", "text": "function getSelectionText() {\r\n \r\n\t\tvar mText = \"\";\r\n\t\tif (window.getSelection) {\r\n\t\t\tmText = window.getSelection().toString();\r\n\t\t} else if (document.selection && document.selection.type != \"Control\") {\r\n\t\t\tmText = document.selection.createRange().text;\r\n\t\t}\r\n\t return mText; \r\n\t /*\r\n\t\tvar textarea = textInput;\r\n\t\tvar start = textarea.selectionStart;\r\n\t\tvar end = textarea.selectionEnd;\r\n\t\tvar sel = textarea.value.substring(start, end);\r\n\t\treturn sel;*/\r\n }", "title": "" }, { "docid": "c6788d505349328a8cc71b53a560d7b9", "score": "0.52846503", "text": "function getSelectedText() {\n var selection = DocumentApp.getActiveDocument().getSelection();\n if (selection) {\n var text = [];\n var elements = selection.getSelectedElements();\n for (var i = 0; i < elements.length; i++) {\n if (elements[i].isPartial()) {\n var element = elements[i].getElement().asText();\n var startIndex = elements[i].getStartOffset();\n var endIndex = elements[i].getEndOffsetInclusive();\n\n text.push(element.getText().substring(startIndex, endIndex + 1));\n } else {\n var element = elements[i].getElement();\n // only include text elements in selection\n if (element.editAsText) {\n var elementText = element.asText().getText();\n // remove images, which appear as blank text elements\n if (elementText != '') {\n text.push(elementText);\n }\n }\n }\n }\n if (text.length == 0) {\n throw 'Please select some text.';\n }\n return text;\n } else {\n throw 'Please select some text.';\n }\n}", "title": "" }, { "docid": "3a0df6c9a40f1c0e20394528d48b6817", "score": "0.5276226", "text": "function getSelection() {\n try {\n var editor = EditorManager.getCurrentFullEditor();\n var selection = editor.getSelectedText();\n if (selection !== '') {\n return encodeSelection(selection);\n } else {\n throw 'NO_SELECTION';\n }\n } catch (e) {\n console.error(e);\n }\n }", "title": "" }, { "docid": "2791f5cd03a40e82fd53d667c4139863", "score": "0.5269041", "text": "function get() {\n var selection = '';\n\n if (editor.win.getSelection) {\n selection = editor.win.getSelection();\n } else if (editor.doc.getSelection) {\n selection = editor.doc.getSelection();\n } else {\n selection = editor.doc.selection.createRange();\n }\n\n return selection;\n }", "title": "" }, { "docid": "06e19a96a8140617f2bf30f6450c47e0", "score": "0.5264913", "text": "function getSelection( part ){\n var pos = this.value.length;\n \n // Work out the selection part.\n part = ( part.toLowerCase() == 'start' ? 'Start' : 'End' );\n \n if( document.selection ){\n // The current selection\n var range = document.selection.createRange(), stored_range, selectionStart, selectionEnd;\n // We'll use this as a 'dummy'\n stored_range = range.duplicate();\n // Select all text\n //stored_range.moveToElementText( this );\n stored_range.expand('textedit');\n // Now move 'dummy' end point to end point of original range\n stored_range.setEndPoint( 'EndToEnd', range );\n // Now we can calculate start and end points\n selectionStart = stored_range.text.length - range.text.length;\n selectionEnd = selectionStart + range.text.length;\n return part == 'Start' ? selectionStart : selectionEnd;\n }\n \n else if(typeof(this['selection'+part])!=\"undefined\"){\n pos = this['selection'+part];\n }\n return pos;\n }", "title": "" }, { "docid": "f92da98a315e3daf948d353a63c9f63a", "score": "0.52630484", "text": "function getSentences(selectedText) {\n return selectedText.trim().split(/[\\.\\?\\!]\\s/).map(Function.prototype.call, String.prototype.trim);\n }", "title": "" }, { "docid": "d1e6eff4f78620ebfe4599de22918502", "score": "0.52563256", "text": "function mark() {\n var ps = [], // Parenthesis\n sbs = [], // SquareBracket\n cbs = [], // CurlyBracket\n t;\n\n for (var i = 0; i < tokens.length; i++) {\n t = tokens[i];\n switch(t.type) {\n case TokenType.LeftParenthesis:\n ps.push(i);\n break;\n case TokenType.RightParenthesis:\n if (ps.length) {\n t.left = ps.pop();\n tokens[t.left].right = i;\n }\n break;\n case TokenType.LeftSquareBracket:\n sbs.push(i);\n break;\n case TokenType.RightSquareBracket:\n if (sbs.length) {\n t.left = sbs.pop();\n tokens[t.left].right = i;\n }\n break;\n case TokenType.LeftCurlyBracket:\n cbs.push(i);\n break;\n case TokenType.RightCurlyBracket:\n if (cbs.length) {\n t.left = cbs.pop();\n tokens[t.left].right = i;\n }\n break;\n }\n }\n }", "title": "" }, { "docid": "371db1892857d50db21407bc675f9f7e", "score": "0.5251767", "text": "function highlightSelection(e) \n{\n selection = window.getSelection();\n \n // Clear all highlights if requested\n if (clearBetweenSelections)\n {\n clearHighlightsOnPage();\n }\n \n //Skip this section if mouse event is undefined\n if (e != undefined)\n {\n \n //Ignore right clicks; avoids odd behavior with CTRL key\n if (e.button == 2)\n {\n return;\n }\n\n //Exit if CTRL key is held while auto highlight is checked on\n if(imedBool && e.ctrlKey)\n {\n return;\n }\n \n //Exit if CTRL key not held and auto highlight is checked off\n if(!imedBool && !e.ctrlKey)\n {\n return;\n }\n }\n \n if (selection.anchorNode.nodeType != 3) {\n return;\n }\n \n var selectedText = selection.toString().replace(/^\\s+|\\s+$/g, \"\");\n var testText = selectedText.toLowerCase();\n \n //Exit if selection is whitespace or what was previously selected\n if (selectedText == '' || lastText == testText)\n {\n return;\n }\n \n if (selection.anchorNode.nodeType == 3 && selection.toString() != '') { // text node\n var mySpan = document.createElement(\"span\");\n var prevSpan = document.getElementById(\"mySelectedSpan\");\n if (prevSpan != null) {\n prevSpan.removeAttribute(\"id\");\n }\n mySpan.id = \"mySelectedSpan\";\n var range = selection.getRangeAt(0).cloneRange();\n range.surroundContents(mySpan);\n }\n \n //Perform highlighting\n localSearchHighlight(selectedText, singleSearch);\n \n //Store processed selection for next time this method is called\n lastText = testText;\n}", "title": "" }, { "docid": "cf3df1744df7c3517bd078a3205bedbc", "score": "0.5242845", "text": "function markPos(i) {\n return {x: 12 + i * 8, y: 12};\n}", "title": "" }, { "docid": "bab011ec5a233ae7cc2e351a721dcb9d", "score": "0.5242158", "text": "function getMark() {\n var initWidth = rect.getElementRect(el).width;\n var reloadMark = initWidth >= 600 ? 'pc' : 'phone';\n return reloadMark;\n }", "title": "" }, { "docid": "193c4f468597327003e43ca15f2023dd", "score": "0.5235648", "text": "getSelectedAnnotations () {\n return this.getAllAnnotations().filter(a => a.selected)\n }", "title": "" }, { "docid": "942dc5b640095bb00f26e95ca562ec16", "score": "0.52261555", "text": "function getSelText() {\n var selection = '';\n if (window.getSelection) {\n selection = window.getSelection();\n } else if (document.getSelection) {\n selection = document.getSelection();\n } else if (document.selection) {\n selection = document.selection.createRange().text;\n }\n if (selection.anchorNode) {\n range = document.createRange();\n range.setStart(selection.anchorNode, selection.anchorOffset);\n range.setEnd(selection.focusNode, selection.focusOffset);\n if (!range.commonAncestorContainer.innerHTML) {\n return range.commonAncestorContainer.textContent;\n } else {\n return range.commonAncestorContainer.innerHTML;\n }\n }\n return;\n}", "title": "" }, { "docid": "708db11ac37169d6fa486cfe70048648", "score": "0.52250767", "text": "get selectionStart() {\n return this.i.selectionStart;\n }", "title": "" }, { "docid": "72cb5c50fccfe863c03b302d462a89fa", "score": "0.52242184", "text": "getFormattedSelection() {\n return this.selectionSorted.length\n ? this.selectionSorted.map((optionEl) => {\n const text = optionEl.textContent;\n return text ? text.trim() : \"\";\n }).join(\", \")\n : \"\";\n }", "title": "" }, { "docid": "686307a24565272a772190885a9cbe6c", "score": "0.5219756", "text": "function getSelectedText() {\n\tif (window.getSelection)\n\t\treturn SelectedText = window.getSelection();\n\telse if (document.selection)\n\t\treturn SelectedText = document.selection.createRange().text;\n}", "title": "" }, { "docid": "d645d9b368edc8511bbe0f02b97f83fb", "score": "0.52177095", "text": "function getSelectedText(){\n if(window.getSelection)\n return window.getSelection().toString();\n else if(document.getSelection)\n return document.getSelection();\n else if(document.selection)\n return document.selection.createRange().text;\n return \"\";\n}", "title": "" }, { "docid": "d645d9b368edc8511bbe0f02b97f83fb", "score": "0.52177095", "text": "function getSelectedText(){\n if(window.getSelection)\n return window.getSelection().toString();\n else if(document.getSelection)\n return document.getSelection();\n else if(document.selection)\n return document.selection.createRange().text;\n return \"\";\n}", "title": "" }, { "docid": "f3b3d6177b7103eef077373ede856f9c", "score": "0.5196967", "text": "function _removeTextmarkers(editor) {\n editor = editor || EditorManager.getCurrentFullEditor();\n var allMarks = editor._codeMirror.doc.getAllMarks(),\n i,\n l;\n for (i = 0, l = allMarks.length; i < l; i++) {\n if (allMarks[i].className === Utils.CLASS_NAME) {\n allMarks[i].clear();\n }\n\n }\n }", "title": "" }, { "docid": "be5a0a0d62c789635266ddce129fdd8e", "score": "0.5189554", "text": "function selectedText(editor) {\r\n restoreRange(editor);\r\n if (ie) return getRange(editor).text;\r\n return getSelection(editor).toString();\r\n }", "title": "" }, { "docid": "c3369f602171151cf40fe1671377c44b", "score": "0.5188181", "text": "function saveMarkersToText(){\r\n\r\n\t\tvar features = [];\r\n\t\tmarkers.eachLayer( function(layer) {\r\n\t\t if(layer instanceof L.Marker) {\r\n\t\t\tif(markers.getBounds().contains(layer.getLatLng())) {\r\n\t\t\t features.push(layer.getLatLng());\r\n\t\t\t}\r\n\t\t }\r\n\t\t});\r\n\t\treturn(features);\r\n\t }", "title": "" }, { "docid": "31146ee366b624fe7c136c01f2c5feb1", "score": "0.51876765", "text": "function handleSelectionDisplay(line){\r\n\tvar lines = document.getElementsByClassName('element');\r\n\tvar i;\r\n\tfor (i = 0; i < lines.length; i++){\r\n\t\tlines[i].classList.remove('selection');\r\n\t}\r\n\r\n\tvar selectedLine = document.getElementsByClassName(line);\r\n\tfor (i = 0; i < selectedLine.length; i++){\r\n\t\tselectedLine[i].classList.add('selection'); \r\n\t}\r\n\r\n\treturn selectedLine[0].firstChild.firstChild.nodeValue;\r\n}", "title": "" }, { "docid": "6fbebc3d6ca8468228af7c2b7e49240d", "score": "0.5185118", "text": "function themerex_reviews_marks_to_display(mark) {\n\t\"use strict\";\n\tif (THEMEREX_GLOBALS['reviews_max_level'] < 100) {\n\t\tmark = Math.round(mark / 100 * THEMEREX_GLOBALS['reviews_max_level'] * 10) / 10;\n\t\tif (String(mark).indexOf('.') < 0) {\n\t\t\tmark += '.0';\n\t\t}\n\t}\n\treturn mark;\n}", "title": "" }, { "docid": "099db26555380fcbb70b5606aebb29e0", "score": "0.51772606", "text": "function selectedText(editor) {\n restoreRange(editor);\n if (ie) return getRange(editor).text;\n return getSelection(editor).toString();\n }", "title": "" }, { "docid": "4b04f5a1ed269724de75d6d9979927fe", "score": "0.5176449", "text": "highlightSelectedRange(editor) {\n const range = editor.getSelectedBufferRange();\n const marker = editor.markBufferRange(range, {invalidate: 'inside'});\n editor.decorateMarker(marker, {\n type: 'line',\n class: 'clang-expand-highlight'\n });\n\n return marker;\n }", "title": "" }, { "docid": "91ed66ae8f7f8eebc125c1f54621aa06", "score": "0.51746106", "text": "function getSel ()\n{\n\treturn afc( app.activeDocument, \"selection\" );\n}", "title": "" }, { "docid": "93e0824228b2aabc1fb45a2f05926d2f", "score": "0.517029", "text": "function getTextFromSelection (sel) {\n sel = sel || window.getSelection();\n var container;\n if (sel.rangeCount) {\n container = document.createElement('div');\n for (var i = 0, len = sel.rangeCount; i < len; ++i) {\n container.appendChild(sel.getRangeAt(i).cloneContents());\n }\n return container.innerText;\n }\n return '';\n}", "title": "" }, { "docid": "7a8237cdabf9e93efaa9fe27d71e3a55", "score": "0.51581395", "text": "function main(){\n if(app.selection.length != 0){\n mS = myDoc.selection[0];\n if(mS.constructor.name == \"Text\" || mS.constructor.name == \"Word\" || mS.constructor.name == \"TextStyleRange\"){\n //Check first and last character in string\n var str = mS.contents;\n mS.contents = toggleQuotes(str);\n\t\t\tapp.select(mS.characters[0],SelectionOptions.ADD_TO);\n }else{\n alert(app.activeDocument.selection[0].constructor.name+\"\\nPlease select some text\");\n exit();\n }\n }else{\n alert(\"Nothing selected\\nPlease select some text\");\n }\n}", "title": "" } ]